From 14cdc336edc40f19a2f0d715565d5b4c4a38495b Mon Sep 17 00:00:00 2001 From: "aleksej.paschenko" Date: Wed, 10 Jul 2024 08:24:54 +0300 Subject: [PATCH 1/2] Add CreateMsgBodyWithoutSignature for w5 --- wallet/wallet_v5.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/wallet/wallet_v5.go b/wallet/wallet_v5.go index 4d41b220..f7e2d4f8 100644 --- a/wallet/wallet_v5.go +++ b/wallet/wallet_v5.go @@ -144,6 +144,35 @@ func (w *walletV5R1) NextMessageParams(state tlb.ShardAccount) (NextMsgParams, e return NextMsgParams{Init: init}, nil } +func (w *walletV5R1) CreateMsgBodyWithoutSignature(internalMessages []RawMessage, msgConfig MessageConfig) (*boc.Cell, error) { + actions := make([]W5SendMessageAction, 0, len(internalMessages)) + for _, msg := range internalMessages { + actions = append(actions, W5SendMessageAction{ + Msg: msg.Message, + Mode: msg.Mode, + }) + } + w5Actions := W5Actions(actions) + msg := extV5R1SignedMessage{ + WalletId: w.walletID, + ValidUntil: uint32(msgConfig.ValidUntil.Unix()), + Seqno: msgConfig.Seqno, + Actions: &w5Actions, + } + bodyCell := boc.NewCell() + if err := bodyCell.WriteUint(uint64(msgConfig.V5MsgType), 32); err != nil { + return nil, err + } + if err := tlb.Marshal(bodyCell, msg); err != nil { + return nil, err + } + bytes := [64]byte{} + if err := bodyCell.WriteBytes(bytes[:]); err != nil { + return nil, err + } + return bodyCell, nil +} + // GetW5R1ExtensionsList returns a list of wallet v5 extensions added to a specific wallet. func GetW5R1ExtensionsList(state tlb.ShardAccount, workchain int) (map[ton.AccountID]struct{}, error) { if state.Account.Status() == tlb.AccountActive { From 0d92fa62acf5cda8c7ffed919af5c78a3f37466d Mon Sep 17 00:00:00 2001 From: "aleksej.paschenko" Date: Wed, 10 Jul 2024 08:52:08 +0300 Subject: [PATCH 2/2] Tonconnect to support wallet v5r1 --- tonconnect/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tonconnect/server.go b/tonconnect/server.go index 9be2e811..4b86f79d 100644 --- a/tonconnect/server.go +++ b/tonconnect/server.go @@ -89,7 +89,7 @@ func NewTonConnect(executor abi.Executor, secret string, opts ...Option) (*Serve var knownHashes = make(map[string]wallet.Version) func init() { - for i := wallet.Version(0); i <= wallet.V5Beta; i++ { + for i := wallet.Version(0); i <= wallet.V5R1; i++ { ver := wallet.GetCodeHashByVer(i) knownHashes[hex.EncodeToString(ver[:])] = i }