Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added starknet to list of networks #86

Merged
merged 2 commits into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ The below networks are supported by default, and custom networks can be supporte
| Zora Testnet | 999 |
| Flare Mainnet | 14 |
| Pulsechain Mainnet | 369 |
| Starknet | 300 |
| starknet testnet | 301 |

## Installation

Expand Down
2 changes: 2 additions & 0 deletions src/enums/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export enum Networks {
zkSyncEra = 324,
zkSyncEraTestnet = 280,
zkSyncEraSepoliaTestnet = 300,
starknet=300,
starknetTestnet=301,
shibarium = 109,
mantle = 5000,
mantleTestnet = 5001,
Expand Down
16 changes: 10 additions & 6 deletions src/multicall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,13 +421,12 @@ export class Multicall {
calls: AggregateCallContext[],
options: ContractCallOptions
): Promise<AggregateResponse> {
let ethersProvider = this.getTypedOptions<MulticallOptionsEthers>()
.ethersProvider;
let ethersProvider =
this.getTypedOptions<MulticallOptionsEthers>().ethersProvider;

if (!ethersProvider) {
const customProvider = this.getTypedOptions<
MulticallOptionsCustomJsonRpcProvider
>();
const customProvider =
this.getTypedOptions<MulticallOptionsCustomJsonRpcProvider>();
if (customProvider.nodeUrl) {
ethersProvider = new ethers.providers.JsonRpcProvider(
customProvider.nodeUrl
Expand Down Expand Up @@ -531,7 +530,7 @@ export class Multicall {
* Get typed options
*/
private getTypedOptions<T>(): T {
return (this._options as unknown) as T;
return this._options as unknown as T;
}

/**
Expand Down Expand Up @@ -620,6 +619,11 @@ export class Multicall {
return '0xF9cda624FBC7e059355ce98a31693d299FACd963';
case Networks.shibarium:
return '0xd1727fC8F78aBA7DD6294f6033D74c72Ccd3D3B0';
case Networks.starknet:
return '0xc662c410C0ECf747543f5bA90660f6ABeBD9C8c4';
case Networks.starknetTestnet:
return '0xde29d060D45901Fb19ED6C6e959EB22d8626708e';

default:
throw new Error(
`Network - ${network} doesn't have a multicall contract address defined. Please check your network or deploy your own contract on it.`
Expand Down