Skip to content

Commit abf5a27

Browse files
committed
request header callback
1 parent 91c998a commit abf5a27

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

web3.nim

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,18 @@ proc newWeb3*(provider: RpcClient): Web3 =
6868
provider.setMethodHandler("eth_subscription") do(j: JsonNode):
6969
r.handleSubscriptionNotification(j)
7070

71-
proc newWeb3*(uri: string): Future[Web3] {.async.} =
71+
proc newWeb3*(
72+
uri: string, getHeaders: GetJsonRpcRequestHeaders = nil):
73+
Future[Web3] {.async.} =
7274
let u = parseUri(uri)
7375
var provider: RpcClient
7476
case u.scheme
7577
of "http", "https":
76-
let p = newRpcHttpClient()
78+
let p = newRpcHttpClient(getHeaders = getHeaders)
7779
await p.connect(uri)
7880
provider = p
7981
of "ws", "wss":
80-
let p = newRpcWebSocketClient()
82+
let p = newRpcWebSocketClient(getHeaders = getHeaders)
8183
await p.connect(uri)
8284
provider = p
8385
else:

0 commit comments

Comments
 (0)