Remove unicode character
All checks were successful
Lint / Run flake8 on python integration tests (push) Successful in 2m43s
Lint / Run golangci-lint (push) Successful in 5m37s
Tests / test-rpc (push) Successful in 4m26s
Tests / test-importer (push) Successful in 20m54s
Tests / sdk_tests (push) Successful in 8m13s
Tests / test-unit (push) Successful in 6m34s
All checks were successful
Lint / Run flake8 on python integration tests (push) Successful in 2m43s
Lint / Run golangci-lint (push) Successful in 5m37s
Tests / test-rpc (push) Successful in 4m26s
Tests / test-importer (push) Successful in 20m54s
Tests / sdk_tests (push) Successful in 8m13s
Tests / test-unit (push) Successful in 6m34s
This commit is contained in:
parent
d65dcce302
commit
1ea6d6b647
@ -1,48 +1,48 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
##
|
##
|
||||||
## This script generates a new account keypair, transfers funds to it, and creates
|
## This script generates a new account keypair, transfers funds to it, and creates
|
||||||
## a bond with those funds. The amount of can be optionally specified, else a
|
## a bond with those funds. The amount of can be optionally specified, else a
|
||||||
## default value estimated to be sufficient for about 5000 records.
|
## default value estimated to be sufficient for about 5000 records.
|
||||||
##
|
##
|
||||||
## The `laconic` CLI and a valid config file for it are required. The default location
|
## The `laconic` CLI and a valid config file for it are required. The default location
|
||||||
## for the config file is `~/.laconic/config.yml`, but this can be controlled with
|
## for the config file is `~/.laconic/config.yml`, but this can be controlled with
|
||||||
## the environment variable LACONIC_CONFIG. A `userKey` for a source account with
|
## the environment variable LACONIC_CONFIG. A `userKey` for a source account with
|
||||||
## sufficient funds available must be present in this file for the funds transfer
|
## sufficient funds available must be present in this file for the funds transfer
|
||||||
## to succeed.
|
## to succeed.
|
||||||
##
|
##
|
||||||
## Example:
|
## Example:
|
||||||
##
|
##
|
||||||
## ❯ scripts/create-and-fund-account.sh 1000000000
|
## $ scripts/create-and-fund-account.sh 1000000000
|
||||||
## {
|
## {
|
||||||
## "name": "68334d7175fd4f86befa4902657e5270",
|
## "name": "68334d7175fd4f86befa4902657e5270",
|
||||||
## "type": "local",
|
## "type": "local",
|
||||||
## "address": "ethm15r5x94km0swq55aszwd7hnr9wksq7wmr38xes7",
|
## "address": "ethm15r5x94km0swq55aszwd7hnr9wksq7wmr38xes7",
|
||||||
## "pubkey": "AuKqlSldJJXj4gYMFt2HeX9DJ3aUosYA7n6zBz9Tg7/i",
|
## "pubkey": "AuKqlSldJJXj4gYMFt2HeX9DJ3aUosYA7n6zBz9Tg7/i",
|
||||||
## "mnemonic": "umbrella bean special unaware accident giant distance mix ghost feel possible cost road grant endless man maple derive rebuild learn mask water attract resist",
|
## "mnemonic": "umbrella bean special unaware accident giant distance mix ghost feel possible cost road grant endless man maple derive rebuild learn mask water attract resist",
|
||||||
## "bond": "3d3a73f09115d289d330781455e6eac217305dc4a20e19bde808011fe3775a93",
|
## "bond": "3d3a73f09115d289d330781455e6eac217305dc4a20e19bde808011fe3775a93",
|
||||||
## "balance": 1000000000,
|
## "balance": 1000000000,
|
||||||
## "privkey": "480880fde7aff1461da584b436cb3a84692413c84623fda78e127bb4e704ce76"
|
## "privkey": "480880fde7aff1461da584b436cb3a84692413c84623fda78e127bb4e704ce76"
|
||||||
## }
|
## }
|
||||||
##
|
##
|
||||||
|
|
||||||
AVG_RECORD_PHOTON=1000000
|
AVG_RECORD_PHOTON=1000000
|
||||||
NUM_RECORDS=5000
|
NUM_RECORDS=5000
|
||||||
BOND_OVERHEAD=200000
|
BOND_OVERHEAD=200000
|
||||||
KEYNAME=`uuidgen | tr -d '-'`
|
KEYNAME=`uuidgen | tr -d '-'`
|
||||||
KEYRING_DIR=`mktemp -d`
|
KEYRING_DIR=`mktemp -d`
|
||||||
KEYRING=test
|
KEYRING=test
|
||||||
LACONIC_CONFIG=${LACONIC_CONFIG:-$HOME/.laconic/config.yml}
|
LACONIC_CONFIG=${LACONIC_CONFIG:-$HOME/.laconic/config.yml}
|
||||||
BOND_AMOUNT=${1:-$((AVG_RECORD_PHOTON * NUM_RECORDS))}
|
BOND_AMOUNT=${1:-$((AVG_RECORD_PHOTON * NUM_RECORDS))}
|
||||||
|
|
||||||
ACCOUNT_JSON=$(laconicd keys add $KEYNAME --keyring-backend $KEYRING --algo eth_secp256k1 --keyring-dir $KEYRING_DIR --output json)
|
ACCOUNT_JSON=$(laconicd keys add $KEYNAME --keyring-backend $KEYRING --algo eth_secp256k1 --keyring-dir $KEYRING_DIR --output json)
|
||||||
PRIVATE_KEY=$(yes | laconicd keys export $KEYNAME --keyring-backend $KEYRING --keyring-dir $KEYRING_DIR --unarmored-hex --unsafe)
|
PRIVATE_KEY=$(yes | laconicd keys export $KEYNAME --keyring-backend $KEYRING --keyring-dir $KEYRING_DIR --unarmored-hex --unsafe)
|
||||||
PUB_KEY=$(echo $ACCOUNT_JSON | jq -r ".pubkey | fromjson | .key")
|
PUB_KEY=$(echo $ACCOUNT_JSON | jq -r ".pubkey | fromjson | .key")
|
||||||
|
|
||||||
laconicd keys delete $KEYNAME --keyring-backend $KEYRING --keyring-dir $KEYRING_DIR -y 2> /dev/null
|
laconicd keys delete $KEYNAME --keyring-backend $KEYRING --keyring-dir $KEYRING_DIR -y 2> /dev/null
|
||||||
rm -rf $KEYRING_DIR
|
rm -rf $KEYRING_DIR
|
||||||
|
|
||||||
laconic -c $LACONIC_CONFIG cns tokens send --address $(echo $ACCOUNT_JSON | jq -r '.address') --type aphoton --quantity $((BOND_AMOUNT + BOND_OVERHEAD)) > /dev/null
|
laconic -c $LACONIC_CONFIG cns tokens send --address $(echo $ACCOUNT_JSON | jq -r '.address') --type aphoton --quantity $((BOND_AMOUNT + BOND_OVERHEAD)) > /dev/null
|
||||||
BOND_ID=$(laconic -c $LACONIC_CONFIG cns bond create --user-key $PRIVATE_KEY --type aphoton --quantity $BOND_AMOUNT | jq -r '.bondId')
|
BOND_ID=$(laconic -c $LACONIC_CONFIG cns bond create --user-key $PRIVATE_KEY --type aphoton --quantity $BOND_AMOUNT | jq -r '.bondId')
|
||||||
|
|
||||||
echo $ACCOUNT_JSON | jq ".bond = \"$BOND_ID\"" | jq ".balance = $BOND_AMOUNT" | jq ".privkey = \"$PRIVATE_KEY\"" | jq ".pubkey = \"$PUB_KEY\""
|
echo $ACCOUNT_JSON | jq ".bond = \"$BOND_ID\"" | jq ".balance = $BOND_AMOUNT" | jq ".privkey = \"$PRIVATE_KEY\"" | jq ".pubkey = \"$PUB_KEY\""
|
||||||
|
Loading…
Reference in New Issue
Block a user