-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrustSimulation_test.go
More file actions
51 lines (45 loc) · 2.6 KB
/
rustSimulation_test.go
File metadata and controls
51 lines (45 loc) · 2.6 KB
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
package simulate_tx_api
import "testing"
const host = "http://127.0.0.1:10000"
func TestNewSimulate_simulate(t *testing.T) {
tests := []struct {
name string
param string
}{
{
name: "simulation",
param: "{\n \"chainId\": 1,\n \"from\": \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\",\n \"to\": \"0x66fc62c1748e45435b06cf8dd105b73e9855f93e\",\n \"data\": \"0xffa2ca3b44eea7c8e659973cbdf476546e9e6adfd1c580700537e52ba7124933a97904ea000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001d0e30db00300ffffffffffffc02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000186a0\",\n \"gasLimit\": 500000,\n \"value\": \"100000\",\n \"blockNumber\": 16784600\n}",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
simulations, err := NewSimulate(host, "", "", "", 5).SimulateGetter(SimulateCoinSummer).Simulations(tt.param)
if err != nil {
t.Errorf("simulation error: %s", err)
return
}
t.Log(simulations)
})
}
}
func TestNewSimulate_simulateBundle(t *testing.T) {
tests := []struct {
name string
param string
}{
{
name: "simulate-bundle",
param: "[\n {\n \"chainId\": 1,\n \"from\": \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\",\n \"to\": \"0x66fc62c1748e45435b06cf8dd105b73e9855f93e\",\n \"data\": \"0xffa2ca3b44eea7c8e659973cbdf476546e9e6adfd1c580700537e52ba7124933a97904ea000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001d0e30db00300ffffffffffffc02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000186a0\",\n \"gasLimit\": 500000,\n \"value\": \"100000\",\n \"blockNumber\": 16784600\n }\n]",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
simulations, err := NewSimulate(host, "", "", "", 5).SimulateGetter(SimulateCoinSummer).BundledSimulations(tt.param)
if err != nil {
t.Errorf("simulation error: %s", err)
return
}
t.Log(simulations)
})
}
}