-
Notifications
You must be signed in to change notification settings - Fork 3
/
manual_test_kms.nu
59 lines (47 loc) · 1.57 KB
/
manual_test_kms.nu
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
## Setup dependencies in different terminals:
## DB
# docker run --rm -e POSTGRES_HOST_AUTH_METHOD=trust -p 5432:5432 postgres
## Can connect to using psql postgres://postgres:postgres@127.0.0.1:5432/database
## TxSitter
# cargo watch -x run
## or just
# cargo run
echo "Start"
let txSitter = "http://127.0.0.1:3000"
http post -t application/json $"($txSitter)/1/admin/network/11155111" {
name: "Ethereum Sepolia",
httpRpc: $env.SEPOLIA_HTTP_RPC,
wsRpc: $env.SEPOLIA_WS_RPC,
}
echo "Creating relayer"
let relayer = http post -t application/json $"($txSitter)/1/admin/relayer" { "name": "My Relayer", "chainId": 11155111 }
http post -t application/json $"($txSitter)/1/admin/relayer/($relayer.relayerId)" {
gasPriceLimits: [
{ chainId: 11155111, value: "0x123" }
]
}
echo "Create api key"
let apiKey = http post $"($txSitter)/1/admin/relayer/($relayer.relayerId)/key" ""
$env.ETH_RPC_URL = $"($txSitter)/1/api/($apiKey.apiKey)/rpc"
echo "Funding relayer"
cast send --private-key $env.PRIVATE_KEY --value 1ether $relayer.address ''
echo "Sending transaction"
let tx = http post -t application/json $"($txSitter)/1/api/($apiKey.apiKey)/tx" {
"relayerId": $relayer.relayerId,
"to": $relayer.address,
"value": "10",
"data": ""
"gasLimit": "150000"
}
echo "Wait until tx is mined"
for i in 0..100 {
let txResponse = http get $"($txSitter)/1/api/($apiKey.apiKey)/tx/($tx.txId)"
if ($txResponse | get -i status) == "mined" {
echo $txResponse
break
} else {
echo $txResponse
sleep 1sec
}
}
echo "Success!"