-
Notifications
You must be signed in to change notification settings - Fork 651
/
wallet_with_options.go
82 lines (70 loc) · 1.62 KB
/
wallet_with_options.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package c
import (
"github.com/ava-labs/coreth/plugin/evm"
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/vms/secp256k1fx"
"github.com/ava-labs/avalanchego/wallet/subnet/primary/common"
ethcommon "github.com/ethereum/go-ethereum/common"
)
var _ Wallet = (*walletWithOptions)(nil)
func NewWalletWithOptions(
wallet Wallet,
options ...common.Option,
) Wallet {
return &walletWithOptions{
Wallet: wallet,
options: options,
}
}
type walletWithOptions struct {
Wallet
options []common.Option
}
func (w *walletWithOptions) Builder() Builder {
return NewBuilderWithOptions(
w.Wallet.Builder(),
w.options...,
)
}
func (w *walletWithOptions) IssueImportTx(
chainID ids.ID,
to ethcommon.Address,
options ...common.Option,
) (*evm.Tx, error) {
return w.Wallet.IssueImportTx(
chainID,
to,
common.UnionOptions(w.options, options)...,
)
}
func (w *walletWithOptions) IssueExportTx(
chainID ids.ID,
outputs []*secp256k1fx.TransferOutput,
options ...common.Option,
) (*evm.Tx, error) {
return w.Wallet.IssueExportTx(
chainID,
outputs,
common.UnionOptions(w.options, options)...,
)
}
func (w *walletWithOptions) IssueUnsignedAtomicTx(
utx evm.UnsignedAtomicTx,
options ...common.Option,
) (*evm.Tx, error) {
return w.Wallet.IssueUnsignedAtomicTx(
utx,
common.UnionOptions(w.options, options)...,
)
}
func (w *walletWithOptions) IssueAtomicTx(
tx *evm.Tx,
options ...common.Option,
) error {
return w.Wallet.IssueAtomicTx(
tx,
common.UnionOptions(w.options, options)...,
)
}