@@ -9,6 +9,7 @@ use crate::chains::ton::ton_sign::assert_eq_boc;
9
9
use tw_any_coin:: test_utils:: sign_utils:: AnySignerHelper ;
10
10
use tw_coin_registry:: coin_type:: CoinType ;
11
11
use tw_encoding:: hex:: { DecodeHex , ToHex } ;
12
+ use tw_number:: U256 ;
12
13
use tw_proto:: Common :: Proto :: SigningError ;
13
14
use tw_proto:: TheOpenNetwork :: Proto ;
14
15
use tw_proto:: TheOpenNetwork :: Proto :: mod_Transfer:: OneOfpayload as PayloadType ;
@@ -19,7 +20,7 @@ fn test_ton_sign_wallet_v5r1_transfer_and_deploy() {
19
20
20
21
let transfer = Proto :: Transfer {
21
22
dest : "EQBe6DtCpJZe8M4t-crMXe93JlEYgSl30S5OUuMSLOfeQfBu" . into ( ) ,
22
- amount : 10 ,
23
+ amount : U256 :: encode_be_compact ( 10 ) ,
23
24
mode : Proto :: SendMode :: PAY_FEES_SEPARATELY as u32
24
25
| Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
25
26
bounceable : true ,
@@ -52,7 +53,7 @@ fn test_ton_sign_wallet_v5r1_transfer_ordinary() {
52
53
53
54
let transfer = Proto :: Transfer {
54
55
dest : "EQBe6DtCpJZe8M4t-crMXe93JlEYgSl30S5OUuMSLOfeQfBu" . into ( ) ,
55
- amount : 10 ,
56
+ amount : U256 :: encode_be_compact ( 10 ) ,
56
57
mode : Proto :: SendMode :: PAY_FEES_SEPARATELY as u32
57
58
| Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
58
59
bounceable : true ,
@@ -87,7 +88,7 @@ fn test_ton_sign_wallet_v5r1_transfer_all_balance() {
87
88
88
89
let transfer = Proto :: Transfer {
89
90
dest : "UQAU3o5-Sp1MYRpw3U7b_wmARxqI49LxiFhEoVCxpUKjTYXk" . into ( ) ,
90
- amount : 0 ,
91
+ amount : U256 :: encode_be_compact ( 0 ) ,
91
92
mode : Proto :: SendMode :: ATTACH_ALL_CONTRACT_BALANCE as u32
92
93
| Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
93
94
bounceable : true ,
@@ -121,7 +122,7 @@ fn test_ton_sign_wallet_v5r1_transfer_all_balance_non_bounceable() {
121
122
122
123
let transfer = Proto :: Transfer {
123
124
dest : "UQBe6DtCpJZe8M4t-crMXe93JlEYgSl30S5OUuMSLOfeQa2r" . into ( ) ,
124
- amount : 0 ,
125
+ amount : U256 :: encode_be_compact ( 0 ) ,
125
126
mode : Proto :: SendMode :: ATTACH_ALL_CONTRACT_BALANCE as u32
126
127
| Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
127
128
bounceable : false ,
@@ -155,7 +156,7 @@ fn test_ton_sign_wallet_v5r1_transfer_with_ascii_comment() {
155
156
156
157
let transfer = Proto :: Transfer {
157
158
dest : "EQBe6DtCpJZe8M4t-crMXe93JlEYgSl30S5OUuMSLOfeQfBu" . into ( ) ,
158
- amount : 10 ,
159
+ amount : U256 :: encode_be_compact ( 10 ) ,
159
160
mode : Proto :: SendMode :: PAY_FEES_SEPARATELY as u32
160
161
| Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
161
162
bounceable : true ,
@@ -190,7 +191,7 @@ fn test_ton_sign_wallet_v5r1_transfer_with_utf8_comment() {
190
191
191
192
let transfer = Proto :: Transfer {
192
193
dest : "EQBe6DtCpJZe8M4t-crMXe93JlEYgSl30S5OUuMSLOfeQfBu" . into ( ) ,
193
- amount : 10 ,
194
+ amount : U256 :: encode_be_compact ( 10 ) ,
194
195
mode : Proto :: SendMode :: PAY_FEES_SEPARATELY as u32
195
196
| Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
196
197
bounceable : true ,
@@ -226,17 +227,17 @@ fn test_ton_sign_wallet_v5r1_transfer_jettons() {
226
227
let jetton_transfer = Proto :: JettonTransfer {
227
228
query_id : 69 ,
228
229
// Transfer 0.12 USDT (decimal precision is 6).
229
- jetton_amount : 120000 ,
230
+ jetton_amount : U256 :: encode_be_compact ( 120000 ) ,
230
231
to_owner : "UQAU3o5-Sp1MYRpw3U7b_wmARxqI49LxiFhEoVCxpUKjTYXk" . into ( ) ,
231
232
// Send unused toncoins back to sender.
232
233
response_address : "UQCh41gQP1A4I0lnAn6yAfitDAIYpXG6UFIXqeSz1TVxNOJ_" . into ( ) ,
233
- forward_amount : 1 ,
234
+ forward_amount : U256 :: encode_be_compact ( 1 ) ,
234
235
..Default :: default ( )
235
236
} ;
236
237
237
238
let transfer = Proto :: Transfer {
238
239
dest : "EQDg4AjfaxQBVsUFueenkKlHLhhYWrcBvCEzbEgfrT0nxuGC" . into ( ) ,
239
- amount : 100 * 1000 * 1000 ,
240
+ amount : U256 :: encode_be_compact ( 100 * 1000 * 1000 ) ,
240
241
mode : Proto :: SendMode :: PAY_FEES_SEPARATELY as u32
241
242
| Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
242
243
bounceable : true ,
@@ -272,17 +273,17 @@ fn test_ton_sign_wallet_v5r1_transfer_jettons_with_comment() {
272
273
let jetton_transfer = Proto :: JettonTransfer {
273
274
query_id : 0 ,
274
275
// Transfer 0.11 USDT (decimal precision is 6).
275
- jetton_amount : 110000 ,
276
+ jetton_amount : U256 :: encode_be_compact ( 110000 ) ,
276
277
to_owner : "UQAU3o5-Sp1MYRpw3U7b_wmARxqI49LxiFhEoVCxpUKjTYXk" . into ( ) ,
277
278
// Send unused toncoins back to sender.
278
279
response_address : "UQCh41gQP1A4I0lnAn6yAfitDAIYpXG6UFIXqeSz1TVxNOJ_" . into ( ) ,
279
- forward_amount : 1 ,
280
+ forward_amount : U256 :: encode_be_compact ( 1 ) ,
280
281
..Default :: default ( )
281
282
} ;
282
283
283
284
let transfer = Proto :: Transfer {
284
285
dest : "EQDg4AjfaxQBVsUFueenkKlHLhhYWrcBvCEzbEgfrT0nxuGC" . into ( ) ,
285
- amount : 100 * 1000 * 1000 ,
286
+ amount : U256 :: encode_be_compact ( 100 * 1000 * 1000 ) ,
286
287
mode : Proto :: SendMode :: PAY_FEES_SEPARATELY as u32
287
288
| Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
288
289
bounceable : true ,
@@ -320,7 +321,7 @@ fn test_ton_sign_wallet_v5r1_transfer_custom_payload() {
320
321
let transfer = Proto :: Transfer {
321
322
dest : "UQAU3o5-Sp1MYRpw3U7b_wmARxqI49LxiFhEoVCxpUKjTYXk" . into ( ) ,
322
323
// 0.00025 TON
323
- amount : 250_000 ,
324
+ amount : U256 :: encode_be_compact ( 250_000 ) ,
324
325
mode : Proto :: SendMode :: PAY_FEES_SEPARATELY as u32
325
326
| Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
326
327
bounceable : true ,
@@ -371,7 +372,7 @@ fn test_ton_sign_wallet_v5r1_transfer_custom_payload_with_state_init() {
371
372
let transfer = Proto :: Transfer {
372
373
dest : doge_contract_address. into ( ) ,
373
374
// 0.0069 TON
374
- amount : 6_900_000 ,
375
+ amount : U256 :: encode_be_compact ( 6_900_000 ) ,
375
376
mode : Proto :: SendMode :: PAY_FEES_SEPARATELY as u32
376
377
| Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
377
378
bounceable : false ,
@@ -409,7 +410,7 @@ fn test_ton_sign_wallet_v5r1_missing_required_send_mode() {
409
410
410
411
let transfer = Proto :: Transfer {
411
412
dest : "EQBe6DtCpJZe8M4t-crMXe93JlEYgSl30S5OUuMSLOfeQfBu" . into ( ) ,
412
- amount : 10 ,
413
+ amount : U256 :: encode_be_compact ( 10 ) ,
413
414
// Proto::SendMode::IGNORE_ACTION_PHASE_ERRORS is required for wallet v5r1 external messages.
414
415
mode : Proto :: SendMode :: PAY_FEES_SEPARATELY as u32 ,
415
416
bounceable : true ,
@@ -438,17 +439,17 @@ fn test_ton_sign_wallet_v5r1_mintless_jetton() {
438
439
let jetton_transfer = Proto :: JettonTransfer {
439
440
query_id : 1 ,
440
441
// Transfer 0 mintless jetton to self.
441
- jetton_amount : 0 ,
442
+ jetton_amount : U256 :: encode_be_compact ( 0 ) ,
442
443
to_owner : "UQCh41gQP1A4I0lnAn6yAfitDAIYpXG6UFIXqeSz1TVxNOJ_" . into ( ) ,
443
444
// Send unused toncoins back to sender.
444
445
response_address : "UQCh41gQP1A4I0lnAn6yAfitDAIYpXG6UFIXqeSz1TVxNOJ_" . into ( ) ,
445
- forward_amount : 1 ,
446
+ forward_amount : U256 :: encode_be_compact ( 1 ) ,
446
447
custom_payload : "te6ccgECNQEABJMAAQgN9gLWAQlGA6+1FWXC4ss/wvDOFwMk2bVM97AUEWqaUhh63uWfQ26nAB4CIgWBcAIDBChIAQEZG2ZqtEYGAq27TvzHdGuGrhhKoICBU+Zg9Xq/qRMHGAAdIgEgBQYiASAHCChIAQEV0tdPcZG01smq0thhsmqf9ZzE0QqpP3c+ERvuHF1JDgAbKEgBAf3dO8qdKoPys7AWvavs1wMNWCOq5XashXaRopmksx/LABsiASAJCiIBIAsMKEgBAWP0xUs9JBrfQRl1FkF2tIfIDYpwLdf3fXqMi6BqxNtmABoiASANDihIAQFOErI5E7ld/nTAgHXdGI74UH8kxIaFyAkH42P54tEC9QAYIgEgDxAoSAEBrF16Czdlg18FB467CrR6Ucwxb8H+Z1e4qDeFWbkz1WEAFyIBIBESKEgBAXeWzg9xTFO6z0FP+axi8Njuxxp0zPrAUs4vnmt/dE3xABYoSAEBEZ7KazNpaWJoInmqO4II/AfncyhMNWxh6BE2qFU7/9wAFCIBIBMUKEgBAZleZTNXbgCF+8G08kiQeDPanQtNCVakzEU3g9GKB+K2ABQiASAVFihIAQFeCM83J7sm36g24qFeEDvStahHWn6SsEk+Wii49rzBiAASIgEgFxgoSAEBfV9jrgSeiAKVqeeLliXdoLrxFWe2HK0f4SG5h4kfb8YAESIBIBkaIgEgGxwoSAEBImHhXIbOHuOnOgE5f0KLqoXDB7/ZLQQGiHysuulUq2IAECIBIB0eKEgBAXT+qb5w1+qtvbJ1Fbn8y6IhO85YfxKIgKBga6ROO/yQAA8iASAfIChIAQGoJHXWXWRQGZdP9xIUrMowhvgnf+CwKTIIOBxlDiKgcAANKEgBAZ6tCuDr89HFRz3WwwK+wW4XmkE+O7Hf+NgUDI+uqnAJAAwiASAhIihIAQHtasTLBAw7MZHpRTsKyC47E1PZ/LAtF3n2Y2b5ThX0VgALIgEgIyQiASAlJihIAQGumGRf7UXrpK12Cuvj06565IC0Kbd4i2XoG6dnqC+uQAAJKEgBAXM19HUUkz6ns7o/2x45kQ2iLj8gl3zYhrAhISEUg0O1AAgiASAnKCIBICkqKEgBAa7kNA+lev+Z5T/xqKBbO648BvnLL6/hAp1auOiZTWRhAAcoSAEBxn19AKZGAUPYWs8pTpNQrCB4Ap0KfzyjOgB1Mc9PbIUABSIBICssKEgBAWarrCPqSS6+lq6NRcrWZ2/v6bN4b6Zd3GWAtN6j8a6BAAQiASAtLiIBIC8wKEgBAXYYqhLZ1tHg+HdKd8vLmTBsojkj61ZiafXB7pOt+hEFAAMiASAxMihIAQHt8p6qBiXtz+kKcgo13Udyh7Uo8irrdKlSSY2dOdALogAAIgFIMzQoSAEByacrlqsAKiFOlv4Rp4V1gNg2i4aVPkcHJq8Vug/89k4AAABduZA/UDgjSWcCfrIB+K0MAhilcbpQUhep5LPVNXE0Q7msoAAABm4N2AAABm9VrQgoSAEByIAktH0CNxT//QZ8Vgj68CApZON9XBKDfE0D2rY8Fx4AAA==" . into ( )
447
448
} ;
448
449
449
450
let transfer = Proto :: Transfer {
450
451
dest : "UQCn2lssMz09Gn60mBnv544DgiqIX3mK5cqGEPEPKxCNbE0E" . into ( ) , // jetton wallet address
451
- amount : 90 * 1000 * 1000 , // 0.09 TON as fee
452
+ amount : U256 :: encode_be_compact ( 90 * 1000 * 1000 ) , // 0.09 TON as fee
452
453
mode : Proto :: SendMode :: PAY_FEES_SEPARATELY as u32
453
454
| Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
454
455
bounceable : true ,
0 commit comments