@funkit/connect 9.14.0 → 9.15.1
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 +41 -0
- package/dist/__generated__/default_configs.d.ts +5 -11
- package/dist/__generated__/default_feature_gates.d.ts +3 -2
- package/dist/clients/aave.d.ts +92 -0
- package/dist/clients/aave.js +156 -0
- package/dist/clients/{chunk-LMEQD56M.js → chunk-PLDXBAAH.js} +2 -1
- package/dist/clients/fanatics.js +1 -1
- package/dist/clients/lighter.d.ts +33 -2
- package/dist/clients/lighter.js +121 -2
- package/dist/clients/polymarket.d.ts +30 -1
- package/dist/clients/polymarket.js +147 -4
- package/dist/components/CopyAddress/CopyInputDisplayedAddress.css.d.ts +1 -0
- package/dist/components/CopyAddress/CopyInputDisplayedAddress.d.ts +6 -0
- package/dist/components/FreeUsdcBanner/FreeUsdcBanner.d.ts +5 -0
- package/dist/consts/polymarket.d.ts +7 -0
- package/dist/domains/quote.d.ts +11 -0
- package/dist/index.css +12 -5
- package/dist/index.js +828 -516
- package/dist/modals/CheckoutModal/InputAmount/InputAmount.d.ts +4 -0
- package/dist/modals/CheckoutModal/InputAmount/aaveClient.d.ts +20 -0
- package/dist/modals/CheckoutModal/InputAmount/useAaveNativeSupply.d.ts +44 -0
- package/dist/modals/WithdrawalModal/WithdrawalSuccess.d.ts +0 -1
- package/dist/modals/WithdrawalModal/useWithdrawal.d.ts +1 -2
- package/dist/providers/FunkitCheckoutContext/index.d.ts +8 -0
- package/dist/providers/FunkitCheckoutContext/types.d.ts +6 -0
- package/dist/wagmi/actions.d.ts +1 -1
- package/dist/wallets/walletConnectors/index.js +39 -39
- package/package.json +10 -5
|
@@ -11,10 +11,16 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
encodeFunctionData,
|
|
13
13
|
erc20Abi,
|
|
14
|
-
getAddress
|
|
14
|
+
getAddress as getAddress2
|
|
15
15
|
} from "viem";
|
|
16
16
|
import { polygon } from "viem/chains";
|
|
17
17
|
|
|
18
|
+
// src/consts/polymarket.ts
|
|
19
|
+
import { getAddress } from "viem";
|
|
20
|
+
var POLYMARKET_PUSD_ADDRESS = getAddress(
|
|
21
|
+
"0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB"
|
|
22
|
+
);
|
|
23
|
+
|
|
18
24
|
// src/domains/paymentMethods.ts
|
|
19
25
|
import { exhaustiveCheck, formatAddress } from "@funkit/utils";
|
|
20
26
|
|
|
@@ -352,7 +358,9 @@ var STATSIG_CLIENT_KEY = "client-UmFd8WIJljA7cLmZuDqs3X25M8sKd5WIQP4BSC2bRbM";
|
|
|
352
358
|
var default_feature_gates_default = {
|
|
353
359
|
"compliance-review-blocker": false,
|
|
354
360
|
"enable-across-wallet-flow": false,
|
|
361
|
+
"enable-add-token-to-wallet": false,
|
|
355
362
|
"enable-empty-withdrawal-selection": false,
|
|
363
|
+
"enable-free-usdc-banner": false,
|
|
356
364
|
"enable-permit-toggle": false,
|
|
357
365
|
"enable-polymarket-wallet-withdrawal": false,
|
|
358
366
|
"enable-swapped-exchanges": false,
|
|
@@ -360,9 +368,8 @@ var default_feature_gates_default = {
|
|
|
360
368
|
"faster-notifications": false,
|
|
361
369
|
"new-token-transfer-config": false,
|
|
362
370
|
"new-withdrawal-config": false,
|
|
363
|
-
"polymarket-pusd-migration": false,
|
|
364
371
|
"saved-card-defaults-to-fiat-tab": false,
|
|
365
|
-
"test-
|
|
372
|
+
"test-feature-gate": false,
|
|
366
373
|
"wallet-flow-enable-exact-input-with-actions": false,
|
|
367
374
|
"you-receive-remove-swap-impact": false
|
|
368
375
|
};
|
|
@@ -381,7 +388,7 @@ function checkFeatureGate(name) {
|
|
|
381
388
|
var PMCT_WITHDRAW_ACTION_TYPE = "PMCT_WITHDRAW";
|
|
382
389
|
var POLYGON_USDCE = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174";
|
|
383
390
|
var PUSD_TOKEN = {
|
|
384
|
-
address:
|
|
391
|
+
address: POLYMARKET_PUSD_ADDRESS,
|
|
385
392
|
symbol: "pUSD",
|
|
386
393
|
iconSrc: "https://sdk-cdn.fun.xyz/images/pusd.svg"
|
|
387
394
|
};
|
|
@@ -558,6 +565,142 @@ function createPolymarketWithdrawalConfig(config) {
|
|
|
558
565
|
}
|
|
559
566
|
return "sendPmctTransfer" in config ? buildUdaWithdrawalConfig(config) : buildWalletUnwrapWithdrawalConfig(config);
|
|
560
567
|
}
|
|
568
|
+
var COLLATERAL_ONRAMP_ADDRESS = "0x93070a847efEf7F70739046A929D47a521F5B8ee";
|
|
569
|
+
var COLLATERAL_ONRAMP_ABI = [
|
|
570
|
+
{
|
|
571
|
+
name: "wrap",
|
|
572
|
+
type: "function",
|
|
573
|
+
inputs: [
|
|
574
|
+
{ name: "_asset", type: "address" },
|
|
575
|
+
{ name: "_to", type: "address" },
|
|
576
|
+
{ name: "_amount", type: "uint256" }
|
|
577
|
+
],
|
|
578
|
+
outputs: [],
|
|
579
|
+
stateMutability: "nonpayable"
|
|
580
|
+
}
|
|
581
|
+
];
|
|
582
|
+
var POLYMARKET_PERPS_ADDRESS = "0xdca4af75705dbb50f62437045aff9921947917d2";
|
|
583
|
+
var POLYMARKET_PERPS_ABI = [
|
|
584
|
+
{
|
|
585
|
+
name: "deposit",
|
|
586
|
+
type: "function",
|
|
587
|
+
stateMutability: "nonpayable",
|
|
588
|
+
inputs: [
|
|
589
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
590
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
591
|
+
{ internalType: "address", name: "to", type: "address" }
|
|
592
|
+
],
|
|
593
|
+
outputs: []
|
|
594
|
+
}
|
|
595
|
+
];
|
|
596
|
+
var VAULT_DEPOSITOR_POLYGON = getAddress2(
|
|
597
|
+
"0xC8A6871D4eC4DaE64f605db0f8a0B3D9ef928D64"
|
|
598
|
+
);
|
|
599
|
+
var VAULT_DEPOSITOR_ABI = [
|
|
600
|
+
{
|
|
601
|
+
name: "deposit",
|
|
602
|
+
type: "function",
|
|
603
|
+
stateMutability: "nonpayable",
|
|
604
|
+
inputs: [
|
|
605
|
+
{ name: "token", type: "address" },
|
|
606
|
+
{ name: "vault", type: "address" },
|
|
607
|
+
{ name: "callData", type: "bytes" },
|
|
608
|
+
{ name: "minAmountOut", type: "uint256" }
|
|
609
|
+
],
|
|
610
|
+
outputs: [{ name: "returnData", type: "bytes" }]
|
|
611
|
+
}
|
|
612
|
+
];
|
|
613
|
+
var RELAY_ROUTER_V3_ADDRESS = getAddress2(
|
|
614
|
+
"0xb92fe925DC43a0ECdE6c8b1a2709c170Ec4fFf4f"
|
|
615
|
+
);
|
|
616
|
+
var RELAY_ROUTER_V3_ABI = [
|
|
617
|
+
{
|
|
618
|
+
inputs: [
|
|
619
|
+
{ internalType: "address[]", name: "tokens", type: "address[]" },
|
|
620
|
+
{ internalType: "address[]", name: "tos", type: "address[]" },
|
|
621
|
+
{ internalType: "bytes[]", name: "datas", type: "bytes[]" },
|
|
622
|
+
{ internalType: "uint256[]", name: "amounts", type: "uint256[]" }
|
|
623
|
+
],
|
|
624
|
+
name: "cleanupErc20sViaCall",
|
|
625
|
+
outputs: [],
|
|
626
|
+
stateMutability: "nonpayable",
|
|
627
|
+
type: "function"
|
|
628
|
+
}
|
|
629
|
+
];
|
|
630
|
+
var AMOUNT_PLACEHOLDER = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffdeadbeefn;
|
|
631
|
+
function createPerpsGenerateActionParams(config) {
|
|
632
|
+
const { recipientAddress } = config;
|
|
633
|
+
return async () => {
|
|
634
|
+
const wrapUsdceToPusd = encodeFunctionData({
|
|
635
|
+
abi: COLLATERAL_ONRAMP_ABI,
|
|
636
|
+
functionName: "wrap",
|
|
637
|
+
args: [POLYGON_USDCE, RELAY_ROUTER_V3_ADDRESS, AMOUNT_PLACEHOLDER]
|
|
638
|
+
});
|
|
639
|
+
const wrapUsdceToPusdViaVaultDepositor = encodeFunctionData({
|
|
640
|
+
abi: VAULT_DEPOSITOR_ABI,
|
|
641
|
+
functionName: "deposit",
|
|
642
|
+
args: [POLYGON_USDCE, COLLATERAL_ONRAMP_ADDRESS, wrapUsdceToPusd, 0n]
|
|
643
|
+
});
|
|
644
|
+
const depositPusdToPerps = encodeFunctionData({
|
|
645
|
+
abi: POLYMARKET_PERPS_ABI,
|
|
646
|
+
functionName: "deposit",
|
|
647
|
+
args: [PUSD_TOKEN.address, AMOUNT_PLACEHOLDER, recipientAddress]
|
|
648
|
+
});
|
|
649
|
+
const depositPusdToPerpsViaVaultDepositor = encodeFunctionData({
|
|
650
|
+
abi: VAULT_DEPOSITOR_ABI,
|
|
651
|
+
functionName: "deposit",
|
|
652
|
+
args: [
|
|
653
|
+
PUSD_TOKEN.address,
|
|
654
|
+
POLYMARKET_PERPS_ADDRESS,
|
|
655
|
+
depositPusdToPerps,
|
|
656
|
+
0n
|
|
657
|
+
]
|
|
658
|
+
});
|
|
659
|
+
const legs = [
|
|
660
|
+
// Leg 1 — sweep the bridged USDC.e and wrap it into pUSD.
|
|
661
|
+
{
|
|
662
|
+
token: POLYGON_USDCE,
|
|
663
|
+
to: VAULT_DEPOSITOR_POLYGON,
|
|
664
|
+
data: wrapUsdceToPusdViaVaultDepositor,
|
|
665
|
+
// 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
|
|
666
|
+
amount: 0n
|
|
667
|
+
},
|
|
668
|
+
// Leg 2 — sweep the resulting pUSD and deposit it into Polymarket Perps
|
|
669
|
+
// for the recipient.
|
|
670
|
+
{
|
|
671
|
+
token: PUSD_TOKEN.address,
|
|
672
|
+
to: VAULT_DEPOSITOR_POLYGON,
|
|
673
|
+
data: depositPusdToPerpsViaVaultDepositor,
|
|
674
|
+
// 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
|
|
675
|
+
amount: 0n
|
|
676
|
+
}
|
|
677
|
+
];
|
|
678
|
+
return [
|
|
679
|
+
// RelayRouterV3 calls its function `cleanupErc20sViaCall`
|
|
680
|
+
// that iterates over the legs and does the following for each leg:
|
|
681
|
+
// 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):
|
|
682
|
+
// `IERC20(token).balanceOf(address(this))`
|
|
683
|
+
// 2. Approves the token to the target address (https://github.com/relayprotocol/relay-periphery/blob/0e4aabb750efb1f807d7f12b83b090b51b9ee736/src/v3/RelayRouterV3.sol#L183-L184):
|
|
684
|
+
// `IERC20(token).approve(to, amount)`
|
|
685
|
+
// 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):
|
|
686
|
+
// `(bool success, ) = to.call(data);
|
|
687
|
+
// `if (!success) { revert CallFailed(); }`
|
|
688
|
+
{
|
|
689
|
+
contractAbi: RELAY_ROUTER_V3_ABI,
|
|
690
|
+
contractAddress: RELAY_ROUTER_V3_ADDRESS,
|
|
691
|
+
functionName: "cleanupErc20sViaCall",
|
|
692
|
+
// cleanupErc20sViaCall takes parallel arrays — transpose the per-leg rows.
|
|
693
|
+
functionArgs: [
|
|
694
|
+
legs.map((leg) => leg.token),
|
|
695
|
+
legs.map((leg) => leg.to),
|
|
696
|
+
legs.map((leg) => leg.data),
|
|
697
|
+
legs.map((leg) => leg.amount)
|
|
698
|
+
]
|
|
699
|
+
}
|
|
700
|
+
];
|
|
701
|
+
};
|
|
702
|
+
}
|
|
561
703
|
export {
|
|
704
|
+
createPerpsGenerateActionParams,
|
|
562
705
|
createPolymarketWithdrawalConfig
|
|
563
706
|
};
|
|
@@ -6,6 +6,7 @@ export declare const copyButtonIconActive: string;
|
|
|
6
6
|
export declare const copyInputTextBox: string;
|
|
7
7
|
export declare const copyInputTextBoxActive: string;
|
|
8
8
|
export declare const copyInputText: string;
|
|
9
|
+
export declare const displayedAddressText: string;
|
|
9
10
|
export declare const copyInputTextWrapper: string;
|
|
10
11
|
export declare const copyInputTextDefault: string;
|
|
11
12
|
export declare const copyInputTextActive: string;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
type CopyLabel = 'address' | 'invoice';
|
|
2
3
|
interface CopyInputDisplayedAddressProps {
|
|
3
4
|
address: string;
|
|
4
5
|
onAddressCopied?: () => void;
|
|
5
6
|
truncateAddress?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Word rendered after "Copy" in the button label. EN variant char-animates
|
|
9
|
+
* the raw word; i18n variant maps to `common.copyAddress` / `common.copyInvoice`.
|
|
10
|
+
*/
|
|
11
|
+
label?: CopyLabel;
|
|
6
12
|
}
|
|
7
13
|
/**
|
|
8
14
|
* Main exported component that conditionally renders English or i18n version
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Action type signalling a Polymarket Perps deposit (USDC.e → pUSD → Perps). */
|
|
2
|
+
export declare const POLYMARKET_PERPS_DEPOSIT_ACTION_TYPE = "POLYMARKET_PERPS_DEPOSIT";
|
|
3
|
+
/**
|
|
4
|
+
* Polymarket pUSD on Polygon. Perps deposits must land in pUSD on-chain, so
|
|
5
|
+
* QR/UDA transfers for the deposit action target this address.
|
|
6
|
+
*/
|
|
7
|
+
export declare const POLYMARKET_PUSD_ADDRESS: `0x${string}`;
|
package/dist/domains/quote.d.ts
CHANGED
|
@@ -22,6 +22,17 @@ export declare function getCheckoutBaseQuote(checkoutItem: FunkitActiveCheckoutI
|
|
|
22
22
|
* scoped to Wallet (Relay direct-execution) only.
|
|
23
23
|
*/
|
|
24
24
|
usePermit?: boolean): Promise<CheckoutQuoteResponse>;
|
|
25
|
+
/**
|
|
26
|
+
* In EXACT_IN/ONE_TO_ONE mode, the user's input is the source (from) amount.
|
|
27
|
+
* When a canonical bigint is available, use formatUnits to produce the precise
|
|
28
|
+
* human-readable string, avoiding precision loss from bigint->Number->string.
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveFromTokenAmount(checkoutItem: FunkitActiveCheckoutItem, isExactInViaBuilder: boolean, userInputAmount: number, fromTokenDecimals: number): string;
|
|
31
|
+
/**
|
|
32
|
+
* Derives estSubtotalToAmount from metadata.toAmountBaseUnit for EXACT_IN quotes.
|
|
33
|
+
* Returns null when derivation isn't needed or isn't possible.
|
|
34
|
+
**/
|
|
35
|
+
export declare function deriveEstSubtotalToAmountIfNeeded(baseQuote: CheckoutQuoteResponse, isExactIn: boolean, toTokenDecimals: number): string | null;
|
|
25
36
|
export declare function getQuoteFinalEstimation(baseQuote: CheckoutQuoteResponse, checkoutItem: FunkitActiveCheckoutItem, newPaymentMethodInfo: PaymentMethodInfo, wagmiConfig: Config, apiKey: string, loginType: LoginType, isWithdrawal?: boolean, brokerageQuote?: BluvoBrokerageQuote): Promise<{
|
|
26
37
|
finalEstimation: FunkitCheckoutQuoteResult;
|
|
27
38
|
brokerage?: BrokerageDetails;
|
package/dist/index.css
CHANGED
|
@@ -15620,8 +15620,8 @@
|
|
|
15620
15620
|
inset: 0;
|
|
15621
15621
|
}
|
|
15622
15622
|
|
|
15623
|
-
/* vanilla-extract-css-ns:src/components/CopyAddress/CopyInputDisplayedAddress.css.ts.vanilla.css?source=#
|
|
15624
|
-
@keyframes
|
|
15623
|
+
/* vanilla-extract-css-ns:src/components/CopyAddress/CopyInputDisplayedAddress.css.ts.vanilla.css?source=#H4sIAAAAAAAAA81W247bNhB9368YBFjABkSBsiMnq7wEST8i7UtBUSObME0KJL22U+y/F6QuFiXHcVOgKAyY4m3mzJnhIT/v8VIbdkALf2b78juKlxr+egKgz6EBcIYpW2tzINqIrVAF5PQZ6POneLZoPyVz+PuCLsFoxxx+W9AKt0uwnElcZMt2k24YF+5SQOb7b08AWd67m89t6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3oY7hD0f8NJKC0rHMNAAA= */
|
|
15624
|
+
@keyframes _1kbzei9f {
|
|
15625
15625
|
0% {
|
|
15626
15626
|
transform-origin: 50% 0%;
|
|
15627
15627
|
transform: translateY(0) rotateX(0deg) scale(1);
|
|
@@ -15641,7 +15641,7 @@
|
|
|
15641
15641
|
filter: blur(6px);
|
|
15642
15642
|
}
|
|
15643
15643
|
}
|
|
15644
|
-
@keyframes
|
|
15644
|
+
@keyframes _1kbzei9g {
|
|
15645
15645
|
0%, 15% {
|
|
15646
15646
|
transform-origin: 50% 100%;
|
|
15647
15647
|
transform: translateY(-60%) rotateX(30deg) scale(.6);
|
|
@@ -15744,11 +15744,18 @@
|
|
|
15744
15744
|
display: inline-flex;
|
|
15745
15745
|
}
|
|
15746
15746
|
[data-rk] ._1kbzei9b {
|
|
15747
|
+
display: block;
|
|
15748
|
+
width: 100%;
|
|
15749
|
+
white-space: nowrap;
|
|
15750
|
+
overflow: hidden;
|
|
15751
|
+
text-overflow: ellipsis;
|
|
15752
|
+
}
|
|
15753
|
+
[data-rk] ._1kbzei9c {
|
|
15747
15754
|
position: relative;
|
|
15748
15755
|
perspective: 100px;
|
|
15749
15756
|
transform-style: preserve-3d;
|
|
15750
15757
|
}
|
|
15751
|
-
[data-rk] .
|
|
15758
|
+
[data-rk] ._1kbzei9d {
|
|
15752
15759
|
display: inline-block;
|
|
15753
15760
|
animation-name: var(--animation-name, none);
|
|
15754
15761
|
animation-delay: var(--animation-delay, 0s);
|
|
@@ -15757,7 +15764,7 @@
|
|
|
15757
15764
|
animation-fill-mode: forwards;
|
|
15758
15765
|
opacity: var(--animation-opacity, 1);
|
|
15759
15766
|
}
|
|
15760
|
-
[data-rk] .
|
|
15767
|
+
[data-rk] ._1kbzei9e {
|
|
15761
15768
|
transform: translateY(-60%) rotateX(30deg) scale(.6);
|
|
15762
15769
|
transform-origin: 50% 100%;
|
|
15763
15770
|
position: absolute;
|