Giter VIP home page Giter VIP logo

ever-cli's People

Contributors

a-zorina avatar alexeyvavilin avatar amphyby avatar ar-tmp avatar aslanin avatar asnov avatar atomxy avatar borisi avatar bvscd avatar cryshado avatar d3p avatar darksquirrelcomes avatar elasticlove1 avatar futurizt avatar igorkoval avatar ilyar avatar joydark avatar keshoid avatar mikhailushakoff avatar mskvortsov avatar sehor05 avatar silkovalexander avatar sumrachek avatar tonjen avatar yaroslavser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ever-cli's Issues

Decode body issue for external out messages bodies

  • Install Docker >= 19.x
  • Install the latest tonos-cli (0.35.4)
  • brew install jq (for Mac)
  • Run the following commands sequence:
docker run -d --name local-node -e USER_AGREEMENT=yes -p80:80 tonlabs/local-node
git clone https://github.com/alinaT95/DecodyBodyIssue
cd DecodyBodyIssue
tonos-cli getkeypair -o key.json
output=`tonos-cli -j genaddr --setkey key.json 1_Accumulator.tvc --abi 1_Accumulator.abi.json --save --wc 0`
echo $output
{
  "raw_address": "0:12d54c354a3421568fca88297cdc8928dc63084d5c61e96ae8638ec8eeba38de",
  "testnet": {
    "non-bounceable": "0QAS1Uw1SjQhVo_KiCl83Iko3GMITVxh6WroY47I7ro43iqe",
    "bounceable": "kQAS1Uw1SjQhVo_KiCl83Iko3GMITVxh6WroY47I7ro43ndb"
  },
  "mainnet": {
    "non-bounceable": "UQAS1Uw1SjQhVo_KiCl83Iko3GMITVxh6WroY47I7ro43pEU",
    "bounceable": "EQAS1Uw1SjQhVo_KiCl83Iko3GMITVxh6WroY47I7ro43szR"
  }
}
json=${output#*data:}
addr=$(echo "$json" | jq -r '.raw_address')
echo $addr
0:12d54c354a3421568fca88297cdc8928dc63084d5c61e96ae8638ec8eeba38de
tonos-cli call  --abi ./local_giver.abi.json 0:ece57bcc6c530283becbbd8a3b24d3c5987cdddc3c8b7b33be6e4a6312490415 sendTransaction "{\"dest\":\"${addr}\", \"value\":\"10000000000000\",\"bounce\":\"false\",\"allBalance\":\"false\",\"payload\":\"\"}" --sign ./local_giver.keys.json
tonos-cli deploy --wc 0 --abi 1_Accumulator.abi.json 1_Accumulator.tvc {} --sign key.json
tonos-cli -j call  --abi 1_Accumulator.abi.json $addr add_1 '{"value":"101"}' --sign key.json
output=`tonos-cli -j query-raw messages --filter "{\"src\": { \"eq\":\"${addr}\"}}" --limit 1 " id created_at created_at_string msg_type_name body boc"  --order '[{"path":"created_at", "direction":"DESC"}]'`
echo $output
[
  {
    "id": "dd0bb15d5a0d4c2f77925b57a2425baf5d9a62776c81b4b09a5ccf68f08f6c6a",
    "created_at": 1689322540,
    "created_at_string": "2023-07-14 08:15:40.000",
    "msg_type_name": "ExtOut",
    "body": "te6ccgEBAQEAJgAASGRn/xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZw==",
    "boc": "te6ccgEBAQEAVQAApeAAlqphqlGhCrR+VEFL5uRJRuMYQmrjD0tXQxx2R3XRxvAAAAAAAAAtbsliCFgyM/+IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADPA"
  }
]
json=${output#*data:}
msg=$(echo "$json" | jq -r '.[0]')
echo $msg
{
    "id": "dd0bb15d5a0d4c2f77925b57a2425baf5d9a62776c81b4b09a5ccf68f08f6c6a",
    "created_at": 1689322540,
    "created_at_string": "2023-07-14 08:15:40.000",
    "msg_type_name": "ExtOut",
    "body": "te6ccgEBAQEAJgAASGRn/xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZw==",
    "boc": "te6ccgEBAQEAVQAApeAAlqphqlGhCrR+VEFL5uRJRuMYQmrjD0tXQxx2R3XRxvAAAAAAAAAtbsliCFgyM/+IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADPA"
  }
boc=$(echo "$msg" | jq -r '.boc')
echo $boc
te6ccgEBAQEAVQAApeAAlqphqlGhCrR+VEFL5uRJRuMYQmrjD0tXQxx2R3XRxvAAAAAAAAAtbsliCFgyM/+IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADPA
output=`tonos-cli -j decode msg --abi 1_Accumulator.abi.json "$boc"`
echo $output
{
  "Type": "external outbound message",
  "Header": {
    "source": "0:f12ffdc23e0c9eb907a3e6cd1dc766b932033cf41f50af603d88efd33e9e5bb5",
    "destination": "",
    "created_lt": "5824",
    "created_at": "1689325480"
  },
  "Body": "te6ccgEBAQEAJgAASGRn/xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZw==",
  "BodyCall": {
    "TryEvent": {
      "summ": "0x0000000000000000000000000000000000000000000000000000000000000067"
    }
  }
}
json=${output#*data:}
body=$(echo "$json" | jq -r '.Body')
echo $body
te6ccgEBAQEAJgAASGRn/xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZw==
tonos-cli -j decode body  --abi 1_Accumulator.abi.json "$body"
{
  "Error": "Failed to decode header: Deserialization error Not enough remaining bits in the cell: data: 258..288, references: 0..0, data slice:0000019c, cell:bits: 288   refs: 0   data: 6467ff100000000000000000000000000000000000000000000000000000000000000067\n"
}

Notes:

  • In previous script add_1 method of contract was called. It emits event TryEvent that produces an issue, if we try to decode the corresponding body of external out message. But if you call add_2 method instead (tonos-cli_newww/tonos-cli/target/release/tonos-cli -j call --abi 1_Accumulator.abi.json $addr add_2 '{"value":"101"}' --sign key.json), it will be ok in the end. And one gets the following output. So it looks like decode body command work is unstable?
tonos-cli -j decode body  --abi 1_Accumulator.abi.json "$body"
{
  "BodyCall": {
    "TryEvent_1": {
      "summ": "0x00000000000000000000000000000000000000000000000000000000000000cc"
    }
  },
  "Signature": "None",
  "Header": null,
  "FunctionId": "00000000"
}
  • If recompile contract without pubkey pragma, then this issue can not be reproduced. Then both bodies are decoded for those contract.

Bug: `tonos-cli depool events -w` always gives Error: failed to query event: WaitFor failed: wait_for operation did not return anything during the specified timeout

I'm using tonos-cli depool events -w to listen DePool events.
When a new event arrives, I get the following error regardless of the amount of time I've been waiting for:

Error: failed to query event: WaitFor failed: wait_for operation did not return anything during the specified timeout
Error: 1

This error appears even the event arrives during 3 seconds I've run the waiting command. This was not the case in tonos-cli 0.1.29. Now I have

tonos_cli 0.2.0
COMMIT_ID: acdabec127e19b2c91781439178d6d683f3a926a
BUILD_DATE: 2021-01-04 18:03:43 -0300
COMMIT_DATE: 2021-01-04 17:30:41 -0300
GIT_BRANCH: master

tonos-cli truncates leading zeros when issuing the result of getCustodians

I'm using

tonos-cli --url main.ton.dev run 0:ebaa9810c3bd1fb7f02901509735ac287362b741e9e874ea2a36f94351e2c255 getCustodians '{}' --abi ../configs/SafeMultisigWallet.abi.json

It gives me:

"custodians": [
    {
      "index": "0x1",
      "pubkey": "0xf07a7cb924c7420520d0d98afad87d9b5e1765920fda698c22da6d0cd3354b9"
    },
    {
      "index": "0x6",
      "pubkey": "0x1a99622e54b4e87d603dd87c9cc936b388b2a0e1979bb56d4039cfad0fbadc8c"
    },

As you can see pubkey with index 0x01 has 63 characters instead of 64. The leading zero was cutted out.
At the same time Public Key was entered correctly in the command to create this SafeMultisigWallet. Please, check the screenshot bellow:

image

How to run tests

I was trying to run tests for the current version:

mkdir test
cd test
git clone --recurse-submodules [email protected]:tonlabs/tonos-cli.git
cd tonos-cli
git checkout v0.1.25
docker rm --force ton-node
docker run --name ton-node --publish 80:80 --detach tonlabs/local-node
cargo test

Tests fail as they should?
Or am I doing what is wrong?

Out:

   Compiling tonos-cli v0.1.25 (/home/ilyar/code/tonlabs/tonos-cli/test/tonos-cli)
    Finished test [unoptimized + debuginfo] target(s) in 5.24s
     Running target/debug/deps/tonos_cli-8818e366e3d3d44e

running 6 tests
test debot::term_browser::browser_tests::load_key_from_file ... ok
test decode::tests::test_decode_msg_json ... ok
test decode::tests::test_decode_body_json ... ok
test crypto::tests::test_invalid_mnemonic ... ok
test debot::term_browser::browser_tests::load_key_from_seed ... ok
test crypto::tests::test_generate_keypair ... ok

test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/cli-c58efccea3a6e55d

running 18 tests
test test_decode_body ... ok
test test_decode_msg ... ok
test test_account_doesnt_exist ... ok
test test_account_command ... FAILED
test test_genaddr_setkey ... ok
test test_config ... ok
test test_override_config_path ... ok
test test_decode_body_constructor_for_minus_workchain ... ok
test test_getkeypair ... ok
test test_genaddr_genkey ... ok
test test_genaddr_initdata ... ok
test test_genaddr ... ok
test test_nodeid ... ok
test test_genaddr_wc ... ok
test test_sendfile ... ok
test test_call_giver ... ok
test test_deploy ... ok
test test_callex ... ok

Support empty Public Keys when deploying

Deployment using SDK allows using empty PK (https://github.com/tonlabs/TON-SDK/blob/master/docs/mod_abi.md#DeploySet field initial_pubkey), and it emulates the same behavior as deploying contract from a contract.

Deploying using tonos-cli forces the insertion of a PK that was used to sign a message, thus contract data is altered and deployment address is changed.

Can this feature be added to tonos-cli too? i.e. specifying custom initial PK to insert into contract dufing deployment.

Thank you.

build error on ton_client

macOS 10.13.6
tonos-cli 0.3.0

error: reached the type-length limit while instantiating tokio::loom::std::unsafe_cell::U...<T, S>::dealloc::{{closure}}#1]>
--> /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/loom/std/unsafe_cell.rs:13:5
|
13 | / pub(crate) fn with_mut(&self, f: impl FnOnce(*mut T) -> R) -> R {
14 | | f(self.0.get())
15 | | }
| |_____^
|
= note: consider adding a #![type_length_limit="1149087"] attribute to your crate

error: aborting due to previous error

error: could not compile ton_client.

Error at debot fetch command

Hi.
I've got an error at command -
tonos-cli debot fetch 0:5d1ca0ead13e6a4994074d2aaaee64ae925cc94858467bb2170de972a1835435

Error is:
debash$ failed to read line: Resource temporarily unavailable (os error 11)

OS - Linux
tonos-cli 0.2.0
"url": "https://net.ton.dev"

From the same host tonos-cli 0.1.29 works fine with the same command
Thanks.

tonos-cli arguments and config

Writing scripts, automating the execution of tonos-cli I encountered a problem - not all parameters, allowed to set in config (./tonlabs-cli.conf.json) can be set from command line, for example --url "https://main.ton.dev"

Also - not all parameters from command line (for example address) cannot be transparently set in ./tonlabs-cli.conf.json (in command line we use full address -1:XXXXXX..., while in ./tonlabs-cli.conf.json we need to use separately workchain and address (keys wc and addr).

What behaviour I expect:

  1. If I set everything in ./tonlabs-cli.conf.json I want to use it like ./tonos-cli run getTransactions '{}' without address, url, abi and keys totally

  2. If I don't want to use config I need the ability to set EVERY parameter in command line, including url like ./tonos-cli run --url "https://main.ton.dev" --abi "SafeMultisigwallet.abi.json" --keys "./mysecret.keys.json" -1:ab1f1e8daf784ba59d9ae6266bbadda7a0b63a1d5d38eed5c9a11161861eb1cd getTransactionIds '{}'

P.S. Maybe it's good to name every parameter, including address, method, and params to avoid any wrong readings in automating tasks with tonos-cli, like ./tonos-cli run --url "https://main.ton.dev" --abi "SafeMultisigwallet.abi.json" --keys "./mysecret.keys.json" --address "-1:ab1f1e8daf784ba59d9ae6266bbadda7a0b63a1d5d38eed5c9a11161861eb1cd" --method getTransactionIds --params '{}' but I'm not sure.

tonos-cli ignores quotation marks on windows

It seems like in windows (both powershell and cmd), tonos-cli ignores quotation marks.
For example if you use json for deploy args: '{"param":"value"}', tonos-cli will read '{param: value}' and would obviously fail to decode the json.

Minimal reproducible example:
tonos-cli account '{"a":"b"}'

Output in ubuntu:


Input arguments:
 address: {"a":"b"}

Output in windows:

Config: default
Input arguments:
 address: '{a:b}'

As you can see, on windows, the quotation marks are just gone. Moreover the single quotes were left as they were..
I suspect this is actually a problem with clap's parsing, what do you think?

Failed to set initial data: Invalid version: Provided ABI version is not supported (2.3)

Create key pair

tonos-cli getkeypair alice.json "can any ask question test test test test test test test test"

Code

pragma ever-solidity >= 0.64.0;
abstract contract Nonce {
    uint public static _nonce;
}
contract Foo is Nonce {}

Compile

https://github.com/EverscaleGuild/ever-solidity/releases/tag/0.66.0

sold -V
sold 0.66.0+commit.ce436293.mod.Linux.g++
sold Foo.sol

Calculate address

tonos-cli genaddr --setkey alice.json Foo.tvc Foo.abi.json --data '{"_nonce": 0}'
Config: default
Input arguments:
     tvc: Foo.tvc
      wc: None
    keys: alice.json
init_data: {"_nonce": 0}
is_update_tvc: None
Error: cannot generate address: Invalid TVC image: Failed to set initial data: Invalid version: Provided ABI version is not supported (2.3)
Error: 1

Note

for solc v 0.64.0 all ok

tonos-cli message does not access address as first argument

Bug

When executing tonos-cli message <wc_-1_addr>... the -1 of a non workchain -1 address is interpreted as flag. We can work around this with by ensuring all flags are moved the beginning of the command, and using -- before the -1 to escape the flag - however, I believe this can be resolved with a single line change.

Insert a new line before Line 151 of main.rs, with the following code:

(@setting AllowLeadingHyphen)

I would happily create a PR, but due to another issue, I am currently unable to compile tonos-cli to test :)

Add flag for pure JSON output

Feature Request

As a: validator operator
I want: Calls to tonos-cli to optionally be returned as pure json (see example)
So that: I am better able to integrate tooling without having to grep responses for what I need (which is inherently error prone).

Example

Current:

# tonos-cli account -1:f5f8cd98d0cf32f5f5d3551cb2af0aedc3fcbed3bfefce67ef75dcfaf30738ce
Input arguments:
 address: -1:f5f8cd98d0cf32f5f5d3551cb2af0aedc3fcbed3bfefce67ef75dcfaf30738ce
Processing...
Succeeded.
acc_type:      Active
balance:       217757762808213
last_paid:     1589369498
last_trans_lt: 0x2ebad4bdc6
data(boc): b5ee9c720101060100e40001d513b6de8914ea3f5cfe6837ea58e3bb90e63d7a78f81d5986a5bd45050e703e42000001720dcddaad89db6f448a751fae7f341bf52c71ddc8731ebd3c7c0eacc352dea28287381f21000000000000000000000000000000000000000000000000000000000000000001813001020148050202014804030043bf1702f807b0b5595945ec8da0a74acc3c3ba91c3fd848ea005549a01ef8ef0efc0a0043bf0f28adefe3af322fff34346c54e520be31e6a1644f35bc5d8aae3ef14ab532dc060044bf93b6de8914ea3f5cfe6837ea58e3bb90e63d7a78f81d5986a5bd45050e703e4200

Desired:

# tonos-cli account -1:f5f8cd98d0cf32f5f5d3551cb2af0aedc3fcbed3bfefce67ef75dcfaf30738ce --output=json
{"acc_type": "Active", "balance": 217757762808213, "last_paid": 1589369498, "last_trans_lt": 0x2ebad4bdc6, "data": "b5ee9c720101060100e40001d513b6de8914ea3f5cfe6837ea58e3bb90e63d7a78f81d5986a5bd45050e703e42000001720dcddaad89db6f448a751fae7f341bf52c71ddc8731ebd3c7c0eacc352dea28287381f21000000000000000000000000000000000000000000000000000000000000000001813001020148050202014804030043bf1702f807b0b5595945ec8da0a74acc3c3ba91c3fd848ea005549a01ef8ef0efc0a0043bf0f28adefe3af322fff34346c54e520be31e6a1644f35bc5d8aae3ef14ab532dc060044bf93b6de8914ea3f5cfe6837ea58e3bb90e63d7a78f81d5986a5bd45050e703e4200"}

Failed to set logger call_contractaddr_reset.log: attempted to set a logger after the logging system was already initialized

  • Install Docker >= 19.x
  • Install the latest tonos-cli (0.35.4)
  • Run the following commands sequence:
docker run -d --name local-node -e USER_AGREEMENT=yes -p80:80 tonlabs/local-node
git clone https://github.com/alinaT95/TonoscliLoggerIssue
cd TonoscliLoggerIssue
tonos-cli getkeypair -o key.json
tonos-cli genaddr --setkey key.json 1_Accumulator.tvc --abi 1_Accumulator.abi.json --save --wc 0

Output:
{
  "raw_address": "0:5464926c6980c3861dceed1339b78054bfa6410a62e993800cde49d3e488b878",
  "testnet": {
    "non-bounceable": "0QAH93ZfsgB3DH1Pj7EdfySLD4xqpnyimXdEq6lMEYmXRsK2",
    "bounceable": "kQAH93ZfsgB3DH1Pj7EdfySLD4xqpnyimXdEq6lMEYmXRp9z"
  },
  "mainnet": {
    "non-bounceable": "UQAH93ZfsgB3DH1Pj7EdfySLD4xqpnyimXdEq6lMEYmXRnk8",
    "bounceable": "EQAH93ZfsgB3DH1Pj7EdfySLD4xqpnyimXdEq6lMEYmXRiT5"
  }
}
tonos-cli call  --abi ./local_giver.abi.json 0:ece57bcc6c530283becbbd8a3b24d3c5987cdddc3c8b7b33be6e4a6312490415 sendTransaction '{"dest":"0:5464926c6980c3861dceed1339b78054bfa6410a62e993800cde49d3e488b878","value":"1500000000","bounce":"false","allBalance":"false","payload":""}' --sign ./local_giver.keys.json 
tonos-cli deploy --wc 0 --abi 1_Accumulator.abi.json 1_Accumulator.tvc {} --sign key.json
tonos-cli -j call  --abi 1_Accumulator.abi.json 0:5464926c6980c3861dceed1339b78054bfa6410a62e993800cde49d3e488b878 reset '{}' --sign key.json

 {
  "Error": {
    "code": 414,
    "message": "Contract execution was terminated with error: Compute phase isn't succeeded, exit code: 788.\nPossible reason: Contract did not accept message.\nTip: For more information about exit code check the contract source code or ask the contract developer",
    "data": {
      "core_version": "1.42.1",
      "phase": "computeVm",
      "exit_code": 788,
      "exit_arg": "0",
      "account_address": "0:5464926c6980c3861dceed1339b78054bfa6410a62e993800cde49d3e488b878",
      "gas_used": 0,
      "contract_error": null,
      "config_servers": [
        "http://0.0.0.0",
        "http://127.0.0.1",
        "http://localhost"
      ],
      "query_url": "http://0.0.0.0/graphql",
      "query_ip_address": "127.0.0.1:80",
      "transaction_id": "b3dbca7f83ab01df24c8d5d82c83810bf6e1438448f84c7e6ed846913056a882"
    }
  }
}
{
  "Error": "Failed to set logger call_0:5464926c6980c3861dceed1339b78054bfa6410a62e993800cde49d3e488b878_reset.log: attempted to set a logger after the logging system was already initialized"
}

Notes:

  • Version of compiler used is 0.69.0+commit.3f1a3763.mod.Darwin.appleclang.
  • tonos-cli genaddr generates new raw address, don't forget to replace dest contract address in below commands.
  • Check "debug_fail": "Full" is set in tonos-cli.conf.json.

crash on tonos-cli run

root@rnode:/ton-node/tools# ./tonos-cli version
Config: /ton-node/tools/tonos-cli.conf.json
tonos-cli 0.2.1
COMMIT_ID: 1e7d9fe
BUILD_DATE: 2021-01-25 21:45:21 +0000
COMMIT_DATE: 2021-01-25 22:08:42 +0300
GIT_BRANCH: update_last_depool
root@rnode:/ton-node/tools# /ton-node/tools/tonos-cli run -1:3333333333333333333333333333333333333333333333333333333333333333 compute_returned_stake '{"wallet_addr":"0x"}' --abi /ton-node/configs/Elector.abi.json
Config: /ton-node/tools/tonos-cli.conf.json
Input arguments:
address: -1:3333333333333333333333333333333333333333333333333333333333333333
method: compute_returned_stake
params: {"wallet_addr":"0x"}
abi: /ton-node/configs/Elector.abi.json
keys: None
lifetime: None
output: None
Connecting to "https://rustnet.ton.dev"
Generating external inbound message...

MessageId: 4b6c59e74d7ea6287630051b251805867a7611b3582b234534e19b19b6948342
Expire at: unknown
Running get-method...
thread 'main' panicked at 'a parsed Url should always be a valid Uri: InvalidUri(InvalidUriChar)', /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.10.10/src/into_url.rs:44:14

tonos-cli config path should be consistent

Instead of the current directory, tonlabs-cli.conf.json should be written to a consistent path for a given user of a given system. for example: ~/.tonos-cli/tonlabs-cli.conf.json so that tonos-cli can be run from any directory on the system and yield consistent results.

Similarly, .tvc and .abi files could live in a subdir of the same path to save referencing them on every call.

Y

Be

add "[--raw] [--output <msg_file>" to deploy & depool commands

I would like to ask you to add to tonos-cli's command "deploy" and "depool" the formation and output of messages to a file for sending separately, like in the "tonos-cli message .... [--raw] [--output <msg_file>]"
So that I will have possibility to send file via "tonos-cli sendfile <msg_file>" later

Sending local message: couldn't unpack message: Invalid character 't' at position 0

tonos-cli send gives error on next workflow:

$ tonos-cli genphrase
Config: /home/zelenin/Projects/udiar/free-ton-app/tonos-cli.conf.json
Succeeded.
Seed phrase: "canoe mutual culture fuel oil trade congress civil middle auction biology breeze"

$ tonos-cli getkeypair keyfile.json "canoe mutual culture fuel oil trade congress civil middle auction biology breeze"
Config: /home/zelenin/Projects/udiar/free-ton-app/tonos-cli.conf.json
Input arguments:
key_file: keyfile.json
  phrase: canoe mutual culture fuel oil trade congress civil middle auction biology breeze
Succeeded.

$ echo -n "qwe" | xxd -ps
717765

$ tonos-cli message \
>   --raw \
>   --output message.boc \
>   --abi ./sdk-samples/low-level/node-js/core-api/transfer-with-comment/transfer.abi.json `# abi контракта из примеров` \
>   --sign keyfile.json \
>   0:25938dfd4c4a9622acdb7180ac0774d61d161eb310403b6bb9506caeaba136da `# адрес взятый из ./sdk-samples/low-level/node-js/core-api/transfer-with-comment/index.js` \
>   transfer \
>   '{"comment":"717765"}' `# это слово "qwe"` \
>   --lifetime 3600
Config: /home/zelenin/Projects/udiar/free-ton-app/tonos-cli.conf.json
Input arguments:
 address: 0:25938dfd4c4a9622acdb7180ac0774d61d161eb310403b6bb9506caeaba136da
  method: transfer
  params: {"comment":"717765"}
     abi: ./sdk-samples/low-level/node-js/core-api/transfer-with-comment/transfer.abi.json
    keys: keyfile.json
lifetime: 3600
  output: message.boc
Generating external inbound message...

MessageId: 9f50ffec99bdf0ac6a1645fabb42f191ee225d2675e41185f17a9e5272f0792c
Expire at: Wed, 11 Aug 2021 16:05:45 +0300
Message saved to file message.boc

$ tonos-cli send \
>   --abi ./sdk-samples/low-level/node-js/core-api/transfer-with-comment/transfer.abi.json \
>   "`base64 -w 0 message.boc`"
Config: /home/zelenin/Projects/udiar/free-ton-app/tonos-cli.conf.json
Input arguments:
 message: te6ccgEBAgEAbwABzYgASycb+piVLEVZtuMBWA7prDosPWYggHbXcqDZXVdCbbQGYIig8Kv5Wd/WQ8Y+TLoADSj8+rCI07hseVz0rCIDsyZhk/Etly0r7JfoevtUhgEzHdLDBevHE9mKQGYv8HHsMAAAAAIBAAZxd2U=
     abi: ./sdk-samples/low-level/node-js/core-api/transfer-with-comment/transfer.abi.json
Connecting to https://net.ton.dev
Error: couldn't unpack message: Invalid character 't' at position 0
Error: 1

Environment:

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.2 LTS
Release:	20.04
Codename:	focal
$ node -v
v12.22.4
$ tonos-cli --version
tonos_cli 0.15.1
COMMIT_ID: f171bbf4319449b21ebe71a2532ec2e4415da8d0
BUILD_DATE: 2021-06-30 07:47:46 +0300
COMMIT_DATE: 2021-06-30 07:46:27 +0300
GIT_BRANCH: master

inner error recursion limit exceeded at line 1 column 29630

I noticed the issue which occurs in case participant list is big enough. More than 125 participants.
So, then you try to run something like:

tonos-cli --config ~/tonlabs-cli.conf.json runget -1:3333333333333333333333333333333333333333333333333333333333333333 participant_list_extended

You will have some part of output, but it will fail with the following error:

inner error recursion limit exceeded at line 1 column 29630
Error: 1

Please also find the version of tonos-cli was used:

tonos_cli 0.1.27
COMMIT_ID: 6881752
BUILD_DATE: 2020-11-27 14:26:44 +0100
COMMIT_DATE: 2020-11-24 16:50:35 +0300
GIT_BRANCH: master

genaddr ERROR. Can't generate wallet address. v 0.1.12 & 0.1.13

fresh build
genphrase & getkeypair is ok, but on genaddr I get error
./tonos-cli genaddr SafeMultisigWallet.tvc SafeMultisigWallet.abi.json --setkey xyz.keys.json
Config: default
Input arguments:
tvc: SafeMultisigWallet.tvc
wc: None
keys: xyz.keys.json
init_data: None
is_update_tvc: None
Error: failed to generate address: Inner SDK error.
core version: 0.25.0
source: client
code: 3003
message: Image creation failed: unknown BOC_TAG: 1013478509
message processing state: None data: null

Option '-j' does not proper work with getconfig command

$ tonos-cli -j getconfig 15
Input arguments:
   index: 15
Config p15: {
  "validators_elected_for": 10800,
  "elections_start_before": 5400,
  "elections_end_before": 1350,
  "stake_held_for": 5400
}

But it have to output pure json only

Add options to save account state to file

I would like to ask you to add to tonos-cli's possibility to save current state of account to file or output to console.
Something like
tonos-cli GetState <address> [--raw] [--output <path_to_file>]

It will logical addition to "4.4.5. Run contract method locally for saved account state"
tonos-cli run --boc [--abi <contract.abi.json>] <account> <method> <params>

The offline messages sending is not working

Issue description

There is the inconsistent packing/unpacking of "tonos-cli message" JSONs here in src/call.rs. And then the "offline transactions/messages" feature of tonos-cli is not working.

Steps to reproduce the issue

  1. Run tonos-cli message <wallet_address> submitTransaction '{"dest":"<wallet_address>","value":1000000000,"bounce":true,"allBalance":false,"payload":""}' --abi SafeMultisigWallet.abi.json --sign wallet-key.json --lifetime 3600 (as per the docs: https://docs.ton.dev/86757ecb2/p/94921e-multisignature-wallet-management-in-tonos-cli/t/364e69 "4.8. Create new transaction offline")
  2. Write down the encoded message body
  3. Run tonos-cli send --abi SafeMultisigWallet.abi.json '<message_body>' (as per the docs: https://docs.ton.dev/86757ecb2/p/94921e-multisignature-wallet-management-in-tonos-cli/t/364e69 "4.10. Broadcast previously generated message")

What's the expected result?

 message: <message_body>
     abi: SafeMultisigWallet.abi.json

MessageId: <message_id>
Expire at: <expiry_date>
Calling method submitTransaction with parameters:
{
  "allBalance": false,
  "bounce": true,
  "dest": "<wallet_address>",
  "payload": "te6ccgEBAQEAAgAAAA==",
  "value": "0x3b9aca00"
}
Processing... 
Succeded.
Result: {
  "transId": "0x0"
}

And the transaction message is sent to the network.

What's the actual result?

Input arguments:
 message: <message_body>
     abi: SafeMultisigWallet.abi.json
Connecting to https://net.ton.dev
Error: couldn't find "address" key in message
Error: 1

And the transaction message is not sent to the network.

Additional details

Please note the difference in pack_message: https://github.com/tonlabs/tonos-cli/blob/90c1385039dc08737c737341b2fef570a556f703/src/call.rs#L112-L119
And unpack_message: https://github.com/tonlabs/tonos-cli/blob/90c1385039dc08737c737341b2fef570a556f703/src/call.rs#L144-L145
unpack_message expects msg->address field in JSON here: https://github.com/tonlabs/tonos-cli/blob/90c1385039dc08737c737341b2fef570a556f703/src/call.rs#L144, while the pack_message method is not providing it.

This commit added the "address" JSON field packing/unpacking: 577d54b#diff-c5c022d135afc2c596bb0084c03b78ed
And this commit removed the packing, but there is unpacking left: 2ba9f08#diff-c5c022d135afc2c596bb0084c03b78ed

Please make a decision - whether you need this field or not :)

cyclic package dependency

error: cyclic package dependency: package `ahash v0.7.4` depends on itself. Cycle:
package `ahash v0.7.4`
    ... which is depended on by `hashbrown v0.11.2`
    ... which is depended on by `indexmap v1.7.0`
    ... which is depended on by `serde_json v1.0.68`
    ... which is depended on by `wasm-bindgen v0.2.78`
    ... which is depended on by `js-sys v0.3.55`
    ... which is depended on by `instant v0.1.10`
    ... which is depended on by `parking_lot v0.11.2`
    ... which is depended on by `once_cell v1.8.0`
    ... which is depended on by `ahash v0.7.4`

commit 42621a5333f24642e8e8779eb851f34aa51588ae error on build

git pull --recurse-submodules
$ git show
commit 42621a5 (HEAD -> master, origin/master, origin/HEAD)
Merge: 5eee991 8e35b83
Author: Sergei Voronezhskii [email protected]
Date: Wed May 19 07:45:51 2021 +0300
Merge pull request #163 from tonlabs/sdk-1.15.0-rc
Update to sdk 1.15.0

$ cargo update
Updating crates.io index
Updating git repository https://github.com/tonlabs/ton-labs-abi.git
Updating git repository https://github.com/tonlabs/ton-labs-block.git
Updating git repository https://github.com/tonlabs/TON-SDK.git
error: failed to get ton_client as a dependency of package tonos-cli v0.13.1 (/usr/home/svt/Rnode-scripts/tonos-cli)

Caused by:
failed to load source for dependency ton_client

Caused by:
Unable to update https://github.com/tonlabs/TON-SDK.git?branch=1.15.0-rc

Caused by:
failed to find branch 1.15.0-rc

Caused by:
cannot locate remote-tracking branch 'origin/1.15.0-rc'; class=Reference (4); code=NotFound (-3)

Fix json format out for active account

npx tonos-cli --json account 0:c3da3e141096b5bb518b3479b8fe36163c191e2aaffa5c603b85b62335c91201

Actual:

{
  "0:c3da3e141096b5bb518b3479b8fe36163c191e2aaffa5c603b85b62335c91201": {
    "acc_type": "Active",
    "address": "0:c3da3e141096b5bb518b3479b8fe36163c191e2aaffa5c603b85b62335c91201",
    "balance": "100000000000",
    "last_paid": "1644230193",
    "last_trans_lt": "0x15",
    "data(boc)": "b5ee9c720101020100980001dff869eb226d1d3eda3b9863e3121b66b351cbf8c6ce7f4fd4dba45901b97155d70000017ed3c1ae58fc34f591368e9f6d1dcc31f1890db359a8e5fc63673fa7ea6dd22c80dcb8aaeb80000000000000000000000000000000000000000000000000000000000000002020000000001018010045a01f0d3d644da3a7db47730c7c62436cd66a397f18d9cfe9fa9b748b20372e2abae010",
    "code_hash": "207dc560c5956de1a2c1479356f8f3ee70a59767db2bf4788b1d61ad42cdad82"
  }
}

Expect:

{
  "acc_type": "Active",
  "address": "0:c3da3e141096b5bb518b3479b8fe36163c191e2aaffa5c603b85b62335c91201",
  "balance": "100000000000",
  "last_paid": "1644230193",
  "last_trans_lt": "0x15",
  "data(boc)": "b5ee9c720101020100980001dff869eb226d1d3eda3b9863e3121b66b351cbf8c6ce7f4fd4dba45901b97155d70000017ed3c1ae58fc34f591368e9f6d1dcc31f1890db359a8e5fc63673fa7ea6dd22c80dcb8aaeb80000000000000000000000000000000000000000000000000000000000000002020000000001018010045a01f0d3d644da3a7db47730c7c62436cd66a397f18d9cfe9fa9b748b20372e2abae010",
  "code_hash": "207dc560c5956de1a2c1479356f8f3ee70a59767db2bf4788b1d61ad42cdad82"
}

Mtotivation:

npx tonos-cli --json account 0:c3da3e141096b5bb518b3479b8fe36163c191e2aaffa5c603b85b62335c91201 | jq .acc_type

error on build

Compiling ton_sdk v1.6.3 (https://github.com/tonlabs/TON-SDK.git#4d34e4d5)
error[E0599]: no function or associated item named get_pubkey found for struct ton_abi::Contract in the current scope
--> /home/ton/.cargo/git/checkouts/ton-sdk-11823a0ea1fdf592/4d34e4d/ton_sdk/src/contract.rs:143:25
|
143 | Ok(AbiContract::get_pubkey(data)?
| ^^^^^^^^^^ function or associated item not found in ton_abi::Contract

error[E0277]: the size for values of type [u8] cannot be known at compilation time
--> /home/ton/.cargo/git/checkouts/ton-sdk-11823a0ea1fdf592/4d34e4d/ton_sdk/src/contract.rs:144:19
|
144 | .map(|pub_key| PublicKey::from_bytes(&pub_key))
| ^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait Sized is not implemented for [u8]
= help: unsized locals are gated as an unstable feature
help: function arguments must have a statically known size, borrowed types always have a known size
|
144 | .map(|&pub_key| PublicKey::from_bytes(&pub_key))
| ^

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0277, E0599.
For more information about an error, try rustc --explain E0277.
error: could not compile ton_sdk

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

error: failed to run custom build command for `openssl-sys v0.9.58`

Compiling rand_hc v0.1.0
Compiling rand_isaac v0.1.1
Compiling rand_xorshift v0.1.1
Compiling rustc_version v0.2.3
error: failed to run custom build command for openssl-sys v0.9.58

Caused by:
process didn't exit successfully: /opt/tonos-cli/target/debug/build/openssl-sys-360e038eaf45f30d/build-script-main (exit code: 101)
--- stdout
cargo:rustc-cfg=const_fn
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_DIR
OPENSSL_DIR unset
run pkg_config fail: "\"pkg-config\" \"--libs\" \"--cflags\" \"openssl\" did not exit successfully: exit code: 1\n--- stderr\nPackage openssl was not found in the pkg-config search path.\nPerhaps you should add the directory containing `openssl.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'openssl' found\n"

--- stderr
thread 'main' panicked at '

Could not find directory of OpenSSL installation, and this -sys crate cannot
proceed without this knowledge. If OpenSSL is installed and this crate had
trouble finding it, you can set the OPENSSL_DIR environment variable for the
compilation process.

Make sure you also have the development packages of openssl installed.
For example, libssl-dev on Ubuntu or openssl-devel on Fedora.

If you're in a situation where you think the directory should be found
automatically, please open a bug at https://github.com/sfackler/rust-openssl
and include information about your system as well as this message.

$HOST = x86_64-unknown-linux-gnu
$TARGET = x86_64-unknown-linux-gnu
openssl-sys = 0.9.58

', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.58/build/find_normal.rs:157:5
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

warning: build failed, waiting for other jobs to finish...
error: build failed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.