@rhinestone/deposit-modal 0.0.0-dev-20260729013445 → 0.0.0-dev-20260729102711
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/README.md +15 -3
- package/dist/{DepositModalReown-7IKZUY34.cjs → DepositModalReown-G7QBA2WT.cjs} +13 -13
- package/dist/{DepositModalReown-RLSGDANC.mjs → DepositModalReown-PXZ3VRDG.mjs} +7 -7
- package/dist/{caip-CA6s0-GB.d.cts → caip-523Zrc3r.d.cts} +1 -2
- package/dist/{caip-CA6s0-GB.d.ts → caip-523Zrc3r.d.ts} +1 -2
- package/dist/{chunk-KZGITCZT.mjs → chunk-2IHE3ZZA.mjs} +0 -2
- package/dist/{chunk-M3HAQUVO.cjs → chunk-2JJHOAVW.cjs} +380 -379
- package/dist/{chunk-JT2VAH2D.mjs → chunk-4PLG4NBK.mjs} +12 -11
- package/dist/{chunk-HDZUPOUJ.cjs → chunk-55L3Z4XN.cjs} +76 -76
- package/dist/{chunk-X4ZOJMRY.cjs → chunk-6EP5HD6N.cjs} +82 -81
- package/dist/{chunk-IQ6P2TBV.mjs → chunk-6STXGQE3.mjs} +1 -1
- package/dist/{chunk-2APKKVQK.mjs → chunk-CSUTQI7V.mjs} +1 -1
- package/dist/{chunk-R62N7VSH.cjs → chunk-EGJH7RZU.cjs} +67 -66
- package/dist/{chunk-SLAJQ5BS.mjs → chunk-IYRT3PQK.mjs} +9 -8
- package/dist/{chunk-EGB3NWML.cjs → chunk-JWX33GHX.cjs} +1 -3
- package/dist/{chunk-KWXEW5SV.cjs → chunk-KQ2CB6FY.cjs} +37 -25
- package/dist/{chunk-FBMNVFEH.mjs → chunk-LAK7WZIB.mjs} +6 -5
- package/dist/{chunk-CUSYITEG.mjs → chunk-LPXQ65KL.mjs} +15 -3
- package/dist/{chunk-YJP274QC.mjs → chunk-M5PWZT2F.mjs} +1 -1
- package/dist/{chunk-W3WWC4LD.cjs → chunk-OU5AFKDR.cjs} +2 -2
- package/dist/{chunk-D52L6CAO.cjs → chunk-TVCRLV7L.cjs} +3 -3
- package/dist/{chunk-X73URRGG.mjs → chunk-VVAGYN2B.mjs} +2 -2
- package/dist/{chunk-AA37G5O2.cjs → chunk-XPYV35FC.cjs} +1 -1
- package/dist/claim.cjs +6 -6
- package/dist/claim.d.cts +3 -3
- package/dist/claim.d.ts +3 -3
- package/dist/claim.mjs +5 -5
- package/dist/constants.cjs +3 -5
- package/dist/constants.d.cts +2 -2
- package/dist/constants.d.ts +2 -2
- package/dist/constants.mjs +2 -4
- package/dist/deposit.cjs +8 -8
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +7 -7
- package/dist/index.cjs +10 -12
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +9 -11
- package/dist/polymarket.cjs +5 -5
- package/dist/polymarket.mjs +2 -2
- package/dist/server.cjs +2 -2
- package/dist/server.d.cts +13 -8
- package/dist/server.d.ts +13 -8
- package/dist/server.mjs +2 -2
- package/dist/{types-DF9MnowK.d.ts → types-CUj-rF6J.d.cts} +8 -4
- package/dist/{types-DF9MnowK.d.cts → types-CUj-rF6J.d.ts} +8 -4
- package/dist/withdraw.cjs +6 -6
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +5 -5
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -45,6 +45,10 @@ export function DepositButton({ walletClient, publicClient, recipient }) {
|
|
|
45
45
|
walletClient={walletClient}
|
|
46
46
|
publicClient={publicClient}
|
|
47
47
|
recipient={recipient}
|
|
48
|
+
// Required. A proxy you control that holds your Rhinestone API key and
|
|
49
|
+
// forwards to the deposit processor — the modal runs in the browser and
|
|
50
|
+
// cannot hold the key itself.
|
|
51
|
+
backendUrl={process.env.NEXT_PUBLIC_DEPOSIT_PROXY_URL}
|
|
48
52
|
targetChain={8453}
|
|
49
53
|
targetToken="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
50
54
|
onLifecycle={(event) => {
|
|
@@ -80,6 +84,7 @@ import { WithdrawModal } from "@rhinestone/deposit-modal/withdraw";
|
|
|
80
84
|
isOpen={open}
|
|
81
85
|
onClose={() => setOpen(false)}
|
|
82
86
|
accountAddress={userWallet}
|
|
87
|
+
backendUrl={process.env.NEXT_PUBLIC_DEPOSIT_PROXY_URL}
|
|
83
88
|
sourceChain={137}
|
|
84
89
|
sourceToken={USDC_POLYGON}
|
|
85
90
|
targetChain={8453}
|
|
@@ -107,8 +112,10 @@ import { ClaimModal } from "@rhinestone/deposit-modal/claim";
|
|
|
107
112
|
isOpen={claimOpen}
|
|
108
113
|
onClose={() => setClaimOpen(false)}
|
|
109
114
|
refundEndpoint="/api/refund"
|
|
115
|
+
backendUrl={process.env.NEXT_PUBLIC_DEPOSIT_PROXY_URL}
|
|
110
116
|
// Optional prefills:
|
|
111
117
|
defaultTxHash={depositTxHash}
|
|
118
|
+
defaultRefundDestination={knownSelfCustodialAddress}
|
|
112
119
|
onLifecycle={(event) => console.log(event)}
|
|
113
120
|
/>
|
|
114
121
|
```
|
|
@@ -129,13 +136,17 @@ export const POST = createRefundHandler({
|
|
|
129
136
|
apiKey: process.env.RHINESTONE_API_KEY!,
|
|
130
137
|
async authorize(request) {
|
|
131
138
|
const session = await getSession(request);
|
|
132
|
-
if (!session) return null;
|
|
133
|
-
|
|
139
|
+
if (!session) return null; // → 401
|
|
140
|
+
// The deposit `recipient` you passed the widget. Used ONLY to prove the
|
|
141
|
+
// deposit is this user's — it does not decide where the money goes.
|
|
142
|
+
return { depositRecipient: session.depositRecipient };
|
|
134
143
|
},
|
|
135
144
|
});
|
|
136
145
|
```
|
|
137
146
|
|
|
138
|
-
It verifies the deposit really belongs to that recipient before spending your API key, and 403s otherwise. Return
|
|
147
|
+
It verifies the deposit really belongs to that recipient before spending your API key, and 403s otherwise. Return `refundDestination` from `authorize` to pin where funds go and take that choice away from the browser — the handler reports the effective destination back, so the modal's success screen and `complete` event name the address that was actually paid rather than the one the browser asked for.
|
|
148
|
+
|
|
149
|
+
`defaultRefundDestination` on the modal only *seeds* that field and the user can edit it; `refundDestination` from `authorize` overrides whatever they submitted.
|
|
139
150
|
|
|
140
151
|
If you write your own endpoint instead, echo a `destination` in the success body whenever you override the requested one, for the same reason.
|
|
141
152
|
|
|
@@ -144,6 +155,7 @@ If you write your own endpoint instead, echo a `destination` in the success body
|
|
|
144
155
|
```tsx
|
|
145
156
|
<ClaimModal
|
|
146
157
|
refundEndpoint="https://your-proxy.example/deposits/refund"
|
|
158
|
+
backendUrl={process.env.NEXT_PUBLIC_DEPOSIT_PROXY_URL}
|
|
147
159
|
getUserToken={(refund) =>
|
|
148
160
|
fetch("/api/refund-token", {
|
|
149
161
|
method: "POST",
|
|
@@ -1,18 +1,18 @@
|
|
|
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 _chunk2JJHOAVWcjs = require('./chunk-2JJHOAVW.cjs');
|
|
4
|
+
require('./chunk-55L3Z4XN.cjs');
|
|
5
|
+
require('./chunk-TVCRLV7L.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
10
|
-
require('./chunk-
|
|
11
|
-
require('./chunk-
|
|
9
|
+
var _chunkKQ2CB6FYcjs = require('./chunk-KQ2CB6FY.cjs');
|
|
10
|
+
require('./chunk-XPYV35FC.cjs');
|
|
11
|
+
require('./chunk-OU5AFKDR.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkJWX33GHXcjs = require('./chunk-JWX33GHX.cjs');
|
|
16
16
|
|
|
17
17
|
// src/DepositModalReown.tsx
|
|
18
18
|
var _react = require('react');
|
|
@@ -69,7 +69,7 @@ var APPKIT_NETWORK_BY_ID = {
|
|
|
69
69
|
[_networks.katana.id]: _networks.katana,
|
|
70
70
|
[_networks.hyperEvm.id]: _networks.hyperEvm
|
|
71
71
|
};
|
|
72
|
-
var EVM_NETWORKS =
|
|
72
|
+
var EVM_NETWORKS = _chunkJWX33GHXcjs.SUPPORTED_CHAINS.map((chain) => {
|
|
73
73
|
const network = APPKIT_NETWORK_BY_ID[chain.id];
|
|
74
74
|
if (!network) {
|
|
75
75
|
throw new Error(
|
|
@@ -88,14 +88,14 @@ function buildTransports(rpcUrls) {
|
|
|
88
88
|
const transports = {};
|
|
89
89
|
for (const network of EVM_NETWORKS) {
|
|
90
90
|
const id = Number(network.id);
|
|
91
|
-
transports[id] = _viem.http.call(void 0,
|
|
91
|
+
transports[id] = _viem.http.call(void 0, _chunkKQ2CB6FYcjs.rpcUrlFor.call(void 0, rpcUrls, id));
|
|
92
92
|
}
|
|
93
93
|
return transports;
|
|
94
94
|
}
|
|
95
95
|
function getEvmRpcFingerprint(rpcUrls) {
|
|
96
96
|
return EVM_NETWORKS.map((network) => {
|
|
97
97
|
const id = Number(network.id);
|
|
98
|
-
return `${id}=${_nullishCoalesce(
|
|
98
|
+
return `${id}=${_nullishCoalesce(_chunkKQ2CB6FYcjs.rpcUrlFor.call(void 0, rpcUrls, id), () => ( ""))}`;
|
|
99
99
|
}).join("|");
|
|
100
100
|
}
|
|
101
101
|
var cachedAdapter = null;
|
|
@@ -189,9 +189,9 @@ function useReownWallet() {
|
|
|
189
189
|
await switchChainAsync({ chainId });
|
|
190
190
|
}
|
|
191
191
|
} catch (err) {
|
|
192
|
-
if (
|
|
192
|
+
if (_chunkKQ2CB6FYcjs.isUnsupportedChainSwitchError.call(void 0, err)) {
|
|
193
193
|
throw new Error(
|
|
194
|
-
`Switch to ${
|
|
194
|
+
`Switch to ${_chunkJWX33GHXcjs.getChainName.call(void 0, chainId)} in your wallet to continue`
|
|
195
195
|
);
|
|
196
196
|
}
|
|
197
197
|
throw err;
|
|
@@ -223,7 +223,7 @@ function DepositModalWithReown(props) {
|
|
|
223
223
|
reown.disconnect();
|
|
224
224
|
}, [reown.disconnect]);
|
|
225
225
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
226
|
-
|
|
226
|
+
_chunk2JJHOAVWcjs.DepositModalInner,
|
|
227
227
|
{
|
|
228
228
|
...props,
|
|
229
229
|
reownWallet: reownWithSolana,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DepositModalInner
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-IYRT3PQK.mjs";
|
|
4
|
+
import "./chunk-VVAGYN2B.mjs";
|
|
5
|
+
import "./chunk-CSUTQI7V.mjs";
|
|
6
6
|
import {
|
|
7
7
|
isUnsupportedChainSwitchError,
|
|
8
8
|
rpcUrlFor
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-LPXQ65KL.mjs";
|
|
10
|
+
import "./chunk-6STXGQE3.mjs";
|
|
11
|
+
import "./chunk-M5PWZT2F.mjs";
|
|
12
12
|
import {
|
|
13
13
|
SUPPORTED_CHAINS,
|
|
14
14
|
getChainName
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-2IHE3ZZA.mjs";
|
|
16
16
|
|
|
17
17
|
// src/DepositModalReown.tsx
|
|
18
18
|
import { useCallback, useMemo } from "react";
|
|
@@ -12,7 +12,6 @@ declare function tokenIconUrl(symbol: string): string;
|
|
|
12
12
|
*/
|
|
13
13
|
declare function getTokenIcon(symbol: string): string;
|
|
14
14
|
|
|
15
|
-
declare const DEFAULT_BACKEND_URL = "https://v1.orchestrator.rhinestone.dev/deposit-widget";
|
|
16
15
|
declare const NATIVE_TOKEN_ADDRESS: Address;
|
|
17
16
|
declare const CHAIN_BY_ID: Record<number, Chain>;
|
|
18
17
|
declare const SOURCE_CHAINS: Chain[];
|
|
@@ -73,4 +72,4 @@ declare const HYPERCORE_USDC_ADDRESS = "0xb88339CB7199b77E23DB6E890353E22632Ba63
|
|
|
73
72
|
*/
|
|
74
73
|
declare const HYPERCORE_USDT0_ADDRESS = "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb";
|
|
75
74
|
|
|
76
|
-
export { type SupportedTokenOption as A, CHAIN_BY_ID as C,
|
|
75
|
+
export { type SupportedTokenOption as A, CHAIN_BY_ID as C, HYPERCORE_CHAIN_ID as H, NATIVE_TOKEN_ADDRESS as N, SOURCE_CHAINS as S, HYPERCORE_USDC_ADDRESS as a, HYPERCORE_USDT0_ADDRESS as b, SUPPORTED_CHAINS as c, chainRegistry as d, getChainIcon as e, findChainIdForToken as f, getChainBadge as g, getChainId as h, getChainName as i, getChainObject as j, getExplorerName as k, getExplorerTxUrl as l, getExplorerUrl as m, getSupportedChainIds as n, getSupportedTargetTokens as o, getSupportedTokenSymbolsForChain as p, getTargetTokenSymbolsForChain as q, getTokenAddress as r, getTokenDecimals as s, getTokenDecimalsByAddress as t, getTokenIcon as u, getTokenSymbol as v, getUsdcAddress as w, getUsdcDecimals as x, isSupportedTokenAddressForChain as y, tokenIconUrl as z };
|
|
@@ -12,7 +12,6 @@ declare function tokenIconUrl(symbol: string): string;
|
|
|
12
12
|
*/
|
|
13
13
|
declare function getTokenIcon(symbol: string): string;
|
|
14
14
|
|
|
15
|
-
declare const DEFAULT_BACKEND_URL = "https://v1.orchestrator.rhinestone.dev/deposit-widget";
|
|
16
15
|
declare const NATIVE_TOKEN_ADDRESS: Address;
|
|
17
16
|
declare const CHAIN_BY_ID: Record<number, Chain>;
|
|
18
17
|
declare const SOURCE_CHAINS: Chain[];
|
|
@@ -73,4 +72,4 @@ declare const HYPERCORE_USDC_ADDRESS = "0xb88339CB7199b77E23DB6E890353E22632Ba63
|
|
|
73
72
|
*/
|
|
74
73
|
declare const HYPERCORE_USDT0_ADDRESS = "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb";
|
|
75
74
|
|
|
76
|
-
export { type SupportedTokenOption as A, CHAIN_BY_ID as C,
|
|
75
|
+
export { type SupportedTokenOption as A, CHAIN_BY_ID as C, HYPERCORE_CHAIN_ID as H, NATIVE_TOKEN_ADDRESS as N, SOURCE_CHAINS as S, HYPERCORE_USDC_ADDRESS as a, HYPERCORE_USDT0_ADDRESS as b, SUPPORTED_CHAINS as c, chainRegistry as d, getChainIcon as e, findChainIdForToken as f, getChainBadge as g, getChainId as h, getChainName as i, getChainObject as j, getExplorerName as k, getExplorerTxUrl as l, getExplorerUrl as m, getSupportedChainIds as n, getSupportedTargetTokens as o, getSupportedTokenSymbolsForChain as p, getTargetTokenSymbolsForChain as q, getTokenAddress as r, getTokenDecimals as s, getTokenDecimalsByAddress as t, getTokenIcon as u, getTokenSymbol as v, getUsdcAddress as w, getUsdcDecimals as x, isSupportedTokenAddressForChain as y, tokenIconUrl as z };
|
|
@@ -151,7 +151,6 @@ import {
|
|
|
151
151
|
soneium as soneium2,
|
|
152
152
|
unichain as unichain2
|
|
153
153
|
} from "viem/chains";
|
|
154
|
-
var DEFAULT_BACKEND_URL = "https://v1.orchestrator.rhinestone.dev/deposit-widget";
|
|
155
154
|
var NATIVE_TOKEN_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
156
155
|
var ALL_CHAINS_BY_ID = {
|
|
157
156
|
[mainnet2.id]: mainnet2,
|
|
@@ -776,7 +775,6 @@ export {
|
|
|
776
775
|
getChainIcon,
|
|
777
776
|
tokenIconUrl,
|
|
778
777
|
getTokenIcon,
|
|
779
|
-
DEFAULT_BACKEND_URL,
|
|
780
778
|
NATIVE_TOKEN_ADDRESS,
|
|
781
779
|
CHAIN_BY_ID,
|
|
782
780
|
SOURCE_CHAINS,
|