@b3dotfun/sdk 0.0.90-test.1 → 0.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/constants/rpc.d.ts +22 -0
- package/dist/cjs/anyspend/constants/rpc.js +38 -0
- package/dist/cjs/anyspend/utils/chain.d.ts +23 -0
- package/dist/cjs/anyspend/utils/chain.js +56 -12
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +31 -0
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +37 -0
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +2 -19
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +4 -31
- package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +1 -12
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +1 -17
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +2 -21
- package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +2 -2
- package/dist/cjs/global-account/react/hooks/useTokenBalancesByChain.js +3 -0
- package/dist/cjs/global-account/react/stores/index.d.ts +0 -1
- package/dist/cjs/global-account/react/stores/index.js +1 -3
- package/dist/esm/anyspend/constants/rpc.d.ts +22 -0
- package/dist/esm/anyspend/constants/rpc.js +35 -0
- package/dist/esm/anyspend/utils/chain.d.ts +23 -0
- package/dist/esm/anyspend/utils/chain.js +53 -12
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +31 -0
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +33 -0
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +2 -19
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +3 -30
- package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +1 -12
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +1 -17
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +1 -20
- package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +2 -2
- package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +3 -0
- package/dist/esm/global-account/react/stores/index.d.ts +0 -1
- package/dist/esm/global-account/react/stores/index.js +0 -1
- package/dist/types/anyspend/constants/rpc.d.ts +22 -0
- package/dist/types/anyspend/utils/chain.d.ts +23 -0
- package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +31 -0
- package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +1 -12
- package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +1 -17
- package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +2 -2
- package/dist/types/global-account/react/stores/index.d.ts +0 -1
- package/package.json +1 -1
- package/src/anyspend/constants/rpc.ts +38 -0
- package/src/anyspend/utils/chain.ts +70 -36
- package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +84 -0
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +28 -36
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +21 -27
- package/src/global-account/react/components/B3Provider/useB3Config.ts +1 -21
- package/src/global-account/react/hooks/useTokenBalancesByChain.tsx +3 -0
- package/src/global-account/react/stores/index.ts +0 -1
- package/dist/cjs/global-account/react/stores/configStore.d.ts +0 -24
- package/dist/cjs/global-account/react/stores/configStore.js +0 -30
- package/dist/esm/global-account/react/stores/configStore.d.ts +0 -24
- package/dist/esm/global-account/react/stores/configStore.js +0 -27
- package/dist/types/global-account/react/stores/configStore.d.ts +0 -24
- package/src/global-account/react/stores/configStore.ts +0 -51
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public RPC endpoints for EVM chains.
|
|
3
|
+
* These are free, public endpoints that can be used without API keys.
|
|
4
|
+
*
|
|
5
|
+
* Sources:
|
|
6
|
+
* - https://publicnode.com
|
|
7
|
+
* - https://chainlist.org
|
|
8
|
+
*/
|
|
9
|
+
export declare const ETHEREUM_PUBLIC_RPC = "https://ethereum-rpc.publicnode.com";
|
|
10
|
+
export declare const ARBITRUM_PUBLIC_RPC = "https://arbitrum-one-rpc.publicnode.com";
|
|
11
|
+
export declare const BASE_PUBLIC_RPC = "https://base-rpc.publicnode.com";
|
|
12
|
+
export declare const OPTIMISM_PUBLIC_RPC = "https://optimism-rpc.publicnode.com";
|
|
13
|
+
export declare const POLYGON_PUBLIC_RPC = "https://polygon-bor-rpc.publicnode.com";
|
|
14
|
+
export declare const AVALANCHE_PUBLIC_RPC = "https://avalanche-c-chain-rpc.publicnode.com";
|
|
15
|
+
export declare const BSC_PUBLIC_RPC = "https://bsc-rpc.publicnode.com";
|
|
16
|
+
export declare const B3_PUBLIC_RPC = "https://mainnet-rpc.b3.fun/http";
|
|
17
|
+
export declare const ABSTRACT_PUBLIC_RPC = "https://api.mainnet.abs.xyz";
|
|
18
|
+
export declare const HYPEREVM_PUBLIC_RPC = "https://rpc.hyperliquid.xyz/evm";
|
|
19
|
+
/**
|
|
20
|
+
* Map of chain IDs to their default public RPC URLs.
|
|
21
|
+
*/
|
|
22
|
+
export declare const PUBLIC_RPC_URLS: Record<number, string>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Public RPC endpoints for EVM chains.
|
|
4
|
+
* These are free, public endpoints that can be used without API keys.
|
|
5
|
+
*
|
|
6
|
+
* Sources:
|
|
7
|
+
* - https://publicnode.com
|
|
8
|
+
* - https://chainlist.org
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.PUBLIC_RPC_URLS = exports.HYPEREVM_PUBLIC_RPC = exports.ABSTRACT_PUBLIC_RPC = exports.B3_PUBLIC_RPC = exports.BSC_PUBLIC_RPC = exports.AVALANCHE_PUBLIC_RPC = exports.POLYGON_PUBLIC_RPC = exports.OPTIMISM_PUBLIC_RPC = exports.BASE_PUBLIC_RPC = exports.ARBITRUM_PUBLIC_RPC = exports.ETHEREUM_PUBLIC_RPC = void 0;
|
|
12
|
+
// PublicNode endpoints
|
|
13
|
+
exports.ETHEREUM_PUBLIC_RPC = "https://ethereum-rpc.publicnode.com";
|
|
14
|
+
exports.ARBITRUM_PUBLIC_RPC = "https://arbitrum-one-rpc.publicnode.com";
|
|
15
|
+
exports.BASE_PUBLIC_RPC = "https://base-rpc.publicnode.com";
|
|
16
|
+
exports.OPTIMISM_PUBLIC_RPC = "https://optimism-rpc.publicnode.com";
|
|
17
|
+
exports.POLYGON_PUBLIC_RPC = "https://polygon-bor-rpc.publicnode.com";
|
|
18
|
+
exports.AVALANCHE_PUBLIC_RPC = "https://avalanche-c-chain-rpc.publicnode.com";
|
|
19
|
+
exports.BSC_PUBLIC_RPC = "https://bsc-rpc.publicnode.com";
|
|
20
|
+
// Chain-specific public endpoints
|
|
21
|
+
exports.B3_PUBLIC_RPC = "https://mainnet-rpc.b3.fun/http";
|
|
22
|
+
exports.ABSTRACT_PUBLIC_RPC = "https://api.mainnet.abs.xyz";
|
|
23
|
+
exports.HYPEREVM_PUBLIC_RPC = "https://rpc.hyperliquid.xyz/evm";
|
|
24
|
+
/**
|
|
25
|
+
* Map of chain IDs to their default public RPC URLs.
|
|
26
|
+
*/
|
|
27
|
+
exports.PUBLIC_RPC_URLS = {
|
|
28
|
+
1: exports.ETHEREUM_PUBLIC_RPC, // Ethereum Mainnet
|
|
29
|
+
42161: exports.ARBITRUM_PUBLIC_RPC, // Arbitrum One
|
|
30
|
+
8453: exports.BASE_PUBLIC_RPC, // Base
|
|
31
|
+
10: exports.OPTIMISM_PUBLIC_RPC, // Optimism
|
|
32
|
+
137: exports.POLYGON_PUBLIC_RPC, // Polygon
|
|
33
|
+
43114: exports.AVALANCHE_PUBLIC_RPC, // Avalanche C-Chain
|
|
34
|
+
56: exports.BSC_PUBLIC_RPC, // BNB Smart Chain
|
|
35
|
+
8333: exports.B3_PUBLIC_RPC, // B3
|
|
36
|
+
2741: exports.ABSTRACT_PUBLIC_RPC, // Abstract
|
|
37
|
+
999: exports.HYPEREVM_PUBLIC_RPC, // HyperEVM
|
|
38
|
+
};
|
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
import { components } from "../../anyspend/types/api";
|
|
2
2
|
import { Account, Chain, PublicClient, Transport, WalletClient } from "viem";
|
|
3
3
|
import { ChainType, IBaseChain, IEVMChain, IHyperliquidChain, ISolanaChain } from "../types/chain";
|
|
4
|
+
/**
|
|
5
|
+
* Set custom RPC URL overrides for specific chains.
|
|
6
|
+
* These overrides are used by chainIdToPublicClient and chainIdToWalletClient.
|
|
7
|
+
*
|
|
8
|
+
* @param overrides - A record mapping chain IDs to custom RPC URLs
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* // Set once at app initialization using environment variables
|
|
12
|
+
* setChainRpcOverrides({
|
|
13
|
+
* 1: process.env.ETHEREUM_RPC_URL,
|
|
14
|
+
* 8453: process.env.BASE_RPC_URL,
|
|
15
|
+
* 42161: process.env.ARBITRUM_RPC_URL,
|
|
16
|
+
* });
|
|
17
|
+
*/
|
|
18
|
+
export declare function setChainRpcOverrides(overrides: Record<number, string>): void;
|
|
19
|
+
/**
|
|
20
|
+
* Get the current RPC URL overrides.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getChainRpcOverrides(): Record<number, string>;
|
|
23
|
+
/**
|
|
24
|
+
* Clear all RPC URL overrides.
|
|
25
|
+
*/
|
|
26
|
+
export declare function clearChainRpcOverrides(): void;
|
|
4
27
|
export declare const hyperEVM: {
|
|
5
28
|
blockExplorers: {
|
|
6
29
|
readonly default: {
|
|
@@ -4,6 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ALL_CHAINS = exports.HYPERLIQUID_CHAINS = exports.SOLANA_CHAINS = exports.EVM_CHAINS = exports.HYPERLIQUID_MAINNET = exports.SOLANA_MAINNET = exports.EVM_TESTNET = exports.EVM_MAINNET = exports.hyperEVM = void 0;
|
|
7
|
+
exports.setChainRpcOverrides = setChainRpcOverrides;
|
|
8
|
+
exports.getChainRpcOverrides = getChainRpcOverrides;
|
|
9
|
+
exports.clearChainRpcOverrides = clearChainRpcOverrides;
|
|
7
10
|
exports.getSolanaChains = getSolanaChains;
|
|
8
11
|
exports.getAllEvmChains = getAllEvmChains;
|
|
9
12
|
exports.getChainType = getChainType;
|
|
@@ -26,6 +29,7 @@ exports.isHyperliquidChain = isHyperliquidChain;
|
|
|
26
29
|
exports.getHyperliquidChain = getHyperliquidChain;
|
|
27
30
|
exports.getAvailableChainIds = getAvailableChainIds;
|
|
28
31
|
const constants_1 = require("../../anyspend/constants");
|
|
32
|
+
const rpc_1 = require("../../anyspend/constants/rpc");
|
|
29
33
|
const invariant_1 = __importDefault(require("invariant"));
|
|
30
34
|
const viem_1 = require("viem");
|
|
31
35
|
const chains_1 = require("viem/chains");
|
|
@@ -34,11 +38,45 @@ const token_1 = require("./token");
|
|
|
34
38
|
function getCustomEvmChain(chain, rpcUrl) {
|
|
35
39
|
return (0, viem_1.defineChain)({ ...chain, rpcUrls: { default: { http: [rpcUrl] } } });
|
|
36
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Global RPC URL overrides for EVM chains.
|
|
43
|
+
* Use setChainRpcOverrides() to configure custom RPC endpoints.
|
|
44
|
+
*/
|
|
45
|
+
let chainRpcOverrides = {};
|
|
46
|
+
/**
|
|
47
|
+
* Set custom RPC URL overrides for specific chains.
|
|
48
|
+
* These overrides are used by chainIdToPublicClient and chainIdToWalletClient.
|
|
49
|
+
*
|
|
50
|
+
* @param overrides - A record mapping chain IDs to custom RPC URLs
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* // Set once at app initialization using environment variables
|
|
54
|
+
* setChainRpcOverrides({
|
|
55
|
+
* 1: process.env.ETHEREUM_RPC_URL,
|
|
56
|
+
* 8453: process.env.BASE_RPC_URL,
|
|
57
|
+
* 42161: process.env.ARBITRUM_RPC_URL,
|
|
58
|
+
* });
|
|
59
|
+
*/
|
|
60
|
+
function setChainRpcOverrides(overrides) {
|
|
61
|
+
chainRpcOverrides = { ...overrides };
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get the current RPC URL overrides.
|
|
65
|
+
*/
|
|
66
|
+
function getChainRpcOverrides() {
|
|
67
|
+
return { ...chainRpcOverrides };
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Clear all RPC URL overrides.
|
|
71
|
+
*/
|
|
72
|
+
function clearChainRpcOverrides() {
|
|
73
|
+
chainRpcOverrides = {};
|
|
74
|
+
}
|
|
37
75
|
exports.hyperEVM = (0, viem_1.defineChain)({
|
|
38
76
|
id: token_1.HYPEREVM_CHAIN_ID,
|
|
39
77
|
name: "HyperEVM",
|
|
40
78
|
nativeCurrency: { name: "HyperEVM", symbol: "HYPE", decimals: 18 },
|
|
41
|
-
rpcUrls: { default: { http: [
|
|
79
|
+
rpcUrls: { default: { http: [rpc_1.HYPEREVM_PUBLIC_RPC] } },
|
|
42
80
|
blockExplorers: { default: { name: "HyperEVM Explorer", url: "https://hyperevmscan.io/" } },
|
|
43
81
|
});
|
|
44
82
|
// export const b4testnet = defineChain({
|
|
@@ -58,7 +96,7 @@ exports.EVM_MAINNET = {
|
|
|
58
96
|
canDepositNative: true,
|
|
59
97
|
defaultToken: (0, token_1.getEthToken)(chains_1.mainnet.id),
|
|
60
98
|
nativeToken: (0, token_1.getEthToken)(chains_1.mainnet.id),
|
|
61
|
-
viem: getCustomEvmChain(chains_1.mainnet,
|
|
99
|
+
viem: getCustomEvmChain(chains_1.mainnet, rpc_1.ETHEREUM_PUBLIC_RPC),
|
|
62
100
|
pollingInterval: 4000, // 4 seconds for Ethereum mainnet
|
|
63
101
|
zapperEnum: "ETHEREUM_MAINNET",
|
|
64
102
|
coingeckoName: "eth",
|
|
@@ -73,7 +111,7 @@ exports.EVM_MAINNET = {
|
|
|
73
111
|
canDepositNative: true,
|
|
74
112
|
defaultToken: (0, token_1.getEthToken)(chains_1.arbitrum.id),
|
|
75
113
|
nativeToken: (0, token_1.getEthToken)(chains_1.arbitrum.id),
|
|
76
|
-
viem: getCustomEvmChain(chains_1.arbitrum,
|
|
114
|
+
viem: getCustomEvmChain(chains_1.arbitrum, rpc_1.ARBITRUM_PUBLIC_RPC),
|
|
77
115
|
pollingInterval: 500, // 500ms for Arbitrum's fast blocks
|
|
78
116
|
zapperEnum: "ARBITRUM_MAINNET",
|
|
79
117
|
coingeckoName: "arbitrum",
|
|
@@ -88,7 +126,7 @@ exports.EVM_MAINNET = {
|
|
|
88
126
|
canDepositNative: true,
|
|
89
127
|
defaultToken: (0, token_1.getEthToken)(chains_1.base.id),
|
|
90
128
|
nativeToken: (0, token_1.getEthToken)(chains_1.base.id),
|
|
91
|
-
viem: getCustomEvmChain(chains_1.base,
|
|
129
|
+
viem: getCustomEvmChain(chains_1.base, rpc_1.BASE_PUBLIC_RPC),
|
|
92
130
|
pollingInterval: 1000, // 1 second for Base
|
|
93
131
|
zapperEnum: "BASE_MAINNET",
|
|
94
132
|
coingeckoName: "base",
|
|
@@ -103,7 +141,7 @@ exports.EVM_MAINNET = {
|
|
|
103
141
|
canDepositNative: true,
|
|
104
142
|
defaultToken: (0, token_1.getEthToken)(chains_1.optimism.id),
|
|
105
143
|
nativeToken: (0, token_1.getEthToken)(chains_1.optimism.id),
|
|
106
|
-
viem: getCustomEvmChain(chains_1.optimism,
|
|
144
|
+
viem: getCustomEvmChain(chains_1.optimism, rpc_1.OPTIMISM_PUBLIC_RPC),
|
|
107
145
|
pollingInterval: 1000, // 1 second for Optimism
|
|
108
146
|
zapperEnum: "OPTIMISM_MAINNET",
|
|
109
147
|
coingeckoName: "optimism",
|
|
@@ -118,7 +156,7 @@ exports.EVM_MAINNET = {
|
|
|
118
156
|
canDepositNative: true,
|
|
119
157
|
defaultToken: (0, token_1.getPolToken)(),
|
|
120
158
|
nativeToken: (0, token_1.getPolToken)(),
|
|
121
|
-
viem: getCustomEvmChain(chains_1.polygon,
|
|
159
|
+
viem: getCustomEvmChain(chains_1.polygon, rpc_1.POLYGON_PUBLIC_RPC),
|
|
122
160
|
pollingInterval: 1000, // 1 second for Polygon
|
|
123
161
|
zapperEnum: "POLYGON_MAINNET",
|
|
124
162
|
coingeckoName: "polygon_pos",
|
|
@@ -133,7 +171,7 @@ exports.EVM_MAINNET = {
|
|
|
133
171
|
canDepositNative: true,
|
|
134
172
|
defaultToken: (0, token_1.getAvaxToken)(),
|
|
135
173
|
nativeToken: (0, token_1.getAvaxToken)(),
|
|
136
|
-
viem: getCustomEvmChain(chains_1.avalanche,
|
|
174
|
+
viem: getCustomEvmChain(chains_1.avalanche, rpc_1.AVALANCHE_PUBLIC_RPC),
|
|
137
175
|
pollingInterval: 1000, // 1 second for Avalanche
|
|
138
176
|
zapperEnum: "AVALANCHE_MAINNET",
|
|
139
177
|
coingeckoName: "avax",
|
|
@@ -148,7 +186,7 @@ exports.EVM_MAINNET = {
|
|
|
148
186
|
canDepositNative: true,
|
|
149
187
|
defaultToken: (0, token_1.getBnbToken)(),
|
|
150
188
|
nativeToken: (0, token_1.getBnbToken)(),
|
|
151
|
-
viem: getCustomEvmChain(chains_1.bsc,
|
|
189
|
+
viem: getCustomEvmChain(chains_1.bsc, rpc_1.BSC_PUBLIC_RPC),
|
|
152
190
|
pollingInterval: 1000, // 1 second for BSC
|
|
153
191
|
zapperEnum: "BSC_MAINNET",
|
|
154
192
|
coingeckoName: "bsc",
|
|
@@ -163,7 +201,7 @@ exports.EVM_MAINNET = {
|
|
|
163
201
|
canDepositNative: true,
|
|
164
202
|
defaultToken: (0, token_1.getEthToken)(chains_1.b3.id),
|
|
165
203
|
nativeToken: (0, token_1.getEthToken)(chains_1.b3.id),
|
|
166
|
-
viem: getCustomEvmChain(chains_1.b3,
|
|
204
|
+
viem: getCustomEvmChain(chains_1.b3, rpc_1.B3_PUBLIC_RPC),
|
|
167
205
|
pollingInterval: 1000, // 1 second for B3
|
|
168
206
|
zapperEnum: "B3_MAINNET",
|
|
169
207
|
coingeckoName: "b3",
|
|
@@ -178,7 +216,7 @@ exports.EVM_MAINNET = {
|
|
|
178
216
|
canDepositNative: true,
|
|
179
217
|
defaultToken: (0, token_1.getEthToken)(chains_1.abstract.id),
|
|
180
218
|
nativeToken: (0, token_1.getEthToken)(chains_1.abstract.id),
|
|
181
|
-
viem: getCustomEvmChain(chains_1.abstract,
|
|
219
|
+
viem: getCustomEvmChain(chains_1.abstract, rpc_1.ABSTRACT_PUBLIC_RPC),
|
|
182
220
|
pollingInterval: 3000, // 3 seconds for Abstract
|
|
183
221
|
zapperEnum: "ABSTRACT_MAINNET",
|
|
184
222
|
coingeckoName: "abstract",
|
|
@@ -293,16 +331,22 @@ function getChainType(chainId) {
|
|
|
293
331
|
}
|
|
294
332
|
function chainIdToPublicClient(chainId) {
|
|
295
333
|
(0, invariant_1.default)(exports.EVM_CHAINS[chainId], `Chain ${chainId} is not an EVM chain`);
|
|
334
|
+
// Use override RPC if configured, otherwise use the default chain RPC
|
|
335
|
+
const rpcOverride = chainRpcOverrides[chainId];
|
|
336
|
+
const chain = rpcOverride ? getCustomEvmChain(exports.EVM_CHAINS[chainId].viem, rpcOverride) : exports.EVM_CHAINS[chainId].viem;
|
|
296
337
|
return (0, viem_1.createPublicClient)({
|
|
297
|
-
chain
|
|
338
|
+
chain,
|
|
298
339
|
transport: (0, viem_1.http)(),
|
|
299
340
|
pollingInterval: exports.EVM_CHAINS[chainId].pollingInterval,
|
|
300
341
|
});
|
|
301
342
|
}
|
|
302
343
|
function chainIdToWalletClient(chainId, account) {
|
|
303
344
|
(0, invariant_1.default)(exports.EVM_CHAINS[chainId], `Chain ${chainId} is not an EVM chain`);
|
|
345
|
+
// Use override RPC if configured, otherwise use the default chain RPC
|
|
346
|
+
const rpcOverride = chainRpcOverrides[chainId];
|
|
347
|
+
const chain = rpcOverride ? getCustomEvmChain(exports.EVM_CHAINS[chainId].viem, rpcOverride) : exports.EVM_CHAINS[chainId].viem;
|
|
304
348
|
return (0, viem_1.createWalletClient)({
|
|
305
|
-
chain
|
|
349
|
+
chain,
|
|
306
350
|
transport: (0, viem_1.http)(),
|
|
307
351
|
account,
|
|
308
352
|
pollingInterval: exports.EVM_CHAINS[chainId].pollingInterval,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CreateOnrampOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOnrampOrder";
|
|
2
|
+
import { CreateOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOrder";
|
|
3
|
+
import { PermissionsConfig } from "../../../../global-account/types/permissions";
|
|
4
|
+
import { Account } from "thirdweb/wallets";
|
|
5
|
+
import { ClientType } from "../../../client-manager";
|
|
6
|
+
export interface B3ConfigContextType {
|
|
7
|
+
accountOverride?: Account;
|
|
8
|
+
automaticallySetFirstEoa: boolean;
|
|
9
|
+
environment: "development" | "production";
|
|
10
|
+
defaultPermissions: PermissionsConfig;
|
|
11
|
+
theme: "light" | "dark";
|
|
12
|
+
clientType: ClientType;
|
|
13
|
+
partnerId: string;
|
|
14
|
+
stripePublishableKey?: string;
|
|
15
|
+
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
16
|
+
enableTurnkey: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function B3ConfigProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, stripePublishableKey, createClientReferenceId, enableTurnkey, }: {
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
accountOverride?: Account;
|
|
21
|
+
environment?: "development" | "production";
|
|
22
|
+
defaultPermissions?: PermissionsConfig;
|
|
23
|
+
automaticallySetFirstEoa?: boolean;
|
|
24
|
+
theme?: "light" | "dark";
|
|
25
|
+
clientType?: ClientType;
|
|
26
|
+
partnerId: string;
|
|
27
|
+
stripePublishableKey?: string;
|
|
28
|
+
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
29
|
+
enableTurnkey?: boolean;
|
|
30
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare function useB3Config(): B3ConfigContextType;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.B3ConfigProvider = B3ConfigProvider;
|
|
4
|
+
exports.useB3Config = useB3Config;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
/**
|
|
8
|
+
* Default permissions configuration for B3 provider
|
|
9
|
+
*/
|
|
10
|
+
const DEFAULT_PERMISSIONS = {
|
|
11
|
+
approvedTargets: ["0xa8e42121e318e3D3BeD7f5969AF6D360045317DD"],
|
|
12
|
+
nativeTokenLimitPerTransaction: 0.1,
|
|
13
|
+
startDate: new Date(),
|
|
14
|
+
endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
|
|
15
|
+
};
|
|
16
|
+
const B3ConfigContext = (0, react_1.createContext)(null);
|
|
17
|
+
function B3ConfigProvider({ children, accountOverride, environment = "development", defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa = false, theme = "light", clientType = "rest", partnerId, stripePublishableKey, createClientReferenceId, enableTurnkey = false, }) {
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)(B3ConfigContext.Provider, { value: {
|
|
19
|
+
accountOverride,
|
|
20
|
+
environment,
|
|
21
|
+
defaultPermissions,
|
|
22
|
+
automaticallySetFirstEoa,
|
|
23
|
+
theme,
|
|
24
|
+
clientType,
|
|
25
|
+
partnerId,
|
|
26
|
+
stripePublishableKey,
|
|
27
|
+
createClientReferenceId,
|
|
28
|
+
enableTurnkey,
|
|
29
|
+
}, children: children }));
|
|
30
|
+
}
|
|
31
|
+
function useB3Config() {
|
|
32
|
+
const context = (0, react_1.useContext)(B3ConfigContext);
|
|
33
|
+
if (!context) {
|
|
34
|
+
throw new Error("useB3Config must be used within a B3ConfigProvider");
|
|
35
|
+
}
|
|
36
|
+
return context;
|
|
37
|
+
}
|
|
@@ -14,10 +14,10 @@ const react_2 = require("react");
|
|
|
14
14
|
const react_3 = require("thirdweb/react");
|
|
15
15
|
const wagmi_1 = require("wagmi");
|
|
16
16
|
const client_manager_1 = require("../../../client-manager");
|
|
17
|
-
const configStore_1 = require("../../stores/configStore");
|
|
18
17
|
const StyleRoot_1 = require("../StyleRoot");
|
|
19
18
|
const index_1 = require("../Toast/index");
|
|
20
19
|
const AuthenticationProvider_1 = __importDefault(require("./AuthenticationProvider"));
|
|
20
|
+
const B3ConfigProvider_1 = require("./B3ConfigProvider");
|
|
21
21
|
const LocalSDKProvider_1 = require("./LocalSDKProvider");
|
|
22
22
|
// Create queryClient instance
|
|
23
23
|
const queryClient = new react_query_1.QueryClient();
|
|
@@ -27,23 +27,6 @@ const queryClient = new react_query_1.QueryClient();
|
|
|
27
27
|
function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey,
|
|
28
28
|
// deprecated since v0.0.87
|
|
29
29
|
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors = false, createClientReferenceId, enableTurnkey = false, defaultPermissions, }) {
|
|
30
|
-
const setConfig = (0, configStore_1.useB3ConfigStore)(state => state.setConfig);
|
|
31
|
-
// Initialize config store on mount
|
|
32
|
-
(0, react_2.useEffect)(() => {
|
|
33
|
-
setConfig({
|
|
34
|
-
accountOverride,
|
|
35
|
-
environment: environment ?? "development",
|
|
36
|
-
automaticallySetFirstEoa: !!automaticallySetFirstEoa,
|
|
37
|
-
theme,
|
|
38
|
-
clientType,
|
|
39
|
-
partnerId,
|
|
40
|
-
stripePublishableKey,
|
|
41
|
-
createClientReferenceId,
|
|
42
|
-
enableTurnkey,
|
|
43
|
-
defaultPermissions,
|
|
44
|
-
});
|
|
45
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
|
-
}, []);
|
|
47
30
|
// Initialize Google Analytics on mount
|
|
48
31
|
(0, react_2.useEffect)(() => {
|
|
49
32
|
(0, analytics_1.loadGA4Script)();
|
|
@@ -53,7 +36,7 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey
|
|
|
53
36
|
(0, client_manager_1.setClientType)(clientType);
|
|
54
37
|
}, [clientType]);
|
|
55
38
|
const wagmiConfig = (0, react_2.useMemo)(() => (0, createWagmiConfig_1.createWagmiConfig)({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }), [partnerId, rpcUrls, connectors, overrideDefaultConnectors]);
|
|
56
|
-
return ((0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(index_1.ToastProvider, { children: (0, jsx_runtime_1.
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(index_1.ToastProvider, { children: (0, jsx_runtime_1.jsx)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, children: (0, jsx_runtime_1.jsxs)(B3ConfigProvider_1.B3ConfigProvider, { accountOverride: accountOverride, environment: environment, automaticallySetFirstEoa: !!automaticallySetFirstEoa, theme: theme, clientType: clientType, partnerId: partnerId, stripePublishableKey: stripePublishableKey, createClientReferenceId: createClientReferenceId, enableTurnkey: enableTurnkey, defaultPermissions: defaultPermissions, children: [(0, jsx_runtime_1.jsx)(ToastContextConnector, {}), (0, jsx_runtime_1.jsxs)(react_1.RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, (0, jsx_runtime_1.jsx)(StyleRoot_1.StyleRoot, { id: "b3-root" })] }), (0, jsx_runtime_1.jsx)(AuthenticationProvider_1.default, { partnerId: partnerId, automaticallySetFirstEoa: !!automaticallySetFirstEoa })] }) }) }) }) }) }) }));
|
|
57
40
|
}
|
|
58
41
|
/**
|
|
59
42
|
* Component to connect the toast context to the global toast API
|
|
@@ -7,12 +7,11 @@ exports.B3Provider = B3Provider;
|
|
|
7
7
|
exports.InnerProvider = InnerProvider;
|
|
8
8
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
9
|
const react_query_1 = require("@tanstack/react-query");
|
|
10
|
-
const react_1 = require("react");
|
|
11
|
-
const react_2 = require("thirdweb/react");
|
|
10
|
+
const react_1 = require("thirdweb/react");
|
|
12
11
|
const wagmi_1 = require("wagmi");
|
|
13
|
-
const configStore_1 = require("../../stores/configStore");
|
|
14
12
|
const createWagmiConfig_1 = require("../../utils/createWagmiConfig");
|
|
15
13
|
const AuthenticationProvider_1 = __importDefault(require("./AuthenticationProvider"));
|
|
14
|
+
const B3ConfigProvider_1 = require("./B3ConfigProvider");
|
|
16
15
|
const LocalSDKProvider_1 = require("./LocalSDKProvider");
|
|
17
16
|
// Create queryClient instance
|
|
18
17
|
const queryClient = new react_query_1.QueryClient();
|
|
@@ -20,38 +19,12 @@ const queryClient = new react_query_1.QueryClient();
|
|
|
20
19
|
* Main B3Provider component
|
|
21
20
|
*/
|
|
22
21
|
function B3Provider({ theme = "light", children, accountOverride, environment, clientType = "socket", partnerId, rpcUrls, onConnect, defaultPermissions, }) {
|
|
23
|
-
|
|
24
|
-
// Initialize config store on mount - props are static and never change
|
|
25
|
-
(0, react_1.useEffect)(() => {
|
|
26
|
-
setConfig({
|
|
27
|
-
accountOverride,
|
|
28
|
-
environment: environment ?? "development",
|
|
29
|
-
automaticallySetFirstEoa: false,
|
|
30
|
-
theme,
|
|
31
|
-
clientType,
|
|
32
|
-
partnerId,
|
|
33
|
-
defaultPermissions,
|
|
34
|
-
});
|
|
35
|
-
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
36
|
-
return ((0, jsx_runtime_1.jsx)(react_2.ThirdwebProvider, { children: (0, jsx_runtime_1.jsxs)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, children: [children, (0, jsx_runtime_1.jsx)(AuthenticationProvider_1.default, { partnerId: partnerId, automaticallySetFirstEoa: false })] }) }));
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(react_1.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, children: (0, jsx_runtime_1.jsxs)(B3ConfigProvider_1.B3ConfigProvider, { accountOverride: accountOverride, environment: environment, automaticallySetFirstEoa: false, theme: theme, clientType: clientType, partnerId: partnerId, defaultPermissions: defaultPermissions, children: [children, (0, jsx_runtime_1.jsx)(AuthenticationProvider_1.default, { partnerId: partnerId, automaticallySetFirstEoa: false })] }) }) }));
|
|
37
23
|
}
|
|
38
24
|
/**
|
|
39
25
|
* Inner provider component for native
|
|
40
26
|
*/
|
|
41
27
|
function InnerProvider({ children, accountOverride, environment, defaultPermissions, theme = "light", clientType = "socket", partnerId, rpcUrls, }) {
|
|
42
|
-
const setConfig = (0, configStore_1.useB3ConfigStore)(state => state.setConfig);
|
|
43
28
|
const wagmiConfig = (0, createWagmiConfig_1.createWagmiConfig)({ partnerId, rpcUrls });
|
|
44
|
-
|
|
45
|
-
(0, react_1.useEffect)(() => {
|
|
46
|
-
setConfig({
|
|
47
|
-
accountOverride,
|
|
48
|
-
environment: environment ?? "development",
|
|
49
|
-
automaticallySetFirstEoa: false,
|
|
50
|
-
theme,
|
|
51
|
-
clientType,
|
|
52
|
-
partnerId,
|
|
53
|
-
defaultPermissions,
|
|
54
|
-
});
|
|
55
|
-
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
56
|
-
return ((0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: children }) }));
|
|
29
|
+
return ((0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(B3ConfigProvider_1.B3ConfigProvider, { accountOverride: accountOverride, environment: environment, automaticallySetFirstEoa: false, theme: theme, clientType: clientType, partnerId: partnerId, defaultPermissions: defaultPermissions, children: children }) }) }));
|
|
57
30
|
}
|
|
@@ -2,15 +2,4 @@
|
|
|
2
2
|
* Hook to access the B3 configuration
|
|
3
3
|
* @deprecated This is just an alias for useB3Config. Use useB3Config directly instead.
|
|
4
4
|
*/
|
|
5
|
-
export declare function useB3():
|
|
6
|
-
automaticallySetFirstEoa: boolean;
|
|
7
|
-
environment: "development" | "production";
|
|
8
|
-
theme: "light" | "dark";
|
|
9
|
-
clientType: import("../../../client-manager").ClientType;
|
|
10
|
-
partnerId: string;
|
|
11
|
-
createClientReferenceId: ((params: import("../../../../anyspend/react").CreateOrderParams | import("../../../../anyspend/react").CreateOnrampOrderParams) => Promise<string>) | undefined;
|
|
12
|
-
enableTurnkey: boolean;
|
|
13
|
-
stripePublishableKey: string | undefined;
|
|
14
|
-
defaultPermissions: import("../../../types/permissions").PermissionsConfig;
|
|
15
|
-
accountOverride: import("thirdweb/wallets").Account | undefined;
|
|
16
|
-
};
|
|
5
|
+
export declare function useB3(): import("./B3ConfigProvider").B3ConfigContextType;
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Hook to access B3 configuration
|
|
3
|
-
* Returns all config values from the Zustand store
|
|
4
|
-
* Since config is static (set once at initialization), destructuring is fine here
|
|
5
|
-
*/
|
|
6
|
-
export declare const useB3Config: () => {
|
|
7
|
-
automaticallySetFirstEoa: boolean;
|
|
8
|
-
environment: "development" | "production";
|
|
9
|
-
theme: "light" | "dark";
|
|
10
|
-
clientType: import("../../../client-manager").ClientType;
|
|
11
|
-
partnerId: string;
|
|
12
|
-
createClientReferenceId: ((params: import("../../../../anyspend/react").CreateOrderParams | import("../../../../anyspend/react").CreateOnrampOrderParams) => Promise<string>) | undefined;
|
|
13
|
-
enableTurnkey: boolean;
|
|
14
|
-
stripePublishableKey: string | undefined;
|
|
15
|
-
defaultPermissions: import("../../../types/permissions").PermissionsConfig;
|
|
16
|
-
accountOverride: import("thirdweb/wallets").Account | undefined;
|
|
17
|
-
};
|
|
1
|
+
export { useB3Config } from "./B3ConfigProvider";
|
|
@@ -1,24 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useB3Config = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* Hook to access B3 configuration
|
|
7
|
-
* Returns all config values from the Zustand store
|
|
8
|
-
* Since config is static (set once at initialization), destructuring is fine here
|
|
9
|
-
*/
|
|
10
|
-
const useB3Config = () => {
|
|
11
|
-
return (0, configStore_1.useB3ConfigStore)(state => ({
|
|
12
|
-
automaticallySetFirstEoa: state.automaticallySetFirstEoa,
|
|
13
|
-
environment: state.environment,
|
|
14
|
-
theme: state.theme,
|
|
15
|
-
clientType: state.clientType,
|
|
16
|
-
partnerId: state.partnerId,
|
|
17
|
-
createClientReferenceId: state.createClientReferenceId,
|
|
18
|
-
enableTurnkey: state.enableTurnkey,
|
|
19
|
-
stripePublishableKey: state.stripePublishableKey,
|
|
20
|
-
defaultPermissions: state.defaultPermissions,
|
|
21
|
-
accountOverride: state.accountOverride,
|
|
22
|
-
}));
|
|
23
|
-
};
|
|
24
|
-
exports.useB3Config = useB3Config;
|
|
4
|
+
var B3ConfigProvider_1 = require("./B3ConfigProvider");
|
|
5
|
+
Object.defineProperty(exports, "useB3Config", { enumerable: true, get: function () { return B3ConfigProvider_1.useB3Config; } });
|
|
@@ -7455,12 +7455,12 @@ export declare function useFirstEOA(chain?: {
|
|
|
7455
7455
|
[x: `bytes6[${string}]`]: undefined;
|
|
7456
7456
|
[x: `bytes9[${string}]`]: undefined;
|
|
7457
7457
|
[x: `bytes8[${string}]`]: undefined;
|
|
7458
|
+
[x: `bytes10[${string}]`]: undefined;
|
|
7458
7459
|
[x: `bytes2[${string}]`]: undefined;
|
|
7459
7460
|
[x: `bytes3[${string}]`]: undefined;
|
|
7460
7461
|
[x: `bytes4[${string}]`]: undefined;
|
|
7461
7462
|
[x: `bytes5[${string}]`]: undefined;
|
|
7462
7463
|
[x: `bytes7[${string}]`]: undefined;
|
|
7463
|
-
[x: `bytes10[${string}]`]: undefined;
|
|
7464
7464
|
[x: `bytes11[${string}]`]: undefined;
|
|
7465
7465
|
[x: `bytes12[${string}]`]: undefined;
|
|
7466
7466
|
[x: `bytes13[${string}]`]: undefined;
|
|
@@ -7557,12 +7557,12 @@ export declare function useFirstEOA(chain?: {
|
|
|
7557
7557
|
bytes6?: undefined;
|
|
7558
7558
|
bytes9?: undefined;
|
|
7559
7559
|
bytes8?: undefined;
|
|
7560
|
+
bytes10?: undefined;
|
|
7560
7561
|
bytes2?: undefined;
|
|
7561
7562
|
bytes3?: undefined;
|
|
7562
7563
|
bytes4?: undefined;
|
|
7563
7564
|
bytes5?: undefined;
|
|
7564
7565
|
bytes7?: undefined;
|
|
7565
|
-
bytes10?: undefined;
|
|
7566
7566
|
bytes11?: undefined;
|
|
7567
7567
|
bytes12?: undefined;
|
|
7568
7568
|
bytes13?: undefined;
|
|
@@ -52,6 +52,9 @@ function useTokenBalancesByChain({ address, chainsIds, enabled = true, }) {
|
|
|
52
52
|
staleTime: 30000, // Consider data fresh for 30 seconds
|
|
53
53
|
gcTime: 5 * 60 * 1000, // Keep in cache for 5 minutes
|
|
54
54
|
retry: 2, // Limit retries on failure
|
|
55
|
+
// Enable structural sharing to prevent infinite loops
|
|
56
|
+
// This ensures we only get new references when data actually changes
|
|
57
|
+
structuralSharing: true,
|
|
55
58
|
});
|
|
56
59
|
return {
|
|
57
60
|
nativeTokens: combinedData?.nativeTokens ?? [],
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { useAuthStore } from "./useAuthStore";
|
|
2
|
-
export { useB3ConfigStore } from "./configStore";
|
|
3
2
|
export { useModalStore } from "./useModalStore";
|
|
4
3
|
export { useRecentAddressesStore } from "./useRecentAddressesStore";
|
|
5
4
|
export type { AnySpendBuySpinProps, AnySpendFundTournamentProps, AnySpendJoinTournamentProps, AnySpendModalProps, AnySpendNftProps, AnySpendOrderHistoryProps, AnySpendStakeB3Props, AnyspendOrderDetailsProps, ManageAccountModalProps, ModalContentType, RequestPermissionsModalProps, SignInWithB3ModalProps, } from "./useModalStore";
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useRecentAddressesStore = exports.useModalStore = exports.
|
|
3
|
+
exports.useRecentAddressesStore = exports.useModalStore = exports.useAuthStore = void 0;
|
|
4
4
|
var useAuthStore_1 = require("./useAuthStore");
|
|
5
5
|
Object.defineProperty(exports, "useAuthStore", { enumerable: true, get: function () { return useAuthStore_1.useAuthStore; } });
|
|
6
|
-
var configStore_1 = require("./configStore");
|
|
7
|
-
Object.defineProperty(exports, "useB3ConfigStore", { enumerable: true, get: function () { return configStore_1.useB3ConfigStore; } });
|
|
8
6
|
var useModalStore_1 = require("./useModalStore");
|
|
9
7
|
Object.defineProperty(exports, "useModalStore", { enumerable: true, get: function () { return useModalStore_1.useModalStore; } });
|
|
10
8
|
var useRecentAddressesStore_1 = require("./useRecentAddressesStore");
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public RPC endpoints for EVM chains.
|
|
3
|
+
* These are free, public endpoints that can be used without API keys.
|
|
4
|
+
*
|
|
5
|
+
* Sources:
|
|
6
|
+
* - https://publicnode.com
|
|
7
|
+
* - https://chainlist.org
|
|
8
|
+
*/
|
|
9
|
+
export declare const ETHEREUM_PUBLIC_RPC = "https://ethereum-rpc.publicnode.com";
|
|
10
|
+
export declare const ARBITRUM_PUBLIC_RPC = "https://arbitrum-one-rpc.publicnode.com";
|
|
11
|
+
export declare const BASE_PUBLIC_RPC = "https://base-rpc.publicnode.com";
|
|
12
|
+
export declare const OPTIMISM_PUBLIC_RPC = "https://optimism-rpc.publicnode.com";
|
|
13
|
+
export declare const POLYGON_PUBLIC_RPC = "https://polygon-bor-rpc.publicnode.com";
|
|
14
|
+
export declare const AVALANCHE_PUBLIC_RPC = "https://avalanche-c-chain-rpc.publicnode.com";
|
|
15
|
+
export declare const BSC_PUBLIC_RPC = "https://bsc-rpc.publicnode.com";
|
|
16
|
+
export declare const B3_PUBLIC_RPC = "https://mainnet-rpc.b3.fun/http";
|
|
17
|
+
export declare const ABSTRACT_PUBLIC_RPC = "https://api.mainnet.abs.xyz";
|
|
18
|
+
export declare const HYPEREVM_PUBLIC_RPC = "https://rpc.hyperliquid.xyz/evm";
|
|
19
|
+
/**
|
|
20
|
+
* Map of chain IDs to their default public RPC URLs.
|
|
21
|
+
*/
|
|
22
|
+
export declare const PUBLIC_RPC_URLS: Record<number, string>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public RPC endpoints for EVM chains.
|
|
3
|
+
* These are free, public endpoints that can be used without API keys.
|
|
4
|
+
*
|
|
5
|
+
* Sources:
|
|
6
|
+
* - https://publicnode.com
|
|
7
|
+
* - https://chainlist.org
|
|
8
|
+
*/
|
|
9
|
+
// PublicNode endpoints
|
|
10
|
+
export const ETHEREUM_PUBLIC_RPC = "https://ethereum-rpc.publicnode.com";
|
|
11
|
+
export const ARBITRUM_PUBLIC_RPC = "https://arbitrum-one-rpc.publicnode.com";
|
|
12
|
+
export const BASE_PUBLIC_RPC = "https://base-rpc.publicnode.com";
|
|
13
|
+
export const OPTIMISM_PUBLIC_RPC = "https://optimism-rpc.publicnode.com";
|
|
14
|
+
export const POLYGON_PUBLIC_RPC = "https://polygon-bor-rpc.publicnode.com";
|
|
15
|
+
export const AVALANCHE_PUBLIC_RPC = "https://avalanche-c-chain-rpc.publicnode.com";
|
|
16
|
+
export const BSC_PUBLIC_RPC = "https://bsc-rpc.publicnode.com";
|
|
17
|
+
// Chain-specific public endpoints
|
|
18
|
+
export const B3_PUBLIC_RPC = "https://mainnet-rpc.b3.fun/http";
|
|
19
|
+
export const ABSTRACT_PUBLIC_RPC = "https://api.mainnet.abs.xyz";
|
|
20
|
+
export const HYPEREVM_PUBLIC_RPC = "https://rpc.hyperliquid.xyz/evm";
|
|
21
|
+
/**
|
|
22
|
+
* Map of chain IDs to their default public RPC URLs.
|
|
23
|
+
*/
|
|
24
|
+
export const PUBLIC_RPC_URLS = {
|
|
25
|
+
1: ETHEREUM_PUBLIC_RPC, // Ethereum Mainnet
|
|
26
|
+
42161: ARBITRUM_PUBLIC_RPC, // Arbitrum One
|
|
27
|
+
8453: BASE_PUBLIC_RPC, // Base
|
|
28
|
+
10: OPTIMISM_PUBLIC_RPC, // Optimism
|
|
29
|
+
137: POLYGON_PUBLIC_RPC, // Polygon
|
|
30
|
+
43114: AVALANCHE_PUBLIC_RPC, // Avalanche C-Chain
|
|
31
|
+
56: BSC_PUBLIC_RPC, // BNB Smart Chain
|
|
32
|
+
8333: B3_PUBLIC_RPC, // B3
|
|
33
|
+
2741: ABSTRACT_PUBLIC_RPC, // Abstract
|
|
34
|
+
999: HYPEREVM_PUBLIC_RPC, // HyperEVM
|
|
35
|
+
};
|