-
Notifications
You must be signed in to change notification settings - Fork 210
/
options.go
46 lines (37 loc) · 945 Bytes
/
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
package sdk
import (
"github.com/spacemeshos/go-scale"
"github.com/spacemeshos/go-spacemesh/common/types"
"github.com/spacemeshos/go-spacemesh/genvm/core"
)
// Opt modifies Options.
type Opt func(*Options)
// Defaults returns default Options.
func Defaults() *Options {
return &Options{GasPrice: 1}
}
// Options to modify common transaction fields.
type Options struct {
GasPrice uint64
GenesisID types.Hash20
}
// WithGasPrice modifies GasPrice.
func WithGasPrice(price uint64) Opt {
return func(opts *Options) {
opts.GasPrice = price
}
}
// WithGenesisID updates genesis id that will be used to prefix tx hash.
func WithGenesisID(id types.Hash20) Opt {
return func(opts *Options) {
opts.GenesisID = id
}
}
var (
// TxVersion is the only version supported at genesis.
TxVersion = scale.U8(0)
// MethodSpawn ...
MethodSpawn = scale.U8(core.MethodSpawn)
// MethodSpend ...
MethodSpend = scale.U8(core.MethodSpend)
)