@funkit/connect 9.24.0-next.0 → 9.25.0
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/CHANGELOG.md +50 -4
- package/dist/clients/aave.d.ts +9 -0
- package/dist/clients/aave.js +4 -1
- package/dist/clients/{chunk-4HCOSF4M.js → chunk-7G3QEQFB.js} +2 -2
- package/dist/clients/{chunk-7FIVHWNC.js → chunk-7UIDHSYG.js} +47 -0
- package/dist/clients/{chunk-UUHGOBKZ.js → chunk-AHYOV7AV.js} +2 -1
- package/dist/clients/{chunk-S7FRYR55.js → chunk-ME4OAQIY.js} +1 -1
- package/dist/clients/{chunk-CEBG7XQ5.js → chunk-MXPZTW2H.js} +212 -1126
- package/dist/clients/chunk-SQ2RX7WY.js +1110 -0
- package/dist/clients/{chunk-KWIR3HO4.js → chunk-VJZW3MA3.js} +1 -1
- package/dist/clients/{chunk-MRBN4XCA.js → chunk-ZEXZQOAO.js} +1 -1
- package/dist/clients/fanatics.css +1 -1
- package/dist/clients/fanatics.js +4 -6
- package/dist/clients/lighter.css +2816 -1
- package/dist/clients/lighter.js +44 -28
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +217 -222
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +7 -8
- package/dist/clients/polymarket/createPolymarketDepositConfig.js +3 -3
- package/dist/clients/polymarket/index.css +217 -222
- package/dist/clients/polymarket/index.js +7 -8
- package/dist/clients/polymarket/polymarket.js +2 -2
- package/dist/clients/polymarket/usePolymarketAccountBalances.js +2 -2
- package/dist/clients/rolly.js +1 -1
- package/dist/components/FunCheckoutHistory/FunCheckoutHistoryContent.d.ts +1 -2
- package/dist/components/FunTooltip/FunTooltip.d.ts +10 -5
- package/dist/components/FunTransactionSummary/DestinationHealthFactorRow.d.ts +15 -0
- package/dist/components/FunTransactionSummary/DestinationYieldRows.d.ts +1 -0
- package/dist/components/FunTransactionSummary/PaymentAmountSummary.d.ts +2 -1
- package/dist/components/FunTransactionSummary/PaymentMethodSummary.d.ts +8 -1
- package/dist/domains/aave.d.ts +14 -9
- package/dist/domains/nado.d.ts +9 -0
- package/dist/hooks/track/CheckoutModalEvent.d.ts +0 -1
- package/dist/hooks/track/WithdrawModalEvent.d.ts +9 -1
- package/dist/hooks/useGetAssetHoldingsFromRpc.d.ts +23 -0
- package/dist/hooks/useInjectedAssetHoldings.d.ts +23 -0
- package/dist/hooks/useXstockAssetHoldings.d.ts +15 -0
- package/dist/hooks/useXstocksWrappedTokenAddress.d.ts +16 -0
- package/dist/index.css +11 -16
- package/dist/index.js +4696 -4117
- package/dist/modals/CheckoutModal/CheckoutComplete/CheckoutComplete.d.ts +1 -1
- package/dist/modals/CheckoutModal/FunCheckoutStep.d.ts +0 -1
- package/dist/modals/CheckoutModal/InputAmount/useNadoDirectTransfer.d.ts +64 -0
- package/dist/modals/CheckoutModal/SelectAsset/SelectAsset.d.ts +1 -1
- package/dist/modals/CheckoutModal/stepTransition.d.ts +0 -3
- package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +25 -4
- package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +10 -1
- package/dist/modals/WithdrawalModal/WithdrawalContent.d.ts +8 -1
- package/dist/modals/WithdrawalModal/WithdrawalSwappedIframeController.d.ts +11 -0
- package/dist/modals/WithdrawalModal/types.d.ts +1 -0
- package/dist/providers/FunkitCheckoutContext/types.d.ts +29 -12
- package/dist/utils/assets.d.ts +7 -0
- package/dist/utils/checkoutHistory.d.ts +1 -5
- package/dist/utils/customer.d.ts +6 -0
- package/dist/wallets/walletConnectors/index.js +50 -50
- package/package.json +6 -6
- package/dist/__generated__/default_configs.d.ts +0 -901
- package/dist/__generated__/default_feature_gates.d.ts +0 -20
- package/dist/clients/chunk-25ICASD7.js +0 -2371
- package/dist/clients/chunk-3GO74QTP.js +0 -2382
- package/dist/clients/chunk-7GWX2ZS4.js +0 -69
- package/dist/clients/chunk-7HNGV6JU.js +0 -54
- package/dist/clients/chunk-A32VN2DX.js +0 -2382
- package/dist/clients/chunk-ELLXM7RO.js +0 -186
- package/dist/clients/chunk-GGXTLJ7J.js +0 -290
- package/dist/clients/chunk-GUWXVR5S.js +0 -186
- package/dist/clients/chunk-HRWCNZJA.js +0 -230
- package/dist/clients/chunk-JBWB54MX.js +0 -69
- package/dist/clients/chunk-JD3FIVZ7.js +0 -69
- package/dist/clients/chunk-JTGKAPID.js +0 -2382
- package/dist/clients/chunk-L7PABCF2.js +0 -54
- package/dist/clients/chunk-LII3SVUH.js +0 -230
- package/dist/clients/chunk-NCUPPJ2Z.js +0 -2382
- package/dist/clients/chunk-NPPIETHZ.js +0 -54
- package/dist/clients/chunk-NUJ6ZM5F.js +0 -186
- package/dist/clients/chunk-UVWNEQMD.js +0 -186
- package/dist/clients/chunk-VVTNR7YH.js +0 -2382
- package/dist/clients/chunk-YYMIRDCQ.js +0 -230
- package/dist/clients/chunk-ZNVFASTH.js +0 -54
- package/dist/clients/nado.d.ts +0 -78
- package/dist/clients/nado.js +0 -107
- package/dist/clients/polymarket.d.ts +0 -161
- package/dist/clients/polymarket.js +0 -688
- package/dist/components/FunCheckoutHistory/FunCheckoutHistoryHelp.d.ts +0 -10
- package/dist/interfaces/logTransport.d.ts +0 -51
- package/dist/interfaces/swapped-transport.d.ts +0 -78
- package/dist/modals/CheckoutModal/CheckoutHelp/CheckoutHelp.d.ts +0 -9
- package/dist/modals/CheckoutModal/SourceChange/EmptyFormOfPaymentsMessage.d.ts +0 -4
- package/dist/modals/CheckoutModal/SourceChange/useUpdateSourceAssetForCard.d.ts +0 -4
- package/dist/modals/CheckoutModal/SwappedIframe/SwappedErrorMessage.d.ts +0 -6
- package/dist/utils/flags/resolver.d.ts +0 -34
- package/dist/wallets/walletConnectors/chunk-4NV5BYRP.js +0 -95
- package/dist/wallets/walletConnectors/chunk-AVDUNQUW.js +0 -96
- package/dist/wallets/walletConnectors/chunk-GUQM4QSL.js +0 -66
- package/dist/wallets/walletConnectors/chunk-IULPZP2Q.js +0 -69
- package/dist/wallets/walletConnectors/chunk-JPN6TWIT.js +0 -92
- package/dist/wallets/walletConnectors/chunk-KCRO2AGO.js +0 -106
- package/dist/wallets/walletConnectors/chunk-KI5Y2BBF.js +0 -94
- package/dist/wallets/walletConnectors/chunk-NR2OGDHQ.js +0 -103
- package/dist/wallets/walletConnectors/chunk-OEEGYENV.js +0 -87
- package/dist/wallets/walletConnectors/chunk-OX37G4YT.js +0 -98
- package/dist/wallets/walletConnectors/chunk-SWFF3TWJ.js +0 -100
- package/dist/wallets/walletConnectors/chunk-TKB2OY6G.js +0 -99
- package/dist/wallets/walletConnectors/chunk-W2LCLDPX.js +0 -70
- package/dist/wallets/walletConnectors/chunk-WAHGI5L7.js +0 -96
- package/dist/wallets/walletConnectors/chunk-WKNQMP4A.js +0 -93
- package/dist/wallets/walletConnectors/chunk-XCNHV3HS.js +0 -110
- package/dist/wallets/walletConnectors/chunk-YO2K4MBH.js +0 -218
- package/dist/wallets/walletConnectors/chunk-YQFGVZGR.js +0 -92
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
Box
|
|
4
|
-
} from "./chunk-JBWB54MX.js";
|
|
5
|
-
import {
|
|
6
|
-
logger
|
|
7
|
-
} from "./chunk-UUHGOBKZ.js";
|
|
8
|
-
|
|
9
|
-
// src/components/AsyncImage/useAsyncImage.ts
|
|
10
|
-
import { useEffect, useReducer } from "react";
|
|
11
|
-
var cachedUrls = /* @__PURE__ */ new Map();
|
|
12
|
-
var cachedRequestPromises = /* @__PURE__ */ new Map();
|
|
13
|
-
async function loadAsyncImage(asyncImage) {
|
|
14
|
-
const cachedRequestPromise = cachedRequestPromises.get(asyncImage);
|
|
15
|
-
if (cachedRequestPromise) {
|
|
16
|
-
return cachedRequestPromise;
|
|
17
|
-
}
|
|
18
|
-
const load = async () => asyncImage().then(async (url) => {
|
|
19
|
-
cachedUrls.set(asyncImage, url);
|
|
20
|
-
return url;
|
|
21
|
-
});
|
|
22
|
-
const requestPromise = load().catch(async () => {
|
|
23
|
-
return load().catch(() => {
|
|
24
|
-
cachedRequestPromises.delete(asyncImage);
|
|
25
|
-
return void 0;
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
cachedRequestPromises.set(asyncImage, requestPromise);
|
|
29
|
-
return requestPromise;
|
|
30
|
-
}
|
|
31
|
-
function useForceUpdate() {
|
|
32
|
-
const [, forceUpdate] = useReducer((x) => x + 1, 0);
|
|
33
|
-
return forceUpdate;
|
|
34
|
-
}
|
|
35
|
-
function useAsyncImage(url) {
|
|
36
|
-
const cachedUrl = typeof url === "function" ? cachedUrls.get(url) : void 0;
|
|
37
|
-
const forceUpdate = useForceUpdate();
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
if (typeof url === "function" && !cachedUrl) {
|
|
40
|
-
loadAsyncImage(url).then(forceUpdate);
|
|
41
|
-
}
|
|
42
|
-
}, [url, cachedUrl, forceUpdate]);
|
|
43
|
-
return typeof url === "function" ? cachedUrl : url;
|
|
44
|
-
}
|
|
45
|
-
var REMOTE_IMG_CACHE = /* @__PURE__ */ new Set();
|
|
46
|
-
function preloadRemoteImages(...imageUrls) {
|
|
47
|
-
for (const imageUrl of imageUrls) {
|
|
48
|
-
try {
|
|
49
|
-
const { protocol } = new URL(imageUrl);
|
|
50
|
-
if (protocol !== "https:" && protocol !== "http:") {
|
|
51
|
-
logger.warn("preloadRemoteImages:invalidUrl", {
|
|
52
|
-
message: "Invalid protocol",
|
|
53
|
-
imageUrl
|
|
54
|
-
});
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
if (!REMOTE_IMG_CACHE.has(imageUrl)) {
|
|
58
|
-
REMOTE_IMG_CACHE.add(imageUrl);
|
|
59
|
-
const preloadImage = new Image();
|
|
60
|
-
preloadImage.src = imageUrl;
|
|
61
|
-
}
|
|
62
|
-
} catch (error) {
|
|
63
|
-
logger.warn("preloadRemoteImages:error", {
|
|
64
|
-
message: "Unable to preload image",
|
|
65
|
-
imageUrl,
|
|
66
|
-
error
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// src/components/AsyncImage/AsyncImage.tsx
|
|
73
|
-
import React, { useMemo, useReducer as useReducer2, useState } from "react";
|
|
74
|
-
|
|
75
|
-
// src/utils/sanitizeUrl.ts
|
|
76
|
-
var SAFE_URL_PROTOCOLS = /* @__PURE__ */ new Set(["https:", "http:"]);
|
|
77
|
-
function sanitizeUrl(url) {
|
|
78
|
-
if (!url) {
|
|
79
|
-
return void 0;
|
|
80
|
-
}
|
|
81
|
-
try {
|
|
82
|
-
const parsed = new URL(url);
|
|
83
|
-
if (SAFE_URL_PROTOCOLS.has(parsed.protocol)) {
|
|
84
|
-
return parsed.href;
|
|
85
|
-
}
|
|
86
|
-
return void 0;
|
|
87
|
-
} catch {
|
|
88
|
-
return void 0;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
function sanitizeCssUrl(url) {
|
|
92
|
-
const safeUrl = sanitizeUrl(url);
|
|
93
|
-
if (!safeUrl) {
|
|
94
|
-
return void 0;
|
|
95
|
-
}
|
|
96
|
-
return safeUrl.replace(/['()\\]/g, (char) => {
|
|
97
|
-
return `%${char.charCodeAt(0).toString(16).padStart(2, "0")}`;
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// src/components/AsyncImage/AsyncImage.tsx
|
|
102
|
-
function useTriggeredOnce() {
|
|
103
|
-
return useReducer2(() => true, false);
|
|
104
|
-
}
|
|
105
|
-
function AsyncImage({
|
|
106
|
-
alt,
|
|
107
|
-
background,
|
|
108
|
-
borderColor,
|
|
109
|
-
borderRadius,
|
|
110
|
-
boxShadow,
|
|
111
|
-
height,
|
|
112
|
-
useAsImage,
|
|
113
|
-
src: srcProp,
|
|
114
|
-
fallbackSrc,
|
|
115
|
-
fallbackElement,
|
|
116
|
-
width,
|
|
117
|
-
testId
|
|
118
|
-
}) {
|
|
119
|
-
const src = useAsyncImage(srcProp || fallbackSrc);
|
|
120
|
-
const isRemoteImage = src !== void 0 && /^(https?|data):/.test(src);
|
|
121
|
-
const [isRemoteImageLoaded, setRemoteImageLoaded] = useTriggeredOnce();
|
|
122
|
-
const [hasError, setHasError] = useState(
|
|
123
|
-
srcProp === void 0 && fallbackSrc === void 0
|
|
124
|
-
);
|
|
125
|
-
const { asyncStyle, imgProps } = useMemo(() => {
|
|
126
|
-
const asyncStyle2 = !useAsImage ? getRemoteImageStyles(isRemoteImage, isRemoteImageLoaded, src) : {};
|
|
127
|
-
if (useAsImage || isRemoteImage) {
|
|
128
|
-
const imgProps2 = {
|
|
129
|
-
as: "img",
|
|
130
|
-
src,
|
|
131
|
-
"aria-hidden": true,
|
|
132
|
-
onError: ({
|
|
133
|
-
currentTarget
|
|
134
|
-
}) => {
|
|
135
|
-
currentTarget.onerror = null;
|
|
136
|
-
if (fallbackSrc !== void 0) {
|
|
137
|
-
currentTarget.src = fallbackSrc;
|
|
138
|
-
} else {
|
|
139
|
-
setHasError(true);
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
onLoad: isRemoteImage ? setRemoteImageLoaded : void 0
|
|
143
|
-
};
|
|
144
|
-
return { imgProps: imgProps2, asyncStyle: asyncStyle2 };
|
|
145
|
-
}
|
|
146
|
-
return {
|
|
147
|
-
imgProps: {
|
|
148
|
-
backgroundSize: "cover"
|
|
149
|
-
},
|
|
150
|
-
asyncStyle: {
|
|
151
|
-
...asyncStyle2,
|
|
152
|
-
// has to be added as a inline style because vanilla-extract doesn't recognize this as a valid style
|
|
153
|
-
backgroundPosition: "center"
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
}, [
|
|
157
|
-
fallbackSrc,
|
|
158
|
-
isRemoteImage,
|
|
159
|
-
isRemoteImageLoaded,
|
|
160
|
-
src,
|
|
161
|
-
useAsImage,
|
|
162
|
-
setRemoteImageLoaded
|
|
163
|
-
]);
|
|
164
|
-
const mainElement = hasError && fallbackElement || /* @__PURE__ */ React.createElement(
|
|
165
|
-
Box,
|
|
166
|
-
{
|
|
167
|
-
...imgProps,
|
|
168
|
-
height: "full",
|
|
169
|
-
position: "absolute",
|
|
170
|
-
style: {
|
|
171
|
-
WebkitTouchCallout: "none",
|
|
172
|
-
transition: "opacity .15s linear",
|
|
173
|
-
userSelect: "none",
|
|
174
|
-
...asyncStyle
|
|
175
|
-
},
|
|
176
|
-
width: "full"
|
|
177
|
-
}
|
|
178
|
-
);
|
|
179
|
-
return /* @__PURE__ */ React.createElement(
|
|
180
|
-
Box,
|
|
181
|
-
{
|
|
182
|
-
"aria-label": alt,
|
|
183
|
-
borderRadius,
|
|
184
|
-
boxShadow,
|
|
185
|
-
height: typeof height === "string" ? height : void 0,
|
|
186
|
-
overflow: "hidden",
|
|
187
|
-
position: "relative",
|
|
188
|
-
role: "img",
|
|
189
|
-
style: {
|
|
190
|
-
background,
|
|
191
|
-
height: typeof height === "number" ? height : void 0,
|
|
192
|
-
width: typeof width === "number" ? width : void 0
|
|
193
|
-
},
|
|
194
|
-
width: typeof width === "string" ? width : void 0,
|
|
195
|
-
testId
|
|
196
|
-
},
|
|
197
|
-
mainElement,
|
|
198
|
-
borderColor ? /* @__PURE__ */ React.createElement(
|
|
199
|
-
Box,
|
|
200
|
-
{
|
|
201
|
-
...typeof borderColor === "object" && "custom" in borderColor ? { style: { borderColor: borderColor.custom } } : { borderColor },
|
|
202
|
-
borderRadius,
|
|
203
|
-
borderStyle: "solid",
|
|
204
|
-
borderWidth: "1",
|
|
205
|
-
height: "full",
|
|
206
|
-
position: "relative",
|
|
207
|
-
width: "full"
|
|
208
|
-
}
|
|
209
|
-
) : null
|
|
210
|
-
);
|
|
211
|
-
}
|
|
212
|
-
var getRemoteImageStyles = (isRemoteImage, isRemoteImageLoaded, src) => {
|
|
213
|
-
if (isRemoteImage) {
|
|
214
|
-
return {
|
|
215
|
-
opacity: isRemoteImageLoaded ? 1 : 0
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
const safeSrc = sanitizeCssUrl(src);
|
|
219
|
-
return {
|
|
220
|
-
// note the url must have quotation, see https://github.com/evanw/esbuild/issues/1843#issuecomment-1370108070
|
|
221
|
-
backgroundImage: safeSrc ? `url('${safeSrc}')` : void 0,
|
|
222
|
-
backgroundRepeat: "no-repeat",
|
|
223
|
-
opacity: src ? 1 : 0
|
|
224
|
-
};
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
export {
|
|
228
|
-
preloadRemoteImages,
|
|
229
|
-
AsyncImage
|
|
230
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
Box
|
|
4
|
-
} from "./chunk-7FIVHWNC.js";
|
|
5
|
-
|
|
6
|
-
// src/components/Text/Text.tsx
|
|
7
|
-
import React from "react";
|
|
8
|
-
var Text = React.forwardRef(
|
|
9
|
-
({
|
|
10
|
-
as = "div",
|
|
11
|
-
children,
|
|
12
|
-
className,
|
|
13
|
-
color = "primaryText",
|
|
14
|
-
display,
|
|
15
|
-
font = "body",
|
|
16
|
-
id,
|
|
17
|
-
size = "16",
|
|
18
|
-
style,
|
|
19
|
-
tabIndex,
|
|
20
|
-
title,
|
|
21
|
-
textAlign = "inherit",
|
|
22
|
-
textTransform = "none",
|
|
23
|
-
weight = "regular",
|
|
24
|
-
testId
|
|
25
|
-
}, ref) => {
|
|
26
|
-
return /* @__PURE__ */ React.createElement(
|
|
27
|
-
Box,
|
|
28
|
-
{
|
|
29
|
-
as,
|
|
30
|
-
className,
|
|
31
|
-
color: color === "inherit" ? void 0 : color,
|
|
32
|
-
display,
|
|
33
|
-
fontFamily: font,
|
|
34
|
-
fontSize: size,
|
|
35
|
-
fontWeight: weight,
|
|
36
|
-
id,
|
|
37
|
-
title,
|
|
38
|
-
ref,
|
|
39
|
-
style,
|
|
40
|
-
tabIndex,
|
|
41
|
-
textAlign,
|
|
42
|
-
textTransform,
|
|
43
|
-
testId,
|
|
44
|
-
background: { selection: "textSelection" }
|
|
45
|
-
},
|
|
46
|
-
children
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
Text.displayName = "Text";
|
|
51
|
-
|
|
52
|
-
export {
|
|
53
|
-
Text
|
|
54
|
-
};
|
package/dist/clients/nado.d.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Nado deposit routed through the Ink VaultDepositooor.
|
|
3
|
-
*
|
|
4
|
-
* Each deposit is a 2-action batch:
|
|
5
|
-
* 1. approve(collateralToken, VAULT_DEPOSITOR, maxUint256) — covers the live balance pull
|
|
6
|
-
* 2. VAULT_DEPOSITOR.deposit(collateralToken, NADO_ENDPOINT, calldata, 0)
|
|
7
|
-
*
|
|
8
|
-
* No zero-first approve reset: USDT0 on Ink (TetherTokenOFTExtension) inherits
|
|
9
|
-
* OpenZeppelin's plain approve — verified on the Ink explorer, no legacy
|
|
10
|
-
* non-zero->non-zero revert — and the other collaterals are standard OZ tokens.
|
|
11
|
-
*
|
|
12
|
-
* The Endpoint calldata carries AMOUNT_PLACEHOLDER where the uint128 amount
|
|
13
|
-
* goes; the VaultDepositooor injects its caller's LIVE collateral balance over
|
|
14
|
-
* the placeholder before calling the Endpoint. That makes the deposit robust
|
|
15
|
-
* to bridge fee drift: whatever actually arrived is what gets deposited, with
|
|
16
|
-
* no under-funded revert and no dust stranded on the EOA. The selector is the
|
|
17
|
-
* canonical uint128 one (0x221f0939, registered for the Endpoint on the Ink
|
|
18
|
-
* VaultDepositooor) while the head encodes the amount slot as uint256 so the
|
|
19
|
-
* 32-byte placeholder word fits — uint128 and uint256 head-encode identically.
|
|
20
|
-
*
|
|
21
|
-
* `subaccount` packs the recipient address (high 20 bytes) with the
|
|
22
|
-
* subaccount name "default" (right-padded to the remaining 12 bytes) into a
|
|
23
|
-
* single bytes32 word. `productId` is per-collateral and is looked up by the
|
|
24
|
-
* integrator from the Nado SpotEngine allowlist.
|
|
25
|
-
*
|
|
26
|
-
* Spec: https://www.notion.so/the-fun-group/37bfc3b2a002816bac41c920902e03c2
|
|
27
|
-
*/
|
|
28
|
-
import { type Address, type Hex } from 'viem';
|
|
29
|
-
import type { FunkitCheckoutActionParams } from '../providers/FunkitCheckoutContext/types';
|
|
30
|
-
/** Nado Endpoint on Ink mainnet (chain 57073). */
|
|
31
|
-
export declare const NADO_ENDPOINT_ADDRESS: `0x${string}`;
|
|
32
|
-
/** VaultDepositooor on Ink — fresh CREATE3 deploy (differs from the canonical
|
|
33
|
-
* address on other chains). The Nado Endpoint is registered on it with
|
|
34
|
-
* selector 0x221f0939 and no decimal conversion. Mirrors
|
|
35
|
-
* VAULT_DEPOSITOR_ADDRESSES[INK] in fun-backend's packages/types. */
|
|
36
|
-
export declare const INK_VAULT_DEPOSITOR_ADDRESS: `0x${string}`;
|
|
37
|
-
/** Sentinel value Nado treats as "no referral". */
|
|
38
|
-
export declare const NADO_NO_REFERRAL_CODE = "-1";
|
|
39
|
-
/** Default subaccount name used by the Nado UI/SDK. */
|
|
40
|
-
export declare const NADO_DEFAULT_SUBACCOUNT_NAME = "default";
|
|
41
|
-
/**
|
|
42
|
-
* Build a Nado `bytes32` subaccount from an owner address and subaccount
|
|
43
|
-
* name. Layout: `[owner (20 bytes)] [name (right-padded to 12 bytes)]`.
|
|
44
|
-
*
|
|
45
|
-
* Throws if `name` encodes to more than 12 bytes — without this, `pad()`
|
|
46
|
-
* surfaces viem's opaque `SizeExceedsPaddingSizeError`.
|
|
47
|
-
*/
|
|
48
|
-
export declare function buildNadoSubaccount(owner: Address, name?: string): Hex;
|
|
49
|
-
export interface NadoDepositActionsConfig {
|
|
50
|
-
/** Address credited on Nado (typically the connected wallet). */
|
|
51
|
-
recipientAddress: Address | undefined;
|
|
52
|
-
/** Collateral ERC20 on Ink being deposited (USDT0, kBTC, WETH, USDC, ...). */
|
|
53
|
-
collateralTokenAddress: Address;
|
|
54
|
-
/** Nado SpotEngine productId for the collateral token. */
|
|
55
|
-
productId: number;
|
|
56
|
-
/** Optional subaccount name. Defaults to "default". */
|
|
57
|
-
subaccountName?: string;
|
|
58
|
-
/** Optional referral code. Defaults to the no-referral sentinel "-1". */
|
|
59
|
-
referralCode?: string;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Builds the 2-action batch (approve + deposit) for a Nado collateral
|
|
63
|
-
* deposit routed through the Endpoint.
|
|
64
|
-
*
|
|
65
|
-
* Usage:
|
|
66
|
-
* ```ts
|
|
67
|
-
* const checkoutConfig: FunkitCheckoutConfig = {
|
|
68
|
-
* // ...
|
|
69
|
-
* generateActionsParams: () => async (amount, output) =>
|
|
70
|
-
* createNadoDepositActions({
|
|
71
|
-
* recipientAddress: walletAddress,
|
|
72
|
-
* collateralTokenAddress: output.targetAsset,
|
|
73
|
-
* productId: NADO_PRODUCT_ID_BY_TOKEN[output.targetAsset],
|
|
74
|
-
* }),
|
|
75
|
-
* }
|
|
76
|
-
* ```
|
|
77
|
-
*/
|
|
78
|
-
export declare function createNadoDepositActions(config: NadoDepositActionsConfig): FunkitCheckoutActionParams[];
|
package/dist/clients/nado.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/clients/nado.tsx
|
|
4
|
-
import {
|
|
5
|
-
concat,
|
|
6
|
-
encodeAbiParameters,
|
|
7
|
-
erc20Abi,
|
|
8
|
-
getAddress,
|
|
9
|
-
maxUint256,
|
|
10
|
-
pad,
|
|
11
|
-
stringToHex,
|
|
12
|
-
toFunctionSelector
|
|
13
|
-
} from "viem";
|
|
14
|
-
var NADO_ENDPOINT_ADDRESS = getAddress(
|
|
15
|
-
"0x05ec92d78ed421f3d3ada77ffde167106565974e"
|
|
16
|
-
);
|
|
17
|
-
var INK_VAULT_DEPOSITOR_ADDRESS = getAddress(
|
|
18
|
-
"0xDB9d579B0DCbf566E372C73A2e374c44B161E1Ee"
|
|
19
|
-
);
|
|
20
|
-
var AMOUNT_PLACEHOLDER = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffdeadbeefn;
|
|
21
|
-
var VAULT_DEPOSITOR_ABI = [
|
|
22
|
-
{
|
|
23
|
-
name: "deposit",
|
|
24
|
-
type: "function",
|
|
25
|
-
stateMutability: "nonpayable",
|
|
26
|
-
inputs: [
|
|
27
|
-
{ name: "token", type: "address" },
|
|
28
|
-
{ name: "vault", type: "address" },
|
|
29
|
-
{ name: "callData", type: "bytes" },
|
|
30
|
-
{ name: "minAmountOut", type: "uint256" }
|
|
31
|
-
],
|
|
32
|
-
outputs: []
|
|
33
|
-
}
|
|
34
|
-
];
|
|
35
|
-
var NADO_NO_REFERRAL_CODE = "-1";
|
|
36
|
-
var NADO_DEFAULT_SUBACCOUNT_NAME = "default";
|
|
37
|
-
var NADO_SUBACCOUNT_NAME_MAX_BYTES = 12;
|
|
38
|
-
function buildNadoSubaccount(owner, name = NADO_DEFAULT_SUBACCOUNT_NAME) {
|
|
39
|
-
const nameHex = stringToHex(name);
|
|
40
|
-
const nameByteLength = (nameHex.length - 2) / 2;
|
|
41
|
-
if (nameByteLength > NADO_SUBACCOUNT_NAME_MAX_BYTES) {
|
|
42
|
-
throw new Error(
|
|
43
|
-
`Nado subaccount name must encode to \u2264 ${NADO_SUBACCOUNT_NAME_MAX_BYTES} bytes (got ${nameByteLength}: "${name}")`
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
return concat([
|
|
47
|
-
owner,
|
|
48
|
-
pad(nameHex, { dir: "right", size: NADO_SUBACCOUNT_NAME_MAX_BYTES })
|
|
49
|
-
]);
|
|
50
|
-
}
|
|
51
|
-
function createNadoDepositActions(config) {
|
|
52
|
-
const {
|
|
53
|
-
recipientAddress,
|
|
54
|
-
collateralTokenAddress,
|
|
55
|
-
productId,
|
|
56
|
-
subaccountName,
|
|
57
|
-
referralCode = NADO_NO_REFERRAL_CODE
|
|
58
|
-
} = config;
|
|
59
|
-
if (!recipientAddress) {
|
|
60
|
-
throw new Error("Please connect your wallet before starting a Nado deposit");
|
|
61
|
-
}
|
|
62
|
-
const collateral = getAddress(collateralTokenAddress);
|
|
63
|
-
const subaccount = buildNadoSubaccount(recipientAddress, subaccountName);
|
|
64
|
-
const depositCalldata = concat([
|
|
65
|
-
toFunctionSelector(
|
|
66
|
-
"depositCollateralWithReferral(bytes32,uint32,uint128,string)"
|
|
67
|
-
),
|
|
68
|
-
encodeAbiParameters(
|
|
69
|
-
[
|
|
70
|
-
{ type: "bytes32" },
|
|
71
|
-
{ type: "uint32" },
|
|
72
|
-
{ type: "uint256" },
|
|
73
|
-
{ type: "string" }
|
|
74
|
-
],
|
|
75
|
-
[subaccount, productId, AMOUNT_PLACEHOLDER, referralCode]
|
|
76
|
-
)
|
|
77
|
-
]);
|
|
78
|
-
return [
|
|
79
|
-
// MAX approve so the pull covers whatever balance actually arrived (the
|
|
80
|
-
// amount is only known at execution); the spender is Fun's own audited
|
|
81
|
-
// VaultDepositooor. No zero-first reset needed: Ink USDT0 uses plain OZ
|
|
82
|
-
// approve (verified), unlike legacy mainnet USDT.
|
|
83
|
-
{
|
|
84
|
-
contractAbi: erc20Abi,
|
|
85
|
-
contractAddress: collateral,
|
|
86
|
-
functionName: "approve",
|
|
87
|
-
functionArgs: [INK_VAULT_DEPOSITOR_ADDRESS, maxUint256]
|
|
88
|
-
},
|
|
89
|
-
// VaultDepositooor pulls the live balance, injects it over the
|
|
90
|
-
// placeholder, and calls the Endpoint. minAmountOut is 0 because the
|
|
91
|
-
// collateral passes through 1:1 (no vault rate to bound).
|
|
92
|
-
{
|
|
93
|
-
contractAbi: VAULT_DEPOSITOR_ABI,
|
|
94
|
-
contractAddress: INK_VAULT_DEPOSITOR_ADDRESS,
|
|
95
|
-
functionName: "deposit",
|
|
96
|
-
functionArgs: [collateral, NADO_ENDPOINT_ADDRESS, depositCalldata, 0n]
|
|
97
|
-
}
|
|
98
|
-
];
|
|
99
|
-
}
|
|
100
|
-
export {
|
|
101
|
-
INK_VAULT_DEPOSITOR_ADDRESS,
|
|
102
|
-
NADO_DEFAULT_SUBACCOUNT_NAME,
|
|
103
|
-
NADO_ENDPOINT_ADDRESS,
|
|
104
|
-
NADO_NO_REFERRAL_CODE,
|
|
105
|
-
buildNadoSubaccount,
|
|
106
|
-
createNadoDepositActions
|
|
107
|
-
};
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Polymarket V2 PMCT withdrawal.
|
|
3
|
-
*
|
|
4
|
-
* Two flows are supported, dispatched on input shape:
|
|
5
|
-
*
|
|
6
|
-
* 1. **UDA / PMCT transfer** (legacy) — caller supplies `userId` +
|
|
7
|
-
* `sendPmctTransfer`. The backend handles the unwrap/route via
|
|
8
|
-
* PermissionedRamp. Returns a {@link CustomWithdrawalConfig}.
|
|
9
|
-
*
|
|
10
|
-
* 2. **Wallet unwrap** — caller supplies `proxyAddress`, a `publicClient`,
|
|
11
|
-
* and a batched `sendTransactions` primitive. `preWithdrawalAction`
|
|
12
|
-
* reads the pUSD allowance and returns the approve (when needed) +
|
|
13
|
-
* `unwrap()` to USDCe as an array of {@link WithdrawalTransaction}s.
|
|
14
|
-
* The SDK prepends those to the withdrawal txn and atomically broadcasts
|
|
15
|
-
* the batch via the integrator's `sendTransactions`. Returns a
|
|
16
|
-
* {@link WalletWithdrawalConfig}.
|
|
17
|
-
*/
|
|
18
|
-
import { type Address, type PublicClient, type TransactionReceipt } from 'viem';
|
|
19
|
-
import type { CustomWithdrawalConfig, FunkitCheckoutActionParams, FunkitWithdrawalConfig, WalletWithdrawalConfig } from '../providers/FunkitCheckoutContext/types';
|
|
20
|
-
import type { WithdrawalTransaction } from '../wallets/Wallet';
|
|
21
|
-
export interface PolymarketWithdrawalCallbackConfig {
|
|
22
|
-
userId: string;
|
|
23
|
-
modalTitle?: string;
|
|
24
|
-
disableConnectedWallet?: boolean;
|
|
25
|
-
sourceTokenSymbol?: string;
|
|
26
|
-
defaultReceiveToken?: string;
|
|
27
|
-
sourceTokenAddress?: Address;
|
|
28
|
-
iconSrc?: string;
|
|
29
|
-
/**
|
|
30
|
-
* Execute the ERC-20 transfer of PMCT from the user's proxy to the UDA.
|
|
31
|
-
* Called after the UDA address is generated.
|
|
32
|
-
* Should return when the transaction has been submitted (not necessarily confirmed).
|
|
33
|
-
*/
|
|
34
|
-
sendPmctTransfer: (params: {
|
|
35
|
-
/** The UDA address to send PMCT to */
|
|
36
|
-
udaAddress: Address;
|
|
37
|
-
/** Amount in base units (from the quote) */
|
|
38
|
-
amountBaseUnit: bigint;
|
|
39
|
-
}) => Promise<void>;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Caller-supplied batched submitter. Receives the full ordered list of txs
|
|
43
|
-
* (helper-injected approve+unwrap, then the SDK's withdrawal txn). Must
|
|
44
|
-
* broadcast them atomically in a single user signature and return a tx hash
|
|
45
|
-
* that {@link WithdrawalClient.confirmTransaction} can wait on.
|
|
46
|
-
*/
|
|
47
|
-
export type PolymarketSendTransactions = (txs: WithdrawalTransaction[]) => Promise<string>;
|
|
48
|
-
export interface PolymarketWalletUnwrapWithdrawalConfig {
|
|
49
|
-
/** Polymarket proxy that holds pUSD and signs the batched tx. */
|
|
50
|
-
proxyAddress: Address;
|
|
51
|
-
/** Polygon public client used for the pre-flight allowance read. */
|
|
52
|
-
publicClient: PublicClient;
|
|
53
|
-
/**
|
|
54
|
-
* Batched send primitive. The SDK passes the full ordered list of txs —
|
|
55
|
-
* helper-emitted `approve(pUSD → offramp)` (only when allowance is
|
|
56
|
-
* insufficient) and `offramp.unwrap(USDCe, proxy, amount)` from
|
|
57
|
-
* `preWithdrawalAction`, followed by the withdrawal txn — and the
|
|
58
|
-
* integrator broadcasts them atomically in a single user signature.
|
|
59
|
-
*/
|
|
60
|
-
sendTransactions: PolymarketSendTransactions;
|
|
61
|
-
/**
|
|
62
|
-
* Optional override for waiting on a tx receipt. Defaults to
|
|
63
|
-
* `publicClient.waitForTransactionReceipt`.
|
|
64
|
-
*/
|
|
65
|
-
confirmTransaction?: (txHash: string, chainId: number) => Promise<TransactionReceipt>;
|
|
66
|
-
modalTitle?: string;
|
|
67
|
-
disableConnectedWallet?: boolean;
|
|
68
|
-
sourceTokenSymbol?: string;
|
|
69
|
-
sourceTokenAddress?: Address;
|
|
70
|
-
defaultReceiveToken?: string;
|
|
71
|
-
iconSrc?: string;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Combined input — supplies params for both flows. The runtime path is
|
|
75
|
-
* chosen at call time via the `enable-polymarket-wallet-withdrawal`
|
|
76
|
-
* Statsig gate (read synchronously through {@link checkFeatureGate}, so
|
|
77
|
-
* this stays a regular function callable from event handlers).
|
|
78
|
-
*/
|
|
79
|
-
export interface PolymarketWithdrawalConfig extends PolymarketWithdrawalCallbackConfig, PolymarketWalletUnwrapWithdrawalConfig {
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Combined / gated entry point. Returns a {@link CustomWithdrawalConfig}
|
|
83
|
-
* (UDA path) or {@link WalletWithdrawalConfig} (wallet-unwrap path)
|
|
84
|
-
* depending on the gate value at call time.
|
|
85
|
-
*
|
|
86
|
-
* ```ts
|
|
87
|
-
* const withdrawalConfig = createPolymarketWithdrawalConfig({
|
|
88
|
-
* userId: walletAddress,
|
|
89
|
-
* sendPmctTransfer: async ({ udaAddress, amountBaseUnit }) => { ... },
|
|
90
|
-
* proxyAddress,
|
|
91
|
-
* publicClient,
|
|
92
|
-
* sendTransactions: async (txs) => myBatchedSend(txs),
|
|
93
|
-
* })
|
|
94
|
-
* ```
|
|
95
|
-
*/
|
|
96
|
-
export declare function createPolymarketWithdrawalConfig(config: PolymarketWithdrawalConfig): FunkitWithdrawalConfig;
|
|
97
|
-
/**
|
|
98
|
-
* Legacy UDA / PMCT transfer flow. Returns a {@link CustomWithdrawalConfig}.
|
|
99
|
-
*
|
|
100
|
-
* @deprecated Pass the combined {@link PolymarketWithdrawalConfig} instead so
|
|
101
|
-
* the wallet-unwrap rollout can be staged via the
|
|
102
|
-
* `enable-polymarket-wallet-withdrawal` Statsig gate. Direct callers of this
|
|
103
|
-
* single-flow overload bypass the gate.
|
|
104
|
-
*
|
|
105
|
-
* ```ts
|
|
106
|
-
* const withdrawalConfig = createPolymarketWithdrawalConfig({
|
|
107
|
-
* userId: walletAddress,
|
|
108
|
-
* sendPmctTransfer: async ({ udaAddress, amountBaseUnit }) => { ... },
|
|
109
|
-
* })
|
|
110
|
-
* ```
|
|
111
|
-
*/
|
|
112
|
-
export declare function createPolymarketWithdrawalConfig(config: PolymarketWithdrawalCallbackConfig): CustomWithdrawalConfig;
|
|
113
|
-
/**
|
|
114
|
-
* Wallet-flow with embedded pUSD → USDCe unwrap. Returns a
|
|
115
|
-
* {@link WalletWithdrawalConfig} whose `preWithdrawalAction` and `wallet`
|
|
116
|
-
* coordinate via a closure-scoped queue, so the integrator only sees the
|
|
117
|
-
* batched `sendTransactions` primitive.
|
|
118
|
-
*
|
|
119
|
-
* @deprecated Pass the combined {@link PolymarketWithdrawalConfig} instead so
|
|
120
|
-
* the wallet-unwrap rollout can be staged via the
|
|
121
|
-
* `enable-polymarket-wallet-withdrawal` Statsig gate. Direct callers of this
|
|
122
|
-
* single-flow overload bypass the gate.
|
|
123
|
-
*
|
|
124
|
-
* ```ts
|
|
125
|
-
* const withdrawalConfig = createPolymarketWithdrawalConfig({
|
|
126
|
-
* proxyAddress,
|
|
127
|
-
* publicClient,
|
|
128
|
-
* sendTransactions: async (txs) => myBatchedSend(txs),
|
|
129
|
-
* })
|
|
130
|
-
* ```
|
|
131
|
-
*/
|
|
132
|
-
export declare function createPolymarketWithdrawalConfig(config: PolymarketWalletUnwrapWithdrawalConfig): WalletWithdrawalConfig;
|
|
133
|
-
export interface PolymarketPerpsDepositConfig {
|
|
134
|
-
/**
|
|
135
|
-
* Polymarket Perps account credited with the deposit
|
|
136
|
-
*/
|
|
137
|
-
recipientAddress: Address;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Builds the `generateActionsParams` callback for a Polymarket Perps deposit.
|
|
141
|
-
*
|
|
142
|
-
* Both legs run inside a single Relay Router V3 `cleanupErc20sViaCall` sweep,
|
|
143
|
-
* each mediated by the VaultDepositor proxy so the flow composes with
|
|
144
|
-
* EXACT_INPUT quoting — the VaultDepositor pulls msg.sender's full balance and
|
|
145
|
-
* substitutes AMOUNT_PLACEHOLDER at exec time, so arrival amounts don't need to
|
|
146
|
-
* be known at quote time:
|
|
147
|
-
* 1. USDC.e → pUSD via `CollateralOnramp.wrap`, attributing pUSD to Relay
|
|
148
|
-
* Router V3.
|
|
149
|
-
* 2. pUSD → `POLYMARKET_PERPS_ADDRESS.deposit`, crediting `recipientAddress`.
|
|
150
|
-
*
|
|
151
|
-
* Usage:
|
|
152
|
-
* ```ts
|
|
153
|
-
* const checkoutConfig: FunkitCheckoutConfig = {
|
|
154
|
-
* // ...
|
|
155
|
-
* generateActionsParams: createPerpsGenerateActionParams({
|
|
156
|
-
* recipientAddress: proxyAddress,
|
|
157
|
-
* }),
|
|
158
|
-
* }
|
|
159
|
-
* ```
|
|
160
|
-
*/
|
|
161
|
-
export declare function createPerpsGenerateActionParams(config: PolymarketPerpsDepositConfig): () => Promise<FunkitCheckoutActionParams[]>;
|