Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ton/wallet/highloadv2r2.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type SpecHighloadV2R2 struct {
SpecQuery
}

func (s *SpecHighloadV2R2) BuildMessage(_ context.Context, messages []*Message) (*cell.Cell, error) {
func (s *SpecHighloadV2R2) BuildMessage(ctx context.Context, messages []*Message) (*cell.Cell, error) {
if len(messages) > 254 {
return nil, errors.New("for this type of wallet max 254 messages can be sent in the same time")
}
Expand All @@ -47,7 +47,7 @@ func (s *SpecHighloadV2R2) BuildMessage(_ context.Context, messages []*Message)

var ttl, queryID uint32
if s.customQueryIDFetcher != nil {
ttl, queryID = s.customQueryIDFetcher()
ttl, queryID = s.customQueryIDFetcher(ctx)
} else {
queryID = randUint32()
ttl = uint32(timeNow().Add(time.Duration(s.messagesTTL) * time.Second).UTC().Unix())
Expand Down
8 changes: 7 additions & 1 deletion ton/wallet/regular.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,15 @@ type SpecQuery struct {
// Do not set ttl to high if you are sending many messages,
// unexpired executed messages will be cached in contract,
// and it may become too expensive to make transactions.
customQueryIDFetcher func() (ttl uint32, randPart uint32)
customQueryIDFetcher func(context.Context) (ttl uint32, randPart uint32)
}

func (s *SpecQuery) SetCustomQueryIDFetcher(fetcher func() (ttl uint32, randPart uint32)) {
s.SetCustomQueryIDFetcherWithContext(func(ctx context.Context) (ttl uint32, randPart uint32) {
return fetcher()
})
}

func (s *SpecQuery) SetCustomQueryIDFetcherWithContext(fetcher func(ctx context.Context) (ttl uint32, randPart uint32)) {
s.customQueryIDFetcher = fetcher
}
Loading