Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot] 2b2008a15b
Bump github.com/valyala/fasthttp from 1.2.0 to 1.34.0 2 years ago
  1. 239
      .github/workflows/hmybuild.yml
  2. 103
      .github/workflows/test-build.yml
  3. 6
      .gitignore
  4. 39
      Makefile
  5. 95
      README.md
  6. 6
      cmd/main.go
  7. 8
      cmd/subcommands/balance.go
  8. 14
      cmd/subcommands/blockchain.go
  9. 14
      cmd/subcommands/command.go
  10. 2
      cmd/subcommands/completion.go
  11. 6
      cmd/subcommands/custom-flags.go
  12. 2
      cmd/subcommands/delegation.go
  13. 99
      cmd/subcommands/ethtransfer.go
  14. 2
      cmd/subcommands/failures.go
  15. 29
      cmd/subcommands/governance.go
  16. 20
      cmd/subcommands/keys.go
  17. 39
      cmd/subcommands/root.go
  18. 38
      cmd/subcommands/staking.go
  19. 31
      cmd/subcommands/transfer.go
  20. 10
      cmd/subcommands/utility.go
  21. 2
      cmd/subcommands/validator.go
  22. 57
      cmd/subcommands/values.go
  23. 12
      go.mod
  24. 52
      go.sum
  25. 2
      pkg/account/account_test.go
  26. 6
      pkg/account/creation.go
  27. 4
      pkg/account/export.go
  28. 15
      pkg/account/import.go
  29. 8
      pkg/account/removal.go
  30. 2
      pkg/common/numeric.go
  31. 2
      pkg/common/store.go
  32. 10
      pkg/common/values.go
  33. 4
      pkg/console/bridge.go
  34. 89
      pkg/console/console.go
  35. 9
      pkg/console/hmy.go
  36. 6
      pkg/console/web3ext/web3ext.go
  37. 4
      pkg/governance/cli.go
  38. 41
      pkg/governance/eip712.go
  39. 6
      pkg/governance/signing.go
  40. 6
      pkg/governance/signing_test.go
  41. 114
      pkg/governance/types.go
  42. 20
      pkg/keys/bls.go
  43. 22
      pkg/keys/keys.go
  44. 2
      pkg/keys/mnemonic.go
  45. 10
      pkg/ledger/hw_wallet.go
  46. 30
      pkg/ledger/nano_S_driver.go
  47. 2
      pkg/rpc/eth/methods.go
  48. 6
      pkg/rpc/methods.go
  49. 2
      pkg/rpc/query.go
  50. 4
      pkg/rpc/v1/methods.go
  51. 8
      pkg/sharding/structure.go
  52. 16
      pkg/store/local.go
  53. 19
      pkg/transaction/controller.go
  54. 2
      pkg/transaction/errors.go
  55. 69
      pkg/transaction/ethcontroller.go
  56. 8
      pkg/transaction/transaction.go
  57. 17
      pkg/transaction/util.go
  58. 2
      pkg/validation/validation_test.go
  59. 70
      scripts/hmy-csv.py
  60. 20
      scripts/hmy.sh
  61. 4
      scripts/stress-test

@ -1,52 +1,70 @@
name: release wiki
name: release hmy
on:
push:
tags:
- v*
env:
GOPATH: ${{ github.workspace }}
GOBIN: ${{ github.workspace }}/bin
jobs:
build-x86_64:
name: Build wiki binary for x86_64
build-x8664:
name: Build hmy binary for Linux x8664
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-22.04, macos-latest ]
os: [ ubuntu-18.04 ]
steps:
- name: Checkout wiki code
uses: actions/checkout@v3
- name: Set up Go 1.16.5
uses: actions/setup-go@v2
with:
path: go-sdk
go-version: 1.16.5
- name: Set up Go
uses: actions/setup-go@v3
- name: Checkout hmy code
uses: actions/checkout@v2
with:
go-version-file: go-sdk/go.mod
path: go/src/github.com/harmony-one/go-sdk
- name: Debug
run: |
pwd
echo ${HOME}
echo ${GITHUB_WORKSPACE}
echo ${GOPATH}
echo ${GOROOT}
env:
GOPATH: /home/runner/work/go-sdk/go-sdk/go
- name: Checkout dependence repo
uses: actions/checkout@v3
uses: actions/checkout@v2
with:
repository: woop-chain/mcl
path: ${{ github.workspace }}/src/github.com/woop-chain/mcl
repository: harmony-one/mcl
path: go/src/github.com/harmony-one/mcl
env:
GOPATH: /home/runner/work/go-sdk/go-sdk/go
- name: Checkout dependence repo
uses: actions/checkout@v3
uses: actions/checkout@v2
with:
repository: woop-chain/bls
path: ${{ github.workspace }}/src/github.com/woop-chain/bls
repository: harmony-one/bls
path: go/src/github.com/harmony-one/bls
env:
GOPATH: /home/runner/work/go-sdk/go-sdk/go
- name: Checkout dependence code
uses: actions/checkout@v2
with:
repository: woop-chain/woop
path: ${{ github.workspace }}/src/github.com/woop-chain/woop
repository: harmony-one/harmony
path: go/src/github.com/harmony-one/harmony
ref: main
fetch-depth: 0
env:
GOPATH: /home/runner/work/go-sdk/go-sdk/go
- name: Get latest version and release
run: |
@ -54,49 +72,29 @@ jobs:
RELEASE=$(git describe --long | cut -f2 -d-)
echo "build_version=$VERSION" >> $GITHUB_ENV
echo "build_release=$RELEASE" >> $GITHUB_ENV
working-directory: go-sdk
- name: Debug
run: |
pwd
echo ${HOME}
echo ${GITHUB_WORKSPACE}
echo ${GOPATH}
echo ${GOROOT}
working-directory: /home/runner/work/go-sdk/go-sdk/go/src/github.com/harmony-one/go-sdk
env:
GOPATH: /home/runner/work/go-sdk/go-sdk/go
- name: Build wiki binary for Linux
if: matrix.os == 'ubuntu-22.04'
- name: Build hmy binary for Linux
if: matrix.os == 'ubuntu-18.04'
run: |
make static
working-directory: go-sdk
- name: Build libs for macos-latest
if: matrix.os == 'macos-latest'
run: |
brew install gmp
brew install openssl
sudo mkdir -p /opt/homebrew/opt/
sudo ln -sf /usr/local/opt/openssl@1.1 /opt/homebrew/opt/openssl@1.1
echo "ls -l /opt/homebrew/opt/openssl@1.1"; ls -l /opt/homebrew/opt/openssl@1.1
make libs
working-directory: ${{ github.workspace }}/src/github.com/woop-chain/woop
- name: Build wiki binary for macos-latest x86_64
if: matrix.os == 'macos-latest'
run: |
make all
mv dist/wiki dist/wiki-darwin-x86_64
working-directory: go-sdk
working-directory: /home/runner/work/go-sdk/go-sdk/go/src/github.com/harmony-one/go-sdk
env:
GOPATH: /home/runner/work/go-sdk/go-sdk/go
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: wiki
path: ${{ github.workspace }}/go-sdk/dist/*
name: hmy
path: /home/runner/work/go-sdk/go-sdk/go/src/github.com/harmony-one/go-sdk/dist/*
retention-days: 1
env:
GOPATH: /home/runner/work/go-sdk/go-sdk/go
# build-arm64:
# name: Build wiki binary
# name: Build hmy binary
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
@ -110,10 +108,10 @@ jobs:
# go-version: 1.16.5
# - name: Checkout wiki code
# - name: Checkout hmy code
# uses: actions/checkout@v2
# with:
# path: go/src/github.com/woop-chain/go-sdk
# path: go/src/github.com/harmony-one/go-sdk
# - name: Debug
# run: |
@ -128,62 +126,66 @@ jobs:
# - name: Checkout dependence repo
# uses: actions/checkout@v2
# with:
# repository: woop-chain/mcl
# path: go/src/github.com/woop-chain/mcl
# repository: harmony-one/mcl
# path: go/src/github.com/harmony-one/mcl
# env:
# GOPATH: /home/ubuntu/actions-runner/_work/go-sdk/go-sdk/go
# - name: Checkout dependence repo
# uses: actions/checkout@v2
# with:
# repository: woop-chain/bls
# path: go/src/github.com/woop-chain/bls
# repository: harmony-one/bls
# path: go/src/github.com/harmony-one/bls
# env:
# GOPATH: /home/ubuntu/actions-runner/_work/go-sdk/go-sdk/go
# - name: Checkout dependence code
# uses: actions/checkout@v2
# with:
# repository: woop-chain/woop
# path: go/src/github.com/woop-chain/woop
# repository: harmony-one/harmony
# path: go/src/github.com/harmony-one/harmony
# ref: main
# fetch-depth: 0
# env:
# GOPATH: /home/ubuntu/actions-runner/_work/go-sdk/go-sdk/go
# - name: Build wiki binary for Arm
# - name: Build hmy binary for Arm
# run: |
# make static
# mv dist/wiki dist/wiki-arm64
# chmod +x dist/wiki-arm64
# working-directory: /home/ubuntu/actions-runner/_work/go-sdk/go-sdk/go/src/github.com/woop-chain/go-sdk
# mv dist/hmy dist/hmy-arm64
# chmod +x dist/hmy-arm64
# working-directory: /home/ubuntu/actions-runner/_work/go-sdk/go-sdk/go/src/github.com/harmony-one/go-sdk
# env:
# GOPATH: /home/ubuntu/actions-runner/_work/go-sdk/go-sdk/go
# - name: Upload artifact
# uses: actions/upload-artifact@v2
# with:
# name: wiki-arm64
# path: /home/ubuntu/actions-runner/_work/go-sdk/go-sdk/go/src/github.com/woop-chain/go-sdk/dist/*
# name: hmy-arm64
# path: /home/ubuntu/actions-runner/_work/go-sdk/go-sdk/go/src/github.com/harmony-one/go-sdk/dist/*
# retention-days: 1
# env:
# GOPATH: /home/ubuntu/actions-runner/_work/go-sdk/go-sdk/go
release-page:
name: Sign binary and create and publish release page
needs: [ build-x86_64 ]
runs-on: ubuntu-22.04
needs: [ build-x8664 ]
runs-on: ubuntu-18.04
steps:
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v3
with:
gpg-private-key: ${{ secrets.WIKI_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.WIKI_GPG_PRIVATE_KEY_PASS }}
gpg-private-key: ${{ secrets.HMY_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.HMY_GPG_PRIVATE_KEY_PASS }}
- name: Checkout wiki core code
uses: actions/checkout@v3
- name: Checkout hmy core code
uses: actions/checkout@v2
with:
path: go-sdk
path: go/src/github.com/harmony-one/go-sdk
env:
GOPATH: /home/runner/work/go-sdk/go-sdk/go
- name: Get latest version
run: |
@ -193,89 +195,122 @@ jobs:
echo "build_version=$VERSION" >> $GITHUB_ENV
echo "build_version_long=$VERSION_LONG" >> $GITHUB_ENV
echo "build_release=$RELEASE" >> $GITHUB_ENV
working-directory: go-sdk
working-directory: /home/runner/work/go-sdk/go-sdk/go/src/github.com/harmony-one/go-sdk
env:
GOPATH: /home/runner/work/go-sdk/go-sdk/go
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: wiki
- name: Display structure of downloaded files
run: ls -R
name: hmy
- name: Signed darwin x86_64 wiki binary
- name: Signed amd64 hmy binary
run: |
gpg --detach-sign wiki-darwin-x86_64
sha256sum wiki-darwin-x86_64 >> wiki-darwin-x86_64.sha256
gpg --detach-sign hmy
sha256sum hmy >> hmy.sha256
# - name: Download artifact
# uses: actions/download-artifact@v2
# with:
# name: hmy-arm64
# - name: Signed arm64 hmy binary
# run: |
# gpg --detach-sign hmy-arm64
# sha256sum hmy-arm64 >> hmy-arm64.sha256
- name: Get tag message
env:
TAG_SHA: ${{ github.event.after }}
GOPATH: /home/runner/work/go-sdk/go
run: |
touch ./tag_message.md
echo -e "$TAG_SHA\n\nThe released version: $build_version_long" >> ./tag_message.md
working-directory: go-sdk
working-directory: /home/runner/work/go-sdk/go-sdk/go/src/github.com/harmony-one/go-sdk
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOPATH: /home/runner/work/go-sdk/go-sdk/go
with:
tag_name: ${{ github.ref }}
release_name: Mainnet Release ${{ env.build_version }}
draft: true
prerelease: false
body_path: ${{ github.workspace }}/go-sdk/tag_message.md
body_path: /home/runner/work/go-sdk/go-sdk/go/src/github.com/harmony-one/go-sdk/tag_message.md
- name: Upload wiki binary for Linux (x86_64)
- name: Upload hmy binary for Linux (amd64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOPATH: /home/runner/work/go-sdk/go-sdk/go
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./wiki
asset_name: wiki
asset_path: ./hmy
asset_name: hmy
asset_content_type: application/octet-stream
- name: Upload wiki binary darwin-x86_64
- name: Upload sha256 signature of hmy amd64 binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./wiki-darwin-x86_64
asset_name: wiki-darwin-x86_64
asset_path: ./hmy.sha256
asset_name: hmy.sha256
asset_content_type: text/plain
- name: Upload gpg signature of hmy amd64 binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./hmy.sig
asset_name: hmy.sig
asset_content_type: application/octet-stream
# - name: Upload wiki binary for ARM64
# - name: Upload hmy binary for ARM64
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# GOPATH: /home/runner/work/go-sdk/go-sdk/go
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ./wiki-arm64
# asset_name: wiki-arm64
# asset_path: ./hmy-arm64
# asset_name: hmy-arm64
# asset_content_type: application/octet-stream
# - name: Upload sha256 signature of wiki arm64 binary
# - name: Upload sha256 signature of hmy arm64 binary
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ./wiki-arm64.sha256
# asset_name: wiki-arm64.sha256
# asset_path: ./hmy-arm64.sha256
# asset_name: hmy-arm64.sha256
# asset_content_type: text/plain
# - name: Upload gpg signature of wiki arm64 binary
# - name: Upload gpg signature of hmy arm64 binary
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ./wiki-arm64.sig
# asset_name: wiki-arm64.sig
# asset_content_type: application/octet-stream
# asset_path: ./hmy-arm64.sig
# asset_name: hmy-arm64.sig
# asset_content_type: application/octet-stream

@ -1,103 +0,0 @@
name: test build
on:
push:
env:
GOPATH: ${{ github.workspace }}
GOBIN: ${{ github.workspace }}/bin
jobs:
build-x86_64:
name: Build wiki binary for x86_64
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-22.04, macos-latest ]
steps:
- name: Checkout wiki code
uses: actions/checkout@v3
with:
path: go-sdk
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: go-sdk/go.mod
- name: Checkout dependence repo
uses: actions/checkout@v3
with:
repository: woop-chain/mcl
path: ${{ github.workspace }}/src/github.com/woop-chain/mcl
- name: Checkout dependence repo
uses: actions/checkout@v3
with:
repository: woop-chain/bls
path: ${{ github.workspace }}/src/github.com/woop-chain/bls
- name: Checkout dependence code
uses: actions/checkout@v2
with:
repository: woop-chain/woop
path: ${{ github.workspace }}/src/github.com/woop-chain/woop
ref: main
fetch-depth: 0
- name: Get latest version and release
run: |
VERSION=$(git tag -l --sort=-v:refname | head -n 1 | tr -d v)
RELEASE=$(git describe --long | cut -f2 -d-)
echo "build_version=$VERSION" >> $GITHUB_ENV
echo "build_release=$RELEASE" >> $GITHUB_ENV
working-directory: go-sdk
- name: Debug
run: |
pwd
echo ${HOME}
echo ${GITHUB_WORKSPACE}
echo ${GOPATH}
echo ${GOROOT}
ls ${{ github.workspace }}/src/github.com/woop-chain/
- name: Build wiki binary for linux ubuntu
if: matrix.os == 'ubuntu-22.04'
run: |
make static
working-directory: go-sdk
- name: Build libs for macos-latest
if: matrix.os == 'macos-latest'
run: |
brew install gmp
brew install openssl
sudo mkdir -p /opt/homebrew/opt/
sudo ln -sf /usr/local/opt/openssl@1.1 /opt/homebrew/opt/openssl@1.1
echo "ls -l /opt/homebrew/opt/openssl@1.1"; ls -l /opt/homebrew/opt/openssl@1.1
make libs
working-directory: ${{ github.workspace }}/src/github.com/woop-chain/woop
- name: Build wiki binary for macos-latest x86_64
if: matrix.os == 'macos-latest'
run: |
make all
working-directory: go-sdk
- name: Upload artifact for linux
uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-22.04'
with:
name: wiki-linux
path: ${{ github.workspace }}/go-sdk/dist/*
retention-days: 1
- name: Upload artifact for darwin
uses: actions/upload-artifact@v3
if: matrix.os == 'macos-latest'
with:
name: wiki-darwin
path: ${{ github.workspace }}/go-sdk/dist/*
retention-days: 1

6
.gitignore vendored

@ -1,6 +1,6 @@
wiki
wiki-docs
hmy
hmy-docs
dist
.idea/
*.key
wiki_version
hmy_version

@ -1,19 +1,16 @@
SHELL := /bin/bash
TOP:=$(realpath ..)
export LD_LIBRARY_PATH:=$(TOP)/bls/lib:$(TOP)/mcl/lib:/usr/local/opt/openssl/lib:/opt/homebrew/opt/gmp/lib/:/opt/homebrew/opt/openssl/lib
export LIBRARY_PATH:=$(LD_LIBRARY_PATH)
version := $(shell git rev-list --count HEAD)
commit := $(shell git describe --always --long --dirty)
built_at := $(shell date +%FT%T%z)
built_by := ${USER}@wikiwoop.com
built_by := ${USER}@harmony.one
flags := -gcflags="all=-N -l"
flags := -gcflags="all=-N -l -c 2"
ldflags := -X main.version=v${version} -X main.commit=${commit}
ldflags += -X main.builtAt=${built_at} -X main.builtBy=${built_by}
cli := ./dist/wiki
upload-path-darwin := 's3://pub.wikiwoop.com/release/darwin-x86_64/mainnet/wiki'
upload-path-linux := 's3://pub.wikiwoop.com/release/linux-x86_64/mainnet/wiki'
upload-path-linux-version := 's3://pub.wikiwoop.com/release/linux-x86_64/mainnet/wiki_version'
cli := ./dist/hmy
upload-path-darwin := 's3://pub.harmony.one/release/darwin-x86_64/mainnet/hmy'
upload-path-linux := 's3://pub.harmony.one/release/linux-x86_64/mainnet/hmy'
upload-path-linux-version := 's3://pub.harmony.one/release/linux-x86_64/mainnet/hmy_version'
uname := $(shell uname)
env := GO111MODULE=on
@ -22,18 +19,18 @@ DIR := ${CURDIR}
export CGO_LDFLAGS=-L$(DIR)/dist/lib -Wl,-rpath -Wl,\$ORIGIN/lib
all:
source $(shell go env GOPATH)/src/github.com/woop-chain/woop/scripts/setup_bls_build_flags.sh && $(env) go build -o $(cli) -ldflags="$(ldflags)" cmd/main.go
cp $(cli) wiki
source $(shell go env GOPATH)/src/github.com/harmony-one/harmony/scripts/setup_bls_build_flags.sh && $(env) go build -o $(cli) -ldflags="$(ldflags)" cmd/main.go
cp $(cli) hmy
static:
make -C $(shell go env GOPATH)/src/github.com/woop-chain/mcl
make -C $(shell go env GOPATH)/src/github.com/woop-chain/bls minimised_static BLS_SWAP_G=1
source $(shell go env GOPATH)/src/github.com/woop-chain/woop/scripts/setup_bls_build_flags.sh && $(env) go build -o $(cli) -ldflags="$(ldflags) -w -extldflags \"-static\"" cmd/main.go
cp $(cli) wiki
make -C $(shell go env GOPATH)/src/github.com/harmony-one/mcl
make -C $(shell go env GOPATH)/src/github.com/harmony-one/bls minimised_static BLS_SWAP_G=1
source $(shell go env GOPATH)/src/github.com/harmony-one/harmony/scripts/setup_bls_build_flags.sh && $(env) go build -o $(cli) -ldflags="$(ldflags) -w -extldflags \"-static -z muldefs\"" cmd/main.go
cp $(cli) hmy
debug:
source $(shell go env GOPATH)/src/github.com/woop-chain/woop/scripts/setup_bls_build_flags.sh && $(env) go build $(flags) -o $(cli) -ldflags="$(ldflags)" cmd/main.go
cp $(cli) wiki
source $(shell go env GOPATH)/src/github.com/harmony-one/harmony/scripts/setup_bls_build_flags.sh && $(env) go build $(flags) -o $(cli) -ldflags="$(ldflags)" cmd/main.go
cp $(cli) hmy
install:all
cp $(cli) ~/.local/bin
@ -49,7 +46,7 @@ test-rpc:
# Notice assumes you have correct uploading credentials
upload-darwin:all
ifeq (${uname}, Darwin)
aws --profile upload s3 cp ./wiki ${upload-path-darwin}
aws --profile upload s3 cp ./hmy ${upload-path-darwin}
else
@echo "Wrong operating system for target upload"
endif
@ -57,9 +54,9 @@ endif
# Only the linux build will upload the CLI version
upload-linux:static
ifeq (${uname}, Linux)
aws --profile upload s3 cp ./wiki ${upload-path-linux}
./wiki version &> ./wiki_version
aws --profile upload s3 cp ./wiki_version ${upload-path-linux-version}
aws --profile upload s3 cp ./hmy ${upload-path-linux}
./hmy version &> ./hmy_version
aws --profile upload s3 cp ./hmy_version ${upload-path-linux-version}
else
@echo "Wrong operating system for target upload"
endif

@ -1,21 +1,21 @@
# Woop's go-sdk
# Harmony's go-sdk
This is a go layer on top of the Woop RPC, included is a CLI tool that you can build with a
This is a go layer on top of the Harmony RPC, included is a CLI tool that you can build with a
simple invocation of `make`
See https://docs.wikiwoop.com/home/network/wallets/woop-cli/download-setup for detailed
documentation on how to use the `wiki` CLI tools
See https://docs.harmony.one/home/network/wallets/harmony-cli/download-setup for detailed
documentation on how to use the `hmy` CLI tools
# Build
Working directly on this repo can be challenging because of the upstream dependencies. Follow the
README in the main repo for an already ready development environment:
https://github.com/woop-chain/woop/blob/master/README.md.
https://github.com/harmony-one/harmony/blob/master/README.md.
...for the impatient:
```
$ docker run -it woopchain/main:stable /bin/bash
$ docker run -it harmonyone/main:stable /bin/bash
$ cd ../go-sdk
$ git pull -r origin master
$ make
@ -23,20 +23,20 @@ $ make
# Usage & Examples
`wiki` implements a fluent API, that is, there is a hierarchy of commands.
`hmy` implements a fluent API, that is, there is a hierarchy of commands.
# bash completions
once built, add `wiki` to your path and add to your `.bashrc`
once built, add `hmy` to your path and add to your `.bashrc`
```
. <(wiki completion)
. <(hmy completion)
```
invoke the following command to see the most command usages of `wiki`
invoke the following command to see the most command usages of `hmy`
```
$ wiki cookbook
$ hmy cookbook
Cookbook of Usage
@ -52,88 +52,89 @@ Note:
Examples:
1. Check account balance on given chain
./wiki --node=https://api.s0.t.hmny.io balances <SOME_ONE_ADDRESS>
./hmy --node=https://api.s0.t.hmny.io balances <SOME_ONE_ADDRESS>
2. Check sent transaction
./wiki --node=https://api.s0.t.hmny.io blockchain transaction-by-hash <SOME_TX_HASH>
./hmy --node=https://api.s0.t.hmny.io blockchain transaction-by-hash <SOME_TX_HASH>
3. List local account keys
./wiki keys list
./hmy keys list
4. Sending a transaction (waits 40 seconds for transaction confirmation)
./wiki --node=https://api.s0.t.hmny.io transfer \
./hmy --node=https://api.s0.t.hmny.io transfer \
--from <SOME_ONE_ADDRESS> --to <SOME_ONE_ADDRESS> \
--from-shard 0 --to-shard 1 --amount 200 --passphrase
5. Sending a batch of transactions as dictated from a file (the `--dry-run` options still apply)
./wiki --node=https://api.s0.t.hmny.io transfer --file <PATH_TO_JSON_FILE>
./hmy --node=https://api.s0.t.hmny.io transfer --file <PATH_TO_JSON_FILE>
Check README for details on json file format.
6. Check a completed transaction receipt
./wiki --node=https://api.s0.t.hmny.io blockchain transaction-receipt <SOME_TX_HASH>
./hmy --node=https://api.s0.t.hmny.io blockchain transaction-receipt <SOME_TX_HASH>
7. Import an account using the mnemonic. Prompts the user to give the mnemonic.
./wiki keys recover-from-mnemonic <ACCOUNT_NAME>
./hmy keys recover-from-mnemonic <ACCOUNT_NAME>
8. Import an existing keystore file
./wiki keys import-ks <PATH_TO_KEYSTORE_JSON>
./hmy keys import-ks <PATH_TO_KEYSTORE_JSON>
9. Import a keystore file using a secp256k1 private key
./wiki keys import-private-key <secp256k1_PRIVATE_KEY>
./hmy keys import-private-key <secp256k1_PRIVATE_KEY>
10. Export a keystore file's secp256k1 private key
./wiki keys export-private-key <ACCOUNT_ADDRESS> --passphrase
./hmy keys export-private-key <ACCOUNT_ADDRESS> --passphrase
11. Generate a BLS key then encrypt and save the private key to the specified location.
./wiki keys generate-bls-key --bls-file-path <PATH_FOR_BLS_KEY_FILE>
./hmy keys generate-bls-key --bls-file-path <PATH_FOR_BLS_KEY_FILE>
12. Create a new validator with a list of BLS keys
./wiki --node=https://api.s0.t.hmny.io staking create-validator --amount 10 --validator-addr <SOME_ONE_ADDRESS> \
./hmy --node=https://api.s0.t.hmny.io staking create-validator --amount 10 --validator-addr <SOME_ONE_ADDRESS> \
--bls-pubkeys <BLS_KEY_1>,<BLS_KEY_2>,<BLS_KEY_3> \
--identity foo --details bar --name baz --max-change-rate 0.1 --max-rate 0.1 --max-total-delegation 10 \
--min-self-delegation 10 --rate 0.1 --security-contact Leo --website wikiwoop.com --passphrase
--min-self-delegation 10 --rate 0.1 --security-contact Leo --website harmony.one --passphrase
13. Edit an existing validator
./wiki --node=https://api.s0.t.hmny.io staking edit-validator \
./hmy --node=https://api.s0.t.hmny.io staking edit-validator \
--validator-addr <SOME_ONE_ADDRESS> --identity foo --details bar \
--name baz --security-contact EK --website wikiwoop.com \
--name baz --security-contact EK --website harmony.one \
--min-self-delegation 0 --max-total-delegation 10 --rate 0.1\
--add-bls-key <SOME_BLS_KEY> --remove-bls-key <OTHER_BLS_KEY> --passphrase
14. Delegate an amount to a validator
./wiki --node=https://api.s0.t.hmny.io staking delegate \
./hmy --node=https://api.s0.t.hmny.io staking delegate \
--delegator-addr <SOME_ONE_ADDRESS> --validator-addr <VALIDATOR_ONE_ADDRESS> \
--amount 10 --passphrase
15. Undelegate to a validator
./wiki --node=https://api.s0.t.hmny.io staking undelegate \
./hmy --node=https://api.s0.t.hmny.io staking undelegate \
--delegator-addr <SOME_ONE_ADDRESS> --validator-addr <VALIDATOR_ONE_ADDRESS> \
--amount 10 --passphrase
16. Collect block rewards as a delegator
./wiki --node=https://api.s0.t.hmny.io staking collect-rewards \
./hmy --node=https://api.s0.t.hmny.io staking collect-rewards \
--delegator-addr <SOME_ONE_ADDRESS> --passphrase
17. Check elected validators
./wiki --node=https://api.s0.t.hmny.io blockchain validator elected
./hmy --node=https://api.s0.t.hmny.io blockchain validator elected
18. Get current staking utility metrics
./wiki --node=https://api.s0.t.hmny.io blockchain utility-metrics
./hmy --node=https://api.s0.t.hmny.io blockchain utility-metrics
19. Check in-memory record of failed staking transactions
./wiki --node=https://api.s0.t.hmny.io failures staking
./hmy --node=https://api.s0.t.hmny.io failures staking
20. Check which shard your BLS public key would be assigned to as a validator
./wiki --node=https://api.s0.t.hmny.io utility shard-for-bls <BLS_PUBLIC_KEY>
./hmy --node=https://api.s0.t.hmny.io utility shard-for-bls <BLS_PUBLIC_KEY>
21. Vote on a governance proposal on https://snapshot.org
./wiki governance vote-proposal --space=[woop-mainnet.eth] \
./hmy governance vote-proposal --space=[harmony-mainnet.eth] \
--proposal=<PROPOSAL_IPFS_HASH> --proposal-type=[single-choice] \
--choice=<VOTING_CHOICE(S)> --app=[APP] --key=<ACCOUNT_ADDRESS_OR_NAME>
PS: key must first use (wiki keys import-private-key) to import
--choice=<VOTING_CHOICE(S)> --app=[APP] --key=<ACCOUNT_ADDRESS_OR_NAME> \
--privacy=[PRIVACY TYPE]
PS: key must first use (hmy keys import-private-key) to import
22. Enter Console
./wiki command --net=testnet
./hmy command --net=testnet
```
# Sending batched transactions
@ -144,7 +145,7 @@ off **in sequential order**.
Example:
```
wiki --node="https://api.s1.t.hmny.io/" transfer --file ./batchTransactions.json
hmy --node="https://api.s1.t.hmny.io/" transfer --file ./batchTransactions.json
```
> Note that the `--wait-for-confirm` and `--dry-run` options still apply when sending batched transactions
@ -156,13 +157,13 @@ The JSON file will be a JSON array where each element has the following attribut
| :------------------:|:----------:| :----------------|
| `from` | string | [**Required**] Sender's one address, must have key in keystore. |
| `to` | string | [**Required**] The receivers one address. |
| `amount` | string | [**Required**] The amount to send in $WOOP. |
| `amount` | string | [**Required**] The amount to send in $ONE. |
| `from-shard` | string | [**Required**] The source shard. |
| `to-shard` | string | [**Required**] The destination shard. |
| `passphrase-file` | string | [*Optional*] The file path to file containing the passphrase in plain text. If none is provided, check for passphrase string. |
| `passphrase-string` | string | [*Optional*] The passphrase as a string in plain text. If none is provided, passphrase is ''. |
| `nonce` | string | [*Optional*] The nonce of a specific transaction, default uses nonce from blockchain. |
| `gas-price` | string | [*Optional*] The gas price to pay in NANO (1e-9 of $WOOP), default is 1. |
| `gas-price` | string | [*Optional*] The gas price to pay in NANO (1e-9 of $ONE), default is 1. |
| `gas-limit` | string | [*Optional*] The gas limit, default is 21000. |
| `stop-on-error` | boolean | [*Optional*] If true, stop sending transactions if an error occurred, default is false. |
| `true-nonce` | boolean | [*Optional*] If true, send transaction using true on-chain nonce. Cannot be used with `nonce`. If none is provided, use tx pool nonce. |
@ -242,26 +243,26 @@ Example of returned JSON Array:
## Offline sign transfer
1. Get Nonce From a Account. (Need to be online, but no passphrase required)
```bash
./wiki get-nonce --node=https://api.s0.t.hmny.io --from=[ONE address]
./hmy get-nonce --node=https://api.s0.t.hmny.io --from=[ONE address]
```
2. Sign transfer and write to file. (Passphrase required, But no need to be online)
```bash
./wiki transfer --offline-sign --nonce=[nonce value from previous] --from=[ONE address] --to=[ONE address] --amount=1000 --from-shard=0 --to-shard=0 > signed.json
./hmy transfer --offline-sign --nonce=[nonce value from previous] --from=[ONE address] --to=[ONE address] --amount=1000 --from-shard=0 --to-shard=0 > signed.json
```
3. send `signed.json` to Woop blockchain! (Need to be online, but no passphrase required)
3. send `signed.json` to Harmony blockchain! (Need to be online, but no passphrase required)
```bash
./wiki offline-sign-transfer --node=https://api.s0.b.hmny.io --file ./signed.json
./hmy offline-sign-transfer --node=https://api.s0.b.hmny.io --file ./signed.json
```
# Debugging
The go-sdk code respects `WIKI_RPC_DEBUG WIKI_TX_DEBUG` as debugging
The go-sdk code respects `HMY_RPC_DEBUG HMY_TX_DEBUG` as debugging
based environment variables.
```bash
WIKI_RPC_DEBUG=true WIKI_TX_DEBUG=true ./wiki blockchain protocol-version
HMY_RPC_DEBUG=true HMY_TX_DEBUG=true ./hmy blockchain protocol-version
```
# Contract Deploy
@ -269,7 +270,7 @@ WIKI_RPC_DEBUG=true WIKI_TX_DEBUG=true ./wiki blockchain protocol-version
You can deploy the contract use the command;
```bash
./wiki command --node="https://api.s0.b.hmny.io" --net=testnet
./hmy command --node="https://api.s0.b.hmny.io" --net=testnet
```
Then you can test this code to deploy a smart contract

@ -5,10 +5,10 @@ import (
"os"
"path"
cmd "github.com/woop-chain/go-sdk/cmd/subcommands"
cmd "github.com/harmony-one/go-sdk/cmd/subcommands"
// Need this side effect
_ "github.com/harmony-one/go-sdk/pkg/store"
"github.com/spf13/cobra"
_ "github.com/woop-chain/go-sdk/pkg/store"
)
var (
@ -29,7 +29,7 @@ func main() {
Short: "Show version",
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Fprintf(os.Stderr,
"Woop (C) 2024. %v, version %v-%v (%v %v)\n",
"Harmony (C) 2020. %v, version %v-%v (%v %v)\n",
path.Base(os.Args[0]), version, commit, builtBy, builtAt)
os.Exit(0)
return nil

@ -6,17 +6,17 @@ import (
"net"
"strings"
"github.com/harmony-one/go-sdk/pkg/common"
"github.com/harmony-one/go-sdk/pkg/rpc"
"github.com/harmony-one/go-sdk/pkg/sharding"
"github.com/spf13/cobra"
"github.com/woop-chain/go-sdk/pkg/common"
"github.com/woop-chain/go-sdk/pkg/rpc"
"github.com/woop-chain/go-sdk/pkg/sharding"
)
func init() {
cmdQuery := &cobra.Command{
Use: "balances",
Short: "Check account balance on all shards",
Long: "Query for the latest account balance given a Woop Address",
Long: "Query for the latest account balance given a Harmony Address",
Args: cobra.ExactArgs(1),
PreRunE: validateAddress,
RunE: func(cmd *cobra.Command, args []string) error {

@ -3,9 +3,9 @@ package cmd
import (
"fmt"
"github.com/harmony-one/go-sdk/pkg/common"
"github.com/harmony-one/go-sdk/pkg/rpc"
"github.com/spf13/cobra"
"github.com/woop-chain/go-sdk/pkg/common"
"github.com/woop-chain/go-sdk/pkg/rpc"
)
var (
@ -40,9 +40,9 @@ Look up information about delegation
cmdBlockchain := &cobra.Command{
Use: "blockchain",
Short: "Interact with WoopChain",
Short: "Interact with the Harmony.one Blockchain",
Long: `
Query Woop's blockchain for completed transaction, historic records
Query Harmony's blockchain for completed transaction, historic records
`,
RunE: func(cmd *cobra.Command, args []string) error {
cmd.Help()
@ -77,7 +77,7 @@ High level information about each transaction for given account
subCommands := []*cobra.Command{{
Use: "block-by-number",
Short: "Get a woop blockchain block by block number",
Short: "Get a harmony blockchain block by block number",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
noLatest = true
@ -92,9 +92,9 @@ High level information about each transaction for given account
},
}, {
Use: "protocol-version",
Short: "The version of the Woop Protocol",
Short: "The version of the Harmony Protocol",
Long: `
Query Woop's blockchain for high level metrics, queries
Query Harmony's blockchain for high level metrics, queries
`,
RunE: func(cmd *cobra.Command, args []string) error {
return request(rpc.Method.ProtocolVersion, []interface{}{})

@ -2,11 +2,11 @@ package cmd
import (
ethereum_rpc "github.com/ethereum/go-ethereum/rpc"
"github.com/harmony-one/go-sdk/pkg/common"
"github.com/harmony-one/go-sdk/pkg/console"
"github.com/harmony-one/go-sdk/pkg/rpc"
"github.com/mitchellh/go-homedir"
"github.com/spf13/cobra"
"github.com/woop-chain/go-sdk/pkg/common"
"github.com/woop-chain/go-sdk/pkg/console"
"github.com/woop-chain/go-sdk/pkg/rpc"
"log"
"os"
"path"
@ -30,13 +30,13 @@ func init() {
func checkAndMakeDirIfNeeded() string {
userDir, _ := homedir.Dir()
wikiCLIDir := path.Join(userDir, common.DefaultConfigDirName, common.DefaultCommandAliasesDirName)
if _, err := os.Stat(wikiCLIDir); os.IsNotExist(err) {
hmyCLIDir := path.Join(userDir, common.DefaultConfigDirName, common.DefaultCommandAliasesDirName)
if _, err := os.Stat(hmyCLIDir); os.IsNotExist(err) {
// Double check with Leo what is right file persmission
os.Mkdir(wikiCLIDir, 0700)
os.Mkdir(hmyCLIDir, 0700)
}
return wikiCLIDir
return hmyCLIDir
}
// remoteConsole will connect to a remote node instance, attaching a JavaScript

@ -12,7 +12,7 @@ func init() {
Short: "Generates bash completion scripts",
Long: `To load completion, run:
. <(wiki completion)
. <(hmy completion)
Add the line to your ~/.bashrc to enable completiony for each bash session.
`,

@ -1,10 +1,10 @@
package cmd
import (
"github.com/harmony-one/go-sdk/pkg/address"
"github.com/harmony-one/go-sdk/pkg/common"
"github.com/harmony-one/go-sdk/pkg/validation"
"github.com/pkg/errors"
"github.com/woop-chain/go-sdk/pkg/address"
"github.com/woop-chain/go-sdk/pkg/common"
"github.com/woop-chain/go-sdk/pkg/validation"
)
type oneAddress struct {

@ -1,8 +1,8 @@
package cmd
import (
"github.com/harmony-one/go-sdk/pkg/rpc"
"github.com/spf13/cobra"
"github.com/woop-chain/go-sdk/pkg/rpc"
)
var (

@ -5,19 +5,18 @@ import (
"errors"
"fmt"
"io/ioutil"
"os"
"strconv"
"strings"
"time"
"github.com/woop-chain/go-sdk/pkg/address"
"github.com/woop-chain/go-sdk/pkg/common"
"github.com/woop-chain/go-sdk/pkg/rpc"
rpcEth "github.com/woop-chain/go-sdk/pkg/rpc/eth"
"github.com/woop-chain/go-sdk/pkg/store"
"github.com/woop-chain/go-sdk/pkg/transaction"
"github.com/woop-chain/woop/accounts"
"github.com/woop-chain/woop/core"
"github.com/harmony-one/go-sdk/pkg/address"
"github.com/harmony-one/go-sdk/pkg/common"
"github.com/harmony-one/go-sdk/pkg/rpc"
rpcEth "github.com/harmony-one/go-sdk/pkg/rpc/eth"
"github.com/harmony-one/go-sdk/pkg/store"
"github.com/harmony-one/go-sdk/pkg/transaction"
"github.com/harmony-one/harmony/accounts"
"github.com/harmony-one/harmony/core"
"github.com/spf13/cobra"
)
@ -44,13 +43,9 @@ func ethHandlerForShard(node string) (*rpc.HTTPMessenger, error) {
// Note that the vars need to be set before calling this handler.
func ethHandlerForTransaction(txLog *transactionLog) error {
from := fromAddress.String()
var networkHandler *rpc.HTTPMessenger
if !offlineSign {
var err error
networkHandler, err = ethHandlerForShard(node)
if handlerForError(txLog, err) != nil {
return err
}
networkHandler, err := ethHandlerForShard(node)
if handlerForError(txLog, err) != nil {
return err
}
var ctrlr *transaction.EthController
@ -103,17 +98,12 @@ func ethHandlerForTransaction(txLog *transactionLog) error {
gLimit = uint64(tempLimit)
}
dataByte, err := transaction.StringToByte(data)
if err != nil {
return handlerForError(txLog, err)
}
txLog.TimeSigned = time.Now().UTC().Format(timeFormat) // Approximate time of signature
err = ctrlr.ExecuteEthTransaction(
nonce, gLimit,
toAddress.String(),
amt, gPrice,
dataByte,
[]byte{},
)
if dryRun {
@ -197,9 +187,6 @@ func ethOpts(ctlr *transaction.EthController) {
if dryRun {
ctlr.Behavior.DryRun = true
}
if offlineSign {
ctlr.Behavior.OfflineSign = true
}
if useLedgerWallet {
ctlr.Behavior.SigningImpl = transaction.Ledger
}
@ -214,12 +201,9 @@ func init() {
Short: "Create and send an Ethereum compatible transaction",
Args: cobra.ExactArgs(0),
Long: `
Create an Ethereum compatible transaction, sign it, and send off to the Woop blockchain
Create an Ethereum compatible transaction, sign it, and send off to the Harmony blockchain
`,
PreRunE: func(cmd *cobra.Command, args []string) error {
if offlineSign {
dryRun = true
}
if givenFilePath == "" {
for _, flagName := range [...]string{"from", "to", "amount", "chain-id"} {
_ = cmd.MarkFlagRequired(flagName)
@ -285,72 +269,15 @@ Create an Ethereum compatible transaction, sign it, and send off to the Woop blo
cmdEthTransfer.Flags().Var(&fromAddress, "from", "sender's one address, keystore must exist locally")
cmdEthTransfer.Flags().Var(&toAddress, "to", "the destination one address")
cmdEthTransfer.Flags().BoolVar(&dryRun, "dry-run", false, "do not send signed transaction")
cmdEthTransfer.Flags().BoolVar(&offlineSign, "offline-sign", false, "output offline signing")
cmdEthTransfer.Flags().BoolVar(&trueNonce, "true-nonce", false, "send transaction with on-chain nonce")
cmdEthTransfer.Flags().StringVar(&amount, "amount", "0", "amount to send (ONE)")
cmdEthTransfer.Flags().StringVar(&gasPrice, "gas-price", "100", "gas price to pay (NANO)")
cmdEthTransfer.Flags().StringVar(&gasLimit, "gas-limit", "", "gas limit")
cmdEthTransfer.Flags().StringVar(&inputNonce, "nonce", "", "set nonce for tx")
cmdEthTransfer.Flags().StringVar(&data, "data", "", "transaction data")
cmdEthTransfer.Flags().StringVar(&targetChain, "chain-id", "", "what chain ID to target")
cmdEthTransfer.Flags().Uint32Var(&timeout, "timeout", defaultTimeout, "set timeout in seconds. Set to 0 to not wait for confirm")
cmdEthTransfer.Flags().BoolVar(&userProvidesPassphrase, "passphrase", false, ppPrompt)
cmdEthTransfer.Flags().StringVar(&passphraseFilePath, "passphrase-file", "", "path to a file containing the passphrase")
RootCmd.AddCommand(cmdEthTransfer)
cmdOfflineSignEthTransfer := &cobra.Command{
Use: "offline-sign-eth-transfer",
Short: "Send a Offline Signed Ethereum transaction",
Args: cobra.ExactArgs(0),
Long: `
Send a offline signed transaction to the Woop blockchain (on the same shard)
`,
PreRunE: func(cmd *cobra.Command, args []string) error {
if givenFilePath == "" {
return fmt.Errorf("must give a offline-signed file")
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
var txLogs []*transactionLog
networkHandler := rpc.NewHTTPHandler(node)
openFile, err := os.Open(givenFilePath)
if err != nil {
return err
}
defer openFile.Close()
err = json.NewDecoder(openFile).Decode(&txLogs)
if err != nil {
return err
}
for _, txLog := range txLogs {
if len(txLog.Errors) > 0 {
continue
}
ctrlr := transaction.NewEthController(networkHandler, nil, nil, *chainName.chainID, ethOpts)
err := ctrlr.ExecuteRawTransaction(txLog.RawTxn)
if handlerForError(txLog, err) != nil {
txLog.Errors = append(txLog.Errors, err.Error())
continue
}
if txHash := ctrlr.TransactionHash(); txHash != nil {
txLog.TxHash = *txHash
}
txLog.Receipt = ctrlr.Receipt()["result"]
}
fmt.Println(common.ToJSONUnsafe(txLogs, true))
return nil
},
}
RootCmd.AddCommand(cmdOfflineSignEthTransfer)
}

@ -1,8 +1,8 @@
package cmd
import (
"github.com/harmony-one/go-sdk/pkg/rpc"
"github.com/spf13/cobra"
"github.com/woop-chain/go-sdk/pkg/rpc"
)
func init() {

@ -3,18 +3,18 @@ package cmd
import (
"fmt"
"github.com/harmony-one/go-sdk/pkg/governance"
"github.com/harmony-one/go-sdk/pkg/store"
"github.com/harmony-one/harmony/accounts"
"github.com/spf13/cobra"
"github.com/woop-chain/go-sdk/pkg/governance"
"github.com/woop-chain/go-sdk/pkg/store"
"github.com/woop-chain/woop/accounts"
)
func init() {
cmdGovernance := &cobra.Command{
Use: "governance",
Short: "Interact with the Woop spaces on https://snapshot.org",
Short: "Interact with the Harmony spaces on https://snapshot.org",
Long: `
Support interaction with the Woop governance space on Snapshot, especially for validators that do not want to import their account private key into either metamask or onewallet.
Support interaction with the Harmony governance space on Snapshot, especially for validators that do not want to import their account private key into either metamask or onewallet.
`,
RunE: func(cmd *cobra.Command, args []string) error {
cmd.Help()
@ -35,9 +35,8 @@ func commandVote() (cmd *cobra.Command) {
var choice string
var key string
var proposalType string
// var privacy string
var privacy string
var app string
var reason string
cmd = &cobra.Command{
Use: "vote-proposal",
@ -64,22 +63,20 @@ func commandVote() (cmd *cobra.Command) {
Proposal: proposal,
ProposalType: proposalType,
Choice: choice,
// Privacy: privacy,
App: app,
From: account.Address.Hex(),
Reason: reason,
Privacy: privacy,
App: app,
From: account.Address.Hex(),
})
},
}
cmd.Flags().StringVar(&key, "key", "", "Account name. Must first use (wiki keys import-private-key) to import.")
cmd.Flags().StringVar(&space, "space", "woop-mainnet.eth", "Snapshot space")
cmd.Flags().StringVar(&key, "key", "", "Account name. Must first use (hmy keys import-private-key) to import.")
cmd.Flags().StringVar(&space, "space", "harmony-mainnet.eth", "Snapshot space")
cmd.Flags().StringVar(&proposal, "proposal", "", "Proposal hash")
cmd.Flags().StringVar(&proposalType, "proposal-type", "single-choice", "Proposal type like single-choice, approval, quadratic, etc.")
cmd.Flags().StringVar(&choice, "choice", "", "Vote choice either as integer, list of integers (e.x. when using ranked choice voting), or string")
// cmd.Flags().StringVar(&privacy, "privacy", "", "Vote privacy e.x. shutter")
cmd.Flags().StringVar(&app, "app", "snapshot", "Voting app")
cmd.Flags().StringVar(&reason, "reason", "", "Reason for your choice")
cmd.Flags().StringVar(&privacy, "privacy", "", "Vote privacy ex. shutter")
cmd.Flags().StringVar(&app, "app", "", "Voting app")
cmd.Flags().BoolVar(&userProvidesPassphrase, "passphrase", false, ppPrompt)
cmd.MarkFlagRequired("key")

@ -13,13 +13,13 @@ import (
"github.com/tyler-smith/go-bip39"
"golang.org/x/crypto/ssh/terminal"
"github.com/woop-chain/go-sdk/pkg/account"
c "github.com/woop-chain/go-sdk/pkg/common"
"github.com/woop-chain/go-sdk/pkg/keys"
"github.com/woop-chain/go-sdk/pkg/ledger"
"github.com/woop-chain/go-sdk/pkg/mnemonic"
"github.com/woop-chain/go-sdk/pkg/store"
"github.com/woop-chain/go-sdk/pkg/validation"
"github.com/harmony-one/go-sdk/pkg/account"
c "github.com/harmony-one/go-sdk/pkg/common"
"github.com/harmony-one/go-sdk/pkg/keys"
"github.com/harmony-one/go-sdk/pkg/ledger"
"github.com/harmony-one/go-sdk/pkg/mnemonic"
"github.com/harmony-one/go-sdk/pkg/store"
"github.com/harmony-one/go-sdk/pkg/validation"
)
const (
@ -120,7 +120,7 @@ func keysSub() []*cobra.Command {
cmdLocation := &cobra.Command{
Use: "location",
Short: "Show where `wiki` keeps accounts & their keys",
Short: "Show where `hmy` keeps accounts & their keys",
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println(store.DefaultLocation())
return nil
@ -144,7 +144,7 @@ func keysSub() []*cobra.Command {
Passphrase: passphrase,
}
if recoverFromMnemonic {
fmt.Fprintf(os.Stderr, "deprecated method: use `./wiki keys recover-from-mnemonic` instead.\n")
fmt.Fprintf(os.Stderr, "deprecated method: use `./hmy keys recover-from-mnemonic` instead.\n")
fmt.Println("Enter mnemonic to recover keys from")
scanner := bufio.NewScanner(os.Stdin)
scanner.Scan()
@ -341,7 +341,7 @@ func keysSub() []*cobra.Command {
Short: "Generates multiple bls keys for a given shard network configuration and then encrypts and saves the private key with a requested passphrase",
RunE: func(cmd *cobra.Command, args []string) error {
if err := validation.ValidateNodeConnection(node); err != nil {
fmt.Fprintf(os.Stderr, "Cannot connect to node %v, using Woop mainnet endpoint %v\n",
fmt.Fprintf(os.Stderr, "Cannot connect to node %v, using Harmony mainnet endpoint %v\n",
node, defaultMainnetEndpoint)
node = defaultMainnetEndpoint
}

@ -4,24 +4,23 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/harmony-one/go-sdk/pkg/address"
"net/http"
"os"
"path"
"regexp"
"strings"
"github.com/woop-chain/go-sdk/pkg/address"
color "github.com/fatih/color"
"github.com/harmony-one/go-sdk/pkg/common"
"github.com/harmony-one/go-sdk/pkg/rpc"
rpcEth "github.com/harmony-one/go-sdk/pkg/rpc/eth"
rpcV1 "github.com/harmony-one/go-sdk/pkg/rpc/v1"
"github.com/harmony-one/go-sdk/pkg/sharding"
"github.com/harmony-one/go-sdk/pkg/store"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/cobra/doc"
"github.com/woop-chain/go-sdk/pkg/common"
"github.com/woop-chain/go-sdk/pkg/rpc"
rpcEth "github.com/woop-chain/go-sdk/pkg/rpc/eth"
rpcV1 "github.com/woop-chain/go-sdk/pkg/rpc/v1"
"github.com/woop-chain/go-sdk/pkg/sharding"
"github.com/woop-chain/go-sdk/pkg/store"
)
var (
@ -52,15 +51,15 @@ var (
}
// RootCmd is single entry point of the CLI
RootCmd = &cobra.Command{
Use: "wiki",
Short: "Woop blockchain",
Use: "hmy",
Short: "Harmony blockchain",
SilenceUsage: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
if verbose {
common.EnableAllVerbose()
}
switch rpcPrefix {
case "wiki":
case "hmy":
rpc.Method = rpcV1.Method
case "eth":
rpc.Method = rpcEth.Method
@ -96,7 +95,7 @@ var (
}
} else if endpoint.Match([]byte(node)) {
chainName = endpointToChainID(node)
} else if strings.Contains(node, "api.wikiwoop.com") {
} else if strings.Contains(node, "api.harmony.one") {
chainName = chainIDWrapper{chainID: &common.Chain.MainNet}
} else {
chainName = chainIDWrapper{chainID: &common.Chain.TestNet}
@ -112,9 +111,9 @@ var (
return nil
},
Long: fmt.Sprintf(`
CLI interface to the Woop blockchain
CLI interface to the Harmony blockchain
%s`, g("Invoke 'wiki cookbook' for examples of the most common, important usages")),
%s`, g("Invoke 'hmy cookbook' for examples of the most common, important usages")),
RunE: func(cmd *cobra.Command, args []string) error {
cmd.Help()
return nil
@ -123,7 +122,7 @@ CLI interface to the Woop blockchain
)
func init() {
vS := "dump out debug information, same as env var WIKI_ALL_DEBUG=true"
vS := "dump out debug information, same as env var HMY_ALL_DEBUG=true"
RootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, vS)
RootCmd.PersistentFlags().StringVarP(&node, "node", "n", defaultNodeAddr, "<host>")
RootCmd.PersistentFlags().StringVarP(&rpcPrefix, "rpc-prefix", "r", defaultRpcPrefix, "<rpc>")
@ -162,10 +161,10 @@ func init() {
RootCmd.PersistentFlags().StringVar(&givenFilePath, "file", "", "Path to file for given command when applicable")
RootCmd.AddCommand(&cobra.Command{
Use: "docs",
Short: fmt.Sprintf("Generate docs to a local %s directory", wikiDocsDir),
Short: fmt.Sprintf("Generate docs to a local %s directory", hmyDocsDir),
RunE: func(cmd *cobra.Command, args []string) error {
cwd, _ := os.Getwd()
docDir := path.Join(cwd, wikiDocsDir)
docDir := path.Join(cwd, hmyDocsDir)
os.Mkdir(docDir, 0700)
doc.GenMarkdownTree(RootCmd, docDir)
return nil
@ -176,12 +175,12 @@ func init() {
var (
// VersionWrapDump meant to be set from main.go
VersionWrapDump = ""
cookbook = color.GreenString("wiki cookbook")
versionLink = "https://wikiwoop.com/wikicli_ver"
cookbook = color.GreenString("hmy cookbook")
versionLink = "https://harmony.one/hmycli_ver"
versionFormat = regexp.MustCompile("v[0-9]+-[a-z0-9]{7}")
)
// Execute kicks off the wiki CLI
// Execute kicks off the hmy CLI
func Execute() {
RootCmd.SilenceErrors = true
if err := RootCmd.Execute(); err != nil {

@ -9,25 +9,25 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/rlp"
bls_core "github.com/harmony-one/bls/ffi/go/bls"
"github.com/harmony-one/go-sdk/pkg/address"
"github.com/harmony-one/go-sdk/pkg/common"
"github.com/harmony-one/go-sdk/pkg/keys"
"github.com/harmony-one/go-sdk/pkg/ledger"
"github.com/harmony-one/go-sdk/pkg/rpc"
"github.com/harmony-one/go-sdk/pkg/store"
"github.com/harmony-one/go-sdk/pkg/transaction"
"github.com/harmony-one/harmony/accounts"
"github.com/harmony-one/harmony/accounts/keystore"
"github.com/harmony-one/harmony/common/denominations"
"github.com/harmony-one/harmony/core"
"github.com/harmony-one/harmony/crypto/bls"
"github.com/harmony-one/harmony/numeric"
"github.com/harmony-one/harmony/shard"
"github.com/harmony-one/harmony/staking/effective"
staking "github.com/harmony-one/harmony/staking/types"
"github.com/pkg/errors"
"github.com/spf13/cobra"
bls_core "github.com/woop-chain/bls/ffi/go/bls"
"github.com/woop-chain/go-sdk/pkg/address"
"github.com/woop-chain/go-sdk/pkg/common"
"github.com/woop-chain/go-sdk/pkg/keys"
"github.com/woop-chain/go-sdk/pkg/ledger"
"github.com/woop-chain/go-sdk/pkg/rpc"
"github.com/woop-chain/go-sdk/pkg/store"
"github.com/woop-chain/go-sdk/pkg/transaction"
"github.com/woop-chain/woop/accounts"
"github.com/woop-chain/woop/accounts/keystore"
"github.com/woop-chain/woop/common/denominations"
"github.com/woop-chain/woop/core"
"github.com/woop-chain/woop/crypto/bls"
"github.com/woop-chain/woop/numeric"
"github.com/woop-chain/woop/shard"
"github.com/woop-chain/woop/staking/effective"
staking "github.com/woop-chain/woop/staking/types"
)
const (
@ -184,7 +184,7 @@ func confirmTx(networkHandler *rpc.HTTPMessenger, confirmWaitTime uint32, txHash
for _, txError := range transactionErrors {
fmt.Println(txError.Error().Error())
}
fmt.Println("Try increasing the `timeout` or look for the transaction receipt with `wiki blockchain transaction-receipt <txHash>`")
fmt.Println("Try increasing the `timeout` or look for the transaction receipt with `hmy blockchain transaction-receipt <txHash>`")
return fmt.Errorf("could not confirm %s even after %d seconds", txHash, confirmWaitTime)
}
transactionErrors, _ := transaction.GetError(txHash, networkHandler)
@ -846,7 +846,7 @@ func init() {
Use: "staking",
Short: "newvalidator, editvalidator, delegate, undelegate or redelegate",
Long: `
Create a staking transaction, sign it, and send off to the Woop blockchain
Create a staking transaction, sign it, and send off to the Harmony blockchain
`,
RunE: func(cmd *cobra.Command, args []string) error {
cmd.Help()

@ -10,15 +10,15 @@ import (
"strings"
"time"
"github.com/woop-chain/go-sdk/pkg/address"
"github.com/woop-chain/go-sdk/pkg/common"
"github.com/woop-chain/go-sdk/pkg/rpc"
"github.com/woop-chain/go-sdk/pkg/sharding"
"github.com/woop-chain/go-sdk/pkg/store"
"github.com/woop-chain/go-sdk/pkg/transaction"
"github.com/woop-chain/go-sdk/pkg/validation"
"github.com/woop-chain/woop/accounts"
"github.com/woop-chain/woop/core"
"github.com/harmony-one/go-sdk/pkg/address"
"github.com/harmony-one/go-sdk/pkg/common"
"github.com/harmony-one/go-sdk/pkg/rpc"
"github.com/harmony-one/go-sdk/pkg/sharding"
"github.com/harmony-one/go-sdk/pkg/store"
"github.com/harmony-one/go-sdk/pkg/transaction"
"github.com/harmony-one/go-sdk/pkg/validation"
"github.com/harmony-one/harmony/accounts"
"github.com/harmony-one/harmony/core"
"github.com/spf13/cobra"
)
@ -42,7 +42,6 @@ var (
transferFileFlags []transferFlags
timeout uint32
timeFormat = "2006-01-02 15:04:05.000000"
data string
)
type transactionLog struct {
@ -170,11 +169,6 @@ func handlerForTransaction(txLog *transactionLog) error {
gLimit = uint64(tempLimit)
}
dataByte, err := transaction.StringToByte(data)
if err != nil {
return handlerForError(txLog, err)
}
addr := toAddress.String()
txLog.TimeSigned = time.Now().UTC().Format(timeFormat) // Approximate time of signature
@ -183,7 +177,7 @@ func handlerForTransaction(txLog *transactionLog) error {
&addr,
fromShardID, toShardID,
amt, gPrice,
dataByte,
[]byte{},
)
if dryRun {
@ -342,7 +336,7 @@ func init() {
Short: "Create and send a transaction",
Args: cobra.ExactArgs(0),
Long: `
Create a transaction, sign it, and send off to the Woop blockchain
Create a transaction, sign it, and send off to the Harmony blockchain
`,
PreRunE: func(cmd *cobra.Command, args []string) error {
if offlineSign {
@ -420,7 +414,6 @@ Create a transaction, sign it, and send off to the Woop blockchain
cmdTransfer.Flags().StringVar(&inputNonce, "nonce", "", "set nonce for tx")
cmdTransfer.Flags().Uint32Var(&fromShardID, "from-shard", 0, "source shard id")
cmdTransfer.Flags().Uint32Var(&toShardID, "to-shard", 0, "target shard id")
cmdTransfer.Flags().StringVar(&data, "data", "", "transaction data")
cmdTransfer.Flags().StringVar(&targetChain, "chain-id", "", "what chain ID to target")
cmdTransfer.Flags().Uint32Var(&timeout, "timeout", defaultTimeout, "set timeout in seconds. Set to 0 to not wait for confirm")
cmdTransfer.Flags().BoolVar(&userProvidesPassphrase, "passphrase", false, ppPrompt)
@ -456,7 +449,7 @@ Get Nonce From a Account
Short: "Send a Offline Signed transaction",
Args: cobra.ExactArgs(0),
Long: `
Send a offline signed transaction to the Woop blockchain
Send a offline signed to the Harmony blockchain
`,
PreRunE: func(cmd *cobra.Command, args []string) error {
if givenFilePath == "" {

@ -6,17 +6,17 @@ import (
"math/big"
"strings"
bls_core "github.com/harmony-one/bls/ffi/go/bls"
"github.com/harmony-one/go-sdk/pkg/address"
"github.com/harmony-one/go-sdk/pkg/rpc"
"github.com/harmony-one/harmony/crypto/bls"
"github.com/spf13/cobra"
bls_core "github.com/woop-chain/bls/ffi/go/bls"
"github.com/woop-chain/go-sdk/pkg/address"
"github.com/woop-chain/go-sdk/pkg/rpc"
"github.com/woop-chain/woop/crypto/bls"
)
func init() {
cmdUtilities := &cobra.Command{
Use: "utility",
Short: "common woop blockchain utilities",
Short: "common harmony blockchain utilities",
RunE: func(cmd *cobra.Command, args []string) error {
cmd.Help()
return nil

@ -4,9 +4,9 @@ import (
"fmt"
"strconv"
"github.com/harmony-one/go-sdk/pkg/rpc"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/woop-chain/go-sdk/pkg/rpc"
)
var (

@ -7,9 +7,9 @@ import (
)
const (
wikiDocsDir = "wiki-docs"
hmyDocsDir = "hmy-docs"
defaultNodeAddr = "http://localhost:9500"
defaultRpcPrefix = "wiki"
defaultRpcPrefix = "hmy"
defaultMainnetEndpoint = "https://api.s0.t.hmny.io/"
)
@ -30,88 +30,89 @@ Note:
Examples:
%s
./wiki --node=[NODE] balances <SOME_ONE_ADDRESS>
./hmy --node=[NODE] balances <SOME_ONE_ADDRESS>
%s
./wiki --node=[NODE] blockchain transaction-by-hash <SOME_TX_HASH>
./hmy --node=[NODE] blockchain transaction-by-hash <SOME_TX_HASH>
%s
./wiki keys list
./hmy keys list
%s
./wiki --node=[NODE] transfer \
./hmy --node=[NODE] transfer \
--from <SOME_ONE_ADDRESS> --to <SOME_ONE_ADDRESS> \
--from-shard 0 --to-shard 1 --amount 200 --passphrase
%s
./wiki --node=[NODE] transfer --file <PATH_TO_JSON_FILE>
./hmy --node=[NODE] transfer --file <PATH_TO_JSON_FILE>
Check README for details on json file format.
%s
./wiki --node=[NODE] blockchain transaction-receipt <SOME_TX_HASH>
./hmy --node=[NODE] blockchain transaction-receipt <SOME_TX_HASH>
%s
./wiki keys recover-from-mnemonic <ACCOUNT_NAME> --passphrase
./hmy keys recover-from-mnemonic <ACCOUNT_NAME> --passphrase
%s
./wiki keys import-ks <PATH_TO_KEYSTORE_JSON>
./hmy keys import-ks <PATH_TO_KEYSTORE_JSON>
%s
./wiki keys import-private-key <secp256k1_PRIVATE_KEY>
./hmy keys import-private-key <secp256k1_PRIVATE_KEY>
%s
./wiki keys export-private-key <ACCOUNT_ADDRESS> --passphrase
./hmy keys export-private-key <ACCOUNT_ADDRESS> --passphrase
%s
./wiki keys generate-bls-key --bls-file-path <PATH_FOR_BLS_KEY_FILE>
./hmy keys generate-bls-key --bls-file-path <PATH_FOR_BLS_KEY_FILE>
%s
./wiki --node=[NODE] staking create-validator --amount 10 --validator-addr <SOME_ONE_ADDRESS> \
./hmy --node=[NODE] staking create-validator --amount 10 --validator-addr <SOME_ONE_ADDRESS> \
--bls-pubkeys <BLS_KEY_1>,<BLS_KEY_2>,<BLS_KEY_3> \
--identity foo --details bar --name baz --max-change-rate 0.1 --max-rate 0.1 --max-total-delegation 10 \
--min-self-delegation 10 --rate 0.1 --security-contact Leo --website wikiwoop.com --passphrase
--min-self-delegation 10 --rate 0.1 --security-contact Leo --website harmony.one --passphrase
%s
./wiki --node=[NODE] staking edit-validator \
./hmy --node=[NODE] staking edit-validator \
--validator-addr <SOME_ONE_ADDRESS> --identity foo --details bar \
--name baz --security-contact EK --website wikiwoop.com \
--name baz --security-contact EK --website harmony.one \
--min-self-delegation 0 --max-total-delegation 10 --rate 0.1\
--add-bls-key <SOME_BLS_KEY> --remove-bls-key <OTHER_BLS_KEY> --passphrase
%s
./wiki --node=[NODE] staking delegate \
./hmy --node=[NODE] staking delegate \
--delegator-addr <SOME_ONE_ADDRESS> --validator-addr <VALIDATOR_ONE_ADDRESS> \
--amount 10 --passphrase
%s
./wiki --node=[NODE] staking undelegate \
./hmy --node=[NODE] staking undelegate \
--delegator-addr <SOME_ONE_ADDRESS> --validator-addr <VALIDATOR_ONE_ADDRESS> \
--amount 10 --passphrase
%s
./wiki --node=[NODE] staking collect-rewards \
./hmy --node=[NODE] staking collect-rewards \
--delegator-addr <SOME_ONE_ADDRESS> --passphrase
%s
./wiki --node=[NODE] blockchain validator elected
./hmy --node=[NODE] blockchain validator elected
%s
./wiki --node=[NODE] blockchain utility-metrics
./hmy --node=[NODE] blockchain utility-metrics
%s
./wiki --node=[NODE] failures staking
./hmy --node=[NODE] failures staking
%s
./wiki --node=[NODE] utility shard-for-bls <BLS_PUBLIC_KEY>
./hmy --node=[NODE] utility shard-for-bls <BLS_PUBLIC_KEY>
%s
./wiki governance vote-proposal --space=[woop-mainnet.eth] \
./hmy governance vote-proposal --space=[harmony-mainnet.eth] \
--proposal=<PROPOSAL_IPFS_HASH> --proposal-type=[single-choice] \
--choice=<VOTING_CHOICE(S)> --app=[APP] --key=<ACCOUNT_ADDRESS_OR_NAME>
PS: key must first use (wiki keys import-private-key) to import
--choice=<VOTING_CHOICE(S)> --app=[APP] --key=<ACCOUNT_ADDRESS_OR_NAME> \
--privacy=[PRIVACY TYPE]
PS: key must first use (hmy keys import-private-key) to import
%s
./wiki command --net=testnet
./hmy command --net=testnet
`,
g("1. Check account balance on given chain"),
g("2. Check sent transaction"),

@ -1,4 +1,4 @@
module github.com/woop-chain/go-sdk
module github.com/harmony-one/go-sdk
go 1.14
@ -12,9 +12,9 @@ require (
github.com/ethereum/go-ethereum v1.9.23
github.com/fatih/color v1.9.0
github.com/golang/snappy v0.0.2-0.20200707131729-196ae77b8a26 // indirect
github.com/woop-chain/bls v0.0.7-0.20191214005344-88c23f91a8a9
github.com/woop-chain/woop v1.10.2-0.20210123081216-6993b9ad0ca1
github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356
github.com/harmony-one/bls v0.0.7-0.20191214005344-88c23f91a8a9
github.com/harmony-one/harmony v1.10.2-0.20210123081216-6993b9ad0ca1
github.com/karalabe/hid v1.0.0
github.com/mattn/go-colorable v0.1.9
github.com/mitchellh/go-homedir v1.1.0
github.com/olekukonko/tablewriter v0.0.5 // indirect
@ -22,9 +22,9 @@ require (
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v0.0.5
github.com/tyler-smith/go-bip39 v1.0.2
github.com/valyala/fasthttp v1.2.0
github.com/valyala/fasthttp v1.34.0
github.com/valyala/fastjson v1.6.3
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a
golang.org/x/crypto v0.0.0-20220214200702-86341886e292
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)

@ -47,6 +47,8 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKSc=
github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY=
github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/aristanetworks/fsnotify v1.4.2/go.mod h1:D/rtu7LpjYM8tRJphJ0hUBYpjai8SfX+aSNsWDTq/Ks=
@ -352,16 +354,16 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU=
github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48=
github.com/woop-chain/gencodec v0.0.0-20190215044613-e6740dbdd846/go.mod h1:YZcPnufUw70msUSudLvxcQOSpnZJgaMS9WIU8IGEtBg=
github.com/woop-chain/abool v1.0.1/go.mod h1:9sq0PJzb1SqRpKrpEV4Ttvm9WV5uud8sfrsPw3AIBJA=
github.com/woop-chain/bls v0.0.6/go.mod h1:ML9osB/z3hR9WAYZVj7qH+IP6oaPRPmshDbxrQyia7g=
github.com/woop-chain/bls v0.0.7-0.20191214005344-88c23f91a8a9 h1:mG6rcfYadQAkWJn5mnfRnJ4plNf2XNvuadiirLcsmr0=
github.com/woop-chain/bls v0.0.7-0.20191214005344-88c23f91a8a9/go.mod h1:ML9osB/z3hR9WAYZVj7qH+IP6oaPRPmshDbxrQyia7g=
github.com/woop-chain/woop v1.10.2-0.20210123081216-6993b9ad0ca1 h1:bu87yqH7Vy5kN33Z9c3/fh5bWkiKBDDnlwY+i2qJook=
github.com/woop-chain/woop v1.10.2-0.20210123081216-6993b9ad0ca1/go.mod h1:QsUfRGisvY6k1KvpzVeBI3VBdHhYLlpVQTEbzrMmw1U=
github.com/woop-chain/taggedrlp v0.1.4 h1:RZ+qy0VCzT+d/mTfq23gH3an5tSvxOhg6AddLDO6tKw=
github.com/woop-chain/taggedrlp v0.1.4/go.mod h1:osO5TRXLKdgCP+oj2J9qfqhywMOOA+4nP5q+o8nDSYA=
github.com/woop-chain/vdf v0.0.0-20190924175951-620379da8849/go.mod h1:EgNU7X5HLNBBho+OqCm1A1NrpD6xb1SHfi9pMCYaKKw=
github.com/harmony-ek/gencodec v0.0.0-20190215044613-e6740dbdd846/go.mod h1:YZcPnufUw70msUSudLvxcQOSpnZJgaMS9WIU8IGEtBg=
github.com/harmony-one/abool v1.0.1/go.mod h1:9sq0PJzb1SqRpKrpEV4Ttvm9WV5uud8sfrsPw3AIBJA=
github.com/harmony-one/bls v0.0.6/go.mod h1:ML9osB/z3hR9WAYZVj7qH+IP6oaPRPmshDbxrQyia7g=
github.com/harmony-one/bls v0.0.7-0.20191214005344-88c23f91a8a9 h1:mG6rcfYadQAkWJn5mnfRnJ4plNf2XNvuadiirLcsmr0=
github.com/harmony-one/bls v0.0.7-0.20191214005344-88c23f91a8a9/go.mod h1:ML9osB/z3hR9WAYZVj7qH+IP6oaPRPmshDbxrQyia7g=
github.com/harmony-one/harmony v1.10.2-0.20210123081216-6993b9ad0ca1 h1:bu87yqH7Vy5kN33Z9c3/fh5bWkiKBDDnlwY+i2qJook=
github.com/harmony-one/harmony v1.10.2-0.20210123081216-6993b9ad0ca1/go.mod h1:QsUfRGisvY6k1KvpzVeBI3VBdHhYLlpVQTEbzrMmw1U=
github.com/harmony-one/taggedrlp v0.1.4 h1:RZ+qy0VCzT+d/mTfq23gH3an5tSvxOhg6AddLDO6tKw=
github.com/harmony-one/taggedrlp v0.1.4/go.mod h1:osO5TRXLKdgCP+oj2J9qfqhywMOOA+4nP5q+o8nDSYA=
github.com/harmony-one/vdf v0.0.0-20190924175951-620379da8849/go.mod h1:EgNU7X5HLNBBho+OqCm1A1NrpD6xb1SHfi9pMCYaKKw=
github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
@ -471,6 +473,8 @@ github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0=
github.com/karalabe/hid v1.0.0 h1:+/CIMNXhSU/zIJgnIvBD2nKHxS/bnRHhhs9xBryLpPo=
github.com/karalabe/hid v1.0.0/go.mod h1:Vr51f8rUOLYrfrWDFlV12GGQgM5AT8sVh+2fY4MPeu8=
github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356 h1:I/yrLt2WilKxlQKCM52clh5rGzTKpVctGT1lH4Dc8Jw=
github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
@ -478,11 +482,11 @@ github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQL
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
github.com/klauspost/compress v1.4.1 h1:8VMb5+0wMgdBykOV96DwNwKFQ+WTI4pzYURP99CcB9E=
github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
github.com/klauspost/compress v1.15.0 h1:xqfchp4whNFxn5A4XFyyYtitiWI8Hy5EW59jEwcyL6U=
github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/cpuid v1.2.1 h1:vJi+O/nMdFt0vqm8NZBI6wzALWdA2X+egi0ogNyrC/w=
github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/reedsolomon v1.9.2/go.mod h1:CwCi+NUr9pqSVktrkN+Ondf06rkhYZ/pcNv7fu+8Un4=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
@ -1042,12 +1046,14 @@ github.com/uudashr/gocognit v0.0.0-20190926065955-1655d0de0517/go.mod h1:j44Ayx2
github.com/uudashr/gocognit v1.0.1/go.mod h1:j44Ayx2KW4+oB6SWMv8KsmHzZrOInQav7D3cQMJ5JUM=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.2.0 h1:dzZJf2IuMiclVjdw0kkT+f9u4YdrapbNyGAN47E/qnk=
github.com/valyala/fasthttp v1.2.0/go.mod h1:4vX61m6KN+xDduDNwXrhIAVZaZaZiQ1luJk8LWSxF3s=
github.com/valyala/fasthttp v1.34.0 h1:d3AAQJ2DRcxJYHm7OXNXtXt2as1vMDfxeIcFvhmGGm4=
github.com/valyala/fasthttp v1.34.0/go.mod h1:epZA5N+7pY6ZaEKRmstzOuYJx9HI8DI1oaCGZpdH4h0=
github.com/valyala/fastjson v1.6.3 h1:tAKFnnwmeMGPbwJ7IwxcTPCNr3uIzoIj3/Fh90ra4xc=
github.com/valyala/fastjson v1.6.3/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY=
github.com/valyala/quicktemplate v1.2.0/go.mod h1:EH+4AkTd43SvgIbQHYu59/cJyxDoOVRUAfrukLPuGJ4=
github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
github.com/vmihailenco/msgpack/v4 v4.3.11/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
github.com/vmihailenco/msgpack/v5 v5.0.0-beta.1/go.mod h1:xlngVLeyQ/Qi05oQxhQ+oTuqa03RjMwMfk/7/TCs+QI=
github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
@ -1122,8 +1128,9 @@ golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM=
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
@ -1167,8 +1174,10 @@ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200904194848-62affa334b73 h1:MXfv8rhZWmFeqX3GNZRsd6vOLoaCHjYEX3qkRo3YBUA=
golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/oauth2 v0.0.0-20170912212905-13449ad91cb2/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@ -1227,14 +1236,23 @@ golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 h1:nhht2DYV/Sn3qOayu8lM+cU1ii9sTLUeBQwQQfUHtrs=
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20170424234030-8be79e1e0910/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

@ -3,7 +3,7 @@ package account
import (
"testing"
"github.com/woop-chain/go-sdk/pkg/store"
"github.com/harmony-one/go-sdk/pkg/store"
)
func TestAccountGetsRemoved(t *testing.T) {

@ -3,9 +3,9 @@ package account
import (
"errors"
"github.com/woop-chain/go-sdk/pkg/keys"
"github.com/woop-chain/go-sdk/pkg/mnemonic"
"github.com/woop-chain/go-sdk/pkg/store"
"github.com/harmony-one/go-sdk/pkg/keys"
"github.com/harmony-one/go-sdk/pkg/mnemonic"
"github.com/harmony-one/go-sdk/pkg/store"
)
var (

@ -5,8 +5,8 @@ import (
"fmt"
"path/filepath"
"github.com/woop-chain/go-sdk/pkg/store"
"github.com/woop-chain/woop/accounts"
"github.com/harmony-one/go-sdk/pkg/store"
"github.com/harmony-one/harmony/accounts"
)
var (

@ -3,22 +3,21 @@ package account
import (
"encoding/hex"
"fmt"
"github.com/ethereum/go-ethereum/crypto"
"github.com/mitchellh/go-homedir"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
"github.com/ethereum/go-ethereum/crypto"
"github.com/mitchellh/go-homedir"
"github.com/btcsuite/btcd/btcec"
mapset "github.com/deckarep/golang-set"
"github.com/woop-chain/go-sdk/pkg/address"
"github.com/woop-chain/go-sdk/pkg/common"
"github.com/woop-chain/go-sdk/pkg/mnemonic"
"github.com/woop-chain/go-sdk/pkg/store"
"github.com/woop-chain/woop/accounts/keystore"
"github.com/harmony-one/go-sdk/pkg/address"
"github.com/harmony-one/go-sdk/pkg/common"
"github.com/harmony-one/go-sdk/pkg/mnemonic"
"github.com/harmony-one/go-sdk/pkg/store"
"github.com/harmony-one/harmony/accounts/keystore"
)
// ImportFromPrivateKey allows import of an ECDSA private key

@ -5,9 +5,9 @@ import (
"os"
"path"
"github.com/harmony-one/go-sdk/pkg/common"
"github.com/harmony-one/go-sdk/pkg/store"
"github.com/mitchellh/go-homedir"
"github.com/woop-chain/go-sdk/pkg/common"
"github.com/woop-chain/go-sdk/pkg/store"
)
// RemoveAccount - removes an account from the keystore
@ -19,8 +19,8 @@ func RemoveAccount(name string) error {
}
uDir, _ := homedir.Dir()
wikiCLIDir := path.Join(uDir, common.DefaultConfigDirName, common.DefaultConfigAccountAliasesDirName)
accountDir := fmt.Sprintf("%s/%s", wikiCLIDir, name)
hmyCLIDir := path.Join(uDir, common.DefaultConfigDirName, common.DefaultConfigAccountAliasesDirName)
accountDir := fmt.Sprintf("%s/%s", hmyCLIDir, name)
os.RemoveAll(accountDir)
return nil

@ -8,7 +8,7 @@ import (
"strconv"
"strings"
"github.com/woop-chain/woop/numeric"
"github.com/harmony-one/harmony/numeric"
)
var (

@ -1,7 +1,7 @@
package common
import (
"github.com/woop-chain/woop/accounts/keystore"
"github.com/harmony-one/harmony/accounts/keystore"
)
func KeyStoreForPath(p string) *keystore.KeyStore {

@ -4,11 +4,11 @@ import (
"errors"
"os"
"github.com/woop-chain/woop/accounts/keystore"
"github.com/harmony-one/harmony/accounts/keystore"
)
const (
DefaultConfigDirName = ".wiki_cli"
DefaultConfigDirName = ".hmy_cli"
DefaultConfigAccountAliasesDirName = "account-keys"
DefaultCommandAliasesDirName = "command"
DefaultPassphrase = ""
@ -28,13 +28,13 @@ var (
)
func init() {
if _, enabled := os.LookupEnv("WIKI_RPC_DEBUG"); enabled != false {
if _, enabled := os.LookupEnv("HMY_RPC_DEBUG"); enabled != false {
DebugRPC = true
}
if _, enabled := os.LookupEnv("WIKI_TX_DEBUG"); enabled != false {
if _, enabled := os.LookupEnv("HMY_TX_DEBUG"); enabled != false {
DebugTransaction = true
}
if _, enabled := os.LookupEnv("WIKI_ALL_DEBUG"); enabled != false {
if _, enabled := os.LookupEnv("HMY_ALL_DEBUG"); enabled != false {
EnableAllVerbose()
}
}

@ -3,8 +3,8 @@ package console
import (
"encoding/json"
"fmt"
"github.com/woop-chain/go-sdk/pkg/console/jsre"
"github.com/woop-chain/go-sdk/pkg/console/prompt"
"github.com/harmony-one/go-sdk/pkg/console/jsre"
"github.com/harmony-one/go-sdk/pkg/console/prompt"
"io"
"reflect"
"strings"

@ -4,6 +4,18 @@ import (
"encoding/hex"
"errors"
"fmt"
ethereum_rpc "github.com/ethereum/go-ethereum/rpc"
"github.com/harmony-one/go-sdk/pkg/account"
"github.com/harmony-one/go-sdk/pkg/address"
"github.com/harmony-one/go-sdk/pkg/common"
"github.com/harmony-one/go-sdk/pkg/console/jsre"
"github.com/harmony-one/go-sdk/pkg/console/jsre/deps"
"github.com/harmony-one/go-sdk/pkg/console/prompt"
"github.com/harmony-one/go-sdk/pkg/console/web3ext"
"github.com/harmony-one/go-sdk/pkg/rpc"
"github.com/harmony-one/go-sdk/pkg/store"
"github.com/harmony-one/go-sdk/pkg/transaction"
"github.com/harmony-one/harmony/accounts"
"io"
"io/ioutil"
"math/big"
@ -17,19 +29,6 @@ import (
"syscall"
"time"
ethereum_rpc "github.com/ethereum/go-ethereum/rpc"
"github.com/woop-chain/go-sdk/pkg/account"
"github.com/woop-chain/go-sdk/pkg/address"
"github.com/woop-chain/go-sdk/pkg/common"
"github.com/woop-chain/go-sdk/pkg/console/jsre"
"github.com/woop-chain/go-sdk/pkg/console/jsre/deps"
"github.com/woop-chain/go-sdk/pkg/console/prompt"
"github.com/woop-chain/go-sdk/pkg/console/web3ext"
"github.com/woop-chain/go-sdk/pkg/rpc"
"github.com/woop-chain/go-sdk/pkg/store"
"github.com/woop-chain/go-sdk/pkg/transaction"
"github.com/woop-chain/woop/accounts"
"github.com/dop251/goja"
"github.com/mattn/go-colorable"
"github.com/peterh/liner"
@ -58,9 +57,9 @@ type Config struct {
Prompter prompt.UserPrompter // Input prompter to allow interactive user feedback (defaults to TerminalPrompter)
Printer io.Writer // Output writer to serialize any display strings to (defaults to os.Stdout)
Preload []string // Absolute paths to JavaScript files to preload
NodeUrl string // Wiki Node url
ShardId int // Wiki Shard ID
Net string // Wiki Network
NodeUrl string // Hmy Node url
ShardId int // Hmy Shard ID
Net string // Hmy Network
}
// Console is a JavaScript interpreted runtime environment. It is a fully fledged
@ -74,9 +73,9 @@ type Console struct {
histPath string // Absolute path to the console scrollback history
history []string // Scroll history maintained by the console
printer io.Writer // Output writer to serialize any display strings to
nodeUrl string // Wiki Node url
shardId int // Wiki Shard ID
net string // Wiki Network
nodeUrl string // Hmy Node url
shardId int // Hmy Shard ID
net string // Hmy Network
}
// New initializes a JavaScript interpreted runtime environment and sets defaults
@ -243,14 +242,14 @@ func (c *Console) initPersonal(vm *goja.Runtime, bridge *bridge) {
if personal == nil || c.prompter == nil {
return
}
personal.Set("getListAccounts", jsre.MakeCallback(vm, bridge.WikiGetListAccounts))
personal.Set("signTransaction", jsre.MakeCallback(vm, bridge.callbackProtected(bridge.WikiSignTransaction)))
personal.Set("sendTransaction", jsre.MakeCallback(vm, bridge.callbackProtected(bridge.WikiSendTransaction)))
personal.Set("lockAccount", jsre.MakeCallback(vm, bridge.callbackProtected(bridge.WikiLockAccount)))
personal.Set("importRawKey", jsre.MakeCallback(vm, bridge.WikiImportRawKey))
personal.Set("unlockAccount", jsre.MakeCallback(vm, bridge.callbackProtected(bridge.WikiUnlockAccount)))
personal.Set("newAccount", jsre.MakeCallback(vm, bridge.callbackProtected(bridge.WikiNewAccount)))
personal.Set("sign", jsre.MakeCallback(vm, bridge.callbackProtected(bridge.WikiSign)))
personal.Set("getListAccounts", jsre.MakeCallback(vm, bridge.HmyGetListAccounts))
personal.Set("signTransaction", jsre.MakeCallback(vm, bridge.callbackProtected(bridge.HmySignTransaction)))
personal.Set("sendTransaction", jsre.MakeCallback(vm, bridge.callbackProtected(bridge.HmySendTransaction)))
personal.Set("lockAccount", jsre.MakeCallback(vm, bridge.callbackProtected(bridge.HmyLockAccount)))
personal.Set("importRawKey", jsre.MakeCallback(vm, bridge.HmyImportRawKey))
personal.Set("unlockAccount", jsre.MakeCallback(vm, bridge.callbackProtected(bridge.HmyUnlockAccount)))
personal.Set("newAccount", jsre.MakeCallback(vm, bridge.callbackProtected(bridge.HmyNewAccount)))
personal.Set("sign", jsre.MakeCallback(vm, bridge.callbackProtected(bridge.HmySign)))
_, err := vm.RunString(`Object.defineProperty(personal, "listAccounts", {get: personal.getListAccounts});`)
if err != nil {
@ -264,8 +263,8 @@ func (c *Console) initEth(vm *goja.Runtime, bridge *bridge) {
return
}
eth.Set("sendTransaction", jsre.MakeCallback(vm, bridge.callbackProtected(bridge.WikiSendTransaction)))
eth.Set("signTransaction", jsre.MakeCallback(vm, bridge.callbackProtected(bridge.WikiSignTransaction)))
eth.Set("sendTransaction", jsre.MakeCallback(vm, bridge.callbackProtected(bridge.HmySendTransaction)))
eth.Set("signTransaction", jsre.MakeCallback(vm, bridge.callbackProtected(bridge.HmySignTransaction)))
}
func (c *Console) clearHistory() {
@ -319,7 +318,7 @@ func (c *Console) AutoCompleteInput(line string, pos int) (string, []string, str
// Welcome show summary of current Geth instance and some metadata about the
// console's available modules.
func (c *Console) Welcome() {
message := "Welcome to the Wiki JavaScript console!\n\n"
message := "Welcome to the Hmy JavaScript console!\n\n"
// Print some generic Geth metadata
if res, err := c.jsre.Run(`
@ -327,7 +326,7 @@ func (c *Console) Welcome() {
try {
message += "coinbase: " + eth.coinbase + "\n";
} catch (err) {}
message += "at shard: " + wiki.shardID + "\n";
message += "at shard: " + hmy.shardID + "\n";
message += "at block: " + eth.blockNumber + " (" + new Date(1000 * eth.getBlock(eth.blockNumber).timestamp) + ")\n";
try {
message += " datadir: " + admin.datadir + "\n";
@ -531,7 +530,7 @@ func (b *bridge) callbackProtected(protectedFunc func(call jsre.Call) (goja.Valu
}
}
func (b *bridge) WikiGetListAccounts(call jsre.Call) (goja.Value, error) {
func (b *bridge) HmyGetListAccounts(call jsre.Call) (goja.Value, error) {
var accounts = []string{}
for _, name := range store.LocalAccounts() {
@ -545,7 +544,7 @@ func (b *bridge) WikiGetListAccounts(call jsre.Call) (goja.Value, error) {
return call.VM.ToValue(accounts), nil
}
func (b *bridge) WikiSignTransaction(call jsre.Call) (goja.Value, error) {
func (b *bridge) HmySignTransaction(call jsre.Call) (goja.Value, error) {
txObj := call.Arguments[0].ToObject(call.VM)
password := call.Arguments[1].String()
@ -554,10 +553,6 @@ func (b *bridge) WikiSignTransaction(call jsre.Call) (goja.Value, error) {
gasLimit := getStringFromJsObjWithDefault(txObj, "gas", "1000000")
amount := getStringFromJsObjWithDefault(txObj, "value", "0")
gasPrice := getStringFromJsObjWithDefault(txObj, "gasPrice", "1")
input, err := transaction.StringToByte(getStringFromJsObjWithDefault(txObj, "data", ""))
if err != nil {
return nil, err
}
networkHandler := rpc.NewHTTPHandler(b.console.nodeUrl)
chanId, err := common.StringToChainID(b.console.net)
@ -603,7 +598,7 @@ func (b *bridge) WikiSignTransaction(call jsre.Call) (goja.Value, error) {
toP,
uint32(b.console.shardId), uint32(b.console.shardId),
amt, gPrice,
input,
[]byte{},
)
if err != nil {
return nil, err
@ -628,7 +623,7 @@ func (b *bridge) WikiSignTransaction(call jsre.Call) (goja.Value, error) {
}), nil
}
func (b *bridge) WikiSendTransaction(call jsre.Call) (goja.Value, error) {
func (b *bridge) HmySendTransaction(call jsre.Call) (goja.Value, error) {
txObj := call.Arguments[0].ToObject(call.VM)
password := ""
if len(call.Arguments) > 1 {
@ -640,10 +635,6 @@ func (b *bridge) WikiSendTransaction(call jsre.Call) (goja.Value, error) {
gasLimit := getStringFromJsObjWithDefault(txObj, "gas", "1000000")
amount := getStringFromJsObjWithDefault(txObj, "value", "0")
gasPrice := getStringFromJsObjWithDefault(txObj, "gasPrice", "1")
input, err := transaction.StringToByte(getStringFromJsObjWithDefault(txObj, "data", ""))
if err != nil {
return nil, err
}
networkHandler := rpc.NewHTTPHandler(b.console.nodeUrl)
chanId, err := common.StringToChainID(b.console.net)
@ -689,7 +680,7 @@ func (b *bridge) WikiSendTransaction(call jsre.Call) (goja.Value, error) {
toP,
uint32(b.console.shardId), uint32(b.console.shardId),
amt, gPrice,
input,
[]byte{},
)
if err != nil {
return nil, err
@ -698,7 +689,7 @@ func (b *bridge) WikiSendTransaction(call jsre.Call) (goja.Value, error) {
return call.VM.ToValue(*ctrlr.TransactionHash()), nil
}
func (b *bridge) WikiLockAccount(call jsre.Call) (goja.Value, error) {
func (b *bridge) HmyLockAccount(call jsre.Call) (goja.Value, error) {
address := call.Arguments[0].String()
_, _, err := store.LockKeystore(address)
@ -709,7 +700,7 @@ func (b *bridge) WikiLockAccount(call jsre.Call) (goja.Value, error) {
return goja.Null(), nil
}
func (b *bridge) WikiImportRawKey(call jsre.Call) (goja.Value, error) {
func (b *bridge) HmyImportRawKey(call jsre.Call) (goja.Value, error) {
privateKey := call.Arguments[0].String()
password := call.Arguments[1].String()
@ -721,7 +712,7 @@ func (b *bridge) WikiImportRawKey(call jsre.Call) (goja.Value, error) {
return call.VM.ToValue(name), nil
}
func (b *bridge) WikiUnlockAccount(call jsre.Call) (goja.Value, error) {
func (b *bridge) HmyUnlockAccount(call jsre.Call) (goja.Value, error) {
if len(call.Arguments) < 3 {
return nil, errors.New("arguments < 3")
}
@ -737,11 +728,11 @@ func (b *bridge) WikiUnlockAccount(call jsre.Call) (goja.Value, error) {
return goja.Null(), nil
}
func (b *bridge) WikiNewAccount(call jsre.Call) (goja.Value, error) {
func (b *bridge) HmyNewAccount(call jsre.Call) (goja.Value, error) {
return goja.Null(), nil
}
func (b *bridge) WikiSign(call jsre.Call) (goja.Value, error) {
func (b *bridge) HmySign(call jsre.Call) (goja.Value, error) {
dataToSign := call.Arguments[0].String()
addressStr := call.Arguments[1].String()
password := call.Arguments[2].String()

@ -2,12 +2,11 @@ package console
import (
"fmt"
"strconv"
"github.com/dop251/goja"
"github.com/woop-chain/woop/accounts"
"github.com/woop-chain/woop/accounts/keystore"
"github.com/woop-chain/woop/crypto/hash"
"github.com/harmony-one/harmony/accounts"
"github.com/harmony-one/harmony/accounts/keystore"
"github.com/harmony-one/harmony/crypto/hash"
"strconv"
)
func signMessageWithPassword(keyStore *keystore.KeyStore, account accounts.Account, password string, data []byte) (sign []byte, err error) {

@ -17,7 +17,7 @@ var Modules = map[string]string{
"txpool": TxpoolJs,
"les": LESJs,
"vflux": VfluxJs,
"wiki": WikiJs,
"hmy": HmyJs,
}
const ChequebookJs = `
@ -904,9 +904,9 @@ web3._extend({
});
`
const WikiJs = `
const HmyJs = `
web3._extend({
property: 'wiki',
property: 'hmy',
methods:
[

@ -3,8 +3,8 @@ package governance
import (
"fmt"
"github.com/woop-chain/woop/accounts"
"github.com/woop-chain/woop/accounts/keystore"
"github.com/harmony-one/harmony/accounts"
"github.com/harmony-one/harmony/accounts/keystore"
)
func DoVote(keyStore *keystore.KeyStore, account accounts.Account, vote Vote) error {

@ -125,12 +125,6 @@ func (typedData *TypedData) String() (string, error) {
Types core.Types `json:"types"`
Message core.TypedDataMessage `json:"message"`
}
var ts uint64
var err error
if ts, err = toUint64(typedData.Message["timestamp"]); err != nil {
// should not happen
return "", errors.Wrapf(err, "timestamp")
}
formatted := data{
Domain: domain{
Name: typedData.Domain.Name,
@ -142,35 +136,14 @@ func (typedData *TypedData) String() (string, error) {
Message: core.TypedDataMessage{
"space": typedData.Message["space"],
"proposal": typedData.Message["proposal"],
"choice": typedData.Message["choice"],
"choice": toUint64(typedData.Message["choice"]),
"app": typedData.Message["app"],
"reason": typedData.Message["reason"],
// this conversion is required to stop snapshot
// from complaining about `wrong envelope format`
"timestamp": ts,
"timestamp": toUint64(typedData.Message["timestamp"]),
"from": typedData.Message["from"],
},
}
// same comment as above
if typedData.Types["Vote"][4].Type == "uint32" {
if choice, err := toUint64(typedData.Message["choice"]); err != nil {
return "", errors.Wrapf(err, "choice")
} else {
formatted.Message["choice"] = choice
}
// prevent hex choice interpretation
} else if typedData.Types["Vote"][4].Type == "uint32[]" {
arr := typedData.Message["choice"].([]interface{})
res := make([]uint64, len(arr))
for i, a := range arr {
if c, err := toUint64(a); err != nil {
return "", errors.Wrapf(err, "choice member %d", i)
} else {
res[i] = c
}
}
formatted.Message["choice"] = res
}
message, err := json.Marshal(formatted)
if err != nil {
return "", err
@ -179,13 +152,11 @@ func (typedData *TypedData) String() (string, error) {
}
}
func toUint64(x interface{}) (uint64, error) {
func toUint64(x interface{}) uint64 {
y, ok := x.(*math.HexOrDecimal256)
if !ok {
return 0, errors.New(
fmt.Sprintf("%+v is not a *math.HexOrDecimal256", x),
)
panic("not a *math.HexOrDecimal256")
}
z := (*big.Int)(y)
return z.Uint64(), nil
}
return z.Uint64()
}

@ -4,10 +4,10 @@ import (
"fmt"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/harmony-one/harmony/accounts"
"github.com/harmony-one/harmony/accounts/keystore"
"github.com/harmony-one/harmony/crypto/hash"
"github.com/pkg/errors"
"github.com/woop-chain/woop/accounts"
"github.com/woop-chain/woop/accounts/keystore"
"github.com/woop-chain/woop/crypto/hash"
)
func encodeForSigning(typedData *TypedData) ([]byte, error) {

@ -7,8 +7,8 @@ import (
"testing"
"github.com/btcsuite/btcd/btcec"
"github.com/woop-chain/go-sdk/pkg/common"
"github.com/woop-chain/woop/accounts"
"github.com/harmony-one/go-sdk/pkg/common"
"github.com/harmony-one/harmony/accounts"
)
func TestSigning(t *testing.T) {
@ -28,7 +28,7 @@ func TestSigning(t *testing.T) {
}
// add a temporary key store with the below private key
location := path.Join(os.TempDir(), "wiki-test")
location := path.Join(os.TempDir(), "hmy-test")
keyStore := common.KeyStoreForPath(location)
privateKeyBytes, _ := hex.DecodeString("91c8360c4cb4b5fac45513a7213f31d4e4a7bfcb4630e9fbf074f42a203ac0b9")
sk, _ := btcec.PrivKeyFromBytes(btcec.S256(), privateKeyBytes)

@ -2,7 +2,6 @@ package governance
import (
"encoding/json"
"fmt"
"strconv"
"strings"
"time"
@ -13,24 +12,15 @@ import (
"github.com/pkg/errors"
)
var (
voteToNumberMapping = map[string]int64{
"for": 1,
"against": 2,
"abstain": 3,
}
)
type Vote struct {
From string // --key
Space string // --space
Proposal string // --proposal
ProposalType string // --proposal-type
Choice string // --choice
// Privacy string // --privacy
App string // --app
Reason string // --reason
Timestamp int64 // not exposed to the end user
Privacy string // --privacy
App string // --app
Timestamp int64 // not exposed to the end user
}
func (v *Vote) ToEIP712() (*TypedData, error) {
@ -74,70 +64,35 @@ func (v *Vote) ToEIP712() (*TypedData, error) {
proposal = v.Proposal
}
// vote type, vote choice and vote privacy (TODO)
// vote type, vote choice and vote privacy
// choice needs to be converted into its native format for envelope
var choice interface{}
// The space between [1, 2, 3] does not matter since we parse it
// wiki governance vote-proposal \
// --space woop-mainnet.eth \
// --proposal 0xTruncated \
// --proposal-type {"approval","ranked-choice"} \
// --choice "[1, 2, 3]" \
// --key <name of pk>
if v.ProposalType == "approval" || v.ProposalType == "ranked-choice" {
myType = append(myType, eip712.Type{
Name: "choice",
Type: "uint32[]",
})
var is []int64
var is []int
if err := json.Unmarshal([]byte(v.Choice), &is); err == nil {
local := make([]interface{}, len(is))
for i := range is {
local[i] = math.NewHexOrDecimal256(is[i])
}
choice = local
choice = is
} else {
return nil, errors.Wrapf(err,
"unexpected value of choice %s (expected uint32[])", choice,
)
}
// The space between --choice {value} does not matter to snapshot.org
// But for comparing with the snapshot-js library, remove it
// wiki governance vote-proposal \
// --space woop-mainnet.eth \
// --proposal 0xTruncated \
// # either quadratic or weighted
// --proposal-type {"quadratic","weighted"} \
// # 20, 20, 40 of my vote (total 80) goes to 1, 2, 3 - note the single / double quotes
// --choice '{"1":20,"2":20,"3":40}' \
// --key <name of pk>
} else if v.ProposalType == "quadratic" || v.ProposalType == "weighted" {
myType = append(myType, eip712.Type{
Name: "choice",
Type: "string",
})
choice = v.Choice
// TODO Untested
// wiki governance vote-proposal \
// --space woop-mainnet.eth \
// --proposal 0xTruncated \
// --proposal-type ANY \
// --choice "unknown-format" \
// --key <name of pk>
// --privacy shutter
// } else if v.Privacy == "shutter" {
// myType = append(myType, eip712.Type{
// Name: "choice",
// Type: "string",
// })
// choice = v.Choice
// wiki governance vote-proposal \
// --space woop-mainnet.eth \
// --proposal 0xTruncated \
// --proposal-type single-choice \
// --choice 1 \
// --key <name of pk>
} else if v.ProposalType == "single-choice" {
} else if v.Privacy == "shutter" {
myType = append(myType, eip712.Type{
Name: "choice",
Type: "string",
})
choice = v.Choice
} else {
myType = append(myType, eip712.Type{
Name: "choice",
Type: "uint32",
@ -149,53 +104,19 @@ func (v *Vote) ToEIP712() (*TypedData, error) {
} else {
choice = math.NewHexOrDecimal256(int64(x))
}
// wiki governance vote-proposal \
// --space woop-mainnet.eth \
// --proposal 0xTruncated \
// --proposal-type basic \
// # any character case works
// --choice {aBstAin/agAiNst/for} \
// --key <name of pk>
} else if v.ProposalType == "basic" {
myType = append(myType, eip712.Type{
Name: "choice",
Type: "uint32",
})
if number, ok := voteToNumberMapping[strings.ToLower(v.Choice)]; ok {
choice = math.NewHexOrDecimal256(number)
} else {
return nil, errors.New(
fmt.Sprintf(
"unknown basic choice %s",
v.Choice,
),
)
}
} else {
return nil, errors.New(
fmt.Sprintf(
"unknown proposal type %s",
v.ProposalType,
),
)
}
// order matters so these are added last
myType = append(myType, eip712.Type{
Name: "reason",
Type: "string",
})
// order matters so this is added last
myType = append(myType, eip712.Type{
Name: "app",
Type: "string",
})
// metadata is skipped in this code intentionally
if v.Timestamp == 0 {
v.Timestamp = time.Now().Unix()
}
return &TypedData{
typedData := TypedData{
eip712.TypedData{
Domain: eip712.TypedDataDomain{
Name: name,
@ -221,10 +142,11 @@ func (v *Vote) ToEIP712() (*TypedData, error) {
"timestamp": math.NewHexOrDecimal256(v.Timestamp),
"proposal": proposal,
"choice": choice,
"reason": v.Reason,
"app": v.App,
},
PrimaryType: "Vote",
},
}, nil
}
return &typedData, nil
}

@ -16,17 +16,17 @@ import (
"path"
"strings"
bls_core "github.com/woop-chain/bls/ffi/go/bls"
"github.com/woop-chain/go-sdk/pkg/common"
"github.com/woop-chain/go-sdk/pkg/sharding"
"github.com/woop-chain/go-sdk/pkg/validation"
"github.com/woop-chain/woop/crypto/bls"
"github.com/woop-chain/woop/crypto/hash"
"github.com/woop-chain/woop/staking/types"
bls_core "github.com/harmony-one/bls/ffi/go/bls"
"github.com/harmony-one/go-sdk/pkg/common"
"github.com/harmony-one/go-sdk/pkg/sharding"
"github.com/harmony-one/go-sdk/pkg/validation"
"github.com/harmony-one/harmony/crypto/bls"
"github.com/harmony-one/harmony/crypto/hash"
"github.com/harmony-one/harmony/staking/types"
"golang.org/x/crypto/ssh/terminal"
)
// BlsKey - struct to represent bls key data
//BlsKey - struct to represent bls key data
type BlsKey struct {
PrivateKey *bls_core.SecretKey
PublicKey *bls_core.PublicKey
@ -37,7 +37,7 @@ type BlsKey struct {
ShardPublicKey *bls.SerializedPublicKey
}
// Initialize - initialize a bls key and assign a random private bls key if not already done
//Initialize - initialize a bls key and assign a random private bls key if not already done
func (blsKey *BlsKey) Initialize() {
if blsKey.PrivateKey == nil {
blsKey.PrivateKey = bls.RandPrivateKey()
@ -47,7 +47,7 @@ func (blsKey *BlsKey) Initialize() {
}
}
// Reset - resets the currently assigned private and public key fields
//Reset - resets the currently assigned private and public key fields
func (blsKey *BlsKey) Reset() {
blsKey.PrivateKey = nil
blsKey.PrivateKeyHex = ""

@ -7,8 +7,8 @@ import (
"strings"
ethCommon "github.com/ethereum/go-ethereum/common"
"github.com/woop-chain/go-sdk/pkg/address"
"github.com/woop-chain/woop/accounts/keystore"
"github.com/harmony-one/go-sdk/pkg/address"
"github.com/harmony-one/harmony/accounts/keystore"
// "github.com/ethereum/go-ethereum/crypto"
@ -17,33 +17,33 @@ import (
func checkAndMakeKeyDirIfNeeded() string {
userDir, _ := homedir.Dir()
wikiCLIDir := path.Join(userDir, ".wiki_cli", "keystore")
if _, err := os.Stat(wikiCLIDir); os.IsNotExist(err) {
hmyCLIDir := path.Join(userDir, ".hmy_cli", "keystore")
if _, err := os.Stat(hmyCLIDir); os.IsNotExist(err) {
// Double check with Leo what is right file persmission
os.Mkdir(wikiCLIDir, 0700)
os.Mkdir(hmyCLIDir, 0700)
}
return wikiCLIDir
return hmyCLIDir
}
func ListKeys(keystoreDir string) {
wikiCLIDir := checkAndMakeKeyDirIfNeeded()
hmyCLIDir := checkAndMakeKeyDirIfNeeded()
scryptN := keystore.StandardScryptN
scryptP := keystore.StandardScryptP
ks := keystore.NewKeyStore(wikiCLIDir, scryptN, scryptP)
ks := keystore.NewKeyStore(hmyCLIDir, scryptN, scryptP)
// keystore.KeyStore
allAccounts := ks.Accounts()
fmt.Printf("Woop Address:%s File URL:\n", strings.Repeat(" ", ethCommon.AddressLength*2))
fmt.Printf("Harmony Address:%s File URL:\n", strings.Repeat(" ", ethCommon.AddressLength*2))
for _, account := range allAccounts {
fmt.Printf("%s\t\t %s\n", address.ToBech32(account.Address), account.URL)
}
}
func AddNewKey(password string) {
wikiCLIDir := checkAndMakeKeyDirIfNeeded()
hmyCLIDir := checkAndMakeKeyDirIfNeeded()
scryptN := keystore.StandardScryptN
scryptP := keystore.StandardScryptP
ks := keystore.NewKeyStore(wikiCLIDir, scryptN, scryptP)
ks := keystore.NewKeyStore(hmyCLIDir, scryptN, scryptP)
account, err := ks.NewAccount(password)
if err != nil {
fmt.Printf("new account error: %v\n", err)

@ -8,7 +8,7 @@ import (
"github.com/tyler-smith/go-bip39"
)
// FromMnemonicSeedAndPassphrase mimics the Woop JS sdk in deriving the
// FromMnemonicSeedAndPassphrase mimics the Harmony JS sdk in deriving the
// private, public key pair from the mnemonic, its index, and empty string password.
// Note that an index k would be the k-th key generated using the same mnemonic.
func FromMnemonicSeedAndPassphrase(mnemonic string, index int) (*secp256k1.PrivateKey, *secp256k1.PublicKey) {

@ -13,9 +13,9 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/rlp"
"github.com/woop-chain/go-sdk/pkg/address"
"github.com/woop-chain/woop/core/types"
staking "github.com/woop-chain/woop/staking/types"
"github.com/harmony-one/go-sdk/pkg/address"
"github.com/harmony-one/harmony/core/types"
staking "github.com/harmony-one/harmony/staking/types"
)
var (
@ -36,7 +36,7 @@ func getLedger() *NanoS {
return nanos
}
// ProcessAddressCommand list the address associated with Ledger Nano S
//ProcessAddressCommand list the address associated with Ledger Nano S
func GetAddress() string {
n := getLedger()
oneAddr, err := n.GetAddress()
@ -48,7 +48,7 @@ func GetAddress() string {
return oneAddr
}
// ProcessAddressCommand list the address associated with Ledger Nano S
//ProcessAddressCommand list the address associated with Ledger Nano S
func ProcessAddressCommand() {
n := getLedger()
oneAddr, err := n.GetAddress()

@ -6,9 +6,8 @@ import (
"encoding/hex"
"errors"
"fmt"
"github.com/karalabe/hid"
"io"
"github.com/karalabe/usb"
)
const (
@ -208,22 +207,12 @@ func (n *NanoS) GetAddress() (oneAddr string, err error) {
}
func (n *NanoS) SignTxn(txn []byte) (sig [signatureSize]byte, err error) {
buf := bytes.NewBuffer(txn)
var resp []byte
for buf.Len() > 0 {
var p1 byte = p1More
var p2 byte = p2SignHash
if resp == nil {
p1 = p1First
}
if buf.Len() < packetSize {
p2 = p2Finish
}
resp, err = n.Exchange(cmdSignTx, p1, p2, buf.Next(packetSize))
if err != nil {
return [signatureSize]byte{}, err
}
var p1 byte = p1More
resp, err = n.Exchange(cmdSignTx, p1, p2SignHash, txn)
if err != nil {
return [signatureSize]byte{}, err
}
copy(sig[:], resp)
@ -273,14 +262,11 @@ func OpenNanoS() (*NanoS, error) {
)
// search for Nano S
devices, err := usb.EnumerateHid(ledgerVendorID, ledgerNanoSProductID)
if err != nil {
return nil, err
}
devices := hid.Enumerate(ledgerVendorID, ledgerNanoSProductID)
if len(devices) == 0 {
return nil, errors.New("nano S not detected")
return nil, errors.New("Nano S not detected")
} else if len(devices) > 1 {
return nil, errors.New("detected multiple Nano S devices")
return nil, errors.New("Unexpected error -- Is the one wallet app running?")
}
// open the device

@ -3,7 +3,7 @@ package v1
import (
"fmt"
rpcCommon "github.com/woop-chain/go-sdk/pkg/rpc/common"
rpcCommon "github.com/harmony-one/go-sdk/pkg/rpc/common"
)
const (

@ -3,13 +3,13 @@ package rpc
import (
"fmt"
rpcCommon "github.com/harmony-one/go-sdk/pkg/rpc/common"
rpcV1 "github.com/harmony-one/go-sdk/pkg/rpc/v1"
"github.com/pkg/errors"
rpcCommon "github.com/woop-chain/go-sdk/pkg/rpc/common"
rpcV1 "github.com/woop-chain/go-sdk/pkg/rpc/v1"
)
var (
RPCPrefix = "wiki"
RPCPrefix = "hmy"
Method rpcCommon.RpcEnumList = rpcV1.Method
)

@ -8,7 +8,7 @@ import (
"github.com/valyala/fasthttp"
"github.com/woop-chain/go-sdk/pkg/common"
"github.com/harmony-one/go-sdk/pkg/common"
)
var (

@ -3,11 +3,11 @@ package v1
import (
"fmt"
rpcCommon "github.com/woop-chain/go-sdk/pkg/rpc/common"
rpcCommon "github.com/harmony-one/go-sdk/pkg/rpc/common"
)
const (
prefix = "wiki"
prefix = "hmy"
)
// Method is a list of known RPC methods

@ -5,10 +5,10 @@ import (
"encoding/json"
"fmt"
"github.com/woop-chain/go-sdk/pkg/common"
"github.com/woop-chain/go-sdk/pkg/rpc"
"github.com/woop-chain/woop/common/denominations"
"github.com/woop-chain/woop/numeric"
"github.com/harmony-one/go-sdk/pkg/common"
"github.com/harmony-one/go-sdk/pkg/rpc"
"github.com/harmony-one/harmony/common/denominations"
"github.com/harmony-one/harmony/numeric"
)
var (

@ -7,21 +7,21 @@ import (
"path"
"time"
"github.com/harmony-one/go-sdk/pkg/address"
"github.com/harmony-one/go-sdk/pkg/common"
c "github.com/harmony-one/go-sdk/pkg/common"
"github.com/harmony-one/harmony/accounts"
"github.com/harmony-one/harmony/accounts/keystore"
"github.com/pkg/errors"
"github.com/woop-chain/go-sdk/pkg/address"
"github.com/woop-chain/go-sdk/pkg/common"
c "github.com/woop-chain/go-sdk/pkg/common"
"github.com/woop-chain/woop/accounts"
"github.com/woop-chain/woop/accounts/keystore"
homedir "github.com/mitchellh/go-homedir"
)
func init() {
uDir, _ := homedir.Dir()
wikiCLIDir := path.Join(uDir, common.DefaultConfigDirName, common.DefaultConfigAccountAliasesDirName)
if _, err := os.Stat(wikiCLIDir); os.IsNotExist(err) {
os.MkdirAll(wikiCLIDir, 0700)
hmyCLIDir := path.Join(uDir, common.DefaultConfigDirName, common.DefaultConfigAccountAliasesDirName)
if _, err := os.Stat(hmyCLIDir); os.IsNotExist(err) {
os.MkdirAll(hmyCLIDir, 0700)
}
}

@ -9,15 +9,15 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/rlp"
"github.com/woop-chain/go-sdk/pkg/address"
"github.com/woop-chain/go-sdk/pkg/common"
"github.com/woop-chain/go-sdk/pkg/ledger"
"github.com/woop-chain/go-sdk/pkg/rpc"
"github.com/woop-chain/woop/accounts"
"github.com/woop-chain/woop/accounts/keystore"
"github.com/woop-chain/woop/common/denominations"
"github.com/woop-chain/woop/core/types"
"github.com/woop-chain/woop/numeric"
"github.com/harmony-one/go-sdk/pkg/address"
"github.com/harmony-one/go-sdk/pkg/common"
"github.com/harmony-one/go-sdk/pkg/ledger"
"github.com/harmony-one/go-sdk/pkg/rpc"
"github.com/harmony-one/harmony/accounts"
"github.com/harmony-one/harmony/accounts/keystore"
"github.com/harmony-one/harmony/common/denominations"
"github.com/harmony-one/harmony/core/types"
"github.com/harmony-one/harmony/numeric"
)
var (
@ -205,6 +205,7 @@ func (C *Controller) setAmount(amount numeric.Dec) {
return
}
}
C.transactionForRPC.params["transfer-amount"] = amountInAtto
}

@ -5,7 +5,7 @@ import (
"fmt"
"time"
"github.com/woop-chain/go-sdk/pkg/rpc"
"github.com/harmony-one/go-sdk/pkg/rpc"
)
var (

@ -7,13 +7,13 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/rlp"
"github.com/woop-chain/go-sdk/pkg/address"
"github.com/woop-chain/go-sdk/pkg/common"
"github.com/woop-chain/go-sdk/pkg/rpc"
"github.com/woop-chain/woop/accounts"
"github.com/woop-chain/woop/accounts/keystore"
"github.com/woop-chain/woop/core/types"
"github.com/woop-chain/woop/numeric"
"github.com/harmony-one/go-sdk/pkg/address"
"github.com/harmony-one/go-sdk/pkg/common"
"github.com/harmony-one/go-sdk/pkg/rpc"
"github.com/harmony-one/harmony/accounts"
"github.com/harmony-one/harmony/accounts/keystore"
"github.com/harmony-one/harmony/core/types"
"github.com/harmony-one/harmony/numeric"
)
type ethTransactionForRPC struct {
@ -134,37 +134,34 @@ func (C *EthController) setAmount(amount numeric.Dec) {
})
return
}
balanceRPCReply, err := C.messenger.SendRPC(
rpc.Method.GetBalance,
p{address.ToBech32(C.sender.account.Address), "latest"},
)
if err != nil {
C.executionError = err
return
}
currentBalance, _ := balanceRPCReply["result"].(string)
bal, _ := new(big.Int).SetString(currentBalance[2:], 16)
balance := numeric.NewDecFromBigInt(bal)
gasAsDec := C.transactionForRPC.params["gas-price"].(numeric.Dec)
gasAsDec = gasAsDec.Mul(numeric.NewDec(int64(C.transactionForRPC.params["gas-limit"].(uint64))))
amountInAtto := amount.Mul(oneAsDec)
total := amountInAtto.Add(gasAsDec)
if !C.Behavior.OfflineSign {
balanceRPCReply, err := C.messenger.SendRPC(
rpc.Method.GetBalance,
p{address.ToBech32(C.sender.account.Address), "latest"},
if total.GT(balance) {
balanceInOne := balance.Quo(oneAsDec)
C.executionError = ErrBadTransactionParam
errorMsg := fmt.Sprintf(
"insufficient balance of %s in shard %d for the requested transfer of %s",
balanceInOne.String(), C.transactionForRPC.params["from-shard"].(uint32), amount.String(),
)
if err != nil {
C.executionError = err
return
}
currentBalance, _ := balanceRPCReply["result"].(string)
bal, _ := new(big.Int).SetString(currentBalance[2:], 16)
balance := numeric.NewDecFromBigInt(bal)
if total.GT(balance) {
balanceInOne := balance.Quo(oneAsDec)
C.executionError = ErrBadTransactionParam
errorMsg := fmt.Sprintf(
"insufficient balance of %s in shard %d for the requested transfer of %s",
balanceInOne.String(), C.transactionForRPC.params["from-shard"].(uint32), amount.String(),
)
C.transactionErrors = append(C.transactionErrors, &Error{
ErrMessage: &errorMsg,
TimestampOfRejection: time.Now().Unix(),
})
return
}
C.transactionErrors = append(C.transactionErrors, &Error{
ErrMessage: &errorMsg,
TimestampOfRejection: time.Now().Unix(),
})
return
}
C.transactionForRPC.params["transfer-amount"] = amountInAtto
}
@ -307,10 +304,4 @@ func (C *EthController) ExecuteEthTransaction(
return C.executionError
}
func (C *EthController) ExecuteRawTransaction(txn string) error {
C.transactionForRPC.signature = &txn
C.sendSignedTx()
C.txConfirmation()
return C.executionError
}
// TODO: add logic to create staking transactions in the SDK.

@ -3,10 +3,10 @@ package transaction
import (
"math/big"
"github.com/woop-chain/go-sdk/pkg/address"
"github.com/woop-chain/go-sdk/pkg/rpc"
"github.com/woop-chain/woop/core/types"
"github.com/woop-chain/woop/numeric"
"github.com/harmony-one/go-sdk/pkg/address"
"github.com/harmony-one/go-sdk/pkg/rpc"
"github.com/harmony-one/harmony/core/types"
"github.com/harmony-one/harmony/numeric"
)
// NewTransaction - create a new Transaction based on supplied params

@ -1,17 +0,0 @@
package transaction
import (
"encoding/hex"
"fmt"
"strings"
)
func StringToByte(dataStr string) ([]byte, error) {
if len(dataStr) == 0 {
return []byte{}, nil
}
if !strings.HasPrefix(dataStr, "0x") {
return nil, fmt.Errorf("invalid data literal: %q", dataStr)
}
return hex.DecodeString(dataStr[2:])
}

@ -3,7 +3,7 @@ package validation
import (
"testing"
"github.com/woop-chain/go-sdk/pkg/sharding"
"github.com/harmony-one/go-sdk/pkg/sharding"
)
func TestIsValidAddress(t *testing.T) {

@ -9,19 +9,19 @@ Due to a possible Nonce mismatch, it is recommended to NOT have 1 'from' address
appear in multiple CSV files that are ran at the same time.
Example:
./wiki-csv.py /path/to/csv/file.csv --node https://api.s0.t.hmny.io/
./wiki-csv.py /path/to/csv/file.csv --fast -n https://api.s0.t.hmny.io/
./wiki-csv.py /path/to/csv/file.csv --fast --use-default-passphrase --yes -n https://api.s0.t.hmny.io/
./wiki-csv.py /path/to/csv/file.csv --fast --use-default-passphrase --yes --batch-size 100 -n https://api.s0.t.hmny.io/
./hmy-csv.py /path/to/csv/file.csv --node https://api.s0.t.hmny.io/
./hmy-csv.py /path/to/csv/file.csv --fast -n https://api.s0.t.hmny.io/
./hmy-csv.py /path/to/csv/file.csv --fast --use-default-passphrase --yes -n https://api.s0.t.hmny.io/
./hmy-csv.py /path/to/csv/file.csv --fast --use-default-passphrase --yes --batch-size 100 -n https://api.s0.t.hmny.io/
Sample CSV file:
https://docs.google.com/spreadsheets/d/1nkF8N16S3y28cn7SM1cYJca8lzHPOzyR42S1V-OOAeQ/edit?usp=sharing
For detail help message:
./wiki-csv.py --help
./hmy-csv.py --help
Install with:
curl -O https://raw.githubusercontent.com/woop-chain/go-sdk/master/scripts/wiki-csv.py && chmod +x wiki-csv.py
curl -O https://raw.githubusercontent.com/harmony-one/go-sdk/master/scripts/hmy-csv.py && chmod +x hmy-csv.py
"""
import sys
import time
@ -36,7 +36,7 @@ import json
import ssl
script_directory = os.path.dirname(os.path.realpath(__file__))
_wiki_call_and_prefix = [f"{script_directory}/wiki"]
_hmy_call_and_prefix = [f"{script_directory}/hmy"]
chain_id_options = {"mainnet", "testnet", "stressnet", "partner", "dryrun"}
default_passphrase = ""
@ -57,19 +57,19 @@ class Typgpy(str):
UNDERLINE = '\033[4m'
def _wiki(cli_args, timeout=200):
def _hmy(cli_args, timeout=200):
"""
Helper function to call the CLI with the given args.
Assumes `_setup_wiki` has been called prior to using this function.
Assumes `_setup_hmy` has been called prior to using this function.
Raises subprocess.CalledProcessError if call errored.
"""
assert isinstance(cli_args, list)
wiki_and_args = _wiki_call_and_prefix + [str(x) for x in cli_args]
hmy_and_args = _hmy_call_and_prefix + [str(x) for x in cli_args]
if args.verbose:
wiki_and_args.append("--verbose")
return subprocess.check_output(wiki_and_args, env=os.environ, timeout=timeout).decode()
hmy_and_args.append("--verbose")
return subprocess.check_output(hmy_and_args, env=os.environ, timeout=timeout).decode()
def get_shard_count(node):
@ -79,7 +79,7 @@ def get_shard_count(node):
Will raise a KeyError if the RPC returns back an error.
Will raise a subprocess.CalledProcessError if CLI errored.
"""
response = _wiki(["utility", "shards", "-n", node])
response = _hmy(["utility", "shards", "-n", node])
return len(json.loads(response)['result'])
@ -102,7 +102,7 @@ def send_transactions(transactions, batch_size, node, chain_id, timeout=40, fast
for i in range(0, len(transactions), batch_size):
batch_tx = transactions[i: i + batch_size]
temp_file = f"/tmp/wiki-csv-{hash(str(batch_tx))}.json"
temp_file = f"/tmp/hmy-csv-{hash(str(batch_tx))}.json"
batch_log_file = f"{script_directory}/batch_tx_{time.time()}.log"
with open(temp_file, "w") as f:
json.dump(batch_tx, f) # Assume to work since `transactions` should be built by `parse_csv`
@ -110,15 +110,15 @@ def send_transactions(transactions, batch_size, node, chain_id, timeout=40, fast
print(
f"{Typgpy.OKBLUE}Sending a batch of {Typgpy.OKGREEN}{len(batch_tx)}{Typgpy.OKBLUE} transaction(s){Typgpy.ENDC}")
print(f"{Typgpy.OKBLUE}Logs for this batch will be at {Typgpy.OKGREEN}{batch_log_file}{Typgpy.ENDC}")
wiki_args = ["transfer", "--file", temp_file, "--node", node]
hmy_args = ["transfer", "--file", temp_file, "--node", node]
if chain_id:
wiki_args.extend(["--chain-id", chain_id])
hmy_args.extend(["--chain-id", chain_id])
if fast:
wiki_args.extend(["--timeout", "0"])
hmy_args.extend(["--timeout", "0"])
else:
wiki_args.extend(["--timeout", timeout])
hmy_args.extend(["--timeout", timeout])
try:
output = _wiki(wiki_args, timeout=timeout * len(batch_tx))
output = _hmy(hmy_args, timeout=timeout * len(batch_tx))
except subprocess.CalledProcessError as e:
print(f"{Typgpy.FAIL}Transaction failure: {e}{Typgpy.ENDC}")
print(f"{Typgpy.FAIL}Error output: {e.output.decode()}{Typgpy.ENDC}")
@ -162,8 +162,8 @@ def parse_csv(path, node, use_default_passphrase=True):
sys.stdout.write(f"\rParsing line {i} of {path}")
sys.stdout.flush()
try:
_wiki(["utility", "bech32-to-addr", row['from']])
_wiki(["utility", "bech32-to-addr", row['to']])
_hmy(["utility", "bech32-to-addr", row['from']])
_hmy(["utility", "bech32-to-addr", row['to']])
except subprocess.CalledProcessError as e:
print(f"{e.output}")
print(f"{Typgpy.FAIL}Address error on line {i}! From: {row['from']}; To: {row['to']}{Typgpy.ENDC}")
@ -245,35 +245,35 @@ def sanity_check(args):
assert args.chain_id in chain_id_options, f"{args.chain_id} not in {chain_id_options}"
def _setup_wiki():
def _setup_hmy():
"""
Setup `_wiki_call_and_prefix` depending on if wiki.sh exists.
Setup `_hmy_call_and_prefix` depending on if hmy.sh exists.
"""
global _wiki_call_and_prefix
_wiki_call_and_prefix = [f"{script_directory}/wiki"]
global _hmy_call_and_prefix
_hmy_call_and_prefix = [f"{script_directory}/hmy"]
try:
_wiki(["version"])
_hmy(["version"])
return
except (subprocess.CalledProcessError, FileNotFoundError):
print(f"Unable to execute wiki CLI directly at: '{_wiki_call_and_prefix[0]}'")
print(f"Trying to use 'wiki.sh'...")
if "wiki.sh" in os.listdir(script_directory):
_wiki_call_and_prefix = [f"{script_directory}/wiki.sh", "--"]
print(f"Unable to execute hmy CLI directly at: '{_hmy_call_and_prefix[0]}'")
print(f"Trying to use 'hmy.sh'...")
if "hmy.sh" in os.listdir(script_directory):
_hmy_call_and_prefix = [f"{script_directory}/hmy.sh", "--"]
try:
_wiki(["version"])
_hmy(["version"])
return
except subprocess.CalledProcessError as e:
raise SystemExit(
f"'wiki.sh' is unable to execute the CLI. Try downloading the CLI with `./wiki.sh -d`.") from e
f"'hmy.sh' is unable to execute the CLI. Try downloading the CLI with `./hmy.sh -d`.") from e
else:
raise SystemExit(f"'wiki.sh' is not found in script directory {script_directory}. ")
raise SystemExit(f"'hmy.sh' is not found in script directory {script_directory}. ")
def _parse_args():
"""
Argument parser that is only used for main execution.
"""
parser = argparse.ArgumentParser(description='Woop CLI, transaction from CSV file wrapper script.')
parser = argparse.ArgumentParser(description='Harmony CLI, transaction from CSV file wrapper script.')
parser.add_argument("path", type=str, help="The path to the CSV file.")
parser.add_argument("--node", "-n", dest="node", default="https://api.s0.t.hmny.io/", type=str,
help="The node or endpoint to send the transactions to, default: 'https://api.s0.t.hmny.io/'.")
@ -298,7 +298,7 @@ def _parse_args():
if __name__ == "__main__":
args = _parse_args()
_setup_wiki()
_setup_hmy()
sanity_check(args)
transactions = parse_csv(args.path, args.node, use_default_passphrase=args.use_default_passphrase)
send_transactions(transactions, args.batch_size, args.node, args.chain_id,

@ -1,6 +1,6 @@
#!/usr/bin/env bash
BUCKET='pub.wikiwoop.com'
BUCKET='pub.harmony.one'
OS="$(uname -s)"
usage () {
@ -10,8 +10,8 @@ Usage: $0 [option] command
Options:
-d download all the binaries
-h print this help
Note: Arguments must be passed at the end for ./wiki to work correctly.
For instance: ./wiki.sh balances <one-address> --node=https://api.s0.p.hmny.io/
Note: Arguments must be passed at the end for ./hmy to work correctly.
For instance: ./hmy.sh balances <one-address> --node=https://api.s0.p.hmny.io/
EOT
}
@ -22,13 +22,13 @@ set_download () {
Darwin)
FOLDER=release/darwin-x86_64/${rel}
URL=http://${BUCKET}.s3.amazonaws.com/${FOLDER}
BIN=( wiki libbls384_256.dylib libcrypto.1.0.0.dylib libgmp.10.dylib libgmpxx.4.dylib libmcl.dylib )
BIN=( hmy libbls384_256.dylib libcrypto.1.0.0.dylib libgmp.10.dylib libgmpxx.4.dylib libmcl.dylib )
NAMES=("${BIN[@]}")
;;
Linux)
URL=https://wikiwoop.com
BIN=( wikicli )
NAMES=( wiki )
URL=https://harmony.one
BIN=( hmycli )
NAMES=( hmy )
;;
*)
echo "${OS} not supported."
@ -43,7 +43,7 @@ do_download () {
rm -f ${NAMES[i]}
curl -L ${URL}/${BIN[i]} -o ${NAMES[i]}
done
chmod +x wiki
chmod +x hmy
}
while getopts "dh" opt; do
@ -63,7 +63,7 @@ done
shift $((OPTIND-1))
if [ "$OS" = "Linux" ]; then
./wiki "$@"
./hmy "$@"
else
DYLD_FALLBACK_LIBRARY_PATH="$(pwd)" ./wiki "$@"
DYLD_FALLBACK_LIBRARY_PATH="$(pwd)" ./hmy "$@"
fi

@ -2,7 +2,7 @@
set -ieu
source ../woop/scripts/setup_bls_build_flags.sh
source ../harmony/scripts/setup_bls_build_flags.sh
sender='one1yc06ghr2p8xnl2380kpfayweguuhxdtupkhqzw'
receiver='one1q6gkzcap0uruuu8r6sldxuu47pd4ww9w9t7tg6'
@ -21,7 +21,7 @@ for iter in $(seq 100); do
value=$(c "${iter}/100")
bump=$(c "${value}+${rand}")
amount=$(printf "%.2f" ${bump})
./wiki --node=${shard_zero} \
./hmy --node=${shard_zero} \
transfer --from ${sender} --to ${receiver} \
--from-shard 0 --to-shard 0 --amount ${amount} \
--passphrase='' &

Loading…
Cancel
Save