Skip to content

Commit 6de46b5

Browse files
committed
feat: sepolia constants, rpc open change
1 parent 1843e3c commit 6de46b5

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

src/constants.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,19 @@ export const API_VERSION = ZERO;
2020
export enum BaseUrl {
2121
SN_MAIN = 'https://alpha-mainnet.starknet.io',
2222
SN_GOERLI = 'https://alpha4.starknet.io',
23+
SN_SEPOLIA = 'https://alpha-sepolia.starknet.io',
2324
}
2425

2526
export enum NetworkName {
2627
SN_MAIN = 'SN_MAIN',
2728
SN_GOERLI = 'SN_GOERLI',
29+
SN_SEPOLIA = 'SN_SEPOLIA',
2830
}
2931

3032
export enum StarknetChainId {
3133
SN_MAIN = '0x534e5f4d41494e', // encodeShortString('SN_MAIN'),
3234
SN_GOERLI = '0x534e5f474f45524c49', // encodeShortString('SN_GOERLI')
35+
SN_SEPOLIA = '0x534e5f5345504f4c4941', // encodeShortString('SN_SEPOLIA')
3336
}
3437

3538
export enum TransactionHashPrefix {
@@ -45,12 +48,14 @@ export const UDC = {
4548
ENTRYPOINT: 'deployContract',
4649
};
4750

48-
export const RPC_GOERLI_NODES = [
49-
'https://starknet-testnet.public.blastapi.io/rpc/v0.5',
50-
'https://limited-rpc.nethermind.io/goerli-juno/v0_5',
51-
];
52-
53-
export const RPC_MAINNET_NODES = [
54-
'https://starknet-mainnet.public.blastapi.io/rpc/v0.5',
55-
'https://limited-rpc.nethermind.io/mainnet-juno/v0_5',
56-
];
51+
export const RPC_NODES = {
52+
SN_GOERLI: [
53+
'https://starknet-testnet.public.blastapi.io/rpc/v0.5',
54+
'https://limited-rpc.nethermind.io/goerli-juno/v0_5',
55+
],
56+
SN_MAIN: [
57+
'https://starknet-mainnet.public.blastapi.io/rpc/v0.5',
58+
'https://limited-rpc.nethermind.io/mainnet-juno/v0_5',
59+
],
60+
SN_SEPOLIA: [],
61+
};

src/provider/rpc.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import {
22
HEX_STR_TRANSACTION_VERSION_1,
33
HEX_STR_TRANSACTION_VERSION_2,
44
NetworkName,
5-
RPC_GOERLI_NODES,
6-
RPC_MAINNET_NODES,
5+
RPC_NODES,
76
StarknetChainId,
87
} from '../constants';
98
import {
@@ -46,7 +45,7 @@ export const getDefaultNodeUrl = (networkName?: NetworkName, mute: boolean = fal
4645
if (!mute)
4746
// eslint-disable-next-line no-console
4847
console.warn('Using default public node url, please provide nodeUrl in provider options!');
49-
const nodes = networkName === NetworkName.SN_MAIN ? RPC_MAINNET_NODES : RPC_GOERLI_NODES;
48+
const nodes = networkName ? RPC_NODES[networkName] : RPC_NODES[NetworkName.SN_GOERLI];
5049
const randIdx = Math.floor(Math.random() * nodes.length);
5150
return nodes[randIdx];
5251
};

0 commit comments

Comments
 (0)