Skip to content

Commit

Permalink
update import fee type
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-tron committed Jul 3, 2024
1 parent 094eae0 commit 38d019f
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 54 deletions.
48 changes: 0 additions & 48 deletions abi/generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -729,31 +729,6 @@ func TestMessageDecoder(t *testing.T) {
},
},

{
name: "storm vault transfer notification",
interfaces: []ContractInterface{StormVault},
wantOpName: "StormVaultTransferNotification",
boc: "te6ccuECAgEAAKYAAG4BTAFoc2LQnAAAErtGYPwoYWq03FYgCADY/t9qBwnVPjVeVntDbe2WP/YtNjjUoOOyThl+J1hcfwEA2SWThWGACd2SQ3OpqtQbKM7ALak4TWc2OvIDT8KnzMBn4o1BEN6ID7NXxQAbH9vtQOE6p8arys9obb2yx/7FpscalBx2ScMvxOsLj/ACwiRZrfUSlMM0dz+Hm4KW1IqaFz1Pwxg3+t0jQDt36qLHweyx",
wantValidate: func(t *testing.T, value any) {
body := StormVaultTransferNotificationMsgBody{
QueryId: 20595548945448,
Amount: 24925000000000,
Sender: value.(StormVaultTransferNotificationMsgBody).Sender,
ForwardPayload: tlb.EitherRef[NotificationPayload]{
IsRight: true,
Value: NotificationPayload{
Opcode: 2707654454786252178,
},
},
}

if !reflect.DeepEqual(value, body) {
t.Fatalf("got: %v, want: %v", value, body)
}

},
},

{
name: "storm vault stake",
interfaces: []ContractInterface{StormVault},
Expand Down Expand Up @@ -850,29 +825,6 @@ func TestMessageDecoder(t *testing.T) {
},
},

{
name: "storm nft item transfer",
interfaces: []ContractInterface{StormReferral},
wantOpName: "StormNftItemTransfer",
boc: "te6ccuEBAQEAUgCkAJ9fzD0UAAAAAAAAAACAF5HV1dlKRs28pyDBur1/dcMC030CGfYtGb7zi6MogBbwAmzTV8CyM5p8IDBk2E/NonjbGBcQOkO5BOJIGDzBQHAgCHS8k3s=",
wantValidate: func(t *testing.T, value any) {

body := StormNftItemTransferMsgBody{
QueryId: 0,
NewOwner: value.(StormNftItemTransferMsgBody).NewOwner,
ResponseDestination: value.(StormNftItemTransferMsgBody).ResponseDestination,
CustomPayload: value.(StormNftItemTransferMsgBody).CustomPayload,
ForwardAmount: 0,
ForwardPayload: value.(StormNftItemTransferMsgBody).ForwardPayload,
}

if !reflect.DeepEqual(value, body) {
t.Fatalf("got: %v, want: %v", value, body)
}

},
},

{
name: "storm withdraw referral amount",
interfaces: []ContractInterface{StormReferral},
Expand Down
2 changes: 1 addition & 1 deletion block.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func ToBlockId(s tlb.ShardDesc, workchain int32) BlockIDExt {
return ton.ToBlockId(s, workchain)
}

func CreateExternalMessage(address AccountID, body *boc.Cell, init *tlb.StateInit, importFee tlb.Grams) (tlb.Message, error) {
func CreateExternalMessage(address AccountID, body *boc.Cell, init *tlb.StateInit, importFee tlb.VarUInteger16) (tlb.Message, error) {
return ton.CreateExternalMessage(address, body, init, importFee)
}

Expand Down
2 changes: 1 addition & 1 deletion tlb/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ type CommonMsgInfo struct {
ExtInMsgInfo *struct {
Src MsgAddress
Dest MsgAddress
ImportFee Grams
ImportFee VarUInteger16
} `tlbSumType:"ext_in_msg_info$10"`
ExtOutMsgInfo *struct {
Src MsgAddress
Expand Down
4 changes: 2 additions & 2 deletions ton/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,15 @@ func ToBlockId(s tlb.ShardDesc, workchain int32) BlockIDExt {
}
}

func CreateExternalMessage(address AccountID, body *boc.Cell, init *tlb.StateInit, importFee tlb.Grams) (tlb.Message, error) {
func CreateExternalMessage(address AccountID, body *boc.Cell, init *tlb.StateInit, importFee tlb.VarUInteger16) (tlb.Message, error) {
// TODO: add either selection algorithm
var msg = tlb.Message{
Info: tlb.CommonMsgInfo{
SumType: "ExtInMsgInfo",
ExtInMsgInfo: &struct {
Src tlb.MsgAddress
Dest tlb.MsgAddress
ImportFee tlb.Grams
ImportFee tlb.VarUInteger16
}{
Src: (*AccountID)(nil).ToMsgAddress(),
Dest: address.ToMsgAddress(),
Expand Down
2 changes: 1 addition & 1 deletion tontest/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func (b messageBuilder) Message() (tlb.Message, error) {
m.Info.SumType = "ExtInMsgInfo"
m.Info.ExtInMsgInfo = &struct {
Src, Dest tlb.MsgAddress
ImportFee tlb.Grams
ImportFee tlb.VarUInteger16
}{Src: tlb.MsgAddress{SumType: "AddrNone"}, Dest: b.to.ToMsgAddress()}
case Internal:
m.Info.SumType = "IntMsgInfo"
Expand Down
2 changes: 1 addition & 1 deletion wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func (w *Wallet) RawSendV2(
if err != nil {
return ton.Bits256{}, fmt.Errorf("can not marshal wallet message body: %v", err)
}
extMsg, err := ton.CreateExternalMessage(w.address, signedBodyCell, init, 0)
extMsg, err := ton.CreateExternalMessage(w.address, signedBodyCell, init, tlb.VarUInteger16{})
if err != nil {
return ton.Bits256{}, fmt.Errorf("can not create external message: %v", err)
}
Expand Down

0 comments on commit 38d019f

Please sign in to comment.