ton-client-ruby 1.1.9 → 1.1.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/code_generator/api.json +397 -5
- data/lib/code_generator/code_generator.rb +7 -0
- data/lib/ton-client-ruby/Client/Abi.rb +11 -1
- data/lib/ton-client-ruby/Client/Boc.rb +14 -1
- data/lib/ton-client-ruby/Client/Client.rb +5 -1
- data/lib/ton-client-ruby/Client/Proofs.rb +28 -0
- data/lib/ton-client-ruby/Helpers/CommonHelpers.rb +1 -1
- data/lib/ton-client-ruby/version.rb +1 -1
- data/lib/ton-client-ruby.rb +14 -13
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7e868ce4eb16f47f2accf10dbc163388dfb6bdd597a4994d71b29496fd65a56
|
4
|
+
data.tar.gz: a3c1c35385c3e0767edb3758da11ec522525bf741a5849985e73901b6e4b373f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd5c88d15df026c37a4b9861e99b02f6dea6cd73ecbaeed23ce4d2c2b5daf139db67eb2f0f35109165c3e0c1479b11dc955cafc91c4df851bc425bd1394b3b32
|
7
|
+
data.tar.gz: 282357a123d7efc1acabba8e7a6b7a834e9d73149d1b55ad909346781becacd336e917d9c6afd8e25d4f131933af8860f020ac4f0ab8f8d220706befda6fe903
|
data/lib/code_generator/api.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"version": "1.
|
2
|
+
"version": "1.25.0",
|
3
3
|
"modules": [
|
4
4
|
{
|
5
5
|
"name": "client",
|
@@ -247,6 +247,13 @@
|
|
247
247
|
"value": "34",
|
248
248
|
"summary": null,
|
249
249
|
"description": null
|
250
|
+
},
|
251
|
+
{
|
252
|
+
"name": "LocalStorageError",
|
253
|
+
"type": "Number",
|
254
|
+
"value": "35",
|
255
|
+
"summary": null,
|
256
|
+
"description": null
|
250
257
|
}
|
251
258
|
],
|
252
259
|
"summary": null,
|
@@ -324,6 +331,25 @@
|
|
324
331
|
},
|
325
332
|
"summary": null,
|
326
333
|
"description": null
|
334
|
+
},
|
335
|
+
{
|
336
|
+
"name": "proofs",
|
337
|
+
"type": "Optional",
|
338
|
+
"optional_inner": {
|
339
|
+
"type": "Ref",
|
340
|
+
"ref_name": "client.ProofsConfig"
|
341
|
+
},
|
342
|
+
"summary": null,
|
343
|
+
"description": null
|
344
|
+
},
|
345
|
+
{
|
346
|
+
"name": "local_storage_path",
|
347
|
+
"type": "Optional",
|
348
|
+
"optional_inner": {
|
349
|
+
"type": "String"
|
350
|
+
},
|
351
|
+
"summary": "For file based storage is a folder name where SDK will store its data. For browser based is a browser async storage key prefix. Default (recommended) value is \"~/.tonclient\" for native environments and \".tonclient\" for web-browser.",
|
352
|
+
"description": null
|
327
353
|
}
|
328
354
|
],
|
329
355
|
"summary": null,
|
@@ -461,7 +487,7 @@
|
|
461
487
|
"number_type": "UInt",
|
462
488
|
"number_size": 32
|
463
489
|
},
|
464
|
-
"summary": "Maximum value for the endpoint's blockchain data syncronization latency (time-lag). Library periodically checks the current endpoint for blockchain data
|
490
|
+
"summary": "Maximum value for the endpoint's blockchain data syncronization latency (time-lag). Library periodically checks the current endpoint for blockchain data synchronization latency. If the latency (time-lag) is less then `NetworkConfig.max_latency` then library selects another endpoint.",
|
465
491
|
"description": "Must be specified in milliseconds. Default is 60000 (1 min)."
|
466
492
|
},
|
467
493
|
{
|
@@ -587,6 +613,23 @@
|
|
587
613
|
"summary": null,
|
588
614
|
"description": null
|
589
615
|
},
|
616
|
+
{
|
617
|
+
"name": "ProofsConfig",
|
618
|
+
"type": "Struct",
|
619
|
+
"struct_fields": [
|
620
|
+
{
|
621
|
+
"name": "cache_in_local_storage",
|
622
|
+
"type": "Optional",
|
623
|
+
"optional_inner": {
|
624
|
+
"type": "Boolean"
|
625
|
+
},
|
626
|
+
"summary": "Cache proofs in the local storage.",
|
627
|
+
"description": "Default is `true`. If this value is set to `true`, downloaded proofs and master-chain BOCs are saved into the\npersistent local storage (e.g. file system for native environments or browser's IndexedDB\nfor the web); otherwise all the data is cached only in memory in current client's context\nand will be lost after destruction of the client."
|
628
|
+
}
|
629
|
+
],
|
630
|
+
"summary": null,
|
631
|
+
"description": null
|
632
|
+
},
|
590
633
|
{
|
591
634
|
"name": "BuildInfoDependency",
|
592
635
|
"type": "Struct",
|
@@ -5732,7 +5775,7 @@
|
|
5732
5775
|
"description": null
|
5733
5776
|
},
|
5734
5777
|
{
|
5735
|
-
"name": "
|
5778
|
+
"name": "ResultOfDecodeAccountData",
|
5736
5779
|
"type": "Struct",
|
5737
5780
|
"struct_fields": [
|
5738
5781
|
{
|
@@ -5860,6 +5903,51 @@
|
|
5860
5903
|
],
|
5861
5904
|
"summary": null,
|
5862
5905
|
"description": null
|
5906
|
+
},
|
5907
|
+
{
|
5908
|
+
"name": "ParamsOfDecodeBoc",
|
5909
|
+
"type": "Struct",
|
5910
|
+
"struct_fields": [
|
5911
|
+
{
|
5912
|
+
"name": "params",
|
5913
|
+
"type": "Array",
|
5914
|
+
"array_item": {
|
5915
|
+
"type": "Ref",
|
5916
|
+
"ref_name": "abi.AbiParam"
|
5917
|
+
},
|
5918
|
+
"summary": "Parameters to decode from BOC",
|
5919
|
+
"description": null
|
5920
|
+
},
|
5921
|
+
{
|
5922
|
+
"name": "boc",
|
5923
|
+
"type": "String",
|
5924
|
+
"summary": "Data BOC or BOC handle",
|
5925
|
+
"description": null
|
5926
|
+
},
|
5927
|
+
{
|
5928
|
+
"name": "allow_partial",
|
5929
|
+
"type": "Boolean",
|
5930
|
+
"summary": null,
|
5931
|
+
"description": null
|
5932
|
+
}
|
5933
|
+
],
|
5934
|
+
"summary": null,
|
5935
|
+
"description": null
|
5936
|
+
},
|
5937
|
+
{
|
5938
|
+
"name": "ResultOfDecodeBoc",
|
5939
|
+
"type": "Struct",
|
5940
|
+
"struct_fields": [
|
5941
|
+
{
|
5942
|
+
"name": "data",
|
5943
|
+
"type": "Ref",
|
5944
|
+
"ref_name": "Value",
|
5945
|
+
"summary": "Decoded data as a JSON structure.",
|
5946
|
+
"description": null
|
5947
|
+
}
|
5948
|
+
],
|
5949
|
+
"summary": null,
|
5950
|
+
"description": null
|
5863
5951
|
}
|
5864
5952
|
],
|
5865
5953
|
"functions": [
|
@@ -6199,7 +6287,7 @@
|
|
6199
6287
|
"generic_args": [
|
6200
6288
|
{
|
6201
6289
|
"type": "Ref",
|
6202
|
-
"ref_name": "abi.
|
6290
|
+
"ref_name": "abi.ResultOfDecodeAccountData"
|
6203
6291
|
}
|
6204
6292
|
]
|
6205
6293
|
},
|
@@ -6280,6 +6368,44 @@
|
|
6280
6368
|
]
|
6281
6369
|
},
|
6282
6370
|
"errors": null
|
6371
|
+
},
|
6372
|
+
{
|
6373
|
+
"name": "decode_boc",
|
6374
|
+
"summary": "Decodes BOC into JSON as a set of provided parameters.",
|
6375
|
+
"description": "Solidity functions use ABI types for [builder encoding](https://github.com/tonlabs/TON-Solidity-Compiler/blob/master/API.md#tvmbuilderstore).\nThe simplest way to decode such a BOC is to use ABI decoding.\nABI has it own rules for fields layout in cells so manually encoded\nBOC can not be described in terms of ABI rules.\n\nTo solve this problem we introduce a new ABI type `Ref(<ParamType>)`\nwhich allows to store `ParamType` ABI parameter in cell reference and, thus,\ndecode manually encoded BOCs. This type is available only in `decode_boc` function\nand will not be available in ABI messages encoding until it is included into some ABI revision.\n\nSuch BOC descriptions covers most users needs. If someone wants to decode some BOC which\ncan not be described by these rules (i.e. BOC with TLB containing constructors of flags\ndefining some parsing conditions) then they can decode the fields up to fork condition,\ncheck the parsed data manually, expand the parsing schema and then decode the whole BOC\nwith the full schema.",
|
6376
|
+
"params": [
|
6377
|
+
{
|
6378
|
+
"name": "context",
|
6379
|
+
"type": "Generic",
|
6380
|
+
"generic_name": "Arc",
|
6381
|
+
"generic_args": [
|
6382
|
+
{
|
6383
|
+
"type": "Ref",
|
6384
|
+
"ref_name": "ClientContext"
|
6385
|
+
}
|
6386
|
+
],
|
6387
|
+
"summary": null,
|
6388
|
+
"description": null
|
6389
|
+
},
|
6390
|
+
{
|
6391
|
+
"name": "params",
|
6392
|
+
"type": "Ref",
|
6393
|
+
"ref_name": "abi.ParamsOfDecodeBoc",
|
6394
|
+
"summary": null,
|
6395
|
+
"description": null
|
6396
|
+
}
|
6397
|
+
],
|
6398
|
+
"result": {
|
6399
|
+
"type": "Generic",
|
6400
|
+
"generic_name": "ClientResult",
|
6401
|
+
"generic_args": [
|
6402
|
+
{
|
6403
|
+
"type": "Ref",
|
6404
|
+
"ref_name": "abi.ResultOfDecodeBoc"
|
6405
|
+
}
|
6406
|
+
]
|
6407
|
+
},
|
6408
|
+
"errors": null
|
6283
6409
|
}
|
6284
6410
|
]
|
6285
6411
|
},
|
@@ -6466,7 +6592,7 @@
|
|
6466
6592
|
{
|
6467
6593
|
"name": "boc",
|
6468
6594
|
"type": "String",
|
6469
|
-
"summary": "BOC encoded as base64",
|
6595
|
+
"summary": "BOC encoded as base64 or BOC handle",
|
6470
6596
|
"description": null
|
6471
6597
|
}
|
6472
6598
|
],
|
@@ -6487,6 +6613,36 @@
|
|
6487
6613
|
"summary": null,
|
6488
6614
|
"description": null
|
6489
6615
|
},
|
6616
|
+
{
|
6617
|
+
"name": "ParamsOfGetBocDepth",
|
6618
|
+
"type": "Struct",
|
6619
|
+
"struct_fields": [
|
6620
|
+
{
|
6621
|
+
"name": "boc",
|
6622
|
+
"type": "String",
|
6623
|
+
"summary": "BOC encoded as base64 or BOC handle",
|
6624
|
+
"description": null
|
6625
|
+
}
|
6626
|
+
],
|
6627
|
+
"summary": null,
|
6628
|
+
"description": null
|
6629
|
+
},
|
6630
|
+
{
|
6631
|
+
"name": "ResultOfGetBocDepth",
|
6632
|
+
"type": "Struct",
|
6633
|
+
"struct_fields": [
|
6634
|
+
{
|
6635
|
+
"name": "depth",
|
6636
|
+
"type": "Number",
|
6637
|
+
"number_type": "UInt",
|
6638
|
+
"number_size": 32,
|
6639
|
+
"summary": "BOC root cell depth",
|
6640
|
+
"description": null
|
6641
|
+
}
|
6642
|
+
],
|
6643
|
+
"summary": null,
|
6644
|
+
"description": null
|
6645
|
+
},
|
6490
6646
|
{
|
6491
6647
|
"name": "ParamsOfGetCodeFromTvc",
|
6492
6648
|
"type": "Struct",
|
@@ -6845,6 +7001,26 @@
|
|
6845
7001
|
"summary": "Contract code BOC encoded as base64 or BOC handle",
|
6846
7002
|
"description": null
|
6847
7003
|
},
|
7004
|
+
{
|
7005
|
+
"name": "code_hash",
|
7006
|
+
"type": "Optional",
|
7007
|
+
"optional_inner": {
|
7008
|
+
"type": "String"
|
7009
|
+
},
|
7010
|
+
"summary": "Contract code hash",
|
7011
|
+
"description": null
|
7012
|
+
},
|
7013
|
+
{
|
7014
|
+
"name": "code_depth",
|
7015
|
+
"type": "Optional",
|
7016
|
+
"optional_inner": {
|
7017
|
+
"type": "Number",
|
7018
|
+
"number_type": "UInt",
|
7019
|
+
"number_size": 32
|
7020
|
+
},
|
7021
|
+
"summary": "Contract code depth",
|
7022
|
+
"description": null
|
7023
|
+
},
|
6848
7024
|
{
|
6849
7025
|
"name": "data",
|
6850
7026
|
"type": "Optional",
|
@@ -6854,6 +7030,26 @@
|
|
6854
7030
|
"summary": "Contract data BOC encoded as base64 or BOC handle",
|
6855
7031
|
"description": null
|
6856
7032
|
},
|
7033
|
+
{
|
7034
|
+
"name": "data_hash",
|
7035
|
+
"type": "Optional",
|
7036
|
+
"optional_inner": {
|
7037
|
+
"type": "String"
|
7038
|
+
},
|
7039
|
+
"summary": "Contract data hash",
|
7040
|
+
"description": null
|
7041
|
+
},
|
7042
|
+
{
|
7043
|
+
"name": "data_depth",
|
7044
|
+
"type": "Optional",
|
7045
|
+
"optional_inner": {
|
7046
|
+
"type": "Number",
|
7047
|
+
"number_type": "UInt",
|
7048
|
+
"number_size": 32
|
7049
|
+
},
|
7050
|
+
"summary": "Contract data depth",
|
7051
|
+
"description": null
|
7052
|
+
},
|
6857
7053
|
{
|
6858
7054
|
"name": "library",
|
6859
7055
|
"type": "Optional",
|
@@ -6891,6 +7087,15 @@
|
|
6891
7087
|
},
|
6892
7088
|
"summary": "Is present and non-zero only in instances of large smart contracts",
|
6893
7089
|
"description": null
|
7090
|
+
},
|
7091
|
+
{
|
7092
|
+
"name": "compiler_version",
|
7093
|
+
"type": "Optional",
|
7094
|
+
"optional_inner": {
|
7095
|
+
"type": "String"
|
7096
|
+
},
|
7097
|
+
"summary": "Compiler version, for example 'sol 0.49.0'",
|
7098
|
+
"description": null
|
6894
7099
|
}
|
6895
7100
|
],
|
6896
7101
|
"summary": null,
|
@@ -7283,6 +7488,44 @@
|
|
7283
7488
|
},
|
7284
7489
|
"errors": null
|
7285
7490
|
},
|
7491
|
+
{
|
7492
|
+
"name": "get_boc_depth",
|
7493
|
+
"summary": "Calculates BOC depth",
|
7494
|
+
"description": null,
|
7495
|
+
"params": [
|
7496
|
+
{
|
7497
|
+
"name": "context",
|
7498
|
+
"type": "Generic",
|
7499
|
+
"generic_name": "Arc",
|
7500
|
+
"generic_args": [
|
7501
|
+
{
|
7502
|
+
"type": "Ref",
|
7503
|
+
"ref_name": "ClientContext"
|
7504
|
+
}
|
7505
|
+
],
|
7506
|
+
"summary": null,
|
7507
|
+
"description": null
|
7508
|
+
},
|
7509
|
+
{
|
7510
|
+
"name": "params",
|
7511
|
+
"type": "Ref",
|
7512
|
+
"ref_name": "boc.ParamsOfGetBocDepth",
|
7513
|
+
"summary": null,
|
7514
|
+
"description": null
|
7515
|
+
}
|
7516
|
+
],
|
7517
|
+
"result": {
|
7518
|
+
"type": "Generic",
|
7519
|
+
"generic_name": "ClientResult",
|
7520
|
+
"generic_args": [
|
7521
|
+
{
|
7522
|
+
"type": "Ref",
|
7523
|
+
"ref_name": "boc.ResultOfGetBocDepth"
|
7524
|
+
}
|
7525
|
+
]
|
7526
|
+
},
|
7527
|
+
"errors": null
|
7528
|
+
},
|
7286
7529
|
{
|
7287
7530
|
"name": "get_code_from_tvc",
|
7288
7531
|
"summary": "Extracts code from TVC contract image",
|
@@ -12225,6 +12468,155 @@
|
|
12225
12468
|
"errors": null
|
12226
12469
|
}
|
12227
12470
|
]
|
12471
|
+
},
|
12472
|
+
{
|
12473
|
+
"name": "proofs",
|
12474
|
+
"summary": "[UNSTABLE](UNSTABLE.md) Module for proving data, retrieved from TONOS API.",
|
12475
|
+
"description": null,
|
12476
|
+
"types": [
|
12477
|
+
{
|
12478
|
+
"name": "ProofsErrorCode",
|
12479
|
+
"type": "EnumOfConsts",
|
12480
|
+
"enum_consts": [
|
12481
|
+
{
|
12482
|
+
"name": "InvalidData",
|
12483
|
+
"type": "Number",
|
12484
|
+
"value": "901",
|
12485
|
+
"summary": null,
|
12486
|
+
"description": null
|
12487
|
+
},
|
12488
|
+
{
|
12489
|
+
"name": "ProofCheckFailed",
|
12490
|
+
"type": "Number",
|
12491
|
+
"value": "902",
|
12492
|
+
"summary": null,
|
12493
|
+
"description": null
|
12494
|
+
},
|
12495
|
+
{
|
12496
|
+
"name": "InternalError",
|
12497
|
+
"type": "Number",
|
12498
|
+
"value": "903",
|
12499
|
+
"summary": null,
|
12500
|
+
"description": null
|
12501
|
+
},
|
12502
|
+
{
|
12503
|
+
"name": "DataDiffersFromProven",
|
12504
|
+
"type": "Number",
|
12505
|
+
"value": "904",
|
12506
|
+
"summary": null,
|
12507
|
+
"description": null
|
12508
|
+
}
|
12509
|
+
],
|
12510
|
+
"summary": null,
|
12511
|
+
"description": null
|
12512
|
+
},
|
12513
|
+
{
|
12514
|
+
"name": "ParamsOfProofBlockData",
|
12515
|
+
"type": "Struct",
|
12516
|
+
"struct_fields": [
|
12517
|
+
{
|
12518
|
+
"name": "block",
|
12519
|
+
"type": "Ref",
|
12520
|
+
"ref_name": "Value",
|
12521
|
+
"summary": "Single block's data, retrieved from TONOS API, that needs proof. Required fields are `id` and/or top-level `boc` (for block identification), others are optional.",
|
12522
|
+
"description": null
|
12523
|
+
}
|
12524
|
+
],
|
12525
|
+
"summary": null,
|
12526
|
+
"description": null
|
12527
|
+
},
|
12528
|
+
{
|
12529
|
+
"name": "ParamsOfProofTransactionData",
|
12530
|
+
"type": "Struct",
|
12531
|
+
"struct_fields": [
|
12532
|
+
{
|
12533
|
+
"name": "transaction",
|
12534
|
+
"type": "Ref",
|
12535
|
+
"ref_name": "Value",
|
12536
|
+
"summary": "Single transaction's data as queried from DApp server, without modifications. The required fields are `id` and/or top-level `boc`, others are optional. In order to reduce network requests count, it is recommended to provide `block_id` and `boc` of transaction.",
|
12537
|
+
"description": null
|
12538
|
+
}
|
12539
|
+
],
|
12540
|
+
"summary": null,
|
12541
|
+
"description": null
|
12542
|
+
}
|
12543
|
+
],
|
12544
|
+
"functions": [
|
12545
|
+
{
|
12546
|
+
"name": "proof_block_data",
|
12547
|
+
"summary": "Proves that a given block's data, which is queried from TONOS API, can be trusted.",
|
12548
|
+
"description": "This function checks block proofs and compares given data with the proven.\nIf the given data differs from the proven, the exception will be thrown.\nThe input param is a single block's JSON object, which was queried from DApp server using\nfunctions such as `net.query`, `net.query_collection` or `net.wait_for_collection`.\nIf block's BOC is not provided in the JSON, it will be queried from DApp server\n(in this case it is required to provide at least `id` of block).\n\nPlease note, that joins (like `signatures` in `Block`) are separated entities and not supported,\nso function will throw an exception in a case if JSON being checked has such entities in it.\n\nIf `cache_in_local_storage` in config is set to `true` (default), downloaded proofs and\nmaster-chain BOCs are saved into the persistent local storage (e.g. file system for native\nenvironments or browser's IndexedDB for the web); otherwise all the data is cached only in\nmemory in current client's context and will be lost after destruction of the client.\n\n**Why Proofs are needed**\n\nProofs are needed to ensure that the data downloaded from a DApp server is real blockchain\ndata. Checking proofs can protect from the malicious DApp server which can potentially provide\nfake data, or also from \"Man in the Middle\" attacks class.\n\n**What Proofs are**\n\nSimply, proof is a list of signatures of validators', which have signed this particular master-\nblock.\n\nThe very first validator set's public keys are included in the zero-state. Whe know a root hash\nof the zero-state, because it is stored in the network configuration file, it is our authority\nroot. For proving zero-state it is enough to calculate and compare its root hash.\n\nIn each new validator cycle the validator set is changed. The new one is stored in a key-block,\nwhich is signed by the validator set, which we already trust, the next validator set will be\nstored to the new key-block and signed by the current validator set, and so on.\n\nIn order to prove any block in the master-chain we need to check, that it has been signed by\na trusted validator set. So we need to check all key-blocks' proofs, started from the zero-state\nand until the block, which we want to prove. But it can take a lot of time and traffic to\ndownload and prove all key-blocks on a client. For solving this, special trusted blocks are used\nin TON-SDK.\n\nThe trusted block is the authority root, as well, as the zero-state. Each trusted block is the\n`id` (e.g. `root_hash`) of the already proven key-block. There can be plenty of trusted\nblocks, so there can be a lot of authority roots. The hashes of trusted blocks for MainNet\nand DevNet are hardcoded in SDK in a separated binary file (trusted_key_blocks.bin) and can\nbe updated for each release.\nIn future SDK releases, one will also be able to provide their hashes of trusted blocks for\nother networks, besides for MainNet and DevNet.\nBy using trusted key-blocks, in order to prove any block, we can prove chain of key-blocks to\nthe closest previous trusted key-block, not only to the zero-state.\n\nBut shard-blocks don't have proofs on DApp server. In this case, in order to prove any shard-\nblock data, we search for a corresponding master-block, which contains the root hash of this\nshard-block, or some shard block which is linked to that block in shard-chain. After proving\nthis master-block, we traverse through each link and calculate and compare hashes with links,\none-by-one. After that we can ensure that this shard-block has also been proven.",
|
12549
|
+
"params": [
|
12550
|
+
{
|
12551
|
+
"name": "context",
|
12552
|
+
"type": "Generic",
|
12553
|
+
"generic_name": "Arc",
|
12554
|
+
"generic_args": [
|
12555
|
+
{
|
12556
|
+
"type": "Ref",
|
12557
|
+
"ref_name": "ClientContext"
|
12558
|
+
}
|
12559
|
+
],
|
12560
|
+
"summary": null,
|
12561
|
+
"description": null
|
12562
|
+
},
|
12563
|
+
{
|
12564
|
+
"name": "params",
|
12565
|
+
"type": "Ref",
|
12566
|
+
"ref_name": "proofs.ParamsOfProofBlockData",
|
12567
|
+
"summary": null,
|
12568
|
+
"description": null
|
12569
|
+
}
|
12570
|
+
],
|
12571
|
+
"result": {
|
12572
|
+
"type": "Generic",
|
12573
|
+
"generic_name": "ClientResult",
|
12574
|
+
"generic_args": [
|
12575
|
+
{
|
12576
|
+
"type": "None"
|
12577
|
+
}
|
12578
|
+
]
|
12579
|
+
},
|
12580
|
+
"errors": null
|
12581
|
+
},
|
12582
|
+
{
|
12583
|
+
"name": "proof_transaction_data",
|
12584
|
+
"summary": "Proves that a given transaction's data, which is queried from TONOS API, can be trusted.",
|
12585
|
+
"description": "This function requests the corresponding block, checks block proofs, ensures that given transaction\nexists in the proven block and compares given data with the proven.\nIf the given data differs from the proven, the exception will be thrown.\nThe input parameter is a single transaction's JSON object (see params description),\nwhich was queried from TONOS API using functions such as `net.query`, `net.query_collection`\nor `net.wait_for_collection`.\n\nIf transaction's BOC and/or `block_id` are not provided in the JSON, they will be queried from\nTONOS API (in this case it is required to provide at least `id` of transaction).\n\nPlease note, that joins (like `account`, `in_message`, `out_messages`, etc. in `Transaction`\nentity) are separated entities and not supported, so function will throw an exception in a case\nif JSON being checked has such entities in it.\n\nIf `cache_in_local_storage` in config is set to `true` (default), downloaded proofs and\nmaster-chain BOCs are saved into the persistent local storage (e.g. file system for native\nenvironments or browser's IndexedDB for the web); otherwise all the data is cached only in\nmemory in current client's context and will be lost after destruction of the client.\n\nFor more information about proofs checking, see description of `proof_block_data` function.",
|
12586
|
+
"params": [
|
12587
|
+
{
|
12588
|
+
"name": "context",
|
12589
|
+
"type": "Generic",
|
12590
|
+
"generic_name": "Arc",
|
12591
|
+
"generic_args": [
|
12592
|
+
{
|
12593
|
+
"type": "Ref",
|
12594
|
+
"ref_name": "ClientContext"
|
12595
|
+
}
|
12596
|
+
],
|
12597
|
+
"summary": null,
|
12598
|
+
"description": null
|
12599
|
+
},
|
12600
|
+
{
|
12601
|
+
"name": "params",
|
12602
|
+
"type": "Ref",
|
12603
|
+
"ref_name": "proofs.ParamsOfProofTransactionData",
|
12604
|
+
"summary": null,
|
12605
|
+
"description": null
|
12606
|
+
}
|
12607
|
+
],
|
12608
|
+
"result": {
|
12609
|
+
"type": "Generic",
|
12610
|
+
"generic_name": "ClientResult",
|
12611
|
+
"generic_args": [
|
12612
|
+
{
|
12613
|
+
"type": "None"
|
12614
|
+
}
|
12615
|
+
]
|
12616
|
+
},
|
12617
|
+
"errors": null
|
12618
|
+
}
|
12619
|
+
]
|
12228
12620
|
}
|
12229
12621
|
]
|
12230
12622
|
}
|
@@ -175,6 +175,13 @@ curl https://raw.githubusercontent.com/tonlabs/TON-SDK/master/tools/api.json > a
|
|
175
175
|
```\n\n
|
176
176
|
```\n
|
177
177
|
ton-client-ruby update ./api.json\n
|
178
|
+
```\n
|
179
|
+
or\n\n
|
180
|
+
```\n
|
181
|
+
cd ton-client-ruby\n
|
182
|
+
```\n\n
|
183
|
+
```\n
|
184
|
+
./bin/ton-client-ruby update\n
|
178
185
|
```\n
|
179
186
|
}
|
180
187
|
content = checkContent(content)
|
@@ -132,7 +132,7 @@ module TonClient
|
|
132
132
|
# INPUT: ParamsOfDecodeAccountData
|
133
133
|
# abi: Value - # # Contract ABI
|
134
134
|
# data: String - # # Data BOC or BOC handle
|
135
|
-
# RESPONSE:
|
135
|
+
# RESPONSE: ResultOfDecodeAccountData
|
136
136
|
# data: Value - # # Decoded data as a JSON structure.
|
137
137
|
def decode_account_data(payload, &block)
|
138
138
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
@@ -160,6 +160,16 @@ module TonClient
|
|
160
160
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
161
161
|
end
|
162
162
|
|
163
|
+
# INPUT: ParamsOfDecodeBoc
|
164
|
+
# params: Array - # # Parameters to decode from BOC
|
165
|
+
# boc: String - # # Data BOC or BOC handle
|
166
|
+
# allow_partial: Boolean -
|
167
|
+
# RESPONSE: ResultOfDecodeBoc
|
168
|
+
# data: Value - # # Decoded data as a JSON structure.
|
169
|
+
def decode_boc(payload, &block)
|
170
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
171
|
+
end
|
172
|
+
|
163
173
|
end
|
164
174
|
end
|
165
175
|
|
@@ -62,13 +62,21 @@ module TonClient
|
|
62
62
|
end
|
63
63
|
|
64
64
|
# INPUT: ParamsOfGetBocHash
|
65
|
-
# boc: String - # # BOC encoded as base64
|
65
|
+
# boc: String - # # BOC encoded as base64 or BOC handle
|
66
66
|
# RESPONSE: ResultOfGetBocHash
|
67
67
|
# hash: String - # # BOC root hash encoded with hex
|
68
68
|
def get_boc_hash(payload, &block)
|
69
69
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
70
70
|
end
|
71
71
|
|
72
|
+
# INPUT: ParamsOfGetBocDepth
|
73
|
+
# boc: String - # # BOC encoded as base64 or BOC handle
|
74
|
+
# RESPONSE: ResultOfGetBocDepth
|
75
|
+
# depth: Number - # # BOC root cell depth
|
76
|
+
def get_boc_depth(payload, &block)
|
77
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
78
|
+
end
|
79
|
+
|
72
80
|
# INPUT: ParamsOfGetCodeFromTvc
|
73
81
|
# tvc: String - # # Contract TVC image or image BOC handle
|
74
82
|
# RESPONSE: ResultOfGetCodeFromTvc
|
@@ -134,11 +142,16 @@ module TonClient
|
|
134
142
|
# boc_cache: BocCacheType<Optional> - # # Cache type to put the result. The BOC itself returned if no cache type provided.
|
135
143
|
# RESPONSE: ResultOfDecodeTvc
|
136
144
|
# code: String<Optional> - # # Contract code BOC encoded as base64 or BOC handle
|
145
|
+
# code_hash: String<Optional> - # # Contract code hash
|
146
|
+
# code_depth: Number<Optional> - # # Contract code depth
|
137
147
|
# data: String<Optional> - # # Contract data BOC encoded as base64 or BOC handle
|
148
|
+
# data_hash: String<Optional> - # # Contract data hash
|
149
|
+
# data_depth: Number<Optional> - # # Contract data depth
|
138
150
|
# library: String<Optional> - # # Contract library BOC encoded as base64 or BOC handle
|
139
151
|
# tick: Boolean<Optional> - # # `special.tick` field. # # Specifies the contract ability to handle tick transactions
|
140
152
|
# tock: Boolean<Optional> - # # `special.tock` field. # # Specifies the contract ability to handle tock transactions
|
141
153
|
# split_depth: Number<Optional> - # # Is present and non-zero only in instances of large smart contracts
|
154
|
+
# compiler_version: String<Optional> - # # Compiler version, for example 'sol 0.49.0'
|
142
155
|
def decode_tvc(payload, &block)
|
143
156
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
144
157
|
end
|
@@ -4,7 +4,7 @@ module TonClient
|
|
4
4
|
include CommonInstanceHelpers
|
5
5
|
|
6
6
|
attr_reader :core, :context
|
7
|
-
private_accessor :_crypto, :_abi, :_boc, :_processing, :_utils, :_tvm, :_net, :_debot
|
7
|
+
private_accessor :_crypto, :_abi, :_boc, :_processing, :_utils, :_tvm, :_net, :_debot, :_proofs
|
8
8
|
MODULE = self.to_s.downcase.gsub(/^(.+::|)(\w+)$/, '\2').freeze
|
9
9
|
|
10
10
|
def initialize(context: Context.new, core: TonClient::TonBinding)
|
@@ -48,6 +48,10 @@ module TonClient
|
|
48
48
|
_debot ||= Debot.new(context: context)
|
49
49
|
end
|
50
50
|
|
51
|
+
def proofs
|
52
|
+
_proofs ||= Proofs.new(context: context)
|
53
|
+
end
|
54
|
+
|
51
55
|
# RESPONSE: ResultOfGetApiReference
|
52
56
|
# api: Value -
|
53
57
|
def get_api_reference(&block)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module TonClient
|
2
|
+
|
3
|
+
class Proofs
|
4
|
+
include CommonInstanceHelpers
|
5
|
+
|
6
|
+
attr_reader :core, :context
|
7
|
+
MODULE = self.to_s.downcase.gsub(/^(.+::|)(\w+)$/, '\2').freeze
|
8
|
+
|
9
|
+
def initialize(context: Context.new, core: TonClient::TonBinding)
|
10
|
+
@context = context
|
11
|
+
@core = core
|
12
|
+
end
|
13
|
+
|
14
|
+
# INPUT: ParamsOfProofBlockData
|
15
|
+
# block: Value - # # Single block's data, retrieved from TONOS API, that needs proof. Required fields are `id` and/or top-level `boc` (for block identification), others are optional.
|
16
|
+
def proof_block_data(payload, &block)
|
17
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
18
|
+
end
|
19
|
+
|
20
|
+
# INPUT: ParamsOfProofTransactionData
|
21
|
+
# transaction: Value - # # Single transaction's data as queried from DApp server, without modifications. The required fields are `id` and/or top-level `boc`, others are optional. In order to reduce network requests count, it is recommended to provide `block_id` and `boc` of transaction.
|
22
|
+
def proof_transaction_data(payload, &block)
|
23
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
@@ -19,10 +19,10 @@ module TonClient
|
|
19
19
|
queue = Queue.new
|
20
20
|
method.call(*args) do |response|
|
21
21
|
responses << response
|
22
|
+
yield(responses) if block_given?
|
22
23
|
queue.push 1 if response.finished == true
|
23
24
|
end
|
24
25
|
queue.pop
|
25
|
-
yield(responses) if block_given?
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
data/lib/ton-client-ruby.rb
CHANGED
@@ -4,19 +4,20 @@ require 'json'
|
|
4
4
|
require 'byebug'
|
5
5
|
require 'dotenv'
|
6
6
|
require 'fileutils'
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
7
|
+
require_relative './ton-client-ruby/Helpers/CommonHelpers.rb'
|
8
|
+
require_relative './ton-client-ruby/Binding/struct.rb'
|
9
|
+
require_relative './ton-client-ruby/Binding/binding.rb'
|
10
|
+
require_relative './ton-client-ruby/Client/Context.rb'
|
11
|
+
require_relative './ton-client-ruby/Client/Client.rb'
|
12
|
+
require_relative './ton-client-ruby/Client/Crypto.rb'
|
13
|
+
require_relative './ton-client-ruby/Client/Abi.rb'
|
14
|
+
require_relative './ton-client-ruby/Client/Boc.rb'
|
15
|
+
require_relative './ton-client-ruby/Client/Net.rb'
|
16
|
+
require_relative './ton-client-ruby/Client/Processing.rb'
|
17
|
+
require_relative './ton-client-ruby/Client/Tvm.rb'
|
18
|
+
require_relative './ton-client-ruby/Client/Utils.rb'
|
19
|
+
require_relative './ton-client-ruby/Client/Debot.rb'
|
20
|
+
require_relative './ton-client-ruby/version'
|
20
21
|
|
21
22
|
module TonClient
|
22
23
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ton-client-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nerzh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- lib/ton-client-ruby/Client/Debot.rb
|
134
134
|
- lib/ton-client-ruby/Client/Net.rb
|
135
135
|
- lib/ton-client-ruby/Client/Processing.rb
|
136
|
+
- lib/ton-client-ruby/Client/Proofs.rb
|
136
137
|
- lib/ton-client-ruby/Client/Tvm.rb
|
137
138
|
- lib/ton-client-ruby/Client/Utils.rb
|
138
139
|
- lib/ton-client-ruby/Helpers/CommonHelpers.rb
|