@funkit/connect 12.8.0 → 12.10.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.
@@ -1,23 +1,19 @@
1
1
  import type { DepositAccess, PolymarketPerpsTransferPending } from '../../providers/FunkitCheckoutContext/types';
2
2
  import type { PerpsTransferDirection, PerpsTransferStatus } from './PolymarketPerpsTransferScreen';
3
3
  /**
4
- * pUSD has 6 on-chain decimals, so balances carry up to 6 decimal places. We
5
- * render only the decimals actually present, up to 6: capping at 2 rounded
6
- * `196.867461` *up* to `196.87`, so Max filled a value above the real balance
7
- * and tripped the insufficient-balance guard. At 6 decimals the value is
8
- * reproduced exactly. There is no minimum, so trailing zeros are trimmed —
9
- * a `1.1` balance fills as `1.1`, not `1.100000` (or `1.10`).
10
- *
11
- * Not `formatCurrencyAndStringify` — that helper produces a 2-decimal `$`
12
- * display string, while this fills the editable input with an exact,
13
- * re-parsable pUSD amount.
4
+ * The *held* value of a chip/Max fill. pUSD has 6 on-chain decimals, so only
5
+ * 6 decimals reproduce a balance exactly: capping at 2 rounded `196.867461`
6
+ * *up* to `196.87`, which exceeded the real balance and tripped the
7
+ * insufficient-balance guard. Trailing zeros are trimmed. The 2-decimal view
8
+ * the user sees is {@link formatDisplayAmount}.
14
9
  */
15
10
  export declare function formatAmountValue(value: number): string;
16
11
  /**
17
12
  * How the confirmed amount was chosen — `manual` typing, a percent chip
18
- * (`preset`), or the Max chip. `null` until the amount is first set.
13
+ * (`preset`), the Max chip, or an integrator-supplied `prefill` the user left
14
+ * untouched. `null` until the amount is first set.
19
15
  */
20
- export type PerpsTransferAmountSelection = 'manual' | 'preset' | 'max';
16
+ export type PerpsTransferAmountSelection = 'manual' | 'preset' | 'max' | 'prefill';
21
17
  export interface PerpsTransferFormProps {
22
18
  predictionsBalanceUsd: number;
23
19
  perpsBalanceUsd: number;
@@ -26,7 +22,7 @@ export interface PerpsTransferFormProps {
26
22
  /** Minimum pUSD to transfer *into* perps (USD). */
27
23
  perpsMinTransferUsd?: number;
28
24
  initialDirection?: PerpsTransferDirection;
29
- /** Initial amount input string (pUSD). */
25
+ /** Initial amount (plain USD string, up to 2 decimals). Omit for an empty field. */
30
26
  initialAmountUsd?: string;
31
27
  status?: PerpsTransferStatus;
32
28
  /** Whether a retained balance is waiting for a fresh authoritative value. */
@@ -51,9 +47,18 @@ export interface PerpsTransferAccount {
51
47
  }
52
48
  /** Plain form state consumed by `PerpsTransferBody` and `PerpsTransferBottomBar`. */
53
49
  export interface PerpsTransferForm {
54
- /** Raw amount input string (may contain separators). */
50
+ /**
51
+ * The held amount (may contain separators) — what `onTransfer` forwards.
52
+ * A chip/Max fill keeps up to 6 decimals here so no balance is stranded.
53
+ */
55
54
  amount: string;
56
- /** Validated setter — ignores input that isn't numeric with ≤6 decimals. */
55
+ /**
56
+ * What the input renders: `amount` verbatim while the user types, or a
57
+ * 2-decimal cent-floored view of a chip/Max fill. Editing a fill replaces
58
+ * the held value with the edited string, so the two converge on first edit.
59
+ */
60
+ displayAmount: string;
61
+ /** Validated setter — ignores input that isn't numeric with ≤2 decimals. */
57
62
  setAmount: (next: string) => void;
58
63
  /** Fills the amount with the source balance at full 6-decimal precision. */
59
64
  fillMaxAmount: () => void;
@@ -120,6 +120,8 @@ export interface PolymarketPerpsTransferPending {
120
120
  /** A perps → predictions withdrawal was submitted and has not yet landed. */
121
121
  isPerpsWithdrawalPending: boolean;
122
122
  }
123
+ /** Which way funds move on the transfer step; the name is the destination. */
124
+ export type PerpsTransferDirection = 'toPerps' | 'toPredictions';
123
125
  /** The two accounts the perps transfer step moves funds between. */
124
126
  export interface PolymarketPerpsTransferHandles {
125
127
  predictions: PolymarketTransferAccount;
@@ -127,6 +129,17 @@ export interface PolymarketPerpsTransferHandles {
127
129
  /** Integrator-reported in-flight transfers; absent means none pending. */
128
130
  pending?: PolymarketPerpsTransferPending;
129
131
  access?: DepositAccess;
132
+ /**
133
+ * Direction the transfer step opens with. Defaults to Predictions → Perps;
134
+ * a single-product `access` still wins and locks the direction.
135
+ */
136
+ initialDirection?: PerpsTransferDirection;
137
+ /**
138
+ * Amount the transfer step opens with: a plain USD string, up to 2 decimals,
139
+ * no commas/separators (`'12.50'`, `'25'`, `'1000.00'`). Invalid or zero
140
+ * values are ignored; empty by default.
141
+ */
142
+ initialAmountUsd?: string;
130
143
  }
131
144
  export interface FunkitCheckoutConfig extends Omit<ApiFunkitCheckoutConfig, 'generateActionsParams' | 'customRecipient' | 'modalTitle' | 'iconSrc' | 'modalTitleMeta'> {
132
145
  /** List of contract action params **/
@@ -1,9 +1,7 @@
1
1
  /**
2
- * Fetch the compiled shadow stylesheet at runtime. `dist/shadow-css.js` is a
3
- * build artifact of this same build, so it can't be imported statically —
4
- * and a static import would ship the ~800KB CSS string to every integrator.
5
- * The dynamic specifier survives esbuild (bare imports are externalized) and
6
- * resolves through node_modules from inside the published package, so the
7
- * chunk is only fetched when shadow mode actually turns on.
2
+ * Load the shadow stylesheet, retrying on the schedule above. Webpack and
3
+ * Turbopack re-attempt a failed chunk on the next call, which clears most
4
+ * transient network failures; a stale-deploy 404 fails the same way every
5
+ * time and falls back.
8
6
  */
9
7
  export declare function loadShadowCss(): Promise<string | null>;
@@ -1,13 +1,9 @@
1
- import { type SolanaSigner, type SolanaWallet } from '@funkit/fun-relay';
1
+ import type { SolanaSigner, SolanaWallet } from '@funkit/fun-relay';
2
2
  import type { SolanaAddress } from '@funkit/api-base';
3
3
  import type { SolanaWalletSigner } from '../interfaces/solanaWallet';
4
4
  import type { ValidatedSolanaWallet } from '../providers/SolanaWalletProvider';
5
5
  import { type WithdrawalClient } from '../wallets/Wallet';
6
6
  export declare function resolveSigner(wallet: SolanaWalletSigner): SolanaSigner;
7
- /**
8
- * Takes a wallet that cleared `SolanaWalletProvider`'s validation: relay's
9
- * adapter types the payer as a base58 address, not the host's bare string.
10
- */
11
7
  export declare function createSolanaRelayWallet(wallet: SolanaWalletSigner & {
12
8
  address: SolanaAddress;
13
9
  }): SolanaWallet;
@@ -3,6 +3,7 @@ import type { Connector, CreateConnectorFn } from '../wagmi/hooks';
3
3
  import type { TransactionReceipt, TypedDataDomain } from 'viem';
4
4
  import type { CoinbaseWalletOptions } from './walletConnectors/coinbaseWallet/coinbaseWallet';
5
5
  import type { WalletConnectWalletOptions } from './walletConnectors/walletConnectWallet/walletConnectWallet';
6
+ export { isSolanaWithdrawalClient, type SolanaWithdrawalClient, } from '@funkit/connect-core/clients/solana';
6
7
  export type InstructionStepName = 'install' | 'create' | 'scan' | 'connect' | 'refresh';
7
8
  type FunkitSdkConnector = {
8
9
  mobile?: {
@@ -153,14 +154,4 @@ export interface LighterWithdrawalClient extends WithdrawalClient {
153
154
  readonly _type: 'lighter';
154
155
  readonly adaptedWallet: import('@funkit/fun-relay').LighterWallet;
155
156
  }
156
- /**
157
- * Solana-source variant. Carries the relay adapted wallet (Lighter pattern) so
158
- * execution skips the EVM shim; the EVM-shaped members only satisfy the contract.
159
- */
160
- export interface SolanaWithdrawalClient extends WithdrawalClient {
161
- readonly _type: 'solana';
162
- readonly adaptedWallet: import('@funkit/fun-relay').SolanaWallet;
163
- }
164
- export declare function isSolanaWithdrawalClient(client: WithdrawalClient): client is SolanaWithdrawalClient;
165
157
  export declare function isLighterWithdrawalClient(client: WithdrawalClient): client is LighterWithdrawalClient;
166
- export {};
@@ -0,0 +1,13 @@
1
+ import type { Address } from 'viem';
2
+ import type { Config } from '../wagmi/hooks';
3
+ import type { WithdrawalClient } from './Wallet';
4
+ /**
5
+ * Adapts the user's connected (wagmi) wallet into the {@link WithdrawalClient}
6
+ * shape the SDK's relay execution drives.
7
+ *
8
+ * Everything is routed through wagmi-core actions bound to the live `config`
9
+ * (not a captured viem client) so chain switches and account changes are always
10
+ * read from current state — `sendTransaction` ensures the wallet is on
11
+ * `chainId` first, so the relay flow never broadcasts on the wrong chain.
12
+ */
13
+ export declare function createConnectedWithdrawalClient(config: Config, ownerAddress: Address, sourceChainId: number): WithdrawalClient;
@@ -11,57 +11,54 @@ import {
11
11
  import {
12
12
  subWallet
13
13
  } from "./chunk-XODA5ESL.js";
14
+ import {
15
+ tahoWallet
16
+ } from "./chunk-U74RFZOL.js";
14
17
  import {
15
18
  talismanWallet
16
19
  } from "./chunk-IAYYWCVB.js";
17
20
  import {
18
21
  tokenPocketWallet
19
22
  } from "./chunk-NXWG6FG2.js";
20
- import {
21
- tahoWallet
22
- } from "./chunk-U74RFZOL.js";
23
23
  import {
24
24
  tokenaryWallet
25
25
  } from "./chunk-TPM5PUJD.js";
26
- import {
27
- trustWallet
28
- } from "./chunk-SR5CZR3L.js";
29
26
  import {
30
27
  uniswapWallet
31
28
  } from "./chunk-UNDWHCDH.js";
29
+ import {
30
+ trustWallet
31
+ } from "./chunk-SR5CZR3L.js";
32
32
  import {
33
33
  walletConnectWallet
34
34
  } from "./chunk-DUX4XCDV.js";
35
- import {
36
- phantomWallet
37
- } from "./chunk-Q27YVDDH.js";
38
35
  import {
39
36
  rabbyWallet
40
37
  } from "./chunk-RQ2GXOJL.js";
41
38
  import {
42
- ramperWallet
43
- } from "./chunk-GPXIBTWN.js";
39
+ phantomWallet
40
+ } from "./chunk-Q27YVDDH.js";
44
41
  import {
45
42
  rainbowWallet
46
43
  } from "./chunk-ZSSSLFQF.js";
44
+ import {
45
+ ramperWallet
46
+ } from "./chunk-GPXIBTWN.js";
47
47
  import {
48
48
  roninWallet
49
49
  } from "./chunk-IA5432IR.js";
50
- import {
51
- safeWallet
52
- } from "./chunk-IR3PJMVM.js";
53
50
  import {
54
51
  safeheronWallet
55
52
  } from "./chunk-UN3ONVNC.js";
56
53
  import {
57
54
  safepalWallet
58
55
  } from "./chunk-BBB2J3US.js";
56
+ import {
57
+ safeWallet
58
+ } from "./chunk-IR3PJMVM.js";
59
59
  import {
60
60
  ledgerWallet
61
61
  } from "./chunk-BL4OC2EJ.js";
62
- import {
63
- metaMaskWallet
64
- } from "./chunk-RXRYHMRI.js";
65
62
  import {
66
63
  mewWallet
67
64
  } from "./chunk-DSPQXAB2.js";
@@ -71,6 +68,9 @@ import {
71
68
  import {
72
69
  okxWallet
73
70
  } from "./chunk-CU5J53XR.js";
71
+ import {
72
+ metaMaskWallet
73
+ } from "./chunk-RXRYHMRI.js";
74
74
  import {
75
75
  omniWallet
76
76
  } from "./chunk-2TAUCVX7.js";
@@ -80,18 +80,18 @@ import {
80
80
  import {
81
81
  oneKeyWallet
82
82
  } from "./chunk-KN32ITJ7.js";
83
- import {
84
- enkryptWallet
85
- } from "./chunk-Z6LDN2AN.js";
86
83
  import {
87
84
  foxWallet
88
85
  } from "./chunk-U52QO5HF.js";
89
- import {
90
- frontierWallet
91
- } from "./chunk-IWOMSW64.js";
92
86
  import {
93
87
  frameWallet
94
88
  } from "./chunk-B572YIAQ.js";
89
+ import {
90
+ enkryptWallet
91
+ } from "./chunk-Z6LDN2AN.js";
92
+ import {
93
+ frontierWallet
94
+ } from "./chunk-IWOMSW64.js";
95
95
  import {
96
96
  gateWallet
97
97
  } from "./chunk-YRMBR6NA.js";
@@ -110,42 +110,42 @@ import {
110
110
  import {
111
111
  clvWallet
112
112
  } from "./chunk-4FHNLTR3.js";
113
- import {
114
- coinbaseWallet
115
- } from "./chunk-SM2A3OSG.js";
116
- import {
117
- coreWallet
118
- } from "./chunk-TRZDAXCQ.js";
119
113
  import {
120
114
  coin98Wallet
121
115
  } from "./chunk-RFCZYLNR.js";
116
+ import {
117
+ coinbaseWallet
118
+ } from "./chunk-SM2A3OSG.js";
122
119
  import {
123
120
  customWallet
124
121
  } from "./chunk-VKM5M5UK.js";
125
122
  import {
126
123
  dawnWallet
127
124
  } from "./chunk-LV6YV3DE.js";
125
+ import {
126
+ coreWallet
127
+ } from "./chunk-TRZDAXCQ.js";
128
128
  import {
129
129
  desigWallet
130
130
  } from "./chunk-DFHP75HV.js";
131
131
  import {
132
- bitskiWallet
133
- } from "./chunk-NPITCCJE.js";
132
+ argentWallet
133
+ } from "./chunk-XSDTNMQY.js";
134
134
  import {
135
135
  bifrostWallet
136
136
  } from "./chunk-ALGPGI6V.js";
137
137
  import {
138
- argentWallet
139
- } from "./chunk-XSDTNMQY.js";
138
+ bitgetWallet
139
+ } from "./chunk-HOCKAU5H.js";
140
+ import {
141
+ bitskiWallet
142
+ } from "./chunk-NPITCCJE.js";
140
143
  import {
141
144
  bitverseWallet
142
145
  } from "./chunk-5AEWIKRA.js";
143
146
  import {
144
147
  bloomWallet
145
148
  } from "./chunk-PNHDOC77.js";
146
- import {
147
- bitgetWallet
148
- } from "./chunk-HOCKAU5H.js";
149
149
  import "./chunk-AALSJCUR.js";
150
150
  import {
151
151
  braveWallet
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/connect",
3
- "version": "12.8.0",
3
+ "version": "12.10.0",
4
4
  "description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
5
5
  "files": [
6
6
  "dist",
@@ -119,11 +119,11 @@
119
119
  "ua-parser-js": "^1.0.37",
120
120
  "use-debounce": "^10.0.5",
121
121
  "uuid": "^11.1.1",
122
+ "@funkit/api-base": "8.5.0",
122
123
  "@funkit/chains": "2.4.0",
123
- "@funkit/connect-core": "8.1.1",
124
- "@funkit/utils": "5.0.0",
125
- "@funkit/api-base": "8.4.0",
126
- "@funkit/fun-relay": "3.0.1"
124
+ "@funkit/connect-core": "8.3.0",
125
+ "@funkit/fun-relay": "3.1.0",
126
+ "@funkit/utils": "5.0.0"
127
127
  },
128
128
  "repository": {
129
129
  "type": "git",
@@ -136,7 +136,7 @@
136
136
  "build": "node build.js && pnpm typecheck",
137
137
  "build:watch": "node build.js --watch",
138
138
  "dev": "pnpm build:watch & pnpm typegen:watch",
139
- "prebuild": "pnpm typegen",
139
+ "prebuild": "rm -rf dist && pnpm typegen",
140
140
  "typecheck": "pnpm tsc --noEmit",
141
141
  "typegen": "tsc --project tsconfig.build.json --emitDeclarationOnly && tsc-alias",
142
142
  "typegen:watch": "tsc --project tsconfig.build.json --emitDeclarationOnly --watch & tsc-alias --project tsconfig.build.json --watch",