demo.sh (2381B)
1 set +e 2 # chainlib required settings, edit as needed. 3 export RPC_PROVIDER=http://localhost:8545 4 # The chain spec 3rd field MUST match the chain id of the newtork 5 export CHAIN_SPEC=evm:kitabu:5050:test 6 # this file will be used to sign all transcations below 7 # it must have sufficient gas token balance 8 export WALLET_KEY_FILE=${WALLET_KEY_FILE:-alice.json} 9 10 # eth-keyfile is provided by the funga-eth module, a dependency of craft-nft 11 >&2 echo generating keys... 12 eth-keyfile -z > bob.json 13 eth-keyfile -z > carol.json 14 eth-keyfile -z > dave.json 15 export ALICE=$(eth-keyfile -z -d $WALLET_KEY_FILE) 16 >&2 echo "Alice has key $ALICE. This key will be used for signing" 17 export BOB=$(eth-keyfile -z -d bob.json) 18 >&2 echo Bob has key $BOB 19 export CAROL=$(eth-keyfile -z -d carol.json) 20 >&2 echo Carol has key $CAROL 21 export DAVE=$(eth-keyfile -z -d dave.json) 22 >&2 echo Dave has key $DAVE 23 24 # publish contract 25 >&2 echo publishing token ... 26 echo "description missing" > description.txt 27 craftnft-publish --name "Test Token" --symbol "TEST" --declaration-file description.txt -s -w > token.txt 28 export TOKEN_ADDRESS=$(cat token.txt | eth-checksum) 29 >&2 echo published token $TOKEN_ADDRESS 30 31 token_foo=$(echo -n foo | sha256sum | awk '{print $1;}') 32 >&2 echo allocating unique token "foo" ... 33 craftnft-allocate -e $TOKEN_ADDRESS -s -w $token_foo >> txs.txt 34 token_bar=$(echo -n bar | sha256sum | awk '{print $1;}') 35 >&2 echo allocating batched token "bar" ... 36 craftnft-allocate -e $TOKEN_ADDRESS -s -w --count 10 $token_bar >> txs.txt 37 38 >&2 echo minting the "foo" token to Alice ... 39 craftnft-mint -e $TOKEN_ADDRESS --token-id $token_foo -s -w $ALICE >> txs.txt 40 >&2 echo minting a "bar" token to Bob ... 41 craftnft-mint -e $TOKEN_ADDRESS --token-id $token_bar -s -w $BOB >> txs.txt 42 >&2 echo minting a "bar" token to Carol ... 43 craftnft-mint -e $TOKEN_ADDRESS --token-id $token_bar -s -w $CAROL >> txs.txt 44 >&2 echo minting a "bar" token to Alice ... 45 craftnft-mint -e $TOKEN_ADDRESS --token-id $token_bar -s -w $ALICE >> txs.txt 46 47 # erc721-tranfser is provided by the eth-erc721 module, a dependency of craft-nft 48 # It is a generic tool, so we need to specify the gas budget manually 49 >&2 echo "transfer Alice's bar token to Dave ..." 50 erc721-transfer -e $TOKEN_ADDRESS -a $DAVE -s -w --fee-limit 100000 0xfcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04f0000000000000002 >> txs.txt 51 52 craftnft-dump $TOKEN_ADDRESS 53 set -e