@funkit/connect 9.14.0 → 9.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  import type { MeldQuote, MeldServiceProvider } from '@funkit/api-base';
2
2
  import React from 'react';
3
+ import type { Hex } from 'viem';
3
4
  import { type PaymentMethodInfo } from '../../../domains/paymentMethods';
4
5
  import { type CheckoutModalCommonState, FunCheckoutStep, type ModalStepComponentProps, type ModalStepInfo } from '../stepTransition';
5
6
  export type InputAmountState = CheckoutModalCommonState & {
@@ -19,6 +20,9 @@ export type InputAmountNext = Record<string, never> | {
19
20
  provider?: MeldServiceProvider;
20
21
  quote?: MeldQuote;
21
22
  nextStep?: FunCheckoutStep.SOURCE_CHANGE | FunCheckoutStep.MELD_CURRENCY_SELECT | FunCheckoutStep.MELD_QUOTES | FunCheckoutStep.MELD_REDIRECT;
23
+ } | {
24
+ nextStep: FunCheckoutStep.CHECKOUT_COMPLETE;
25
+ txHash: Hex;
22
26
  };
23
27
  export declare const InputAmountInfo: ModalStepInfo<FunCheckoutStep.INPUT_AMOUNT>;
24
28
  export declare function InputAmount(props: ModalStepComponentProps<FunCheckoutStep.INPUT_AMOUNT>): React.JSX.Element;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Aave V3 client and constants for the native fast-path supply flow.
3
+ *
4
+ * The PoC uses `@aave/client` (V3 SDK) directly via its action functions, with
5
+ * the viem adapter for signing. We don't mount `<AaveProvider>` because the
6
+ * funkit tree doesn't need the React-bound hooks.
7
+ *
8
+ * NOTE on location: this file is co-located with its only current caller
9
+ * (`useAaveNativeSupply.ts`). It does NOT belong in `~/clients/` — that
10
+ * directory is reserved for customer-specific code exported via the
11
+ * `./clients/*` subpath; pulling Aave SDK setup in from there would bloat
12
+ * the main bundle for every customer. As more callers appear (e.g. reserve
13
+ * queries for confirmation-screen metadata), move this to a dedicated
14
+ * `~/integrations/aave.ts` or similar — it's a third-party SDK integration
15
+ * boundary, not a constant (singleton) and not domain logic.
16
+ */
17
+ import { AaveClient } from '@aave/client';
18
+ import type { Address } from 'viem';
19
+ export declare const aaveClient: AaveClient;
20
+ export declare const AAVE_MARKET_ADDRESS_BY_CHAIN: Record<string, Address>;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Aave V3 native-supply fast-path: routes same-token same-chain
3
+ * deposits straight to Pool.supply via @aave/client, bypassing Relay.
4
+ */
5
+ import type { Dnum } from 'dnum';
6
+ import type { Hex } from 'viem';
7
+ import type { FunkitActiveCheckoutItem } from '../../../providers/FunkitCheckoutContext';
8
+ import type { FunkitCheckoutConfig } from '../../../providers/FunkitCheckoutContext';
9
+ interface AaveNativeSupplyContextArgs {
10
+ apiKey: string;
11
+ sourceAsset: {
12
+ chainId: string | number;
13
+ address: string;
14
+ };
15
+ checkoutConfig: Pick<FunkitCheckoutConfig, 'targetChain' | 'targetAsset'>;
16
+ }
17
+ /**
18
+ * True when the customer has the Aave native fast-path enabled, the
19
+ * checkout's target chain has an Aave market configured (membership in
20
+ * AAVE_MARKET_ADDRESS_BY_CHAIN is the single source of truth for "Aave
21
+ * supported here"), and the source asset matches the target asset
22
+ * (same chain, same token address). Decoupled from the hook so callers
23
+ * can branch their UI before mounting the hook.
24
+ */
25
+ export declare function isAaveNativeSupplyContext({ apiKey, sourceAsset, checkoutConfig, }: AaveNativeSupplyContextArgs): boolean;
26
+ /**
27
+ * Stringify an amount for Aave's `bigDecimal()`. Prefers the precise
28
+ * base-unit Dnum (carries the token's real decimals) so we don't ship
29
+ * float noise like "0.30000000000000004" to the API. Falls back to the
30
+ * raw JS-number string when the Dnum isn't populated (EXACT_OUT path).
31
+ */
32
+ export declare function formatSupplyAmount(tokenAmountBaseUnit: Dnum | null, fallbackAssetAmount: number | undefined): string;
33
+ interface UseAaveNativeSupplyArgs {
34
+ checkoutItem: FunkitActiveCheckoutItem | null;
35
+ }
36
+ interface UseAaveNativeSupplyResult {
37
+ submit: (humanAmount: string) => Promise<{
38
+ txHash: Hex;
39
+ } | null>;
40
+ isPending: boolean;
41
+ error: Error | null;
42
+ }
43
+ export declare function useAaveNativeSupply({ checkoutItem, }: UseAaveNativeSupplyArgs): UseAaveNativeSupplyResult;
44
+ export {};
@@ -2,7 +2,6 @@ import React from 'react';
2
2
  import type { Address } from 'viem';
3
3
  interface WithdrawSuccessProps {
4
4
  depositAddress: Address;
5
- amount: number;
6
5
  token: string;
7
6
  tokenIconSrc: string;
8
7
  chainId: string;
@@ -17,8 +17,7 @@ export type WithdrawalFormData = {
17
17
  quote?: FunkitCheckoutQuoteResult;
18
18
  /** Lighter asset index for quoteless Secure withdrawal. */
19
19
  lighterAssetIndex?: number;
20
- /** User-entered amount in token units for quoteless flows. */
21
- userInputAmount?: string;
20
+ userInputAmount: string;
22
21
  };
23
22
  export declare function useWithdrawal({ config, withdrawalItem, onSuccess, }: {
24
23
  config: FunkitWithdrawalConfig;
@@ -27,6 +27,14 @@ interface FunkitCheckoutContextInterface {
27
27
  updateCustomRecipient: (recipient: Address) => void;
28
28
  confirmCheckout(quote: FunkitCheckoutQuoteResult, stepMessageSetter: (m: string) => void, withdrawalClient?: WithdrawalClient, preWithdrawalTxs?: WithdrawalTransaction[]): Promise<Address>;
29
29
  cancelCheckout(depositAddress: Address): Promise<boolean>;
30
+ /**
31
+ * Partial-update the active checkout item. Exposed for direct-execution
32
+ * fast-paths that bypass `confirmCheckout` (e.g. Aave native supply) and
33
+ * need to sync `checkoutItem.depositAddress` themselves. TODO(ENG-3966):
34
+ * fold these call sites into a shared orchestration helper so this
35
+ * doesn't need to be public.
36
+ */
37
+ updateActiveCheckout: (data: Partial<FunkitActiveCheckoutItem> | ((checkoutItem: FunkitActiveCheckoutItem) => Partial<FunkitActiveCheckoutItem>)) => void;
30
38
  /** @deprecated to be removed after quote migration is finished (historically named setCheckoutQuote) */
31
39
  setCheckout: (checkout: FunkitActiveCheckoutItem) => void;
32
40
  setCompletedTimestamp(timestampMs: number): void;
@@ -158,6 +158,12 @@ export interface WithdrawalParam {
158
158
  lighterAssetIndex?: number;
159
159
  /** User-entered amount in token units for quoteless flows (avoids overloading quoteId). */
160
160
  userInputAmount?: string;
161
+ /**
162
+ * USD value of the withdrawal as computed by the modal (token amount × live
163
+ * spot price). Provided so quoteless flows (e.g. Lighter Secure) don't need
164
+ * a separate price round-trip to compute `estTotalUsd` for tracking.
165
+ */
166
+ withdrawalUSD?: string;
161
167
  }
162
168
  /**
163
169
  * A single entry in a {@link MultiMethodWithdrawalConfig}.
@@ -1,6 +1,6 @@
1
1
  import type { Config } from 'wagmi';
2
2
  import { type GetBalanceParameters, type GetBalanceReturnType } from 'wagmi/actions';
3
- export { estimateGas, getGasPrice, getTransaction, multicall, readContract, } from 'wagmi/actions';
3
+ export { estimateGas, getGasPrice, getTransaction, getWalletClient, multicall, readContract, } from 'wagmi/actions';
4
4
  export type GetBalanceReturnTypeCompat = GetBalanceReturnType & {
5
5
  formatted: string;
6
6
  };
@@ -1,16 +1,16 @@
1
1
  "use client";
2
- import {
3
- safeheronWallet
4
- } from "./chunk-AM5MSNVQ.js";
5
2
  import {
6
3
  zerionWallet
7
4
  } from "./chunk-UFYNHHDU.js";
5
+ import {
6
+ injectedWallet
7
+ } from "./chunk-HPUEYLLS.js";
8
+ import {
9
+ talismanWallet
10
+ } from "./chunk-T3VMQBBI.js";
8
11
  import {
9
12
  tokenPocketWallet
10
13
  } from "./chunk-UYW6MV74.js";
11
- import {
12
- frontierWallet
13
- } from "./chunk-J3PJOMO7.js";
14
14
  import {
15
15
  tokenaryWallet
16
16
  } from "./chunk-R7X5RIO7.js";
@@ -38,6 +38,9 @@ import {
38
38
  import {
39
39
  roninWallet
40
40
  } from "./chunk-OSOB6QYX.js";
41
+ import {
42
+ safeheronWallet
43
+ } from "./chunk-AM5MSNVQ.js";
41
44
  import {
42
45
  safeWallet
43
46
  } from "./chunk-BHAPTB57.js";
@@ -50,9 +53,6 @@ import {
50
53
  import {
51
54
  tahoWallet
52
55
  } from "./chunk-KS5MJNGD.js";
53
- import {
54
- talismanWallet
55
- } from "./chunk-T3VMQBBI.js";
56
56
  import {
57
57
  oktoWallet
58
58
  } from "./chunk-BBPTPMH7.js";
@@ -65,6 +65,9 @@ import {
65
65
  import {
66
66
  oneInchWallet
67
67
  } from "./chunk-EUMOVTRQ.js";
68
+ import {
69
+ imTokenWallet
70
+ } from "./chunk-BWLMNATA.js";
68
71
  import {
69
72
  oneKeyWallet
70
73
  } from "./chunk-E3NZE4UP.js";
@@ -78,17 +81,14 @@ import {
78
81
  frameWallet
79
82
  } from "./chunk-MTJIPVYB.js";
80
83
  import {
81
- enkryptWallet
82
- } from "./chunk-2DKNXOPL.js";
84
+ frontierWallet
85
+ } from "./chunk-J3PJOMO7.js";
83
86
  import {
84
87
  gateWallet
85
88
  } from "./chunk-LEAZMT5Y.js";
86
89
  import {
87
- imTokenWallet
88
- } from "./chunk-BWLMNATA.js";
89
- import {
90
- injectedWallet
91
- } from "./chunk-HPUEYLLS.js";
90
+ dawnWallet
91
+ } from "./chunk-PARFRRNI.js";
92
92
  import {
93
93
  kresusWallet
94
94
  } from "./chunk-O4IDLNBH.js";
@@ -101,51 +101,51 @@ import {
101
101
  import {
102
102
  mewWallet
103
103
  } from "./chunk-DP5ICBEB.js";
104
- import {
105
- clvWallet
106
- } from "./chunk-3ZJN3PXP.js";
107
- import {
108
- bitgetWallet
109
- } from "./chunk-IMNI4AGV.js";
110
- import {
111
- coin98Wallet
112
- } from "./chunk-RZQ4B4Z7.js";
113
104
  import {
114
105
  coinbaseWallet
115
106
  } from "./chunk-OUM6H3WU.js";
107
+ import {
108
+ bifrostWallet
109
+ } from "./chunk-OD6B2ISG.js";
110
+ import {
111
+ argentWallet
112
+ } from "./chunk-XTD6OMZP.js";
116
113
  import {
117
114
  coreWallet
118
115
  } from "./chunk-55VS2NKG.js";
119
116
  import {
120
- desigWallet
121
- } from "./chunk-TNVLCMJD.js";
117
+ bitverseWallet
118
+ } from "./chunk-RZH4FSX7.js";
122
119
  import {
123
- dawnWallet
124
- } from "./chunk-PARFRRNI.js";
120
+ enkryptWallet
121
+ } from "./chunk-2DKNXOPL.js";
125
122
  import {
126
123
  foxWallet
127
124
  } from "./chunk-YGMU5VWD.js";
128
125
  import {
129
- argentWallet
130
- } from "./chunk-XTD6OMZP.js";
131
- import {
132
- bifrostWallet
133
- } from "./chunk-OD6B2ISG.js";
134
- import {
135
- bitskiWallet
136
- } from "./chunk-Y36HPFB3.js";
126
+ desigWallet
127
+ } from "./chunk-TNVLCMJD.js";
137
128
  import {
138
- bitverseWallet
139
- } from "./chunk-RZH4FSX7.js";
129
+ bitgetWallet
130
+ } from "./chunk-IMNI4AGV.js";
140
131
  import {
141
132
  bloomWallet
142
133
  } from "./chunk-S6R4B763.js";
134
+ import {
135
+ bitskiWallet
136
+ } from "./chunk-Y36HPFB3.js";
143
137
  import {
144
138
  braveWallet
145
139
  } from "./chunk-XVH4JIXB.js";
146
140
  import {
147
141
  bybitWallet
148
142
  } from "./chunk-7IEUTLHY.js";
143
+ import {
144
+ clvWallet
145
+ } from "./chunk-3ZJN3PXP.js";
146
+ import {
147
+ coin98Wallet
148
+ } from "./chunk-RZQ4B4Z7.js";
149
149
  import "./chunk-FMVNQKZL.js";
150
150
  import "./chunk-YYYRPQHB.js";
151
151
  import "./chunk-3K2MFXCO.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/connect",
3
- "version": "9.14.0",
3
+ "version": "9.15.1",
4
4
  "description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
5
5
  "files": [
6
6
  "dist",
@@ -67,6 +67,8 @@
67
67
  "dotenv": "^17.2.3",
68
68
  "esbuild-plugin-replace": "^1.4.0",
69
69
  "jsdom": "^26.1.0",
70
+ "openapi-fetch": "^0.17.0",
71
+ "openapi-typescript": "^7.13.0",
70
72
  "postcss": "^8.5.10",
71
73
  "postcss-prefix-selector": "^1.16.0",
72
74
  "process": "^0.11.10",
@@ -83,10 +85,12 @@
83
85
  "wagmi": "2.17.2"
84
86
  },
85
87
  "dependencies": {
88
+ "@aave-dao/aave-address-book": "^4.49.9",
89
+ "@aave/client": "^0.9.3",
86
90
  "@bluvo/react": "3.0.0-beta.1",
87
91
  "@bluvo/sdk-ts": "3.0.0-beta.1",
88
- "@lifeomic/attempt": "3.1.0",
89
92
  "@datadog/browser-logs": "5.22.0",
93
+ "@lifeomic/attempt": "3.1.0",
90
94
  "@number-flow/react": "^0.5.5",
91
95
  "@radix-ui/react-dropdown-menu": "^2.1.7",
92
96
  "@radix-ui/react-tooltip": "^1.2.0",
@@ -107,9 +111,9 @@
107
111
  "ua-parser-js": "^1.0.37",
108
112
  "use-debounce": "^10.0.5",
109
113
  "uuid": "^9.0.1",
110
- "@funkit/api-base": "4.2.3",
111
- "@funkit/fun-relay": "2.7.2",
114
+ "@funkit/api-base": "4.3.0",
112
115
  "@funkit/chains": "1.2.0",
116
+ "@funkit/fun-relay": "2.7.3",
113
117
  "@funkit/utils": "3.0.1"
114
118
  },
115
119
  "repository": {
@@ -137,7 +141,8 @@
137
141
  "storybook:fast": "NODE_OPTIONS='--max-old-space-size=4096' storybook dev -p 6006 --no-open",
138
142
  "storybook:clean": "rm -rf node_modules/.vite && npm run storybook",
139
143
  "build-storybook": "storybook build",
140
- "statsig:generate": "tsx scripts/get_default_statsig_config.ts",
144
+ "statsig:api-types": "openapi-typescript https://api.statsig.com/openapi/20240601.json -o scripts/statsig/api-types.ts",
145
+ "statsig:generate": "tsx scripts/statsig/generate.ts",
141
146
  "i18n:unused": "node scripts/find-unused-i18n-keys.mjs"
142
147
  }
143
148
  }