From c8c6ea1c6bd1338335fe18f16a57a3babe4dace1 Mon Sep 17 00:00:00 2001 From: Zakhar Petukhov Date: Fri, 21 Jul 2023 16:44:32 +0700 Subject: [PATCH] create dns known xml --- abi/get_methods.go | 130 +++++++++++++++++++++++++++++++++++++++--- abi/messages.go | 37 ++++++++++++ abi/ordering.go | 24 ++++++-- abi/schemas/dns.xml | 64 +++++++++++++++++++++ abi/schemas/known.xml | 27 --------- abi/types.go | 20 +++++++ 6 files changed, 263 insertions(+), 39 deletions(-) create mode 100644 abi/schemas/dns.xml diff --git a/abi/get_methods.go b/abi/get_methods.go index 2a798577..7c8f7310 100644 --- a/abi/get_methods.go +++ b/abi/get_methods.go @@ -1,12 +1,14 @@ package abi -// Code autogenerated. DO NOT EDIT. + +// Code autogenerated. DO NOT EDIT. import ( -"context" -"fmt" -"github.com/tonkeeper/tongo" -"github.com/tonkeeper/tongo/boc" -"github.com/tonkeeper/tongo/tlb" + "context" + "fmt" + + "github.com/tonkeeper/tongo" + "github.com/tonkeeper/tongo/boc" + "github.com/tonkeeper/tongo/tlb" ) var KnownGetMethodsDecoder = map[string][]func(tlb.VmStack) (string, any, error){ @@ -17,6 +19,9 @@ var KnownGetMethodsDecoder = map[string][]func(tlb.VmStack) (string, any, error) "get_channel_state": {DecodeGetChannelStateResult}, "get_collection_data": {DecodeGetCollectionDataResult}, "get_domain": {DecodeGetDomainResult}, + "get_domain_auction_info": {DecodeGetDomainAuctionInfoResult}, + "get_domain_data": {DecodeGetDomainDataResult}, + "get_domain_editor": {DecodeGetDomainEditorResult}, "get_editor": {DecodeGetEditorResult}, "get_full_domain": {DecodeGetFullDomainResult}, "get_jetton_data": {DecodeGetJettonDataResult}, @@ -60,9 +65,11 @@ var KnownGetMethodsDecoder = map[string][]func(tlb.VmStack) (string, any, error) var KnownSimpleGetMethods = map[int][]func(ctx context.Context, executor Executor, reqAccountID tongo.AccountID) (string, any, error){ 66763: {GetFullDomain}, + 67859: {GetDomainAuctionInfo}, 69506: {GetTelemintTokenName}, 71463: {GetTorrentHash}, 72748: {GetSaleData}, + 72859: {GetDomainData}, 78748: {GetPublicKey}, 80697: {GetAuctionInfo}, 81467: {GetSubwalletId}, @@ -92,6 +99,7 @@ var KnownSimpleGetMethods = map[int][]func(ctx context.Context, executor Executo 119378: {GetDomain}, 120146: {GetPoolStatus}, 122058: {IsActive}, + 122184: {GetDomainEditor}, 122498: {GetTelemintAuctionState}, 123928: {GetStakingStatus}, 129619: {GetTelemintAuctionConfig}, @@ -106,6 +114,9 @@ var ResultTypes = []interface{}{ &GetBillAmountResult{}, &GetChannelStateResult{}, &GetCollectionDataResult{}, + &GetDomainAuctionInfoResult{}, + &GetDomainDataResult{}, + &GetDomainEditorResult{}, &GetDomainResult{}, &GetEditorResult{}, &GetFullDomainResult{}, @@ -402,6 +413,111 @@ func DecodeGetDomainResult(stack tlb.VmStack) (resultType string, resultAny any, return "GetDomainResult", result, err } +type GetDomainAuctionInfoResult struct { + MaxBidAddress []byte + MaxBidAmount tlb.Int256 + AuctionEndTime int64 +} + +func GetDomainAuctionInfo(ctx context.Context, executor Executor, reqAccountID tongo.AccountID) (string, any, error) { + stack := tlb.VmStack{} + + // MethodID = 67859 for "get_domain_auction_info" method + errCode, stack, err := executor.RunSmcMethodByID(ctx, reqAccountID, 67859, 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){DecodeGetDomainAuctionInfoResult} { + s, r, err := f(stack) + if err == nil { + return s, r, nil + } + } + return "", nil, fmt.Errorf("can not decode outputs") +} + +func DecodeGetDomainAuctionInfoResult(stack tlb.VmStack) (resultType string, resultAny any, err error) { + if len(stack) != 3 || (stack[0].SumType != "VmStkSlice") || (stack[1].SumType != "VmStkTinyInt" && stack[1].SumType != "VmStkInt") || (stack[2].SumType != "VmStkTinyInt" && stack[2].SumType != "VmStkInt") { + return "", nil, fmt.Errorf("invalid stack format") + } + var result GetDomainAuctionInfoResult + err = stack.Unmarshal(&result) + return "GetDomainAuctionInfoResult", result, err +} + +type GetDomainDataResult struct { + Init tlb.Int256 + Index tlb.Int256 + CollectionAddress []byte + OwnerAddress []byte + Content []byte +} + +func GetDomainData(ctx context.Context, executor Executor, reqAccountID tongo.AccountID) (string, any, error) { + stack := tlb.VmStack{} + + // MethodID = 72859 for "get_domain_data" method + errCode, stack, err := executor.RunSmcMethodByID(ctx, reqAccountID, 72859, 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){DecodeGetDomainDataResult} { + s, r, err := f(stack) + if err == nil { + return s, r, nil + } + } + return "", nil, fmt.Errorf("can not decode outputs") +} + +func DecodeGetDomainDataResult(stack tlb.VmStack) (resultType string, resultAny any, err error) { + if len(stack) < 5 || (stack[0].SumType != "VmStkTinyInt" && stack[0].SumType != "VmStkInt") || (stack[1].SumType != "VmStkTinyInt" && stack[1].SumType != "VmStkInt") || (stack[2].SumType != "VmStkSlice") || (stack[3].SumType != "VmStkSlice") || (stack[4].SumType != "VmStkCell") { + return "", nil, fmt.Errorf("invalid stack format") + } + var result GetDomainDataResult + err = stack.Unmarshal(&result) + return "GetDomainDataResult", result, err +} + +type GetDomainEditorResult struct { + OwnerAddress []byte +} + +func GetDomainEditor(ctx context.Context, executor Executor, reqAccountID tongo.AccountID) (string, any, error) { + stack := tlb.VmStack{} + + // MethodID = 122184 for "get_domain_editor" method + errCode, stack, err := executor.RunSmcMethodByID(ctx, reqAccountID, 122184, 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){DecodeGetDomainEditorResult} { + s, r, err := f(stack) + if err == nil { + return s, r, nil + } + } + return "", nil, fmt.Errorf("can not decode outputs") +} + +func DecodeGetDomainEditorResult(stack tlb.VmStack) (resultType string, resultAny any, err error) { + if len(stack) < 1 || (stack[0].SumType != "VmStkSlice") { + return "", nil, fmt.Errorf("invalid stack format") + } + var result GetDomainEditorResult + err = stack.Unmarshal(&result) + return "GetDomainEditorResult", result, err +} + type GetEditorResult struct { Editor tlb.MsgAddress } @@ -2000,5 +2116,3 @@ func DecodeSeqnoResult(stack tlb.VmStack) (resultType string, resultAny any, err err = stack.Unmarshal(&result) return "SeqnoResult", result, err } - - diff --git a/abi/messages.go b/abi/messages.go index fad162ed..bf16c7de 100644 --- a/abi/messages.go +++ b/abi/messages.go @@ -4,6 +4,7 @@ package abi import ( "fmt" + "github.com/tonkeeper/tongo/boc" "github.com/tonkeeper/tongo/tlb" ) @@ -106,6 +107,12 @@ func MessageDecoder(cell *boc.Cell) (MsgOpName, any, error) { return JettonInternalTransferMsgOp, nil, err } return JettonInternalTransferMsgOp, res, nil + case EditContentMsgOpCode: // 0x1a0b9d51 + var res EditContentMsgBody + if err := tlb.Unmarshal(cell, &res); err != nil { + return EditContentMsgOp, nil, err + } + return EditContentMsgOp, res, nil case WhalesNominatorsWithdrawUnownedResponseMsgOpCode: // 0x1d1715bf var res WhalesNominatorsWithdrawUnownedResponseMsgBody if err := tlb.Unmarshal(cell, &res); err != nil { @@ -208,6 +215,12 @@ func MessageDecoder(cell *boc.Cell) (MsgOpName, any, error) { return ProofStorageMsgOp, nil, err } return ProofStorageMsgOp, res, nil + case ProcessGovernanceDecisionMsgOpCode: // 0x44beae41 + var res ProcessGovernanceDecisionMsgBody + if err := tlb.Unmarshal(cell, &res); err != nil { + return ProcessGovernanceDecisionMsgOp, nil, err + } + return ProcessGovernanceDecisionMsgOp, res, nil case TelemintDeployMsgOpCode: // 0x4637289a var res TelemintDeployMsgBody if err := tlb.Unmarshal(cell, &res); err != nil { @@ -256,6 +269,18 @@ func MessageDecoder(cell *boc.Cell) (MsgOpName, any, error) { return ElectorNewStakeMsgOp, nil, err } return ElectorNewStakeMsgOp, res, nil + case ChangeDnsRecordMsgOpCode: // 0x4eb1f0f9 + var res ChangeDnsRecordMsgBody + if err := tlb.Unmarshal(cell, &res); err != nil { + return ChangeDnsRecordMsgOp, nil, err + } + return ChangeDnsRecordMsgOp, res, nil + case DnsBalanceReleaseMsgOpCode: // 0x4ed14b65 + var res DnsBalanceReleaseMsgBody + if err := tlb.Unmarshal(cell, &res); err != nil { + return DnsBalanceReleaseMsgOp, nil, err + } + return DnsBalanceReleaseMsgOp, res, nil case UpdatePubkeyMsgOpCode: // 0x53f34cd6 var res UpdatePubkeyMsgBody if err := tlb.Unmarshal(cell, &res); err != nil { @@ -654,6 +679,7 @@ const ( WhalesNominatorsForceKickMsgOp MsgOpName = "WhalesNominatorsForceKick" TonstakeControllerCreditMsgOp MsgOpName = "TonstakeControllerCredit" JettonInternalTransferMsgOp MsgOpName = "JettonInternalTransfer" + EditContentMsgOp MsgOpName = "EditContent" WhalesNominatorsWithdrawUnownedResponseMsgOp MsgOpName = "WhalesNominatorsWithdrawUnownedResponse" SbtDestroyMsgOp MsgOpName = "SbtDestroy" StartUncooperativeChannelCloseMsgOp MsgOpName = "StartUncooperativeChannelClose" @@ -670,6 +696,7 @@ const ( TonstakePoolWithdrawMsgOp MsgOpName = "TonstakePoolWithdraw" TeleitemCancelAuctionMsgOp MsgOpName = "TeleitemCancelAuction" ProofStorageMsgOp MsgOpName = "ProofStorage" + ProcessGovernanceDecisionMsgOp MsgOpName = "ProcessGovernanceDecision" TelemintDeployMsgOp MsgOpName = "TelemintDeploy" TelemintDeployV2MsgOp MsgOpName = "TelemintDeployV2" StorageWithdrawMsgOp MsgOpName = "StorageWithdraw" @@ -678,6 +705,8 @@ const ( TeleitemStartAuctionMsgOp MsgOpName = "TeleitemStartAuction" TonstakePoolTouchMsgOp MsgOpName = "TonstakePoolTouch" ElectorNewStakeMsgOp MsgOpName = "ElectorNewStake" + ChangeDnsRecordMsgOp MsgOpName = "ChangeDnsRecord" + DnsBalanceReleaseMsgOp MsgOpName = "DnsBalanceRelease" UpdatePubkeyMsgOp MsgOpName = "UpdatePubkey" UpdateStorageParamsMsgOp MsgOpName = "UpdateStorageParams" TonstakeImanagerOperationFeeMsgOp MsgOpName = "TonstakeImanagerOperationFee" @@ -760,6 +789,7 @@ const ( WhalesNominatorsForceKickMsgOpCode MsgOpCode = 0x1596920c TonstakeControllerCreditMsgOpCode MsgOpCode = 0x1690c604 JettonInternalTransferMsgOpCode MsgOpCode = 0x178d4519 + EditContentMsgOpCode MsgOpCode = 0x1a0b9d51 WhalesNominatorsWithdrawUnownedResponseMsgOpCode MsgOpCode = 0x1d1715bf SbtDestroyMsgOpCode MsgOpCode = 0x1f04537a StartUncooperativeChannelCloseMsgOpCode MsgOpCode = 0x1f151acf @@ -776,6 +806,7 @@ const ( TonstakePoolWithdrawMsgOpCode MsgOpCode = 0x319b0cdc TeleitemCancelAuctionMsgOpCode MsgOpCode = 0x371638ae ProofStorageMsgOpCode MsgOpCode = 0x419d5d4d + ProcessGovernanceDecisionMsgOpCode MsgOpCode = 0x44beae41 TelemintDeployMsgOpCode MsgOpCode = 0x4637289a TelemintDeployV2MsgOpCode MsgOpCode = 0x4637289b StorageWithdrawMsgOpCode MsgOpCode = 0x46ed2e94 @@ -784,6 +815,8 @@ const ( TeleitemStartAuctionMsgOpCode MsgOpCode = 0x487a8e81 TonstakePoolTouchMsgOpCode MsgOpCode = 0x4bc7c2df ElectorNewStakeMsgOpCode MsgOpCode = 0x4e73744b + ChangeDnsRecordMsgOpCode MsgOpCode = 0x4eb1f0f9 + DnsBalanceReleaseMsgOpCode MsgOpCode = 0x4ed14b65 UpdatePubkeyMsgOpCode MsgOpCode = 0x53f34cd6 UpdateStorageParamsMsgOpCode MsgOpCode = 0x54cbf19b TonstakeImanagerOperationFeeMsgOpCode MsgOpCode = 0x54d37487 @@ -863,6 +896,7 @@ var KnownMsgTypes = map[string]any{ WhalesNominatorsForceKickMsgOp: WhalesNominatorsForceKickMsgBody{}, TonstakeControllerCreditMsgOp: TonstakeControllerCreditMsgBody{}, JettonInternalTransferMsgOp: JettonInternalTransferMsgBody{}, + EditContentMsgOp: EditContentMsgBody{}, WhalesNominatorsWithdrawUnownedResponseMsgOp: WhalesNominatorsWithdrawUnownedResponseMsgBody{}, SbtDestroyMsgOp: SbtDestroyMsgBody{}, StartUncooperativeChannelCloseMsgOp: StartUncooperativeChannelCloseMsgBody{}, @@ -879,6 +913,7 @@ var KnownMsgTypes = map[string]any{ TonstakePoolWithdrawMsgOp: TonstakePoolWithdrawMsgBody{}, TeleitemCancelAuctionMsgOp: TeleitemCancelAuctionMsgBody{}, ProofStorageMsgOp: ProofStorageMsgBody{}, + ProcessGovernanceDecisionMsgOp: ProcessGovernanceDecisionMsgBody{}, TelemintDeployMsgOp: TelemintDeployMsgBody{}, TelemintDeployV2MsgOp: TelemintDeployV2MsgBody{}, StorageWithdrawMsgOp: StorageWithdrawMsgBody{}, @@ -887,6 +922,8 @@ var KnownMsgTypes = map[string]any{ TeleitemStartAuctionMsgOp: TeleitemStartAuctionMsgBody{}, TonstakePoolTouchMsgOp: TonstakePoolTouchMsgBody{}, ElectorNewStakeMsgOp: ElectorNewStakeMsgBody{}, + ChangeDnsRecordMsgOp: ChangeDnsRecordMsgBody{}, + DnsBalanceReleaseMsgOp: DnsBalanceReleaseMsgBody{}, UpdatePubkeyMsgOp: UpdatePubkeyMsgBody{}, UpdateStorageParamsMsgOp: UpdateStorageParamsMsgBody{}, TonstakeImanagerOperationFeeMsgOp: TonstakeImanagerOperationFeeMsgBody{}, diff --git a/abi/ordering.go b/abi/ordering.go index bd2b5991..72df95b7 100644 --- a/abi/ordering.go +++ b/abi/ordering.go @@ -1,11 +1,12 @@ package abi -// Code autogenerated. DO NOT EDIT. + +// Code autogenerated. DO NOT EDIT. import ( -"context" -"github.com/tonkeeper/tongo" -) + "context" + "github.com/tonkeeper/tongo" +) type ContractInterface string @@ -83,6 +84,21 @@ var methodInvocationOrder = []MethodDescription{ InvokeFn: GetDomain, ImplementedBy: []ContractInterface{Domain}, }, + { + Name: "get_domain_auction_info", + InvokeFn: GetDomainAuctionInfo, + ImplementedBy: []ContractInterface{Domain}, + }, + { + Name: "get_domain_data", + InvokeFn: GetDomainData, + ImplementedBy: []ContractInterface{Domain}, + }, + { + Name: "get_domain_editor", + InvokeFn: GetDomainEditor, + ImplementedBy: []ContractInterface{Domain}, + }, { Name: "get_editor", InvokeFn: GetEditor, diff --git a/abi/schemas/dns.xml b/abi/schemas/dns.xml new file mode 100644 index 00000000..e77941c7 --- /dev/null +++ b/abi/schemas/dns.xml @@ -0,0 +1,64 @@ + + + release_balance#4ed14b65 query_id:uint64 = InternalMsgBody; + + + change_dns_record#4eb1f0f9 query_id:uint64 key:uint256 has_value:Bool value:^Cell = InternalMsgBody; + + + edit_content#1a0b9d51 query_id:uint64 content:^Cell = InternalMsgBody; + + + transfer#5fcc3d14 query_id:uint64 = InternalMsgBody; + + + process_governance_decision#44beae41 query_id:uint64 = InternalMsgBody; + + + + + []byte + int257 + + + int64 + DNS_RecordSet + + + + + int64 + + + + + string + + + + + string + + + + + []byte + int256 + int64 + + + + + int256 + int256 + []byte + []byte + []byte + + + + + []byte + + + \ No newline at end of file diff --git a/abi/schemas/known.xml b/abi/schemas/known.xml index 83497bb6..c3dafc88 100644 --- a/abi/schemas/known.xml +++ b/abi/schemas/known.xml @@ -196,33 +196,6 @@ - - - - []byte - int257 - - - int64 - DNS_RecordSet - - - - - int64 - - - - - string - - - - - string - - - diff --git a/abi/types.go b/abi/types.go index b92e8b2d..5c0ee9c6 100644 --- a/abi/types.go +++ b/abi/types.go @@ -250,6 +250,11 @@ type JettonInternalTransferMsgBody struct { ForwardTonAmount tlb.VarUInteger16 } +type EditContentMsgBody struct { + QueryId uint64 + Content tlb.Ref[tlb.Any] +} + type WhalesNominatorsWithdrawUnownedResponseMsgBody struct { QueryId uint64 } @@ -337,6 +342,10 @@ type ProofStorageMsgBody struct { FileDictProof tlb.Ref[tlb.Any] } +type ProcessGovernanceDecisionMsgBody struct { + QueryId uint64 +} + type TelemintDeployMsgBody struct { Sig tlb.Bits512 Msg TelemintUnsignedDeploy @@ -377,6 +386,17 @@ type ElectorNewStakeMsgBody struct { Signature tlb.Ref[tlb.Bits512] } +type ChangeDnsRecordMsgBody struct { + QueryId uint64 + Key tlb.Uint256 + HasValue bool + Value tlb.Ref[tlb.Any] +} + +type DnsBalanceReleaseMsgBody struct { + QueryId uint64 +} + type UpdatePubkeyMsgBody struct { QueryId uint64 NewPubkey tlb.Bits256