Skip to content

Commit

Permalink
Merge pull request #853 from starknet-io/feat/sepolia
Browse files Browse the repository at this point in the history
Sepolia network
  • Loading branch information
tabaktoni authored Dec 11, 2023
2 parents 1d7bd73 + 4f59a8f commit da2db6f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
28 changes: 18 additions & 10 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,19 @@ export const ADDR_BOUND = 2n ** 251n - MAX_STORAGE_ITEM_SIZE;
export enum BaseUrl {
SN_MAIN = 'https://alpha-mainnet.starknet.io',
SN_GOERLI = 'https://alpha4.starknet.io',
SN_SEPOLIA = 'https://alpha-sepolia.starknet.io',
}

export enum NetworkName {
SN_MAIN = 'SN_MAIN',
SN_GOERLI = 'SN_GOERLI',
SN_SEPOLIA = 'SN_SEPOLIA',
}

export enum StarknetChainId {
SN_MAIN = '0x534e5f4d41494e', // encodeShortString('SN_MAIN'),
SN_GOERLI = '0x534e5f474f45524c49', // encodeShortString('SN_GOERLI')
SN_SEPOLIA = '0x534e5f5345504f4c4941', // encodeShortString('SN_SEPOLIA')
}

export enum TransactionHashPrefix {
Expand All @@ -50,14 +53,19 @@ export const UDC = {
ENTRYPOINT: 'deployContract',
};

export const RPC_DEFAULT_VERSION = 'v0_5';
export const RPC_DEFAULT_VERSION = 'v0_6';

export const RPC_GOERLI_NODES = [
`https://starknet-testnet.public.blastapi.io/rpc/${RPC_DEFAULT_VERSION}`,
`https://free-rpc.nethermind.io/goerli-juno/${RPC_DEFAULT_VERSION}`,
];

export const RPC_MAINNET_NODES = [
`https://starknet-mainnet.public.blastapi.io/rpc/${RPC_DEFAULT_VERSION}`,
`https://free-rpc.nethermind.io/mainnet-juno/${RPC_DEFAULT_VERSION}`,
];
export const RPC_NODES = {
SN_GOERLI: [
`https://starknet-testnet.public.blastapi.io/rpc/${RPC_DEFAULT_VERSION}`,
`https://free-rpc.nethermind.io/goerli-juno/${RPC_DEFAULT_VERSION}`,
],
SN_MAIN: [
`https://starknet-mainnet.public.blastapi.io/rpc/${RPC_DEFAULT_VERSION}`,
`https://free-rpc.nethermind.io/mainnet-juno/${RPC_DEFAULT_VERSION}`,
],
SN_SEPOLIA: [
`https://starknet-sepolia.public.blastapi.io/rpc/${RPC_DEFAULT_VERSION}`,
`https://free-rpc.nethermind.io/sepolia-juno/${RPC_DEFAULT_VERSION}`,
],
};
4 changes: 2 additions & 2 deletions src/utils/provider.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NetworkName, RPC_GOERLI_NODES, RPC_MAINNET_NODES } from '../constants';
import { NetworkName, RPC_NODES } from '../constants';
import {
BigNumberish,
BlockIdentifier,
Expand Down Expand Up @@ -73,7 +73,7 @@ export const getDefaultNodeUrl = (networkName?: NetworkName, mute: boolean = fal
if (!mute)
// eslint-disable-next-line no-console
console.warn('Using default public node url, please provide nodeUrl in provider options!');
const nodes = networkName === NetworkName.SN_MAIN ? RPC_MAINNET_NODES : RPC_GOERLI_NODES;
const nodes = RPC_NODES[networkName ?? NetworkName.SN_GOERLI]; // TODO: when goerli deprecated switch default to sepolia
const randIdx = Math.floor(Math.random() * nodes.length);
return nodes[randIdx];
};
Expand Down

0 comments on commit da2db6f

Please sign in to comment.