Get ordered keys

Get ordered keys - get-ordered-keys.js

Prints ordered vRAM table keys in ascending order account/table/scope. This can be used to iterate over the entire table client side. The script is located in the utils/ipfs-service/get-ordered-keys.js of an unboxed zeus box.
Mandatory env variables:
1
export CONTRACT_NAME=
2
export SCOPE=
3
export TABLE_NAME=
4
node zeus_boxes/ipfs-dapp-service/utils/ipfs-service/get-ordered-keys
Copied!
Optional env variables (if using non-local nodeos / IPFS instance):
1
# defaults to localhost:8888, can be used to specify external nodeos instance
2
export NODEOS_ENDPOINT=
3
# defaults to localhost, can be used to specify external IPFS instance
4
export IPFS_HOST=
5
# defaults to 5001
6
export IPFS_PORT=
7
# defaults to http
8
export IPFS_PROTOCOL=
9
# defaults to 1024
10
export SHARD_LIMIT=
11
# defaults to 10000
12
export IPFS_TIMEOUT=
Copied!
Steps to produce console logged output below:
1
npm i -g @liquidapps/zeus-cmd
2
mkdir ipfs-dapp-service; cd ipfs-dapp-service
3
zeus box create
4
zeus unbox ipfs-dapp-service
5
zeus test -c
6
export CONTRACT_NAME=test1
7
export SCOPE=test1
8
export TABLE_NAME=test
9
node zeus_boxes/ipfs-dapp-service/utils/ipfs-service/get-ordered-keys
Copied!
Expected output:
1
[ '0', '1', '2', '20', '555', '12345', '52343' ]
Copied!
Querying table rows with Zeus or the dapp-client’s get_vram_row call:
1
# zeus get-table-row <contract> <table> <scope> <key> <keytype> <keysize>
2
zeus get-table-row test1 test test1 52343 number 64
3
# output:
4
{"row":{"id":"0","sometestnumber":"0"}}
Copied!
Copy link