@rhinestone/deposit-modal 0.0.0-dev-20260806100527 → 0.0.0-dev-20260811103135
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-CR57WJOI.mjs → DepositModalReown-BUMVIAEZ.mjs} +92 -24
- package/dist/{DepositModalReown-SK72STHB.cjs → DepositModalReown-O5NLY2WC.cjs} +94 -26
- package/dist/{chunk-B66AFFZ4.mjs → chunk-2RYFHY2A.mjs} +12 -9
- package/dist/{chunk-27G4LMBV.mjs → chunk-4TLMWZ5C.mjs} +6 -26
- package/dist/{chunk-3RC56FHE.cjs → chunk-6CM7PV7M.cjs} +81 -101
- package/dist/{chunk-ILT2PITN.mjs → chunk-DMTNBUAS.mjs} +1 -1
- package/dist/{chunk-OMAAM7P6.cjs → chunk-DPT7OWNI.cjs} +92 -90
- package/dist/{chunk-Q7WVRUH6.mjs → chunk-EBHG4TCS.mjs} +1 -1
- package/dist/{chunk-H577RJN5.cjs → chunk-EH3HQG6X.cjs} +168 -27
- package/dist/{chunk-LVX64DC2.mjs → chunk-FBF33G7H.mjs} +703 -164
- package/dist/{chunk-UB7VDX4Z.cjs → chunk-FCX7VVMT.cjs} +66 -63
- package/dist/{chunk-LTHMPF7N.cjs → chunk-LDSUGF4F.cjs} +606 -557
- package/dist/{chunk-YEBXUUH3.cjs → chunk-LFLZKER5.cjs} +2 -2
- package/dist/{chunk-A223BLVC.mjs → chunk-QNLLFX6X.mjs} +159 -18
- package/dist/{chunk-S6GUYVNH.mjs → chunk-SVWVI55K.mjs} +23 -21
- package/dist/{chunk-QZDPB44N.mjs → chunk-WP6NQ764.mjs} +1 -1
- package/dist/{chunk-ODUKDCAQ.cjs → chunk-YBYIGKNG.cjs} +3 -3
- package/dist/{chunk-I2RNB3DF.cjs → chunk-YQH7E3VN.cjs} +1 -1
- package/dist/{chunk-R7ZGHZOD.mjs → chunk-Z3YWA7R6.mjs} +106 -57
- package/dist/{chunk-NLUDG3G2.cjs → chunk-ZJGGLTHS.cjs} +785 -246
- package/dist/claim.cjs +6 -6
- package/dist/claim.mjs +5 -5
- package/dist/constants.cjs +3 -3
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.mjs +2 -2
- package/dist/deposit.cjs +8 -8
- package/dist/deposit.mjs +7 -7
- package/dist/index.cjs +10 -10
- package/dist/index.mjs +9 -9
- package/dist/polymarket.cjs +5 -5
- package/dist/polymarket.mjs +2 -2
- package/dist/withdraw.cjs +6 -6
- package/dist/withdraw.mjs +5 -5
- package/package.json +1 -1
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DepositModalInner
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-Z3YWA7R6.mjs";
|
|
4
|
+
import "./chunk-4TLMWZ5C.mjs";
|
|
5
|
+
import "./chunk-WP6NQ764.mjs";
|
|
6
6
|
import {
|
|
7
7
|
isUnsupportedChainSwitchError,
|
|
8
|
+
peekRuntimeChains,
|
|
9
|
+
primeRuntimeChains,
|
|
8
10
|
rpcUrlFor
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-FBF33G7H.mjs";
|
|
12
|
+
import "./chunk-EBHG4TCS.mjs";
|
|
13
|
+
import "./chunk-DMTNBUAS.mjs";
|
|
12
14
|
import {
|
|
13
15
|
SUPPORTED_CHAINS,
|
|
14
16
|
getChainName
|
|
15
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-QNLLFX6X.mjs";
|
|
16
18
|
|
|
17
19
|
// src/DepositModalReown.tsx
|
|
18
|
-
import { useCallback, useMemo } from "react";
|
|
20
|
+
import { useCallback, useMemo as useMemo2 } from "react";
|
|
19
21
|
|
|
20
22
|
// src/core/reown.tsx
|
|
21
|
-
import { useState } from "react";
|
|
23
|
+
import { useEffect, useMemo, useState } from "react";
|
|
22
24
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
23
25
|
import { WagmiAdapter } from "@reown/appkit-adapter-wagmi";
|
|
24
26
|
import { SolanaAdapter } from "@reown/appkit-adapter-solana";
|
|
@@ -84,22 +86,24 @@ function getAppKitNetwork(chainId) {
|
|
|
84
86
|
|
|
85
87
|
// src/core/reown.tsx
|
|
86
88
|
import { jsx } from "react/jsx-runtime";
|
|
87
|
-
function buildTransports(rpcUrls) {
|
|
89
|
+
function buildTransports(rpcUrls, networks = EVM_NETWORKS) {
|
|
88
90
|
const transports = {};
|
|
89
|
-
for (const network of
|
|
91
|
+
for (const network of networks) {
|
|
90
92
|
const id = Number(network.id);
|
|
91
93
|
transports[id] = http(rpcUrlFor(rpcUrls, id));
|
|
92
94
|
}
|
|
93
95
|
return transports;
|
|
94
96
|
}
|
|
95
|
-
function getEvmRpcFingerprint(rpcUrls) {
|
|
96
|
-
return
|
|
97
|
+
function getEvmRpcFingerprint(rpcUrls, networks) {
|
|
98
|
+
return networks.map((network) => {
|
|
97
99
|
const id = Number(network.id);
|
|
98
100
|
return `${id}=${rpcUrlFor(rpcUrls, id) ?? ""}`;
|
|
99
101
|
}).join("|");
|
|
100
102
|
}
|
|
101
103
|
var cachedAdapter = null;
|
|
102
104
|
var cachedAdapterKey = null;
|
|
105
|
+
var wagmiConfiguredEvmIds = /* @__PURE__ */ new Set();
|
|
106
|
+
var runtimeNetworkById = /* @__PURE__ */ new Map();
|
|
103
107
|
function mapTheme(theme) {
|
|
104
108
|
const themeMode = theme?.mode === "light" ? "light" : "dark";
|
|
105
109
|
const themeVariables = {};
|
|
@@ -108,25 +112,34 @@ function mapTheme(theme) {
|
|
|
108
112
|
}
|
|
109
113
|
return { themeMode, themeVariables };
|
|
110
114
|
}
|
|
111
|
-
function
|
|
115
|
+
function mergeNetworks(runtime) {
|
|
116
|
+
const byId = /* @__PURE__ */ new Map();
|
|
117
|
+
for (const network of EVM_NETWORKS) byId.set(Number(network.id), network);
|
|
118
|
+
for (const chain of runtime) {
|
|
119
|
+
if (!byId.has(chain.id)) byId.set(chain.id, chain);
|
|
120
|
+
}
|
|
121
|
+
return [...byId.values()];
|
|
122
|
+
}
|
|
123
|
+
function getOrCreateAdapter(projectId, enableSolana, theme, rpcUrls, runtimeChains = []) {
|
|
124
|
+
const networks = mergeNetworks(runtimeChains);
|
|
112
125
|
const adapterKey = [
|
|
113
126
|
projectId,
|
|
114
127
|
enableSolana ? "solana" : "evm",
|
|
115
|
-
getEvmRpcFingerprint(rpcUrls)
|
|
128
|
+
getEvmRpcFingerprint(rpcUrls, networks)
|
|
116
129
|
].join(":");
|
|
117
130
|
if (cachedAdapter && cachedAdapterKey === adapterKey) return cachedAdapter;
|
|
118
131
|
cachedAdapter = new WagmiAdapter({
|
|
119
|
-
networks
|
|
132
|
+
networks,
|
|
120
133
|
projectId,
|
|
121
|
-
transports: buildTransports(rpcUrls)
|
|
134
|
+
transports: buildTransports(rpcUrls, networks)
|
|
122
135
|
});
|
|
123
136
|
cachedAdapterKey = adapterKey;
|
|
124
137
|
const { themeMode, themeVariables } = mapTheme(theme);
|
|
125
138
|
const adapters = enableSolana ? [cachedAdapter, new SolanaAdapter()] : [cachedAdapter];
|
|
126
|
-
const
|
|
127
|
-
createAppKit({
|
|
139
|
+
const appKitNetworks = enableSolana ? [...networks, solana] : networks;
|
|
140
|
+
const appKit = createAppKit({
|
|
128
141
|
adapters,
|
|
129
|
-
networks,
|
|
142
|
+
networks: appKitNetworks,
|
|
130
143
|
projectId,
|
|
131
144
|
themeMode,
|
|
132
145
|
themeVariables,
|
|
@@ -137,17 +150,66 @@ function getOrCreateAdapter(projectId, enableSolana, theme, rpcUrls) {
|
|
|
137
150
|
},
|
|
138
151
|
allowUnsupportedChain: true
|
|
139
152
|
});
|
|
153
|
+
wagmiConfiguredEvmIds = new Set(networks.map((n) => Number(n.id)));
|
|
154
|
+
for (const chain of runtimeChains) {
|
|
155
|
+
runtimeNetworkById.set(chain.id, chain);
|
|
156
|
+
try {
|
|
157
|
+
appKit.addNetwork("eip155", chain);
|
|
158
|
+
} catch {
|
|
159
|
+
}
|
|
160
|
+
}
|
|
140
161
|
return cachedAdapter;
|
|
141
162
|
}
|
|
163
|
+
function chainDisplayName(chainId) {
|
|
164
|
+
const runtime = runtimeNetworkById.get(chainId);
|
|
165
|
+
if (runtime) return runtime.name;
|
|
166
|
+
return getChainName(chainId);
|
|
167
|
+
}
|
|
168
|
+
function resolveAppKitNetwork(chainId) {
|
|
169
|
+
return getAppKitNetwork(chainId) ?? runtimeNetworkById.get(chainId);
|
|
170
|
+
}
|
|
142
171
|
function ReownWalletProvider({
|
|
143
172
|
projectId,
|
|
144
173
|
theme,
|
|
145
174
|
enableSolana = true,
|
|
146
175
|
rpcUrls,
|
|
176
|
+
backendUrl,
|
|
147
177
|
children
|
|
148
178
|
}) {
|
|
149
179
|
const [queryClient] = useState(() => new QueryClient());
|
|
150
|
-
const
|
|
180
|
+
const overrides = useMemo(() => {
|
|
181
|
+
if (!rpcUrls) return void 0;
|
|
182
|
+
const out = {};
|
|
183
|
+
for (const [key, url] of Object.entries(rpcUrls)) {
|
|
184
|
+
const id = Number(key);
|
|
185
|
+
if (Number.isFinite(id) && typeof url === "string") out[id] = url;
|
|
186
|
+
}
|
|
187
|
+
return out;
|
|
188
|
+
}, [rpcUrls]);
|
|
189
|
+
const [state, setState] = useState(() => {
|
|
190
|
+
const primed = peekRuntimeChains(backendUrl, overrides);
|
|
191
|
+
return { ready: primed !== null, chains: primed ?? [] };
|
|
192
|
+
});
|
|
193
|
+
useEffect(() => {
|
|
194
|
+
let active = true;
|
|
195
|
+
const primed = peekRuntimeChains(backendUrl, overrides);
|
|
196
|
+
setState({ ready: primed !== null, chains: primed ?? [] });
|
|
197
|
+
primeRuntimeChains(backendUrl, overrides).then((chains) => {
|
|
198
|
+
if (active) setState({ ready: true, chains });
|
|
199
|
+
});
|
|
200
|
+
return () => {
|
|
201
|
+
active = false;
|
|
202
|
+
};
|
|
203
|
+
}, [backendUrl, overrides]);
|
|
204
|
+
if (!state.ready) return null;
|
|
205
|
+
const runtimeChains = state.chains;
|
|
206
|
+
const adapter = getOrCreateAdapter(
|
|
207
|
+
projectId,
|
|
208
|
+
enableSolana,
|
|
209
|
+
theme,
|
|
210
|
+
rpcUrls,
|
|
211
|
+
runtimeChains
|
|
212
|
+
);
|
|
151
213
|
const config = adapter.wagmiConfig;
|
|
152
214
|
return /* @__PURE__ */ jsx(WagmiProvider, { config, children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children }) });
|
|
153
215
|
}
|
|
@@ -181,7 +243,12 @@ function useReownWallet() {
|
|
|
181
243
|
void modal?.disconnect();
|
|
182
244
|
},
|
|
183
245
|
switchChain: async (chainId) => {
|
|
184
|
-
|
|
246
|
+
if (!wagmiConfiguredEvmIds.has(chainId)) {
|
|
247
|
+
throw new Error(
|
|
248
|
+
`Switch to ${chainDisplayName(chainId)} in your wallet to continue`
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
const target = resolveAppKitNetwork(chainId);
|
|
185
252
|
try {
|
|
186
253
|
if (target) {
|
|
187
254
|
await switchNetwork(target);
|
|
@@ -191,7 +258,7 @@ function useReownWallet() {
|
|
|
191
258
|
} catch (err) {
|
|
192
259
|
if (isUnsupportedChainSwitchError(err)) {
|
|
193
260
|
throw new Error(
|
|
194
|
-
`Switch to ${
|
|
261
|
+
`Switch to ${chainDisplayName(chainId)} in your wallet to continue`
|
|
195
262
|
);
|
|
196
263
|
}
|
|
197
264
|
throw err;
|
|
@@ -208,7 +275,7 @@ function DepositModalWithReown(props) {
|
|
|
208
275
|
const reown = useReownWallet();
|
|
209
276
|
const { walletProvider: solanaWalletProvider } = useAppKitProvider("solana");
|
|
210
277
|
const { connection: solanaConnection } = useAppKitConnection();
|
|
211
|
-
const reownWithSolana =
|
|
278
|
+
const reownWithSolana = useMemo2(
|
|
212
279
|
() => ({
|
|
213
280
|
...reown,
|
|
214
281
|
solanaProvider: reown.isSolana ? solanaWalletProvider : void 0,
|
|
@@ -237,6 +304,7 @@ function DepositModalReown(props) {
|
|
|
237
304
|
ReownWalletProvider,
|
|
238
305
|
{
|
|
239
306
|
projectId: props.reownAppId,
|
|
307
|
+
backendUrl: props.backendUrl,
|
|
240
308
|
theme: props.theme,
|
|
241
309
|
rpcUrls: props.rpcUrls,
|
|
242
310
|
children: /* @__PURE__ */ jsx2(DepositModalWithReown, { ...props })
|
|
@@ -1,18 +1,20 @@
|
|
|
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 _chunkLDSUGF4Fcjs = require('./chunk-LDSUGF4F.cjs');
|
|
4
|
+
require('./chunk-6CM7PV7M.cjs');
|
|
5
|
+
require('./chunk-YBYIGKNG.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var _chunkNLUDG3G2cjs = require('./chunk-NLUDG3G2.cjs');
|
|
10
|
-
require('./chunk-I2RNB3DF.cjs');
|
|
11
|
-
require('./chunk-YEBXUUH3.cjs');
|
|
12
9
|
|
|
13
10
|
|
|
11
|
+
var _chunkZJGGLTHScjs = require('./chunk-ZJGGLTHS.cjs');
|
|
12
|
+
require('./chunk-YQH7E3VN.cjs');
|
|
13
|
+
require('./chunk-LFLZKER5.cjs');
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _chunkEH3HQG6Xcjs = require('./chunk-EH3HQG6X.cjs');
|
|
16
18
|
|
|
17
19
|
// src/DepositModalReown.tsx
|
|
18
20
|
var _react = require('react');
|
|
@@ -69,7 +71,7 @@ var APPKIT_NETWORK_BY_ID = {
|
|
|
69
71
|
[_networks.katana.id]: _networks.katana,
|
|
70
72
|
[_networks.hyperEvm.id]: _networks.hyperEvm
|
|
71
73
|
};
|
|
72
|
-
var EVM_NETWORKS =
|
|
74
|
+
var EVM_NETWORKS = _chunkEH3HQG6Xcjs.SUPPORTED_CHAINS.map((chain) => {
|
|
73
75
|
const network = APPKIT_NETWORK_BY_ID[chain.id];
|
|
74
76
|
if (!network) {
|
|
75
77
|
throw new Error(
|
|
@@ -84,22 +86,24 @@ function getAppKitNetwork(chainId) {
|
|
|
84
86
|
|
|
85
87
|
// src/core/reown.tsx
|
|
86
88
|
var _jsxruntime = require('react/jsx-runtime');
|
|
87
|
-
function buildTransports(rpcUrls) {
|
|
89
|
+
function buildTransports(rpcUrls, networks = EVM_NETWORKS) {
|
|
88
90
|
const transports = {};
|
|
89
|
-
for (const network of
|
|
91
|
+
for (const network of networks) {
|
|
90
92
|
const id = Number(network.id);
|
|
91
|
-
transports[id] = _viem.http.call(void 0,
|
|
93
|
+
transports[id] = _viem.http.call(void 0, _chunkZJGGLTHScjs.rpcUrlFor.call(void 0, rpcUrls, id));
|
|
92
94
|
}
|
|
93
95
|
return transports;
|
|
94
96
|
}
|
|
95
|
-
function getEvmRpcFingerprint(rpcUrls) {
|
|
96
|
-
return
|
|
97
|
+
function getEvmRpcFingerprint(rpcUrls, networks) {
|
|
98
|
+
return networks.map((network) => {
|
|
97
99
|
const id = Number(network.id);
|
|
98
|
-
return `${id}=${_nullishCoalesce(
|
|
100
|
+
return `${id}=${_nullishCoalesce(_chunkZJGGLTHScjs.rpcUrlFor.call(void 0, rpcUrls, id), () => ( ""))}`;
|
|
99
101
|
}).join("|");
|
|
100
102
|
}
|
|
101
103
|
var cachedAdapter = null;
|
|
102
104
|
var cachedAdapterKey = null;
|
|
105
|
+
var wagmiConfiguredEvmIds = /* @__PURE__ */ new Set();
|
|
106
|
+
var runtimeNetworkById = /* @__PURE__ */ new Map();
|
|
103
107
|
function mapTheme(theme) {
|
|
104
108
|
const themeMode = _optionalChain([theme, 'optionalAccess', _ => _.mode]) === "light" ? "light" : "dark";
|
|
105
109
|
const themeVariables = {};
|
|
@@ -108,25 +112,34 @@ function mapTheme(theme) {
|
|
|
108
112
|
}
|
|
109
113
|
return { themeMode, themeVariables };
|
|
110
114
|
}
|
|
111
|
-
function
|
|
115
|
+
function mergeNetworks(runtime) {
|
|
116
|
+
const byId = /* @__PURE__ */ new Map();
|
|
117
|
+
for (const network of EVM_NETWORKS) byId.set(Number(network.id), network);
|
|
118
|
+
for (const chain of runtime) {
|
|
119
|
+
if (!byId.has(chain.id)) byId.set(chain.id, chain);
|
|
120
|
+
}
|
|
121
|
+
return [...byId.values()];
|
|
122
|
+
}
|
|
123
|
+
function getOrCreateAdapter(projectId, enableSolana, theme, rpcUrls, runtimeChains = []) {
|
|
124
|
+
const networks = mergeNetworks(runtimeChains);
|
|
112
125
|
const adapterKey = [
|
|
113
126
|
projectId,
|
|
114
127
|
enableSolana ? "solana" : "evm",
|
|
115
|
-
getEvmRpcFingerprint(rpcUrls)
|
|
128
|
+
getEvmRpcFingerprint(rpcUrls, networks)
|
|
116
129
|
].join(":");
|
|
117
130
|
if (cachedAdapter && cachedAdapterKey === adapterKey) return cachedAdapter;
|
|
118
131
|
cachedAdapter = new (0, _appkitadapterwagmi.WagmiAdapter)({
|
|
119
|
-
networks
|
|
132
|
+
networks,
|
|
120
133
|
projectId,
|
|
121
|
-
transports: buildTransports(rpcUrls)
|
|
134
|
+
transports: buildTransports(rpcUrls, networks)
|
|
122
135
|
});
|
|
123
136
|
cachedAdapterKey = adapterKey;
|
|
124
137
|
const { themeMode, themeVariables } = mapTheme(theme);
|
|
125
138
|
const adapters = enableSolana ? [cachedAdapter, new (0, _appkitadaptersolana.SolanaAdapter)()] : [cachedAdapter];
|
|
126
|
-
const
|
|
127
|
-
_react3.createAppKit.call(void 0, {
|
|
139
|
+
const appKitNetworks = enableSolana ? [...networks, _networks.solana] : networks;
|
|
140
|
+
const appKit = _react3.createAppKit.call(void 0, {
|
|
128
141
|
adapters,
|
|
129
|
-
networks,
|
|
142
|
+
networks: appKitNetworks,
|
|
130
143
|
projectId,
|
|
131
144
|
themeMode,
|
|
132
145
|
themeVariables,
|
|
@@ -137,17 +150,66 @@ function getOrCreateAdapter(projectId, enableSolana, theme, rpcUrls) {
|
|
|
137
150
|
},
|
|
138
151
|
allowUnsupportedChain: true
|
|
139
152
|
});
|
|
153
|
+
wagmiConfiguredEvmIds = new Set(networks.map((n) => Number(n.id)));
|
|
154
|
+
for (const chain of runtimeChains) {
|
|
155
|
+
runtimeNetworkById.set(chain.id, chain);
|
|
156
|
+
try {
|
|
157
|
+
appKit.addNetwork("eip155", chain);
|
|
158
|
+
} catch (e) {
|
|
159
|
+
}
|
|
160
|
+
}
|
|
140
161
|
return cachedAdapter;
|
|
141
162
|
}
|
|
163
|
+
function chainDisplayName(chainId) {
|
|
164
|
+
const runtime = runtimeNetworkById.get(chainId);
|
|
165
|
+
if (runtime) return runtime.name;
|
|
166
|
+
return _chunkEH3HQG6Xcjs.getChainName.call(void 0, chainId);
|
|
167
|
+
}
|
|
168
|
+
function resolveAppKitNetwork(chainId) {
|
|
169
|
+
return _nullishCoalesce(getAppKitNetwork(chainId), () => ( runtimeNetworkById.get(chainId)));
|
|
170
|
+
}
|
|
142
171
|
function ReownWalletProvider({
|
|
143
172
|
projectId,
|
|
144
173
|
theme,
|
|
145
174
|
enableSolana = true,
|
|
146
175
|
rpcUrls,
|
|
176
|
+
backendUrl,
|
|
147
177
|
children
|
|
148
178
|
}) {
|
|
149
179
|
const [queryClient] = _react.useState.call(void 0, () => new (0, _reactquery.QueryClient)());
|
|
150
|
-
const
|
|
180
|
+
const overrides = _react.useMemo.call(void 0, () => {
|
|
181
|
+
if (!rpcUrls) return void 0;
|
|
182
|
+
const out = {};
|
|
183
|
+
for (const [key, url] of Object.entries(rpcUrls)) {
|
|
184
|
+
const id = Number(key);
|
|
185
|
+
if (Number.isFinite(id) && typeof url === "string") out[id] = url;
|
|
186
|
+
}
|
|
187
|
+
return out;
|
|
188
|
+
}, [rpcUrls]);
|
|
189
|
+
const [state, setState] = _react.useState.call(void 0, () => {
|
|
190
|
+
const primed = _chunkZJGGLTHScjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
|
|
191
|
+
return { ready: primed !== null, chains: _nullishCoalesce(primed, () => ( [])) };
|
|
192
|
+
});
|
|
193
|
+
_react.useEffect.call(void 0, () => {
|
|
194
|
+
let active = true;
|
|
195
|
+
const primed = _chunkZJGGLTHScjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
|
|
196
|
+
setState({ ready: primed !== null, chains: _nullishCoalesce(primed, () => ( [])) });
|
|
197
|
+
_chunkZJGGLTHScjs.primeRuntimeChains.call(void 0, backendUrl, overrides).then((chains) => {
|
|
198
|
+
if (active) setState({ ready: true, chains });
|
|
199
|
+
});
|
|
200
|
+
return () => {
|
|
201
|
+
active = false;
|
|
202
|
+
};
|
|
203
|
+
}, [backendUrl, overrides]);
|
|
204
|
+
if (!state.ready) return null;
|
|
205
|
+
const runtimeChains = state.chains;
|
|
206
|
+
const adapter = getOrCreateAdapter(
|
|
207
|
+
projectId,
|
|
208
|
+
enableSolana,
|
|
209
|
+
theme,
|
|
210
|
+
rpcUrls,
|
|
211
|
+
runtimeChains
|
|
212
|
+
);
|
|
151
213
|
const config = adapter.wagmiConfig;
|
|
152
214
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _wagmi.WagmiProvider, { config, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider, { client: queryClient, children }) });
|
|
153
215
|
}
|
|
@@ -181,7 +243,12 @@ function useReownWallet() {
|
|
|
181
243
|
void _optionalChain([_react3.modal, 'optionalAccess', _12 => _12.disconnect, 'call', _13 => _13()]);
|
|
182
244
|
},
|
|
183
245
|
switchChain: async (chainId) => {
|
|
184
|
-
|
|
246
|
+
if (!wagmiConfiguredEvmIds.has(chainId)) {
|
|
247
|
+
throw new Error(
|
|
248
|
+
`Switch to ${chainDisplayName(chainId)} in your wallet to continue`
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
const target = resolveAppKitNetwork(chainId);
|
|
185
252
|
try {
|
|
186
253
|
if (target) {
|
|
187
254
|
await switchNetwork(target);
|
|
@@ -189,9 +256,9 @@ function useReownWallet() {
|
|
|
189
256
|
await switchChainAsync({ chainId });
|
|
190
257
|
}
|
|
191
258
|
} catch (err) {
|
|
192
|
-
if (
|
|
259
|
+
if (_chunkZJGGLTHScjs.isUnsupportedChainSwitchError.call(void 0, err)) {
|
|
193
260
|
throw new Error(
|
|
194
|
-
`Switch to ${
|
|
261
|
+
`Switch to ${chainDisplayName(chainId)} in your wallet to continue`
|
|
195
262
|
);
|
|
196
263
|
}
|
|
197
264
|
throw err;
|
|
@@ -223,7 +290,7 @@ function DepositModalWithReown(props) {
|
|
|
223
290
|
reown.disconnect();
|
|
224
291
|
}, [reown.disconnect]);
|
|
225
292
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
226
|
-
|
|
293
|
+
_chunkLDSUGF4Fcjs.DepositModalInner,
|
|
227
294
|
{
|
|
228
295
|
...props,
|
|
229
296
|
reownWallet: reownWithSolana,
|
|
@@ -237,6 +304,7 @@ function DepositModalReown(props) {
|
|
|
237
304
|
ReownWalletProvider,
|
|
238
305
|
{
|
|
239
306
|
projectId: props.reownAppId,
|
|
307
|
+
backendUrl: props.backendUrl,
|
|
240
308
|
theme: props.theme,
|
|
241
309
|
rpcUrls: props.rpcUrls,
|
|
242
310
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DepositModalWithReown, { ...props })
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ListRow
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WP6NQ764.mjs";
|
|
4
4
|
import {
|
|
5
5
|
AlertTriangleIcon,
|
|
6
6
|
BodyHeader,
|
|
7
7
|
Button,
|
|
8
8
|
Callout,
|
|
9
9
|
CdnIcon,
|
|
10
|
+
ChainCatalogProvider,
|
|
10
11
|
CheckIcon,
|
|
11
12
|
ChevronLeftIcon,
|
|
12
13
|
CloseIcon,
|
|
@@ -24,20 +25,20 @@ import {
|
|
|
24
25
|
debugLog,
|
|
25
26
|
formatTokenAmount,
|
|
26
27
|
formatUserError,
|
|
28
|
+
useExplorerTxUrl,
|
|
27
29
|
useLatestRef,
|
|
28
30
|
useStableRpcUrls
|
|
29
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-FBF33G7H.mjs";
|
|
30
32
|
import {
|
|
31
33
|
SERVICE_HEADERS
|
|
32
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-EBHG4TCS.mjs";
|
|
33
35
|
import {
|
|
34
36
|
getChainIcon,
|
|
35
37
|
getChainName,
|
|
36
|
-
getExplorerTxUrl,
|
|
37
38
|
getTokenDecimalsByAddress,
|
|
38
39
|
getTokenSymbol,
|
|
39
40
|
tokenIconUrl
|
|
40
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-QNLLFX6X.mjs";
|
|
41
42
|
|
|
42
43
|
// src/ClaimModal.tsx
|
|
43
44
|
import {
|
|
@@ -362,7 +363,7 @@ function ClaimModal({
|
|
|
362
363
|
}, [state.step, onClose]);
|
|
363
364
|
const canGoBack = state.step === "select" || state.step === "review" || state.step === "failed";
|
|
364
365
|
const showBackButton = uiConfig?.showBackButton ?? true;
|
|
365
|
-
return /* @__PURE__ */ jsx2(RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ jsx2(
|
|
366
|
+
return /* @__PURE__ */ jsx2(RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ jsx2(ChainCatalogProvider, { service, rpcUrls, children: /* @__PURE__ */ jsx2(
|
|
366
367
|
Modal,
|
|
367
368
|
{
|
|
368
369
|
isOpen,
|
|
@@ -415,7 +416,7 @@ function ClaimModal({
|
|
|
415
416
|
) })
|
|
416
417
|
] })
|
|
417
418
|
}
|
|
418
|
-
) });
|
|
419
|
+
) }) });
|
|
419
420
|
}
|
|
420
421
|
function ClaimBody({
|
|
421
422
|
state,
|
|
@@ -715,6 +716,7 @@ function ReviewStep({
|
|
|
715
716
|
onSubmit
|
|
716
717
|
}) {
|
|
717
718
|
const { chainId, symbol, amount, chainName, chainIcon } = describeDeposit(deposit);
|
|
719
|
+
const explorerTxUrl = useExplorerTxUrl();
|
|
718
720
|
const [destination, setDestination] = useState(defaultRefundDestination ?? "");
|
|
719
721
|
const destinationValid = isAddress(destination);
|
|
720
722
|
return /* @__PURE__ */ jsxs2("div", { className: "rs-screen", children: [
|
|
@@ -749,7 +751,7 @@ function ReviewStep({
|
|
|
749
751
|
/* @__PURE__ */ jsxs2("div", { className: "rs-review-detail-row", children: [
|
|
750
752
|
/* @__PURE__ */ jsx2("span", { children: "Deposit transaction" }),
|
|
751
753
|
(() => {
|
|
752
|
-
const url = deposit.txHash ?
|
|
754
|
+
const url = deposit.txHash ? explorerTxUrl(chainId, deposit.txHash) : null;
|
|
753
755
|
const short = deposit.txHash ? shortenHash(deposit.txHash) : "\u2014";
|
|
754
756
|
return url ? /* @__PURE__ */ jsxs2(
|
|
755
757
|
"a",
|
|
@@ -800,6 +802,7 @@ function ResultStep({
|
|
|
800
802
|
onRetry
|
|
801
803
|
}) {
|
|
802
804
|
const success = !!result;
|
|
805
|
+
const explorerTxUrl = useExplorerTxUrl();
|
|
803
806
|
return /* @__PURE__ */ jsxs2("div", { className: "rs-screen", children: [
|
|
804
807
|
/* @__PURE__ */ jsxs2("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
805
808
|
/* @__PURE__ */ jsx2(
|
|
@@ -830,7 +833,7 @@ function ResultStep({
|
|
|
830
833
|
/* @__PURE__ */ jsxs2("div", { className: "rs-review-detail-row", children: [
|
|
831
834
|
/* @__PURE__ */ jsx2("span", { children: "Transaction" }),
|
|
832
835
|
(() => {
|
|
833
|
-
const url =
|
|
836
|
+
const url = explorerTxUrl(result.chain, result.txHash);
|
|
834
837
|
const short = shortenHash(result.txHash);
|
|
835
838
|
return url ? /* @__PURE__ */ jsxs2(
|
|
836
839
|
"a",
|
|
@@ -21,20 +21,18 @@ import {
|
|
|
21
21
|
quoteFeeGroups,
|
|
22
22
|
quoteFeeRow,
|
|
23
23
|
resolveTokenDisplay,
|
|
24
|
-
rpcUrlFor,
|
|
25
24
|
tokenAmountToNumber,
|
|
25
|
+
useExplorerTxUrl,
|
|
26
26
|
useLatestRef
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-FBF33G7H.mjs";
|
|
28
28
|
import {
|
|
29
|
-
CHAIN_BY_ID,
|
|
30
29
|
NATIVE_TOKEN_ADDRESS,
|
|
31
30
|
cdnIconUrl,
|
|
32
31
|
getChainIcon,
|
|
33
32
|
getChainName,
|
|
34
|
-
getExplorerTxUrl,
|
|
35
33
|
targetChainToCaip2,
|
|
36
34
|
toEvmCaip2
|
|
37
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-QNLLFX6X.mjs";
|
|
38
36
|
|
|
39
37
|
// src/core/removed-props.ts
|
|
40
38
|
var MANAGED_ACCOUNT_REMOVALS = {
|
|
@@ -884,6 +882,7 @@ function ProcessingStep({
|
|
|
884
882
|
const onDepositCompleteRef = useLatestRef(onDepositComplete);
|
|
885
883
|
const onDepositFailedRef = useLatestRef(onDepositFailed);
|
|
886
884
|
const onErrorRef = useLatestRef(onError);
|
|
885
|
+
const explorerTxUrl = useExplorerTxUrl();
|
|
887
886
|
const initialTerminalEventRef = useRef2(null);
|
|
888
887
|
const [state, setState] = useState4(() => {
|
|
889
888
|
if (directTransfer) return { type: "complete" };
|
|
@@ -1222,8 +1221,8 @@ function ProcessingStep({
|
|
|
1222
1221
|
const displaySourceChain = sourceDetails.chainId ?? sourceChain;
|
|
1223
1222
|
const displaySourceToken = sourceDetails.token ?? sourceToken;
|
|
1224
1223
|
const displayAmount = sourceDetails.amount ?? amount;
|
|
1225
|
-
const sourceExplorerUrl =
|
|
1226
|
-
const destExplorerUrl = destinationTxHash ?
|
|
1224
|
+
const sourceExplorerUrl = explorerTxUrl(displaySourceChain, txHash);
|
|
1225
|
+
const destExplorerUrl = destinationTxHash ? explorerTxUrl(targetChain, destinationTxHash) : null;
|
|
1227
1226
|
const sourceDisplay = (() => {
|
|
1228
1227
|
const resolved = resolveTokenDisplay(displaySourceToken, displaySourceChain, {
|
|
1229
1228
|
symbol: providedSourceSymbol ?? (displaySourceChain === "solana" ? "SOL" : "Token"),
|
|
@@ -1556,24 +1555,6 @@ function ProcessingStep({
|
|
|
1556
1555
|
] });
|
|
1557
1556
|
}
|
|
1558
1557
|
|
|
1559
|
-
// src/core/public-client.ts
|
|
1560
|
-
import { createPublicClient, http } from "viem";
|
|
1561
|
-
var clientCache = /* @__PURE__ */ new Map();
|
|
1562
|
-
function getPublicClient(chainId, rpcUrls) {
|
|
1563
|
-
const url = rpcUrlFor(rpcUrls, chainId);
|
|
1564
|
-
const cacheKey = `${chainId}|${url ?? ""}`;
|
|
1565
|
-
let client = clientCache.get(cacheKey);
|
|
1566
|
-
if (!client) {
|
|
1567
|
-
const chain = CHAIN_BY_ID[chainId];
|
|
1568
|
-
client = createPublicClient({
|
|
1569
|
-
chain,
|
|
1570
|
-
transport: http(url)
|
|
1571
|
-
});
|
|
1572
|
-
clientCache.set(cacheKey, client);
|
|
1573
|
-
}
|
|
1574
|
-
return client;
|
|
1575
|
-
}
|
|
1576
|
-
|
|
1577
1558
|
// src/core/account-setup.ts
|
|
1578
1559
|
import { concat, isAddress, keccak256, toHex } from "viem";
|
|
1579
1560
|
var SetupError = class extends Error {
|
|
@@ -1773,7 +1754,6 @@ export {
|
|
|
1773
1754
|
fetchTokenPriceUsd,
|
|
1774
1755
|
useTokenPrices,
|
|
1775
1756
|
ProcessingStep,
|
|
1776
|
-
getPublicClient,
|
|
1777
1757
|
SetupError,
|
|
1778
1758
|
deriveAccountSalt,
|
|
1779
1759
|
computeRequestKey,
|