@spicenet-io/spiceflow-ui 3.3.9 → 3.3.11

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.
Files changed (70) hide show
  1. package/dist/{Button-jx5yrM-s.js → Button-CAv7hfnV.js} +1 -1
  2. package/dist/{Button-CkSwrat1.js → Button-Cs81k5Pq.js} +1 -1
  3. package/dist/auth-dynamic.cjs.js +1 -1
  4. package/dist/auth-dynamic.js +1 -1
  5. package/dist/auth-privy.cjs.js +1 -1
  6. package/dist/auth-privy.js +1 -1
  7. package/dist/components/AccountDisplay/{AccountCustomSection.d.ts → parts/AccountCustomSection.d.ts} +2 -2
  8. package/dist/components/AccountDisplay/{AccountHeader.d.ts → parts/AccountHeader.d.ts} +1 -1
  9. package/dist/components/AccountDisplay/{AccountIdleBalances.d.ts → parts/AccountIdleBalances.d.ts} +2 -2
  10. package/dist/components/AccountDisplay/{AccountPanel.d.ts → parts/AccountPanel.d.ts} +3 -3
  11. package/dist/components/AccountDisplay/{AccountPendingDeposits.d.ts → parts/AccountPendingDeposits.d.ts} +2 -2
  12. package/dist/components/AssetSelector/index.d.ts +3 -3
  13. package/dist/components/AssetSelector/{AssetDropdown.d.ts → parts/AssetDropdown.d.ts} +1 -1
  14. package/dist/components/AssetSelector/{ChainIcon.d.ts → parts/ChainIcon.d.ts} +1 -1
  15. package/dist/components/AssetSelector/{TokenIcon.d.ts → parts/TokenIcon.d.ts} +1 -1
  16. package/dist/components/ProviderLogins/index.d.ts +4 -2
  17. package/dist/components/ProviderLogins/{DynamicLogin.d.ts → parts/DynamicLogin.d.ts} +1 -1
  18. package/dist/components/ProviderLogins/{PrivyLogin.d.ts → parts/PrivyLogin.d.ts} +1 -1
  19. package/dist/components/SpiceBalance/index.d.ts +2 -2
  20. package/dist/components/SpiceDeposit/index.d.ts +3 -3
  21. package/dist/components/SpiceDeposit/{depositBatches.d.ts → lib/depositBatches.d.ts} +3 -3
  22. package/dist/components/SpiceDeposit/{executors.d.ts → lib/executors.d.ts} +3 -3
  23. package/dist/components/SpiceDeposit/{feePreview.d.ts → lib/feePreview.d.ts} +1 -1
  24. package/dist/components/SpiceDeposit/{ConnectWalletModal.d.ts → steps/ConnectWalletModal.d.ts} +1 -1
  25. package/dist/components/SpiceDeposit/{DepositModal.d.ts → steps/DepositModal.d.ts} +1 -1
  26. package/dist/components/SpiceDeposit/{DepositRecoveryPrompt.d.ts → steps/DepositRecoveryPrompt.d.ts} +1 -1
  27. package/dist/components/SpiceDeposit/{DepositStatusModal.d.ts → steps/DepositStatusModal.d.ts} +3 -3
  28. package/dist/components/SpiceDeposit/{SelectChainModal.d.ts → steps/SelectChainModal.d.ts} +1 -1
  29. package/dist/components/SpiceDeposit/{SelectTokenModal.d.ts → steps/SelectTokenModal.d.ts} +1 -1
  30. package/dist/components/SpiceLock/{executors.d.ts → lib/executors.d.ts} +13 -14
  31. package/dist/components/SpiceLock/{helpers.d.ts → lib/helpers.d.ts} +2 -2
  32. package/dist/components/SpiceLock/{LockConfirmationPanel.d.ts → parts/LockConfirmationPanel.d.ts} +1 -1
  33. package/dist/components/SpiceLock/{LockDurationSlider.d.ts → parts/LockDurationSlider.d.ts} +1 -1
  34. package/dist/components/SpiceLock/{LockExpiryRow.d.ts → parts/LockExpiryRow.d.ts} +1 -1
  35. package/dist/components/SpiceLock/{VotingPowerRow.d.ts → parts/VotingPowerRow.d.ts} +1 -1
  36. package/dist/components/SpiceSupply/{buildBatches.d.ts → lib/buildBatches.d.ts} +8 -10
  37. package/dist/components/SpiceSupply/lib/executors.d.ts +67 -0
  38. package/dist/components/SpiceSupply/{feePreview.d.ts → lib/feePreview.d.ts} +9 -11
  39. package/dist/components/SpiceSupply/{DestinationEstimate.d.ts → parts/DestinationEstimate.d.ts} +2 -2
  40. package/dist/components/SpiceSupply/{SupplyEstimate.d.ts → parts/SupplyEstimate.d.ts} +1 -1
  41. package/dist/components/SpiceWithdraw/lib/executors.d.ts +34 -0
  42. package/dist/components/SpiceWithdraw/{SelectPopover.d.ts → parts/SelectPopover.d.ts} +1 -1
  43. package/dist/components/StatusDisplay/index.d.ts +3 -2
  44. package/dist/components/StatusDisplay/{StatusIcon.d.ts → parts/StatusIcon.d.ts} +1 -1
  45. package/dist/components/StatusDisplay/{StatusPanel.d.ts → parts/StatusPanel.d.ts} +1 -1
  46. package/dist/components/StatusDisplay/{StepItem.d.ts → parts/StepItem.d.ts} +1 -1
  47. package/dist/execution/gasless.d.ts +7 -0
  48. package/dist/execution/pollIntentStep.d.ts +28 -0
  49. package/dist/hooks/useSpiceExecution.d.ts +1 -0
  50. package/dist/index.cjs.js +12 -12
  51. package/dist/index.d.ts +2 -1
  52. package/dist/index.js +16 -16
  53. package/dist/{providerWallet-Ds1PM0vC.js → providerWallet-BC4uEdg8.js} +1 -1
  54. package/dist/{providerWallet-6FpyLYqw.js → providerWallet-QdrPrEd_.js} +1 -1
  55. package/dist/providers/dynamic.d.ts +2 -2
  56. package/dist/providers/privy.d.ts +2 -2
  57. package/dist/types/supply.d.ts +15 -0
  58. package/dist/utils/spiceConstants.d.ts +3 -0
  59. package/package.json +3 -3
  60. package/dist/components/SpiceDeposit/views/DepositSubtitle.d.ts +0 -9
  61. package/dist/components/SpiceSupply/executors.d.ts +0 -73
  62. package/dist/components/SpiceWithdraw/executors.d.ts +0 -50
  63. /package/dist/components/AccountDisplay/{AccountActions.d.ts → parts/AccountActions.d.ts} +0 -0
  64. /package/dist/components/SpiceBalance/{AccountItem.d.ts → parts/AccountItem.d.ts} +0 -0
  65. /package/dist/components/SpiceBalance/{BalanceSection.d.ts → parts/BalanceSection.d.ts} +0 -0
  66. /package/dist/components/SpiceDeposit/{views/AssetChooserList.d.ts → parts/DepositAssetChooser.d.ts} +0 -0
  67. /package/dist/components/SpiceDeposit/{ModalHeader.d.ts → parts/ModalHeader.d.ts} +0 -0
  68. /package/dist/components/SpiceWithdraw/{helpers.d.ts → lib/helpers.d.ts} +0 -0
  69. /package/dist/components/SpiceWithdraw/{views/BalancePopover.d.ts → parts/WithdrawBalancePopover.d.ts} +0 -0
  70. /package/dist/components/SpiceWithdraw/{views → parts}/WithdrawDetailsPanel.d.ts +0 -0
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{createWalletClient as l,custom as d}from"viem";import{g as c}from"./Button-jx5yrM-s.js";const o=t=>{if(!t)return!1;const e=t.connector;if(!e)return!1;if(e.isEmbeddedWallet===!0)return!0;const r=(e.key||e.connectorKey||"").toLowerCase();if(r.includes("embedded")||r.includes("turnkey"))return!0;const n=(e.name||t.walletName||"").toLowerCase();return!!(n.includes("embedded")||n.includes("turnkey"))},u=t=>(t?.connectedWallets||[]).find(e=>o(e))||(o(t?.primaryWallet)?t.primaryWallet:null),f=t=>(t?.connectedWallets||[]).find(e=>e?.address&&e?.connector&&!o(e))||null,i=async(t,e)=>{if(!t?.address)throw new Error("Wallet not available");if(typeof t.getWalletClient=="function"){const r=e===void 0?[void 0]:[String(e),e,void 0];let n=null;for(const s of r)try{const a=await t.getWalletClient(s);if(a)return a}catch(a){n=a}if(n)throw n}if(typeof t.getEthereumProvider=="function"){const r=await t.getEthereumProvider(),n=e?c(e)?.viemChain:void 0;return l({account:t.address,chain:n,transport:d(r)})}throw new Error("Wallet client not available")},m=async(t,e)=>{if(!t?.address)throw new Error("Wallet not available");if(typeof t.getEthereumProvider=="function")return t.getEthereumProvider();const r=await i(t,e);return{request:n=>r.request(n)}},y=(t,e)=>({address:t?.address||e.address,chainId:Number(t?.chainId??e.chainId),contractAddress:t?.contractAddress||t?.delegate||e.contractAddress,nonce:BigInt(t?.nonce??e.nonce),r:t?.r,s:t?.s,yParity:(()=>{if(typeof t?.yParity=="number")return t.yParity;const r=Number(t?.v??27);return Number.isFinite(r)?r>=27?r-27:r:0})()});export{m as a,f as b,i as c,u as g,y as n};
2
+ import{createWalletClient as l,custom as d}from"viem";import{g as c}from"./Button-CAv7hfnV.js";const o=t=>{if(!t)return!1;const e=t.connector;if(!e)return!1;if(e.isEmbeddedWallet===!0)return!0;const r=(e.key||e.connectorKey||"").toLowerCase();if(r.includes("embedded")||r.includes("turnkey"))return!0;const n=(e.name||t.walletName||"").toLowerCase();return!!(n.includes("embedded")||n.includes("turnkey"))},u=t=>(t?.connectedWallets||[]).find(e=>o(e))||(o(t?.primaryWallet)?t.primaryWallet:null),f=t=>(t?.connectedWallets||[]).find(e=>e?.address&&e?.connector&&!o(e))||null,i=async(t,e)=>{if(!t?.address)throw new Error("Wallet not available");if(typeof t.getWalletClient=="function"){const r=e===void 0?[void 0]:[String(e),e,void 0];let n=null;for(const s of r)try{const a=await t.getWalletClient(s);if(a)return a}catch(a){n=a}if(n)throw n}if(typeof t.getEthereumProvider=="function"){const r=await t.getEthereumProvider(),n=e?c(e)?.viemChain:void 0;return l({account:t.address,chain:n,transport:d(r)})}throw new Error("Wallet client not available")},m=async(t,e)=>{if(!t?.address)throw new Error("Wallet not available");if(typeof t.getEthereumProvider=="function")return t.getEthereumProvider();const r=await i(t,e);return{request:n=>r.request(n)}},y=(t,e)=>({address:t?.address||e.address,chainId:Number(t?.chainId??e.chainId),contractAddress:t?.contractAddress||t?.delegate||e.contractAddress,nonce:BigInt(t?.nonce??e.nonce),r:t?.r,s:t?.s,yParity:(()=>{if(typeof t?.yParity=="number")return t.yParity;const r=Number(t?.v??27);return Number.isFinite(r)?r>=27?r-27:r:0})()});export{m as a,f as b,i as c,u as g,y as n};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";const o=require("viem"),c=require("./Button-CkSwrat1.js"),a=e=>{if(!e)return!1;const t=e.connector;if(!t)return!1;if(t.isEmbeddedWallet===!0)return!0;const r=(t.key||t.connectorKey||"").toLowerCase();if(r.includes("embedded")||r.includes("turnkey"))return!0;const n=(t.name||e.walletName||"").toLowerCase();return!!(n.includes("embedded")||n.includes("turnkey"))},s=e=>(e?.connectedWallets||[]).find(t=>a(t))||(a(e?.primaryWallet)?e.primaryWallet:null),u=e=>(e?.connectedWallets||[]).find(t=>t?.address&&t?.connector&&!a(t))||null,l=async(e,t)=>{if(!e?.address)throw new Error("Wallet not available");if(typeof e.getWalletClient=="function"){const r=t===void 0?[void 0]:[String(t),t,void 0];let n=null;for(const d of r)try{const i=await e.getWalletClient(d);if(i)return i}catch(i){n=i}if(n)throw n}if(typeof e.getEthereumProvider=="function"){const r=await e.getEthereumProvider(),n=t?c.getChainConfig(t)?.viemChain:void 0;return o.createWalletClient({account:e.address,chain:n,transport:o.custom(r)})}throw new Error("Wallet client not available")},m=async(e,t)=>{if(!e?.address)throw new Error("Wallet not available");if(typeof e.getEthereumProvider=="function")return e.getEthereumProvider();const r=await l(e,t);return{request:n=>r.request(n)}},f=(e,t)=>({address:e?.address||t.address,chainId:Number(e?.chainId??t.chainId),contractAddress:e?.contractAddress||e?.delegate||t.contractAddress,nonce:BigInt(e?.nonce??t.nonce),r:e?.r,s:e?.s,yParity:(()=>{if(typeof e?.yParity=="number")return e.yParity;const r=Number(e?.v??27);return Number.isFinite(r)?r>=27?r-27:r:0})()});exports.getDynamicEmbeddedWallet=s,exports.getDynamicExternalWallet=u,exports.getProviderEthereumProvider=m,exports.getProviderWalletClient=l,exports.normalizeAuthorization=f;
2
+ "use strict";const o=require("viem"),c=require("./Button-Cs81k5Pq.js"),a=e=>{if(!e)return!1;const t=e.connector;if(!t)return!1;if(t.isEmbeddedWallet===!0)return!0;const r=(t.key||t.connectorKey||"").toLowerCase();if(r.includes("embedded")||r.includes("turnkey"))return!0;const n=(t.name||e.walletName||"").toLowerCase();return!!(n.includes("embedded")||n.includes("turnkey"))},s=e=>(e?.connectedWallets||[]).find(t=>a(t))||(a(e?.primaryWallet)?e.primaryWallet:null),u=e=>(e?.connectedWallets||[]).find(t=>t?.address&&t?.connector&&!a(t))||null,l=async(e,t)=>{if(!e?.address)throw new Error("Wallet not available");if(typeof e.getWalletClient=="function"){const r=t===void 0?[void 0]:[String(t),t,void 0];let n=null;for(const d of r)try{const i=await e.getWalletClient(d);if(i)return i}catch(i){n=i}if(n)throw n}if(typeof e.getEthereumProvider=="function"){const r=await e.getEthereumProvider(),n=t?c.getChainConfig(t)?.viemChain:void 0;return o.createWalletClient({account:e.address,chain:n,transport:o.custom(r)})}throw new Error("Wallet client not available")},m=async(e,t)=>{if(!e?.address)throw new Error("Wallet not available");if(typeof e.getEthereumProvider=="function")return e.getEthereumProvider();const r=await l(e,t);return{request:n=>r.request(n)}},f=(e,t)=>({address:e?.address||t.address,chainId:Number(e?.chainId??t.chainId),contractAddress:e?.contractAddress||e?.delegate||t.contractAddress,nonce:BigInt(e?.nonce??t.nonce),r:e?.r,s:e?.s,yParity:(()=>{if(typeof e?.yParity=="number")return e.yParity;const r=Number(e?.v??27);return Number.isFinite(r)?r>=27?r-27:r:0})()});exports.getDynamicEmbeddedWallet=s,exports.getDynamicExternalWallet=u,exports.getProviderEthereumProvider=m,exports.getProviderWalletClient=l,exports.normalizeAuthorization=f;
@@ -1,3 +1,3 @@
1
1
  import "../globals.css";
2
- export { DynamicLogin } from "../components/ProviderLogins/DynamicLogin";
3
- export type { DynamicLoginProps } from "../components/ProviderLogins/DynamicLogin";
2
+ export { DynamicLogin } from "../components/ProviderLogins";
3
+ export type { DynamicLoginProps } from "../components/ProviderLogins";
@@ -1,3 +1,3 @@
1
1
  import "../globals.css";
2
- export { PrivyLogin } from "../components/ProviderLogins/PrivyLogin";
3
- export type { PrivyLoginProps } from "../components/ProviderLogins/PrivyLogin";
2
+ export { PrivyLogin } from "../components/ProviderLogins";
3
+ export type { PrivyLoginProps } from "../components/ProviderLogins";
@@ -14,6 +14,20 @@ export interface BuildActionCallsContext {
14
14
  userAddress: Address;
15
15
  chainId: number;
16
16
  destinationToken: Address;
17
+ grossAmount?: bigint;
18
+ netAmount?: bigint;
19
+ combinedFeeAmount?: bigint;
20
+ feeExecutionMode?: "backend-transfer" | "user-transfer";
21
+ feeBreakdown?: {
22
+ spicenetFee: bigint;
23
+ gasFee: bigint;
24
+ bridgeFee: bigint;
25
+ };
26
+ }
27
+ export interface SupplyBatchBuildOptions {
28
+ actionAmountOverride?: bigint;
29
+ fundingAmountOverride?: bigint;
30
+ actionContextOverride?: Partial<BuildActionCallsContext>;
17
31
  }
18
32
  export interface PayExecuteContext {
19
33
  asset: Asset;
@@ -32,6 +46,7 @@ export interface SpiceSupplyProps {
32
46
  onClose: () => void;
33
47
  destinationToken: DestinationTokenConfig;
34
48
  buildActionCalls: (amount: bigint, ctx: BuildActionCallsContext) => Call[];
49
+ feeExecutionMode?: "backend-transfer" | "user-transfer";
35
50
  buildSpicenetBatch?: (params: {
36
51
  userAddress: Address;
37
52
  destinationChainId: number;
@@ -0,0 +1,3 @@
1
+ import type { Address } from "viem";
2
+ export declare const SPICE_SOLVER_ADDRESS: Address;
3
+ export declare const SPICE_COMBINED_FEE_RECIPIENT: `0x${string}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spicenet-io/spiceflow-ui",
3
- "version": "3.3.9",
3
+ "version": "3.3.11",
4
4
  "description": "Spiceflow UI SDK",
5
5
  "type": "module",
6
6
  "packageManager": "bun@1.3.13",
@@ -42,7 +42,7 @@
42
42
  "dev": "rollup -c rollup.config.mjs --watch",
43
43
  "dev:link": "bun run build && bun link && echo 'SDK linked globally. Run: bun link @spicenet-io/spiceflow-ui in your project'",
44
44
  "clean": "rm -rf dist",
45
- "prepublishOnly": "npm run build"
45
+ "prepublishOnly": "bun run build"
46
46
  },
47
47
  "keywords": [
48
48
  "react",
@@ -58,7 +58,7 @@
58
58
  "author": "",
59
59
  "license": "MIT",
60
60
  "dependencies": {
61
- "@spicenet-io/spiceflow-core": "^0.3.11",
61
+ "@spicenet-io/spiceflow-core": "^0.3.12",
62
62
  "lucide-react": "0.562.0",
63
63
  "tslib": "2.8.1"
64
64
  },
@@ -1,9 +0,0 @@
1
- import React from "react";
2
- import type { ResolvedDarkPalette } from "../../../utils/theme";
3
- interface DepositSubtitleProps {
4
- appName: string;
5
- dark: boolean;
6
- dk: ResolvedDarkPalette;
7
- }
8
- export declare const DepositSubtitle: React.FC<DepositSubtitleProps>;
9
- export {};
@@ -1,73 +0,0 @@
1
- import type { Dispatch, MutableRefObject, SetStateAction } from "react";
2
- import { type Address } from "viem";
3
- import { type FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
4
- import type { ChainBatch } from "../../types/authorization";
5
- import type { SelectedAsset } from "../../types/assets";
6
- import type { SpiceSupplyProps } from "../../types/supply";
7
- import type { ResolvedExactOutputSwap } from "../../utils/swapQuotes";
8
- import type { GaslessExecutionOptions, GaslessProgress } from "../../hooks/useSpiceExecution";
9
- export type SupplyStep = "idle" | "signing-delegation" | "signing-intent" | "submitting" | "executing" | "success" | "error";
10
- export type PaymentResult = {
11
- status: "processing" | "success" | "failed";
12
- txHash?: string;
13
- error?: string;
14
- };
15
- type EstimateGaslessFn = (chainBatches: ChainBatch[], tokenAddress: string, tokenTransferAmount: bigint, options?: GaslessExecutionOptions) => Promise<FeeEstimateSummary>;
16
- type ExecuteGaslessFn = (chainBatches: ChainBatch[], tokenAddress: string, tokenTransferAmount: bigint, onProgress?: (progress: GaslessProgress) => void, signal?: AbortSignal, options?: GaslessExecutionOptions) => Promise<string>;
17
- type BuildPayBatchesFn = (options?: {
18
- actionAmountOverride?: bigint;
19
- fundingAmountOverride?: bigint;
20
- }) => Promise<ChainBatch[]>;
21
- type BuildSupplyBatchesFn = (spicenetFundingAmount?: bigint) => Promise<ChainBatch[]>;
22
- type EstimateRequiredGrossFundingFn = (requiredNetFunding: bigint, buildBatches: (grossFundingAmount: bigint) => ChainBatch[] | Promise<ChainBatch[]>, fundingToken: Address, gaslessOptions?: Pick<GaslessExecutionOptions, "useCustomTransfers" | "userOverride">) => Promise<bigint>;
23
- export interface ExecutorContext {
24
- selectedAsset: SelectedAsset | null;
25
- parsedAmount: number;
26
- currentPaymentAmount: string;
27
- isInsufficientBalance: boolean;
28
- isPayMode: boolean;
29
- isNon7702: boolean;
30
- isSourceDestToken: boolean;
31
- needsSwap: boolean;
32
- exactOutputSwap: ResolvedExactOutputSwap | null;
33
- selectedIsEquivalent: boolean;
34
- resolvedTokenIn: Address | null;
35
- embeddedWalletAddress: string | null | undefined;
36
- providerEmbeddedAddress: string | null | undefined;
37
- externalWallet: {
38
- getEthereumProvider: () => Promise<any>;
39
- } | null | undefined;
40
- externalWalletAddress: string | null | undefined;
41
- address: string | null | undefined;
42
- isConnected: boolean;
43
- ready: boolean;
44
- authenticated: boolean;
45
- provider: string | null | undefined;
46
- resolvedChainId: number;
47
- executionTokenAddress: Address;
48
- destinationToken: SpiceSupplyProps["destinationToken"];
49
- buildActionCalls: SpiceSupplyProps["buildActionCalls"];
50
- buildSpicenetBatch: SpiceSupplyProps["buildSpicenetBatch"];
51
- onPayExecute?: SpiceSupplyProps["onPayExecute"];
52
- onError?: (err: Error) => void;
53
- buildPayChainBatches: BuildPayBatchesFn;
54
- buildSupplyChainBatches: BuildSupplyBatchesFn;
55
- estimateGasless: EstimateGaslessFn;
56
- executeGasless: ExecuteGaslessFn;
57
- estimateRequiredGrossFunding: EstimateRequiredGrossFundingFn;
58
- handleProgressCallback: (progress: GaslessProgress) => void;
59
- setError: Dispatch<SetStateAction<string | null>>;
60
- setStep: Dispatch<SetStateAction<SupplyStep>>;
61
- setStatusMsg: Dispatch<SetStateAction<string>>;
62
- setTxHash: Dispatch<SetStateAction<string | null>>;
63
- setIsExecuting: Dispatch<SetStateAction<boolean>>;
64
- setShowStatusPanel: Dispatch<SetStateAction<boolean>>;
65
- setPaymentResult: Dispatch<SetStateAction<PaymentResult | null>>;
66
- spiceDepositSubmittedRef: MutableRefObject<boolean>;
67
- abortControllerRef: MutableRefObject<AbortController | null>;
68
- }
69
- export declare function executeSupply(ctx: ExecutorContext): Promise<void>;
70
- export declare function executeDirectExternalAction(ctx: ExecutorContext): Promise<`0x${string}` | undefined>;
71
- export declare function executeNon7702Pay(ctx: ExecutorContext): Promise<string>;
72
- export declare function executePay(ctx: ExecutorContext): Promise<void>;
73
- export {};
@@ -1,50 +0,0 @@
1
- import type { Dispatch, MutableRefObject, SetStateAction } from "react";
2
- import { type FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
3
- import type { Address } from "viem";
4
- import type { ChainBatch } from "../../types/authorization";
5
- import type { DestinationToken } from "../../types/withdraw";
6
- import type { GaslessExecutionOptions, GaslessProgress } from "../../hooks/useSpiceExecution";
7
- export type WithdrawalExecutionContext = {
8
- actionId: string;
9
- intentId: string;
10
- intentIndex: number;
11
- totalSteps: number;
12
- };
13
- type EstimateGaslessFn = (chainBatches: ChainBatch[], tokenAddress: string, tokenTransferAmount: bigint, options?: GaslessExecutionOptions) => Promise<FeeEstimateSummary>;
14
- type ExecuteGaslessFn = (chainBatches: ChainBatch[], tokenAddress: string, tokenTransferAmount: bigint, onProgress?: (progress: GaslessProgress) => void, signal?: AbortSignal, options?: GaslessExecutionOptions) => Promise<string>;
15
- export interface WithdrawExecutorContext {
16
- computedWithdrawBatches: ChainBatch[];
17
- walletAddress: string | null | undefined;
18
- recipientAddress: string | null | undefined;
19
- selectedDestToken: DestinationToken | null;
20
- selectedChainId: number | null;
21
- amount: string;
22
- receiveAmountRaw: bigint;
23
- gasFee: bigint | null;
24
- isNon7702: boolean;
25
- onWithdrawExecute?: (amount: string) => Promise<void> | void;
26
- onWithdrawSuccess?: (info: {
27
- token: string;
28
- amount: string;
29
- chainId: number;
30
- }) => void;
31
- onWithdrawError?: (msg: string) => void;
32
- buildSpicenetBatch?: (params: {
33
- destinationChainId: number;
34
- deliveryToken: Address;
35
- deliveryAmount: bigint;
36
- deliveryRecipient: Address;
37
- }) => ChainBatch | null;
38
- buildWithdrawBatches: (spicenetFundingAmount?: bigint) => ChainBatch[];
39
- estimateGasless: EstimateGaslessFn;
40
- executeGasless: ExecuteGaslessFn;
41
- setIsExecuting: Dispatch<SetStateAction<boolean>>;
42
- setExecutionError: Dispatch<SetStateAction<string | null>>;
43
- setExecutionProgress: Dispatch<SetStateAction<GaslessProgress | null>>;
44
- setLockedGasFee: Dispatch<SetStateAction<bigint | null>>;
45
- executionContextRef: MutableRefObject<WithdrawalExecutionContext | null>;
46
- isMountedRef: MutableRefObject<boolean>;
47
- }
48
- export declare function executeWithdraw(ctx: WithdrawExecutorContext): Promise<void>;
49
- export declare function retryWithdraw(ctx: WithdrawExecutorContext): Promise<void>;
50
- export {};