@@ -9,6 +9,7 @@ use crate::chains::ton::ton_sign::assert_eq_boc;
99use tw_any_coin:: test_utils:: sign_utils:: AnySignerHelper ;
1010use tw_coin_registry:: coin_type:: CoinType ;
1111use tw_encoding:: hex:: { DecodeHex , ToHex } ;
12+ use tw_number:: U256 ;
1213use tw_proto:: Common :: Proto :: SigningError ;
1314use tw_proto:: TheOpenNetwork :: Proto ;
1415use tw_proto:: TheOpenNetwork :: Proto :: mod_Transfer:: OneOfpayload as PayloadType ;
@@ -19,7 +20,7 @@ fn test_ton_sign_wallet_v5r1_transfer_and_deploy() {
1920
2021 let transfer = Proto :: Transfer {
2122 dest : "EQBe6DtCpJZe8M4t-crMXe93JlEYgSl30S5OUuMSLOfeQfBu" . into ( ) ,
22- amount : 10 ,
23+ amount : U256 :: encode_be_compact ( 10 ) ,
2324 mode : Proto :: SendMode :: PAY_FEES_SEPARATELY as u32
2425 | Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
2526 bounceable : true ,
@@ -52,7 +53,7 @@ fn test_ton_sign_wallet_v5r1_transfer_ordinary() {
5253
5354 let transfer = Proto :: Transfer {
5455 dest : "EQBe6DtCpJZe8M4t-crMXe93JlEYgSl30S5OUuMSLOfeQfBu" . into ( ) ,
55- amount : 10 ,
56+ amount : U256 :: encode_be_compact ( 10 ) ,
5657 mode : Proto :: SendMode :: PAY_FEES_SEPARATELY as u32
5758 | Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
5859 bounceable : true ,
@@ -87,7 +88,7 @@ fn test_ton_sign_wallet_v5r1_transfer_all_balance() {
8788
8889 let transfer = Proto :: Transfer {
8990 dest : "UQAU3o5-Sp1MYRpw3U7b_wmARxqI49LxiFhEoVCxpUKjTYXk" . into ( ) ,
90- amount : 0 ,
91+ amount : U256 :: encode_be_compact ( 0 ) ,
9192 mode : Proto :: SendMode :: ATTACH_ALL_CONTRACT_BALANCE as u32
9293 | Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
9394 bounceable : true ,
@@ -121,7 +122,7 @@ fn test_ton_sign_wallet_v5r1_transfer_all_balance_non_bounceable() {
121122
122123 let transfer = Proto :: Transfer {
123124 dest : "UQBe6DtCpJZe8M4t-crMXe93JlEYgSl30S5OUuMSLOfeQa2r" . into ( ) ,
124- amount : 0 ,
125+ amount : U256 :: encode_be_compact ( 0 ) ,
125126 mode : Proto :: SendMode :: ATTACH_ALL_CONTRACT_BALANCE as u32
126127 | Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
127128 bounceable : false ,
@@ -155,7 +156,7 @@ fn test_ton_sign_wallet_v5r1_transfer_with_ascii_comment() {
155156
156157 let transfer = Proto :: Transfer {
157158 dest : "EQBe6DtCpJZe8M4t-crMXe93JlEYgSl30S5OUuMSLOfeQfBu" . into ( ) ,
158- amount : 10 ,
159+ amount : U256 :: encode_be_compact ( 10 ) ,
159160 mode : Proto :: SendMode :: PAY_FEES_SEPARATELY as u32
160161 | Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
161162 bounceable : true ,
@@ -190,7 +191,7 @@ fn test_ton_sign_wallet_v5r1_transfer_with_utf8_comment() {
190191
191192 let transfer = Proto :: Transfer {
192193 dest : "EQBe6DtCpJZe8M4t-crMXe93JlEYgSl30S5OUuMSLOfeQfBu" . into ( ) ,
193- amount : 10 ,
194+ amount : U256 :: encode_be_compact ( 10 ) ,
194195 mode : Proto :: SendMode :: PAY_FEES_SEPARATELY as u32
195196 | Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
196197 bounceable : true ,
@@ -226,17 +227,17 @@ fn test_ton_sign_wallet_v5r1_transfer_jettons() {
226227 let jetton_transfer = Proto :: JettonTransfer {
227228 query_id : 69 ,
228229 // Transfer 0.12 USDT (decimal precision is 6).
229- jetton_amount : 120000 ,
230+ jetton_amount : U256 :: encode_be_compact ( 120000 ) ,
230231 to_owner : "UQAU3o5-Sp1MYRpw3U7b_wmARxqI49LxiFhEoVCxpUKjTYXk" . into ( ) ,
231232 // Send unused toncoins back to sender.
232233 response_address : "UQCh41gQP1A4I0lnAn6yAfitDAIYpXG6UFIXqeSz1TVxNOJ_" . into ( ) ,
233- forward_amount : 1 ,
234+ forward_amount : U256 :: encode_be_compact ( 1 ) ,
234235 ..Default :: default ( )
235236 } ;
236237
237238 let transfer = Proto :: Transfer {
238239 dest : "EQDg4AjfaxQBVsUFueenkKlHLhhYWrcBvCEzbEgfrT0nxuGC" . into ( ) ,
239- amount : 100 * 1000 * 1000 ,
240+ amount : U256 :: encode_be_compact ( 100 * 1000 * 1000 ) ,
240241 mode : Proto :: SendMode :: PAY_FEES_SEPARATELY as u32
241242 | Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
242243 bounceable : true ,
@@ -272,17 +273,17 @@ fn test_ton_sign_wallet_v5r1_transfer_jettons_with_comment() {
272273 let jetton_transfer = Proto :: JettonTransfer {
273274 query_id : 0 ,
274275 // Transfer 0.11 USDT (decimal precision is 6).
275- jetton_amount : 110000 ,
276+ jetton_amount : U256 :: encode_be_compact ( 110000 ) ,
276277 to_owner : "UQAU3o5-Sp1MYRpw3U7b_wmARxqI49LxiFhEoVCxpUKjTYXk" . into ( ) ,
277278 // Send unused toncoins back to sender.
278279 response_address : "UQCh41gQP1A4I0lnAn6yAfitDAIYpXG6UFIXqeSz1TVxNOJ_" . into ( ) ,
279- forward_amount : 1 ,
280+ forward_amount : U256 :: encode_be_compact ( 1 ) ,
280281 ..Default :: default ( )
281282 } ;
282283
283284 let transfer = Proto :: Transfer {
284285 dest : "EQDg4AjfaxQBVsUFueenkKlHLhhYWrcBvCEzbEgfrT0nxuGC" . into ( ) ,
285- amount : 100 * 1000 * 1000 ,
286+ amount : U256 :: encode_be_compact ( 100 * 1000 * 1000 ) ,
286287 mode : Proto :: SendMode :: PAY_FEES_SEPARATELY as u32
287288 | Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
288289 bounceable : true ,
@@ -320,7 +321,7 @@ fn test_ton_sign_wallet_v5r1_transfer_custom_payload() {
320321 let transfer = Proto :: Transfer {
321322 dest : "UQAU3o5-Sp1MYRpw3U7b_wmARxqI49LxiFhEoVCxpUKjTYXk" . into ( ) ,
322323 // 0.00025 TON
323- amount : 250_000 ,
324+ amount : U256 :: encode_be_compact ( 250_000 ) ,
324325 mode : Proto :: SendMode :: PAY_FEES_SEPARATELY as u32
325326 | Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
326327 bounceable : true ,
@@ -371,7 +372,7 @@ fn test_ton_sign_wallet_v5r1_transfer_custom_payload_with_state_init() {
371372 let transfer = Proto :: Transfer {
372373 dest : doge_contract_address. into ( ) ,
373374 // 0.0069 TON
374- amount : 6_900_000 ,
375+ amount : U256 :: encode_be_compact ( 6_900_000 ) ,
375376 mode : Proto :: SendMode :: PAY_FEES_SEPARATELY as u32
376377 | Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
377378 bounceable : false ,
@@ -409,7 +410,7 @@ fn test_ton_sign_wallet_v5r1_missing_required_send_mode() {
409410
410411 let transfer = Proto :: Transfer {
411412 dest : "EQBe6DtCpJZe8M4t-crMXe93JlEYgSl30S5OUuMSLOfeQfBu" . into ( ) ,
412- amount : 10 ,
413+ amount : U256 :: encode_be_compact ( 10 ) ,
413414 // Proto::SendMode::IGNORE_ACTION_PHASE_ERRORS is required for wallet v5r1 external messages.
414415 mode : Proto :: SendMode :: PAY_FEES_SEPARATELY as u32 ,
415416 bounceable : true ,
@@ -438,17 +439,17 @@ fn test_ton_sign_wallet_v5r1_mintless_jetton() {
438439 let jetton_transfer = Proto :: JettonTransfer {
439440 query_id : 1 ,
440441 // Transfer 0 mintless jetton to self.
441- jetton_amount : 0 ,
442+ jetton_amount : U256 :: encode_be_compact ( 0 ) ,
442443 to_owner : "UQCh41gQP1A4I0lnAn6yAfitDAIYpXG6UFIXqeSz1TVxNOJ_" . into ( ) ,
443444 // Send unused toncoins back to sender.
444445 response_address : "UQCh41gQP1A4I0lnAn6yAfitDAIYpXG6UFIXqeSz1TVxNOJ_" . into ( ) ,
445- forward_amount : 1 ,
446+ forward_amount : U256 :: encode_be_compact ( 1 ) ,
446447 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 ( )
447448 } ;
448449
449450 let transfer = Proto :: Transfer {
450451 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
452453 mode : Proto :: SendMode :: PAY_FEES_SEPARATELY as u32
453454 | Proto :: SendMode :: IGNORE_ACTION_PHASE_ERRORS as u32 ,
454455 bounceable : true ,
0 commit comments