ston-fi / tonlib-rs

Rust SDK for The Open Network
https://github.com/ston-fi/tonlib-rs
MIT License
195 stars 42 forks source link

How to disable annoying client request outputs #62

Closed oneforalone closed 5 months ago

oneforalone commented 5 months ago

I'm just testing with jetton, i.e. get jetton meta data via following codes:

use tonlib::address::TonAddress;
use tonlib::client::TonClient;
use tonlib::contract::JettonMasterContract;
use tonlib::contract::TonContractFactory;

use anyhow::Result;

#[tokio::main]
async fn main() -> Result<()> {
    let client = TonClient::builder().build().await?;
    let contract_factory = TonContractFactory::builder(&client).build().await?;
    // UP jetton
    let up_jetton = "EQCvaf0JMrv6BOvPpAgee08uQM_uRpUd__fhA7Nm8twzvbE_".parse()?;
    let oneforalone =
        TonAddress::from_base64_url("UQBJev-cGiUhjbDKAlJ56VoWy5JjCnYNmqVOMgYB1qkS0eiq")?;
    let master_contract = contract_factory.get_contract(&up_jetton);
    let wallet_address = master_contract.get_wallet_address(&oneforalone).await?;
    let wallet_state = client.get_account_state(&wallet_address).await?;
    let balance = wallet_state.balance;
    println!("{wallet_address:?}'s balance is {balance}");

    Ok(())
}

Got lots of client request and tvm tracing log, that's kinda annoying , is there any way to disable these output?


[ 4][t 0][2024-06-11 14:03:46.054509][Client.cpp:84][&tonlib_requests]  End to wait for updates, returning object 0 0x10ef040a0
[ 4][t 1][2024-06-11 14:03:46.054524][adnl-ext-connection.cpp:31][!outconn]     sending packet of size 136
[ 4][t 1][2024-06-11 14:03:46.054591][BufferedFd.h:216][!outconn]       Flush write: +204B[left:0B]
[ 4][t 0][2024-06-11 14:03:46.054610][Client.cpp:78][&tonlib_requests]  Begin to wait for updates with timeout 1.000000
[ 4][t 1][2024-06-11 14:03:46.520551][BufferedFd.h:207][!outconn]       Flush read: +16KB[total:16KB]
[ 4][t 1][2024-06-11 14:03:46.520643][adnl-ext-connection.cpp:80][!outconn]     len=42696
[ 4][t 1][2024-06-11 14:03:46.520770][BufferedFd.h:207][!outconn]       Flush read: +8520B[total:25KB]
[ 4][t 1][2024-06-11 14:03:46.521343][BufferedFd.h:207][!outconn]       Flush read: +11KB[total:37KB]
[ 4][t 1][2024-06-11 14:03:46.521701][BufferedFd.h:207][!outconn]       Flush read: +4740B[total:41KB]
[ 4][t 1][2024-06-11 14:03:46.521905][adnl-ext-connection.cpp:163][!outconn]    received packet of size 42696
[ 4][t 2][2024-06-11 14:03:46.522188][ExtClient.h:91][!LastBlock][&lite_server res.is_ok()]     got result from liteserver: 2804418368 liteServer_partialBlockProof {
  complete = true
  from = tonNode_blockIdExt {
    workchain = -1
    shard = -9223372036854775808
    seqno = 38301448
    root_hash = { 59 01 86 17 49 0C 61 CE D4 C7 26 E2 5A C0 CF AC 80 F7 2D AD 36 1F F9 4A B8 28 92 E5 30 F0 E0 0A }
    file_hash = { 01 63 51 A4 7D 9F EF 2D 0E 67 84 CA B1 FD 6D 89 A8 91 67 A1 00 A4 5C C8 ED DA B3 53 7B 19 E5 C2 }
  }
  to = tonNode_blockIdExt {
    workchain = -1
    shard = -9223372036854775808
    seqno = 38301487
    root_hash = { E1 F2 27 4A B0 12 CF 71 DD B0 3D 37 1D 02 04 90 BB 78 56 36 F6 91 22 72 4E C0 D2 BD 64 50 F5 5F }
    file_hash = { 68 68 9B 15 6F DB F4 45 AD 52 4B C1 08 75 D7 DE 02 1A 3F 92 17 90 7E 1E 0A BB 0A B8 69 20 5D 2B }
  }
  steps = vector[1] {
    liteServer_blockLinkForward {
      to_key_block = false
      from = tonNode_blockIdExt {
        workchain = -1
        shard = -9223372036854775808
        seqno = 38301448
        root_hash = { 59 01 86 17 49 0C 61 CE D4 C7 26 E2 5A C0 CF AC 80 F7 2D AD 36 1F F9 4A B8 28 92 E5 30 F0 E0 0A }
        file_hash = { 01 63 51 A4 7D 9F EF 2D 0E 67 84 CA B1 FD 6D 89 A8 91 67 A1 00 A4 5C C8 ED DA B3 53 7B 19 E5 C2 }
      }
      to = tonNode_blockIdExt {
        workchain = -1
        shard = -9223372036854775808
        seqno = 38301487
        root_hash = { E1 F2 27 4A B0 12 CF 71 DD B0 3D 37 1D 02 04 90 BB 78 56 36 F6 91 22 72 4E C0 D2 BD 64 50 F5 5F }
        file_hash = { 68 68 9B 15 6F DB F4 45 AD 52 4B C1 08 75 D7 DE 02 1A 3F 92 17 90 7E 1E 0A BB 0A B8 69 20 5D 2B }
      }
      dest_proof = bytes [339] { B5 EE 9C 72 01 02 07 01 00 01 47 00 09 46 03 E1 F2 27 4A B0 12 CF 71 DD B0 3D 37 1D 02 04 90 BB 78 56 36 F6 91 22 72 4E C0 D2 BD 64 50 F5 5F 00 16 01 24 10 11 EF 55 AA FF FF FF 11 02 03 04 05 ...}
      config_proof = bytes [32288] { B5 EE 9C 72 02 02 02 F2 00 01 00 00 7E 10 00 00 09 46 03 59 01 86 17 49 0C 61 CE D4 C7 26 E2 5A C0 CF AC 80 F7 2D AD 36 1F F9 4A B8 28 92 E5 30 F0 E0 0A 00 1A 00 01 24 10 11 EF 55 AA FF FF FF ...}
      signatures = liteServer_signatureSet {
        validator_set_hash = -842451326
        catchain_seqno = 573903
        signatures = vector[96] {
          liteServer_signature {
            node_id_short = { 1E 53 99 22 E4 BB 1C FC 1B F4 F3 20 18 0B 48 93 4A 2E D6 13 B3 47 F3 93 0F D2 0E F9 F9 D3 A8 82 }
            signature = bytes [64] { 1E BF E3 43 D1 21 56 25 37 9B B4 A0 72 66 B6 9B 6D E1 50 20 5D 7C E0 16 1F BA 45 B8 AA 49 8D 92 E3 46 D6 36 46 D3 B4 B1 1C 39 2E 43 6E 8D 78 7D 6B D8 62 24 28 E0 00 EE D8 38 51 8A B5 D8 C2 0C }
          }
          liteServer_signature {
            node_id_short = { 47 2A 4B F5 DE 65 23 7B F1 79 20 6D 5E B0 2F E3 6B 4C 5C 70 10 F9 7A A1 8B 7C AE 5E C3 E4 17 34 }
            signature = bytes [64] { 30 44 A5 5A B7 EE 83 01 3F 91 80 17 59 F6 25 6D 78 C0 9B E3 54 60 FB 6D CA EA 2B D9 01 FB 2E 74 A6 3E E4 1F F4 A2 90 0B A0 6C F4 36 99 0F 3D F8 6A 0B 7A F4 12 BC 0A 22 0C 21 90 27 D7 77 F0 0C }
          }
          liteServer_signature {
            node_id_short = { 5D BE DB 86 32 75 62 B4 60 47 F6 E2 77 E9 E0 13 BD A8 59 21 80 10 CA 1E 1A 37 9E 72 32 C6 3C 73 }
            signature = bytes [64] { 0A 39 C1 DD 1E C1 52 31 82 11 E1 A4 BD 05 34 A7 68 77 36 1D A7 5E 5B B5 CD E6 5E D6 21 40 02 03 6A 0D 8E 3A A0 A4 4E 65 0C 68 BD D6 A2 4A 54 DE AF 65 15 12 E4 A9 B7 84 11 BE 74 FF 22 28 7E 0E }
          }
          liteServer_signature {
            node_id_short = { 1D 48 B7 9F 69 CF 56 77 04 6D CC BE 99 D4 FF 7C 4A 94 83 A5 15 0C 6D 40 FB 5F 64 B3 73 55 6C 77 }
            signature = bytes [64] { B8 57 BF D3 16 23 E8 77 4D C5 D3 70 01 66 AB D4 FA AD 84 A4 F0 EA BD 3B 88 43 21 50 FF C5 B2 01 6B E6 7A DD 62 83 01 7A 51 1A 7D 0D F8 AF 66 14 EF F3 13 B1 DF 36 76 EA D7 98 4C 7D EB 08 C8 00 }
          }
          liteServer_signature {
            node_id_short = { 06 3B F4 9F 9C 2A E9 3D 43 92 1D F4 A2 42 92 DF 0A 92 9F EB 70 0A 9F 74 58 87 DC F3 C6 89 8D 25 }
            signature = bytes [64] { 30 22 66 98 A5 67 49 E4 20 B2 25 40 13 29 30 9D D9 0C 5F A0 94 94 71 F7 88 D1 D0 D4 F9 7D ED 83 A4 D0 69 99 CA 12 4B 1B 74 F7 1
[ 4][t 2][2024-06-11 14:03:46.522800][LastBlock.cpp:161][!LastBlock][&last_block]       Got proof FROM
tonNode_blockIdExt {
  workchain = -1
  shard = -9223372036854775808
  seqno = 38301448
  root_hash = { 59 01 86 17 49 0C 61 CE D4 C7 26 E2 5A C0 CF AC 80 F7 2D AD 36 1F F9 4A B8 28 92 E5 30 F0 E0 0A }
  file_hash = { 01 63 51 A4 7D 9F EF 2D 0E 67 84 CA B1 FD 6D 89 A8 91 67 A1 00 A4 5C C8 ED DA B3 53 7B 19 E5 C2 }
}
TO
tonNode_blockIdExt {
  workchain = -1
  shard = -9223372036854775808
  seqno = 38301487
  root_hash = { E1 F2 27 4A B0 12 CF 71 DD B0 3D 37 1D 02 04 90 BB 78 56 36 F6 91 22 72 4E C0 D2 BD 64 50 F5 5F }
  file_hash = { 68 68 9B 15 6F DB F4 45 AD 52 4B C1 08 75 D7 DE 02 1A 3F 92 17 90 7E 1E 0A BB 0A B8 69 20 5D 2B }
}
[ 4][t 2][2024-06-11 14:03:46.523629][lite-client-common.cpp:90][!LastBlock]    deserialized a forward BlkProofLink from (-1,8000000000000000,38301448):59018617490C61CED4C726E25AC0CFAC80F72DAD361FF94AB82892E530F0E00A:016351A47D9FEF2D0E6784CAB1FD6D89A89167A100A45CC8EDDAB3537B19E5C2 to (-1,8000000000000000,38301487):E1F2274AB012CF71DDB03D371D020490BB785636F69122724EC0D2BD6450F55F:68689B156FDBF445AD524BC10875D7DE021A3F9217907E1E0ABB0AB869205D2B with 96 signatures
[ 4][t 2][2024-06-11 14:03:46.523652][lite-client-common.cpp:94][!LastBlock]    deserialized a BlkProofChain of 1 links
[ 4][t 2][2024-06-11 14:03:46.547626][LastBlock.cpp:213][!LastBlock][&last_block]       get_last_block: done
   net queries: 1
   total: 493.2ms validation: 24.8ms
[ 4][t 2][2024-06-11 14:03:46.547657][LastBlock.cpp:361][!LastBlock][&last_block]       sync: ok [last_block:(-1,8000000000000000,38301991):F6256D1BCAB976E3352B0BB907ADB8CB1718C9CC63E0206689AF3E4819EDE1B0:2CAB751FEA507174953D832CA81F561A624DC4291044ADD2D8BB13E9E08190BF][last_key_block:(-1,8000000000000000,38301448):59018617490C61CED4C726E25AC0CFAC80F72DAD361FF94AB82892E530F0E00A:016351A47D9FEF2D0E6784CAB1FD6D89A89167A100A45CC8EDDAB3537B19E5C2][utime:1718114614][init_block:(-1,8000000000000000,34835953):5695B27CD38B9BC46AB7A09967D7591AA2513B7372AE51C760DD64D682DB27A8:F28D76297E7806D24CF111110F527DED07B565693AD4B208C97C9D9419E2C4AF]
[ 4][t 2][2024-06-11 14:03:46.547680][ExtClient.h:69][!GetAccountState][&lite_server]   send query to liteserver: 499652946 liteServer_getAccountState {
  id = tonNode_blockIdExt {
    workchain = -1
    shard = -9223372036854775808
    seqno = 38301991
    root_hash = { F6 25 6D 1B CA B9 76 E3 35 2B 0B B9 07 AD B8 CB 17 18 C9 CC 63 E0 20 66 89 AF 3E 48 19 ED E1 B0 }
    file_hash = { 2C AB 75 1F EA 50 71 74 95 3D 83 2C A8 1F 56 1A 62 4D C4 29 10 44 AD D2 D8 BB 13 E9 E0 81 90 BF }
  }
  account = liteServer_accountId {
    workchain = 0
    id = { BC 91 B8 9F 7A 87 4A FF C7 5E FA 3D 88 FA 2E 5B 72 ED E0 73 C7 11 BE 38 37 A3 CA 8B 06 57 E5 60 }
  }
}
[ 4][t 2][2024-06-11 14:03:46.547704][LastBlock.cpp:408][!LastBlock][&last_block]       Sync state: 3466038 / 3466038
[ 4][t 1][2024-06-11 14:03:46.547730][TonlibClient.cpp:2196][!Tonlib][&tonlib_query id == 0]    Tonlib update updateSyncState {
  sync_state = syncStateDone {
  }
}
[ 4][t 0][2024-06-11 14:03:46.547762][Client.cpp:84][&tonlib_requests]  End to wait for updates, returning object 0 0x12ee2d350
[ 4][t 0][2024-06-11 14:03:46.547859][Client.cpp:78][&tonlib_requests]  Begin to wait for updates with timeout 1.000000
[ 4][t 1][2024-06-11 14:03:46.547871][adnl-ext-connection.cpp:31][!outconn]     sending packet of size 168
[ 4][t 1][2024-06-11 14:03:46.547912][BufferedFd.h:216][!outconn]       Flush write: +236B[left:0B]
[ 4][t 1][2024-06-11 14:03:47.360634][BufferedFd.h:207][!outconn]       Flush read: +4740B[total:4740B]
[ 4][t 1][2024-06-11 14:03:47.360660][adnl-ext-connection.cpp:80][!outconn]     len=4736
[ 4][t 1][2024-06-11 14:03:47.360675][adnl-ext-connection.cpp:163][!outconn]    received packet of size 4736
[ 4][t 2][2024-06-11 14:03:47.360728][ExtClient.h:91][!GetAccountState][&lite_server res.is_ok()]       got result from liteserver: 499652946 liteServer_accountState {
  id = tonNode_blockIdExt {
    workchain = -1
    shard = -9223372036854775808
    seqno = 38301991
    root_hash = { F6 25 6D 1B CA B9 76 E3 35 2B 0B B9 07 AD B8 CB 17 18 C9 CC 63 E0 20 66 89 AF 3E 48 19 ED E1 B0 }
    file_hash = { 2C AB 75 1F EA 50 71 74 95 3D 83 2C A8 1F 56 1A 62 4D C4 29 10 44 AD D2 D8 BB 13 E9 E0 81 90 BF }
  }
  shardblk = tonNode_blockIdExt {
    workchain = 0
    shard = -4611686018427387904
    seqno = 43973545
    root_hash = { 2E D8 50 0D EA 74 38 B1 2E 45 AB 1F D5 46 FA 9E C4 FE A6 A4 6B B9 D4 59 00 F1 31 87 49 03 52 94 }
    file_hash = { 5E 9B 37 7F 93 39 47 46 45 9D C8 C5 32 B0 F1 9E 17 8E EC F1 95 99 4B A0 97 3E 6D CF 53 BA 22 90 }
  }
  shard_proof = bytes [1265] { B5 EE 9C 72 01 02 1B 02 00 04 E4 00 01 09 46 03 F6 25 6D 1B CA B9 76 E3 35 2B 0B B9 07 AD B8 CB 17 18 C9 CC 63 E0 20 66 89 AF 3E 48 19 ED E1 B0 00 16 02 09 46 03 29 16 8B 89 43 8E 06 D6 0C 5D ...}
  proof = bytes [2234] { B5 EE 9C 72 01 02 42 02 00 08 AD 00 01 09 46 03 2E D8 50 0D EA 74 38 B1 2E 45 AB 1F D5 46 FA 9E C4 FE A6 A4 6B B9 D4 59 00 F1 31 87 49 03 52 94 00 2E 02 09 46 03 3F 13 95 46 69 07 AB C1 4F B1 ...}
  state = bytes [950] { B5 EE 9C 72 01 02 13 01 00 03 AA 00 02 6F C0 0B C9 1B 89 F7 A8 74 AF FC 75 EF A3 D8 8F A2 E5 B7 2E DE 07 3C 71 1B E3 83 7A 3C A8 B0 65 7E 56 02 26 86 7D 83 30 B2 8B A8 00 00 A6 8E 4D C0 12 15 ...}
}
[ 2][t 2][2024-06-11 14:03:47.361022][TonlibClient.cpp:771][!GetAccountState]   Unknown code hash: vrBoPr64kn/p/I7AoYvH3ReJlomCWhIeq0bFo6hg0M4=
[ 4][t 1][2024-06-11 14:03:47.361130][TonlibClient.cpp:2195][!Tonlib][&tonlib_query id != 0]    Tonlib answer query [id:10] fullAccountState {
  address = accountAddress {
    account_address = "EQC8kbifeodK_8de-j2I-i5bcu3gc8cRvjg3o8qLBlflYM7X"
  }
  balance = 20708923
  last_transaction_id = internal_transactionId {
    lt = 45782530000003
    hash = bytes [32] { 7D 5D DE 08 31 D1 B9 6A A6 D4 56 B7 8C 96 45 AD A7 49 C5 8C 39 EC D1 24 99 06 83 E4 D8 B0 F7 1E }
  }
  block_id = ton_blockIdExt {
    workchain = -1
    shard = -9223372036854775808
    seqno = 38301991
    root_hash = bytes [32] { F6 25 6D 1B CA B9 76 E3 35 2B 0B B9 07 AD B8 CB 17 18 C9 CC 63 E0 20 66 89 AF 3E 48 19 ED E1 B0 }
    file_hash = bytes [32] { 2C AB 75 1F EA 50 71 74 95 3D 83 2C A8 1F 56 1A 62 4D C4 29 10 44 AD D2 D8 BB 13 E9 E0 81 90 BF }
  }
  sync_utime = 1718114594
  account_state = raw_accountState {
    code = bytes [819] { B5 EE 9C 72 41 02 11 01 00 03 23 00 01 14 FF 00 F4 A4 13 F4 BC F2 C8 0B 01 02 01 62 02 03 02 02 CC 04 05 00 1B A0 F6 05 DA 89 A1 F4 01 F4 81 F4 81 A8 61 02 01 D4 06 07 02 01 20 08 09 00 C3 08 ...}
    data = bytes [894] { B5 EE 9C 72 41 02 12 01 00 03 6E 00 01 8F 4B 21 60 6F 28 00 92 F5 FF 38 34 4A 43 1B 61 94 04 A4 F3 D2 B4 2D 97 24 C6 14 EC 1B 35 4A 9C 64 0C 03 AD 52 25 A3 00 2B DA 7F 42 4C AE FE 81 3A F3 E9 ...}
    frozen_hash = bytes [0] { }
  }
  revision = 0
}
[ 4][t 0][2024-06-11 14:03:47.361214][Client.cpp:84][&tonlib_requests]  End to wait for updates, returning object 10 0x12ef29940
[ 4][t 0][2024-06-11 14:03:47.361563][Client.cpp:78][&tonlib_requests]  Begin to wait for updates with timeout 1.000000```
oneforalone commented 5 months ago

Solved with TonClient::set_log_verbosity_level(1);