@funkit/connect 9.23.1 → 9.23.2-next.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 +8 -0
- package/dist/__generated__/default_configs.d.ts +901 -0
- package/dist/__generated__/default_feature_gates.d.ts +20 -0
- package/dist/clients/aave.d.ts +1 -1
- package/dist/clients/chunk-25ICASD7.js +2371 -0
- package/dist/clients/chunk-3GO74QTP.js +2382 -0
- package/dist/clients/{chunk-4M57JDJK.js → chunk-4HCOSF4M.js} +1 -1
- package/dist/clients/chunk-7GWX2ZS4.js +69 -0
- package/dist/clients/{chunk-2LMREKV6.js → chunk-7HNGV6JU.js} +1 -1
- package/dist/clients/{chunk-H3CKQIYI.js → chunk-CEBG7XQ5.js} +2 -2
- package/dist/clients/{chunk-GCIUIPM7.js → chunk-ELLXM7RO.js} +1 -1
- package/dist/clients/chunk-GGXTLJ7J.js +290 -0
- package/dist/clients/chunk-HRWCNZJA.js +230 -0
- package/dist/clients/chunk-JD3FIVZ7.js +69 -0
- package/dist/clients/chunk-JTGKAPID.js +2382 -0
- package/dist/clients/chunk-L7PABCF2.js +54 -0
- package/dist/clients/chunk-LII3SVUH.js +230 -0
- package/dist/clients/chunk-NCUPPJ2Z.js +2382 -0
- package/dist/clients/chunk-NUJ6ZM5F.js +186 -0
- package/dist/clients/chunk-UVWNEQMD.js +186 -0
- package/dist/clients/chunk-VVTNR7YH.js +2382 -0
- package/dist/clients/chunk-ZNVFASTH.js +54 -0
- package/dist/clients/fanatics.css +1 -1
- package/dist/clients/fanatics.js +3 -3
- package/dist/clients/lighter.css +1 -1
- package/dist/clients/lighter.d.ts +1 -1
- package/dist/clients/lighter.js +3 -3
- package/dist/clients/mallard.d.ts +1 -1
- package/dist/clients/nado.d.ts +78 -0
- package/dist/clients/nado.js +107 -0
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +21 -11
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.d.ts +1 -1
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +4 -4
- package/dist/clients/polymarket/createPolymarketDepositConfig.d.ts +1 -1
- package/dist/clients/polymarket/index.css +21 -11
- package/dist/clients/polymarket/index.js +4 -4
- package/dist/clients/polymarket/polymarket.d.ts +2 -2
- package/dist/clients/polymarket.d.ts +161 -0
- package/dist/clients/polymarket.js +688 -0
- package/dist/clients/rolly.d.ts +1 -1
- package/dist/components/ApprovalMethodToggle/ApprovalMethodToggle.d.ts +1 -1
- package/dist/components/BottomLinks/BottomLinks.css.d.ts +6 -0
- package/dist/components/BottomLinks/BottomLinks.d.ts +14 -0
- package/dist/components/Dropdown/ChainDropdown.d.ts +1 -1
- package/dist/components/Dropdown/TokenAndChainDropdown.d.ts +1 -1
- package/dist/components/Dropdown/TokenDropdown.d.ts +1 -1
- package/dist/components/FunAsset/FunAssetItem.d.ts +1 -1
- package/dist/components/FunCheckoutHistory/AddTokenToWalletButton.d.ts +1 -1
- package/dist/components/FunCheckoutHistory/FunDirectExecutionHistoryBottomBar.d.ts +1 -1
- package/dist/components/FunCheckoutHistory/FunDirectExecutionHistoryDetail.d.ts +1 -1
- package/dist/components/FunCheckoutHistory/PendingSuccessScreen.d.ts +2 -2
- package/dist/components/FunCheckoutHistory/YouSendItem.d.ts +1 -1
- package/dist/components/FunNotificationBanner/FunNotificationBannerIcon.d.ts +1 -1
- package/dist/components/FunPayments/FunPaymentMethods.d.ts +1 -1
- package/dist/components/FunSelectBrokerage/FunSelectBrokerage.d.ts +1 -1
- package/dist/components/FunTransactionSummary/DestinationYieldRows.d.ts +1 -1
- package/dist/components/FunTransactionSummary/PaymentAmountSummary.d.ts +3 -3
- package/dist/components/FunTransactionSummary/PaymentFeesSummary.d.ts +2 -2
- package/dist/components/FunTransactionSummary/PaymentFeesSummary.track.d.ts +2 -2
- package/dist/components/FunTransactionSummary/PaymentMethodSummary.d.ts +2 -2
- package/dist/components/FunTransactionSummary/PaymentRouteSummary.d.ts +1 -1
- package/dist/components/ModalHeightAnimationLayer/FunCheckoutModalHeightAnimationWrapper.d.ts +2 -2
- package/dist/components/NewTokenDepositAlert/NewTokenDepositAlert.d.ts +1 -1
- package/dist/components/ReceiveAmount/ReceiveAmount.d.ts +2 -2
- package/dist/components/SourcePaymentMethodItem/SourcePaymentMethodItem.d.ts +1 -1
- package/dist/components/TransactionStatus/AnimatedSpinner/AnimatedSpinner.d.ts +1 -1
- package/dist/components/TransactionStatus/StepSpinner.d.ts +1 -1
- package/dist/components/TransactionStatus/TransactionStatus.d.ts +2 -2
- package/dist/components/TransferTokenDetails/TransferTokenDetails.d.ts +1 -1
- package/dist/consts/customers.d.ts +1 -1
- package/dist/consts/funkit.d.ts +1 -0
- package/dist/domains/aave.d.ts +1 -1
- package/dist/domains/asset.d.ts +2 -2
- package/dist/domains/checkout.d.ts +1 -1
- package/dist/domains/checkoutErrors.d.ts +2 -2
- package/dist/domains/checkoutRecipient.d.ts +1 -1
- package/dist/domains/clientMetadata.d.ts +1 -1
- package/dist/domains/dynamicRouting.d.ts +1 -1
- package/dist/domains/fees.d.ts +3 -3
- package/dist/domains/paymentMethods.d.ts +1 -1
- package/dist/domains/quote.d.ts +5 -5
- package/dist/domains/quoteMode/exactOut.d.ts +1 -1
- package/dist/domains/quoteMode/resolveQuoteMode.d.ts +1 -1
- package/dist/domains/quoteMode/types.d.ts +2 -2
- package/dist/hooks/queries/useLightningQuote.d.ts +1 -1
- package/dist/hooks/queries/useMeldDefaultCurrency.d.ts +1 -1
- package/dist/hooks/queries/useRecentCheckouts.d.ts +1 -1
- package/dist/hooks/queries/useRecentDeposits.d.ts +1 -1
- package/dist/hooks/queries/useWithdrawalQuote.d.ts +31 -31
- package/dist/hooks/track/useTrack.d.ts +1 -1
- package/dist/hooks/useBluvo.d.ts +3 -3
- package/dist/hooks/useCheckoutDirectExecution.d.ts +3 -3
- package/dist/hooks/useCheckoutDirectExecutionHistory.d.ts +1 -1
- package/dist/hooks/useCheckoutItemDisplay.d.ts +2 -2
- package/dist/hooks/useCheckoutTimeEstimate.d.ts +2 -2
- package/dist/hooks/useCountdown.d.ts +1 -1
- package/dist/hooks/useEnabledTokenTransferChainTokens.d.ts +1 -1
- package/dist/hooks/useExchangeOptions.d.ts +1 -1
- package/dist/hooks/useFrogAccount.d.ts +1 -1
- package/dist/hooks/useIsBlacklisted.d.ts +1 -1
- package/dist/hooks/useIsDynamicRoutingEnabled.d.ts +1 -1
- package/dist/hooks/useMinDeposit.d.ts +1 -1
- package/dist/hooks/useNewTokenBanner.d.ts +1 -1
- package/dist/hooks/useOnNewNotification.d.ts +1 -1
- package/dist/hooks/usePaymentMethodTabs.d.ts +1 -1
- package/dist/hooks/usePaymentSources.d.ts +2 -2
- package/dist/hooks/useRelayBypass.d.ts +1 -1
- package/dist/hooks/useStepQueryReadiness.d.ts +3 -3
- package/dist/hooks/useTokenAndChainDropdown.d.ts +1 -1
- package/dist/hooks/useTokenTransfer.d.ts +1 -1
- package/dist/hooks/useTokenTransferConfig.d.ts +1 -1
- package/dist/hooks/useUserIpInfo.d.ts +1 -1
- package/dist/index.css +21 -11
- package/dist/index.js +536 -469
- package/dist/interfaces/identity.d.ts +1 -1
- package/dist/interfaces/logTransport.d.ts +51 -0
- package/dist/interfaces/swapped-transport.d.ts +78 -0
- package/dist/modals/ChainModal/Chain.d.ts +1 -1
- package/dist/modals/CheckoutModal/Brokerage/BrokerageSuccessModal.d.ts +1 -1
- package/dist/modals/CheckoutModal/Brokerage/BrokerageTwoFA.d.ts +2 -2
- package/dist/modals/CheckoutModal/Brokerage/ConnectExchange.d.ts +2 -2
- package/dist/modals/CheckoutModal/Brokerage/SelectBrokerage.d.ts +2 -2
- package/dist/modals/CheckoutModal/ConfirmationStep/CheckoutPrimaryInfo.d.ts +2 -2
- package/dist/modals/CheckoutModal/ConfirmationStep/ConfirmationStep.d.ts +1 -1
- package/dist/modals/CheckoutModal/ConfirmationStep/DisclaimerText.d.ts +1 -1
- package/dist/modals/CheckoutModal/ConfirmationStep/mapRetryAction.d.ts +1 -1
- package/dist/modals/CheckoutModal/ConfirmationStep/useCheckoutConfirmation.d.ts +1 -1
- package/dist/modals/CheckoutModal/ConfirmationStep/useCheckoutQuote.d.ts +2 -2
- package/dist/modals/CheckoutModal/ConfirmationStep/usePostCheckout.d.ts +2 -2
- package/dist/modals/CheckoutModal/ConfirmationStep/useQuoteRefresh.d.ts +1 -1
- package/dist/modals/CheckoutModal/ConfirmationStep/useSourceAssetConfirm.d.ts +2 -2
- package/dist/modals/CheckoutModal/InputAmount/InputAmount.d.ts +1 -1
- package/dist/modals/CheckoutModal/InputAmount/InputAmountLoaded.d.ts +2 -2
- package/dist/modals/CheckoutModal/InputAmount/state.d.ts +3 -3
- package/dist/modals/CheckoutModal/InputAmount/useAaveNativeSupply.d.ts +3 -3
- package/dist/modals/CheckoutModal/InputAmount/useAmountInput.d.ts +1 -1
- package/dist/modals/CheckoutModal/InputAmount/useAvailableBalanceForCheckout.d.ts +3 -3
- package/dist/modals/CheckoutModal/InputAmount/useCheckoutAmountLimits.d.ts +2 -2
- package/dist/modals/CheckoutModal/InputAmount/useMeld.d.ts +1 -1
- package/dist/modals/CheckoutModal/InputAmount/utils.d.ts +2 -2
- package/dist/modals/CheckoutModal/LightningInvoice/LightningInvoice.d.ts +1 -1
- package/dist/modals/CheckoutModal/LightningInvoice/LightningInvoiceQrCode.d.ts +1 -1
- package/dist/modals/CheckoutModal/MeldCurrencySelect/MeldCurrencySelect.d.ts +1 -1
- package/dist/modals/CheckoutModal/MeldQuotes/MeldQuotes.d.ts +1 -1
- package/dist/modals/CheckoutModal/MeldRedirect/MeldRedirect.d.ts +1 -1
- package/dist/modals/CheckoutModal/SelectAsset/SelectAsset.d.ts +4 -4
- package/dist/modals/CheckoutModal/SelectAsset/SelectAssetInfoSection.d.ts +2 -2
- package/dist/modals/CheckoutModal/SelectAsset/SelectAssetList.d.ts +2 -2
- package/dist/modals/CheckoutModal/SourceChange/ConnectedSource.d.ts +1 -1
- package/dist/modals/CheckoutModal/SourceChange/CryptoCashToggle.d.ts +2 -2
- package/dist/modals/CheckoutModal/SourceChange/EmptyFormOfPaymentsMessage.d.ts +4 -0
- package/dist/modals/CheckoutModal/SourceChange/SourceChange.d.ts +2 -2
- package/dist/modals/CheckoutModal/SourceChange/useSourceChangeLayout.d.ts +1 -1
- package/dist/modals/CheckoutModal/SourceChange/useUpdateSourceAssetForCard.d.ts +4 -0
- package/dist/modals/CheckoutModal/SwappedIframe/SwappedErrorMessage.d.ts +6 -0
- package/dist/modals/CheckoutModal/SwappedIframe/SwappedIframeController.d.ts +2 -2
- package/dist/modals/CheckoutModal/TransferToken/CheckoutNotification.d.ts +1 -1
- package/dist/modals/CheckoutModal/TransferToken/CheckoutNotifications.track.d.ts +1 -1
- package/dist/modals/CheckoutModal/TransferToken/DirectExecutionNotification.d.ts +1 -1
- package/dist/modals/CheckoutModal/TransferToken/TransferToken.d.ts +1 -1
- package/dist/modals/CheckoutModal/TransferToken/types.d.ts +1 -1
- package/dist/modals/CheckoutModal/VirtualFiatAccount/BridgeCustomer.d.ts +2 -2
- package/dist/modals/CheckoutModal/VirtualFiatAccount/BridgeKyc.d.ts +1 -1
- package/dist/modals/CheckoutModal/VirtualFiatAccount/ErrorScreen.d.ts +1 -1
- package/dist/modals/CheckoutModal/VirtualFiatAccount/FiatAccountDetail.d.ts +1 -1
- package/dist/modals/CheckoutModal/VirtualFiatAccount/KycIframe.d.ts +2 -2
- package/dist/modals/CheckoutModal/VirtualFiatAccount/VirtualFiatAccount.d.ts +2 -2
- package/dist/modals/CheckoutModal/Withdrawal/WithdrawalComplete.d.ts +2 -2
- package/dist/modals/CheckoutModal/Withdrawal/WithdrawalEnterAmount.d.ts +2 -2
- package/dist/modals/CheckoutModal/stepTransition.d.ts +5 -5
- package/dist/modals/CheckoutModal/stepTransition.track.d.ts +2 -2
- package/dist/modals/ProfileDetails/FunProfileViews/Home/HomeCheckoutDisplayRow.d.ts +2 -2
- package/dist/modals/ProfileDetails/FunProfileViews/Home/HomeTokenDisplayRow.d.ts +1 -1
- package/dist/modals/ProfileDetails/FunProfileViews/Home/ProfileTitleSection.d.ts +2 -2
- package/dist/modals/ProfileDetails/FunProfileViews/Home/index.d.ts +1 -1
- package/dist/modals/WithdrawalModal/ErrorMessage.d.ts +2 -2
- package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +4 -4
- package/dist/modals/WithdrawalModal/RecipientAddress.d.ts +1 -1
- package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +1 -1
- package/dist/modals/WithdrawalModal/WithdrawalCallbackSuccess.d.ts +1 -1
- package/dist/modals/WithdrawalModal/WithdrawalContent.d.ts +1 -1
- package/dist/modals/WithdrawalModal/WithdrawalModal.d.ts +1 -1
- package/dist/modals/WithdrawalModal/WithdrawalTypeSelect.d.ts +1 -1
- package/dist/modals/WithdrawalModal/useWithdrawal.d.ts +3 -3
- package/dist/providers/FunkitBrokerageProvider.d.ts +2 -2
- package/dist/providers/FunkitCheckoutContext/index.d.ts +1 -1
- package/dist/providers/FunkitCheckoutContext/track.d.ts +4 -4
- package/dist/providers/FunkitConfigContext.d.ts +3 -3
- package/dist/providers/FunkitHistoryContext.d.ts +2 -2
- package/dist/providers/FunkitProvider.d.ts +2 -2
- package/dist/providers/FunkitQuoteContext.track.d.ts +4 -4
- package/dist/providers/GeneralWalletProvider.d.ts +2 -2
- package/dist/providers/QuoteModeContext.d.ts +1 -1
- package/dist/providers/SwappedProvider.d.ts +1 -1
- package/dist/utils/assets.d.ts +1 -1
- package/dist/utils/bluvo.d.ts +3 -3
- package/dist/utils/checkout.d.ts +3 -3
- package/dist/utils/depositCutoff.d.ts +1 -1
- package/dist/utils/flags/resolver.d.ts +34 -0
- package/dist/utils/funkitProvider.d.ts +1 -1
- package/dist/utils/payment.d.ts +1 -1
- package/dist/utils/polygonRpcCheck.d.ts +1 -1
- package/dist/utils/purifyCheckoutHistoryItem.d.ts +1 -1
- package/dist/utils/swapped.d.ts +1 -1
- package/dist/utils/withdrawal.d.ts +1 -1
- package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
- package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
- package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
- package/dist/wallets/walletConnectors/chunk-2VP2F6EK.js +70 -0
- package/dist/wallets/walletConnectors/chunk-4T6ZSRJF.js +69 -0
- package/dist/wallets/walletConnectors/chunk-6BW3HLBG.js +96 -0
- package/dist/wallets/walletConnectors/chunk-CCQV2ZET.js +218 -0
- package/dist/wallets/walletConnectors/chunk-CPI4TD43.js +99 -0
- package/dist/wallets/walletConnectors/chunk-F5XEEVG6.js +98 -0
- package/dist/wallets/walletConnectors/chunk-HNRB7KJU.js +92 -0
- package/dist/wallets/walletConnectors/chunk-HTHAK6XB.js +93 -0
- package/dist/wallets/walletConnectors/chunk-MIQTHJ6X.js +66 -0
- package/dist/wallets/walletConnectors/chunk-RB3HR4R2.js +95 -0
- package/dist/wallets/walletConnectors/chunk-RVOY537T.js +100 -0
- package/dist/wallets/walletConnectors/chunk-STVVP43G.js +94 -0
- package/dist/wallets/walletConnectors/chunk-UK7C2JXW.js +87 -0
- package/dist/wallets/walletConnectors/chunk-VAPGUPHO.js +92 -0
- package/dist/wallets/walletConnectors/chunk-VTM6EECM.js +110 -0
- package/dist/wallets/walletConnectors/chunk-X6CGV36L.js +103 -0
- package/dist/wallets/walletConnectors/chunk-YEZM4CK4.js +96 -0
- package/dist/wallets/walletConnectors/chunk-ZNX4EMPB.js +106 -0
- package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
- package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
- package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
- package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
- package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
- package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
- package/dist/wallets/walletConnectors/index.js +60 -60
- package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
- package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
- package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
- package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
- package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
- package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
- package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
- package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
- package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
- package/package.json +3 -3
- /package/dist/clients/{chunk-OG254LB3.js → chunk-7FIVHWNC.js} +0 -0
|
@@ -0,0 +1,688 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
logger
|
|
4
|
+
} from "./chunk-UUHGOBKZ.js";
|
|
5
|
+
|
|
6
|
+
// src/clients/polymarket.tsx
|
|
7
|
+
import {
|
|
8
|
+
POLYMARKET_API_KEY,
|
|
9
|
+
initializeCheckoutTokenTransferAddress
|
|
10
|
+
} from "@funkit/api-base";
|
|
11
|
+
import {
|
|
12
|
+
encodeFunctionData,
|
|
13
|
+
erc20Abi,
|
|
14
|
+
getAddress as getAddress2
|
|
15
|
+
} from "viem";
|
|
16
|
+
import { polygon } from "viem/chains";
|
|
17
|
+
|
|
18
|
+
// src/consts/polymarket.ts
|
|
19
|
+
import { getAddress } from "viem";
|
|
20
|
+
var POLYMARKET_PUSD_ADDRESS = getAddress(
|
|
21
|
+
"0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB"
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
// src/domains/paymentMethods.ts
|
|
25
|
+
import { PaymentMethod } from "@funkit/connect-core";
|
|
26
|
+
import { exhaustiveCheck, formatAddress } from "@funkit/utils";
|
|
27
|
+
|
|
28
|
+
// src/consts/bluvo.tsx
|
|
29
|
+
import {
|
|
30
|
+
ETHEREAL_API_KEY,
|
|
31
|
+
FormOfPaymentType
|
|
32
|
+
} from "@funkit/api-base";
|
|
33
|
+
import React7 from "react";
|
|
34
|
+
|
|
35
|
+
// src/components/Icons/BinanceIcon.tsx
|
|
36
|
+
import React from "react";
|
|
37
|
+
var BinanceIcon = ({ size = 24 }) => {
|
|
38
|
+
return /* @__PURE__ */ React.createElement(
|
|
39
|
+
"svg",
|
|
40
|
+
{
|
|
41
|
+
width: size,
|
|
42
|
+
height: size,
|
|
43
|
+
viewBox: "0 0 20 20",
|
|
44
|
+
fill: "none",
|
|
45
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
46
|
+
},
|
|
47
|
+
/* @__PURE__ */ React.createElement("rect", { width: "20", height: "20", rx: "4", fill: "#F3BA2F" }),
|
|
48
|
+
/* @__PURE__ */ React.createElement(
|
|
49
|
+
"path",
|
|
50
|
+
{
|
|
51
|
+
d: "M7.67 9.04 10 6.71l2.33 2.34 1.36-1.36L10 4 6.31 7.69zM4 10l1.36-1.36L6.7 10l-1.35 1.36zm3.67.96L10 13.29l2.33-2.33 1.36 1.35-3.69 3.7-3.69-3.7zm5.62-.96 1.35-1.35L16 10l-1.36 1.36z",
|
|
52
|
+
fill: "#fff"
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ React.createElement(
|
|
56
|
+
"path",
|
|
57
|
+
{
|
|
58
|
+
d: "M11.38 10 10 8.62 8.98 9.64l-.11.12-.25.24L10 11.38z",
|
|
59
|
+
fill: "#fff"
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// src/components/Icons/BybitIcon.tsx
|
|
66
|
+
import React2 from "react";
|
|
67
|
+
var BybitIcon = ({ size = 24 }) => {
|
|
68
|
+
return /* @__PURE__ */ React2.createElement(
|
|
69
|
+
"svg",
|
|
70
|
+
{
|
|
71
|
+
width: size,
|
|
72
|
+
height: size,
|
|
73
|
+
viewBox: "0 0 20 20",
|
|
74
|
+
fill: "none",
|
|
75
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
76
|
+
},
|
|
77
|
+
/* @__PURE__ */ React2.createElement("rect", { width: "20", height: "20", rx: "4", fill: "#0B0E11" }),
|
|
78
|
+
/* @__PURE__ */ React2.createElement("g", { transform: "translate(2 6.78) scale(0.184)" }, /* @__PURE__ */ React2.createElement("path", { d: "M62.0083 25.3572V3H66.5022V25.3572H62.0083Z", fill: "#F7A600" }), /* @__PURE__ */ React2.createElement(
|
|
79
|
+
"path",
|
|
80
|
+
{
|
|
81
|
+
d: "M9.63407 31.9983H0V9.64111H9.24666C13.7406 9.64111 16.3591 12.0903 16.3591 15.9214C16.3591 18.4013 14.6774 20.0039 13.5134 20.5375C14.9028 21.1652 16.6813 22.5779 16.6813 25.5624C16.6813 29.7373 13.7406 31.9983 9.63407 31.9983ZM8.89096 13.5355H4.4939V18.6852H8.89096C10.7981 18.6852 11.8652 17.6488 11.8652 16.1095C11.8652 14.5719 10.7981 13.5355 8.89096 13.5355ZM9.18151 22.6104H4.4939V28.1056H9.18151C11.2189 28.1056 12.1874 26.8503 12.1874 25.3418C12.1874 23.835 11.2171 22.6104 9.18151 22.6104Z",
|
|
82
|
+
fill: "white"
|
|
83
|
+
}
|
|
84
|
+
), /* @__PURE__ */ React2.createElement(
|
|
85
|
+
"path",
|
|
86
|
+
{
|
|
87
|
+
d: "M30.3882 22.8293V31.9983H25.926V22.8293L19.0073 9.64111H23.8886L28.1888 18.6527L32.4239 9.64111H37.3052L30.3882 22.8293Z",
|
|
88
|
+
fill: "white"
|
|
89
|
+
}
|
|
90
|
+
), /* @__PURE__ */ React2.createElement(
|
|
91
|
+
"path",
|
|
92
|
+
{
|
|
93
|
+
d: "M50.0457 31.9983H40.4116V9.64111H49.6583C54.1522 9.64111 56.7707 12.0903 56.7707 15.9214C56.7707 18.4013 55.089 20.0039 53.925 20.5375C55.3144 21.1652 57.093 22.5779 57.093 25.5624C57.093 29.7373 54.1522 31.9983 50.0457 31.9983ZM49.3026 13.5355H44.9055V18.6852H49.3026C51.2097 18.6852 52.2768 17.6488 52.2768 16.1095C52.2768 14.5719 51.2097 13.5355 49.3026 13.5355ZM49.5931 22.6104H44.9055V28.1056H49.5931C51.6305 28.1056 52.599 26.8503 52.599 25.3418C52.599 23.835 51.6305 22.6104 49.5931 22.6104Z",
|
|
94
|
+
fill: "white"
|
|
95
|
+
}
|
|
96
|
+
), /* @__PURE__ */ React2.createElement(
|
|
97
|
+
"path",
|
|
98
|
+
{
|
|
99
|
+
d: "M80.986 13.5355V32H76.4921V13.5355H70.4785V9.64111H86.9996V13.5355H80.986Z",
|
|
100
|
+
fill: "white"
|
|
101
|
+
}
|
|
102
|
+
))
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// src/components/Icons/CoinbaseIcon.tsx
|
|
107
|
+
import React3 from "react";
|
|
108
|
+
var CoinbaseIcon = ({ size = 24 }) => {
|
|
109
|
+
return /* @__PURE__ */ React3.createElement(
|
|
110
|
+
"svg",
|
|
111
|
+
{
|
|
112
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
113
|
+
width: size,
|
|
114
|
+
height: size,
|
|
115
|
+
viewBox: "0 0 20 20",
|
|
116
|
+
fill: "none"
|
|
117
|
+
},
|
|
118
|
+
/* @__PURE__ */ React3.createElement("rect", { width: "20", height: "20", rx: "4", fill: "#2C5FF6" }),
|
|
119
|
+
/* @__PURE__ */ React3.createElement(
|
|
120
|
+
"path",
|
|
121
|
+
{
|
|
122
|
+
d: "M9.99 13.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5c1.76 0 3.22 1.305 3.46 3h3.52A7.005 7.005 0 0 0 9.99 3c-3.86 0-7 3.14-7 7s3.14 7 7 7c3.69 0 6.725-2.87 6.98-6.5h-3.52c-.24 1.695-1.7 3-3.46 3Z",
|
|
123
|
+
fill: "#fff"
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// src/components/Icons/GateIoIcon.tsx
|
|
130
|
+
import React4 from "react";
|
|
131
|
+
var GateIoIcon = ({ size = 24 }) => {
|
|
132
|
+
return /* @__PURE__ */ React4.createElement(
|
|
133
|
+
"svg",
|
|
134
|
+
{
|
|
135
|
+
width: size,
|
|
136
|
+
height: size,
|
|
137
|
+
viewBox: "0 0 25 25",
|
|
138
|
+
fill: "none",
|
|
139
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
140
|
+
},
|
|
141
|
+
/* @__PURE__ */ React4.createElement("rect", { width: "25", height: "25", rx: "5.357", fill: "#fff" }),
|
|
142
|
+
/* @__PURE__ */ React4.createElement("g", { clipPath: "url(#a)" }, /* @__PURE__ */ React4.createElement(
|
|
143
|
+
"mask",
|
|
144
|
+
{
|
|
145
|
+
id: "b",
|
|
146
|
+
maskUnits: "userSpaceOnUse",
|
|
147
|
+
x: "5",
|
|
148
|
+
y: "5",
|
|
149
|
+
width: "15",
|
|
150
|
+
height: "15",
|
|
151
|
+
style: { maskType: "luminance" }
|
|
152
|
+
},
|
|
153
|
+
/* @__PURE__ */ React4.createElement("path", { d: "M5 5h15v15H5V5Z", fill: "#fff" })
|
|
154
|
+
), /* @__PURE__ */ React4.createElement("g", { mask: "url(#b)" }, /* @__PURE__ */ React4.createElement(
|
|
155
|
+
"path",
|
|
156
|
+
{
|
|
157
|
+
fillRule: "evenodd",
|
|
158
|
+
clipRule: "evenodd",
|
|
159
|
+
d: "M12.5 16.625a4.125 4.125 0 0 1 0-8.25V5a7.5 7.5 0 1 0 7.5 7.5h-3.375a4.125 4.125 0 0 1-4.125 4.125Z",
|
|
160
|
+
fill: "#2354E6"
|
|
161
|
+
}
|
|
162
|
+
)), /* @__PURE__ */ React4.createElement(
|
|
163
|
+
"path",
|
|
164
|
+
{
|
|
165
|
+
fillRule: "evenodd",
|
|
166
|
+
clipRule: "evenodd",
|
|
167
|
+
d: "M12.5 12.5h4.125V8.375H12.5V12.5Z",
|
|
168
|
+
fill: "#17E6A1"
|
|
169
|
+
}
|
|
170
|
+
)),
|
|
171
|
+
/* @__PURE__ */ React4.createElement("defs", null, /* @__PURE__ */ React4.createElement("clipPath", { id: "a" }, /* @__PURE__ */ React4.createElement("path", { fill: "#fff", transform: "translate(5 5)", d: "M0 0h15v15H0z" })))
|
|
172
|
+
);
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
// src/components/Icons/GeminiIcon.tsx
|
|
176
|
+
import React5 from "react";
|
|
177
|
+
var GeminiIcon = ({ size = 24 }) => {
|
|
178
|
+
return /* @__PURE__ */ React5.createElement(
|
|
179
|
+
"svg",
|
|
180
|
+
{
|
|
181
|
+
width: size,
|
|
182
|
+
height: size,
|
|
183
|
+
viewBox: "0 0 20 20",
|
|
184
|
+
fill: "none",
|
|
185
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
186
|
+
},
|
|
187
|
+
/* @__PURE__ */ React5.createElement(
|
|
188
|
+
"path",
|
|
189
|
+
{
|
|
190
|
+
d: "M16 0H4a4 4 0 0 0-4 4v12a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4V4a4 4 0 0 0-4-4",
|
|
191
|
+
fill: "#58C8E6"
|
|
192
|
+
}
|
|
193
|
+
),
|
|
194
|
+
/* @__PURE__ */ React5.createElement(
|
|
195
|
+
"path",
|
|
196
|
+
{
|
|
197
|
+
d: "M15.025 7.686H8.661a3.21 3.21 0 0 1 3.182-2.746 3.21 3.21 0 0 1 3.182 2.746m-3.653.94v2.746H8.626V8.626zm-.035 3.686a3.21 3.21 0 0 1-3.182 2.746 3.21 3.21 0 0 1-3.183-2.746zm-6.365-.94A3.23 3.23 0 0 1 7.686 8.66v2.71zm10.053-2.746a3.23 3.23 0 0 1-2.711 2.71v-2.71zM11.843 4C9.734 4 7.937 5.624 7.712 7.712A4.18 4.18 0 0 0 4 11.843 4.16 4.16 0 0 0 8.157 16c2.109 0 3.909-1.624 4.131-3.712C14.376 12.063 16 10.266 16 8.157A4.16 4.16 0 0 0 11.843 4",
|
|
198
|
+
fill: "#fff"
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
);
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
// src/components/Icons/KrakenIcon.tsx
|
|
205
|
+
import React6 from "react";
|
|
206
|
+
var KrakenIcon = ({ size = 24 }) => {
|
|
207
|
+
return /* @__PURE__ */ React6.createElement(
|
|
208
|
+
"svg",
|
|
209
|
+
{
|
|
210
|
+
width: size,
|
|
211
|
+
height: size,
|
|
212
|
+
viewBox: "0 0 20 20",
|
|
213
|
+
fill: "none",
|
|
214
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
215
|
+
},
|
|
216
|
+
/* @__PURE__ */ React6.createElement(
|
|
217
|
+
"path",
|
|
218
|
+
{
|
|
219
|
+
d: "M16 0H4a4 4 0 0 0-4 4v12a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4V4a4 4 0 0 0-4-4",
|
|
220
|
+
fill: "#5741D9"
|
|
221
|
+
}
|
|
222
|
+
),
|
|
223
|
+
/* @__PURE__ */ React6.createElement(
|
|
224
|
+
"path",
|
|
225
|
+
{
|
|
226
|
+
d: "M4 11.78v-.67a6.4 6.4 0 0 1 .83-3.26 6 6 0 0 1 2.64-2.3A6 6 0 0 1 9.89 5q1.84-.02 3.4.96a5.6 5.6 0 0 1 2.64 4.18q.1.9.07 1.82l-.01.98q0 .22-.05.43c-.15.54-.8.8-1.27.49a.8.8 0 0 1-.35-.57l-.04-.48v-1.98q0-.4-.26-.68a.83.83 0 0 0-1.17-.04 1 1 0 0 0-.32.65v.28l-.01 2.19c0 .41-.33.73-.76.76a1 1 0 0 1-.56-.17.8.8 0 0 1-.3-.48l-.03-.33v-2.2a1 1 0 0 0-.26-.65.84.84 0 0 0-1.25.02 1 1 0 0 0-.24.64V13q0 .28-.1.54a1 1 0 0 1-.32.34.8.8 0 0 1-1.17-.4 1 1 0 0 1-.07-.38V11q.01-.24-.05-.47a.9.9 0 0 0-.72-.62c-.37-.06-.65.11-.85.4q-.14.22-.14.46v2q.02.3-.04.59a.84.84 0 0 1-.87.63.9.9 0 0 1-.74-.63A1 1 0 0 1 4 13z",
|
|
227
|
+
fill: "#fff"
|
|
228
|
+
}
|
|
229
|
+
)
|
|
230
|
+
);
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
// src/consts/bluvo.tsx
|
|
234
|
+
var BLUVO_MIN_DEPOSIT_BY_CUSTOMER = {
|
|
235
|
+
[ETHEREAL_API_KEY]: 15
|
|
236
|
+
};
|
|
237
|
+
var BLUVO_EXCHANGES = {
|
|
238
|
+
coinbase: {
|
|
239
|
+
icon: (size) => /* @__PURE__ */ React7.createElement(CoinbaseIcon, { size }),
|
|
240
|
+
name: "Coinbase"
|
|
241
|
+
},
|
|
242
|
+
binance: {
|
|
243
|
+
icon: (size) => /* @__PURE__ */ React7.createElement(BinanceIcon, { size }),
|
|
244
|
+
name: "Binance"
|
|
245
|
+
},
|
|
246
|
+
gemini: {
|
|
247
|
+
icon: (size) => /* @__PURE__ */ React7.createElement(GeminiIcon, { size }),
|
|
248
|
+
name: "Gemini"
|
|
249
|
+
},
|
|
250
|
+
kraken: {
|
|
251
|
+
icon: (size) => /* @__PURE__ */ React7.createElement(KrakenIcon, { size }),
|
|
252
|
+
name: "Kraken"
|
|
253
|
+
},
|
|
254
|
+
gate: {
|
|
255
|
+
icon: (size) => /* @__PURE__ */ React7.createElement(GateIoIcon, { size }),
|
|
256
|
+
name: "Gate"
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
function getExchangeName(brokerType) {
|
|
260
|
+
return BLUVO_EXCHANGES[brokerType].name;
|
|
261
|
+
}
|
|
262
|
+
var FOP_COMPONENT_ICONS = {
|
|
263
|
+
[FormOfPaymentType.BYBIT]: (size) => /* @__PURE__ */ React7.createElement(BybitIcon, { size })
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
// src/domains/paymentMethods.ts
|
|
267
|
+
function createPaymentMethodInfo(params) {
|
|
268
|
+
switch (params.paymentMethod) {
|
|
269
|
+
case PaymentMethod.CARD:
|
|
270
|
+
return {
|
|
271
|
+
paymentMethod: PaymentMethod.CARD,
|
|
272
|
+
title: params.titleCustomization,
|
|
273
|
+
description: ""
|
|
274
|
+
};
|
|
275
|
+
case PaymentMethod.ACCOUNT_BALANCE:
|
|
276
|
+
return {
|
|
277
|
+
paymentMethod: PaymentMethod.ACCOUNT_BALANCE,
|
|
278
|
+
title: "Your Wallet",
|
|
279
|
+
description: formatAddress(params.walletAddress || "")
|
|
280
|
+
};
|
|
281
|
+
case PaymentMethod.BROKERAGE:
|
|
282
|
+
return {
|
|
283
|
+
paymentMethod: PaymentMethod.BROKERAGE,
|
|
284
|
+
title: getExchangeName(params.exchange),
|
|
285
|
+
description: "",
|
|
286
|
+
deviceId: params.deviceId,
|
|
287
|
+
exchange: params.exchange
|
|
288
|
+
};
|
|
289
|
+
case PaymentMethod.TOKEN_TRANSFER:
|
|
290
|
+
return {
|
|
291
|
+
// this is an arbitrary value for Polymarket.
|
|
292
|
+
paymentMethod: PaymentMethod.TOKEN_TRANSFER,
|
|
293
|
+
title: "QR Code Transfer",
|
|
294
|
+
description: ""
|
|
295
|
+
};
|
|
296
|
+
case PaymentMethod.BITCOIN_LIGHTNING:
|
|
297
|
+
return {
|
|
298
|
+
paymentMethod: PaymentMethod.BITCOIN_LIGHTNING,
|
|
299
|
+
title: "Bitcoin on Cash App",
|
|
300
|
+
description: ""
|
|
301
|
+
};
|
|
302
|
+
case PaymentMethod.VIRTUAL_BANK:
|
|
303
|
+
return {
|
|
304
|
+
paymentMethod: PaymentMethod.VIRTUAL_BANK,
|
|
305
|
+
title: "Fiat Account",
|
|
306
|
+
description: "",
|
|
307
|
+
matchingFiatAccount: params.matchingFiatAccount,
|
|
308
|
+
bridgeCustomer: params.bridgeCustomer
|
|
309
|
+
};
|
|
310
|
+
default:
|
|
311
|
+
exhaustiveCheck(params);
|
|
312
|
+
return {};
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// src/domains/clientMetadata.ts
|
|
317
|
+
function generateClientMetadataForTokenTransfer() {
|
|
318
|
+
return {
|
|
319
|
+
id: "",
|
|
320
|
+
startTimestampMs: 0,
|
|
321
|
+
finalDollarValue: 0,
|
|
322
|
+
latestQuote: null,
|
|
323
|
+
depositAddress: null,
|
|
324
|
+
initSettings: {
|
|
325
|
+
config: {
|
|
326
|
+
targetAsset: "0x",
|
|
327
|
+
targetChain: "",
|
|
328
|
+
targetAssetTicker: "",
|
|
329
|
+
checkoutItemTitle: ""
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
selectedSourceAssetInfo: {
|
|
333
|
+
address: "0x",
|
|
334
|
+
symbol: "",
|
|
335
|
+
chainId: "",
|
|
336
|
+
iconSrc: null
|
|
337
|
+
},
|
|
338
|
+
selectedPaymentMethodInfo: createPaymentMethodInfo({
|
|
339
|
+
paymentMethod: PaymentMethod.TOKEN_TRANSFER
|
|
340
|
+
})
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// src/utils/statsig/checkFeatureGate.ts
|
|
345
|
+
import { defaultFeatureGates as fallbackFeatureGates } from "@funkit/connect-core";
|
|
346
|
+
import { StatsigClient } from "@statsig/react-bindings";
|
|
347
|
+
|
|
348
|
+
// src/providers/FunkitStatsigProvider.tsx
|
|
349
|
+
import { datadogLogs } from "@datadog/browser-logs";
|
|
350
|
+
import {
|
|
351
|
+
LogEventCompressionMode,
|
|
352
|
+
LogLevel,
|
|
353
|
+
StatsigProvider,
|
|
354
|
+
useClientAsyncInit
|
|
355
|
+
} from "@statsig/react-bindings";
|
|
356
|
+
import React8, { useEffect } from "react";
|
|
357
|
+
var STATSIG_CLIENT_KEY = "client-UmFd8WIJljA7cLmZuDqs3X25M8sKd5WIQP4BSC2bRbM";
|
|
358
|
+
|
|
359
|
+
// src/utils/statsig/checkFeatureGate.ts
|
|
360
|
+
function checkFeatureGate(name) {
|
|
361
|
+
try {
|
|
362
|
+
return StatsigClient.instance(STATSIG_CLIENT_KEY).checkGate(name);
|
|
363
|
+
} catch (err) {
|
|
364
|
+
logger.warn("checkFeatureGate:error", { name, err });
|
|
365
|
+
return fallbackFeatureGates[name];
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// src/clients/polymarket.tsx
|
|
370
|
+
var PMCT_WITHDRAW_ACTION_TYPE = "PMCT_WITHDRAW";
|
|
371
|
+
var POLYGON_USDCE = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174";
|
|
372
|
+
var PUSD_TOKEN = {
|
|
373
|
+
address: POLYMARKET_PUSD_ADDRESS,
|
|
374
|
+
symbol: "pUSD",
|
|
375
|
+
iconSrc: "https://sdk-cdn.fun.xyz/images/pusd.svg"
|
|
376
|
+
};
|
|
377
|
+
var PUSD_OFFRAMP_ADDRESS = "0x2957922Eb93258b93368531d39fAcCA3B4dC5854";
|
|
378
|
+
var PUSD_OFFRAMP_ABI = [
|
|
379
|
+
{
|
|
380
|
+
name: "unwrap",
|
|
381
|
+
type: "function",
|
|
382
|
+
inputs: [
|
|
383
|
+
{ name: "_asset", type: "address" },
|
|
384
|
+
{ name: "_to", type: "address" },
|
|
385
|
+
{ name: "_amount", type: "uint256" }
|
|
386
|
+
],
|
|
387
|
+
outputs: [],
|
|
388
|
+
stateMutability: "nonpayable"
|
|
389
|
+
}
|
|
390
|
+
];
|
|
391
|
+
function createPolymarketWithdrawalCallback(config) {
|
|
392
|
+
const { userId, sendPmctTransfer } = config;
|
|
393
|
+
return async (param) => {
|
|
394
|
+
const { targetAssetAddress, targetChainId, destinationAddress, funQuote } = param;
|
|
395
|
+
logger.info("polymarket:withdrawal:start", {
|
|
396
|
+
targetChainId,
|
|
397
|
+
targetAssetAddress,
|
|
398
|
+
destinationAddress,
|
|
399
|
+
quoteId: param.quoteId
|
|
400
|
+
});
|
|
401
|
+
const transferInit = await initializeCheckoutTokenTransferAddress({
|
|
402
|
+
apiKey: POLYMARKET_API_KEY,
|
|
403
|
+
userId,
|
|
404
|
+
recipientAddr: destinationAddress,
|
|
405
|
+
toChainId: targetChainId.toString(),
|
|
406
|
+
toTokenAddress: targetAssetAddress,
|
|
407
|
+
logger,
|
|
408
|
+
clientMetadata: {
|
|
409
|
+
...generateClientMetadataForTokenTransfer(),
|
|
410
|
+
isWithdrawal: true
|
|
411
|
+
},
|
|
412
|
+
actionType: PMCT_WITHDRAW_ACTION_TYPE
|
|
413
|
+
});
|
|
414
|
+
const udaAddress = transferInit.depositAddr;
|
|
415
|
+
logger.info("polymarket:withdrawal:udaGenerated", { udaAddress });
|
|
416
|
+
const amountBaseUnit = extractWithdrawalAmount(funQuote);
|
|
417
|
+
await sendPmctTransfer({
|
|
418
|
+
udaAddress,
|
|
419
|
+
amountBaseUnit
|
|
420
|
+
});
|
|
421
|
+
logger.info("polymarket:withdrawal:transferSubmitted", {
|
|
422
|
+
udaAddress,
|
|
423
|
+
amountBaseUnit: amountBaseUnit.toString()
|
|
424
|
+
});
|
|
425
|
+
return void 0;
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
function buildUdaWithdrawalConfig(config) {
|
|
429
|
+
logger.info("polymarket:withdrawal:flow", { flow: "uda" });
|
|
430
|
+
return {
|
|
431
|
+
modalTitle: config.modalTitle ?? "Withdraw",
|
|
432
|
+
disableConnectedWallet: config.disableConnectedWallet,
|
|
433
|
+
withdrawCallback: createPolymarketWithdrawalCallback(config),
|
|
434
|
+
sourceChainId: polygon.id.toString(),
|
|
435
|
+
sourceTokenSymbol: config.sourceTokenSymbol ?? "USDC",
|
|
436
|
+
defaultReceiveToken: config.defaultReceiveToken ?? "USDC",
|
|
437
|
+
sourceTokenAddress: config.sourceTokenAddress ?? POLYGON_USDCE,
|
|
438
|
+
iconSrc: config.iconSrc ?? "https://sdk-cdn.fun.xyz/images/usdc.svg",
|
|
439
|
+
getMinWithdrawalUSD: () => 3
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
function buildWalletUnwrapWithdrawalConfig(config) {
|
|
443
|
+
logger.info("polymarket:withdrawal:flow", { flow: "wallet-unwrap" });
|
|
444
|
+
const {
|
|
445
|
+
proxyAddress,
|
|
446
|
+
publicClient,
|
|
447
|
+
sendTransactions: callerSendTransactions,
|
|
448
|
+
confirmTransaction
|
|
449
|
+
} = config;
|
|
450
|
+
const wallet = {
|
|
451
|
+
address: () => proxyAddress,
|
|
452
|
+
getChainId: async () => polygon.id,
|
|
453
|
+
switchChain: async (chainId) => {
|
|
454
|
+
if (chainId !== polygon.id) {
|
|
455
|
+
throw new Error(
|
|
456
|
+
`Cannot switch chain: Polymarket withdrawal is fixed to ${polygon.id}, requested ${chainId}`
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
},
|
|
460
|
+
sendTransaction: async (_chainId, transaction) => callerSendTransactions([transaction]),
|
|
461
|
+
sendTransactions: async (_chainId, txs) => callerSendTransactions(txs),
|
|
462
|
+
confirmTransaction: confirmTransaction ?? (async (txHash) => publicClient.waitForTransactionReceipt({ hash: txHash }))
|
|
463
|
+
};
|
|
464
|
+
const preWithdrawalAction = async ({
|
|
465
|
+
funQuote
|
|
466
|
+
}) => {
|
|
467
|
+
logger.info("polymarket:withdrawal:wallet:start", { proxyAddress });
|
|
468
|
+
try {
|
|
469
|
+
const amountBaseUnit = extractWithdrawalAmount(funQuote);
|
|
470
|
+
const currentAllowance = await publicClient.readContract({
|
|
471
|
+
address: PUSD_TOKEN.address,
|
|
472
|
+
abi: erc20Abi,
|
|
473
|
+
functionName: "allowance",
|
|
474
|
+
args: [proxyAddress, PUSD_OFFRAMP_ADDRESS]
|
|
475
|
+
});
|
|
476
|
+
const needsApprovalTx = currentAllowance < amountBaseUnit;
|
|
477
|
+
logger.info("polymarket:withdrawal:wallet:allowanceChecked", {
|
|
478
|
+
proxyAddress,
|
|
479
|
+
amountBaseUnit: amountBaseUnit.toString(),
|
|
480
|
+
currentAllowance: currentAllowance.toString(),
|
|
481
|
+
needsApprovalTx
|
|
482
|
+
});
|
|
483
|
+
const txs = [];
|
|
484
|
+
if (needsApprovalTx) {
|
|
485
|
+
txs.push({
|
|
486
|
+
to: PUSD_TOKEN.address,
|
|
487
|
+
data: encodeFunctionData({
|
|
488
|
+
abi: erc20Abi,
|
|
489
|
+
functionName: "approve",
|
|
490
|
+
args: [PUSD_OFFRAMP_ADDRESS, amountBaseUnit]
|
|
491
|
+
}),
|
|
492
|
+
value: "0"
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
txs.push({
|
|
496
|
+
to: PUSD_OFFRAMP_ADDRESS,
|
|
497
|
+
data: encodeFunctionData({
|
|
498
|
+
abi: PUSD_OFFRAMP_ABI,
|
|
499
|
+
functionName: "unwrap",
|
|
500
|
+
args: [POLYGON_USDCE, proxyAddress, amountBaseUnit]
|
|
501
|
+
}),
|
|
502
|
+
value: "0"
|
|
503
|
+
});
|
|
504
|
+
logger.info("polymarket:withdrawal:wallet:txsStaged", {
|
|
505
|
+
proxyAddress,
|
|
506
|
+
txCount: txs.length,
|
|
507
|
+
needsApprovalTx
|
|
508
|
+
});
|
|
509
|
+
return txs;
|
|
510
|
+
} catch (err) {
|
|
511
|
+
logger.error("polymarket:withdrawal:wallet:error", err, {
|
|
512
|
+
phase: "preWithdrawal",
|
|
513
|
+
proxyAddress
|
|
514
|
+
});
|
|
515
|
+
throw err;
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
return {
|
|
519
|
+
modalTitle: config.modalTitle ?? "Withdraw",
|
|
520
|
+
disableConnectedWallet: config.disableConnectedWallet,
|
|
521
|
+
sourceChainId: polygon.id.toString(),
|
|
522
|
+
sourceTokenSymbol: config.sourceTokenSymbol ?? PUSD_TOKEN.symbol,
|
|
523
|
+
sourceTokenAddress: config.sourceTokenAddress ?? POLYGON_USDCE,
|
|
524
|
+
defaultReceiveToken: config.defaultReceiveToken ?? "USDC",
|
|
525
|
+
iconSrc: config.iconSrc ?? PUSD_TOKEN.iconSrc,
|
|
526
|
+
getMinWithdrawalUSD: () => 0,
|
|
527
|
+
wallet,
|
|
528
|
+
preWithdrawalAction
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
function extractWithdrawalAmount(funQuote) {
|
|
532
|
+
const quote = funQuote;
|
|
533
|
+
const amountStr = quote?.baseQuote?.estTotalFromAmountBaseUnit;
|
|
534
|
+
if (!amountStr) {
|
|
535
|
+
logger.error("polymarket:withdrawal:missingAmountInQuote", { quote });
|
|
536
|
+
throw new Error("Missing withdrawal amount in quote");
|
|
537
|
+
}
|
|
538
|
+
return BigInt(amountStr);
|
|
539
|
+
}
|
|
540
|
+
function createPolymarketWithdrawalConfig(config) {
|
|
541
|
+
if ("sendPmctTransfer" in config && "sendTransactions" in config) {
|
|
542
|
+
const walletUnwrapEnabled = checkFeatureGate(
|
|
543
|
+
"enable-polymarket-wallet-withdrawal"
|
|
544
|
+
);
|
|
545
|
+
logger.info("polymarket:withdrawal:gate", { walletUnwrapEnabled });
|
|
546
|
+
return walletUnwrapEnabled ? buildWalletUnwrapWithdrawalConfig(config) : buildUdaWithdrawalConfig(config);
|
|
547
|
+
}
|
|
548
|
+
return "sendPmctTransfer" in config ? buildUdaWithdrawalConfig(config) : buildWalletUnwrapWithdrawalConfig(config);
|
|
549
|
+
}
|
|
550
|
+
var COLLATERAL_ONRAMP_ADDRESS = "0x93070a847efEf7F70739046A929D47a521F5B8ee";
|
|
551
|
+
var COLLATERAL_ONRAMP_ABI = [
|
|
552
|
+
{
|
|
553
|
+
name: "wrap",
|
|
554
|
+
type: "function",
|
|
555
|
+
inputs: [
|
|
556
|
+
{ name: "_asset", type: "address" },
|
|
557
|
+
{ name: "_to", type: "address" },
|
|
558
|
+
{ name: "_amount", type: "uint256" }
|
|
559
|
+
],
|
|
560
|
+
outputs: [],
|
|
561
|
+
stateMutability: "nonpayable"
|
|
562
|
+
}
|
|
563
|
+
];
|
|
564
|
+
var POLYMARKET_PERPS_ADDRESS = "0xdca4af75705dbb50f62437045aff9921947917d2";
|
|
565
|
+
var POLYMARKET_PERPS_ABI = [
|
|
566
|
+
{
|
|
567
|
+
name: "deposit",
|
|
568
|
+
type: "function",
|
|
569
|
+
stateMutability: "nonpayable",
|
|
570
|
+
inputs: [
|
|
571
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
572
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
573
|
+
{ internalType: "address", name: "to", type: "address" }
|
|
574
|
+
],
|
|
575
|
+
outputs: []
|
|
576
|
+
}
|
|
577
|
+
];
|
|
578
|
+
var VAULT_DEPOSITOR_POLYGON = getAddress2(
|
|
579
|
+
"0xC8A6871D4eC4DaE64f605db0f8a0B3D9ef928D64"
|
|
580
|
+
);
|
|
581
|
+
var VAULT_DEPOSITOR_ABI = [
|
|
582
|
+
{
|
|
583
|
+
name: "deposit",
|
|
584
|
+
type: "function",
|
|
585
|
+
stateMutability: "nonpayable",
|
|
586
|
+
inputs: [
|
|
587
|
+
{ name: "token", type: "address" },
|
|
588
|
+
{ name: "vault", type: "address" },
|
|
589
|
+
{ name: "callData", type: "bytes" },
|
|
590
|
+
{ name: "minAmountOut", type: "uint256" }
|
|
591
|
+
],
|
|
592
|
+
outputs: [{ name: "returnData", type: "bytes" }]
|
|
593
|
+
}
|
|
594
|
+
];
|
|
595
|
+
var RELAY_ROUTER_V3_ADDRESS = getAddress2(
|
|
596
|
+
"0xb92fe925DC43a0ECdE6c8b1a2709c170Ec4fFf4f"
|
|
597
|
+
);
|
|
598
|
+
var RELAY_ROUTER_V3_ABI = [
|
|
599
|
+
{
|
|
600
|
+
inputs: [
|
|
601
|
+
{ internalType: "address[]", name: "tokens", type: "address[]" },
|
|
602
|
+
{ internalType: "address[]", name: "tos", type: "address[]" },
|
|
603
|
+
{ internalType: "bytes[]", name: "datas", type: "bytes[]" },
|
|
604
|
+
{ internalType: "uint256[]", name: "amounts", type: "uint256[]" }
|
|
605
|
+
],
|
|
606
|
+
name: "cleanupErc20sViaCall",
|
|
607
|
+
outputs: [],
|
|
608
|
+
stateMutability: "nonpayable",
|
|
609
|
+
type: "function"
|
|
610
|
+
}
|
|
611
|
+
];
|
|
612
|
+
var AMOUNT_PLACEHOLDER = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffdeadbeefn;
|
|
613
|
+
function createPerpsGenerateActionParams(config) {
|
|
614
|
+
const { recipientAddress } = config;
|
|
615
|
+
return async () => {
|
|
616
|
+
const wrapUsdceToPusd = encodeFunctionData({
|
|
617
|
+
abi: COLLATERAL_ONRAMP_ABI,
|
|
618
|
+
functionName: "wrap",
|
|
619
|
+
args: [POLYGON_USDCE, RELAY_ROUTER_V3_ADDRESS, AMOUNT_PLACEHOLDER]
|
|
620
|
+
});
|
|
621
|
+
const wrapUsdceToPusdViaVaultDepositor = encodeFunctionData({
|
|
622
|
+
abi: VAULT_DEPOSITOR_ABI,
|
|
623
|
+
functionName: "deposit",
|
|
624
|
+
args: [POLYGON_USDCE, COLLATERAL_ONRAMP_ADDRESS, wrapUsdceToPusd, 0n]
|
|
625
|
+
});
|
|
626
|
+
const depositPusdToPerps = encodeFunctionData({
|
|
627
|
+
abi: POLYMARKET_PERPS_ABI,
|
|
628
|
+
functionName: "deposit",
|
|
629
|
+
args: [PUSD_TOKEN.address, AMOUNT_PLACEHOLDER, recipientAddress]
|
|
630
|
+
});
|
|
631
|
+
const depositPusdToPerpsViaVaultDepositor = encodeFunctionData({
|
|
632
|
+
abi: VAULT_DEPOSITOR_ABI,
|
|
633
|
+
functionName: "deposit",
|
|
634
|
+
args: [
|
|
635
|
+
PUSD_TOKEN.address,
|
|
636
|
+
POLYMARKET_PERPS_ADDRESS,
|
|
637
|
+
depositPusdToPerps,
|
|
638
|
+
0n
|
|
639
|
+
]
|
|
640
|
+
});
|
|
641
|
+
const legs = [
|
|
642
|
+
// Leg 1 — sweep the bridged USDC.e and wrap it into pUSD.
|
|
643
|
+
{
|
|
644
|
+
token: POLYGON_USDCE,
|
|
645
|
+
to: VAULT_DEPOSITOR_POLYGON,
|
|
646
|
+
data: wrapUsdceToPusdViaVaultDepositor,
|
|
647
|
+
// relay replaces this with the actual amount of tokens available at execution time https://github.com/relayprotocol/relay-periphery/blob/0e4aabb750efb1f807d7f12b83b090b51b9ee736/src/v3/RelayRouterV3.sol#L177-L180
|
|
648
|
+
amount: 0n
|
|
649
|
+
},
|
|
650
|
+
// Leg 2 — sweep the resulting pUSD and deposit it into Polymarket Perps
|
|
651
|
+
// for the recipient.
|
|
652
|
+
{
|
|
653
|
+
token: PUSD_TOKEN.address,
|
|
654
|
+
to: VAULT_DEPOSITOR_POLYGON,
|
|
655
|
+
data: depositPusdToPerpsViaVaultDepositor,
|
|
656
|
+
// relay replaces this with the actual amount of tokens available at execution time https://github.com/relayprotocol/relay-periphery/blob/0e4aabb750efb1f807d7f12b83b090b51b9ee736/src/v3/RelayRouterV3.sol#L177-L180
|
|
657
|
+
amount: 0n
|
|
658
|
+
}
|
|
659
|
+
];
|
|
660
|
+
return [
|
|
661
|
+
// RelayRouterV3 calls its function `cleanupErc20sViaCall`
|
|
662
|
+
// that iterates over the legs and does the following for each leg:
|
|
663
|
+
// 1. Substitutes 0n with the actual amount of tokens available at execution time (https://github.com/relayprotocol/relay-periphery/blob/0e4aabb750efb1f807d7f12b83b090b51b9ee736/src/v3/RelayRouterV3.sol#L177-L180):
|
|
664
|
+
// `IERC20(token).balanceOf(address(this))`
|
|
665
|
+
// 2. Approves the token to the target address (https://github.com/relayprotocol/relay-periphery/blob/0e4aabb750efb1f807d7f12b83b090b51b9ee736/src/v3/RelayRouterV3.sol#L183-L184):
|
|
666
|
+
// `IERC20(token).approve(to, amount)`
|
|
667
|
+
// 3. Makes the call to the target address and bubles up the revert if it fails (https://github.com/relayprotocol/relay-periphery/blob/0e4aabb750efb1f807d7f12b83b090b51b9ee736/src/v3/RelayRouterV3.sol#L186-L190):
|
|
668
|
+
// `(bool success, ) = to.call(data);
|
|
669
|
+
// `if (!success) { revert CallFailed(); }`
|
|
670
|
+
{
|
|
671
|
+
contractAbi: RELAY_ROUTER_V3_ABI,
|
|
672
|
+
contractAddress: RELAY_ROUTER_V3_ADDRESS,
|
|
673
|
+
functionName: "cleanupErc20sViaCall",
|
|
674
|
+
// cleanupErc20sViaCall takes parallel arrays — transpose the per-leg rows.
|
|
675
|
+
functionArgs: [
|
|
676
|
+
legs.map((leg) => leg.token),
|
|
677
|
+
legs.map((leg) => leg.to),
|
|
678
|
+
legs.map((leg) => leg.data),
|
|
679
|
+
legs.map((leg) => leg.amount)
|
|
680
|
+
]
|
|
681
|
+
}
|
|
682
|
+
];
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
export {
|
|
686
|
+
createPerpsGenerateActionParams,
|
|
687
|
+
createPolymarketWithdrawalConfig
|
|
688
|
+
};
|
package/dist/clients/rolly.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* known at quote time.
|
|
13
13
|
*/
|
|
14
14
|
import { type Address } from 'viem';
|
|
15
|
-
import type { FunkitCheckoutActionParams } from '
|
|
15
|
+
import type { FunkitCheckoutActionParams } from '~/providers/FunkitCheckoutContext/types';
|
|
16
16
|
/** Rolly rollup deposit contract on Arbitrum (UUPS proxy). */
|
|
17
17
|
export declare const ROLLY_VAULT_ADDRESS: `0x${string}`;
|
|
18
18
|
/** Arbitrum USDT0 — Rolly's source deposit token. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ApprovalMethod } from '
|
|
2
|
+
import type { ApprovalMethod } from '~/providers/FunkitQuoteContext';
|
|
3
3
|
interface ApprovalMethodToggleProps {
|
|
4
4
|
value: ApprovalMethod;
|
|
5
5
|
onChange: (next: ApprovalMethod) => void;
|