ladder-cli

0.2.1 • Public • Published

Ladder's command line tool.

Command line tools to simplify user operations.

Actions

Key

  • create common account.

Configuration

  • config ladder's URL: setLadderUrl(url)
  • config ABOS's URL: setAbosUrl(url)
  • config ETH's kovan: setKovanUrl(url)
  • config ABOS's address: setAbosContract(address)
  • config ETH kovan's address: setKovanContract(address)

Basic information

  • query account balance on ladder: getLadderBalance(account)
  • query account balance on ABOS: getAbosBalance(account)
  • query account on Kovan: getKovanBalance(account)

Bank

At ABOS, the Kovan chain needs to be implemented.

  • deposit coin on side chain : deposit(receipt, value);
  • withdraw coin on side chain : withdraw(receipt, value);
  • query information on side chain : getDepositInfo(account, receipt);

Cross-chain transfer

  • get all side chains: getChains()

At ABOS, the Kovan chain needs to be implemented.

  • tranfer coin from one chain to others: transfer (tag, to, value, rate)

Rate

Implemented on Ladder.

  • get current rate of coin: getCurrentRate(coin);
  • get history rate of coin: getHistoryRate(coin, date);

Features

  • [x]API for ladder, eth, abos,
  • [ ]Test Case
  • [ ]Interactive command line
  • [ ]Tab input auto completion。
  • [ ]Color output chalk

Install

npm install ladder-cli -g

Examples

Account

create

ladder-cli key create

return

{
    "privateKey": "0x470b843ca18dfcf0f69d64c9e7c563d6c4b3f994919c0125ac9deb26e8bbd725",
    "mnemonic": "erase same answer prison soon jar liberty puzzle twelve item know crystal",
    "ethAddress": "0x256f6Ee6bF3C7899937bEf584dCebFfAFEA15484",
    "abosAddress": "0x256f6Ee6bF3C7899937bEf584dCebFfAFEA15484",
    "ladAddress": "5DQZCJPwR3Bgd9qzZZHeWeNx98zvyyHtbv1VYiq8FZYhqyCg",
    "ladPublicKey": "0x3b5ffbf9563084afedba5e3613d621452bf1ef3d411d3e1e7cb845ccfb8e5387",
    "type": "ed25519"
}

fromSeed

ladder-cli key fromSeed -k 0x4736048bd0485600bcde19071c5700437b24e25acb696e2ed9e0d7eba6d37ca4

return

{
    "privateKey": "0x470b843ca18dfcf0f69d64c9e7c563d6c4b3f994919c0125ac9deb26e8bbd725",
    "ethAddress": "0x256f6Ee6bF3C7899937bEf584dCebFfAFEA15484",
    "abosAddress": "0x256f6Ee6bF3C7899937bEf584dCebFfAFEA15484",
    "ladAddress": "5DQZCJPwR3Bgd9qzZZHeWeNx98zvyyHtbv1VYiq8FZYhqyCg",
    "ladPublicKey": "0x3b5ffbf9563084afedba5e3613d621452bf1ef3d411d3e1e7cb845ccfb8e5387",
    "type": "ed25519"
}

fromMnemonic

ladder-cli key fromMnemonic -m "erase same answer prison soon jar liberty puzzle twelve item know crystal";

return

{
    "privateKey": "0x470b843ca18dfcf0f69d64c9e7c563d6c4b3f994919c0125ac9deb26e8bbd725",
    "mnemonic": "erase same answer prison soon jar liberty puzzle twelve item know crystal",
    "ethAddress": "0x256f6Ee6bF3C7899937bEf584dCebFfAFEA15484",
    "abosAddress": "0x256f6Ee6bF3C7899937bEf584dCebFfAFEA15484",
    "ladAddress": "5DQZCJPwR3Bgd9qzZZHeWeNx98zvyyHtbv1VYiq8FZYhqyCg",
    "ladPublicKey": "0x3b5ffbf9563084afedba5e3613d621452bf1ef3d411d3e1e7cb845ccfb8e5387",
    "type": "ed25519"
}

ABOS

deposit

ladder-cli abos deposit -k 0x5557557a1029a773baabca1c79c61a45835310e7f2e9ccbe0653091c7502d7ad -b 0xe26792c40fcafc1b31869cc1f78a4a19c01ca1af6dfe742f8524fb74058c7f01 -v 0.1
  • -l: The rpc of abos chain.
  • -k: The private key.
  • -c(option): The smart contract that depolyed in abos chain.
  • -b: The beneficiary on ladder chain. it is public key format with 64 length.
  • -v: You deposit value in etherer.

return

{
    "transactionHash": "0x823970318a63a5fe5213b3466546e2174075a44698b49d70ac681a682ff1019b",
    "transactionIndex": 0,
    "blockHash": "0x6dbdbc6d90761162c1056d5c9da92436dc380094a3fc82a8969fcaa63960fa4f",
    "blockNumber": 3969766,
    "cumulativeQuotaUsed": "0xaa43",
    "quotaUsed": "0xaa43",
    "contractAddress": null,
    "logs": [
        {
            "address": "0x64501b783B2d1ce882076821237f1faba7a105dF",
            "topics": [
                "0x19dacbf83c5de6658e14cbf7bcae5c15eca2eedecf1c66fbca928e4d351bea0f"
            ],
            "data": "0x000000000000000000000000d573cade061a4a6e602f30931181805785b9505fe26792c40fcafc1b31869cc1f78a4a19c01ca1af6dfe742f8524fb74058c7f01000000000000000000000000000000000000000000000000016345785d8a0000",
            "blockHash": "0x6dbdbc6d90761162c1056d5c9da92436dc380094a3fc82a8969fcaa63960fa4f",
            "blockNumber": 3969766,
            "transactionHash": "0x823970318a63a5fe5213b3466546e2174075a44698b49d70ac681a682ff1019b",
            "transactionIndex": 0,
            "logIndex": 0,
            "transactionLogIndex": "0x0",
            "id": "log_15e09545"
        }
    ],
    "root": null,
    "logsBloom": "0x00000000000000000000000000000000000004000000200000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000",
    "errorMessage": null
}

withdraw

ladder-cli abos withdraw -k 0x5557557a1029a773baabca1c79c61a45835310e7f2e9ccbe0653091c7502d7ad -b 0xe26792c40fcafc1b31869cc1f78a4a19c01ca1af6dfe742f8524fb74058c7f01 -v 0.1
  • -l: The rpc of abos chain.
  • -k: The private key.
  • -c(option): The smart contract that depolyed in abos chain.
  • -b: The beneficiary on ladder chain. it is public key format with 64 length.
  • -v: You withdraw value in ether.

return

{
    "transactionHash": "0xdb788159eacc13dc1b26b1564569c8915819bc10dd6d57436a4779bd89a718b5",
    "transactionIndex": 0,
    "blockHash": "0x365a5660c72c2db5c816796877e8c3b74c0a7d8b86c998e1d71e5f317b1680da",
    "blockNumber": 3969867,
    "cumulativeQuotaUsed": "0x507a",
    "quotaUsed": "0x507a",
    "contractAddress": null,
    "logs": [
        {
            "address": "0x64501b783B2d1ce882076821237f1faba7a105dF",
            "topics": [
                "0xc3ded2be7db21b1af963f267d27750e4a15f174547d88b886b9bda43e2c6fa32"
            ],
            "data": "0x000000000000000000000000d573cade061a4a6e602f30931181805785b9505fe26792c40fcafc1b31869cc1f78a4a19c01ca1af6dfe742f8524fb74058c7f01000000000000000000000000000000000000000000000000016345785d8a0000",
            "blockHash": "0x365a5660c72c2db5c816796877e8c3b74c0a7d8b86c998e1d71e5f317b1680da",
            "blockNumber": 3969867,
            "transactionHash": "0xdb788159eacc13dc1b26b1564569c8915819bc10dd6d57436a4779bd89a718b5",
            "transactionIndex": 0,
            "logIndex": 0,
            "transactionLogIndex": "0x0",
            "id": "log_82866b81"
        }
    ],
    "root": null,
    "logsBloom": "0x00000000000000000000000000000000000000000000200000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000020000000000000000000000000000000000000000000008",
    "errorMessage": null
}

depositBalance

ladder-cli abos depositBalance -a 0xd573CaDe061a4A6E602F30931181805785B9505f -b 0xe26792c40fcafc1b31869cc1f78a4a19c01ca1af6dfe742f8524fb74058c7f01 -e
  • -l: The rpc of abos chain.
  • -c(option): The smart contract in abos chain.
  • -a: The deposit account on the chain
  • -b: The beneficiary on ladder chain. it is public key format with 64 length.

return

0.1 ether

crossTransfer

ladder-cli abos crossTransfer -k 0x5557557a1029a773baabca1c79c61a45835310e7f2e9ccbe0653091c7502d7ad -t kovan -r 0xd573CaDe061a4A6E602F30931181805785B9505f -v 0.1
  • -l: The rpc of abos chain.
  • -k: The private key.
  • -c(option): The smart contract of brank that depolyed in abos chain.
  • -t: The coin you want to convert
  • -r: The recipient address on tag chain.
  • -v: You transfer value in ether. return
{
    "transactionHash": "0xee122609e06747e0869210b941451ee5699eb46243273c2cd1ba82ecbaa780dc",
    "transactionIndex": 0,
    "blockHash": "0x5e64d59bf09925435b5035a43e8e8e360cac57a6ce7169f206d098083cbad95c",
    "blockNumber": 3970135,
    "cumulativeQuotaUsed": "0x5ae7",
    "quotaUsed": "0x5ae7",
    "contractAddress": null,
    "logs": [
        {
            "address": "0x64501b783B2d1ce882076821237f1faba7a105dF",
            "topics": [
                "0x2805de6a4a634b2ab3b38349f3909c711217f384c1c4e4bfa32a0cac0c1d4c3a"
            ],
            "data": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000d573cade061a4a6e602f30931181805785b9505f000000000000000000000000d573cade061a4a6e602f30931181805785b9505f000000000000000000000000000000000000000000000000016345785d8a0000",
            "blockHash": "0x5e64d59bf09925435b5035a43e8e8e360cac57a6ce7169f206d098083cbad95c",
            "blockNumber": 3970135,
            "transactionHash": "0xee122609e06747e0869210b941451ee5699eb46243273c2cd1ba82ecbaa780dc",
            "transactionIndex": 0,
            "logIndex": 0,
            "transactionLogIndex": "0x0",
            "id": "log_f304c4a1"
        }
    ],
    "root": null,
    "logsBloom": "0x00000000000000000008000000000000000000000000200000000000000000000000000000800000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000",
    "errorMessage": null
}

nativeBalance

ladder-cli abos nativeBalance -a 0xd573CaDe061a4A6E602F30931181805785B9505f -e
  • -l: The rpc of abos chain.
  • -a: The account on abos chain.
  • -e: From wei to ether.

return

6.344577197012590132 ether

anchorBalance

ladder-cli abos anchorBalance -e
  • -l: The rpc of abos chain.
  • -e: From wei to ether.

return

9993.655422802987258219 ether

KOVAN

deposit

ladder-cli kovan deposit -k 0x5557557a1029a773baabca1c79c61a45835310e7f2e9ccbe0653091c7502d7ad -b 0xe26792c40fcafc1b31869cc1f78a4a19c01ca1af6dfe742f8524fb74058c7f01 -v 1
  • -l(option): The rpc of kovan chain.
  • -k: The private key.
  • -c(option): The smart contract of brank depolyed in kovan chain.
  • -b: The beneficiary on ladder chain. it is public key format with 64 length.
  • -v: You deposit value in ether. return
{
    "blockHash": "0x352d5f605bcaf039cfe32999be04ccd3f4a2e93bdb1da92845734ff0a8c2c3a6",
    "blockNumber": 11358395,
    "contractAddress": null,
    "cumulativeGasUsed": 46185,
    "from": "0xd573CaDe061a4A6E602F30931181805785B9505f",
    "gasUsed": 46185,
    "logs": [
        {
            "address": "0x977ED18c2DcEaBeCd3b601cEB231d26A8B0aE601",
            "blockHash": "0x352d5f605bcaf039cfe32999be04ccd3f4a2e93bdb1da92845734ff0a8c2c3a6",
            "blockNumber": 11358395,
            "data": "0x000000000000000000000000d573cade061a4a6e602f30931181805785b9505fe26792c40fcafc1b31869cc1f78a4a19c01ca1af6dfe742f8524fb74058c7f010000000000000000000000000000000000000000000000000de0b6b3a7640000",
            "logIndex": 0,
            "removed": false,
            "topics": [
                "0x19dacbf83c5de6658e14cbf7bcae5c15eca2eedecf1c66fbca928e4d351bea0f"
            ],
            "transactionHash": "0x8b43198593747a1910f45a3d678ca09702de29a99aef6444394537618dfbcc04",
            "transactionIndex": 0,
            "transactionLogIndex": "0x0",
            "type": "mined",
            "id": "log_0xbe32c8555ffd0c25e8741067b0bb49552437537931bd22edbadfc50886e87f1d"
        }
    ],
    "logsBloom": "0x00000000000000000000000000000000000004000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000200000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "root": null,
    "status": true,
    "to": "0x977ED18c2DcEaBeCd3b601cEB231d26A8B0aE601",
    "transactionHash": "0x8b43198593747a1910f45a3d678ca09702de29a99aef6444394537618dfbcc04",
    "transactionIndex": 0
}

withdraw

ladder-cli kovan withdraw -k 0x5557557a1029a773baabca1c79c61a45835310e7f2e9ccbe0653091c7502d7ad -b 0xe26792c40fcafc1b31869cc1f78a4a19c01ca1af6dfe742f8524fb74058c7f01 -v 1
  • -l(option): The rpc of kovan chain.
  • -k: The private key.
  • -c(option): The smart contract in kovan chain.
  • -b: The beneficiary on ladder chain. it is public key format with 64 length.
  • -v: You withdraw value in ether.

return

{
    "blockHash": "0xede985bcc98fff0faba470e9599bdb8987b38831644cd943ce0f961e1e15d5dd",
    "blockNumber": 11359784,
    "contractAddress": null,
    "cumulativeGasUsed": 24902,
    "from": "0xd573CaDe061a4A6E602F30931181805785B9505f",
    "gasUsed": 24902,
    "logs": [
        {
            "address": "0x977ED18c2DcEaBeCd3b601cEB231d26A8B0aE601",
            "blockHash": "0xede985bcc98fff0faba470e9599bdb8987b38831644cd943ce0f961e1e15d5dd",
            "blockNumber": 11359784,
            "data": "0x000000000000000000000000d573cade061a4a6e602f30931181805785b9505fe26792c40fcafc1b31869cc1f78a4a19c01ca1af6dfe742f8524fb74058c7f010000000000000000000000000000000000000000000000000de0b6b3a7640000",
            "logIndex": 0,
            "removed": false,
            "topics": [
                "0xc3ded2be7db21b1af963f267d27750e4a15f174547d88b886b9bda43e2c6fa32"
            ],
            "transactionHash": "0x48d75e8b6b1d5269d297854a0db3a5d0e9be4e6cb49519c12077422f42320512",
            "transactionIndex": 0,
            "transactionLogIndex": "0x0",
            "type": "mined",
            "id": "log_0xcd425bd744fde06057a768b513f32acae6d09decc5e9deb7c85fa1c59815533b"
        }
    ],
    "logsBloom": "0x00000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000008",
    "root": null,
    "status": true,
    "to": "0x977ED18c2DcEaBeCd3b601cEB231d26A8B0aE601",
    "transactionHash": "0x48d75e8b6b1d5269d297854a0db3a5d0e9be4e6cb49519c12077422f42320512",
    "transactionIndex": 0
}

depositBalance

ladder-cli kovan depositBalance -a 0xd573CaDe061a4A6E602F30931181805785B9505f -b 0xe26792c40fcafc1b31869cc1f78a4a19c01ca1af6dfe742f8524fb74058c7f01 -e
  • -l(option): The rpc of kovan chain.
  • -c(option): The smart contract in kovan chain.
  • -a: The deposit account on the chain
  • -b: The beneficiary on ladder chain. it is public key format with 64 length.
  • -e: From wei to ether return
1 ether

crossTransfer

ladder-cli kovan crossTransfer -k 0x5557557a1029a773baabca1c79c61a45835310e7f2e9ccbe0653091c7502d7ad -t abos -r 0xd573CaDe061a4A6E602F30931181805785B9505f -v 0.1
  • -l: The rpc of kovan chain.
  • -k: The private key.
  • -c(option): The smart contract that depolyed in kovan chain.
  • -t: The coin you want to convert, abos or kovan.
  • -r: The recipient address on tag chain.
  • -v: You transfer value in ether. return
{
    "blockHash": "0x2852f8aaabeeb621427ceea93d83649f514414301b09d59f37995932b0ab47df",
    "blockNumber": 11379339,
    "contractAddress": null,
    "cumulativeGasUsed": 25143,
    "from": "0xd573CaDe061a4A6E602F30931181805785B9505f",
    "gasUsed": 25143,
    "logs": [
        {
            "address": "0x977ED18c2DcEaBeCd3b601cEB231d26A8B0aE601",
            "blockHash": "0x2852f8aaabeeb621427ceea93d83649f514414301b09d59f37995932b0ab47df",
            "blockNumber": 11379339,
            "data": "0x0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000d573cade061a4a6e602f30931181805785b9505f000000000000000000000000d573cade061a4a6e602f30931181805785b9505f000000000000000000000000000000000000000000000000016345785d8a0000",
            "logIndex": 0,
            "removed": false,
            "topics": [
                "0x2805de6a4a634b2ab3b38349f3909c711217f384c1c4e4bfa32a0cac0c1d4c3a"
            ],
            "transactionHash": "0x47a8fb3e539d5d812448f53395a3149c439d1c485f87f1025316315e7bc5d74f",
            "transactionIndex": 0,
            "transactionLogIndex": "0x0",
            "type": "mined",
            "id": "log_0xb571f431f36e216a011b1fafdad9a9655d113aa056b40eec17fcb3ff97d1bf01"
        }
    ],
    "logsBloom": "0x00000000000000000008000000000000000000000000000040000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "root": null,
    "status": true,
    "to": "0x977ED18c2DcEaBeCd3b601cEB231d26A8B0aE601",
    "transactionHash": "0x47a8fb3e539d5d812448f53395a3149c439d1c485f87f1025316315e7bc5d74f",
    "transactionIndex": 0
}

nativeBalance

ladder-cli kovan nativeBalance -a 0xd573CaDe061a4A6E602F30931181805785B9505f -e
  • -l: The rpc of abos chain.
  • -a: The account on abos chain.
  • -e: From wei to ether.

return

2.501188387250137606 ether

Ladder

nativeTransfer

ladder-cli ladder nativeTransfer  -k 0x98dcc02c6574a51871860ae6123642a8470836a13edeb8860edd84169bf9e05f -a 5E4CCLsJ3P1UBXgRdzFEQivMMJEqfg3VBj1tpvx8dsJa2FxQ -v 200000000
  • -l: The rpc of ladder chain.
  • -k: The private key.
  • -a: The recipient in ladder format.
  • -v: Transfer value in millicents

return

{"ApplyExtrinsic":2}: balances.Transfer["5Fo3CMAZ4g54iAaiuiPjcGMRSCbtXm9XzWL55UQ6gtSeVr4y","5E4CCLsJ3P1UBXgRdzFEQivMMJEqfg3VBj1tpvx8dsJa2FxQ",200000000,1000000]      {"ApplyExtrinsic":2}: system.ExtrinsicSuccess[]

nativeBalance

ladder-cli ladder nativeBalance -a 5Fo3CMAZ4g54iAaiuiPjcGMRSCbtXm9XzWL55UQ6gtSeVr4y
  • -l: The rpc of ladder chain.
  • -a: The user address in ladder format.

return

1593180000

receiveReward

ladder-cli ladder receiveReward -k 0x5557557a1029a773baabca1c79c61a45835310e7f2e9ccbe0653091c7502d7ad -a 5HBZSsJ25dF76urtRgYDgnqhwP9nLuLgBWAYrR3spe337b6g
  • -l: The rpc of ladder chain.
  • -k: The private key.
  • -a: The recipient in ladder format.

return

{"ApplyExtrinsic":2}: system.ExtrinsicSuccess[]

depositTotal

ladder-cli ladder depositTotal -t kovan
  • -l: The rpc of ladder chain.
  • -t: The coin you want to query. abos or kovan return
0

depositReward

ladder-cli ladder depositReward -a 5HBZSsJ25dF76urtRgYDgnqhwP9nLuLgBWAYrR3spe337b6g
  • -l: The rpc of ladder chain.
  • -a: The address you query.

return

283000

depositBalance

The result is consistent with your query on the edge chain, if not in case.

ladder-cli ladder depositBalance -a 0xe26792c40fcafc1b31869cc1f78a4a19c01ca1af6dfe742f8524fb74058c7f01 -t kovan
  • -l: The rpc of ladder chain.
  • -a: The beneficiary you deposit coin on side chain.
  • -t: The short name of side chain. return
10000

depositAccounts

ladder-cli ladder depositAccounts

return

[ '5EiCdMKvgNEaE7ZZwTKckqVMNKCnKxmDBdBr2o3TuzAQv9fW',
  '5HBZSsJ25dF76urtRgYDgnqhwP9nLuLgBWAYrR3spe337b6g' ]

coinPrice

ladder-cli ladder coinPrice -t kovan

return

5536654282

coinRate

ladder-cli ladder coinPrice -t kovan:abos

return

31.873508353221958

Readme

Keywords

none

Package Sidebar

Install

npm i ladder-cli

Weekly Downloads

1

Version

0.2.1

License

ISC

Unpacked Size

136 kB

Total Files

20

Last publish

Collaborators

  • kayryu