Skip to content

Commit

Permalink
update generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-tron committed Mar 29, 2024
1 parent f73a142 commit 5ea80fd
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 7 deletions.
37 changes: 37 additions & 0 deletions abi/get_methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ var KnownGetMethodsDecoder = map[string][]func(tlb.VmStack) (string, any, error)
"get_wallet_params": {DecodeGetWalletParamsResult},
"is_active": {DecodeIsActiveResult},
"is_plugin_installed": {DecodeIsPluginInstalledResult},
"jetton_wallet_lock_data": {DecodeJettonWalletLockDataResult},
"list_nominators": {DecodeListNominatorsResult},
"list_votes": {DecodeListVotesResult},
"royalty_params": {DecodeRoyaltyParamsResult},
Expand Down Expand Up @@ -122,6 +123,7 @@ var KnownSimpleGetMethods = map[int][]func(ctx context.Context, executor Executo
122498: {GetTelemintAuctionState},
123928: {GetStakingStatus},
128085: {GetRouterData},
128979: {JettonWalletLockData},
129619: {GetTelemintAuctionConfig},
130271: {GetWalletParams},
130309: {ListVotes},
Expand Down Expand Up @@ -187,6 +189,7 @@ var resultTypes = []interface{}{
&GetWalletParamsResult{},
&IsActiveResult{},
&IsPluginInstalledResult{},
&JettonWalletLockDataResult{},
&ListNominatorsResult{},
&ListVotesResult{},
&RoyaltyParamsResult{},
Expand Down Expand Up @@ -2446,6 +2449,40 @@ func DecodeIsPluginInstalledResult(stack tlb.VmStack) (resultType string, result
return "IsPluginInstalledResult", result, err
}

type JettonWalletLockDataResult struct {
FullBalance tlb.Int257
IndividualUnlockTime uint32
}

func JettonWalletLockData(ctx context.Context, executor Executor, reqAccountID ton.AccountID) (string, any, error) {
stack := tlb.VmStack{}

// MethodID = 128979 for "jetton_wallet_lock_data" method
errCode, stack, err := executor.RunSmcMethodByID(ctx, reqAccountID, 128979, stack)
if err != nil {
return "", nil, err
}
if errCode != 0 && errCode != 1 {
return "", nil, fmt.Errorf("method execution failed with code: %v", errCode)
}
for _, f := range []func(tlb.VmStack) (string, any, error){DecodeJettonWalletLockDataResult} {
s, r, err := f(stack)
if err == nil {
return s, r, nil
}
}
return "", nil, fmt.Errorf("can not decode outputs")
}

func DecodeJettonWalletLockDataResult(stack tlb.VmStack) (resultType string, resultAny any, err error) {
if len(stack) < 2 || (stack[0].SumType != "VmStkTinyInt" && stack[0].SumType != "VmStkInt") || (stack[1].SumType != "VmStkTinyInt" && stack[1].SumType != "VmStkInt") {
return "", nil, fmt.Errorf("invalid stack format")
}
var result JettonWalletLockDataResult
err = stack.Unmarshal(&result)
return "JettonWalletLockDataResult", result, err
}

type ListNominatorsResult struct {
Nominators []struct {
Address tlb.Bits256
Expand Down
4 changes: 4 additions & 0 deletions abi/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,10 @@ var methodInvocationOrder = []MethodDescription{
Name: "is_active",
InvokeFn: IsActive,
},
{
Name: "jetton_wallet_lock_data",
InvokeFn: JettonWalletLockData,
},
{
Name: "list_nominators",
InvokeFn: ListNominators,
Expand Down
2 changes: 1 addition & 1 deletion abi/messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The list below contains the supported message operations, their names and opcode
| ChannelCooperativeClose| 0x5577587e |
| ChannelCooperativeCommit| 0x79a126ef |
| CloseStorageContract| 0x79f937ea |
| Credit| 0x1690c604 |
| DedustDepositLiquidityAll| 0xb56b9598 |
| DedustPayout| 0x474f86cf |
| DedustPayoutFromPool| 0xad4eb6f5 |
Expand Down Expand Up @@ -92,7 +93,6 @@ The list below contains the supported message operations, their names and opcode
| TextComment| 0x00000000 |
| TextComment| 0x00000000 |
| TextComment| 0x00000000 |
| TonstakeControllerCredit| 0x1690c604 |
| TonstakeControllerNewStake| 0xe0505d0e |
| TonstakeControllerPoolHalt| 0x139a1b4e |
| TonstakeControllerPoolSendMessage| 0x270695fb |
Expand Down
12 changes: 6 additions & 6 deletions abi/messages_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var (
// 0x1674b0a0
decodeFuncTonstakePayoutMintJettonsMsgBody = decodeMsg(tlb.Tag{Val: 0x1674b0a0, Len: 32}, TonstakePayoutMintJettonsMsgOp, TonstakePayoutMintJettonsMsgBody{})
// 0x1690c604
decodeFuncTonstakeControllerCreditMsgBody = decodeMsg(tlb.Tag{Val: 0x1690c604, Len: 32}, TonstakeControllerCreditMsgOp, TonstakeControllerCreditMsgBody{})
decodeFuncCreditMsgBody = decodeMsg(tlb.Tag{Val: 0x1690c604, Len: 32}, CreditMsgOp, CreditMsgBody{})
// 0x178d4519
decodeFuncJettonInternalTransferMsgBody = decodeMsg(tlb.Tag{Val: 0x178d4519, Len: 32}, JettonInternalTransferMsgOp, JettonInternalTransferMsgBody{})
// 0x1d1715bf
Expand Down Expand Up @@ -294,7 +294,7 @@ var opcodedMsgInDecodeFunctions = map[uint32]msgDecoderFunc{
TonstakePayoutMintJettonsMsgOpCode: decodeFuncTonstakePayoutMintJettonsMsgBody,

// 0x1690c604
TonstakeControllerCreditMsgOpCode: decodeFuncTonstakeControllerCreditMsgBody,
CreditMsgOpCode: decodeFuncCreditMsgBody,

// 0x178d4519
JettonInternalTransferMsgOpCode: decodeFuncJettonInternalTransferMsgBody,
Expand Down Expand Up @@ -628,7 +628,7 @@ const (
TonstakeControllerPoolHaltMsgOp MsgOpName = "TonstakeControllerPoolHalt"
WhalesNominatorsForceKickMsgOp MsgOpName = "WhalesNominatorsForceKick"
TonstakePayoutMintJettonsMsgOp MsgOpName = "TonstakePayoutMintJettons"
TonstakeControllerCreditMsgOp MsgOpName = "TonstakeControllerCredit"
CreditMsgOp MsgOpName = "Credit"
JettonInternalTransferMsgOp MsgOpName = "JettonInternalTransfer"
WhalesNominatorsWithdrawUnownedResponseMsgOp MsgOpName = "WhalesNominatorsWithdrawUnownedResponse"
SbtDestroyMsgOp MsgOpName = "SbtDestroy"
Expand Down Expand Up @@ -751,7 +751,7 @@ const (
TonstakeControllerPoolHaltMsgOpCode MsgOpCode = 0x139a1b4e
WhalesNominatorsForceKickMsgOpCode MsgOpCode = 0x1596920c
TonstakePayoutMintJettonsMsgOpCode MsgOpCode = 0x1674b0a0
TonstakeControllerCreditMsgOpCode MsgOpCode = 0x1690c604
CreditMsgOpCode MsgOpCode = 0x1690c604
JettonInternalTransferMsgOpCode MsgOpCode = 0x178d4519
WhalesNominatorsWithdrawUnownedResponseMsgOpCode MsgOpCode = 0x1d1715bf
SbtDestroyMsgOpCode MsgOpCode = 0x1f04537a
Expand Down Expand Up @@ -955,7 +955,7 @@ type TonstakePayoutMintJettonsMsgBody struct {
Forward tlb.Grams
}

type TonstakeControllerCreditMsgBody struct {
type CreditMsgBody struct {
QueryId uint64
Amount tlb.Grams
}
Expand Down Expand Up @@ -1568,7 +1568,7 @@ var KnownMsgInTypes = map[string]any{
TonstakeControllerPoolHaltMsgOp: TonstakeControllerPoolHaltMsgBody{},
WhalesNominatorsForceKickMsgOp: WhalesNominatorsForceKickMsgBody{},
TonstakePayoutMintJettonsMsgOp: TonstakePayoutMintJettonsMsgBody{},
TonstakeControllerCreditMsgOp: TonstakeControllerCreditMsgBody{},
CreditMsgOp: CreditMsgBody{},
JettonInternalTransferMsgOp: JettonInternalTransferMsgBody{},
WhalesNominatorsWithdrawUnownedResponseMsgOp: WhalesNominatorsWithdrawUnownedResponseMsgBody{},
SbtDestroyMsgOp: SbtDestroyMsgBody{},
Expand Down

0 comments on commit 5ea80fd

Please sign in to comment.