diff --git a/example/highload-wallet/main.go b/example/highload-wallet/main.go index 3bb8f32e..883a9b82 100644 --- a/example/highload-wallet/main.go +++ b/example/highload-wallet/main.go @@ -84,7 +84,7 @@ func main() { for addrStr, amtStr := range receivers { addr := address.MustParseAddr(addrStr) messages = append(messages, &wallet.Message{ - Mode: 1 + 2, // pay fee separately, ignore action errors + Mode: wallet.PayGasSeparately + wallet.IgnoreErrors, // pay fee separately, ignore action errors InternalMessage: &tlb.InternalMessage{ IHRDisabled: true, // disable hyper routing (currently not works in ton) Bounce: addr.IsBounceable(), diff --git a/example/send-to-contract/main.go b/example/send-to-contract/main.go index 41163a44..5ea514ac 100644 --- a/example/send-to-contract/main.go +++ b/example/send-to-contract/main.go @@ -82,7 +82,7 @@ func main() { log.Println("sending transaction and waiting for confirmation...") tx, block, err := w.SendWaitTransaction(context.Background(), &wallet.Message{ - Mode: 1, // pay fees separately (from balance, not from amount) + Mode: wallet.PayGasSeparately, // pay fees separately (from balance, not from amount) InternalMessage: &tlb.InternalMessage{ Bounce: true, // return amount in case of processing error DstAddr: address.MustParseAddr("EQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N"), diff --git a/ton/wallet/highloadv3.go b/ton/wallet/highloadv3.go index 8080d04c..ead72ca0 100644 --- a/ton/wallet/highloadv3.go +++ b/ton/wallet/highloadv3.go @@ -124,7 +124,7 @@ func (s *SpecHighloadV3) packActions(queryId uint64, messages []*Message) (_ *Me } return &Message{ - Mode: 1 + 2, + Mode: PayGasSeparately + IgnoreErrors, InternalMessage: &tlb.InternalMessage{ IHRDisabled: true, Bounce: false, diff --git a/ton/wallet/wallet.go b/ton/wallet/wallet.go index 993770f1..e571935d 100644 --- a/ton/wallet/wallet.go +++ b/ton/wallet/wallet.go @@ -44,6 +44,14 @@ const ( Unknown Version = 0 ) +const ( + CarryAllRemainingBalance = 128 + CarryAllRemainingIncomingValue = 64 + DestroyAccountIfZero = 32 + IgnoreErrors = 2 + PayGasSeparately = 1 +) + func (v Version) String() string { if v == Unknown { return "unknown" @@ -367,7 +375,7 @@ func (w *Wallet) BuildTransfer(to *address.Address, amount tlb.Coins, bounce boo } return &Message{ - Mode: 1 + 2, + Mode: PayGasSeparately + IgnoreErrors, InternalMessage: &tlb.InternalMessage{ IHRDisabled: true, Bounce: bounce, @@ -393,7 +401,7 @@ func (w *Wallet) BuildTransferEncrypted(ctx context.Context, to *address.Address } return &Message{ - Mode: 1 + 2, + Mode: PayGasSeparately + IgnoreErrors, InternalMessage: &tlb.InternalMessage{ IHRDisabled: true, Bounce: bounce, @@ -734,7 +742,7 @@ func (w *Wallet) DeployContractWaitTransaction(ctx context.Context, amount tlb.C addr := address.NewAddress(0, 0, stateCell.Hash()) tx, block, err := w.SendWaitTransaction(ctx, &Message{ - Mode: 1 + 2, + Mode: PayGasSeparately + IgnoreErrors, InternalMessage: &tlb.InternalMessage{ IHRDisabled: true, Bounce: false, @@ -765,7 +773,7 @@ func (w *Wallet) DeployContract(ctx context.Context, amount tlb.Coins, msgBody, addr := address.NewAddress(0, 0, stateCell.Hash()) if err = w.Send(ctx, &Message{ - Mode: 1 + 2, + Mode: PayGasSeparately + IgnoreErrors, InternalMessage: &tlb.InternalMessage{ IHRDisabled: true, Bounce: false, @@ -793,7 +801,7 @@ func (w *Wallet) FindTransactionByInMsgHash(ctx context.Context, msgHash []byte, func SimpleMessage(to *address.Address, amount tlb.Coins, payload *cell.Cell) *Message { return &Message{ - Mode: 1 + 2, + Mode: PayGasSeparately + IgnoreErrors, InternalMessage: &tlb.InternalMessage{ IHRDisabled: true, Bounce: true, @@ -807,7 +815,7 @@ func SimpleMessage(to *address.Address, amount tlb.Coins, payload *cell.Cell) *M // SimpleMessageAutoBounce - will determine bounce flag from address func SimpleMessageAutoBounce(to *address.Address, amount tlb.Coins, payload *cell.Cell) *Message { return &Message{ - Mode: 1 + 2, + Mode: PayGasSeparately + IgnoreErrors, InternalMessage: &tlb.InternalMessage{ IHRDisabled: true, Bounce: to.IsBounceable(), diff --git a/ton/wallet/wallet_test.go b/ton/wallet/wallet_test.go index 0d8fae55..47aca381 100644 --- a/ton/wallet/wallet_test.go +++ b/ton/wallet/wallet_test.go @@ -258,7 +258,7 @@ func TestWallet_Send(t *testing.T) { } msg := &Message{ - Mode: 128, + Mode: CarryAllRemainingBalance, InternalMessage: intMsg, }