@funkit/connect-rn 3.5.0 → 3.7.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 +88 -0
- package/README.md +81 -0
- package/dist/chunk-VDKAH5Y5.js +1433 -0
- package/dist/chunk-VDKAH5Y5.js.map +7 -0
- package/dist/clients/lighter/index.d.ts +7 -0
- package/dist/clients/lighter/index.d.ts.map +1 -0
- package/dist/clients/lighter/lighterFastWithdrawal.d.ts +42 -0
- package/dist/clients/lighter/lighterFastWithdrawal.d.ts.map +1 -0
- package/dist/clients/lighter/lighterWithdrawalConfig.d.ts +70 -0
- package/dist/clients/lighter/lighterWithdrawalConfig.d.ts.map +1 -0
- package/dist/clients/lighter/useLighterSecureWithdrawal.d.ts +42 -0
- package/dist/clients/lighter/useLighterSecureWithdrawal.d.ts.map +1 -0
- package/dist/clients/lighter/useLighterUnstakedFee.d.ts +15 -0
- package/dist/clients/lighter/useLighterUnstakedFee.d.ts.map +1 -0
- package/dist/clients/lighter/useLighterWithdrawal.d.ts +21 -0
- package/dist/clients/lighter/useLighterWithdrawal.d.ts.map +1 -0
- package/dist/clients/lighter/useLighterWithdrawalMethods.d.ts +29 -0
- package/dist/clients/lighter/useLighterWithdrawalMethods.d.ts.map +1 -0
- package/dist/clients/lighter.d.ts +1 -0
- package/dist/clients/lighter.js +448 -0
- package/dist/clients/lighter.js.map +7 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7278 -6356
- package/dist/index.js.map +4 -4
- package/dist/src/components/AmountDisplay.d.ts +18 -0
- package/dist/src/components/AmountDisplay.d.ts.map +1 -0
- package/dist/src/components/AssetGrid.d.ts +39 -0
- package/dist/src/components/AssetGrid.d.ts.map +1 -0
- package/dist/src/components/NumPad.d.ts +14 -0
- package/dist/src/components/NumPad.d.ts.map +1 -0
- package/dist/src/components/PillButton.d.ts +25 -0
- package/dist/src/components/PillButton.d.ts.map +1 -0
- package/dist/src/components/ReceiveAmountSummary.d.ts +27 -0
- package/dist/src/components/ReceiveAmountSummary.d.ts.map +1 -0
- package/dist/src/components/ReceiveAsRow.d.ts +14 -0
- package/dist/src/components/ReceiveAsRow.d.ts.map +1 -0
- package/dist/src/components/SearchInput.d.ts +15 -0
- package/dist/src/components/SearchInput.d.ts.map +1 -0
- package/dist/src/components/SelectableAssetRow.d.ts +14 -0
- package/dist/src/components/SelectableAssetRow.d.ts.map +1 -0
- package/dist/src/components/SheetContent.d.ts +25 -0
- package/dist/src/components/SheetContent.d.ts.map +1 -0
- package/dist/src/components/SkeletonBar.d.ts +10 -0
- package/dist/src/components/SkeletonBar.d.ts.map +1 -0
- package/dist/src/components/TopBar.d.ts +12 -0
- package/dist/src/components/TopBar.d.ts.map +1 -0
- package/dist/src/components/WalletAddressInput.d.ts +35 -0
- package/dist/src/components/WalletAddressInput.d.ts.map +1 -0
- package/dist/src/components/WithdrawSourceCard.d.ts +23 -0
- package/dist/src/components/WithdrawSourceCard.d.ts.map +1 -0
- package/dist/src/flow/DepositFlowContent.d.ts +19 -0
- package/dist/src/flow/DepositFlowContent.d.ts.map +1 -0
- package/dist/src/flow/FlowSheet.d.ts +3 -1
- package/dist/src/flow/FlowSheet.d.ts.map +1 -1
- package/dist/src/flow/FunkitFlowProvider.d.ts +18 -2
- package/dist/src/flow/FunkitFlowProvider.d.ts.map +1 -1
- package/dist/src/flow/WithdrawalFlowContent.d.ts +21 -0
- package/dist/src/flow/WithdrawalFlowContent.d.ts.map +1 -0
- package/dist/src/flow/useCopiedToast.d.ts +18 -0
- package/dist/src/flow/useCopiedToast.d.ts.map +1 -0
- package/dist/src/flow/withdrawalFlowConfig.d.ts +39 -0
- package/dist/src/flow/withdrawalFlowConfig.d.ts.map +1 -1
- package/dist/src/haptics/HapticsContext.d.ts +21 -0
- package/dist/src/haptics/HapticsContext.d.ts.map +1 -0
- package/dist/src/haptics/hapticTap.d.ts +13 -0
- package/dist/src/haptics/hapticTap.d.ts.map +1 -0
- package/dist/src/hooks/useIsStablecoin.d.ts +3 -0
- package/dist/src/hooks/useIsStablecoin.d.ts.map +1 -0
- package/dist/src/hooks/useNestedSheet.d.ts +17 -0
- package/dist/src/hooks/useNestedSheet.d.ts.map +1 -0
- package/dist/src/hooks/useNestedSheetHeight.d.ts +7 -0
- package/dist/src/hooks/useNestedSheetHeight.d.ts.map +1 -0
- package/dist/src/hooks/usePulse.d.ts +7 -0
- package/dist/src/hooks/usePulse.d.ts.map +1 -0
- package/dist/src/icons/FigmaSystemIcons.d.ts +2 -0
- package/dist/src/icons/FigmaSystemIcons.d.ts.map +1 -1
- package/dist/src/icons/FunIcon.d.ts +5 -2
- package/dist/src/icons/FunIcon.d.ts.map +1 -1
- package/dist/src/icons/TokenChainIcon.d.ts +6 -1
- package/dist/src/icons/TokenChainIcon.d.ts.map +1 -1
- package/dist/src/identity/IdentityContext.d.ts +12 -2
- package/dist/src/identity/IdentityContext.d.ts.map +1 -1
- package/dist/src/providers/FunkitProvider.d.ts +17 -2
- package/dist/src/providers/FunkitProvider.d.ts.map +1 -1
- package/dist/src/screens/SelectChainScreen.d.ts.map +1 -1
- package/dist/src/screens/SelectMethodScreen.d.ts.map +1 -1
- package/dist/src/screens/SelectReceiveTokenAndChainScreen.d.ts +18 -0
- package/dist/src/screens/SelectReceiveTokenAndChainScreen.d.ts.map +1 -0
- package/dist/src/screens/SelectReceiveTokenScreen.d.ts +13 -0
- package/dist/src/screens/SelectReceiveTokenScreen.d.ts.map +1 -0
- package/dist/src/screens/SelectSourceTokenScreen.d.ts +16 -0
- package/dist/src/screens/SelectSourceTokenScreen.d.ts.map +1 -0
- package/dist/src/screens/TransactionBreakdownScreen.d.ts +12 -0
- package/dist/src/screens/TransactionBreakdownScreen.d.ts.map +1 -0
- package/dist/src/screens/WithdrawAddressScreen.d.ts +48 -0
- package/dist/src/screens/WithdrawAddressScreen.d.ts.map +1 -0
- package/dist/src/screens/WithdrawAmountScreen.d.ts +53 -0
- package/dist/src/screens/WithdrawAmountScreen.d.ts.map +1 -0
- package/dist/src/screens/WithdrawCompleteScreen.d.ts +15 -4
- package/dist/src/screens/WithdrawCompleteScreen.d.ts.map +1 -1
- package/dist/src/screens/WithdrawCryptoComplete.d.ts +8 -1
- package/dist/src/screens/WithdrawCryptoComplete.d.ts.map +1 -1
- package/dist/src/screens/WithdrawCryptoSteps.d.ts +39 -0
- package/dist/src/screens/WithdrawCryptoSteps.d.ts.map +1 -0
- package/dist/src/swapped/SwappedScreen.d.ts.map +1 -1
- package/dist/src/swapped/SwappedScreenShell.d.ts +2 -1
- package/dist/src/swapped/SwappedScreenShell.d.ts.map +1 -1
- package/dist/src/swapped/SwappedWithdrawScreen.d.ts.map +1 -1
- package/dist/src/transfer/clipboard.d.ts +22 -0
- package/dist/src/transfer/clipboard.d.ts.map +1 -1
- package/dist/src/utils/amountGlyphs.d.ts +15 -0
- package/dist/src/utils/amountGlyphs.d.ts.map +1 -0
- package/dist/src/utils/assetGrid.d.ts +20 -0
- package/dist/src/utils/assetGrid.d.ts.map +1 -0
- package/dist/src/utils/executionErrorMessage.d.ts +13 -0
- package/dist/src/utils/executionErrorMessage.d.ts.map +1 -0
- package/dist/src/utils/formatAmount.d.ts +21 -0
- package/dist/src/utils/formatAmount.d.ts.map +1 -0
- package/dist/src/utils/motion.d.ts +3 -0
- package/dist/src/utils/motion.d.ts.map +1 -0
- package/dist/src/utils/numpadInput.d.ts +14 -0
- package/dist/src/utils/numpadInput.d.ts.map +1 -0
- package/dist/src/utils/safeArea.d.ts +3 -0
- package/dist/src/utils/safeArea.d.ts.map +1 -0
- package/dist/src/withdrawal/receiveDestination.d.ts +11 -0
- package/dist/src/withdrawal/receiveDestination.d.ts.map +1 -0
- package/dist/src/withdrawal/sourceToken.d.ts +4 -11
- package/dist/src/withdrawal/sourceToken.d.ts.map +1 -1
- package/dist/src/withdrawal/useCryptoWithdrawalExecution.d.ts +8 -2
- package/dist/src/withdrawal/useCryptoWithdrawalExecution.d.ts.map +1 -1
- package/dist/src/withdrawal/useCryptoWithdrawalForm.d.ts +89 -0
- package/dist/src/withdrawal/useCryptoWithdrawalForm.d.ts.map +1 -0
- package/dist/src/withdrawal/useCryptoWithdrawalSubmit.d.ts +37 -0
- package/dist/src/withdrawal/useCryptoWithdrawalSubmit.d.ts.map +1 -0
- package/dist/src/withdrawal/useCryptoWithdrawalValidation.d.ts.map +1 -1
- package/dist/src/withdrawal/useSourceTokenUsdPrice.d.ts +20 -0
- package/dist/src/withdrawal/useSourceTokenUsdPrice.d.ts.map +1 -0
- package/dist/src/withdrawal/useWithdrawalAmountInput.d.ts +38 -0
- package/dist/src/withdrawal/useWithdrawalAmountInput.d.ts.map +1 -0
- package/dist/src/withdrawal/useWithdrawalRisk.d.ts +2 -2
- package/dist/src/withdrawal/useWithdrawalRisk.d.ts.map +1 -1
- package/dist/src/withdrawal/useWithdrawalStatus.d.ts +6 -2
- package/dist/src/withdrawal/useWithdrawalStatus.d.ts.map +1 -1
- package/dist/src/withdrawal/validation.d.ts +24 -6
- package/dist/src/withdrawal/validation.d.ts.map +1 -1
- package/package.json +12 -3
- package/dist/src/components/AmountInput.d.ts +0 -40
- package/dist/src/components/AmountInput.d.ts.map +0 -1
- package/dist/src/components/WithdrawFeeSummary.d.ts +0 -17
- package/dist/src/components/WithdrawFeeSummary.d.ts.map +0 -1
- package/dist/src/screens/SelectDestinationScreen.d.ts +0 -19
- package/dist/src/screens/SelectDestinationScreen.d.ts.map +0 -1
- package/dist/src/screens/WithdrawCryptoCta.d.ts +0 -20
- package/dist/src/screens/WithdrawCryptoCta.d.ts.map +0 -1
- package/dist/src/screens/WithdrawCryptoForm.d.ts +0 -17
- package/dist/src/screens/WithdrawCryptoForm.d.ts.map +0 -1
- package/dist/src/screens/WithdrawCryptoScreen.d.ts +0 -17
- package/dist/src/screens/WithdrawCryptoScreen.d.ts.map +0 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** What a character in the amount is, which is what decides how it moves. */
|
|
2
|
+
export type AmountGlyphKind = 'prefix' | 'placeholder' | 'digit';
|
|
3
|
+
export interface AmountGlyph {
|
|
4
|
+
/** Identity across renders: what mounts is what animates in. */
|
|
5
|
+
key: string;
|
|
6
|
+
char: string;
|
|
7
|
+
kind: AmountGlyphKind;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The amount split into the characters that animate independently. Digits are
|
|
11
|
+
* keyed from the left, so appending or deleting at the right mounts or unmounts
|
|
12
|
+
* exactly that character and an inserted separator shifts the rest along.
|
|
13
|
+
*/
|
|
14
|
+
export declare function amountGlyphs(value: string, prefix: string): AmountGlyph[];
|
|
15
|
+
//# sourceMappingURL=amountGlyphs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amountGlyphs.d.ts","sourceRoot":"","sources":["../../../src/utils/amountGlyphs.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,aAAa,GAAG,OAAO,CAAA;AAEhE,MAAM,WAAW,WAAW;IAC1B,gEAAgE;IAChE,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,eAAe,CAAA;CACtB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,EAAE,CAezE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const ASSET_GRID_COLUMNS = 5;
|
|
2
|
+
export declare const ASSET_GRID_GAP = 16;
|
|
3
|
+
/** Shared so a cell's selection ring lands on the circle the caller passed it. */
|
|
4
|
+
export declare const ASSET_GRID_AVATAR_SIZE = 58;
|
|
5
|
+
/**
|
|
6
|
+
* The cells a capped grid offers, and how many the `+N` affordance stands for.
|
|
7
|
+
*
|
|
8
|
+
* - `mustShow` takes the **last** slot when the head would have hidden it, so a
|
|
9
|
+
* pick made behind the `+N` row comes back without adding a row or moving any
|
|
10
|
+
* other cell. Matched by identity.
|
|
11
|
+
* - A non-positive `capacity` means no cap, so a caller still resolving its limit
|
|
12
|
+
* shows what it has rather than an empty grid.
|
|
13
|
+
*/
|
|
14
|
+
export declare function gridCells<T>(items: T[], capacity: number, mustShow?: T): {
|
|
15
|
+
cells: T[];
|
|
16
|
+
overflowCount: number;
|
|
17
|
+
};
|
|
18
|
+
/** A non-positive `size` can't advance the cursor, so it stays one row. */
|
|
19
|
+
export declare function chunk<T>(items: T[], size: number): T[][];
|
|
20
|
+
//# sourceMappingURL=assetGrid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assetGrid.d.ts","sourceRoot":"","sources":["../../../src/utils/assetGrid.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,IAAI,CAAA;AACnC,eAAO,MAAM,cAAc,KAAK,CAAA;AAChC,kFAAkF;AAClF,eAAO,MAAM,sBAAsB,KAAK,CAAA;AAExC;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,CAAC,EACzB,KAAK,EAAE,CAAC,EAAE,EACV,QAAQ,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,CAAC,GACX;IAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAavC;AAED,2EAA2E;AAC3E,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CASxD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { WalletExecutionErrorCode } from '@funkit/connect-core';
|
|
2
|
+
import type { TFunction } from 'i18next';
|
|
3
|
+
/**
|
|
4
|
+
* What the user reads for a failure core classified. Web's copy, per cause.
|
|
5
|
+
*
|
|
6
|
+
* A cause core could name gets that copy: it is translated and says what to do,
|
|
7
|
+
* which no provider string does. Everything else falls back to the error's own
|
|
8
|
+
* text — "please try again" is the one message that helps nobody, and the
|
|
9
|
+
* failures that land here are the ones neither we nor the user can otherwise
|
|
10
|
+
* diagnose. Truncated, since a relay error can run to paragraphs.
|
|
11
|
+
*/
|
|
12
|
+
export declare function executionErrorMessage(t: TFunction, code: WalletExecutionErrorCode, message?: string): string;
|
|
13
|
+
//# sourceMappingURL=executionErrorMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executionErrorMessage.d.ts","sourceRoot":"","sources":["../../../src/utils/executionErrorMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAMxC;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,CAAC,EAAE,SAAS,EACZ,IAAI,EAAE,wBAAwB,EAC9B,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAYR"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `1062.11` → `1,062.11`. The fraction is passed through untouched: rounding a
|
|
3
|
+
* balance would show the user a number they can't withdraw.
|
|
4
|
+
*/
|
|
5
|
+
export declare function groupThousands(amount: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* The fraction a token amount is shown to, matching web's `ASSET_DECIMALS` (see
|
|
8
|
+
* the checkout's `InputAmount/utils.ts`) so the two flows read the same.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ASSET_DECIMALS = 5;
|
|
11
|
+
/**
|
|
12
|
+
* `99.780000` → `99.78`, capped at {@link ASSET_DECIMALS}.
|
|
13
|
+
*
|
|
14
|
+
* Truncated rather than rounded: a figure the recipient won't actually get is
|
|
15
|
+
* worse than one digit less of it. Trailing zeros go, so a round amount reads as
|
|
16
|
+
* one.
|
|
17
|
+
*/
|
|
18
|
+
export declare function formatTokenAmount(amount: string, maxDecimals?: number): string;
|
|
19
|
+
/** `99.94` → `$99.94`. Two decimals, as every USD figure in the design is. */
|
|
20
|
+
export declare function formatUsd(value: number): string;
|
|
21
|
+
//# sourceMappingURL=formatAmount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatAmount.d.ts","sourceRoot":"","sources":["../../../src/utils/formatAmount.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,IAAI,CAAA;AAE/B;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,WAAW,GAAE,MAAuB,GACnC,MAAM,CAKR;AAED,8EAA8E;AAC9E,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"motion.d.ts","sourceRoot":"","sources":["../../../src/utils/motion.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe,MAAM,CAAA;AAClC,eAAO,MAAM,aAAa,yDAAkC,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type NumpadDigit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
|
|
2
|
+
export type NumpadKey = NumpadDigit | '.' | 'backspace';
|
|
3
|
+
/**
|
|
4
|
+
* The typed amount after one keypress, as a decimal string.
|
|
5
|
+
*
|
|
6
|
+
* - A lone `.` is not a number any parser accepts, so the leading zero is
|
|
7
|
+
* written for the user; a second point, and any point at all on a 0-decimal
|
|
8
|
+
* token, is refused rather than swallowed later.
|
|
9
|
+
* - `0` is a placeholder rather than a leading digit, so typing `5` gives `5`.
|
|
10
|
+
* - Fraction digits stop at the token's `decimals`: past that the input is dust
|
|
11
|
+
* the transfer can't carry, and it would silently truncate at signing time.
|
|
12
|
+
*/
|
|
13
|
+
export declare function applyNumpadKey(value: string, key: NumpadKey, maxDecimals?: number): string;
|
|
14
|
+
//# sourceMappingURL=numpadInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numpadInput.d.ts","sourceRoot":"","sources":["../../../src/utils/numpadInput.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,WAAW,GACnB,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,CAAA;AAEP,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,GAAG,GAAG,WAAW,CAAA;AAIvD;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,SAAS,EACd,WAAW,CAAC,EAAE,MAAM,GACnB,MAAM,CAmBR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safeArea.d.ts","sourceRoot":"","sources":["../../../src/utils/safeArea.ts"],"names":[],"mappings":"AAKA,iFAAiF;AACjF,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE9D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DestinationChain } from './useWithdrawalDestinationTokens';
|
|
2
|
+
/** Nothing picked rules nothing out. */
|
|
3
|
+
export declare function chainCarries(chain: DestinationChain, token: string | undefined): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* The preferred chain if it carries the token, else the first that does — keeping
|
|
6
|
+
* a still-valid preference is what stops a new token moving the network under it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function chainForToken(chains: DestinationChain[], token: string, preferredChainId: number | undefined): number | undefined;
|
|
9
|
+
/** Deduped, curated order intact. */
|
|
10
|
+
export declare function receivableTokens(chains: DestinationChain[]): string[];
|
|
11
|
+
//# sourceMappingURL=receiveDestination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"receiveDestination.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/receiveDestination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAExE,wCAAwC;AACxC,wBAAgB,YAAY,CAC1B,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,OAAO,CAET;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,gBAAgB,EAAE,EAC1B,KAAK,EAAE,MAAM,EACb,gBAAgB,EAAE,MAAM,GAAG,SAAS,GACnC,MAAM,GAAG,SAAS,CAIpB;AAED,qCAAqC;AACrC,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,EAAE,CAErE"}
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import type { WithdrawalFlowConfig, WithdrawalSourceTokenOption
|
|
1
|
+
import type { WithdrawalFlowConfig, WithdrawalSourceTokenOption } from '../flow/withdrawalFlowConfig';
|
|
2
2
|
/**
|
|
3
3
|
* The source tokens the user may pick between. A host with one source omits
|
|
4
4
|
* `sourceTokens`, leaving the single `sourceToken` as the only option.
|
|
5
|
-
*/
|
|
6
|
-
export declare function resolveWithdrawalSourceTokens(config: Pick<WithdrawalFlowConfig, 'sourceToken' | 'sourceTokens'>): WithdrawalSourceTokenOption[];
|
|
7
|
-
/**
|
|
8
|
-
* Resolve the integrator's `withdrawalSourceTokenBalance` callback to a numeric
|
|
9
|
-
* string. Port of web's `resolveWithdrawalSourceTokenBalance`.
|
|
10
5
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* yields `'0'`, never `undefined`: a broken callback must not read as "unknown"
|
|
14
|
-
* and let the form fall through to some other balance.
|
|
6
|
+
* Stays local to React Native: web's option type is keyed by symbol and carries
|
|
7
|
+
* per-option checkout data, so there is no shared shape to resolve against.
|
|
15
8
|
*/
|
|
16
|
-
export declare function
|
|
9
|
+
export declare function resolveWithdrawalSourceTokens(config: Pick<WithdrawalFlowConfig, 'sourceToken' | 'sourceTokens'>): WithdrawalSourceTokenOption[];
|
|
17
10
|
//# sourceMappingURL=sourceToken.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sourceToken.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/sourceToken.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sourceToken.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/sourceToken.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,2BAA2B,EAC5B,MAAM,8BAA8B,CAAA;AAErC;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,IAAI,CAAC,oBAAoB,EAAE,aAAa,GAAG,cAAc,CAAC,GACjE,2BAA2B,EAAE,CAG/B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CheckoutQuoteResponse, type
|
|
1
|
+
import { type CheckoutQuoteResponse, type WalletExecutionErrorCode } from '@funkit/connect-core';
|
|
2
2
|
import type { WithdrawalFlowCallbacks, WithdrawalFlowConfig, WithdrawalToken } from '../flow/withdrawalFlowConfig';
|
|
3
3
|
export type CryptoWithdrawalSubmission = {
|
|
4
4
|
status: 'idle';
|
|
@@ -13,7 +13,13 @@ export type CryptoWithdrawalSubmission = {
|
|
|
13
13
|
amount: string;
|
|
14
14
|
} | {
|
|
15
15
|
status: 'failed';
|
|
16
|
-
code:
|
|
16
|
+
code: WalletExecutionErrorCode;
|
|
17
|
+
/**
|
|
18
|
+
* The error's own text. Read by the form only where the classified cause
|
|
19
|
+
* says nothing the user can act on — a failure the SDK cannot name is
|
|
20
|
+
* better reported in the provider's words than as "please try again".
|
|
21
|
+
*/
|
|
22
|
+
message: string;
|
|
17
23
|
};
|
|
18
24
|
export interface UseCryptoWithdrawalExecutionParams {
|
|
19
25
|
config: WithdrawalFlowConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCryptoWithdrawalExecution.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useCryptoWithdrawalExecution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAE1B,KAAK,
|
|
1
|
+
{"version":3,"file":"useCryptoWithdrawalExecution.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useCryptoWithdrawalExecution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAE1B,KAAK,wBAAwB,EAM9B,MAAM,sBAAsB,CAAA;AAG7B,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,EAChB,MAAM,8BAA8B,CAAA;AA4CrC,MAAM,MAAM,0BAA0B,GAClC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAClB;IAAE,MAAM,EAAE,YAAY,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9C;IACE,MAAM,EAAE,WAAW,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;IACpB,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAA;CACf,GACD;IACE,MAAM,EAAE,QAAQ,CAAA;IAChB,IAAI,EAAE,wBAAwB,CAAA;IAC9B;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAEL,MAAM,WAAW,kCAAkC;IACjD,MAAM,EAAE,oBAAoB,CAAA;IAC5B,WAAW,EAAE,eAAe,CAAA;IAC5B,gBAAgB,EAAE,eAAe,CAAA;IACjC,SAAS,EAAE,uBAAuB,CAAA;CACnC;AAED;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,SAAS,GACV,EAAE,kCAAkC;;mDAY9B;QACD,yEAAyE;QACzE,KAAK,EAAE,qBAAqB,CAAA;QAC5B,gBAAgB,EAAE,MAAM,CAAA;QACxB,MAAM,EAAE,MAAM,CAAA;KACf;;EAwFJ"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { type WithdrawalAmountValidation } from '@funkit/connect-core';
|
|
2
|
+
import type { WithdrawalFlowConfig } from '../flow/withdrawalFlowConfig';
|
|
3
|
+
import { type WithdrawCtaBlocker } from './validation';
|
|
4
|
+
/** What the crypto withdrawal's screens read and write. */
|
|
5
|
+
export type CryptoWithdrawalForm = ReturnType<typeof useCryptoWithdrawalForm>;
|
|
6
|
+
/**
|
|
7
|
+
* One withdrawal in progress, across the screens that build it: the amount, the
|
|
8
|
+
* recipient and the fees are asked for a step at a time, and all of it is priced
|
|
9
|
+
* against the same quote.
|
|
10
|
+
*
|
|
11
|
+
* Held above the screens rather than inside one of them, so a step can be added
|
|
12
|
+
* (or reordered) without the state moving house — and so the quote isn't thrown
|
|
13
|
+
* away and re-fetched on every navigation.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useCryptoWithdrawalForm({ config, quoteInputFeeTokens, }: {
|
|
16
|
+
config: WithdrawalFlowConfig;
|
|
17
|
+
/**
|
|
18
|
+
* A flat fee the venue takes off the withdrawal before it is quoted, in
|
|
19
|
+
* source-token units, or 0.
|
|
20
|
+
*/
|
|
21
|
+
quoteInputFeeTokens: number;
|
|
22
|
+
}): {
|
|
23
|
+
recipient: string;
|
|
24
|
+
setRecipient: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
25
|
+
sourceOptions: import("../..").WithdrawalSourceTokenOption[];
|
|
26
|
+
selectedSourceIndex: number;
|
|
27
|
+
sourceOption: import("../..").WithdrawalSourceTokenOption;
|
|
28
|
+
sourceToken: import("../..").WithdrawalToken;
|
|
29
|
+
sourceLabel: string;
|
|
30
|
+
sourceDecimals: number | undefined;
|
|
31
|
+
balance: string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Records the decision and clears the amount: it was in the previous token's
|
|
34
|
+
* units, and the balance and minimum it was checked against are the new
|
|
35
|
+
* token's. Returns whether the source actually moved.
|
|
36
|
+
*/
|
|
37
|
+
selectSource: (index: number) => boolean;
|
|
38
|
+
destinationChains: import("./useWithdrawalDestinationTokens").DestinationChain[];
|
|
39
|
+
destinationToken: import("../..").WithdrawalToken | undefined;
|
|
40
|
+
selectDestinationToken: (chainId: number, symbol: string) => void;
|
|
41
|
+
isLoadingDestinations: boolean;
|
|
42
|
+
isRecipientBlacklisted: boolean;
|
|
43
|
+
amountValidation: WithdrawalAmountValidation;
|
|
44
|
+
ctaBlocker: WithdrawCtaBlocker | undefined;
|
|
45
|
+
risk: import("./useWithdrawalRisk").WithdrawalRiskResult;
|
|
46
|
+
/**
|
|
47
|
+
* Whether what has been typed is a wallet address at all — `undefined` while
|
|
48
|
+
* the field is empty. Being one doesn't make it usable: the blacklist and the
|
|
49
|
+
* destination's chain are the separate verdicts in `recipientError`.
|
|
50
|
+
*/
|
|
51
|
+
isRecipientAddress: boolean | undefined;
|
|
52
|
+
/** Why a well-formed address still can't be used. */
|
|
53
|
+
recipientError: string | undefined;
|
|
54
|
+
/** Screening's non-blocking verdict; the submit is what it gates. */
|
|
55
|
+
recipientWarning: string | undefined;
|
|
56
|
+
/** Enough to leave the recipient step, which the amount's problems don't hold. */
|
|
57
|
+
canConfirmRecipient: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Fail closed: only a completed, clean screening lets the withdrawal through,
|
|
60
|
+
* and only while the quote on screen is the one for what the field says —
|
|
61
|
+
* mid-edit the query is disabled and `quote` still holds the last price.
|
|
62
|
+
*/
|
|
63
|
+
canSubmit: boolean;
|
|
64
|
+
quote: import("./useCryptoWithdrawalQuote").CryptoWithdrawalQuoteView | undefined;
|
|
65
|
+
quoteAmount: string;
|
|
66
|
+
/** Destination-token units, absent until the quote matches what is typed. */
|
|
67
|
+
receiveAmount: string | undefined;
|
|
68
|
+
receiveUsd: number | undefined;
|
|
69
|
+
receiveFloorUsd: number | undefined;
|
|
70
|
+
isQuoteLoading: boolean;
|
|
71
|
+
isQuoteError: boolean;
|
|
72
|
+
isSettled: boolean;
|
|
73
|
+
isAmountBelowFee: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* The amount step's own gate: `ctaBlocker` also weighs the recipient, which
|
|
76
|
+
* isn't asked for until the step after.
|
|
77
|
+
*/
|
|
78
|
+
amountError: string | undefined;
|
|
79
|
+
canContinue: boolean;
|
|
80
|
+
input: string;
|
|
81
|
+
setInput: (next: string) => void;
|
|
82
|
+
inUsd: boolean;
|
|
83
|
+
swapDenomination: () => void;
|
|
84
|
+
canSwapDenomination: boolean;
|
|
85
|
+
amountUsd: string | undefined;
|
|
86
|
+
amount: string;
|
|
87
|
+
setAmount: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=useCryptoWithdrawalForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCryptoWithdrawalForm.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useCryptoWithdrawalForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAKhC,MAAM,sBAAsB,CAAA;AAI7B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AAWxE,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,cAAc,CAAA;AAmB7E,2DAA2D;AAC3D,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE7E;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,MAAM,EACN,mBAAmB,GACpB,EAAE;IACD,MAAM,EAAE,oBAAoB,CAAA;IAC5B;;;OAGG;IACH,mBAAmB,EAAE,MAAM,CAAA;CAC5B;;;;;;;;;;IA0IG;;;;OAIG;0BACmB,MAAM;;;;;;;;;IA0B5B;;;;OAIG;;IAGH,qDAAqD;;IAErD,qEAAqE;;IAIrE,kFAAkF;;IAElF;;;;OAIG;;;;IAUH,6EAA6E;;;;;;;;IAS7E;;;OAGG;;;;;;;;;;;EAmBN"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { WithdrawalFlowCallbacks, WithdrawalFlowConfig } from '../flow/withdrawalFlowConfig';
|
|
2
|
+
import type { CryptoWithdrawalForm } from './useCryptoWithdrawalForm';
|
|
3
|
+
/**
|
|
4
|
+
* Signing the withdrawal {@link CryptoWithdrawalForm} describes: the press, the
|
|
5
|
+
* once-only hand-off to the outcome, and what the step shows while either is in
|
|
6
|
+
* flight.
|
|
7
|
+
*
|
|
8
|
+
* Held apart from the step that renders it so the money path's invariants — one
|
|
9
|
+
* hand-off, the source the signature was actually raised against, nothing
|
|
10
|
+
* executed but the quote on screen — can be exercised without a rendered screen.
|
|
11
|
+
*/
|
|
12
|
+
/** What the recipient step is showing the withdrawal will land as. */
|
|
13
|
+
interface ReceiveLabels {
|
|
14
|
+
usdLabel: string | undefined;
|
|
15
|
+
tokenLabel: string | undefined;
|
|
16
|
+
}
|
|
17
|
+
export declare function useCryptoWithdrawalSubmit({ config, callbacks, form, receiveLabels, onSubmitted, }: {
|
|
18
|
+
config: WithdrawalFlowConfig;
|
|
19
|
+
callbacks: WithdrawalFlowCallbacks;
|
|
20
|
+
/** The withdrawal being built, which is what gets signed. */
|
|
21
|
+
form: CryptoWithdrawalForm;
|
|
22
|
+
receiveLabels: ReceiveLabels;
|
|
23
|
+
onSubmitted: (result: {
|
|
24
|
+
txHash: string;
|
|
25
|
+
amountLabel: string;
|
|
26
|
+
} & ReceiveLabels) => void;
|
|
27
|
+
}): {
|
|
28
|
+
isSubmitting: boolean;
|
|
29
|
+
/** The button holds for the price and the screening too, not only the signature. */
|
|
30
|
+
isBusy: boolean;
|
|
31
|
+
/** An unrecoverable failure from the last attempt, in the user's words. */
|
|
32
|
+
executionErrorText: string | undefined;
|
|
33
|
+
/** Executes the quote on screen. `form.canSubmit` is what gates the press. */
|
|
34
|
+
submit: () => void;
|
|
35
|
+
};
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=useCryptoWithdrawalSubmit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCryptoWithdrawalSubmit.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useCryptoWithdrawalSubmit.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,8BAA8B,CAAA;AAKrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAErE;;;;;;;;GAQG;AACH,sEAAsE;AACtE,UAAU,aAAa;IACrB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;CAC/B;AAED,wBAAgB,yBAAyB,CAAC,EACxC,MAAM,EACN,SAAS,EACT,IAAI,EACJ,aAAa,EACb,WAAW,GACZ,EAAE;IACD,MAAM,EAAE,oBAAoB,CAAA;IAC5B,SAAS,EAAE,uBAAuB,CAAA;IAClC,6DAA6D;IAC7D,IAAI,EAAE,oBAAoB,CAAA;IAC1B,aAAa,EAAE,aAAa,CAAA;IAC5B,WAAW,EAAE,CACX,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,aAAa,KAC5D,IAAI,CAAA;CACV;;IAqCG,oFAAoF;;IAKpF,2EAA2E;;IAK3E,8EAA8E;;EAmBjF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCryptoWithdrawalValidation.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useCryptoWithdrawalValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAEhC,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EAChB,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"useCryptoWithdrawalValidation.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useCryptoWithdrawalValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAEhC,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EAChB,MAAM,8BAA8B,CAAA;AAIrC,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,cAAc,CAAA;AAErB,MAAM,WAAW,0BAA0B;IACzC,oEAAoE;IACpE,sBAAsB,EAAE,OAAO,CAAA;IAC/B,gBAAgB,EAAE,0BAA0B,CAAA;IAC5C,8EAA8E;IAC9E,UAAU,EAAE,kBAAkB,GAAG,SAAS,CAAA;CAC3C;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,EAC5C,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,MAAM,EACN,SAAS,EACT,OAAO,GACR,EAAE;IACD,MAAM,EAAE,oBAAoB,CAAA;IAC5B,WAAW,EAAE,eAAe,CAAA;IAC5B,gBAAgB,EAAE,eAAe,GAAG,SAAS,CAAA;IAC7C,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B,GAAG,0BAA0B,CA2C7B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { WithdrawalToken } from '../flow/withdrawalFlowConfig';
|
|
2
|
+
/**
|
|
3
|
+
* Spot USD price of the source token, for the USD floor and ceiling the host
|
|
4
|
+
* configures (`getMinWithdrawalUSD` / `getMaxWithdrawalUSD`).
|
|
5
|
+
*
|
|
6
|
+
* A dollar stablecoin is priced from its symbol and never fetched, as web's
|
|
7
|
+
* `useAssetAddressPrice` does — it is the common withdrawal source, and the
|
|
8
|
+
* amount screen was waiting on a round trip to be told a dollar is a dollar.
|
|
9
|
+
*
|
|
10
|
+
* `0` means "unknown", which is what the core validator reads as "no price" —
|
|
11
|
+
* so a failed or in-flight lookup leaves the USD limits inert rather than
|
|
12
|
+
* judging an amount against a made-up rate. Per-token limits and the balance
|
|
13
|
+
* check are unaffected either way.
|
|
14
|
+
*
|
|
15
|
+
* Not every source has a price: Lighter's L2 assets are addressed by index, not
|
|
16
|
+
* by an ERC-20 funkit's price API knows, so that lookup 404s and core's Relay
|
|
17
|
+
* fallback is what prices them.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useSourceTokenUsdPrice(sourceToken: WithdrawalToken): number;
|
|
20
|
+
//# sourceMappingURL=useSourceTokenUsdPrice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSourceTokenUsdPrice.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useSourceTokenUsdPrice.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAanE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,eAAe,GAAG,MAAM,CAuC3E"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The amount as the user types it, and which denomination they are typing in.
|
|
3
|
+
*
|
|
4
|
+
* - `amount` never changes meaning: the quote, the validation and the signature
|
|
5
|
+
* are all in source-token units, so when typing in dollars the typed figure
|
|
6
|
+
* is held here and `amount` is what it converts to.
|
|
7
|
+
* - Held with the form rather than in the screen, which unmounts on the way to
|
|
8
|
+
* the recipient — local state would drop both on Continue.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useWithdrawalAmountInput({ amount, setAmount, sourceUsdPrice, sourceDecimals, }: {
|
|
11
|
+
/** The withdrawal amount, in source-token units. */
|
|
12
|
+
amount: string;
|
|
13
|
+
setAmount: (amount: string) => void;
|
|
14
|
+
/** Spot USD price of the source token; `0` is the price hook's "unknown". */
|
|
15
|
+
sourceUsdPrice: number;
|
|
16
|
+
/** Fraction digits the source token carries, once they're known. */
|
|
17
|
+
sourceDecimals: number | undefined;
|
|
18
|
+
}): {
|
|
19
|
+
/** What to show and edit: dollars when {@link inUsd}, else token units. */
|
|
20
|
+
input: string;
|
|
21
|
+
setInput: (next: string) => void;
|
|
22
|
+
inUsd: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Switches denomination, converting the amount rather than clearing it.
|
|
25
|
+
*
|
|
26
|
+
* - Deliberately does not re-price against a rate that moved since the
|
|
27
|
+
* figure was typed: rewriting what someone entered, under them, is worse
|
|
28
|
+
* than showing it at the rate they entered it at.
|
|
29
|
+
* - The staleness is bounded by refreshing the price on the way into this
|
|
30
|
+
* screen rather than while it is open.
|
|
31
|
+
*/
|
|
32
|
+
swapDenomination: () => void;
|
|
33
|
+
/** Offering the swap without a rate would promise one we don't have. */
|
|
34
|
+
canSwapDenomination: boolean;
|
|
35
|
+
/** What the amount is worth, or `undefined` when nothing prices it. */
|
|
36
|
+
amountUsd: string | undefined;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=useWithdrawalAmountInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWithdrawalAmountInput.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useWithdrawalAmountInput.ts"],"names":[],"mappings":"AA0CA;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,MAAM,EACN,SAAS,EACT,cAAc,EACd,cAAc,GACf,EAAE;IACD,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC,6EAA6E;IAC7E,cAAc,EAAE,MAAM,CAAA;IACtB,oEAAoE;IACpE,cAAc,EAAE,MAAM,GAAG,SAAS,CAAA;CACnC;IAqDG,2EAA2E;;qBAtBpE,MAAM;;IA0Bb;;;;;;;;OAQG;;IAEH,wEAAwE;;IAExE,uEAAuE;;EAS1E"}
|
|
@@ -9,8 +9,8 @@ export interface WithdrawalRiskResult {
|
|
|
9
9
|
* Chainalysis screening for the recipient.
|
|
10
10
|
*
|
|
11
11
|
* **Fails closed**: callers must require `isRisky === false`, so in-flight and
|
|
12
|
-
* errored both block. The chain id
|
|
13
|
-
*
|
|
12
|
+
* errored both block. The chain id scopes the screen to the destination chain,
|
|
13
|
+
* so it is part of the key (web does the same).
|
|
14
14
|
*/
|
|
15
15
|
export declare function useWithdrawalRisk(address: string, chainId: number | undefined): WithdrawalRiskResult;
|
|
16
16
|
//# sourceMappingURL=useWithdrawalRisk.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWithdrawalRisk.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useWithdrawalRisk.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,yBAAyB,mBAAmB,CAAA;AAEzD,MAAM,WAAW,oBAAoB;IACnC,oEAAoE;IACpE,OAAO,EAAE,OAAO,GAAG,SAAS,CAAA;IAC5B,UAAU,EAAE,OAAO,CAAA;IACnB,OAAO,EAAE,OAAO,CAAA;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,oBAAoB,
|
|
1
|
+
{"version":3,"file":"useWithdrawalRisk.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useWithdrawalRisk.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,yBAAyB,mBAAmB,CAAA;AAEzD,MAAM,WAAW,oBAAoB;IACnC,oEAAoE;IACpE,OAAO,EAAE,OAAO,GAAG,SAAS,CAAA;IAC5B,UAAU,EAAE,OAAO,CAAA;IACnB,OAAO,EAAE,OAAO,CAAA;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,oBAAoB,CAmCtB"}
|
|
@@ -4,11 +4,15 @@ export declare const WITHDRAWAL_STATUS_QUERY_KEY = "withdrawalStatus";
|
|
|
4
4
|
* Whether there is still anything to learn by asking again. Split out because
|
|
5
5
|
* the "record never appeared" bound is the part worth testing directly — driving
|
|
6
6
|
* it through the query would mean waiting out real poll intervals.
|
|
7
|
+
*
|
|
8
|
+
* Only answered-and-absent counts against the bound: a network or 5xx failure
|
|
9
|
+
* says nothing about the record, so giving up on one would abandon a withdrawal
|
|
10
|
+
* we could still have followed.
|
|
7
11
|
*/
|
|
8
|
-
export declare function shouldKeepPollingStatus({ status, hasRecord,
|
|
12
|
+
export declare function shouldKeepPollingStatus({ status, hasRecord, notFoundFetches, }: {
|
|
9
13
|
status: RelayExecutionStatus | undefined;
|
|
10
14
|
hasRecord: boolean;
|
|
11
|
-
|
|
15
|
+
notFoundFetches: number;
|
|
12
16
|
}): boolean;
|
|
13
17
|
export interface WithdrawalStatusResult {
|
|
14
18
|
status: RelayExecutionStatus | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWithdrawalStatus.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useWithdrawalStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,oBAAoB,EAErB,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"useWithdrawalStatus.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useWithdrawalStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,oBAAoB,EAErB,MAAM,kBAAkB,CAAA;AAYzB,eAAO,MAAM,2BAA2B,qBAAqB,CAAA;AAU7D;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,MAAM,EACN,SAAS,EACT,eAAe,GAChB,EAAE;IACD,MAAM,EAAE,oBAAoB,GAAG,SAAS,CAAA;IACxC,SAAS,EAAE,OAAO,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;CACxB,GAAG,OAAO,CAGV;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,oBAAoB,GAAG,SAAS,CAAA;IACxC,wEAAwE;IACxE,WAAW,EAAE,OAAO,CAAA;IACpB,uEAAuE;IACvE,QAAQ,EAAE,OAAO,CAAA;IACjB,mEAAmE;IACnE,UAAU,EAAE,OAAO,CAAA;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,GAAG,SAAS,GACzB,sBAAsB,CAoDxB"}
|
|
@@ -11,14 +11,18 @@ export type WithdrawCtaBlocker = 'enter-recipient' | 'unsupported-recipient' | '
|
|
|
11
11
|
/**
|
|
12
12
|
* Amount limits, resolved from the host's callbacks.
|
|
13
13
|
*
|
|
14
|
-
* `sourceTokenUsdPrice`
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* `sourceTokenUsdPrice` of 0 means unknown, not free: the core validator reads
|
|
15
|
+
* it as "no price" and leaves the USD floor and ceiling inert, while the
|
|
16
|
+
* per-token minimum and the balance check still apply. Sources whose price the
|
|
17
|
+
* API cannot resolve (Lighter's index-addressed L2 assets) run that way.
|
|
18
18
|
*/
|
|
19
|
-
export declare function validateAmount({ config, sourceToken, amount, balance, }: {
|
|
20
|
-
config: Pick<WithdrawalFlowConfig, 'getMinWithdrawalAmount' | 'getMinWithdrawalUSD' | 'getMaxWithdrawalUSD'>;
|
|
19
|
+
export declare function validateAmount({ config, sourceToken, sourceTokenUsdPrice, sourceTokenDecimals, amount, balance, }: {
|
|
20
|
+
config: Pick<WithdrawalFlowConfig, 'getMinWithdrawalAmount' | 'getMinWithdrawalUSD' | 'getMaxWithdrawalUSD' | 'getMaxWithdrawalAmount'>;
|
|
21
21
|
sourceToken: WithdrawalToken;
|
|
22
|
+
/** Spot USD price of one source token; 0 when unknown. */
|
|
23
|
+
sourceTokenUsdPrice?: number;
|
|
24
|
+
/** Fraction digits the source carries; caps how fine the USD floor gets. */
|
|
25
|
+
sourceTokenDecimals?: number;
|
|
22
26
|
amount: string;
|
|
23
27
|
balance: string | undefined;
|
|
24
28
|
}): WithdrawalAmountValidation;
|
|
@@ -45,4 +49,18 @@ export declare function getWithdrawCtaBlocker({ recipientAddress, isRecipientBla
|
|
|
45
49
|
amountValidation: WithdrawalAmountValidation;
|
|
46
50
|
destinationToken: WithdrawalToken | undefined;
|
|
47
51
|
}): WithdrawCtaBlocker | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the venue's flat fee leaves nothing for the quote to price.
|
|
54
|
+
*
|
|
55
|
+
* - Two ways to leave nothing: the fee meets or exceeds the amount, or the
|
|
56
|
+
* remainder is under one base unit of the source token — `parseUnits` trims
|
|
57
|
+
* the extra digits, so a positive remainder still reaches the quote as 0.
|
|
58
|
+
* - Undefined `decimals` means the read hasn't landed. The quote can't run
|
|
59
|
+
* without it either, so the fee-only verdict stands until it does.
|
|
60
|
+
*/
|
|
61
|
+
export declare function isAmountBelowQuoteFee({ amount, feeTokenAmount, decimals, }: {
|
|
62
|
+
amount: string;
|
|
63
|
+
feeTokenAmount: number;
|
|
64
|
+
decimals: number | undefined;
|
|
65
|
+
}): boolean;
|
|
48
66
|
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAMhC,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EAChB,MAAM,8BAA8B,CAAA;AAMrC;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAC1B,iBAAiB,GACjB,uBAAuB,GACvB,0BAA0B,GAC1B,cAAc,GACd,cAAc,GACd,oBAAoB,GACpB,mBAAmB,CAAA;AAEvB;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,MAAM,EACN,OAAO,GACR,EAAE;IACD,MAAM,EAAE,IAAI,CACV,oBAAoB,EAClB,wBAAwB,GACxB,qBAAqB,GACrB,qBAAqB,GACrB,wBAAwB,CAC3B,CAAA;IACD,WAAW,EAAE,eAAe,CAAA;IAC5B,0DAA0D;IAC1D,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,4EAA4E;IAC5E,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B,GAAG,0BAA0B,CAmC7B;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,gBAAgB,GACjB,EAAE;IACD,gBAAgB,EAAE,MAAM,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,eAAe,CAAA;IAC5B,gBAAgB,EAAE,eAAe,GAAG,SAAS,CAAA;CAC9C,GAAG,OAAO,CAOV;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,MAAM,EACN,gBAAgB,EAChB,gBAAgB,GACjB,EAAE;IACD,gBAAgB,EAAE,MAAM,CAAA;IACxB,sBAAsB,EAAE,OAAO,CAAA;IAC/B,uBAAuB,EAAE,OAAO,CAAA;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,gBAAgB,EAAE,0BAA0B,CAAA;IAC5C,gBAAgB,EAAE,eAAe,GAAG,SAAS,CAAA;CAC9C,GAAG,kBAAkB,GAAG,SAAS,CAiBjC;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EACN,cAAc,EACd,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;CAC7B,GAAG,OAAO,CAWV"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funkit/connect-rn",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "React Native bindings for @funkit/connect. Re-exports the headless @funkit/connect-core logic; the RN platform halves (Restyle theme, WebView Swapped transport, Transfer/Swapped screens, logging) land in later releases.",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
"types": "./dist/index.d.ts",
|
|
15
15
|
"default": "./dist/index.js"
|
|
16
16
|
},
|
|
17
|
+
"./clients/*": {
|
|
18
|
+
"types": "./dist/clients/*.d.ts",
|
|
19
|
+
"default": "./dist/clients/*.js"
|
|
20
|
+
},
|
|
17
21
|
"./package.json": "./package.json"
|
|
18
22
|
},
|
|
19
23
|
"sideEffects": false,
|
|
@@ -32,9 +36,9 @@
|
|
|
32
36
|
"license": "MIT",
|
|
33
37
|
"dependencies": {
|
|
34
38
|
"@shopify/restyle": "^2.4.5",
|
|
35
|
-
"@funkit/api-base": "7.
|
|
39
|
+
"@funkit/api-base": "7.1.0",
|
|
36
40
|
"@funkit/chains": "2.2.0",
|
|
37
|
-
"@funkit/connect-core": "
|
|
41
|
+
"@funkit/connect-core": "3.1.0"
|
|
38
42
|
},
|
|
39
43
|
"peerDependencies": {
|
|
40
44
|
"@gorhom/bottom-sheet": ">=5",
|
|
@@ -46,6 +50,7 @@
|
|
|
46
50
|
"react": ">=18",
|
|
47
51
|
"react-native": ">=0.74",
|
|
48
52
|
"react-native-gesture-handler": ">=2.0.0",
|
|
53
|
+
"react-native-haptic-feedback": ">=2",
|
|
49
54
|
"react-native-qrcode-svg": ">=6.3.0",
|
|
50
55
|
"react-native-reanimated": ">=3.0.0",
|
|
51
56
|
"react-native-safe-area-context": ">=4.0.0",
|
|
@@ -67,6 +72,7 @@
|
|
|
67
72
|
"react-dom": "^19.0.0",
|
|
68
73
|
"react-native": "0.85.3",
|
|
69
74
|
"react-native-gesture-handler": "2.31.2",
|
|
75
|
+
"react-native-haptic-feedback": "^3.0.0",
|
|
70
76
|
"react-native-qrcode-svg": "6.3.21",
|
|
71
77
|
"react-native-reanimated": "4.3.1",
|
|
72
78
|
"react-native-safe-area-context": "5.4.0",
|
|
@@ -89,6 +95,9 @@
|
|
|
89
95
|
"peerDependenciesMeta": {
|
|
90
96
|
"@react-native-clipboard/clipboard": {
|
|
91
97
|
"optional": true
|
|
98
|
+
},
|
|
99
|
+
"react-native-haptic-feedback": {
|
|
100
|
+
"optional": true
|
|
92
101
|
}
|
|
93
102
|
},
|
|
94
103
|
"scripts": {
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Keep only what a decimal amount can contain: digits and a single decimal
|
|
3
|
-
* point. Normalised rather than trusted — a `decimal-pad` emits the locale's
|
|
4
|
-
* separator (`,` across much of Europe) and a paste bypasses the keypad.
|
|
5
|
-
*
|
|
6
|
-
* Separators are read by shape, not by locale, so `1.000,50` and `1,000.50`
|
|
7
|
-
* both give 1000.50:
|
|
8
|
-
* - A lone separator is the decimal point. A pasted `1,000` therefore reads as
|
|
9
|
-
* one — ambiguous by construction, and the field echoes what we read.
|
|
10
|
-
* - Grouping needs triples throughout AND one separator character, which is
|
|
11
|
-
* what tells `1,000,123` (a million) from `1,000.123` (a thousand).
|
|
12
|
-
* - Anything else is a mistyped decimal (`1.5.`): the first separator stands.
|
|
13
|
-
*/
|
|
14
|
-
export declare function sanitizeDecimalInput(raw: string): string;
|
|
15
|
-
export interface AmountInputProps {
|
|
16
|
-
/** Amount in the source token's units, as typed. */
|
|
17
|
-
value: string;
|
|
18
|
-
onChangeValue: (value: string) => void;
|
|
19
|
-
/** Rendered beside the amount, e.g. `USDC`. */
|
|
20
|
-
tokenSymbol: string;
|
|
21
|
-
/** Spendable balance line under the amount, e.g. `120.5 USDC available`. */
|
|
22
|
-
balanceLabel?: string;
|
|
23
|
-
/** Fills the field with the whole balance. Omit to hide the button. */
|
|
24
|
-
onPressMax?: () => void;
|
|
25
|
-
maxLabel?: string;
|
|
26
|
-
/** Shown in place of the balance line; also tints the amount. */
|
|
27
|
-
errorText?: string;
|
|
28
|
-
autoFocus?: boolean;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* The withdrawal amount field: a large amount that behaves like a display but
|
|
32
|
-
* is editable, with the balance and a Max shortcut underneath.
|
|
33
|
-
*
|
|
34
|
-
* Uses gorhom's `BottomSheetTextInput`, but the sheet is lifted by
|
|
35
|
-
* `FlowSheet`'s own spacer — gorhom's native avoidance is inert under
|
|
36
|
-
* `enableDynamicSizing` (see `useKeyboardHeight`), so the screen hosting this
|
|
37
|
-
* must set `keyboardAvoidEnabled`.
|
|
38
|
-
*/
|
|
39
|
-
export declare function AmountInput({ value, onChangeValue, tokenSymbol, balanceLabel, onPressMax, maxLabel, errorText, autoFocus, }: AmountInputProps): import("react").JSX.Element;
|
|
40
|
-
//# sourceMappingURL=AmountInput.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AmountInput.d.ts","sourceRoot":"","sources":["../../../src/components/AmountInput.tsx"],"names":[],"mappings":"AAKA;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAiBxD;AAUD,MAAM,WAAW,gBAAgB;IAC/B,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,+CAA+C;IAC/C,WAAW,EAAE,MAAM,CAAA;IACnB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,uEAAuE;IACvE,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,aAAa,EACb,WAAW,EACX,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,SAAS,EACT,SAAS,GACV,EAAE,gBAAgB,+BAwElB"}
|