@funkit/connect-rn 3.4.0 → 3.6.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 +73 -0
- package/dist/chunk-BNWA4HKO.js +1217 -0
- package/dist/chunk-BNWA4HKO.js.map +7 -0
- package/dist/clients/lighter/index.d.ts +5 -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/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 +323 -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 +4679 -3578
- package/dist/index.js.map +4 -4
- package/dist/src/components/AmountInput.d.ts +40 -0
- package/dist/src/components/AmountInput.d.ts.map +1 -0
- package/dist/src/components/RecipientAddressInput.d.ts +28 -0
- package/dist/src/components/RecipientAddressInput.d.ts.map +1 -0
- package/dist/src/components/WithdrawFeeSummary.d.ts +23 -0
- package/dist/src/components/WithdrawFeeSummary.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 +10 -1
- package/dist/src/flow/FlowSheet.d.ts.map +1 -1
- package/dist/src/flow/FunkitFlowProvider.d.ts +12 -1
- package/dist/src/flow/FunkitFlowProvider.d.ts.map +1 -1
- package/dist/src/flow/WithdrawalFlowContent.d.ts +18 -0
- package/dist/src/flow/WithdrawalFlowContent.d.ts.map +1 -0
- package/dist/src/flow/guardHostCallbacks.d.ts +11 -0
- package/dist/src/flow/guardHostCallbacks.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/useKeyboardHeight.d.ts +4 -10
- package/dist/src/flow/useKeyboardHeight.d.ts.map +1 -1
- package/dist/src/flow/withdrawalFlowConfig.d.ts +100 -9
- package/dist/src/flow/withdrawalFlowConfig.d.ts.map +1 -1
- package/dist/src/geo/useUserIpInfo.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/logging/datadogHttpLogTransport.d.ts.map +1 -1
- package/dist/src/logging/serializeLogBatch.d.ts +9 -0
- package/dist/src/logging/serializeLogBatch.d.ts.map +1 -0
- package/dist/src/providers/FunkitProvider.d.ts +9 -1
- package/dist/src/providers/FunkitProvider.d.ts.map +1 -1
- package/dist/src/screens/SelectDestinationScreen.d.ts +19 -0
- package/dist/src/screens/SelectDestinationScreen.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/WithdrawCompleteScreen.d.ts +17 -0
- package/dist/src/screens/WithdrawCompleteScreen.d.ts.map +1 -0
- package/dist/src/screens/WithdrawCryptoComplete.d.ts +16 -0
- package/dist/src/screens/WithdrawCryptoComplete.d.ts.map +1 -0
- package/dist/src/screens/WithdrawCryptoCta.d.ts +20 -0
- package/dist/src/screens/WithdrawCryptoCta.d.ts.map +1 -0
- package/dist/src/screens/WithdrawCryptoForm.d.ts +28 -0
- package/dist/src/screens/WithdrawCryptoForm.d.ts.map +1 -0
- package/dist/src/screens/WithdrawCryptoScreen.d.ts +3 -1
- package/dist/src/screens/WithdrawCryptoScreen.d.ts.map +1 -1
- 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/theme/buildFunkitTheme.d.ts +1 -0
- package/dist/src/theme/buildFunkitTheme.d.ts.map +1 -1
- package/dist/src/theme/restyle.d.ts +33 -0
- package/dist/src/theme/restyle.d.ts.map +1 -1
- package/dist/src/theme/toRestyleTheme.d.ts +3 -0
- package/dist/src/theme/toRestyleTheme.d.ts.map +1 -1
- package/dist/src/theme/tokens.d.ts +6 -0
- package/dist/src/theme/tokens.d.ts.map +1 -1
- package/dist/src/transfer/availableChains.d.ts.map +1 -1
- package/dist/src/transfer/hooks/useLighterDepositRecipientOverride.d.ts +23 -0
- package/dist/src/transfer/hooks/useLighterDepositRecipientOverride.d.ts.map +1 -0
- package/dist/src/transfer/hooks/useTransferInit.d.ts +3 -2
- package/dist/src/transfer/hooks/useTransferInit.d.ts.map +1 -1
- package/dist/src/utils/chainDisplay.d.ts +8 -0
- package/dist/src/utils/chainDisplay.d.ts.map +1 -0
- package/dist/src/utils/customers.d.ts +1 -0
- package/dist/src/utils/customers.d.ts.map +1 -1
- package/dist/src/withdrawal/flatFee.d.ts +9 -0
- package/dist/src/withdrawal/flatFee.d.ts.map +1 -0
- package/dist/src/withdrawal/sourceToken.d.ts +17 -0
- package/dist/src/withdrawal/sourceToken.d.ts.map +1 -0
- package/dist/src/withdrawal/useCryptoWithdrawalExecution.d.ts +44 -0
- package/dist/src/withdrawal/useCryptoWithdrawalExecution.d.ts.map +1 -0
- package/dist/src/withdrawal/useCryptoWithdrawalQuote.d.ts +42 -0
- package/dist/src/withdrawal/useCryptoWithdrawalQuote.d.ts.map +1 -0
- package/dist/src/withdrawal/useCryptoWithdrawalValidation.d.ts +24 -0
- package/dist/src/withdrawal/useCryptoWithdrawalValidation.d.ts.map +1 -0
- package/dist/src/withdrawal/useSourceTokenDecimals.d.ts +13 -0
- package/dist/src/withdrawal/useSourceTokenDecimals.d.ts.map +1 -0
- package/dist/src/withdrawal/useWithdrawalDestinationTokens.d.ts +32 -0
- package/dist/src/withdrawal/useWithdrawalDestinationTokens.d.ts.map +1 -0
- package/dist/src/withdrawal/useWithdrawalExecution.d.ts.map +1 -1
- package/dist/src/withdrawal/useWithdrawalRisk.d.ts +16 -0
- package/dist/src/withdrawal/useWithdrawalRisk.d.ts.map +1 -0
- package/dist/src/withdrawal/useWithdrawalStatus.d.ts +31 -0
- package/dist/src/withdrawal/useWithdrawalStatus.d.ts.map +1 -0
- package/dist/src/withdrawal/validation.d.ts +48 -0
- package/dist/src/withdrawal/validation.d.ts.map +1 -0
- package/package.json +7 -3
- package/dist/src/withdrawal/publicClient.d.ts +0 -10
- package/dist/src/withdrawal/publicClient.d.ts.map +0 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type CheckoutQuoteResponse, type WalletExecutionErrorCode } from '@funkit/connect-core';
|
|
2
|
+
import type { WithdrawalFlowCallbacks, WithdrawalFlowConfig, WithdrawalToken } from '../flow/withdrawalFlowConfig';
|
|
3
|
+
export type CryptoWithdrawalSubmission = {
|
|
4
|
+
status: 'idle';
|
|
5
|
+
} | {
|
|
6
|
+
status: 'submitting';
|
|
7
|
+
stepMessage?: string;
|
|
8
|
+
} | {
|
|
9
|
+
status: 'submitted';
|
|
10
|
+
txHash: string;
|
|
11
|
+
submissionId: string;
|
|
12
|
+
/** The amount that executed, not whatever the field says by now. */
|
|
13
|
+
amount: string;
|
|
14
|
+
} | {
|
|
15
|
+
status: 'failed';
|
|
16
|
+
code: WalletExecutionErrorCode;
|
|
17
|
+
};
|
|
18
|
+
export interface UseCryptoWithdrawalExecutionParams {
|
|
19
|
+
config: WithdrawalFlowConfig;
|
|
20
|
+
sourceToken: WithdrawalToken;
|
|
21
|
+
destinationToken: WithdrawalToken;
|
|
22
|
+
callbacks: WithdrawalFlowCallbacks;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Executes the quote the user approved.
|
|
26
|
+
*
|
|
27
|
+
* Both guards are read synchronously inside the async submit — before the first
|
|
28
|
+
* await — so neither may wait for a re-render: a ref for a double-tap on this
|
|
29
|
+
* mount, and a module-scoped set of in-flight withdrawals for a second press
|
|
30
|
+
* after the sheet was closed and reopened mid-execution. The set holds only
|
|
31
|
+
* while the signature is outstanding; deliberately sending the same amount to
|
|
32
|
+
* the same address again once it has settled is a legitimate withdrawal.
|
|
33
|
+
*/
|
|
34
|
+
export declare function useCryptoWithdrawalExecution({ config, sourceToken, destinationToken, callbacks, }: UseCryptoWithdrawalExecutionParams): {
|
|
35
|
+
submission: CryptoWithdrawalSubmission;
|
|
36
|
+
submit: ({ quote, recipientAddress, amount, }: {
|
|
37
|
+
/** The quote on screen — executed as-is, so fees shown are fees paid. */
|
|
38
|
+
quote: CheckoutQuoteResponse;
|
|
39
|
+
recipientAddress: string;
|
|
40
|
+
amount: string;
|
|
41
|
+
}) => Promise<void>;
|
|
42
|
+
reset: () => void;
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=useCryptoWithdrawalExecution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,GAGD;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,wBAAwB,CAAA;CAAE,CAAA;AAExD,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;;EAuFJ"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type CheckoutQuoteResponse } from '@funkit/connect-core';
|
|
2
|
+
import type { FeeBreakdownV2 } from '@funkit/api-base';
|
|
3
|
+
import type { WithdrawalToken } from '../flow/withdrawalFlowConfig';
|
|
4
|
+
export declare const CRYPTO_WITHDRAWAL_QUOTE_QUERY_KEY = "cryptoWithdrawalQuote";
|
|
5
|
+
/**
|
|
6
|
+
* How long a quote stays good for. Used for BOTH `staleTime` and
|
|
7
|
+
* `refetchInterval`, and the equality is load-bearing: with `staleTime: 0`, an
|
|
8
|
+
* `enabled` flip mid-edit remounts the query and refetches the previous key
|
|
9
|
+
* before the new amount lands, replaying a stale quote. The interval keeps it
|
|
10
|
+
* fresh regardless.
|
|
11
|
+
*/
|
|
12
|
+
export declare const QUOTE_REFRESH_INTERVAL_MS = 25000;
|
|
13
|
+
export interface CryptoWithdrawalQuoteView {
|
|
14
|
+
/** Executed as-is by the pipeline — never rebuilt from the fields below. */
|
|
15
|
+
raw: CheckoutQuoteResponse;
|
|
16
|
+
/** What the recipient gets, in destination-token units. */
|
|
17
|
+
receiveAmount: string | undefined;
|
|
18
|
+
fees: FeeBreakdownV2;
|
|
19
|
+
}
|
|
20
|
+
export interface UseCryptoWithdrawalQuoteParams {
|
|
21
|
+
sourceToken: WithdrawalToken;
|
|
22
|
+
destinationToken: WithdrawalToken | undefined;
|
|
23
|
+
recipientAddress: string;
|
|
24
|
+
/** Source-token units. Already debounced and settled by the caller. */
|
|
25
|
+
amount: string;
|
|
26
|
+
walletAddress: string;
|
|
27
|
+
/** The caller's own gate — validation, risk, blacklist (see `useQuoteGate`). */
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The EXACT_IN quote for a crypto withdrawal, refreshed on an interval so the
|
|
32
|
+
* fees on screen stay the fees that execute.
|
|
33
|
+
*
|
|
34
|
+
* The query key is the inputs themselves — no context round-trip — so a quote
|
|
35
|
+
* can never describe a different withdrawal than the form shows.
|
|
36
|
+
*/
|
|
37
|
+
export declare function useCryptoWithdrawalQuote({ sourceToken, destinationToken, recipientAddress, amount, walletAddress, enabled, }: UseCryptoWithdrawalQuoteParams): {
|
|
38
|
+
quote: CryptoWithdrawalQuoteView | undefined;
|
|
39
|
+
isLoading: boolean;
|
|
40
|
+
isError: boolean;
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=useCryptoWithdrawalQuote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCryptoWithdrawalQuote.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useCryptoWithdrawalQuote.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAK3B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAItD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAKnE,eAAO,MAAM,iCAAiC,0BAA0B,CAAA;AAExE;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,QAAS,CAAA;AAE/C,MAAM,WAAW,yBAAyB;IACxC,4EAA4E;IAC5E,GAAG,EAAE,qBAAqB,CAAA;IAC1B,2DAA2D;IAC3D,aAAa,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC,IAAI,EAAE,cAAc,CAAA;CACrB;AAED,MAAM,WAAW,8BAA8B;IAC7C,WAAW,EAAE,eAAe,CAAA;IAC5B,gBAAgB,EAAE,eAAe,GAAG,SAAS,CAAA;IAC7C,gBAAgB,EAAE,MAAM,CAAA;IACxB,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;IACrB,gFAAgF;IAChF,OAAO,EAAE,OAAO,CAAA;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,EACN,aAAa,EACb,OAAO,GACR,EAAE,8BAA8B;;;;EAiEhC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type WithdrawalAmountValidation } from '@funkit/connect-core';
|
|
2
|
+
import type { WithdrawalFlowConfig, WithdrawalToken } from '../flow/withdrawalFlowConfig';
|
|
3
|
+
import { type WithdrawCtaBlocker } from './validation';
|
|
4
|
+
export interface CryptoWithdrawalValidation {
|
|
5
|
+
/** Recipient the funds would be lost in (e.g. a token contract). */
|
|
6
|
+
isRecipientBlacklisted: boolean;
|
|
7
|
+
amountValidation: WithdrawalAmountValidation;
|
|
8
|
+
/** The single thing left to fix, or `undefined` when the form is complete. */
|
|
9
|
+
ctaBlocker: WithdrawCtaBlocker | undefined;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Everything the crypto withdrawal form knows synchronously about what the user
|
|
13
|
+
* has typed. The Statsig-backed blacklist is why this is a hook; the verdicts
|
|
14
|
+
* themselves come from the pure functions in `validation.ts`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useCryptoWithdrawalValidation({ config, sourceToken, destinationToken, amount, recipient, balance, }: {
|
|
17
|
+
config: WithdrawalFlowConfig;
|
|
18
|
+
sourceToken: WithdrawalToken;
|
|
19
|
+
destinationToken: WithdrawalToken | undefined;
|
|
20
|
+
amount: string;
|
|
21
|
+
recipient: string;
|
|
22
|
+
balance: string | undefined;
|
|
23
|
+
}): CryptoWithdrawalValidation;
|
|
24
|
+
//# sourceMappingURL=useCryptoWithdrawalValidation.d.ts.map
|
|
@@ -0,0 +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;AAErC,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,CAiC7B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { WithdrawalToken } from '../flow/withdrawalFlowConfig';
|
|
2
|
+
export declare const SOURCE_TOKEN_DECIMALS_QUERY_KEY = "sourceTokenDecimals";
|
|
3
|
+
/**
|
|
4
|
+
* Decimals for the amount conversion: the host's value when it has one,
|
|
5
|
+
* otherwise read on-chain. A stale host value would mis-scale the transfer, so
|
|
6
|
+
* the read is preferred over a guess.
|
|
7
|
+
*
|
|
8
|
+
* Its own query rather than a step inside the quote, so the read runs once per
|
|
9
|
+
* token — as soon as the form knows what it is spending — instead of on every
|
|
10
|
+
* 25-second quote refresh.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useSourceTokenDecimals(sourceToken: WithdrawalToken): number | undefined;
|
|
13
|
+
//# sourceMappingURL=useSourceTokenDecimals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSourceTokenDecimals.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useSourceTokenDecimals.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAEnE,eAAO,MAAM,+BAA+B,wBAAwB,CAAA;AAEpE;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,eAAe,GAC3B,MAAM,GAAG,SAAS,CA2BpB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { WithdrawalToken } from '../flow/withdrawalFlowConfig';
|
|
2
|
+
export declare const WITHDRAWAL_DESTINATION_TOKENS_QUERY_KEY = "withdrawalDestinations";
|
|
3
|
+
export interface DestinationChain {
|
|
4
|
+
chainId: number;
|
|
5
|
+
/** Symbols receivable on this chain, priority ones first. */
|
|
6
|
+
symbols: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface UseWithdrawalDestinationTokensResult {
|
|
9
|
+
chains: DestinationChain[];
|
|
10
|
+
/** Where the funds land. `undefined` until the curated list resolves. */
|
|
11
|
+
destinationToken: WithdrawalToken | undefined;
|
|
12
|
+
selectDestinationToken: (chainId: number, symbol: string) => void;
|
|
13
|
+
isLoading: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Everything a withdrawal can be received as: the curated Statsig
|
|
17
|
+
* `withdrawalconfig` chains and assets, minus
|
|
18
|
+
* `disablewithdrawalchainsandassets`, resolved against api-base's asset
|
|
19
|
+
* metadata — the same pipeline the deposit list uses, and the same one web
|
|
20
|
+
* feeds into its receive-token dropdown.
|
|
21
|
+
*
|
|
22
|
+
* The destination token is the point of this rail. Sending the source token back out
|
|
23
|
+
* on its own chain is a plain transfer with nothing to quote; the relay quote
|
|
24
|
+
* exists precisely so a user holding USDG on one chain can receive USDC on
|
|
25
|
+
* another.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useWithdrawalDestinationTokens({ sourceToken, defaultReceiveToken, }: {
|
|
28
|
+
sourceToken: WithdrawalToken;
|
|
29
|
+
/** Symbol to preselect; falls back to the source token's symbol. */
|
|
30
|
+
defaultReceiveToken?: string;
|
|
31
|
+
}): UseWithdrawalDestinationTokensResult;
|
|
32
|
+
//# sourceMappingURL=useWithdrawalDestinationTokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWithdrawalDestinationTokens.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useWithdrawalDestinationTokens.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAKnE,eAAO,MAAM,uCAAuC,2BAA2B,CAAA;AAE/E,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,6DAA6D;IAC7D,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AAED,MAAM,WAAW,oCAAoC;IACnD,MAAM,EAAE,gBAAgB,EAAE,CAAA;IAC1B,yEAAyE;IACzE,gBAAgB,EAAE,eAAe,GAAG,SAAS,CAAA;IAC7C,sBAAsB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACjE,SAAS,EAAE,OAAO,CAAA;CACnB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,8BAA8B,CAAC,EAC7C,WAAW,EACX,mBAAmB,GACpB,EAAE;IACD,WAAW,EAAE,eAAe,CAAA;IAC5B,oEAAoE;IACpE,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B,GAAG,oCAAoC,CA2EvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWithdrawalExecution.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useWithdrawalExecution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,
|
|
1
|
+
{"version":3,"file":"useWithdrawalExecution.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useWithdrawalExecution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAM3B,MAAM,sBAAsB,CAAA;AAG7B,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,8BAA8B,CAAA;AAkBrC,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,oBAAoB,CAAA;IAC5B,oFAAoF;IACpF,KAAK,EAAE,qBAAqB,CAAA;IAC5B,SAAS,EAAE,uBAAuB,CAAA;IAClC,8DAA8D;IAC9D,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,KAAK,EACL,SAAS,EACT,OAAO,GACR,EAAE,4BAA4B,GAAG;IAChC,YAAY,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAC5D,CA4FA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const WITHDRAWAL_RISK_QUERY_KEY = "withdrawalRisk";
|
|
2
|
+
export interface WithdrawalRiskResult {
|
|
3
|
+
/** `true` blocks. `undefined` while unknown — which also blocks. */
|
|
4
|
+
isRisky: boolean | undefined;
|
|
5
|
+
isChecking: boolean;
|
|
6
|
+
isError: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Chainalysis screening for the recipient.
|
|
10
|
+
*
|
|
11
|
+
* **Fails closed**: callers must require `isRisky === false`, so in-flight and
|
|
12
|
+
* errored both block. The chain id only gates the query — risk is a property of
|
|
13
|
+
* the address, so it stays out of the key (web does the same).
|
|
14
|
+
*/
|
|
15
|
+
export declare function useWithdrawalRisk(address: string, chainId: number | undefined): WithdrawalRiskResult;
|
|
16
|
+
//# sourceMappingURL=useWithdrawalRisk.d.ts.map
|
|
@@ -0,0 +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,CAkCtB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { RelayExecutionStatus } from '@funkit/api-base';
|
|
2
|
+
export declare const WITHDRAWAL_STATUS_QUERY_KEY = "withdrawalStatus";
|
|
3
|
+
/**
|
|
4
|
+
* Whether there is still anything to learn by asking again. Split out because
|
|
5
|
+
* the "record never appeared" bound is the part worth testing directly — driving
|
|
6
|
+
* it through the query would mean waiting out real poll intervals.
|
|
7
|
+
*/
|
|
8
|
+
export declare function shouldKeepPollingStatus({ status, hasRecord, failedFetches, }: {
|
|
9
|
+
status: RelayExecutionStatus | undefined;
|
|
10
|
+
hasRecord: boolean;
|
|
11
|
+
failedFetches: number;
|
|
12
|
+
}): boolean;
|
|
13
|
+
export interface WithdrawalStatusResult {
|
|
14
|
+
status: RelayExecutionStatus | undefined;
|
|
15
|
+
/** Confirmed on-chain. Only `SUCCESS` — not merely "stopped moving". */
|
|
16
|
+
isCompleted: boolean;
|
|
17
|
+
/** `FAILURE` or `REFUND`: the transfer did not reach the recipient. */
|
|
18
|
+
isFailed: boolean;
|
|
19
|
+
/** Funds came back to the sender, so there is nothing to chase. */
|
|
20
|
+
isRefunded: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Follow a submitted withdrawal to a terminal state.
|
|
24
|
+
*
|
|
25
|
+
* The record is written best-effort by the pipeline, so a missing one is not a
|
|
26
|
+
* failure — the transfer is already on-chain. It just means we cannot report
|
|
27
|
+
* progress, and polling stops rather than hammering the API forever. An
|
|
28
|
+
* explicit terminal failure is different, and is reported as one.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useWithdrawalStatus(txHash: string | undefined): WithdrawalStatusResult;
|
|
31
|
+
//# sourceMappingURL=useWithdrawalStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWithdrawalStatus.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useWithdrawalStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,oBAAoB,EAErB,MAAM,kBAAkB,CAAA;AAUzB,eAAO,MAAM,2BAA2B,qBAAqB,CAAA;AAU7D;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,MAAM,EACN,SAAS,EACT,aAAa,GACd,EAAE;IACD,MAAM,EAAE,oBAAoB,GAAG,SAAS,CAAA;IACxC,SAAS,EAAE,OAAO,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;CACtB,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,CA0CxB"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type WithdrawalAmountValidation } from '@funkit/connect-core';
|
|
2
|
+
import type { WithdrawalFlowConfig, WithdrawalToken } from '../flow/withdrawalFlowConfig';
|
|
3
|
+
/**
|
|
4
|
+
* The one thing the user has left to fix, named so the submit button can say it.
|
|
5
|
+
*
|
|
6
|
+
* Nothing left to fix is `undefined`, not a `ready` member: these are what the
|
|
7
|
+
* typed form is missing, and that is not the same as being submittable — the
|
|
8
|
+
* async verdicts (risk screening, a settled quote) decide that.
|
|
9
|
+
*/
|
|
10
|
+
export type WithdrawCtaBlocker = 'enter-recipient' | 'unsupported-recipient' | 'recipient-same-as-source' | 'max-exceeded' | 'enter-amount' | 'select-destination' | 'invalid-for-chain';
|
|
11
|
+
/**
|
|
12
|
+
* Amount limits, resolved from the host's callbacks.
|
|
13
|
+
*
|
|
14
|
+
* `sourceTokenUsdPrice` is 0 until a price source is wired: the core validator
|
|
15
|
+
* reads that as "no price", which leaves the USD floor and ceiling inert while
|
|
16
|
+
* still applying the per-token minimum and the balance check. It is not a
|
|
17
|
+
* stand-in value — 0 genuinely means unknown here.
|
|
18
|
+
*/
|
|
19
|
+
export declare function validateAmount({ config, sourceToken, amount, balance, }: {
|
|
20
|
+
config: Pick<WithdrawalFlowConfig, 'getMinWithdrawalAmount' | 'getMinWithdrawalUSD' | 'getMaxWithdrawalUSD' | 'getMaxWithdrawalAmount'>;
|
|
21
|
+
sourceToken: WithdrawalToken;
|
|
22
|
+
amount: string;
|
|
23
|
+
balance: string | undefined;
|
|
24
|
+
}): WithdrawalAmountValidation;
|
|
25
|
+
/**
|
|
26
|
+
* A same-chain, same-token transfer back to the sending wallet. Relay rejects
|
|
27
|
+
* these with a generic error, so name the reason before quoting.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isNoOpSelfWithdrawal({ recipientAddress, walletAddress, sourceToken, destinationToken, }: {
|
|
30
|
+
recipientAddress: string;
|
|
31
|
+
walletAddress: string;
|
|
32
|
+
sourceToken: WithdrawalToken;
|
|
33
|
+
destinationToken: WithdrawalToken | undefined;
|
|
34
|
+
}): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Order is a faithful port of web's `getWithdrawButtonText`: the most specific
|
|
37
|
+
* blocker wins, so the user is told the one thing to fix next rather than the
|
|
38
|
+
* first thing that happens to fail.
|
|
39
|
+
*/
|
|
40
|
+
export declare function getWithdrawCtaBlocker({ recipientAddress, isRecipientBlacklisted, isRecipientSameAsSource, amount, amountValidation, destinationToken, }: {
|
|
41
|
+
recipientAddress: string;
|
|
42
|
+
isRecipientBlacklisted: boolean;
|
|
43
|
+
isRecipientSameAsSource: boolean;
|
|
44
|
+
amount: string;
|
|
45
|
+
amountValidation: WithdrawalAmountValidation;
|
|
46
|
+
destinationToken: WithdrawalToken | undefined;
|
|
47
|
+
}): WithdrawCtaBlocker | undefined;
|
|
48
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAIhC,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,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,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B,GAAG,0BAA0B,CAkC7B;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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funkit/connect-rn",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.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": "
|
|
39
|
+
"@funkit/api-base": "7.0.0",
|
|
36
40
|
"@funkit/chains": "2.2.0",
|
|
37
|
-
"@funkit/connect-core": "
|
|
41
|
+
"@funkit/connect-core": "3.0.0"
|
|
38
42
|
},
|
|
39
43
|
"peerDependencies": {
|
|
40
44
|
"@gorhom/bottom-sheet": ">=5",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type PublicClient } from 'viem';
|
|
2
|
-
/**
|
|
3
|
-
* Read-only client for a funkit-supported chain, built over the chain's
|
|
4
|
-
* fallback RPC list from @funkit/chains (the chain's default RPC may be
|
|
5
|
-
* private — e.g. the Robinhood chain — so the curated list matters).
|
|
6
|
-
* `undefined` for unsupported chain ids; the caller surfaces that as a
|
|
7
|
-
* mis-routed target.
|
|
8
|
-
*/
|
|
9
|
-
export declare function getPublicClientFor(chainId: number): Pick<PublicClient, 'readContract'> | undefined;
|
|
10
|
-
//# sourceMappingURL=publicClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"publicClient.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/publicClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAsC,MAAM,MAAM,CAAA;AAM5E;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,GACd,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,GAAG,SAAS,CAehD"}
|