master
nico 9 months ago
parent 178d0509e0
commit ffe1112270
  1. 102
      .github/workflows/hmybuild.yml
  2. 28
      .github/workflows/test-build.yml
  3. 6
      .gitignore
  4. 34
      Makefile
  5. 92
      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. 20
      cmd/subcommands/ethtransfer.go
  14. 2
      cmd/subcommands/failures.go
  15. 14
      cmd/subcommands/governance.go
  16. 20
      cmd/subcommands/keys.go
  17. 39
      cmd/subcommands/root.go
  18. 38
      cmd/subcommands/staking.go
  19. 22
      cmd/subcommands/transfer.go
  20. 10
      cmd/subcommands/utility.go
  21. 2
      cmd/subcommands/validator.go
  22. 54
      cmd/subcommands/values.go
  23. 6
      go.mod
  24. 20
      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. 74
      pkg/console/console.go
  35. 6
      pkg/console/web3ext/web3ext.go
  36. 9
      pkg/console/wiki.go
  37. 4
      pkg/governance/cli.go
  38. 6
      pkg/governance/signing.go
  39. 6
      pkg/governance/signing_test.go
  40. 20
      pkg/governance/types.go
  41. 20
      pkg/keys/bls.go
  42. 22
      pkg/keys/keys.go
  43. 2
      pkg/keys/mnemonic.go
  44. 10
      pkg/ledger/hw_wallet.go
  45. 2
      pkg/rpc/eth/methods.go
  46. 6
      pkg/rpc/methods.go
  47. 2
      pkg/rpc/query.go
  48. 4
      pkg/rpc/v1/methods.go
  49. 8
      pkg/sharding/structure.go
  50. 16
      pkg/store/local.go
  51. 18
      pkg/transaction/controller.go
  52. 2
      pkg/transaction/errors.go
  53. 14
      pkg/transaction/ethcontroller.go
  54. 8
      pkg/transaction/transaction.go
  55. 2
      pkg/validation/validation_test.go
  56. 4
      scripts/stress-test
  57. 70
      scripts/wiki-csv.py
  58. 20
      scripts/wiki.sh

@ -1,4 +1,4 @@
name: release hmy
name: release wiki
on:
push:
@ -11,14 +11,14 @@ env:
jobs:
build-x86_64:
name: Build hmy binary for x86_64
name: Build wiki binary for x86_64
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-22.04, macos-latest ]
steps:
- name: Checkout hmy code
- name: Checkout wiki code
uses: actions/checkout@v3
with:
path: go-sdk
@ -31,20 +31,20 @@ jobs:
- name: Checkout dependence repo
uses: actions/checkout@v3
with:
repository: harmony-one/mcl
path: ${{ github.workspace }}/src/github.com/harmony-one/mcl
repository: woop-chain/mcl
path: ${{ github.workspace }}/src/github.com/woop-chain/mcl
- name: Checkout dependence repo
uses: actions/checkout@v3
with:
repository: harmony-one/bls
path: ${{ github.workspace }}/src/github.com/harmony-one/bls
repository: woop-chain/bls
path: ${{ github.workspace }}/src/github.com/woop-chain/bls
- name: Checkout dependence code
uses: actions/checkout@v2
with:
repository: harmony-one/harmony
path: ${{ github.workspace }}/src/github.com/harmony-one/harmony
repository: woop-chain/woop
path: ${{ github.workspace }}/src/github.com/woop-chain/woop
ref: main
fetch-depth: 0
@ -64,7 +64,7 @@ jobs:
echo ${GOPATH}
echo ${GOROOT}
- name: Build hmy binary for Linux
- name: Build wiki binary for Linux
if: matrix.os == 'ubuntu-22.04'
run: |
make static
@ -79,24 +79,24 @@ jobs:
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/harmony-one/harmony
working-directory: ${{ github.workspace }}/src/github.com/woop-chain/woop
- name: Build hmy binary for macos-latest x86_64
- name: Build wiki binary for macos-latest x86_64
if: matrix.os == 'macos-latest'
run: |
make all
mv dist/hmy dist/hmy-darwin-x86_64
mv dist/wiki dist/wiki-darwin-x86_64
working-directory: go-sdk
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: hmy
name: wiki
path: ${{ github.workspace }}/go-sdk/dist/*
retention-days: 1
# build-arm64:
# name: Build hmy binary
# name: Build wiki binary
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
@ -110,10 +110,10 @@ jobs:
# go-version: 1.16.5
# - name: Checkout hmy code
# - name: Checkout wiki code
# uses: actions/checkout@v2
# with:
# path: go/src/github.com/harmony-one/go-sdk
# path: go/src/github.com/woop-chain/go-sdk
# - name: Debug
# run: |
@ -128,43 +128,43 @@ jobs:
# - name: Checkout dependence repo
# uses: actions/checkout@v2
# with:
# repository: harmony-one/mcl
# path: go/src/github.com/harmony-one/mcl
# repository: woop-chain/mcl
# path: go/src/github.com/woop-chain/mcl
# env:
# GOPATH: /home/ubuntu/actions-runner/_work/go-sdk/go-sdk/go
# - name: Checkout dependence repo
# uses: actions/checkout@v2
# with:
# repository: harmony-one/bls
# path: go/src/github.com/harmony-one/bls
# repository: woop-chain/bls
# path: go/src/github.com/woop-chain/bls
# env:
# GOPATH: /home/ubuntu/actions-runner/_work/go-sdk/go-sdk/go
# - name: Checkout dependence code
# uses: actions/checkout@v2
# with:
# repository: harmony-one/harmony
# path: go/src/github.com/harmony-one/harmony
# repository: woop-chain/woop
# path: go/src/github.com/woop-chain/woop
# ref: main
# fetch-depth: 0
# env:
# GOPATH: /home/ubuntu/actions-runner/_work/go-sdk/go-sdk/go
# - name: Build hmy binary for Arm
# - name: Build wiki binary for Arm
# run: |
# make static
# 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
# 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
# env:
# GOPATH: /home/ubuntu/actions-runner/_work/go-sdk/go-sdk/go
# - name: Upload artifact
# uses: actions/upload-artifact@v2
# with:
# name: hmy-arm64
# path: /home/ubuntu/actions-runner/_work/go-sdk/go-sdk/go/src/github.com/harmony-one/go-sdk/dist/*
# name: wiki-arm64
# path: /home/ubuntu/actions-runner/_work/go-sdk/go-sdk/go/src/github.com/woop-chain/go-sdk/dist/*
# retention-days: 1
# env:
# GOPATH: /home/ubuntu/actions-runner/_work/go-sdk/go-sdk/go
@ -177,10 +177,10 @@ jobs:
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v3
with:
gpg-private-key: ${{ secrets.HMY_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.HMY_GPG_PRIVATE_KEY_PASS }}
gpg-private-key: ${{ secrets.WIKI_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.WIKI_GPG_PRIVATE_KEY_PASS }}
- name: Checkout hmy core code
- name: Checkout wiki core code
uses: actions/checkout@v3
with:
path: go-sdk
@ -198,15 +198,15 @@ jobs:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: hmy
name: wiki
- name: Display structure of downloaded files
run: ls -R
- name: Signed darwin x86_64 hmy binary
- name: Signed darwin x86_64 wiki binary
run: |
gpg --detach-sign hmy-darwin-x86_64
sha256sum hmy-darwin-x86_64 >> hmy-darwin-x86_64.sha256
gpg --detach-sign wiki-darwin-x86_64
sha256sum wiki-darwin-x86_64 >> wiki-darwin-x86_64.sha256
- name: Get tag message
env:
@ -228,54 +228,54 @@ jobs:
prerelease: false
body_path: ${{ github.workspace }}/go-sdk/tag_message.md
- name: Upload hmy binary for Linux (x86_64)
- name: Upload wiki binary for Linux (x86_64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./hmy
asset_name: hmy
asset_path: ./wiki
asset_name: wiki
asset_content_type: application/octet-stream
- name: Upload hmy binary darwin-x86_64
- name: Upload wiki binary darwin-x86_64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./hmy-darwin-x86_64
asset_name: hmy-darwin-x86_64
asset_path: ./wiki-darwin-x86_64
asset_name: wiki-darwin-x86_64
asset_content_type: application/octet-stream
# - name: Upload hmy binary for ARM64
# - name: Upload wiki 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: ./hmy-arm64
# asset_name: hmy-arm64
# asset_path: ./wiki-arm64
# asset_name: wiki-arm64
# asset_content_type: application/octet-stream
# - name: Upload sha256 signature of hmy arm64 binary
# - name: Upload sha256 signature of wiki 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: ./hmy-arm64.sha256
# asset_name: hmy-arm64.sha256
# asset_path: ./wiki-arm64.sha256
# asset_name: wiki-arm64.sha256
# asset_content_type: text/plain
# - name: Upload gpg signature of hmy arm64 binary
# - name: Upload gpg signature of wiki 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: ./hmy-arm64.sig
# asset_name: hmy-arm64.sig
# asset_path: ./wiki-arm64.sig
# asset_name: wiki-arm64.sig
# asset_content_type: application/octet-stream

@ -9,14 +9,14 @@ env:
jobs:
build-x86_64:
name: Build hmy binary for x86_64
name: Build wiki binary for x86_64
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-22.04, macos-latest ]
steps:
- name: Checkout hmy code
- name: Checkout wiki code
uses: actions/checkout@v3
with:
path: go-sdk
@ -29,20 +29,20 @@ jobs:
- name: Checkout dependence repo
uses: actions/checkout@v3
with:
repository: harmony-one/mcl
path: ${{ github.workspace }}/src/github.com/harmony-one/mcl
repository: woop-chain/mcl
path: ${{ github.workspace }}/src/github.com/woop-chain/mcl
- name: Checkout dependence repo
uses: actions/checkout@v3
with:
repository: harmony-one/bls
path: ${{ github.workspace }}/src/github.com/harmony-one/bls
repository: woop-chain/bls
path: ${{ github.workspace }}/src/github.com/woop-chain/bls
- name: Checkout dependence code
uses: actions/checkout@v2
with:
repository: harmony-one/harmony
path: ${{ github.workspace }}/src/github.com/harmony-one/harmony
repository: woop-chain/woop
path: ${{ github.workspace }}/src/github.com/woop-chain/woop
ref: main
fetch-depth: 0
@ -61,9 +61,9 @@ jobs:
echo ${GITHUB_WORKSPACE}
echo ${GOPATH}
echo ${GOROOT}
ls ${{ github.workspace }}/src/github.com/harmony-one/
ls ${{ github.workspace }}/src/github.com/woop-chain/
- name: Build hmy binary for linux ubuntu
- name: Build wiki binary for linux ubuntu
if: matrix.os == 'ubuntu-22.04'
run: |
make static
@ -78,9 +78,9 @@ jobs:
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/harmony-one/harmony
working-directory: ${{ github.workspace }}/src/github.com/woop-chain/woop
- name: Build hmy binary for macos-latest x86_64
- name: Build wiki binary for macos-latest x86_64
if: matrix.os == 'macos-latest'
run: |
make all
@ -90,7 +90,7 @@ jobs:
uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-22.04'
with:
name: hmy-linux
name: wiki-linux
path: ${{ github.workspace }}/go-sdk/dist/*
retention-days: 1
@ -98,6 +98,6 @@ jobs:
uses: actions/upload-artifact@v3
if: matrix.os == 'macos-latest'
with:
name: hmy-darwin
name: wiki-darwin
path: ${{ github.workspace }}/go-sdk/dist/*
retention-days: 1

6
.gitignore vendored

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

@ -5,15 +5,15 @@ 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}@harmony.one
built_by := ${USER}@wikiwoop.com
flags := -gcflags="all=-N -l"
ldflags := -X main.version=v${version} -X main.commit=${commit}
ldflags += -X main.builtAt=${built_at} -X main.builtBy=${built_by}
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'
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'
uname := $(shell uname)
env := GO111MODULE=on
@ -22,18 +22,18 @@ DIR := ${CURDIR}
export CGO_LDFLAGS=-L$(DIR)/dist/lib -Wl,-rpath -Wl,\$ORIGIN/lib
all:
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
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
static:
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\"" cmd/main.go
cp $(cli) hmy
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
debug:
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
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
install:all
cp $(cli) ~/.local/bin
@ -49,7 +49,7 @@ test-rpc:
# Notice assumes you have correct uploading credentials
upload-darwin:all
ifeq (${uname}, Darwin)
aws --profile upload s3 cp ./hmy ${upload-path-darwin}
aws --profile upload s3 cp ./wiki ${upload-path-darwin}
else
@echo "Wrong operating system for target upload"
endif
@ -57,9 +57,9 @@ endif
# Only the linux build will upload the CLI version
upload-linux:static
ifeq (${uname}, Linux)
aws --profile upload s3 cp ./hmy ${upload-path-linux}
./hmy version &> ./hmy_version
aws --profile upload s3 cp ./hmy_version ${upload-path-linux-version}
aws --profile upload s3 cp ./wiki ${upload-path-linux}
./wiki version &> ./wiki_version
aws --profile upload s3 cp ./wiki_version ${upload-path-linux-version}
else
@echo "Wrong operating system for target upload"
endif

@ -1,21 +1,21 @@
# Harmony's go-sdk
# Woop's go-sdk
This is a go layer on top of the Harmony RPC, included is a CLI tool that you can build with a
This is a go layer on top of the Woop RPC, included is a CLI tool that you can build with a
simple invocation of `make`
See https://docs.harmony.one/home/network/wallets/harmony-cli/download-setup for detailed
documentation on how to use the `hmy` CLI tools
See https://docs.wikiwoop.com/home/network/wallets/woop-cli/download-setup for detailed
documentation on how to use the `wiki` 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/harmony-one/harmony/blob/master/README.md.
https://github.com/woop-chain/woop/blob/master/README.md.
...for the impatient:
```
$ docker run -it harmonyone/main:stable /bin/bash
$ docker run -it woopchain/main:stable /bin/bash
$ cd ../go-sdk
$ git pull -r origin master
$ make
@ -23,20 +23,20 @@ $ make
# Usage & Examples
`hmy` implements a fluent API, that is, there is a hierarchy of commands.
`wiki` implements a fluent API, that is, there is a hierarchy of commands.
# bash completions
once built, add `hmy` to your path and add to your `.bashrc`
once built, add `wiki` to your path and add to your `.bashrc`
```
. <(hmy completion)
. <(wiki completion)
```
invoke the following command to see the most command usages of `hmy`
invoke the following command to see the most command usages of `wiki`
```
$ hmy cookbook
$ wiki cookbook
Cookbook of Usage
@ -52,88 +52,88 @@ Note:
Examples:
1. Check account balance on given chain
./hmy --node=https://api.s0.t.hmny.io balances <SOME_ONE_ADDRESS>
./wiki --node=https://api.s0.t.hmny.io balances <SOME_ONE_ADDRESS>
2. Check sent transaction
./hmy --node=https://api.s0.t.hmny.io blockchain transaction-by-hash <SOME_TX_HASH>
./wiki --node=https://api.s0.t.hmny.io blockchain transaction-by-hash <SOME_TX_HASH>
3. List local account keys
./hmy keys list
./wiki keys list
4. Sending a transaction (waits 40 seconds for transaction confirmation)
./hmy --node=https://api.s0.t.hmny.io transfer \
./wiki --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)
./hmy --node=https://api.s0.t.hmny.io transfer --file <PATH_TO_JSON_FILE>
./wiki --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
./hmy --node=https://api.s0.t.hmny.io blockchain transaction-receipt <SOME_TX_HASH>
./wiki --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.
./hmy keys recover-from-mnemonic <ACCOUNT_NAME>
./wiki keys recover-from-mnemonic <ACCOUNT_NAME>
8. Import an existing keystore file
./hmy keys import-ks <PATH_TO_KEYSTORE_JSON>
./wiki keys import-ks <PATH_TO_KEYSTORE_JSON>
9. Import a keystore file using a secp256k1 private key
./hmy keys import-private-key <secp256k1_PRIVATE_KEY>
./wiki keys import-private-key <secp256k1_PRIVATE_KEY>
10. Export a keystore file's secp256k1 private key
./hmy keys export-private-key <ACCOUNT_ADDRESS> --passphrase
./wiki keys export-private-key <ACCOUNT_ADDRESS> --passphrase
11. Generate a BLS key then encrypt and save the private key to the specified location.
./hmy keys generate-bls-key --bls-file-path <PATH_FOR_BLS_KEY_FILE>
./wiki keys generate-bls-key --bls-file-path <PATH_FOR_BLS_KEY_FILE>
12. Create a new validator with a list of BLS keys
./hmy --node=https://api.s0.t.hmny.io staking create-validator --amount 10 --validator-addr <SOME_ONE_ADDRESS> \
./wiki --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 harmony.one --passphrase
--min-self-delegation 10 --rate 0.1 --security-contact Leo --website wikiwoop.com --passphrase
13. Edit an existing validator
./hmy --node=https://api.s0.t.hmny.io staking edit-validator \
./wiki --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 harmony.one \
--name baz --security-contact EK --website wikiwoop.com \
--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
./hmy --node=https://api.s0.t.hmny.io staking delegate \
./wiki --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
./hmy --node=https://api.s0.t.hmny.io staking undelegate \
./wiki --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
./hmy --node=https://api.s0.t.hmny.io staking collect-rewards \
./wiki --node=https://api.s0.t.hmny.io staking collect-rewards \
--delegator-addr <SOME_ONE_ADDRESS> --passphrase
17. Check elected validators
./hmy --node=https://api.s0.t.hmny.io blockchain validator elected
./wiki --node=https://api.s0.t.hmny.io blockchain validator elected
18. Get current staking utility metrics
./hmy --node=https://api.s0.t.hmny.io blockchain utility-metrics
./wiki --node=https://api.s0.t.hmny.io blockchain utility-metrics
19. Check in-memory record of failed staking transactions
./hmy --node=https://api.s0.t.hmny.io failures staking
./wiki --node=https://api.s0.t.hmny.io failures staking
20. Check which shard your BLS public key would be assigned to as a validator
./hmy --node=https://api.s0.t.hmny.io utility shard-for-bls <BLS_PUBLIC_KEY>
./wiki --node=https://api.s0.t.hmny.io utility shard-for-bls <BLS_PUBLIC_KEY>
21. Vote on a governance proposal on https://snapshot.org
./hmy governance vote-proposal --space=[harmony-mainnet.eth] \
./wiki governance vote-proposal --space=[woop-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 (hmy keys import-private-key) to import
PS: key must first use (wiki keys import-private-key) to import
22. Enter Console
./hmy command --net=testnet
./wiki command --net=testnet
```
# Sending batched transactions
@ -144,7 +144,7 @@ off **in sequential order**.
Example:
```
hmy --node="https://api.s1.t.hmny.io/" transfer --file ./batchTransactions.json
wiki --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 +156,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 $ONE. |
| `amount` | string | [**Required**] The amount to send in $WOOP. |
| `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 $ONE), default is 1. |
| `gas-price` | string | [*Optional*] The gas price to pay in NANO (1e-9 of $WOOP), 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 +242,26 @@ Example of returned JSON Array:
## Offline sign transfer
1. Get Nonce From a Account. (Need to be online, but no passphrase required)
```bash
./hmy get-nonce --node=https://api.s0.t.hmny.io --from=[ONE address]
./wiki 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
./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
./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
```
3. send `signed.json` to Harmony blockchain! (Need to be online, but no passphrase required)
3. send `signed.json` to Woop blockchain! (Need to be online, but no passphrase required)
```bash
./hmy offline-sign-transfer --node=https://api.s0.b.hmny.io --file ./signed.json
./wiki offline-sign-transfer --node=https://api.s0.b.hmny.io --file ./signed.json
```
# Debugging
The go-sdk code respects `HMY_RPC_DEBUG HMY_TX_DEBUG` as debugging
The go-sdk code respects `WIKI_RPC_DEBUG WIKI_TX_DEBUG` as debugging
based environment variables.
```bash
HMY_RPC_DEBUG=true HMY_TX_DEBUG=true ./hmy blockchain protocol-version
WIKI_RPC_DEBUG=true WIKI_TX_DEBUG=true ./wiki blockchain protocol-version
```
# Contract Deploy
@ -269,7 +269,7 @@ HMY_RPC_DEBUG=true HMY_TX_DEBUG=true ./hmy blockchain protocol-version
You can deploy the contract use the command;
```bash
./hmy command --node="https://api.s0.b.hmny.io" --net=testnet
./wiki 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/harmony-one/go-sdk/cmd/subcommands"
cmd "github.com/woop-chain/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,
"Harmony (C) 2020. %v, version %v-%v (%v %v)\n",
"Woop (C) 2024. %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 Harmony Address",
Long: "Query for the latest account balance given a Woop 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 the Harmony.one Blockchain",
Short: "Interact with WoopChain",
Long: `
Query Harmony's blockchain for completed transaction, historic records
Query Woop'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 harmony blockchain block by block number",
Short: "Get a woop 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 Harmony Protocol",
Short: "The version of the Woop Protocol",
Long: `
Query Harmony's blockchain for high level metrics, queries
Query Woop'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()
hmyCLIDir := path.Join(userDir, common.DefaultConfigDirName, common.DefaultCommandAliasesDirName)
if _, err := os.Stat(hmyCLIDir); os.IsNotExist(err) {
wikiCLIDir := path.Join(userDir, common.DefaultConfigDirName, common.DefaultCommandAliasesDirName)
if _, err := os.Stat(wikiCLIDir); os.IsNotExist(err) {
// Double check with Leo what is right file persmission
os.Mkdir(hmyCLIDir, 0700)
os.Mkdir(wikiCLIDir, 0700)
}
return hmyCLIDir
return wikiCLIDir
}
// 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:
. <(hmy completion)
. <(wiki 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 (

@ -10,14 +10,14 @@ import (
"strings"
"time"
"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/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/spf13/cobra"
)
@ -214,7 +214,7 @@ 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 Harmony blockchain
Create an Ethereum compatible transaction, sign it, and send off to the Woop blockchain
`,
PreRunE: func(cmd *cobra.Command, args []string) error {
if offlineSign {
@ -304,7 +304,7 @@ Create an Ethereum compatible transaction, sign it, and send off to the Harmony
Short: "Send a Offline Signed Ethereum transaction",
Args: cobra.ExactArgs(0),
Long: `
Send a offline signed transaction to the Harmony blockchain (on the same shard)
Send a offline signed transaction to the Woop blockchain (on the same shard)
`,
PreRunE: func(cmd *cobra.Command, args []string) error {
if givenFilePath == "" {

@ -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 Harmony spaces on https://snapshot.org",
Short: "Interact with the Woop spaces on https://snapshot.org",
Long: `
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.
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.
`,
RunE: func(cmd *cobra.Command, args []string) error {
cmd.Help()
@ -72,8 +72,8 @@ func commandVote() (cmd *cobra.Command) {
},
}
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(&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(&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")

@ -13,13 +13,13 @@ import (
"github.com/tyler-smith/go-bip39"
"golang.org/x/crypto/ssh/terminal"
"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"
"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"
)
const (
@ -120,7 +120,7 @@ func keysSub() []*cobra.Command {
cmdLocation := &cobra.Command{
Use: "location",
Short: "Show where `hmy` keeps accounts & their keys",
Short: "Show where `wiki` 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 `./hmy keys recover-from-mnemonic` instead.\n")
fmt.Fprintf(os.Stderr, "deprecated method: use `./wiki 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 Harmony mainnet endpoint %v\n",
fmt.Fprintf(os.Stderr, "Cannot connect to node %v, using Woop mainnet endpoint %v\n",
node, defaultMainnetEndpoint)
node = defaultMainnetEndpoint
}

@ -4,23 +4,24 @@ 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 (
@ -51,15 +52,15 @@ var (
}
// RootCmd is single entry point of the CLI
RootCmd = &cobra.Command{
Use: "hmy",
Short: "Harmony blockchain",
Use: "wiki",
Short: "Woop blockchain",
SilenceUsage: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
if verbose {
common.EnableAllVerbose()
}
switch rpcPrefix {
case "hmy":
case "wiki":
rpc.Method = rpcV1.Method
case "eth":
rpc.Method = rpcEth.Method
@ -95,7 +96,7 @@ var (
}
} else if endpoint.Match([]byte(node)) {
chainName = endpointToChainID(node)
} else if strings.Contains(node, "api.harmony.one") {
} else if strings.Contains(node, "api.wikiwoop.com") {
chainName = chainIDWrapper{chainID: &common.Chain.MainNet}
} else {
chainName = chainIDWrapper{chainID: &common.Chain.TestNet}
@ -111,9 +112,9 @@ var (
return nil
},
Long: fmt.Sprintf(`
CLI interface to the Harmony blockchain
CLI interface to the Woop blockchain
%s`, g("Invoke 'hmy cookbook' for examples of the most common, important usages")),
%s`, g("Invoke 'wiki cookbook' for examples of the most common, important usages")),
RunE: func(cmd *cobra.Command, args []string) error {
cmd.Help()
return nil
@ -122,7 +123,7 @@ CLI interface to the Harmony blockchain
)
func init() {
vS := "dump out debug information, same as env var HMY_ALL_DEBUG=true"
vS := "dump out debug information, same as env var WIKI_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>")
@ -161,10 +162,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", hmyDocsDir),
Short: fmt.Sprintf("Generate docs to a local %s directory", wikiDocsDir),
RunE: func(cmd *cobra.Command, args []string) error {
cwd, _ := os.Getwd()
docDir := path.Join(cwd, hmyDocsDir)
docDir := path.Join(cwd, wikiDocsDir)
os.Mkdir(docDir, 0700)
doc.GenMarkdownTree(RootCmd, docDir)
return nil
@ -175,12 +176,12 @@ func init() {
var (
// VersionWrapDump meant to be set from main.go
VersionWrapDump = ""
cookbook = color.GreenString("hmy cookbook")
versionLink = "https://harmony.one/hmycli_ver"
cookbook = color.GreenString("wiki cookbook")
versionLink = "https://wikiwoop.com/wikicli_ver"
versionFormat = regexp.MustCompile("v[0-9]+-[a-z0-9]{7}")
)
// Execute kicks off the hmy CLI
// Execute kicks off the wiki 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 `hmy blockchain transaction-receipt <txHash>`")
fmt.Println("Try increasing the `timeout` or look for the transaction receipt with `wiki 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 Harmony blockchain
Create a staking transaction, sign it, and send off to the Woop blockchain
`,
RunE: func(cmd *cobra.Command, args []string) error {
cmd.Help()

@ -10,15 +10,15 @@ import (
"strings"
"time"
"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/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/spf13/cobra"
)
@ -342,7 +342,7 @@ func init() {
Short: "Create and send a transaction",
Args: cobra.ExactArgs(0),
Long: `
Create a transaction, sign it, and send off to the Harmony blockchain
Create a transaction, sign it, and send off to the Woop blockchain
`,
PreRunE: func(cmd *cobra.Command, args []string) error {
if offlineSign {
@ -456,7 +456,7 @@ Get Nonce From a Account
Short: "Send a Offline Signed transaction",
Args: cobra.ExactArgs(0),
Long: `
Send a offline signed transaction to the Harmony blockchain
Send a offline signed transaction to the Woop 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 harmony blockchain utilities",
Short: "common woop 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 (
hmyDocsDir = "hmy-docs"
wikiDocsDir = "wiki-docs"
defaultNodeAddr = "http://localhost:9500"
defaultRpcPrefix = "hmy"
defaultRpcPrefix = "wiki"
defaultMainnetEndpoint = "https://api.s0.t.hmny.io/"
)
@ -30,88 +30,88 @@ Note:
Examples:
%s
./hmy --node=[NODE] balances <SOME_ONE_ADDRESS>
./wiki --node=[NODE] balances <SOME_ONE_ADDRESS>
%s
./hmy --node=[NODE] blockchain transaction-by-hash <SOME_TX_HASH>
./wiki --node=[NODE] blockchain transaction-by-hash <SOME_TX_HASH>
%s
./hmy keys list
./wiki keys list
%s
./hmy --node=[NODE] transfer \
./wiki --node=[NODE] transfer \
--from <SOME_ONE_ADDRESS> --to <SOME_ONE_ADDRESS> \
--from-shard 0 --to-shard 1 --amount 200 --passphrase
%s
./hmy --node=[NODE] transfer --file <PATH_TO_JSON_FILE>
./wiki --node=[NODE] transfer --file <PATH_TO_JSON_FILE>
Check README for details on json file format.
%s
./hmy --node=[NODE] blockchain transaction-receipt <SOME_TX_HASH>
./wiki --node=[NODE] blockchain transaction-receipt <SOME_TX_HASH>
%s
./hmy keys recover-from-mnemonic <ACCOUNT_NAME> --passphrase
./wiki keys recover-from-mnemonic <ACCOUNT_NAME> --passphrase
%s
./hmy keys import-ks <PATH_TO_KEYSTORE_JSON>
./wiki keys import-ks <PATH_TO_KEYSTORE_JSON>
%s
./hmy keys import-private-key <secp256k1_PRIVATE_KEY>
./wiki keys import-private-key <secp256k1_PRIVATE_KEY>
%s
./hmy keys export-private-key <ACCOUNT_ADDRESS> --passphrase
./wiki keys export-private-key <ACCOUNT_ADDRESS> --passphrase
%s
./hmy keys generate-bls-key --bls-file-path <PATH_FOR_BLS_KEY_FILE>
./wiki keys generate-bls-key --bls-file-path <PATH_FOR_BLS_KEY_FILE>
%s
./hmy --node=[NODE] staking create-validator --amount 10 --validator-addr <SOME_ONE_ADDRESS> \
./wiki --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 harmony.one --passphrase
--min-self-delegation 10 --rate 0.1 --security-contact Leo --website wikiwoop.com --passphrase
%s
./hmy --node=[NODE] staking edit-validator \
./wiki --node=[NODE] staking edit-validator \
--validator-addr <SOME_ONE_ADDRESS> --identity foo --details bar \
--name baz --security-contact EK --website harmony.one \
--name baz --security-contact EK --website wikiwoop.com \
--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
./hmy --node=[NODE] staking delegate \
./wiki --node=[NODE] staking delegate \
--delegator-addr <SOME_ONE_ADDRESS> --validator-addr <VALIDATOR_ONE_ADDRESS> \
--amount 10 --passphrase
%s
./hmy --node=[NODE] staking undelegate \
./wiki --node=[NODE] staking undelegate \
--delegator-addr <SOME_ONE_ADDRESS> --validator-addr <VALIDATOR_ONE_ADDRESS> \
--amount 10 --passphrase
%s
./hmy --node=[NODE] staking collect-rewards \
./wiki --node=[NODE] staking collect-rewards \
--delegator-addr <SOME_ONE_ADDRESS> --passphrase
%s
./hmy --node=[NODE] blockchain validator elected
./wiki --node=[NODE] blockchain validator elected
%s
./hmy --node=[NODE] blockchain utility-metrics
./wiki --node=[NODE] blockchain utility-metrics
%s
./hmy --node=[NODE] failures staking
./wiki --node=[NODE] failures staking
%s
./hmy --node=[NODE] utility shard-for-bls <BLS_PUBLIC_KEY>
./wiki --node=[NODE] utility shard-for-bls <BLS_PUBLIC_KEY>
%s
./hmy governance vote-proposal --space=[harmony-mainnet.eth] \
./wiki governance vote-proposal --space=[woop-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 (hmy keys import-private-key) to import
PS: key must first use (wiki keys import-private-key) to import
%s
./hmy command --net=testnet
./wiki command --net=testnet
`,
g("1. Check account balance on given chain"),
g("2. Check sent transaction"),

@ -1,4 +1,4 @@
module github.com/harmony-one/go-sdk
module github.com/woop-chain/go-sdk
go 1.14
@ -12,8 +12,8 @@ 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/harmony-one/bls v0.0.7-0.20191214005344-88c23f91a8a9
github.com/harmony-one/harmony v1.10.2-0.20210123081216-6993b9ad0ca1
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/mattn/go-colorable v0.1.9
github.com/mitchellh/go-homedir v1.1.0

@ -352,16 +352,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/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/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/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=

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

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

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

@ -3,21 +3,22 @@ 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/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"
"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"
)
// 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()
hmyCLIDir := path.Join(uDir, common.DefaultConfigDirName, common.DefaultConfigAccountAliasesDirName)
accountDir := fmt.Sprintf("%s/%s", hmyCLIDir, name)
wikiCLIDir := path.Join(uDir, common.DefaultConfigDirName, common.DefaultConfigAccountAliasesDirName)
accountDir := fmt.Sprintf("%s/%s", wikiCLIDir, name)
os.RemoveAll(accountDir)
return nil

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

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

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

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

@ -18,17 +18,17 @@ import (
"time"
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"
"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"
@ -58,9 +58,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 // Hmy Node url
ShardId int // Hmy Shard ID
Net string // Hmy Network
NodeUrl string // Wiki Node url
ShardId int // Wiki Shard ID
Net string // Wiki Network
}
// Console is a JavaScript interpreted runtime environment. It is a fully fledged
@ -74,9 +74,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 // Hmy Node url
shardId int // Hmy Shard ID
net string // Hmy Network
nodeUrl string // Wiki Node url
shardId int // Wiki Shard ID
net string // Wiki Network
}
// New initializes a JavaScript interpreted runtime environment and sets defaults
@ -243,14 +243,14 @@ func (c *Console) initPersonal(vm *goja.Runtime, bridge *bridge) {
if personal == nil || c.prompter == nil {
return
}
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)))
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)))
_, err := vm.RunString(`Object.defineProperty(personal, "listAccounts", {get: personal.getListAccounts});`)
if err != nil {
@ -264,8 +264,8 @@ func (c *Console) initEth(vm *goja.Runtime, bridge *bridge) {
return
}
eth.Set("sendTransaction", jsre.MakeCallback(vm, bridge.callbackProtected(bridge.HmySendTransaction)))
eth.Set("signTransaction", jsre.MakeCallback(vm, bridge.callbackProtected(bridge.HmySignTransaction)))
eth.Set("sendTransaction", jsre.MakeCallback(vm, bridge.callbackProtected(bridge.WikiSendTransaction)))
eth.Set("signTransaction", jsre.MakeCallback(vm, bridge.callbackProtected(bridge.WikiSignTransaction)))
}
func (c *Console) clearHistory() {
@ -319,7 +319,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 Hmy JavaScript console!\n\n"
message := "Welcome to the Wiki JavaScript console!\n\n"
// Print some generic Geth metadata
if res, err := c.jsre.Run(`
@ -327,7 +327,7 @@ func (c *Console) Welcome() {
try {
message += "coinbase: " + eth.coinbase + "\n";
} catch (err) {}
message += "at shard: " + hmy.shardID + "\n";
message += "at shard: " + wiki.shardID + "\n";
message += "at block: " + eth.blockNumber + " (" + new Date(1000 * eth.getBlock(eth.blockNumber).timestamp) + ")\n";
try {
message += " datadir: " + admin.datadir + "\n";
@ -531,7 +531,7 @@ func (b *bridge) callbackProtected(protectedFunc func(call jsre.Call) (goja.Valu
}
}
func (b *bridge) HmyGetListAccounts(call jsre.Call) (goja.Value, error) {
func (b *bridge) WikiGetListAccounts(call jsre.Call) (goja.Value, error) {
var accounts = []string{}
for _, name := range store.LocalAccounts() {
@ -545,7 +545,7 @@ func (b *bridge) HmyGetListAccounts(call jsre.Call) (goja.Value, error) {
return call.VM.ToValue(accounts), nil
}
func (b *bridge) HmySignTransaction(call jsre.Call) (goja.Value, error) {
func (b *bridge) WikiSignTransaction(call jsre.Call) (goja.Value, error) {
txObj := call.Arguments[0].ToObject(call.VM)
password := call.Arguments[1].String()
@ -628,7 +628,7 @@ func (b *bridge) HmySignTransaction(call jsre.Call) (goja.Value, error) {
}), nil
}
func (b *bridge) HmySendTransaction(call jsre.Call) (goja.Value, error) {
func (b *bridge) WikiSendTransaction(call jsre.Call) (goja.Value, error) {
txObj := call.Arguments[0].ToObject(call.VM)
password := ""
if len(call.Arguments) > 1 {
@ -698,7 +698,7 @@ func (b *bridge) HmySendTransaction(call jsre.Call) (goja.Value, error) {
return call.VM.ToValue(*ctrlr.TransactionHash()), nil
}
func (b *bridge) HmyLockAccount(call jsre.Call) (goja.Value, error) {
func (b *bridge) WikiLockAccount(call jsre.Call) (goja.Value, error) {
address := call.Arguments[0].String()
_, _, err := store.LockKeystore(address)
@ -709,7 +709,7 @@ func (b *bridge) HmyLockAccount(call jsre.Call) (goja.Value, error) {
return goja.Null(), nil
}
func (b *bridge) HmyImportRawKey(call jsre.Call) (goja.Value, error) {
func (b *bridge) WikiImportRawKey(call jsre.Call) (goja.Value, error) {
privateKey := call.Arguments[0].String()
password := call.Arguments[1].String()
@ -721,7 +721,7 @@ func (b *bridge) HmyImportRawKey(call jsre.Call) (goja.Value, error) {
return call.VM.ToValue(name), nil
}
func (b *bridge) HmyUnlockAccount(call jsre.Call) (goja.Value, error) {
func (b *bridge) WikiUnlockAccount(call jsre.Call) (goja.Value, error) {
if len(call.Arguments) < 3 {
return nil, errors.New("arguments < 3")
}
@ -737,11 +737,11 @@ func (b *bridge) HmyUnlockAccount(call jsre.Call) (goja.Value, error) {
return goja.Null(), nil
}
func (b *bridge) HmyNewAccount(call jsre.Call) (goja.Value, error) {
func (b *bridge) WikiNewAccount(call jsre.Call) (goja.Value, error) {
return goja.Null(), nil
}
func (b *bridge) HmySign(call jsre.Call) (goja.Value, error) {
func (b *bridge) WikiSign(call jsre.Call) (goja.Value, error) {
dataToSign := call.Arguments[0].String()
addressStr := call.Arguments[1].String()
password := call.Arguments[2].String()

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

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

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

@ -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/harmony-one/go-sdk/pkg/common"
"github.com/harmony-one/harmony/accounts"
"github.com/woop-chain/go-sdk/pkg/common"
"github.com/woop-chain/woop/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(), "hmy-test")
location := path.Join(os.TempDir(), "wiki-test")
keyStore := common.KeyStoreForPath(location)
privateKeyBytes, _ := hex.DecodeString("91c8360c4cb4b5fac45513a7213f31d4e4a7bfcb4630e9fbf074f42a203ac0b9")
sk, _ := btcec.PrivKeyFromBytes(btcec.S256(), privateKeyBytes)

@ -78,8 +78,8 @@ func (v *Vote) ToEIP712() (*TypedData, error) {
// 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
// hmy governance vote-proposal \
// --space harmony-mainnet.eth \
// wiki governance vote-proposal \
// --space woop-mainnet.eth \
// --proposal 0xTruncated \
// --proposal-type {"approval","ranked-choice"} \
// --choice "[1, 2, 3]" \
@ -103,8 +103,8 @@ func (v *Vote) ToEIP712() (*TypedData, error) {
}
// The space between --choice {value} does not matter to snapshot.org
// But for comparing with the snapshot-js library, remove it
// hmy governance vote-proposal \
// --space harmony-mainnet.eth \
// wiki governance vote-proposal \
// --space woop-mainnet.eth \
// --proposal 0xTruncated \
// # either quadratic or weighted
// --proposal-type {"quadratic","weighted"} \
@ -118,8 +118,8 @@ func (v *Vote) ToEIP712() (*TypedData, error) {
})
choice = v.Choice
// TODO Untested
// hmy governance vote-proposal \
// --space harmony-mainnet.eth \
// wiki governance vote-proposal \
// --space woop-mainnet.eth \
// --proposal 0xTruncated \
// --proposal-type ANY \
// --choice "unknown-format" \
@ -131,8 +131,8 @@ func (v *Vote) ToEIP712() (*TypedData, error) {
// Type: "string",
// })
// choice = v.Choice
// hmy governance vote-proposal \
// --space harmony-mainnet.eth \
// wiki governance vote-proposal \
// --space woop-mainnet.eth \
// --proposal 0xTruncated \
// --proposal-type single-choice \
// --choice 1 \
@ -149,8 +149,8 @@ func (v *Vote) ToEIP712() (*TypedData, error) {
} else {
choice = math.NewHexOrDecimal256(int64(x))
}
// hmy governance vote-proposal \
// --space harmony-mainnet.eth \
// wiki governance vote-proposal \
// --space woop-mainnet.eth \
// --proposal 0xTruncated \
// --proposal-type basic \
// # any character case works

@ -16,17 +16,17 @@ import (
"path"
"strings"
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"
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"
"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/harmony-one/go-sdk/pkg/address"
"github.com/harmony-one/harmony/accounts/keystore"
"github.com/woop-chain/go-sdk/pkg/address"
"github.com/woop-chain/woop/accounts/keystore"
// "github.com/ethereum/go-ethereum/crypto"
@ -17,33 +17,33 @@ import (
func checkAndMakeKeyDirIfNeeded() string {
userDir, _ := homedir.Dir()
hmyCLIDir := path.Join(userDir, ".hmy_cli", "keystore")
if _, err := os.Stat(hmyCLIDir); os.IsNotExist(err) {
wikiCLIDir := path.Join(userDir, ".wiki_cli", "keystore")
if _, err := os.Stat(wikiCLIDir); os.IsNotExist(err) {
// Double check with Leo what is right file persmission
os.Mkdir(hmyCLIDir, 0700)
os.Mkdir(wikiCLIDir, 0700)
}
return hmyCLIDir
return wikiCLIDir
}
func ListKeys(keystoreDir string) {
hmyCLIDir := checkAndMakeKeyDirIfNeeded()
wikiCLIDir := checkAndMakeKeyDirIfNeeded()
scryptN := keystore.StandardScryptN
scryptP := keystore.StandardScryptP
ks := keystore.NewKeyStore(hmyCLIDir, scryptN, scryptP)
ks := keystore.NewKeyStore(wikiCLIDir, scryptN, scryptP)
// keystore.KeyStore
allAccounts := ks.Accounts()
fmt.Printf("Harmony Address:%s File URL:\n", strings.Repeat(" ", ethCommon.AddressLength*2))
fmt.Printf("Woop 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) {
hmyCLIDir := checkAndMakeKeyDirIfNeeded()
wikiCLIDir := checkAndMakeKeyDirIfNeeded()
scryptN := keystore.StandardScryptN
scryptP := keystore.StandardScryptP
ks := keystore.NewKeyStore(hmyCLIDir, scryptN, scryptP)
ks := keystore.NewKeyStore(wikiCLIDir, 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 Harmony JS sdk in deriving the
// FromMnemonicSeedAndPassphrase mimics the Woop 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/harmony-one/go-sdk/pkg/address"
"github.com/harmony-one/harmony/core/types"
staking "github.com/harmony-one/harmony/staking/types"
"github.com/woop-chain/go-sdk/pkg/address"
"github.com/woop-chain/woop/core/types"
staking "github.com/woop-chain/woop/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()

@ -3,7 +3,7 @@ package v1
import (
"fmt"
rpcCommon "github.com/harmony-one/go-sdk/pkg/rpc/common"
rpcCommon "github.com/woop-chain/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 = "hmy"
RPCPrefix = "wiki"
Method rpcCommon.RpcEnumList = rpcV1.Method
)

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

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

@ -5,10 +5,10 @@ import (
"encoding/json"
"fmt"
"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"
"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"
)
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()
hmyCLIDir := path.Join(uDir, common.DefaultConfigDirName, common.DefaultConfigAccountAliasesDirName)
if _, err := os.Stat(hmyCLIDir); os.IsNotExist(err) {
os.MkdirAll(hmyCLIDir, 0700)
wikiCLIDir := path.Join(uDir, common.DefaultConfigDirName, common.DefaultConfigAccountAliasesDirName)
if _, err := os.Stat(wikiCLIDir); os.IsNotExist(err) {
os.MkdirAll(wikiCLIDir, 0700)
}
}

@ -9,15 +9,15 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/rlp"
"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"
"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"
)
var (

@ -5,7 +5,7 @@ import (
"fmt"
"time"
"github.com/harmony-one/go-sdk/pkg/rpc"
"github.com/woop-chain/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/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"
"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"
)
type ethTransactionForRPC struct {

@ -3,10 +3,10 @@ package transaction
import (
"math/big"
"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"
"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"
)
// NewTransaction - create a new Transaction based on supplied params

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

@ -2,7 +2,7 @@
set -ieu
source ../harmony/scripts/setup_bls_build_flags.sh
source ../woop/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})
./hmy --node=${shard_zero} \
./wiki --node=${shard_zero} \
transfer --from ${sender} --to ${receiver} \
--from-shard 0 --to-shard 0 --amount ${amount} \
--passphrase='' &

@ -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:
./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/
./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/
Sample CSV file:
https://docs.google.com/spreadsheets/d/1nkF8N16S3y28cn7SM1cYJca8lzHPOzyR42S1V-OOAeQ/edit?usp=sharing
For detail help message:
./hmy-csv.py --help
./wiki-csv.py --help
Install with:
curl -O https://raw.githubusercontent.com/harmony-one/go-sdk/master/scripts/hmy-csv.py && chmod +x hmy-csv.py
curl -O https://raw.githubusercontent.com/woop-chain/go-sdk/master/scripts/wiki-csv.py && chmod +x wiki-csv.py
"""
import sys
import time
@ -36,7 +36,7 @@ import json
import ssl
script_directory = os.path.dirname(os.path.realpath(__file__))
_hmy_call_and_prefix = [f"{script_directory}/hmy"]
_wiki_call_and_prefix = [f"{script_directory}/wiki"]
chain_id_options = {"mainnet", "testnet", "stressnet", "partner", "dryrun"}
default_passphrase = ""
@ -57,19 +57,19 @@ class Typgpy(str):
UNDERLINE = '\033[4m'
def _hmy(cli_args, timeout=200):
def _wiki(cli_args, timeout=200):
"""
Helper function to call the CLI with the given args.
Assumes `_setup_hmy` has been called prior to using this function.
Assumes `_setup_wiki` has been called prior to using this function.
Raises subprocess.CalledProcessError if call errored.
"""
assert isinstance(cli_args, list)
hmy_and_args = _hmy_call_and_prefix + [str(x) for x in cli_args]
wiki_and_args = _wiki_call_and_prefix + [str(x) for x in cli_args]
if args.verbose:
hmy_and_args.append("--verbose")
return subprocess.check_output(hmy_and_args, env=os.environ, timeout=timeout).decode()
wiki_and_args.append("--verbose")
return subprocess.check_output(wiki_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 = _hmy(["utility", "shards", "-n", node])
response = _wiki(["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/hmy-csv-{hash(str(batch_tx))}.json"
temp_file = f"/tmp/wiki-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}")
hmy_args = ["transfer", "--file", temp_file, "--node", node]
wiki_args = ["transfer", "--file", temp_file, "--node", node]
if chain_id:
hmy_args.extend(["--chain-id", chain_id])
wiki_args.extend(["--chain-id", chain_id])
if fast:
hmy_args.extend(["--timeout", "0"])
wiki_args.extend(["--timeout", "0"])
else:
hmy_args.extend(["--timeout", timeout])
wiki_args.extend(["--timeout", timeout])
try:
output = _hmy(hmy_args, timeout=timeout * len(batch_tx))
output = _wiki(wiki_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:
_hmy(["utility", "bech32-to-addr", row['from']])
_hmy(["utility", "bech32-to-addr", row['to']])
_wiki(["utility", "bech32-to-addr", row['from']])
_wiki(["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_hmy():
def _setup_wiki():
"""
Setup `_hmy_call_and_prefix` depending on if hmy.sh exists.
Setup `_wiki_call_and_prefix` depending on if wiki.sh exists.
"""
global _hmy_call_and_prefix
_hmy_call_and_prefix = [f"{script_directory}/hmy"]
global _wiki_call_and_prefix
_wiki_call_and_prefix = [f"{script_directory}/wiki"]
try:
_hmy(["version"])
_wiki(["version"])
return
except (subprocess.CalledProcessError, FileNotFoundError):
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", "--"]
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", "--"]
try:
_hmy(["version"])
_wiki(["version"])
return
except subprocess.CalledProcessError as e:
raise SystemExit(
f"'hmy.sh' is unable to execute the CLI. Try downloading the CLI with `./hmy.sh -d`.") from e
f"'wiki.sh' is unable to execute the CLI. Try downloading the CLI with `./wiki.sh -d`.") from e
else:
raise SystemExit(f"'hmy.sh' is not found in script directory {script_directory}. ")
raise SystemExit(f"'wiki.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='Harmony CLI, transaction from CSV file wrapper script.')
parser = argparse.ArgumentParser(description='Woop 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_hmy()
_setup_wiki()
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.harmony.one'
BUCKET='pub.wikiwoop.com'
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 ./hmy to work correctly.
For instance: ./hmy.sh balances <one-address> --node=https://api.s0.p.hmny.io/
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/
EOT
}
@ -22,13 +22,13 @@ set_download () {
Darwin)
FOLDER=release/darwin-x86_64/${rel}
URL=http://${BUCKET}.s3.amazonaws.com/${FOLDER}
BIN=( hmy libbls384_256.dylib libcrypto.1.0.0.dylib libgmp.10.dylib libgmpxx.4.dylib libmcl.dylib )
BIN=( wiki libbls384_256.dylib libcrypto.1.0.0.dylib libgmp.10.dylib libgmpxx.4.dylib libmcl.dylib )
NAMES=("${BIN[@]}")
;;
Linux)
URL=https://harmony.one
BIN=( hmycli )
NAMES=( hmy )
URL=https://wikiwoop.com
BIN=( wikicli )
NAMES=( wiki )
;;
*)
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 hmy
chmod +x wiki
}
while getopts "dh" opt; do
@ -63,7 +63,7 @@ done
shift $((OPTIND-1))
if [ "$OS" = "Linux" ]; then
./hmy "$@"
./wiki "$@"
else
DYLD_FALLBACK_LIBRARY_PATH="$(pwd)" ./hmy "$@"
DYLD_FALLBACK_LIBRARY_PATH="$(pwd)" ./wiki "$@"
fi
Loading…
Cancel
Save