-
Notifications
You must be signed in to change notification settings - Fork 21
/
wallet_v1v2.go
59 lines (48 loc) · 1.28 KB
/
wallet_v1v2.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package wallet
import (
"crypto/ed25519"
"github.com/tonkeeper/tongo/boc"
"github.com/tonkeeper/tongo/tlb"
"github.com/tonkeeper/tongo/ton"
)
type DataV1V2 struct {
Seqno uint32
PublicKey tlb.Bits256
}
type walletV1V2 struct {
version Version
publicKey ed25519.PublicKey
workchain int
}
var _ wallet = &walletV1V2{}
func newWalletV1V2(ver Version, key ed25519.PublicKey, options Options) *walletV1V2 {
workchain := defaultOr(options.Workchain, 0)
return &walletV1V2{
version: ver,
publicKey: key,
workchain: workchain,
}
}
func (w *walletV1V2) generateAddress() (ton.AccountID, error) {
stateInit, err := w.generateStateInit()
if err != nil {
return ton.AccountID{}, err
}
return generateAddress(w.workchain, *stateInit)
}
func (w *walletV1V2) generateStateInit() (*tlb.StateInit, error) {
data := DataV1V2{
Seqno: 0,
PublicKey: publicKeyToBits(w.publicKey),
}
return generateStateInit(w.version, data)
}
func (w *walletV1V2) maxMessageNumber() int {
return 4
}
func (w *walletV1V2) createSignedMsgBodyCell(privateKey ed25519.PrivateKey, internalMessages []RawMessage, msgConfig MessageConfig) (*boc.Cell, error) {
panic("implement me")
}
func (w *walletV1V2) nextMessageParams(state tlb.ShardAccount) (nextMsgParams, error) {
panic("implement me")
}