-
Notifications
You must be signed in to change notification settings - Fork 0
/
interface.go
48 lines (41 loc) · 1.37 KB
/
interface.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
package simulate_tx_api
import "github.com/ThreeAndTwo/simulate-tx-api/providers"
type ISimulate interface {
AddProject(name string) (string, error)
RenameProject(name string) (string, error)
AddForkEnv(chainId, name string) (string, error)
RenameForkEnv(forkId, chainId, name string) (string, error)
DeleteForkEnv(forkId string) (string, error)
SimulateTxForFork(forkId, params string) (string, error)
Simulations(params string) (string, error)
BundledSimulations(params string) (string, error)
ReqJsonRpc(rpc string, params *providers.RpcParams) (string, error)
}
type Simulate struct {
Host string
Account string
Project string
Token string
Tps int
}
type Platform string
const (
SimulateTenderly Platform = "tenderly"
SimulateBlockNative Platform = "blocknative"
SimulateCoinSummer Platform = "coinsummer"
)
func NewSimulate(host, account, project, token string, tps int) *Simulate {
return &Simulate{Host: host, Account: account, Project: project, Token: token, Tps: tps}
}
func (s *Simulate) SimulateGetter(platform Platform) ISimulate {
switch platform {
case SimulateTenderly:
return providers.NewTenderly(s.Account, s.Project, s.Token, s.Tps)
case SimulateBlockNative:
return nil
case SimulateCoinSummer:
return providers.NewPrivateTxSimulator(s.Host, s.Tps)
default:
return providers.NewTenderly(s.Account, s.Project, s.Token, s.Tps)
}
}