From aa89d78780efe8268c97b2197a3bf265194712c4 Mon Sep 17 00:00:00 2001 From: aSpite Date: Tue, 11 Jun 2024 13:56:30 +0400 Subject: [PATCH 1/2] fix: multisig deploy sendmode --- src/multisig/MultisigWallet.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/multisig/MultisigWallet.ts b/src/multisig/MultisigWallet.ts index e07301a..8be3540 100644 --- a/src/multisig/MultisigWallet.ts +++ b/src/multisig/MultisigWallet.ts @@ -10,6 +10,7 @@ import { ContractProvider, Dictionary, Sender, + SendMode, Slice, StateInit, } from '@ton/core'; @@ -128,7 +129,7 @@ export class MultisigWallet { public async deployInternal(sender: Sender, value: bigint = 1000000000n) { await sender.send({ - sendMode: 3, + sendMode: SendMode.PAY_GAS_SEPARATELY + SendMode.IGNORE_ERRORS, to: this.address, value: value, init: this.init, From 74a7cb5bf0ae4ad66496fabd6945b50c42645a65 Mon Sep 17 00:00:00 2001 From: aSpite Date: Tue, 11 Jun 2024 14:01:21 +0400 Subject: [PATCH 2/2] fix: parsing tuples and lists in stack --- src/client/TonClient.ts | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/client/TonClient.ts b/src/client/TonClient.ts index 3e32720..17f149c 100644 --- a/src/client/TonClient.ts +++ b/src/client/TonClient.ts @@ -338,18 +338,24 @@ export class TonClient { } } -function parseStackEntry(s: any): TupleItem { - switch (s["@type"]) { - case "tvm.stackEntryNumber": - return { type: 'int', value: BigInt(s.number.number) }; - case "tvm.stackEntryCell": - return { type: 'cell', cell: Cell.fromBase64(s.cell) }; +function parseObject(x: any): any { + const typeName = x['@type']; + switch(typeName) { + case 'tvm.list': + case 'tvm.tuple': + return x.elements.map(parseObject); + case 'tvm.cell': + return Cell.fromBoc(Buffer.from(x.bytes, 'base64'))[0]; + case 'tvm.stackEntryCell': + return parseObject(x.cell); case 'tvm.stackEntryTuple': - return { type: 'tuple', items: s.tuple.elements.map(parseStackEntry) }; - case 'tvm.stackEntryList': - return { type: 'list', items: s.list.elements.map(parseStackEntry) }; + return parseObject(x.tuple); + case 'tvm.stackEntryNumber': + return parseObject(x.number); + case 'tvm.numberDecimal': + return BigInt(x.number); default: - throw Error("Unsupported item type: " + s["@type"]); + throw Error('Unsupported item type: ' + typeName); } } @@ -370,14 +376,7 @@ function parseStackItem(s: any): TupleItem { } else if (s[0] === 'builder') { return { type: 'builder', cell: Cell.fromBoc(Buffer.from(s[1].bytes, 'base64'))[0] }; } else if (s[0] === 'tuple' || s[0] === 'list') { - // toncenter.com missbehaviour - if (s[1].elements.length === 0) { - return { type: 'null' }; - } - return { - type: s[0], - items: s[1].elements.map(parseStackEntry) - }; + return { type: 'tuple', items: s[1].elements.map(parseObject) }; } else { throw Error('Unsupported stack item type: ' + s[0]) }