-
Notifications
You must be signed in to change notification settings - Fork 3
/
options.go
executable file
·50 lines (42 loc) · 998 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
47
48
49
50
/*
Copyright (C) CESS. All rights reserved.
Copyright (C) Cumulus Encrypted Storage System. All rights reserved.
SPDX-License-Identifier: Apache-2.0
*/
package sdkgo
import (
"time"
"github.com/CESSProject/cess-go-sdk/chain"
)
// ConnectRpcAddrs configuration rpc address
func ConnectRpcAddrs(s []string) Option {
return func(cfg *Config) error {
cfg.Rpc = s
return nil
}
}
// Mnemonic configures the mnemonic of the signature account
func Mnemonic(mnemonic string) Option {
return func(cfg *Config) error {
cfg.Mnemonic = mnemonic
return nil
}
}
// TransactionTimeout configures the waiting timeout for a transaction
func TransactionTimeout(timeout time.Duration) Option {
return func(cfg *Config) error {
if timeout < chain.BlockInterval {
cfg.Timeout = chain.BlockInterval
} else {
cfg.Timeout = timeout
}
return nil
}
}
// Name configuration sdk name
func Name(name string) Option {
return func(cfg *Config) error {
cfg.Name = name
return nil
}
}