Skip to content

Commit

Permalink
custom rpc urls
Browse files Browse the repository at this point in the history
  • Loading branch information
KABBOUCHI committed Aug 8, 2023
1 parent 53a6403 commit 7fadec5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,12 @@ await safe.sendTransaction({
chainId: 137
})
```


```ts
import { setRpcUrls } from '@instadapp/avocado'

setRpcUrls({
137: "https://polygon-rpc.com",
})
```
6 changes: 6 additions & 0 deletions src/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@ export const getRpcProvider = (chainId: number | string) => {
}

return rpcInstances[chainId]
}

export const setRpcUrls = (rpcUrls: { [chainId: number]: string }) => {
Object.assign(RPC_URLS, rpcUrls)

RPC_URLS[AVOCADO_CHAIN_ID] = AVOCADO_RPC
}

0 comments on commit 7fadec5

Please sign in to comment.