@funkit/connect 9.23.0 → 9.23.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 +30 -0
- package/dist/clients/{chunk-KSSSSWR6.js → chunk-2LMREKV6.js} +1 -1
- package/dist/clients/{chunk-NCCAYPLO.js → chunk-4M57JDJK.js} +1 -1
- package/dist/clients/{chunk-ZMVXBMON.js → chunk-GCIUIPM7.js} +1 -1
- package/dist/clients/{chunk-OWXKWC7I.js → chunk-H3CKQIYI.js} +10 -10
- package/dist/clients/{chunk-4752IYY6.js → chunk-KWIR3HO4.js} +1 -1
- package/dist/clients/fanatics.css +2 -2
- package/dist/clients/fanatics.js +3 -3
- package/dist/clients/lighter.css +2 -2
- package/dist/clients/lighter.js +5 -3
- package/dist/clients/mallard.d.ts +49 -0
- package/dist/clients/mallard.js +86 -0
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +91 -91
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +6 -6
- package/dist/clients/polymarket/createPolymarketDepositConfig.js +2 -2
- package/dist/clients/polymarket/index.css +91 -91
- package/dist/clients/polymarket/index.js +6 -6
- package/dist/clients/polymarket/polymarket.js +1 -1
- package/dist/clients/rolly.js +1 -14
- package/dist/components/Box/Box.d.ts +21 -21
- package/dist/consts/customers.d.ts +2 -0
- package/dist/css/sprinkles.css.d.ts +21 -21
- package/dist/domains/asset.d.ts +2 -2
- package/dist/domains/clientMetadata.d.ts +6 -1
- package/dist/hooks/useTokenTransferConfig.d.ts +7 -0
- package/dist/index.css +32 -32
- package/dist/index.js +216 -295
- package/dist/modals/CheckoutModal/FunCheckoutStep.d.ts +3 -1
- package/dist/modals/CheckoutModal/SelectAsset/SelectAsset.d.ts +1 -1
- package/dist/modals/CheckoutModal/Withdrawal/WithdrawalComplete.d.ts +14 -0
- package/dist/modals/CheckoutModal/Withdrawal/WithdrawalEnterAmount.d.ts +15 -0
- package/dist/modals/CheckoutModal/stepTransition.d.ts +6 -0
- package/dist/modals/CheckoutModal/stepTransition.track.d.ts +1 -1
- package/dist/providers/FunkitCheckoutContext/types.d.ts +2 -28
- package/dist/utils/tokenTransfer/disabledList.d.ts +1 -14
- package/dist/utils/tokenTransfer/types.d.ts +5 -30
- package/dist/wallets/walletConnectors/index.js +32 -32
- package/package.json +4 -4
- package/dist/clients/nado.d.ts +0 -78
- package/dist/clients/nado.js +0 -107
- /package/dist/clients/{chunk-52NKHZS2.js → chunk-OG254LB3.js} +0 -0
- /package/dist/clients/{chunk-MOUTRRN3.js → chunk-S7FRYR55.js} +0 -0
|
@@ -22,5 +22,7 @@ export declare enum FunCheckoutStep {
|
|
|
22
22
|
BROKERAGE_TWO_FA = "brokerage_two_fa",
|
|
23
23
|
BROKERAGE_SUCCESS = "brokerage_success",
|
|
24
24
|
SWAPPED_IFRAME = "swapped_iframe",
|
|
25
|
-
PERPS_TRANSFER = "perps_transfer"
|
|
25
|
+
PERPS_TRANSFER = "perps_transfer",
|
|
26
|
+
WITHDRAWAL_ENTER_AMOUNT = "withdrawal_enter_amount",
|
|
27
|
+
WITHDRAWAL_COMPLETE = "withdrawal_complete"
|
|
26
28
|
}
|
|
@@ -15,4 +15,4 @@ export type SelectAssetNext = {
|
|
|
15
15
|
};
|
|
16
16
|
export declare const SelectAssetInfo: ModalStepInfo<FunCheckoutStep.SELECT_ASSET>;
|
|
17
17
|
export declare function SelectAsset({ modalState, onNext, onClose, }: ModalStepComponentProps<FunCheckoutStep.SELECT_ASSET>): React.JSX.Element;
|
|
18
|
-
export declare function isTreatedAsNativeToken(apiKey: string, asset: AssetHoldingsItem, dynamicTargetAssetCandidates: DynamicTargetAssetCandidate[], findDynamicPath: IndexedDynamicRoutingConfig[string]['findPath']): boolean;
|
|
18
|
+
export declare function isTreatedAsNativeToken(apiKey: string, asset: AssetHoldingsItem, dynamicTargetAssetCandidates: DynamicTargetAssetCandidate[], findDynamicPath: IndexedDynamicRoutingConfig[string]['findPath'], isUserSelected: boolean): boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Hex } from 'viem';
|
|
2
|
+
import type { FunkitCheckoutQuoteResult } from '../../../domains/quote';
|
|
3
|
+
import type { CustomWithdrawalConfig, WalletWithdrawalConfig } from '../../../providers/FunkitCheckoutContext';
|
|
4
|
+
import { type CheckoutModalCommonState, FunCheckoutStep, type ModalStepComponentProps, type ModalStepInfo } from '../stepTransition';
|
|
5
|
+
export type WithdrawalCompleteState = CheckoutModalCommonState & {
|
|
6
|
+
withdrawalConfig: WalletWithdrawalConfig | CustomWithdrawalConfig;
|
|
7
|
+
hash: Hex;
|
|
8
|
+
withdrawnAmount: string;
|
|
9
|
+
tokenSymbol: string;
|
|
10
|
+
quote?: FunkitCheckoutQuoteResult;
|
|
11
|
+
};
|
|
12
|
+
export type WithdrawalCompleteNext = Record<never, never>;
|
|
13
|
+
export declare const WithdrawalCompleteInfo: ModalStepInfo<FunCheckoutStep.WITHDRAWAL_COMPLETE>;
|
|
14
|
+
export declare function WithdrawalComplete(_props: ModalStepComponentProps<FunCheckoutStep.WITHDRAWAL_COMPLETE>): null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Hex } from 'viem';
|
|
2
|
+
import type { FunkitCheckoutQuoteResult } from '../../../domains/quote';
|
|
3
|
+
import type { CustomWithdrawalConfig, WalletWithdrawalConfig } from '../../../providers/FunkitCheckoutContext';
|
|
4
|
+
import { type CheckoutModalCommonState, FunCheckoutStep, type ModalStepComponentProps, type ModalStepInfo } from '../stepTransition';
|
|
5
|
+
export type WithdrawalEnterAmountState = CheckoutModalCommonState & {
|
|
6
|
+
withdrawalConfig: WalletWithdrawalConfig | CustomWithdrawalConfig;
|
|
7
|
+
};
|
|
8
|
+
export type WithdrawalEnterAmountNext = {
|
|
9
|
+
hash: Hex;
|
|
10
|
+
withdrawnAmount: string;
|
|
11
|
+
tokenSymbol: string;
|
|
12
|
+
quote?: FunkitCheckoutQuoteResult;
|
|
13
|
+
};
|
|
14
|
+
export declare const WithdrawalEnterAmountInfo: ModalStepInfo<FunCheckoutStep.WITHDRAWAL_ENTER_AMOUNT>;
|
|
15
|
+
export declare function WithdrawalEnterAmount(_props: ModalStepComponentProps<FunCheckoutStep.WITHDRAWAL_ENTER_AMOUNT>): null;
|
|
@@ -26,6 +26,8 @@ import { type SwappedIframeNext, type SwappedIframeState } from './SwappedIframe
|
|
|
26
26
|
import { type TransferTokenNext, type TransferTokenState } from './TransferToken/TransferToken';
|
|
27
27
|
import { type FiatAccountDetailNext, type FiatAccountDetailState } from './VirtualFiatAccount/FiatAccountDetail';
|
|
28
28
|
import { type KycIframeNext, type KycIframeState } from './VirtualFiatAccount/KycIframe';
|
|
29
|
+
import { type WithdrawalCompleteNext, type WithdrawalCompleteState } from './Withdrawal/WithdrawalComplete';
|
|
30
|
+
import { type WithdrawalEnterAmountNext, type WithdrawalEnterAmountState } from './Withdrawal/WithdrawalEnterAmount';
|
|
29
31
|
export { FunCheckoutStep };
|
|
30
32
|
export interface CheckoutModalCommonState {
|
|
31
33
|
checkoutId: string;
|
|
@@ -123,6 +125,8 @@ export type CheckoutModalState<S extends FunCheckoutStep = FunCheckoutStep> = {
|
|
|
123
125
|
[FunCheckoutStep.BROKERAGE_SUCCESS]: BrokerageSuccessState;
|
|
124
126
|
[FunCheckoutStep.SWAPPED_IFRAME]: SwappedIframeState;
|
|
125
127
|
[FunCheckoutStep.PERPS_TRANSFER]: PerpsTransferState;
|
|
128
|
+
[FunCheckoutStep.WITHDRAWAL_ENTER_AMOUNT]: WithdrawalEnterAmountState;
|
|
129
|
+
[FunCheckoutStep.WITHDRAWAL_COMPLETE]: WithdrawalCompleteState;
|
|
126
130
|
}[T] & {
|
|
127
131
|
step: T;
|
|
128
132
|
previousStep?: FunCheckoutStep | null;
|
|
@@ -153,6 +157,8 @@ export type NextPayload<S extends FunCheckoutStep = FunCheckoutStep> = {
|
|
|
153
157
|
[FunCheckoutStep.BROKERAGE_SUCCESS]: null;
|
|
154
158
|
[FunCheckoutStep.SWAPPED_IFRAME]: SwappedIframeNext;
|
|
155
159
|
[FunCheckoutStep.PERPS_TRANSFER]: PerpsTransferNext;
|
|
160
|
+
[FunCheckoutStep.WITHDRAWAL_ENTER_AMOUNT]: WithdrawalEnterAmountNext;
|
|
161
|
+
[FunCheckoutStep.WITHDRAWAL_COMPLETE]: WithdrawalCompleteNext;
|
|
156
162
|
}[S] & {
|
|
157
163
|
/** Whether screen transition should change direction to simulate back transition. Only applies if there is a history entry in the stack*/
|
|
158
164
|
reverseAnimation?: boolean;
|
|
@@ -3,4 +3,4 @@ import type { TrackEventData } from '../../hooks/track/useTrack';
|
|
|
3
3
|
import { FunCheckoutStep } from './FunCheckoutStep';
|
|
4
4
|
import type { CheckoutModalState } from './stepTransition';
|
|
5
5
|
export declare const CHECKOUT_STEP_TO_READY_EVENT: Partial<Record<FunCheckoutStep, CheckoutModalEvent>>;
|
|
6
|
-
export declare const trackEventFromNextState: (nextState: CheckoutModalState<FunCheckoutStep>) => TrackEventData;
|
|
6
|
+
export declare const trackEventFromNextState: (nextState: CheckoutModalState<FunCheckoutStep>) => TrackEventData | null;
|
|
@@ -7,10 +7,8 @@ import type { CheckoutBlockedReason } from '../../modals/CheckoutModal/CheckoutB
|
|
|
7
7
|
import type { WithdrawalClient, WithdrawalTransaction } from '../../wallets/Wallet';
|
|
8
8
|
import type { FunkitCheckoutQuoteResult } from '../FunkitHistoryContext';
|
|
9
9
|
export type FunkitCheckoutActionParams = ApiFunkitCheckoutActionParams;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
tokenChainId: string;
|
|
13
|
-
}
|
|
10
|
+
import type { DynamicTargetAssetCandidate, TokenInfo } from '@funkit/connect-core';
|
|
11
|
+
export type { DynamicTargetAssetCandidate, TokenInfo, } from '@funkit/connect-core';
|
|
14
12
|
/**
|
|
15
13
|
* Argument passed to a dynamic {@link FunkitCheckoutConfig.modalTitle} resolver.
|
|
16
14
|
* Extends {@link TokenInfo} with the active dynamic routing id so titles can be
|
|
@@ -21,30 +19,6 @@ export interface TokenInfo {
|
|
|
21
19
|
export interface ModalTitleContext extends TokenInfo {
|
|
22
20
|
dynamicRoutingId?: string;
|
|
23
21
|
}
|
|
24
|
-
export interface DynamicTargetAssetCandidate extends TokenInfo {
|
|
25
|
-
iconSrc: string;
|
|
26
|
-
tokenSymbol: string;
|
|
27
|
-
isDefault?: boolean;
|
|
28
|
-
badgeText?: string;
|
|
29
|
-
targetAssetMinAmount?: number;
|
|
30
|
-
/**
|
|
31
|
-
* Exchange rate of the target asset in terms of the finalized token.
|
|
32
|
-
* Represents how many finalized tokens one unit of the target asset can be exchanged for.
|
|
33
|
-
*
|
|
34
|
-
* Example: If `targetAsset`/`finalizedToken` is USDT/hbUSDT and the rate is 1.01,
|
|
35
|
-
* 1 USDT can be exchanged for 1.01 hbUSDT.
|
|
36
|
-
*/
|
|
37
|
-
finalizedTokenRate?: number;
|
|
38
|
-
dynamicRoutingId?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Recipient to point the checkout at when this candidate is selected. Set when
|
|
41
|
-
* candidates represent destination *accounts* that share a target token but
|
|
42
|
-
* differ by recipient (e.g. Polymarket Predictions vs Perps); selecting one
|
|
43
|
-
* routes funds to its address. Omit for plain token candidates (the recipient
|
|
44
|
-
* is unchanged).
|
|
45
|
-
*/
|
|
46
|
-
customRecipient?: Address;
|
|
47
|
-
}
|
|
48
22
|
/**
|
|
49
23
|
* A token to offer adding to the user's wallet (EIP-747 `wallet_watchAsset`) on
|
|
50
24
|
* the post-checkout success screen.
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Keys are chainId strings. Values are arrays of token addresses,
|
|
3
|
-
* or ["*"] to disable the entire chain.
|
|
4
|
-
*/
|
|
5
|
-
export type DisabledChainsAndAssets = Record<string, string[]>;
|
|
6
|
-
/** Returns true if an entire chain is disabled (has ["*"]). */
|
|
7
|
-
export declare function isChainDisabled(disabledConfig: DisabledChainsAndAssets, chainId: number | string): boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Returns true if a specific chain + asset combination is disabled.
|
|
10
|
-
* - If the chain has ["*"], the entire chain (and all its assets) is disabled.
|
|
11
|
-
* - If the chain has specific addresses, only those tokens are disabled.
|
|
12
|
-
* - Address comparison is case-insensitive.
|
|
13
|
-
*/
|
|
14
|
-
export declare function isAssetDisabled(disabledConfig: DisabledChainsAndAssets, chainId: number | string, tokenAddress: string): boolean;
|
|
1
|
+
export { type DisabledChainsAndAssets, isAssetDisabled, isChainDisabled, } from '@funkit/connect-core';
|
|
@@ -1,32 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
showNewBadge?: 'primary' | true;
|
|
7
|
-
}
|
|
8
|
-
/** Resolved asset: API metadata merged with config-driven fields */
|
|
9
|
-
export type ResolvedAssetInfo = SupportedAssetInfo & TokenTransferAssetConfig;
|
|
10
|
-
/** Raw chain entry from the Statsig tokentransferconfig */
|
|
11
|
-
export interface TokenTransferChainConfig {
|
|
12
|
-
readonly chainId: number;
|
|
13
|
-
readonly isDefault?: boolean;
|
|
14
|
-
readonly assets: readonly TokenTransferAssetConfig[];
|
|
15
|
-
}
|
|
16
|
-
/** The full output of useTokenTransferConfig */
|
|
17
|
-
export interface TokenTransferConfig {
|
|
18
|
-
/** Supported assets filtered by config, keyed by [chainId][address] */
|
|
19
|
-
supportedAssets: GetSupportedAssetsResponse;
|
|
20
|
-
/** Backward-compatible Record<number, string[]> (chainId -> symbol[]) */
|
|
21
|
-
symbolsByChainId: Record<number, string[]>;
|
|
22
|
-
/** Chain IDs in config display order */
|
|
23
|
-
chainIdSortOrder: number[];
|
|
24
|
-
/** Default chain ID (from isDefault on chain entry) */
|
|
25
|
-
defaultChainId: number | undefined;
|
|
26
|
-
/** Token symbols to prioritize at the top of the dropdown */
|
|
27
|
-
priorityTokenSymbols: string[];
|
|
28
|
-
/** Token symbols that have a "New" badge. The 'primary' symbol is first. */
|
|
29
|
-
newBadgeSymbols: Set<string>;
|
|
30
|
-
/** True while /assets/supported is still loading */
|
|
1
|
+
import type { TokenTransferConfigResult } from '@funkit/connect-core';
|
|
2
|
+
export type { ResolvedAssetInfo, TokenTransferAssetConfig, TokenTransferChainConfig, TokenTransferConfigResult, } from '@funkit/connect-core';
|
|
3
|
+
/** The full output of useTokenTransferConfig: the resolved config + load state. */
|
|
4
|
+
export interface TokenTransferConfig extends TokenTransferConfigResult {
|
|
5
|
+
/** True while /assets/supported is still loading. */
|
|
31
6
|
isLoading: boolean;
|
|
32
7
|
}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import {
|
|
3
|
+
zealWallet
|
|
4
|
+
} from "./chunk-52QXXLDS.js";
|
|
2
5
|
import {
|
|
3
6
|
zerionWallet
|
|
4
7
|
} from "./chunk-SWFF3TWJ.js";
|
|
5
8
|
import {
|
|
6
|
-
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import {
|
|
9
|
-
tokenPocketWallet
|
|
10
|
-
} from "./chunk-WKNQMP4A.js";
|
|
9
|
+
tahoWallet
|
|
10
|
+
} from "./chunk-7ZYCBDQ4.js";
|
|
11
11
|
import {
|
|
12
12
|
talismanWallet
|
|
13
13
|
} from "./chunk-4DCO3TGL.js";
|
|
14
|
+
import {
|
|
15
|
+
tokenPocketWallet
|
|
16
|
+
} from "./chunk-WKNQMP4A.js";
|
|
14
17
|
import {
|
|
15
18
|
tokenaryWallet
|
|
16
19
|
} from "./chunk-VH3THHJY.js";
|
|
@@ -20,15 +23,15 @@ import {
|
|
|
20
23
|
import {
|
|
21
24
|
uniswapWallet
|
|
22
25
|
} from "./chunk-Z3PPW6NC.js";
|
|
23
|
-
import {
|
|
24
|
-
walletConnectWallet
|
|
25
|
-
} from "./chunk-3FCWJRI4.js";
|
|
26
26
|
import {
|
|
27
27
|
xdefiWallet
|
|
28
28
|
} from "./chunk-JN5I3DNC.js";
|
|
29
29
|
import {
|
|
30
|
-
|
|
31
|
-
} from "./chunk-
|
|
30
|
+
walletConnectWallet
|
|
31
|
+
} from "./chunk-3FCWJRI4.js";
|
|
32
|
+
import {
|
|
33
|
+
phantomWallet
|
|
34
|
+
} from "./chunk-QY53O7WG.js";
|
|
32
35
|
import {
|
|
33
36
|
rainbowWallet
|
|
34
37
|
} from "./chunk-W2LCLDPX.js";
|
|
@@ -51,8 +54,11 @@ import {
|
|
|
51
54
|
subWallet
|
|
52
55
|
} from "./chunk-NR2OGDHQ.js";
|
|
53
56
|
import {
|
|
54
|
-
|
|
55
|
-
} from "./chunk-
|
|
57
|
+
metaMaskWallet
|
|
58
|
+
} from "./chunk-YO2K4MBH.js";
|
|
59
|
+
import {
|
|
60
|
+
mewWallet
|
|
61
|
+
} from "./chunk-MQM45ADF.js";
|
|
56
62
|
import {
|
|
57
63
|
oktoWallet
|
|
58
64
|
} from "./chunk-YWOVAU6O.js";
|
|
@@ -65,30 +71,27 @@ import {
|
|
|
65
71
|
import {
|
|
66
72
|
oneInchWallet
|
|
67
73
|
} from "./chunk-QG6ZHI7B.js";
|
|
68
|
-
import {
|
|
69
|
-
mewWallet
|
|
70
|
-
} from "./chunk-MQM45ADF.js";
|
|
71
74
|
import {
|
|
72
75
|
oneKeyWallet
|
|
73
76
|
} from "./chunk-WVT6BBJH.js";
|
|
74
|
-
import {
|
|
75
|
-
phantomWallet
|
|
76
|
-
} from "./chunk-QY53O7WG.js";
|
|
77
77
|
import {
|
|
78
78
|
rabbyWallet
|
|
79
79
|
} from "./chunk-RB66PKPA.js";
|
|
80
80
|
import {
|
|
81
|
-
|
|
82
|
-
} from "./chunk-
|
|
81
|
+
foxWallet
|
|
82
|
+
} from "./chunk-GUQM4QSL.js";
|
|
83
83
|
import {
|
|
84
84
|
frameWallet
|
|
85
85
|
} from "./chunk-BU3ZAT5X.js";
|
|
86
|
-
import {
|
|
87
|
-
imTokenWallet
|
|
88
|
-
} from "./chunk-WNAGGFMG.js";
|
|
89
86
|
import {
|
|
90
87
|
frontierWallet
|
|
91
88
|
} from "./chunk-AVDUNQUW.js";
|
|
89
|
+
import {
|
|
90
|
+
gateWallet
|
|
91
|
+
} from "./chunk-JPN6TWIT.js";
|
|
92
|
+
import {
|
|
93
|
+
imTokenWallet
|
|
94
|
+
} from "./chunk-WNAGGFMG.js";
|
|
92
95
|
import {
|
|
93
96
|
injectedWallet
|
|
94
97
|
} from "./chunk-T6LGKC3F.js";
|
|
@@ -98,9 +101,6 @@ import {
|
|
|
98
101
|
import {
|
|
99
102
|
ledgerWallet
|
|
100
103
|
} from "./chunk-RPV27V2Y.js";
|
|
101
|
-
import {
|
|
102
|
-
metaMaskWallet
|
|
103
|
-
} from "./chunk-YO2K4MBH.js";
|
|
104
104
|
import {
|
|
105
105
|
bybitWallet
|
|
106
106
|
} from "./chunk-OX37G4YT.js";
|
|
@@ -116,15 +116,15 @@ import {
|
|
|
116
116
|
import {
|
|
117
117
|
coreWallet
|
|
118
118
|
} from "./chunk-4NV5BYRP.js";
|
|
119
|
-
import {
|
|
120
|
-
enkryptWallet
|
|
121
|
-
} from "./chunk-HBQK5RD5.js";
|
|
122
|
-
import {
|
|
123
|
-
foxWallet
|
|
124
|
-
} from "./chunk-GUQM4QSL.js";
|
|
125
119
|
import {
|
|
126
120
|
dawnWallet
|
|
127
121
|
} from "./chunk-G2PHTVL6.js";
|
|
122
|
+
import {
|
|
123
|
+
desigWallet
|
|
124
|
+
} from "./chunk-FW3WZETT.js";
|
|
125
|
+
import {
|
|
126
|
+
enkryptWallet
|
|
127
|
+
} from "./chunk-HBQK5RD5.js";
|
|
128
128
|
import {
|
|
129
129
|
argentWallet
|
|
130
130
|
} from "./chunk-NTMBEOR2.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funkit/connect",
|
|
3
|
-
"version": "9.23.
|
|
3
|
+
"version": "9.23.1",
|
|
4
4
|
"description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -112,9 +112,9 @@
|
|
|
112
112
|
"use-debounce": "^10.0.5",
|
|
113
113
|
"uuid": "^11.1.1",
|
|
114
114
|
"@funkit/api-base": "4.5.1",
|
|
115
|
-
"@funkit/chains": "2.1.
|
|
116
|
-
"@funkit/connect-core": "1.
|
|
117
|
-
"@funkit/fun-relay": "2.8.
|
|
115
|
+
"@funkit/chains": "2.1.1",
|
|
116
|
+
"@funkit/connect-core": "1.1.0",
|
|
117
|
+
"@funkit/fun-relay": "2.8.3",
|
|
118
118
|
"@funkit/utils": "3.1.0"
|
|
119
119
|
},
|
|
120
120
|
"repository": {
|
package/dist/clients/nado.d.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Nado deposit routed through the Ink VaultDepositooor.
|
|
3
|
-
*
|
|
4
|
-
* Each deposit is a 2-action batch:
|
|
5
|
-
* 1. approve(collateralToken, VAULT_DEPOSITOR, maxUint256) — covers the live balance pull
|
|
6
|
-
* 2. VAULT_DEPOSITOR.deposit(collateralToken, NADO_ENDPOINT, calldata, 0)
|
|
7
|
-
*
|
|
8
|
-
* No zero-first approve reset: USDT0 on Ink (TetherTokenOFTExtension) inherits
|
|
9
|
-
* OpenZeppelin's plain approve — verified on the Ink explorer, no legacy
|
|
10
|
-
* non-zero->non-zero revert — and the other collaterals are standard OZ tokens.
|
|
11
|
-
*
|
|
12
|
-
* The Endpoint calldata carries AMOUNT_PLACEHOLDER where the uint128 amount
|
|
13
|
-
* goes; the VaultDepositooor injects its caller's LIVE collateral balance over
|
|
14
|
-
* the placeholder before calling the Endpoint. That makes the deposit robust
|
|
15
|
-
* to bridge fee drift: whatever actually arrived is what gets deposited, with
|
|
16
|
-
* no under-funded revert and no dust stranded on the EOA. The selector is the
|
|
17
|
-
* canonical uint128 one (0x221f0939, registered for the Endpoint on the Ink
|
|
18
|
-
* VaultDepositooor) while the head encodes the amount slot as uint256 so the
|
|
19
|
-
* 32-byte placeholder word fits — uint128 and uint256 head-encode identically.
|
|
20
|
-
*
|
|
21
|
-
* `subaccount` packs the recipient address (high 20 bytes) with the
|
|
22
|
-
* subaccount name "default" (right-padded to the remaining 12 bytes) into a
|
|
23
|
-
* single bytes32 word. `productId` is per-collateral and is looked up by the
|
|
24
|
-
* integrator from the Nado SpotEngine allowlist.
|
|
25
|
-
*
|
|
26
|
-
* Spec: https://www.notion.so/the-fun-group/37bfc3b2a002816bac41c920902e03c2
|
|
27
|
-
*/
|
|
28
|
-
import { type Address, type Hex } from 'viem';
|
|
29
|
-
import type { FunkitCheckoutActionParams } from '../providers/FunkitCheckoutContext/types';
|
|
30
|
-
/** Nado Endpoint on Ink mainnet (chain 57073). */
|
|
31
|
-
export declare const NADO_ENDPOINT_ADDRESS: `0x${string}`;
|
|
32
|
-
/** VaultDepositooor on Ink — fresh CREATE3 deploy (differs from the canonical
|
|
33
|
-
* address on other chains). The Nado Endpoint is registered on it with
|
|
34
|
-
* selector 0x221f0939 and no decimal conversion. Mirrors
|
|
35
|
-
* VAULT_DEPOSITOR_ADDRESSES[INK] in fun-backend's packages/types. */
|
|
36
|
-
export declare const INK_VAULT_DEPOSITOR_ADDRESS: `0x${string}`;
|
|
37
|
-
/** Sentinel value Nado treats as "no referral". */
|
|
38
|
-
export declare const NADO_NO_REFERRAL_CODE = "-1";
|
|
39
|
-
/** Default subaccount name used by the Nado UI/SDK. */
|
|
40
|
-
export declare const NADO_DEFAULT_SUBACCOUNT_NAME = "default";
|
|
41
|
-
/**
|
|
42
|
-
* Build a Nado `bytes32` subaccount from an owner address and subaccount
|
|
43
|
-
* name. Layout: `[owner (20 bytes)] [name (right-padded to 12 bytes)]`.
|
|
44
|
-
*
|
|
45
|
-
* Throws if `name` encodes to more than 12 bytes — without this, `pad()`
|
|
46
|
-
* surfaces viem's opaque `SizeExceedsPaddingSizeError`.
|
|
47
|
-
*/
|
|
48
|
-
export declare function buildNadoSubaccount(owner: Address, name?: string): Hex;
|
|
49
|
-
export interface NadoDepositActionsConfig {
|
|
50
|
-
/** Address credited on Nado (typically the connected wallet). */
|
|
51
|
-
recipientAddress: Address | undefined;
|
|
52
|
-
/** Collateral ERC20 on Ink being deposited (USDT0, kBTC, WETH, USDC, ...). */
|
|
53
|
-
collateralTokenAddress: Address;
|
|
54
|
-
/** Nado SpotEngine productId for the collateral token. */
|
|
55
|
-
productId: number;
|
|
56
|
-
/** Optional subaccount name. Defaults to "default". */
|
|
57
|
-
subaccountName?: string;
|
|
58
|
-
/** Optional referral code. Defaults to the no-referral sentinel "-1". */
|
|
59
|
-
referralCode?: string;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Builds the 2-action batch (approve + deposit) for a Nado collateral
|
|
63
|
-
* deposit routed through the Endpoint.
|
|
64
|
-
*
|
|
65
|
-
* Usage:
|
|
66
|
-
* ```ts
|
|
67
|
-
* const checkoutConfig: FunkitCheckoutConfig = {
|
|
68
|
-
* // ...
|
|
69
|
-
* generateActionsParams: () => async (amount, output) =>
|
|
70
|
-
* createNadoDepositActions({
|
|
71
|
-
* recipientAddress: walletAddress,
|
|
72
|
-
* collateralTokenAddress: output.targetAsset,
|
|
73
|
-
* productId: NADO_PRODUCT_ID_BY_TOKEN[output.targetAsset],
|
|
74
|
-
* }),
|
|
75
|
-
* }
|
|
76
|
-
* ```
|
|
77
|
-
*/
|
|
78
|
-
export declare function createNadoDepositActions(config: NadoDepositActionsConfig): FunkitCheckoutActionParams[];
|
package/dist/clients/nado.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/clients/nado.tsx
|
|
4
|
-
import {
|
|
5
|
-
concat,
|
|
6
|
-
encodeAbiParameters,
|
|
7
|
-
erc20Abi,
|
|
8
|
-
getAddress,
|
|
9
|
-
maxUint256,
|
|
10
|
-
pad,
|
|
11
|
-
stringToHex,
|
|
12
|
-
toFunctionSelector
|
|
13
|
-
} from "viem";
|
|
14
|
-
var NADO_ENDPOINT_ADDRESS = getAddress(
|
|
15
|
-
"0x05ec92d78ed421f3d3ada77ffde167106565974e"
|
|
16
|
-
);
|
|
17
|
-
var INK_VAULT_DEPOSITOR_ADDRESS = getAddress(
|
|
18
|
-
"0xDB9d579B0DCbf566E372C73A2e374c44B161E1Ee"
|
|
19
|
-
);
|
|
20
|
-
var AMOUNT_PLACEHOLDER = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffdeadbeefn;
|
|
21
|
-
var VAULT_DEPOSITOR_ABI = [
|
|
22
|
-
{
|
|
23
|
-
name: "deposit",
|
|
24
|
-
type: "function",
|
|
25
|
-
stateMutability: "nonpayable",
|
|
26
|
-
inputs: [
|
|
27
|
-
{ name: "token", type: "address" },
|
|
28
|
-
{ name: "vault", type: "address" },
|
|
29
|
-
{ name: "callData", type: "bytes" },
|
|
30
|
-
{ name: "minAmountOut", type: "uint256" }
|
|
31
|
-
],
|
|
32
|
-
outputs: []
|
|
33
|
-
}
|
|
34
|
-
];
|
|
35
|
-
var NADO_NO_REFERRAL_CODE = "-1";
|
|
36
|
-
var NADO_DEFAULT_SUBACCOUNT_NAME = "default";
|
|
37
|
-
var NADO_SUBACCOUNT_NAME_MAX_BYTES = 12;
|
|
38
|
-
function buildNadoSubaccount(owner, name = NADO_DEFAULT_SUBACCOUNT_NAME) {
|
|
39
|
-
const nameHex = stringToHex(name);
|
|
40
|
-
const nameByteLength = (nameHex.length - 2) / 2;
|
|
41
|
-
if (nameByteLength > NADO_SUBACCOUNT_NAME_MAX_BYTES) {
|
|
42
|
-
throw new Error(
|
|
43
|
-
`Nado subaccount name must encode to \u2264 ${NADO_SUBACCOUNT_NAME_MAX_BYTES} bytes (got ${nameByteLength}: "${name}")`
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
return concat([
|
|
47
|
-
owner,
|
|
48
|
-
pad(nameHex, { dir: "right", size: NADO_SUBACCOUNT_NAME_MAX_BYTES })
|
|
49
|
-
]);
|
|
50
|
-
}
|
|
51
|
-
function createNadoDepositActions(config) {
|
|
52
|
-
const {
|
|
53
|
-
recipientAddress,
|
|
54
|
-
collateralTokenAddress,
|
|
55
|
-
productId,
|
|
56
|
-
subaccountName,
|
|
57
|
-
referralCode = NADO_NO_REFERRAL_CODE
|
|
58
|
-
} = config;
|
|
59
|
-
if (!recipientAddress) {
|
|
60
|
-
throw new Error("Please connect your wallet before starting a Nado deposit");
|
|
61
|
-
}
|
|
62
|
-
const collateral = getAddress(collateralTokenAddress);
|
|
63
|
-
const subaccount = buildNadoSubaccount(recipientAddress, subaccountName);
|
|
64
|
-
const depositCalldata = concat([
|
|
65
|
-
toFunctionSelector(
|
|
66
|
-
"depositCollateralWithReferral(bytes32,uint32,uint128,string)"
|
|
67
|
-
),
|
|
68
|
-
encodeAbiParameters(
|
|
69
|
-
[
|
|
70
|
-
{ type: "bytes32" },
|
|
71
|
-
{ type: "uint32" },
|
|
72
|
-
{ type: "uint256" },
|
|
73
|
-
{ type: "string" }
|
|
74
|
-
],
|
|
75
|
-
[subaccount, productId, AMOUNT_PLACEHOLDER, referralCode]
|
|
76
|
-
)
|
|
77
|
-
]);
|
|
78
|
-
return [
|
|
79
|
-
// MAX approve so the pull covers whatever balance actually arrived (the
|
|
80
|
-
// amount is only known at execution); the spender is Fun's own audited
|
|
81
|
-
// VaultDepositooor. No zero-first reset needed: Ink USDT0 uses plain OZ
|
|
82
|
-
// approve (verified), unlike legacy mainnet USDT.
|
|
83
|
-
{
|
|
84
|
-
contractAbi: erc20Abi,
|
|
85
|
-
contractAddress: collateral,
|
|
86
|
-
functionName: "approve",
|
|
87
|
-
functionArgs: [INK_VAULT_DEPOSITOR_ADDRESS, maxUint256]
|
|
88
|
-
},
|
|
89
|
-
// VaultDepositooor pulls the live balance, injects it over the
|
|
90
|
-
// placeholder, and calls the Endpoint. minAmountOut is 0 because the
|
|
91
|
-
// collateral passes through 1:1 (no vault rate to bound).
|
|
92
|
-
{
|
|
93
|
-
contractAbi: VAULT_DEPOSITOR_ABI,
|
|
94
|
-
contractAddress: INK_VAULT_DEPOSITOR_ADDRESS,
|
|
95
|
-
functionName: "deposit",
|
|
96
|
-
functionArgs: [collateral, NADO_ENDPOINT_ADDRESS, depositCalldata, 0n]
|
|
97
|
-
}
|
|
98
|
-
];
|
|
99
|
-
}
|
|
100
|
-
export {
|
|
101
|
-
INK_VAULT_DEPOSITOR_ADDRESS,
|
|
102
|
-
NADO_DEFAULT_SUBACCOUNT_NAME,
|
|
103
|
-
NADO_ENDPOINT_ADDRESS,
|
|
104
|
-
NADO_NO_REFERRAL_CODE,
|
|
105
|
-
buildNadoSubaccount,
|
|
106
|
-
createNadoDepositActions
|
|
107
|
-
};
|
|
File without changes
|
|
File without changes
|