@rhinestone/deposit-modal 0.10.0 → 0.11.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/{DepositModalReown-MTWT6Y66.mjs → DepositModalReown-MO5QDLIT.mjs} +96 -26
- package/dist/{DepositModalReown-S3DSFXTX.cjs → DepositModalReown-YGB73NMW.cjs} +97 -27
- package/dist/caip-D8aRWdEY.d.cts +40 -0
- package/dist/caip-D8aRWdEY.d.ts +40 -0
- package/dist/{chunk-NF4NBRUP.cjs → chunk-4FTI3GTB.cjs} +1 -1
- package/dist/{chunk-A223BLVC.mjs → chunk-53IFZGSF.mjs} +177 -21
- package/dist/{chunk-VDGT6NZQ.mjs → chunk-5746YXKC.mjs} +14 -31
- package/dist/{chunk-7TV7GLJB.mjs → chunk-CWGUBFJL.mjs} +763 -169
- package/dist/{chunk-LR7MKHYV.mjs → chunk-EIWOVX53.mjs} +27 -25
- package/dist/{chunk-VTVOHNXM.cjs → chunk-FVUXJ3RP.cjs} +3 -3
- package/dist/{chunk-A42XAHIB.cjs → chunk-HUHBNYD3.cjs} +84 -101
- package/dist/{chunk-YEBXUUH3.cjs → chunk-JPRV36DT.cjs} +2 -2
- package/dist/{chunk-UMCDZJMG.cjs → chunk-LQGYPM5B.cjs} +96 -94
- package/dist/{chunk-ILT2PITN.mjs → chunk-MZ53PDIX.mjs} +1 -1
- package/dist/{chunk-5NJYW5FT.mjs → chunk-OWYPKCYD.mjs} +12 -9
- package/dist/{chunk-W4YAOJPG.cjs → chunk-SSQ27YFB.cjs} +625 -568
- package/dist/{chunk-H577RJN5.cjs → chunk-TENL4H64.cjs} +186 -30
- package/dist/{chunk-5OEWGJR4.mjs → chunk-URFSTNRS.mjs} +1 -1
- package/dist/{chunk-KW32UBUQ.mjs → chunk-V6T7LORJ.mjs} +1 -1
- package/dist/{chunk-MHIOMTMM.mjs → chunk-YELNYILK.mjs} +391 -334
- package/dist/{chunk-PUJHXHRA.cjs → chunk-ZQR36NCV.cjs} +845 -251
- package/dist/{chunk-DEF767BA.cjs → chunk-ZRIRCIQM.cjs} +66 -63
- package/dist/claim.cjs +6 -6
- package/dist/claim.d.cts +3 -2
- package/dist/claim.d.ts +3 -2
- package/dist/claim.mjs +5 -5
- package/dist/{caip-523Zrc3r.d.cts → constants-FuzG3h4m.d.cts} +1 -18
- package/dist/{caip-523Zrc3r.d.ts → constants-FuzG3h4m.d.ts} +1 -18
- package/dist/constants.cjs +5 -3
- package/dist/constants.d.cts +3 -2
- package/dist/constants.d.ts +3 -2
- package/dist/constants.mjs +4 -2
- package/dist/deposit.cjs +8 -8
- package/dist/deposit.d.cts +3 -2
- package/dist/deposit.d.ts +3 -2
- package/dist/deposit.mjs +7 -7
- package/dist/index.cjs +12 -10
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +11 -9
- package/dist/polymarket.cjs +5 -5
- package/dist/polymarket.mjs +2 -2
- package/dist/{types-C0SGf-21.d.cts → types-CsGa-HxD.d.cts} +10 -3
- package/dist/{types-C0SGf-21.d.ts → types-DdS8OySJ.d.ts} +10 -3
- package/dist/withdraw.cjs +6 -6
- package/dist/withdraw.d.cts +3 -2
- package/dist/withdraw.d.ts +3 -2
- package/dist/withdraw.mjs +5 -5
- package/package.json +1 -1
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DepositModalInner
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-YELNYILK.mjs";
|
|
4
|
+
import "./chunk-5746YXKC.mjs";
|
|
5
|
+
import "./chunk-V6T7LORJ.mjs";
|
|
6
6
|
import {
|
|
7
7
|
isUnsupportedChainSwitchError,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
peekRuntimeChains,
|
|
9
|
+
primeRuntimeChains,
|
|
10
|
+
rpcUrlFor,
|
|
11
|
+
useStableRpcUrls
|
|
12
|
+
} from "./chunk-CWGUBFJL.mjs";
|
|
13
|
+
import "./chunk-URFSTNRS.mjs";
|
|
14
|
+
import "./chunk-MZ53PDIX.mjs";
|
|
12
15
|
import {
|
|
13
16
|
SUPPORTED_CHAINS,
|
|
14
17
|
getChainName
|
|
15
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-53IFZGSF.mjs";
|
|
16
19
|
|
|
17
20
|
// src/DepositModalReown.tsx
|
|
18
|
-
import { useCallback, useMemo } from "react";
|
|
21
|
+
import { useCallback, useMemo as useMemo2 } from "react";
|
|
19
22
|
|
|
20
23
|
// src/core/reown.tsx
|
|
21
|
-
import { useState } from "react";
|
|
24
|
+
import { useEffect, useMemo, useState } from "react";
|
|
22
25
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
23
26
|
import { WagmiAdapter } from "@reown/appkit-adapter-wagmi";
|
|
24
27
|
import { SolanaAdapter } from "@reown/appkit-adapter-solana";
|
|
@@ -84,22 +87,24 @@ function getAppKitNetwork(chainId) {
|
|
|
84
87
|
|
|
85
88
|
// src/core/reown.tsx
|
|
86
89
|
import { jsx } from "react/jsx-runtime";
|
|
87
|
-
function buildTransports(rpcUrls) {
|
|
90
|
+
function buildTransports(rpcUrls, networks = EVM_NETWORKS) {
|
|
88
91
|
const transports = {};
|
|
89
|
-
for (const network of
|
|
92
|
+
for (const network of networks) {
|
|
90
93
|
const id = Number(network.id);
|
|
91
94
|
transports[id] = http(rpcUrlFor(rpcUrls, id));
|
|
92
95
|
}
|
|
93
96
|
return transports;
|
|
94
97
|
}
|
|
95
|
-
function getEvmRpcFingerprint(rpcUrls) {
|
|
96
|
-
return
|
|
98
|
+
function getEvmRpcFingerprint(rpcUrls, networks) {
|
|
99
|
+
return networks.map((network) => {
|
|
97
100
|
const id = Number(network.id);
|
|
98
101
|
return `${id}=${rpcUrlFor(rpcUrls, id) ?? ""}`;
|
|
99
102
|
}).join("|");
|
|
100
103
|
}
|
|
101
104
|
var cachedAdapter = null;
|
|
102
105
|
var cachedAdapterKey = null;
|
|
106
|
+
var wagmiConfiguredEvmIds = /* @__PURE__ */ new Set();
|
|
107
|
+
var runtimeNetworkById = /* @__PURE__ */ new Map();
|
|
103
108
|
function mapTheme(theme) {
|
|
104
109
|
const themeMode = theme?.mode === "light" ? "light" : "dark";
|
|
105
110
|
const themeVariables = {};
|
|
@@ -108,25 +113,34 @@ function mapTheme(theme) {
|
|
|
108
113
|
}
|
|
109
114
|
return { themeMode, themeVariables };
|
|
110
115
|
}
|
|
111
|
-
function
|
|
116
|
+
function mergeNetworks(runtime) {
|
|
117
|
+
const byId = /* @__PURE__ */ new Map();
|
|
118
|
+
for (const network of EVM_NETWORKS) byId.set(Number(network.id), network);
|
|
119
|
+
for (const chain of runtime) {
|
|
120
|
+
if (!byId.has(chain.id)) byId.set(chain.id, chain);
|
|
121
|
+
}
|
|
122
|
+
return [...byId.values()];
|
|
123
|
+
}
|
|
124
|
+
function getOrCreateAdapter(projectId, enableSolana, theme, rpcUrls, runtimeChains = []) {
|
|
125
|
+
const networks = mergeNetworks(runtimeChains);
|
|
112
126
|
const adapterKey = [
|
|
113
127
|
projectId,
|
|
114
128
|
enableSolana ? "solana" : "evm",
|
|
115
|
-
getEvmRpcFingerprint(rpcUrls)
|
|
129
|
+
getEvmRpcFingerprint(rpcUrls, networks)
|
|
116
130
|
].join(":");
|
|
117
131
|
if (cachedAdapter && cachedAdapterKey === adapterKey) return cachedAdapter;
|
|
118
132
|
cachedAdapter = new WagmiAdapter({
|
|
119
|
-
networks
|
|
133
|
+
networks,
|
|
120
134
|
projectId,
|
|
121
|
-
transports: buildTransports(rpcUrls)
|
|
135
|
+
transports: buildTransports(rpcUrls, networks)
|
|
122
136
|
});
|
|
123
137
|
cachedAdapterKey = adapterKey;
|
|
124
138
|
const { themeMode, themeVariables } = mapTheme(theme);
|
|
125
139
|
const adapters = enableSolana ? [cachedAdapter, new SolanaAdapter()] : [cachedAdapter];
|
|
126
|
-
const
|
|
127
|
-
createAppKit({
|
|
140
|
+
const appKitNetworks = enableSolana ? [...networks, solana] : networks;
|
|
141
|
+
const appKit = createAppKit({
|
|
128
142
|
adapters,
|
|
129
|
-
networks,
|
|
143
|
+
networks: appKitNetworks,
|
|
130
144
|
projectId,
|
|
131
145
|
themeMode,
|
|
132
146
|
themeVariables,
|
|
@@ -137,17 +151,67 @@ function getOrCreateAdapter(projectId, enableSolana, theme, rpcUrls) {
|
|
|
137
151
|
},
|
|
138
152
|
allowUnsupportedChain: true
|
|
139
153
|
});
|
|
154
|
+
wagmiConfiguredEvmIds = new Set(networks.map((n) => Number(n.id)));
|
|
155
|
+
for (const chain of runtimeChains) {
|
|
156
|
+
runtimeNetworkById.set(chain.id, chain);
|
|
157
|
+
try {
|
|
158
|
+
appKit.addNetwork("eip155", chain);
|
|
159
|
+
} catch {
|
|
160
|
+
}
|
|
161
|
+
}
|
|
140
162
|
return cachedAdapter;
|
|
141
163
|
}
|
|
164
|
+
function chainDisplayName(chainId) {
|
|
165
|
+
const runtime = runtimeNetworkById.get(chainId);
|
|
166
|
+
if (runtime) return runtime.name;
|
|
167
|
+
return getChainName(chainId);
|
|
168
|
+
}
|
|
169
|
+
function resolveAppKitNetwork(chainId) {
|
|
170
|
+
return getAppKitNetwork(chainId) ?? runtimeNetworkById.get(chainId);
|
|
171
|
+
}
|
|
142
172
|
function ReownWalletProvider({
|
|
143
173
|
projectId,
|
|
144
174
|
theme,
|
|
145
175
|
enableSolana = true,
|
|
146
|
-
rpcUrls,
|
|
176
|
+
rpcUrls: rpcUrlsProp,
|
|
177
|
+
backendUrl,
|
|
147
178
|
children
|
|
148
179
|
}) {
|
|
180
|
+
const rpcUrls = useStableRpcUrls(rpcUrlsProp);
|
|
149
181
|
const [queryClient] = useState(() => new QueryClient());
|
|
150
|
-
const
|
|
182
|
+
const overrides = useMemo(() => {
|
|
183
|
+
if (!rpcUrls) return void 0;
|
|
184
|
+
const out = {};
|
|
185
|
+
for (const [key, url] of Object.entries(rpcUrls)) {
|
|
186
|
+
const id = Number(key);
|
|
187
|
+
if (Number.isFinite(id) && typeof url === "string") out[id] = url;
|
|
188
|
+
}
|
|
189
|
+
return out;
|
|
190
|
+
}, [rpcUrls]);
|
|
191
|
+
const [state, setState] = useState(() => {
|
|
192
|
+
const primed = peekRuntimeChains(backendUrl, overrides);
|
|
193
|
+
return { ready: primed !== null, chains: primed ?? [] };
|
|
194
|
+
});
|
|
195
|
+
useEffect(() => {
|
|
196
|
+
let active = true;
|
|
197
|
+
const primed = peekRuntimeChains(backendUrl, overrides);
|
|
198
|
+
setState({ ready: primed !== null, chains: primed ?? [] });
|
|
199
|
+
primeRuntimeChains(backendUrl, overrides).then((chains) => {
|
|
200
|
+
if (active) setState({ ready: true, chains });
|
|
201
|
+
});
|
|
202
|
+
return () => {
|
|
203
|
+
active = false;
|
|
204
|
+
};
|
|
205
|
+
}, [backendUrl, overrides]);
|
|
206
|
+
if (!state.ready) return null;
|
|
207
|
+
const runtimeChains = state.chains;
|
|
208
|
+
const adapter = getOrCreateAdapter(
|
|
209
|
+
projectId,
|
|
210
|
+
enableSolana,
|
|
211
|
+
theme,
|
|
212
|
+
rpcUrls,
|
|
213
|
+
runtimeChains
|
|
214
|
+
);
|
|
151
215
|
const config = adapter.wagmiConfig;
|
|
152
216
|
return /* @__PURE__ */ jsx(WagmiProvider, { config, children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children }) });
|
|
153
217
|
}
|
|
@@ -181,7 +245,12 @@ function useReownWallet() {
|
|
|
181
245
|
void modal?.disconnect();
|
|
182
246
|
},
|
|
183
247
|
switchChain: async (chainId) => {
|
|
184
|
-
|
|
248
|
+
if (!wagmiConfiguredEvmIds.has(chainId)) {
|
|
249
|
+
throw new Error(
|
|
250
|
+
`Switch to ${chainDisplayName(chainId)} in your wallet to continue`
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
const target = resolveAppKitNetwork(chainId);
|
|
185
254
|
try {
|
|
186
255
|
if (target) {
|
|
187
256
|
await switchNetwork(target);
|
|
@@ -191,7 +260,7 @@ function useReownWallet() {
|
|
|
191
260
|
} catch (err) {
|
|
192
261
|
if (isUnsupportedChainSwitchError(err)) {
|
|
193
262
|
throw new Error(
|
|
194
|
-
`Switch to ${
|
|
263
|
+
`Switch to ${chainDisplayName(chainId)} in your wallet to continue`
|
|
195
264
|
);
|
|
196
265
|
}
|
|
197
266
|
throw err;
|
|
@@ -208,7 +277,7 @@ function DepositModalWithReown(props) {
|
|
|
208
277
|
const reown = useReownWallet();
|
|
209
278
|
const { walletProvider: solanaWalletProvider } = useAppKitProvider("solana");
|
|
210
279
|
const { connection: solanaConnection } = useAppKitConnection();
|
|
211
|
-
const reownWithSolana =
|
|
280
|
+
const reownWithSolana = useMemo2(
|
|
212
281
|
() => ({
|
|
213
282
|
...reown,
|
|
214
283
|
solanaProvider: reown.isSolana ? solanaWalletProvider : void 0,
|
|
@@ -237,6 +306,7 @@ function DepositModalReown(props) {
|
|
|
237
306
|
ReownWalletProvider,
|
|
238
307
|
{
|
|
239
308
|
projectId: props.reownAppId,
|
|
309
|
+
backendUrl: props.backendUrl,
|
|
240
310
|
theme: props.theme,
|
|
241
311
|
rpcUrls: props.rpcUrls,
|
|
242
312
|
children: /* @__PURE__ */ jsx2(DepositModalWithReown, { ...props })
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var _chunkSSQ27YFBcjs = require('./chunk-SSQ27YFB.cjs');
|
|
4
|
+
require('./chunk-HUHBNYD3.cjs');
|
|
5
|
+
require('./chunk-FVUXJ3RP.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var _chunkPUJHXHRAcjs = require('./chunk-PUJHXHRA.cjs');
|
|
10
|
-
require('./chunk-NF4NBRUP.cjs');
|
|
11
|
-
require('./chunk-YEBXUUH3.cjs');
|
|
12
9
|
|
|
13
10
|
|
|
14
11
|
|
|
15
|
-
var
|
|
12
|
+
var _chunkZQR36NCVcjs = require('./chunk-ZQR36NCV.cjs');
|
|
13
|
+
require('./chunk-4FTI3GTB.cjs');
|
|
14
|
+
require('./chunk-JPRV36DT.cjs');
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunkTENL4H64cjs = require('./chunk-TENL4H64.cjs');
|
|
16
19
|
|
|
17
20
|
// src/DepositModalReown.tsx
|
|
18
21
|
var _react = require('react');
|
|
@@ -69,7 +72,7 @@ var APPKIT_NETWORK_BY_ID = {
|
|
|
69
72
|
[_networks.katana.id]: _networks.katana,
|
|
70
73
|
[_networks.hyperEvm.id]: _networks.hyperEvm
|
|
71
74
|
};
|
|
72
|
-
var EVM_NETWORKS =
|
|
75
|
+
var EVM_NETWORKS = _chunkTENL4H64cjs.SUPPORTED_CHAINS.map((chain) => {
|
|
73
76
|
const network = APPKIT_NETWORK_BY_ID[chain.id];
|
|
74
77
|
if (!network) {
|
|
75
78
|
throw new Error(
|
|
@@ -84,22 +87,24 @@ function getAppKitNetwork(chainId) {
|
|
|
84
87
|
|
|
85
88
|
// src/core/reown.tsx
|
|
86
89
|
var _jsxruntime = require('react/jsx-runtime');
|
|
87
|
-
function buildTransports(rpcUrls) {
|
|
90
|
+
function buildTransports(rpcUrls, networks = EVM_NETWORKS) {
|
|
88
91
|
const transports = {};
|
|
89
|
-
for (const network of
|
|
92
|
+
for (const network of networks) {
|
|
90
93
|
const id = Number(network.id);
|
|
91
|
-
transports[id] = _viem.http.call(void 0,
|
|
94
|
+
transports[id] = _viem.http.call(void 0, _chunkZQR36NCVcjs.rpcUrlFor.call(void 0, rpcUrls, id));
|
|
92
95
|
}
|
|
93
96
|
return transports;
|
|
94
97
|
}
|
|
95
|
-
function getEvmRpcFingerprint(rpcUrls) {
|
|
96
|
-
return
|
|
98
|
+
function getEvmRpcFingerprint(rpcUrls, networks) {
|
|
99
|
+
return networks.map((network) => {
|
|
97
100
|
const id = Number(network.id);
|
|
98
|
-
return `${id}=${_nullishCoalesce(
|
|
101
|
+
return `${id}=${_nullishCoalesce(_chunkZQR36NCVcjs.rpcUrlFor.call(void 0, rpcUrls, id), () => ( ""))}`;
|
|
99
102
|
}).join("|");
|
|
100
103
|
}
|
|
101
104
|
var cachedAdapter = null;
|
|
102
105
|
var cachedAdapterKey = null;
|
|
106
|
+
var wagmiConfiguredEvmIds = /* @__PURE__ */ new Set();
|
|
107
|
+
var runtimeNetworkById = /* @__PURE__ */ new Map();
|
|
103
108
|
function mapTheme(theme) {
|
|
104
109
|
const themeMode = _optionalChain([theme, 'optionalAccess', _ => _.mode]) === "light" ? "light" : "dark";
|
|
105
110
|
const themeVariables = {};
|
|
@@ -108,25 +113,34 @@ function mapTheme(theme) {
|
|
|
108
113
|
}
|
|
109
114
|
return { themeMode, themeVariables };
|
|
110
115
|
}
|
|
111
|
-
function
|
|
116
|
+
function mergeNetworks(runtime) {
|
|
117
|
+
const byId = /* @__PURE__ */ new Map();
|
|
118
|
+
for (const network of EVM_NETWORKS) byId.set(Number(network.id), network);
|
|
119
|
+
for (const chain of runtime) {
|
|
120
|
+
if (!byId.has(chain.id)) byId.set(chain.id, chain);
|
|
121
|
+
}
|
|
122
|
+
return [...byId.values()];
|
|
123
|
+
}
|
|
124
|
+
function getOrCreateAdapter(projectId, enableSolana, theme, rpcUrls, runtimeChains = []) {
|
|
125
|
+
const networks = mergeNetworks(runtimeChains);
|
|
112
126
|
const adapterKey = [
|
|
113
127
|
projectId,
|
|
114
128
|
enableSolana ? "solana" : "evm",
|
|
115
|
-
getEvmRpcFingerprint(rpcUrls)
|
|
129
|
+
getEvmRpcFingerprint(rpcUrls, networks)
|
|
116
130
|
].join(":");
|
|
117
131
|
if (cachedAdapter && cachedAdapterKey === adapterKey) return cachedAdapter;
|
|
118
132
|
cachedAdapter = new (0, _appkitadapterwagmi.WagmiAdapter)({
|
|
119
|
-
networks
|
|
133
|
+
networks,
|
|
120
134
|
projectId,
|
|
121
|
-
transports: buildTransports(rpcUrls)
|
|
135
|
+
transports: buildTransports(rpcUrls, networks)
|
|
122
136
|
});
|
|
123
137
|
cachedAdapterKey = adapterKey;
|
|
124
138
|
const { themeMode, themeVariables } = mapTheme(theme);
|
|
125
139
|
const adapters = enableSolana ? [cachedAdapter, new (0, _appkitadaptersolana.SolanaAdapter)()] : [cachedAdapter];
|
|
126
|
-
const
|
|
127
|
-
_react3.createAppKit.call(void 0, {
|
|
140
|
+
const appKitNetworks = enableSolana ? [...networks, _networks.solana] : networks;
|
|
141
|
+
const appKit = _react3.createAppKit.call(void 0, {
|
|
128
142
|
adapters,
|
|
129
|
-
networks,
|
|
143
|
+
networks: appKitNetworks,
|
|
130
144
|
projectId,
|
|
131
145
|
themeMode,
|
|
132
146
|
themeVariables,
|
|
@@ -137,17 +151,67 @@ function getOrCreateAdapter(projectId, enableSolana, theme, rpcUrls) {
|
|
|
137
151
|
},
|
|
138
152
|
allowUnsupportedChain: true
|
|
139
153
|
});
|
|
154
|
+
wagmiConfiguredEvmIds = new Set(networks.map((n) => Number(n.id)));
|
|
155
|
+
for (const chain of runtimeChains) {
|
|
156
|
+
runtimeNetworkById.set(chain.id, chain);
|
|
157
|
+
try {
|
|
158
|
+
appKit.addNetwork("eip155", chain);
|
|
159
|
+
} catch (e) {
|
|
160
|
+
}
|
|
161
|
+
}
|
|
140
162
|
return cachedAdapter;
|
|
141
163
|
}
|
|
164
|
+
function chainDisplayName(chainId) {
|
|
165
|
+
const runtime = runtimeNetworkById.get(chainId);
|
|
166
|
+
if (runtime) return runtime.name;
|
|
167
|
+
return _chunkTENL4H64cjs.getChainName.call(void 0, chainId);
|
|
168
|
+
}
|
|
169
|
+
function resolveAppKitNetwork(chainId) {
|
|
170
|
+
return _nullishCoalesce(getAppKitNetwork(chainId), () => ( runtimeNetworkById.get(chainId)));
|
|
171
|
+
}
|
|
142
172
|
function ReownWalletProvider({
|
|
143
173
|
projectId,
|
|
144
174
|
theme,
|
|
145
175
|
enableSolana = true,
|
|
146
|
-
rpcUrls,
|
|
176
|
+
rpcUrls: rpcUrlsProp,
|
|
177
|
+
backendUrl,
|
|
147
178
|
children
|
|
148
179
|
}) {
|
|
180
|
+
const rpcUrls = _chunkZQR36NCVcjs.useStableRpcUrls.call(void 0, rpcUrlsProp);
|
|
149
181
|
const [queryClient] = _react.useState.call(void 0, () => new (0, _reactquery.QueryClient)());
|
|
150
|
-
const
|
|
182
|
+
const overrides = _react.useMemo.call(void 0, () => {
|
|
183
|
+
if (!rpcUrls) return void 0;
|
|
184
|
+
const out = {};
|
|
185
|
+
for (const [key, url] of Object.entries(rpcUrls)) {
|
|
186
|
+
const id = Number(key);
|
|
187
|
+
if (Number.isFinite(id) && typeof url === "string") out[id] = url;
|
|
188
|
+
}
|
|
189
|
+
return out;
|
|
190
|
+
}, [rpcUrls]);
|
|
191
|
+
const [state, setState] = _react.useState.call(void 0, () => {
|
|
192
|
+
const primed = _chunkZQR36NCVcjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
|
|
193
|
+
return { ready: primed !== null, chains: _nullishCoalesce(primed, () => ( [])) };
|
|
194
|
+
});
|
|
195
|
+
_react.useEffect.call(void 0, () => {
|
|
196
|
+
let active = true;
|
|
197
|
+
const primed = _chunkZQR36NCVcjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
|
|
198
|
+
setState({ ready: primed !== null, chains: _nullishCoalesce(primed, () => ( [])) });
|
|
199
|
+
_chunkZQR36NCVcjs.primeRuntimeChains.call(void 0, backendUrl, overrides).then((chains) => {
|
|
200
|
+
if (active) setState({ ready: true, chains });
|
|
201
|
+
});
|
|
202
|
+
return () => {
|
|
203
|
+
active = false;
|
|
204
|
+
};
|
|
205
|
+
}, [backendUrl, overrides]);
|
|
206
|
+
if (!state.ready) return null;
|
|
207
|
+
const runtimeChains = state.chains;
|
|
208
|
+
const adapter = getOrCreateAdapter(
|
|
209
|
+
projectId,
|
|
210
|
+
enableSolana,
|
|
211
|
+
theme,
|
|
212
|
+
rpcUrls,
|
|
213
|
+
runtimeChains
|
|
214
|
+
);
|
|
151
215
|
const config = adapter.wagmiConfig;
|
|
152
216
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _wagmi.WagmiProvider, { config, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider, { client: queryClient, children }) });
|
|
153
217
|
}
|
|
@@ -181,7 +245,12 @@ function useReownWallet() {
|
|
|
181
245
|
void _optionalChain([_react3.modal, 'optionalAccess', _12 => _12.disconnect, 'call', _13 => _13()]);
|
|
182
246
|
},
|
|
183
247
|
switchChain: async (chainId) => {
|
|
184
|
-
|
|
248
|
+
if (!wagmiConfiguredEvmIds.has(chainId)) {
|
|
249
|
+
throw new Error(
|
|
250
|
+
`Switch to ${chainDisplayName(chainId)} in your wallet to continue`
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
const target = resolveAppKitNetwork(chainId);
|
|
185
254
|
try {
|
|
186
255
|
if (target) {
|
|
187
256
|
await switchNetwork(target);
|
|
@@ -189,9 +258,9 @@ function useReownWallet() {
|
|
|
189
258
|
await switchChainAsync({ chainId });
|
|
190
259
|
}
|
|
191
260
|
} catch (err) {
|
|
192
|
-
if (
|
|
261
|
+
if (_chunkZQR36NCVcjs.isUnsupportedChainSwitchError.call(void 0, err)) {
|
|
193
262
|
throw new Error(
|
|
194
|
-
`Switch to ${
|
|
263
|
+
`Switch to ${chainDisplayName(chainId)} in your wallet to continue`
|
|
195
264
|
);
|
|
196
265
|
}
|
|
197
266
|
throw err;
|
|
@@ -223,7 +292,7 @@ function DepositModalWithReown(props) {
|
|
|
223
292
|
reown.disconnect();
|
|
224
293
|
}, [reown.disconnect]);
|
|
225
294
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
226
|
-
|
|
295
|
+
_chunkSSQ27YFBcjs.DepositModalInner,
|
|
227
296
|
{
|
|
228
297
|
...props,
|
|
229
298
|
reownWallet: reownWithSolana,
|
|
@@ -237,6 +306,7 @@ function DepositModalReown(props) {
|
|
|
237
306
|
ReownWalletProvider,
|
|
238
307
|
{
|
|
239
308
|
projectId: props.reownAppId,
|
|
309
|
+
backendUrl: props.backendUrl,
|
|
240
310
|
theme: props.theme,
|
|
241
311
|
rpcUrls: props.rpcUrls,
|
|
242
312
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DepositModalWithReown, { ...props })
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HyperCore — Hyperliquid's virtual trading L1, settling on HyperEVM (999). It
|
|
3
|
+
* is USDC-only and requires an EOA recipient. It has no node of its own and
|
|
4
|
+
* must never be used as an EVM RPC target.
|
|
5
|
+
*
|
|
6
|
+
* 1337 is the modal's INTERNAL key for HyperCore in the bundled registry, the
|
|
7
|
+
* display tables and the icon map, shared by the source and destination paths.
|
|
8
|
+
* It is not a chain id anyone can dial and it never reaches the backend —
|
|
9
|
+
* `targetChainToCaip2` is the only thing that answers what does.
|
|
10
|
+
*
|
|
11
|
+
* @deprecated as a `targetChain` value. It still works and still derives the
|
|
12
|
+
* same account, but it names the Core L1 rather than the venue a delivery
|
|
13
|
+
* credits; pass {@link HYPERCORE_SPOT_CAIP2} instead.
|
|
14
|
+
*/
|
|
15
|
+
declare const HYPERCORE_CHAIN_ID = 1337;
|
|
16
|
+
/**
|
|
17
|
+
* HyperCore's spot venue — the canonical `targetChain` for a HyperCore
|
|
18
|
+
* delivery, and the only venue this product delivers to.
|
|
19
|
+
*
|
|
20
|
+
* HyperCore is addressed per delivery venue because a credit has to name the
|
|
21
|
+
* account it lands in: spot and perp margin are different balances. Perp
|
|
22
|
+
* (`hypercore:perp`) is deliberately unreachable from here — a managed account
|
|
23
|
+
* cannot sign the perp→spot transfer, so funds delivered there are stranded.
|
|
24
|
+
*/
|
|
25
|
+
declare const HYPERCORE_SPOT_CAIP2: "hypercore:spot";
|
|
26
|
+
/**
|
|
27
|
+
* Every accepted `targetChain` spelling: an EVM chain id, the `"solana"`
|
|
28
|
+
* sentinel, or a HyperCore delivery venue.
|
|
29
|
+
*/
|
|
30
|
+
type TargetChain = number | "solana" | typeof HYPERCORE_SPOT_CAIP2;
|
|
31
|
+
/** Canonical USDC on HyperEVM (999), the HyperCore settlement chain. */
|
|
32
|
+
declare const HYPERCORE_USDC_ADDRESS = "0xb88339CB7199b77E23DB6E890353E22632Ba630f";
|
|
33
|
+
/**
|
|
34
|
+
* USDT0 on HyperEVM (999). HyperCore-origin deposits accept USDC *and* USDT0
|
|
35
|
+
* (both land on HyperEVM and route out via the orchestrator). Destination
|
|
36
|
+
* delivery stays USDC-only, so this is a *source*-token address only.
|
|
37
|
+
*/
|
|
38
|
+
declare const HYPERCORE_USDT0_ADDRESS = "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb";
|
|
39
|
+
|
|
40
|
+
export { HYPERCORE_CHAIN_ID as H, type TargetChain as T, HYPERCORE_SPOT_CAIP2 as a, HYPERCORE_USDC_ADDRESS as b, HYPERCORE_USDT0_ADDRESS as c };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HyperCore — Hyperliquid's virtual trading L1, settling on HyperEVM (999). It
|
|
3
|
+
* is USDC-only and requires an EOA recipient. It has no node of its own and
|
|
4
|
+
* must never be used as an EVM RPC target.
|
|
5
|
+
*
|
|
6
|
+
* 1337 is the modal's INTERNAL key for HyperCore in the bundled registry, the
|
|
7
|
+
* display tables and the icon map, shared by the source and destination paths.
|
|
8
|
+
* It is not a chain id anyone can dial and it never reaches the backend —
|
|
9
|
+
* `targetChainToCaip2` is the only thing that answers what does.
|
|
10
|
+
*
|
|
11
|
+
* @deprecated as a `targetChain` value. It still works and still derives the
|
|
12
|
+
* same account, but it names the Core L1 rather than the venue a delivery
|
|
13
|
+
* credits; pass {@link HYPERCORE_SPOT_CAIP2} instead.
|
|
14
|
+
*/
|
|
15
|
+
declare const HYPERCORE_CHAIN_ID = 1337;
|
|
16
|
+
/**
|
|
17
|
+
* HyperCore's spot venue — the canonical `targetChain` for a HyperCore
|
|
18
|
+
* delivery, and the only venue this product delivers to.
|
|
19
|
+
*
|
|
20
|
+
* HyperCore is addressed per delivery venue because a credit has to name the
|
|
21
|
+
* account it lands in: spot and perp margin are different balances. Perp
|
|
22
|
+
* (`hypercore:perp`) is deliberately unreachable from here — a managed account
|
|
23
|
+
* cannot sign the perp→spot transfer, so funds delivered there are stranded.
|
|
24
|
+
*/
|
|
25
|
+
declare const HYPERCORE_SPOT_CAIP2: "hypercore:spot";
|
|
26
|
+
/**
|
|
27
|
+
* Every accepted `targetChain` spelling: an EVM chain id, the `"solana"`
|
|
28
|
+
* sentinel, or a HyperCore delivery venue.
|
|
29
|
+
*/
|
|
30
|
+
type TargetChain = number | "solana" | typeof HYPERCORE_SPOT_CAIP2;
|
|
31
|
+
/** Canonical USDC on HyperEVM (999), the HyperCore settlement chain. */
|
|
32
|
+
declare const HYPERCORE_USDC_ADDRESS = "0xb88339CB7199b77E23DB6E890353E22632Ba630f";
|
|
33
|
+
/**
|
|
34
|
+
* USDT0 on HyperEVM (999). HyperCore-origin deposits accept USDC *and* USDT0
|
|
35
|
+
* (both land on HyperEVM and route out via the orchestrator). Destination
|
|
36
|
+
* delivery stays USDC-only, so this is a *source*-token address only.
|
|
37
|
+
*/
|
|
38
|
+
declare const HYPERCORE_USDT0_ADDRESS = "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb";
|
|
39
|
+
|
|
40
|
+
export { HYPERCORE_CHAIN_ID as H, type TargetChain as T, HYPERCORE_SPOT_CAIP2 as a, HYPERCORE_USDC_ADDRESS as b, HYPERCORE_USDT0_ADDRESS as c };
|