@rhinestone/deposit-modal 0.2.3 → 0.2.5-alpha.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/dist/{DepositModalReown-SJHEU6RQ.mjs → DepositModalReown-GIODYNOK.mjs} +5 -3
- package/dist/{DepositModalReown-QPJ5TT57.cjs → DepositModalReown-SVVA3OZ6.cjs} +6 -4
- package/dist/{WithdrawModalReown-RUJZCQ4C.mjs → WithdrawModalReown-HTEB4XGU.mjs} +4 -3
- package/dist/{WithdrawModalReown-KGKKBTC7.cjs → WithdrawModalReown-VNTKGALT.cjs} +5 -4
- package/dist/{chunk-5EU7N73M.cjs → chunk-4S262VLP.cjs} +83 -367
- package/dist/{chunk-TYJEZX6S.cjs → chunk-AHQY2O3U.cjs} +595 -323
- package/dist/{chunk-JRNGXHWQ.mjs → chunk-DUGDAMAF.mjs} +135 -133
- package/dist/chunk-J2SWZSXL.mjs +295 -0
- package/dist/{chunk-T2KOQH57.cjs → chunk-KE6CJVOV.cjs} +109 -107
- package/dist/chunk-LHOHM67Z.mjs +234 -0
- package/dist/{chunk-MUWVDVY4.cjs → chunk-R2HP743T.cjs} +14 -1
- package/dist/{chunk-DGT2DZXN.mjs → chunk-RQ2VCKLS.mjs} +452 -180
- package/dist/{chunk-MKO5TNVQ.mjs → chunk-WA4RA4HB.mjs} +15 -299
- package/dist/{chunk-SDZKKUCJ.mjs → chunk-WHW3ZMOT.mjs} +14 -1
- package/dist/chunk-YKGL66EF.cjs +295 -0
- package/dist/chunk-ZHLQMSQM.cjs +234 -0
- package/dist/constants.cjs +2 -2
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +6 -4
- package/dist/deposit.d.cts +3 -3
- package/dist/deposit.d.ts +3 -3
- package/dist/deposit.mjs +5 -3
- package/dist/index.cjs +7 -5
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +6 -4
- package/dist/reown.cjs +7 -5
- package/dist/reown.d.cts +2 -2
- package/dist/reown.d.ts +2 -2
- package/dist/reown.mjs +6 -4
- package/dist/safe-CB7TvRCc.d.cts +62 -0
- package/dist/safe-CB7TvRCc.d.ts +62 -0
- package/dist/safe.cjs +22 -1
- package/dist/safe.d.cts +11 -59
- package/dist/safe.d.ts +11 -59
- package/dist/safe.mjs +22 -0
- package/dist/{types-DGQzvl6v.d.ts → types-CeFbJ-MW.d.ts} +8 -1
- package/dist/{types-DJ1fzNC7.d.cts → types-D0NawmZ8.d.cts} +8 -1
- package/dist/withdraw.cjs +5 -4
- package/dist/withdraw.d.cts +3 -3
- package/dist/withdraw.d.ts +3 -3
- package/dist/withdraw.mjs +4 -3
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkR2HP743Tcjs = require('./chunk-R2HP743T.cjs');
|
|
12
12
|
|
|
13
13
|
// src/components/ui/Modal.tsx
|
|
14
14
|
|
|
@@ -775,14 +775,14 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
775
775
|
const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access', _24 => _24.balance, 'optionalAccess', _25 => _25.unlocked]), () => ( "0"));
|
|
776
776
|
const normalizedName = tokenData.tokenName.trim();
|
|
777
777
|
const isNativeSymbol = normalizedName.toUpperCase() === "ETH" || normalizedName.toUpperCase() === "ETHER";
|
|
778
|
-
const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => (
|
|
779
|
-
const resolvedTokenAddress = isNativeSymbol ?
|
|
778
|
+
const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => ( _chunkR2HP743Tcjs.getTokenAddress.call(void 0, tokenData.tokenName, chainBalance.chainId)));
|
|
779
|
+
const resolvedTokenAddress = isNativeSymbol ? _chunkR2HP743Tcjs.NATIVE_TOKEN_ADDRESS : tokenAddress;
|
|
780
780
|
if (!resolvedTokenAddress) {
|
|
781
781
|
continue;
|
|
782
782
|
}
|
|
783
|
-
const registrySymbol =
|
|
783
|
+
const registrySymbol = _chunkR2HP743Tcjs.getTokenSymbol.call(void 0, resolvedTokenAddress, chainBalance.chainId);
|
|
784
784
|
const symbol = registrySymbol !== "Token" ? registrySymbol : normalizedName || "Token";
|
|
785
|
-
const decimals = registrySymbol !== "Token" ?
|
|
785
|
+
const decimals = registrySymbol !== "Token" ? _chunkR2HP743Tcjs.getTokenDecimalsByAddress.call(void 0, resolvedTokenAddress, chainBalance.chainId) : _nullishCoalesce(tokenData.tokenDecimals, () => ( 18));
|
|
786
786
|
tokens.push({
|
|
787
787
|
chainId: chainBalance.chainId,
|
|
788
788
|
address: resolvedTokenAddress,
|
|
@@ -811,14 +811,14 @@ function normalizeDirectToken(token) {
|
|
|
811
811
|
const address = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "address"), () => ( extractString(token, "tokenAddress"))), () => ( extractString(
|
|
812
812
|
token.token,
|
|
813
813
|
"address"
|
|
814
|
-
))), () => ( (typeof chainId === "number" ?
|
|
814
|
+
))), () => ( (typeof chainId === "number" ? _chunkR2HP743Tcjs.getTokenAddress.call(void 0, symbol, chainId) : void 0)));
|
|
815
815
|
if (!address) return null;
|
|
816
816
|
const balanceUsd = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractNumber(token, "balanceUsd"), () => ( extractNumber(token, "usdValue"))), () => ( extractNumber(token, "valueUsd"))), () => ( extractNumericString(token, "balanceUsd"))), () => ( extractNumericString(token, "usdValue"))), () => ( extractNumericString(token, "valueUsd"))), () => ( 0));
|
|
817
817
|
const isSolanaToken = chainId === "solana";
|
|
818
|
-
const registrySymbol = isSolanaToken ? "Token" :
|
|
818
|
+
const registrySymbol = isSolanaToken ? "Token" : _chunkR2HP743Tcjs.getTokenSymbol.call(void 0, address, chainId);
|
|
819
819
|
const resolvedSymbol = isSolanaToken ? symbol : registrySymbol !== "Token" ? registrySymbol : symbol;
|
|
820
820
|
const backendDecimals = _nullishCoalesce(extractNumber(token, "decimals"), () => ( extractNumber(token, "tokenDecimals")));
|
|
821
|
-
const resolvedDecimals = !isSolanaToken && registrySymbol !== "Token" ?
|
|
821
|
+
const resolvedDecimals = !isSolanaToken && registrySymbol !== "Token" ? _chunkR2HP743Tcjs.getTokenDecimalsByAddress.call(void 0, address, chainId) : _nullishCoalesce(backendDecimals, () => ( 18));
|
|
822
822
|
return {
|
|
823
823
|
chainId,
|
|
824
824
|
address,
|
|
@@ -1146,16 +1146,6 @@ function TransferIcon() {
|
|
|
1146
1146
|
}
|
|
1147
1147
|
) });
|
|
1148
1148
|
}
|
|
1149
|
-
function CheckIcon() {
|
|
1150
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1151
|
-
"path",
|
|
1152
|
-
{
|
|
1153
|
-
d: "M5 13l4 4L19 7",
|
|
1154
|
-
strokeLinecap: "round",
|
|
1155
|
-
strokeLinejoin: "round"
|
|
1156
|
-
}
|
|
1157
|
-
) });
|
|
1158
|
-
}
|
|
1159
1149
|
function ChevronRightIcon() {
|
|
1160
1150
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1161
1151
|
"path",
|
|
@@ -1167,6 +1157,43 @@ function ChevronRightIcon() {
|
|
|
1167
1157
|
) });
|
|
1168
1158
|
}
|
|
1169
1159
|
|
|
1160
|
+
// src/components/ui/PoweredBy.tsx
|
|
1161
|
+
|
|
1162
|
+
function PoweredBy() {
|
|
1163
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-powered-by", children: [
|
|
1164
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1165
|
+
"svg",
|
|
1166
|
+
{
|
|
1167
|
+
viewBox: "0 0 24 24",
|
|
1168
|
+
fill: "none",
|
|
1169
|
+
stroke: "currentColor",
|
|
1170
|
+
strokeWidth: "2",
|
|
1171
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1172
|
+
"path",
|
|
1173
|
+
{
|
|
1174
|
+
strokeLinecap: "round",
|
|
1175
|
+
strokeLinejoin: "round",
|
|
1176
|
+
d: "M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"
|
|
1177
|
+
}
|
|
1178
|
+
)
|
|
1179
|
+
}
|
|
1180
|
+
),
|
|
1181
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
|
|
1182
|
+
"Powered by",
|
|
1183
|
+
" ",
|
|
1184
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1185
|
+
"a",
|
|
1186
|
+
{
|
|
1187
|
+
href: "https://www.rhinestone.dev",
|
|
1188
|
+
target: "_blank",
|
|
1189
|
+
rel: "noopener noreferrer",
|
|
1190
|
+
children: "Rhinestone"
|
|
1191
|
+
}
|
|
1192
|
+
)
|
|
1193
|
+
] })
|
|
1194
|
+
] });
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1170
1197
|
// src/components/steps/ConnectStep.tsx
|
|
1171
1198
|
|
|
1172
1199
|
function rowIcon(kind) {
|
|
@@ -1176,14 +1203,13 @@ function rowIcon(kind) {
|
|
|
1176
1203
|
}
|
|
1177
1204
|
function ConnectStep({
|
|
1178
1205
|
walletOptions,
|
|
1179
|
-
|
|
1206
|
+
enablePolymarketMigration,
|
|
1180
1207
|
onSelectWallet,
|
|
1181
1208
|
onSelectTransferCrypto,
|
|
1209
|
+
onSelectPolymarket,
|
|
1182
1210
|
onRequestConnect,
|
|
1183
1211
|
onConnect,
|
|
1184
1212
|
onDisconnect,
|
|
1185
|
-
onContinue,
|
|
1186
|
-
continueButtonLabel = "Continue",
|
|
1187
1213
|
connectButtonLabel = "Connect external wallet"
|
|
1188
1214
|
}) {
|
|
1189
1215
|
const hasWalletOptions = (_nullishCoalesce(_optionalChain([walletOptions, 'optionalAccess', _56 => _56.length]), () => ( 0))) > 0;
|
|
@@ -1195,36 +1221,45 @@ function ConnectStep({
|
|
|
1195
1221
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
1196
1222
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-connect-centered rs-connect-centered--wallets", children: [
|
|
1197
1223
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-connect-wallet-list", children: [
|
|
1224
|
+
onSelectTransferCrypto && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1225
|
+
"button",
|
|
1226
|
+
{
|
|
1227
|
+
type: "button",
|
|
1228
|
+
className: "rs-connect-wallet-row rs-connect-wallet-row--action",
|
|
1229
|
+
onClick: onSelectTransferCrypto,
|
|
1230
|
+
children: [
|
|
1231
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-connect-wallet-icon rs-connect-wallet-icon--action", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TransferIcon, {}) }),
|
|
1232
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-connect-wallet-meta", children: [
|
|
1233
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-connect-wallet-label", children: "Transfer Crypto" }),
|
|
1234
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-connect-wallet-address", children: "No limit instant transfer" })
|
|
1235
|
+
] }),
|
|
1236
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-connect-wallet-indicator", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronRightIcon, {}) })
|
|
1237
|
+
]
|
|
1238
|
+
}
|
|
1239
|
+
),
|
|
1198
1240
|
_optionalChain([walletOptions, 'optionalAccess', _59 => _59.map, 'call', _60 => _60((option) => {
|
|
1199
|
-
const isSelected = option.id === selectedWalletId;
|
|
1200
1241
|
const rawAddress = _nullishCoalesce(_nullishCoalesce(option.address, () => ( option.solanaAddress)), () => ( option.id));
|
|
1201
1242
|
const shortAddress = rawAddress.length > 12 ? `${rawAddress.slice(0, 6)}...${rawAddress.slice(-4)}` : rawAddress;
|
|
1202
1243
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1203
1244
|
"button",
|
|
1204
1245
|
{
|
|
1205
1246
|
type: "button",
|
|
1206
|
-
className:
|
|
1247
|
+
className: "rs-connect-wallet-row",
|
|
1207
1248
|
onClick: () => _optionalChain([onSelectWallet, 'optionalCall', _61 => _61(option.id)]),
|
|
1208
1249
|
children: [
|
|
1209
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1210
|
-
"
|
|
1250
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-connect-wallet-icon", children: option.icon ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1251
|
+
"img",
|
|
1211
1252
|
{
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
{
|
|
1216
|
-
src: option.icon,
|
|
1217
|
-
alt: option.label,
|
|
1218
|
-
style: { width: 24, height: 24, borderRadius: 6 }
|
|
1219
|
-
}
|
|
1220
|
-
) : rowIcon(option.kind)
|
|
1253
|
+
src: option.icon,
|
|
1254
|
+
alt: option.label,
|
|
1255
|
+
style: { width: 24, height: 24, borderRadius: 6 }
|
|
1221
1256
|
}
|
|
1222
|
-
),
|
|
1257
|
+
) : rowIcon(option.kind) }),
|
|
1223
1258
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-connect-wallet-meta", children: [
|
|
1224
1259
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-connect-wallet-label", children: option.label }),
|
|
1225
1260
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-connect-wallet-address", children: shortAddress })
|
|
1226
1261
|
] }),
|
|
1227
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-connect-wallet-indicator", children:
|
|
1262
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-connect-wallet-indicator", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronRightIcon, {}) })
|
|
1228
1263
|
]
|
|
1229
1264
|
},
|
|
1230
1265
|
option.id
|
|
@@ -1246,18 +1281,15 @@ function ConnectStep({
|
|
|
1246
1281
|
]
|
|
1247
1282
|
}
|
|
1248
1283
|
),
|
|
1249
|
-
|
|
1284
|
+
enablePolymarketMigration && onSelectPolymarket && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1250
1285
|
"button",
|
|
1251
1286
|
{
|
|
1252
1287
|
type: "button",
|
|
1253
1288
|
className: "rs-connect-wallet-row rs-connect-wallet-row--action",
|
|
1254
|
-
onClick:
|
|
1289
|
+
onClick: onSelectPolymarket,
|
|
1255
1290
|
children: [
|
|
1256
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-connect-wallet-icon rs-connect-wallet-icon--action", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1257
|
-
/* @__PURE__ */ _jsxruntime.
|
|
1258
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-connect-wallet-label", children: "Transfer Crypto" }),
|
|
1259
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-connect-wallet-address", children: "No limit instant transfer" })
|
|
1260
|
-
] }),
|
|
1291
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-connect-wallet-icon rs-connect-wallet-icon--action", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExternalLinkIcon, {}) }),
|
|
1292
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-connect-wallet-meta", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-connect-wallet-label", children: "Migrate from Polymarket" }) }),
|
|
1261
1293
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-connect-wallet-indicator", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronRightIcon, {}) })
|
|
1262
1294
|
]
|
|
1263
1295
|
}
|
|
@@ -1275,16 +1307,7 @@ function ConnectStep({
|
|
|
1275
1307
|
}
|
|
1276
1308
|
)
|
|
1277
1309
|
] }),
|
|
1278
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1279
|
-
Button,
|
|
1280
|
-
{
|
|
1281
|
-
onClick: onContinue,
|
|
1282
|
-
variant: "accent",
|
|
1283
|
-
fullWidth: true,
|
|
1284
|
-
disabled: !selectedWalletId || !onContinue,
|
|
1285
|
-
children: continueButtonLabel
|
|
1286
|
-
}
|
|
1287
|
-
) })
|
|
1310
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PoweredBy, {})
|
|
1288
1311
|
] });
|
|
1289
1312
|
}
|
|
1290
1313
|
const handleConnect = _nullishCoalesce(onConnect, () => ( onRequestConnect));
|
|
@@ -1321,6 +1344,22 @@ function ConnectStep({
|
|
|
1321
1344
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-connect-wallet-indicator", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronRightIcon, {}) })
|
|
1322
1345
|
]
|
|
1323
1346
|
}
|
|
1347
|
+
),
|
|
1348
|
+
enablePolymarketMigration && handleConnect && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1349
|
+
"button",
|
|
1350
|
+
{
|
|
1351
|
+
type: "button",
|
|
1352
|
+
className: "rs-connect-wallet-row rs-connect-wallet-row--action",
|
|
1353
|
+
onClick: _nullishCoalesce(onSelectPolymarket, () => ( handleConnect)),
|
|
1354
|
+
children: [
|
|
1355
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-connect-wallet-icon rs-connect-wallet-icon--action", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExternalLinkIcon, {}) }),
|
|
1356
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-connect-wallet-meta", children: [
|
|
1357
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-connect-wallet-label", children: "Connect Polymarket" }),
|
|
1358
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-connect-wallet-address", children: "Connect the EOA that owns your Polymarket wallet" })
|
|
1359
|
+
] }),
|
|
1360
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-connect-wallet-indicator", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronRightIcon, {}) })
|
|
1361
|
+
]
|
|
1362
|
+
}
|
|
1324
1363
|
)
|
|
1325
1364
|
] }) }) });
|
|
1326
1365
|
}
|
|
@@ -1430,43 +1469,6 @@ function accountFromPrivateKey(privateKey) {
|
|
|
1430
1469
|
|
|
1431
1470
|
|
|
1432
1471
|
|
|
1433
|
-
// src/components/ui/PoweredBy.tsx
|
|
1434
|
-
|
|
1435
|
-
function PoweredBy() {
|
|
1436
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-powered-by", children: [
|
|
1437
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1438
|
-
"svg",
|
|
1439
|
-
{
|
|
1440
|
-
viewBox: "0 0 24 24",
|
|
1441
|
-
fill: "none",
|
|
1442
|
-
stroke: "currentColor",
|
|
1443
|
-
strokeWidth: "2",
|
|
1444
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1445
|
-
"path",
|
|
1446
|
-
{
|
|
1447
|
-
strokeLinecap: "round",
|
|
1448
|
-
strokeLinejoin: "round",
|
|
1449
|
-
d: "M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"
|
|
1450
|
-
}
|
|
1451
|
-
)
|
|
1452
|
-
}
|
|
1453
|
-
),
|
|
1454
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
|
|
1455
|
-
"Powered by",
|
|
1456
|
-
" ",
|
|
1457
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1458
|
-
"a",
|
|
1459
|
-
{
|
|
1460
|
-
href: "https://www.rhinestone.dev",
|
|
1461
|
-
target: "_blank",
|
|
1462
|
-
rel: "noopener noreferrer",
|
|
1463
|
-
children: "Rhinestone"
|
|
1464
|
-
}
|
|
1465
|
-
)
|
|
1466
|
-
] })
|
|
1467
|
-
] });
|
|
1468
|
-
}
|
|
1469
|
-
|
|
1470
1472
|
// src/core/webhook.ts
|
|
1471
1473
|
function isRecord(value) {
|
|
1472
1474
|
return typeof value === "object" && value !== null;
|
|
@@ -1987,15 +1989,15 @@ function ProcessingStep({
|
|
|
1987
1989
|
const displaySourceChain = _nullishCoalesce(sourceDetails.chainId, () => ( sourceChain));
|
|
1988
1990
|
const displaySourceToken = _nullishCoalesce(sourceDetails.token, () => ( sourceToken));
|
|
1989
1991
|
const displayAmount = _nullishCoalesce(sourceDetails.amount, () => ( amount));
|
|
1990
|
-
const sourceExplorerUrl =
|
|
1991
|
-
const bridgeExplorerUrl = bridgeTxHash ?
|
|
1992
|
-
const destExplorerUrl = destinationTxHash ?
|
|
1992
|
+
const sourceExplorerUrl = _chunkR2HP743Tcjs.getExplorerTxUrl.call(void 0, displaySourceChain, txHash);
|
|
1993
|
+
const bridgeExplorerUrl = bridgeTxHash ? _chunkR2HP743Tcjs.getExplorerTxUrl.call(void 0, targetChain, bridgeTxHash) : null;
|
|
1994
|
+
const destExplorerUrl = destinationTxHash ? _chunkR2HP743Tcjs.getExplorerTxUrl.call(void 0, targetChain, destinationTxHash) : null;
|
|
1993
1995
|
const isEvmSourceToken = /^0x[a-fA-F0-9]{40}$/.test(displaySourceToken);
|
|
1994
|
-
const sourceSymbol =
|
|
1995
|
-
const sourceDecimals =
|
|
1996
|
+
const sourceSymbol = _nullishCoalesce(providedSourceSymbol, () => ( (displaySourceChain === "solana" ? "SOL" : isEvmSourceToken ? _chunkR2HP743Tcjs.getTokenSymbol.call(void 0, displaySourceToken, displaySourceChain) : "Token")));
|
|
1997
|
+
const sourceDecimals = _nullishCoalesce(providedSourceDecimals, () => ( (displaySourceChain === "solana" ? 9 : isEvmSourceToken ? _chunkR2HP743Tcjs.getTokenDecimalsByAddress.call(void 0,
|
|
1996
1998
|
displaySourceToken,
|
|
1997
1999
|
displaySourceChain
|
|
1998
|
-
) :
|
|
2000
|
+
) : 18)));
|
|
1999
2001
|
const formattedReceivedAmount = (() => {
|
|
2000
2002
|
try {
|
|
2001
2003
|
const raw = _viem.formatUnits.call(void 0, BigInt(displayAmount), sourceDecimals);
|
|
@@ -2013,7 +2015,7 @@ function ProcessingStep({
|
|
|
2013
2015
|
const activePhaseElapsedMs = isProcessing && activePhaseStartedAt !== void 0 ? timelineNowMs - activePhaseStartedAt : 0;
|
|
2014
2016
|
const delayPhaseId = isProcessing && currentPhaseId && activePhaseElapsedMs >= SOFT_DELAY_MS[currentPhaseId] ? currentPhaseId : void 0;
|
|
2015
2017
|
const headerTitle = isFailed ? `${flowCapitalized} could not be completed` : isComplete ? isEarlyComplete ? `${flowCapitalized} confirmed` : `${flowCapitalized} successful` : delayPhaseId === "received" ? "Bridge pending" : delayPhaseId === "bridging" ? "Bridge delayed" : delayPhaseId === "confirming" ? `Confirming ${flowNoun}` : `Submitting transaction...`;
|
|
2016
|
-
const headerDescription = isFailed ? _nullishCoalesce(failureMessage, () => ( "The transfer could not be completed.")) : isComplete ? directTransfer ? "Your transfer is complete." : isEarlyComplete ? "The bridge has started. Funds will arrive shortly." : "Your funds were successfully deposited." : delayPhaseId === "received" ? "Funds are in. We are still waiting for the bridge transaction to begin." : delayPhaseId === "bridging" ? "The bridge has started but settlement is taking longer than expected." : delayPhaseId === "confirming" ? "The source transaction has not been picked up yet, but we are still polling automatically." : _optionalChain([state, 'access', _154 => _154.lastEvent, 'optionalAccess', _155 => _155.type]) === "deposit-received" ? "Transfer received. Preparing bridge execution." : _optionalChain([state, 'access', _156 => _156.lastEvent, 'optionalAccess', _157 => _157.type]) === "bridge-started" ? `Bridge started. Sending funds to ${
|
|
2018
|
+
const headerDescription = isFailed ? _nullishCoalesce(failureMessage, () => ( "The transfer could not be completed.")) : isComplete ? directTransfer ? "Your transfer is complete." : isEarlyComplete ? "The bridge has started. Funds will arrive shortly." : "Your funds were successfully deposited." : delayPhaseId === "received" ? "Funds are in. We are still waiting for the bridge transaction to begin." : delayPhaseId === "bridging" ? "The bridge has started but settlement is taking longer than expected." : delayPhaseId === "confirming" ? "The source transaction has not been picked up yet, but we are still polling automatically." : _optionalChain([state, 'access', _154 => _154.lastEvent, 'optionalAccess', _155 => _155.type]) === "deposit-received" ? "Transfer received. Preparing bridge execution." : _optionalChain([state, 'access', _156 => _156.lastEvent, 'optionalAccess', _157 => _157.type]) === "bridge-started" ? `Bridge started. Sending funds to ${_chunkR2HP743Tcjs.getChainName.call(void 0, targetChain)}.` : "Filling your transaction on the blockchain.";
|
|
2017
2019
|
const showAlert = !isFailed && (delayPhaseId !== void 0 || hasEscalatedDelay);
|
|
2018
2020
|
const alertMessage = hasEscalatedDelay ? "Taking longer than expected. You can close this window \u2014 processing continues in the background." : "This step is slower than usual but still processing.";
|
|
2019
2021
|
const fillStatus = isComplete ? "Successful" : isFailed ? "Failed" : "Processing";
|
|
@@ -2095,15 +2097,15 @@ function ProcessingStep({
|
|
|
2095
2097
|
className: "rs-card-value",
|
|
2096
2098
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
2097
2099
|
children: [
|
|
2098
|
-
|
|
2100
|
+
_chunkR2HP743Tcjs.getChainIcon.call(void 0, displaySourceChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2099
2101
|
"img",
|
|
2100
2102
|
{
|
|
2101
|
-
src:
|
|
2103
|
+
src: _chunkR2HP743Tcjs.getChainIcon.call(void 0, displaySourceChain),
|
|
2102
2104
|
alt: "",
|
|
2103
2105
|
style: { width: 16, height: 16, borderRadius: 3 }
|
|
2104
2106
|
}
|
|
2105
2107
|
),
|
|
2106
|
-
|
|
2108
|
+
_chunkR2HP743Tcjs.getChainName.call(void 0, displaySourceChain),
|
|
2107
2109
|
sourceExplorerUrl && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2108
2110
|
"a",
|
|
2109
2111
|
{
|
|
@@ -2126,15 +2128,15 @@ function ProcessingStep({
|
|
|
2126
2128
|
className: "rs-card-value",
|
|
2127
2129
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
2128
2130
|
children: [
|
|
2129
|
-
|
|
2131
|
+
_chunkR2HP743Tcjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2130
2132
|
"img",
|
|
2131
2133
|
{
|
|
2132
|
-
src:
|
|
2134
|
+
src: _chunkR2HP743Tcjs.getChainIcon.call(void 0, targetChain),
|
|
2133
2135
|
alt: "",
|
|
2134
2136
|
style: { width: 16, height: 16, borderRadius: 3 }
|
|
2135
2137
|
}
|
|
2136
2138
|
),
|
|
2137
|
-
|
|
2139
|
+
_chunkR2HP743Tcjs.getChainName.call(void 0, targetChain),
|
|
2138
2140
|
destExplorerUrl && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2139
2141
|
"a",
|
|
2140
2142
|
{
|
|
@@ -2158,10 +2160,10 @@ function ProcessingStep({
|
|
|
2158
2160
|
className: "rs-card-value",
|
|
2159
2161
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
2160
2162
|
children: [
|
|
2161
|
-
|
|
2163
|
+
_chunkR2HP743Tcjs.getTokenIcon.call(void 0, sourceSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2162
2164
|
"img",
|
|
2163
2165
|
{
|
|
2164
|
-
src:
|
|
2166
|
+
src: _chunkR2HP743Tcjs.getTokenIcon.call(void 0, sourceSymbol),
|
|
2165
2167
|
alt: "",
|
|
2166
2168
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
2167
2169
|
}
|
|
@@ -2293,7 +2295,7 @@ var clientCache = /* @__PURE__ */ new Map();
|
|
|
2293
2295
|
function getPublicClient(chainId) {
|
|
2294
2296
|
let client = clientCache.get(chainId);
|
|
2295
2297
|
if (!client) {
|
|
2296
|
-
const chain =
|
|
2298
|
+
const chain = _chunkR2HP743Tcjs.CHAIN_BY_ID[chainId];
|
|
2297
2299
|
client = _viem.createPublicClient.call(void 0, {
|
|
2298
2300
|
chain,
|
|
2299
2301
|
transport: _viem.http.call(void 0, )
|
|
@@ -2333,4 +2335,4 @@ function getPublicClient(chainId) {
|
|
|
2333
2335
|
|
|
2334
2336
|
|
|
2335
2337
|
|
|
2336
|
-
exports.Modal = Modal; exports.Spinner = Spinner; exports.Button = Button; exports.ConnectStep = ConnectStep; exports.debugLog = debugLog; exports.debugError = debugError; exports.toEvmCaip2 = toEvmCaip2; exports.parseEvmChainId = parseEvmChainId; exports.isSolanaCaip2 = isSolanaCaip2; exports.buildSessionDetails = buildSessionDetails; exports.createDepositService = createDepositService; exports.getAssetId = getAssetId; exports.portfolioToAssets = portfolioToAssets; exports.isNativeAsset = isNativeAsset; exports.loadSessionOwnerFromStorage = loadSessionOwnerFromStorage; exports.saveSessionOwnerToStorage = saveSessionOwnerToStorage; exports.createSessionOwnerKey = createSessionOwnerKey; exports.accountFromPrivateKey = accountFromPrivateKey; exports.
|
|
2338
|
+
exports.Modal = Modal; exports.Spinner = Spinner; exports.Button = Button; exports.PoweredBy = PoweredBy; exports.ConnectStep = ConnectStep; exports.debugLog = debugLog; exports.debugError = debugError; exports.toEvmCaip2 = toEvmCaip2; exports.parseEvmChainId = parseEvmChainId; exports.isSolanaCaip2 = isSolanaCaip2; exports.buildSessionDetails = buildSessionDetails; exports.createDepositService = createDepositService; exports.getAssetId = getAssetId; exports.portfolioToAssets = portfolioToAssets; exports.isNativeAsset = isNativeAsset; exports.loadSessionOwnerFromStorage = loadSessionOwnerFromStorage; exports.saveSessionOwnerToStorage = saveSessionOwnerToStorage; exports.createSessionOwnerKey = createSessionOwnerKey; exports.accountFromPrivateKey = accountFromPrivateKey; exports.currencyFormatter = currencyFormatter; exports.tokenFormatter = tokenFormatter; exports.formatUserError = formatUserError; exports.getEventTxHash = getEventTxHash; exports.isDepositEvent = isDepositEvent; exports.txRefsMatch = txRefsMatch; exports.useLatestRef = useLatestRef; exports.ProcessingStep = ProcessingStep; exports.getPublicClient = getPublicClient; exports.applyTheme = applyTheme;
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SAFE_ABI
|
|
3
|
+
} from "./chunk-J2SWZSXL.mjs";
|
|
4
|
+
|
|
5
|
+
// src/core/polymarket-safe.ts
|
|
6
|
+
import {
|
|
7
|
+
concat,
|
|
8
|
+
encodeAbiParameters,
|
|
9
|
+
encodeFunctionData,
|
|
10
|
+
encodePacked,
|
|
11
|
+
erc20Abi,
|
|
12
|
+
formatUnits,
|
|
13
|
+
getAddress,
|
|
14
|
+
getCreate2Address,
|
|
15
|
+
keccak256,
|
|
16
|
+
parseAbi,
|
|
17
|
+
parseEventLogs,
|
|
18
|
+
pad,
|
|
19
|
+
toHex,
|
|
20
|
+
zeroAddress
|
|
21
|
+
} from "viem";
|
|
22
|
+
var POLYMARKET_POLYGON_CHAIN_ID = 137;
|
|
23
|
+
var POLYMARKET_SAFE_FACTORY_ADDRESS = "0xaacFeEa03eb1561C4e67d661e40682Bd20E3541b";
|
|
24
|
+
var POLYMARKET_SAFE_INIT_CODE_HASH = "0x2bce2127ff07fb632d16c8347c4ebf501f4841168bed00d9e6ef715ddb6fcecf";
|
|
25
|
+
var POLYMARKET_USDCE_ADDRESS = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174";
|
|
26
|
+
var POLYMARKET_PUSD_ADDRESS = "0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB";
|
|
27
|
+
var POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS = "0x2957922Eb93258b93368531d39fAcCA3B4dC5854";
|
|
28
|
+
var SAFE_MULTI_SEND_CALL_ONLY_ADDRESS = "0x40A2aCCbd92BCA938b02010E17A5b8929b49130D";
|
|
29
|
+
var COLLATERAL_OFFRAMP_ABI = parseAbi([
|
|
30
|
+
"function unwrap(address _asset, address _to, uint256 _amount)"
|
|
31
|
+
]);
|
|
32
|
+
var MULTI_SEND_ABI = parseAbi(["function multiSend(bytes transactions)"]);
|
|
33
|
+
function derivePolymarketSafeAddress(owner) {
|
|
34
|
+
const checksummedOwner = getAddress(owner);
|
|
35
|
+
const salt = keccak256(
|
|
36
|
+
encodeAbiParameters([{ type: "address" }], [checksummedOwner])
|
|
37
|
+
);
|
|
38
|
+
return getCreate2Address({
|
|
39
|
+
from: POLYMARKET_SAFE_FACTORY_ADDRESS,
|
|
40
|
+
salt,
|
|
41
|
+
bytecodeHash: POLYMARKET_SAFE_INIT_CODE_HASH
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function isPolymarketAsset(asset) {
|
|
45
|
+
return asset.source === "polymarket";
|
|
46
|
+
}
|
|
47
|
+
async function fetchPolymarketBalances(params) {
|
|
48
|
+
const safeAddress = derivePolymarketSafeAddress(params.owner);
|
|
49
|
+
const balances = await Promise.all([
|
|
50
|
+
readTokenBalance(params.publicClient, POLYMARKET_USDCE_ADDRESS, safeAddress),
|
|
51
|
+
readTokenBalance(params.publicClient, POLYMARKET_PUSD_ADDRESS, safeAddress)
|
|
52
|
+
]);
|
|
53
|
+
const [usdceBalance, pusdBalance] = balances;
|
|
54
|
+
const assets = [];
|
|
55
|
+
if (usdceBalance > 0n) {
|
|
56
|
+
assets.push(
|
|
57
|
+
buildPolymarketAsset({
|
|
58
|
+
kind: "usdce",
|
|
59
|
+
safeAddress,
|
|
60
|
+
balance: usdceBalance
|
|
61
|
+
})
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
if (pusdBalance > 0n) {
|
|
65
|
+
assets.push(
|
|
66
|
+
buildPolymarketAsset({
|
|
67
|
+
kind: "pusd",
|
|
68
|
+
safeAddress,
|
|
69
|
+
balance: pusdBalance
|
|
70
|
+
})
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
safeAddress,
|
|
75
|
+
assets,
|
|
76
|
+
totalUsd: assets.reduce((sum, asset) => sum + (asset.balanceUsd ?? 0), 0)
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
async function executePolymarketSafeTransfer(params) {
|
|
80
|
+
const account = params.walletClient.account;
|
|
81
|
+
const chain = params.walletClient.chain;
|
|
82
|
+
if (!account || !chain) {
|
|
83
|
+
throw new Error("Wallet not connected");
|
|
84
|
+
}
|
|
85
|
+
if (chain.id !== POLYMARKET_POLYGON_CHAIN_ID) {
|
|
86
|
+
throw new Error("Switch to Polygon to sign");
|
|
87
|
+
}
|
|
88
|
+
const isOwner = await params.publicClient.readContract({
|
|
89
|
+
address: params.safeAddress,
|
|
90
|
+
abi: SAFE_ABI,
|
|
91
|
+
functionName: "isOwner",
|
|
92
|
+
args: [account.address]
|
|
93
|
+
});
|
|
94
|
+
if (!isOwner) {
|
|
95
|
+
throw new Error("Connected wallet is not a Polymarket Safe owner");
|
|
96
|
+
}
|
|
97
|
+
const safeTx = params.tokenKind === "pusd" ? buildPusdUnwrapSafeTx(params.recipient, params.amount) : buildUsdceTransferSafeTx(params.recipient, params.amount);
|
|
98
|
+
const signature = concat([
|
|
99
|
+
pad(account.address, { size: 32 }),
|
|
100
|
+
pad(toHex(0), { size: 32 }),
|
|
101
|
+
toHex(1, { size: 1 })
|
|
102
|
+
]);
|
|
103
|
+
const txHash = await params.walletClient.writeContract({
|
|
104
|
+
account,
|
|
105
|
+
chain,
|
|
106
|
+
address: params.safeAddress,
|
|
107
|
+
abi: SAFE_ABI,
|
|
108
|
+
functionName: "execTransaction",
|
|
109
|
+
args: [
|
|
110
|
+
safeTx.to,
|
|
111
|
+
0n,
|
|
112
|
+
safeTx.data,
|
|
113
|
+
safeTx.operation,
|
|
114
|
+
0n,
|
|
115
|
+
0n,
|
|
116
|
+
0n,
|
|
117
|
+
zeroAddress,
|
|
118
|
+
zeroAddress,
|
|
119
|
+
signature
|
|
120
|
+
]
|
|
121
|
+
});
|
|
122
|
+
const receipt = await params.publicClient.waitForTransactionReceipt({
|
|
123
|
+
hash: txHash
|
|
124
|
+
});
|
|
125
|
+
const parsed = parseEventLogs({
|
|
126
|
+
abi: SAFE_ABI,
|
|
127
|
+
logs: receipt.logs.filter(
|
|
128
|
+
(log) => log.address.toLowerCase() === params.safeAddress.toLowerCase()
|
|
129
|
+
),
|
|
130
|
+
strict: false
|
|
131
|
+
});
|
|
132
|
+
if (parsed.some((log) => log.eventName === "ExecutionFailure")) {
|
|
133
|
+
throw new Error("Polymarket Safe transaction failed");
|
|
134
|
+
}
|
|
135
|
+
if (!parsed.some((log) => log.eventName === "ExecutionSuccess")) {
|
|
136
|
+
throw new Error("Polymarket Safe transaction status unavailable");
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
txHash,
|
|
140
|
+
sourceToken: POLYMARKET_USDCE_ADDRESS,
|
|
141
|
+
sourceSymbol: params.tokenKind === "pusd" ? "pUSD" : "USDC.e"
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function buildPolymarketAsset(params) {
|
|
145
|
+
const isPusd = params.kind === "pusd";
|
|
146
|
+
const symbol = isPusd ? "pUSD" : "USDC.e";
|
|
147
|
+
const balanceUsd = Number(formatUnits(params.balance, 6));
|
|
148
|
+
return {
|
|
149
|
+
id: `polymarket:${params.kind}`,
|
|
150
|
+
chainId: POLYMARKET_POLYGON_CHAIN_ID,
|
|
151
|
+
token: isPusd ? POLYMARKET_PUSD_ADDRESS : POLYMARKET_USDCE_ADDRESS,
|
|
152
|
+
symbol,
|
|
153
|
+
name: isPusd ? "Polymarket USD" : "Polygon USDC.e",
|
|
154
|
+
decimals: 6,
|
|
155
|
+
balance: params.balance.toString(),
|
|
156
|
+
balanceUsd: Number.isFinite(balanceUsd) ? balanceUsd : 0,
|
|
157
|
+
source: "polymarket",
|
|
158
|
+
sourceLabel: "Polymarket",
|
|
159
|
+
balanceAddress: params.safeAddress,
|
|
160
|
+
depositToken: POLYMARKET_USDCE_ADDRESS,
|
|
161
|
+
polymarketTokenKind: params.kind,
|
|
162
|
+
polymarketSafeAddress: params.safeAddress,
|
|
163
|
+
reviewLabel: isPusd ? "You send pUSD from Polymarket" : "You send USDC.e from Polymarket"
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
async function readTokenBalance(publicClient, token, holder) {
|
|
167
|
+
try {
|
|
168
|
+
return await publicClient.readContract({
|
|
169
|
+
address: token,
|
|
170
|
+
abi: erc20Abi,
|
|
171
|
+
functionName: "balanceOf",
|
|
172
|
+
args: [holder]
|
|
173
|
+
});
|
|
174
|
+
} catch {
|
|
175
|
+
return 0n;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function buildUsdceTransferSafeTx(recipient, amount) {
|
|
179
|
+
return {
|
|
180
|
+
to: POLYMARKET_USDCE_ADDRESS,
|
|
181
|
+
data: encodeFunctionData({
|
|
182
|
+
abi: erc20Abi,
|
|
183
|
+
functionName: "transfer",
|
|
184
|
+
args: [recipient, amount]
|
|
185
|
+
}),
|
|
186
|
+
operation: 0
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function buildPusdUnwrapSafeTx(recipient, amount) {
|
|
190
|
+
const approveData = encodeFunctionData({
|
|
191
|
+
abi: erc20Abi,
|
|
192
|
+
functionName: "approve",
|
|
193
|
+
args: [POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS, amount]
|
|
194
|
+
});
|
|
195
|
+
const unwrapData = encodeFunctionData({
|
|
196
|
+
abi: COLLATERAL_OFFRAMP_ABI,
|
|
197
|
+
functionName: "unwrap",
|
|
198
|
+
args: [POLYMARKET_USDCE_ADDRESS, recipient, amount]
|
|
199
|
+
});
|
|
200
|
+
return {
|
|
201
|
+
to: SAFE_MULTI_SEND_CALL_ONLY_ADDRESS,
|
|
202
|
+
data: encodeFunctionData({
|
|
203
|
+
abi: MULTI_SEND_ABI,
|
|
204
|
+
functionName: "multiSend",
|
|
205
|
+
args: [
|
|
206
|
+
concat([
|
|
207
|
+
encodeMultiSendCall(POLYMARKET_PUSD_ADDRESS, approveData),
|
|
208
|
+
encodeMultiSendCall(POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS, unwrapData)
|
|
209
|
+
])
|
|
210
|
+
]
|
|
211
|
+
}),
|
|
212
|
+
operation: 1
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
function encodeMultiSendCall(to, data) {
|
|
216
|
+
return encodePacked(
|
|
217
|
+
["uint8", "address", "uint256", "uint256", "bytes"],
|
|
218
|
+
[0, to, 0n, BigInt((data.length - 2) / 2), data]
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export {
|
|
223
|
+
POLYMARKET_POLYGON_CHAIN_ID,
|
|
224
|
+
POLYMARKET_SAFE_FACTORY_ADDRESS,
|
|
225
|
+
POLYMARKET_SAFE_INIT_CODE_HASH,
|
|
226
|
+
POLYMARKET_USDCE_ADDRESS,
|
|
227
|
+
POLYMARKET_PUSD_ADDRESS,
|
|
228
|
+
POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS,
|
|
229
|
+
SAFE_MULTI_SEND_CALL_ONLY_ADDRESS,
|
|
230
|
+
derivePolymarketSafeAddress,
|
|
231
|
+
isPolymarketAsset,
|
|
232
|
+
fetchPolymarketBalances,
|
|
233
|
+
executePolymarketSafeTransfer
|
|
234
|
+
};
|
|
@@ -30,7 +30,15 @@ var SUPPORTED_TOKEN_MATRIX = {
|
|
|
30
30
|
ETH: [_chains.mainnet.id, _chains.base.id, _chains.arbitrum.id, _chains.optimism.id, _chains.polygon.id, _chains.soneium.id],
|
|
31
31
|
WETH: [_chains.mainnet.id, _chains.base.id, _chains.arbitrum.id, _chains.optimism.id, _chains.polygon.id, _chains.soneium.id],
|
|
32
32
|
USDC: [_chains.mainnet.id, _chains.base.id, _chains.arbitrum.id, _chains.optimism.id, _chains.polygon.id, _chains.soneium.id],
|
|
33
|
-
USDT: [
|
|
33
|
+
USDT: [
|
|
34
|
+
_chains.mainnet.id,
|
|
35
|
+
_chains.arbitrum.id,
|
|
36
|
+
_chains.optimism.id,
|
|
37
|
+
_chains.polygon.id,
|
|
38
|
+
_chains.bsc.id,
|
|
39
|
+
_chains.plasma.id,
|
|
40
|
+
_chains.soneium.id
|
|
41
|
+
]
|
|
34
42
|
};
|
|
35
43
|
var CHAIN_DISPLAY_ORDER = [
|
|
36
44
|
_chains.mainnet.id,
|
|
@@ -214,6 +222,11 @@ var chainRegistry = {
|
|
|
214
222
|
symbol: "WETH",
|
|
215
223
|
address: "0x4200000000000000000000000000000000000006",
|
|
216
224
|
decimals: 18
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
symbol: "USDT",
|
|
228
|
+
address: "0x3A337a6adA9d885b6Ad95ec48F9b75f197b5AE35",
|
|
229
|
+
decimals: 6
|
|
217
230
|
}
|
|
218
231
|
]
|
|
219
232
|
}
|