Skip to content

How to set seqno when make transfer? #142

Closed Answered by xssnick
lavrd asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, you could use SetCustomSeqnoFetcher hook of wallet spec. It is exists for every wallet version with seqno.

Example for V4R2:

w, err := wallet.FromSeed(api, words, wallet.V4R2)
if err != nil {
	log.Fatalln("FromSeed err:", err.Error())
	return
}

// hooking seqno fetcher
w.GetSpec().(*wallet.SpecV4R2).SetCustomSeqnoFetcher(func() uint32 {
	// get seqno from db or something
	return 77 // seqno
})

// doing transfers as usual, our hook will be called each time when seqno is needed
transfer, err := w.BuildTransfer(addr, tlb.MustFromTON("0.003"), bounce, "Hello from tonutils-go!")
if err != nil {
	log.Fatalln("Transfer err:", err.Error())
	return
}

If you are using wallet V3, then it will be

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lavrd
Comment options

Answer selected by lavrd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants