@funkit/connect 12.9.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.
- package/CHANGELOG.md +21 -0
- package/dist/clients/{chunk-RAJJSGNT.js → chunk-U33QNTIA.js} +5 -2
- package/dist/clients/internal/nado/withdrawalForm.js +1 -1
- package/dist/clients/polymarket/createPolymarketDepositConfig.d.ts +19 -3
- package/dist/clients/polymarket/createPolymarketDepositConfig.js +1 -1
- package/dist/clients/polymarket/index.js +1 -1
- package/dist/index.js +46 -54
- package/dist/modals/PolymarketPerpsTransfer/PolymarketPerpsTransferScreen.d.ts +2 -2
- package/dist/modals/PolymarketPerpsTransfer/usePerpsTransferForm.d.ts +20 -15
- package/dist/providers/FunkitCheckoutContext/types.d.ts +13 -0
- package/dist/utils/solanaRelayWallet.d.ts +1 -5
- package/dist/wallets/Wallet.d.ts +1 -10
- package/dist/wallets/walletConnectors/index.js +39 -39
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @funkit/connect
|
|
2
2
|
|
|
3
|
+
## 12.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 54a6a79: Polymarket deposit configs can set the direction and amount the Transfer tab opens with.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- d4de552: Solana withdrawal signing now comes from the shared connect-core client.
|
|
12
|
+
- 400e342: The Polymarket transfer amount field shows dollars to the cent; Max still moves the full balance.
|
|
13
|
+
- Updated dependencies [d4de552]
|
|
14
|
+
- Updated dependencies [28c7128]
|
|
15
|
+
- Updated dependencies [30c01e5]
|
|
16
|
+
- Updated dependencies [d4de552]
|
|
17
|
+
- Updated dependencies [12a70d7]
|
|
18
|
+
- Updated dependencies [c452c25]
|
|
19
|
+
- Updated dependencies [ab41aa7]
|
|
20
|
+
- @funkit/api-base@8.5.0
|
|
21
|
+
- @funkit/connect-core@8.3.0
|
|
22
|
+
- @funkit/fun-relay@3.1.0
|
|
23
|
+
|
|
3
24
|
## 12.9.0
|
|
4
25
|
|
|
5
26
|
### Minor Changes
|
|
@@ -78,7 +78,8 @@ function createPolymarketDepositConfig({
|
|
|
78
78
|
modalTitles,
|
|
79
79
|
defaultAccount = "predictions",
|
|
80
80
|
pendingTransfers,
|
|
81
|
-
access
|
|
81
|
+
access,
|
|
82
|
+
transferDefaults
|
|
82
83
|
}) {
|
|
83
84
|
const isPerpsRoute = (routingId) => routingId === POLYMARKET_PERPS_ROUTING_ID;
|
|
84
85
|
const resolvedAccess = { ...access ?? FULL_DEPOSIT_ACCESS };
|
|
@@ -138,7 +139,9 @@ function createPolymarketDepositConfig({
|
|
|
138
139
|
predictions,
|
|
139
140
|
perps,
|
|
140
141
|
pending: pendingTransfers,
|
|
141
|
-
access: resolvedAccess
|
|
142
|
+
access: resolvedAccess,
|
|
143
|
+
initialDirection: transferDefaults?.direction,
|
|
144
|
+
initialAmountUsd: transferDefaults?.amountUsd
|
|
142
145
|
}
|
|
143
146
|
};
|
|
144
147
|
}
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
PLACEHOLDER_FUNKIT_USER_INFO
|
|
7
7
|
} from "../../chunk-CE42WHAA.js";
|
|
8
|
-
import "../../chunk-4DBUYTEE.js";
|
|
9
8
|
import "../../chunk-6EU6CXNH.js";
|
|
10
9
|
import {
|
|
11
10
|
useFunkitConfig
|
|
@@ -13,6 +12,7 @@ import {
|
|
|
13
12
|
import {
|
|
14
13
|
useFunkitTranslation
|
|
15
14
|
} from "../../chunk-ATNOIBW2.js";
|
|
15
|
+
import "../../chunk-4DBUYTEE.js";
|
|
16
16
|
import "../../chunk-2W2P3OS6.js";
|
|
17
17
|
import "../../chunk-7GPRX32F.js";
|
|
18
18
|
import {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { POLYMARKET_PERPS_ROUTING_ID, POLYMARKET_PREDICTIONS_ROUTING_ID } from '../../consts/polymarket';
|
|
2
|
-
import type { DepositAccess, FunkitCheckoutActionParams, FunkitCheckoutConfig, PolymarketPerpsTransferPending, PolymarketTransferAccount } from '../../providers/FunkitCheckoutContext/types';
|
|
2
|
+
import type { DepositAccess, FunkitCheckoutActionParams, FunkitCheckoutConfig, PerpsTransferDirection, PolymarketPerpsTransferPending, PolymarketTransferAccount } from '../../providers/FunkitCheckoutContext/types';
|
|
3
3
|
import { type PolymarketPerpsDepositConfig } from './polymarket';
|
|
4
4
|
export { POLYMARKET_PERPS_ROUTING_ID, POLYMARKET_PREDICTIONS_ROUTING_ID };
|
|
5
5
|
/**
|
|
@@ -22,7 +22,21 @@ export type PolymarketAccount = PolymarketTransferAccount;
|
|
|
22
22
|
* reaching outside this entry point — returning the rail's id is what lets a
|
|
23
23
|
* transfer record be joined to Polymarket's side of the same transfer.
|
|
24
24
|
*/
|
|
25
|
-
export type { PolymarketPerpsTransferPending, DepositAccess, PolymarketTransferResult, } from '../../providers/FunkitCheckoutContext/types';
|
|
25
|
+
export type { PolymarketPerpsTransferPending, DepositAccess, PerpsTransferDirection, PolymarketTransferResult, } from '../../providers/FunkitCheckoutContext/types';
|
|
26
|
+
/** What the transfer step opens with. Both fields are optional. */
|
|
27
|
+
export interface PolymarketTransferDefaults {
|
|
28
|
+
/**
|
|
29
|
+
* Direction on open. Defaults to Predictions → Perps. Ignored when `access`
|
|
30
|
+
* leaves only one product fundable — that product is the destination.
|
|
31
|
+
*/
|
|
32
|
+
direction?: PerpsTransferDirection;
|
|
33
|
+
/**
|
|
34
|
+
* Amount the field opens with, as a plain USD string with up to 2 decimals
|
|
35
|
+
* and no commas/separators. Examples of acceptable values: `'12.50'`,
|
|
36
|
+
* `'25'`, `'1000.00'`. Anything else is ignored.
|
|
37
|
+
*/
|
|
38
|
+
amountUsd?: string;
|
|
39
|
+
}
|
|
26
40
|
export interface CreatePolymarketDepositConfigParams {
|
|
27
41
|
/** Predictions account (the user's predictions proxy). */
|
|
28
42
|
predictions: PolymarketAccount;
|
|
@@ -57,6 +71,8 @@ export interface CreatePolymarketDepositConfigParams {
|
|
|
57
71
|
* location".
|
|
58
72
|
*/
|
|
59
73
|
access?: DepositAccess;
|
|
74
|
+
/** Direction and amount the Transfer tab opens with. */
|
|
75
|
+
transferDefaults?: PolymarketTransferDefaults;
|
|
60
76
|
}
|
|
61
77
|
/**
|
|
62
78
|
* Builds the entire Polymarket deposit checkout config from the two accounts.
|
|
@@ -66,4 +82,4 @@ export interface CreatePolymarketDepositConfigParams {
|
|
|
66
82
|
* step; modal title, min deposit, recipient and on-chain deposit actions are
|
|
67
83
|
* derived per account. Supersedes the "Deposit to" dropdown.
|
|
68
84
|
*/
|
|
69
|
-
export declare function createPolymarketDepositConfig({ predictions, perps, modalTitleMeta, modalTitles, defaultAccount, pendingTransfers, access, }: CreatePolymarketDepositConfigParams): FunkitCheckoutConfig;
|
|
85
|
+
export declare function createPolymarketDepositConfig({ predictions, perps, modalTitleMeta, modalTitles, defaultAccount, pendingTransfers, access, transferDefaults, }: CreatePolymarketDepositConfigParams): FunkitCheckoutConfig;
|
package/dist/index.js
CHANGED
|
@@ -113,7 +113,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
113
113
|
localStorage.setItem(storageKey, version);
|
|
114
114
|
}
|
|
115
115
|
function getCurrentSdkVersion() {
|
|
116
|
-
return "12.
|
|
116
|
+
return "12.10.0";
|
|
117
117
|
}
|
|
118
118
|
function useFingerprint() {
|
|
119
119
|
const fingerprint = useCallback(() => {
|
|
@@ -9861,43 +9861,21 @@ var useSolanaWallet = () => {
|
|
|
9861
9861
|
// src/utils/solanaRelayWallet.ts
|
|
9862
9862
|
import { isSolanaChainId as isSolanaChainId2 } from "@funkit/chains";
|
|
9863
9863
|
import {
|
|
9864
|
-
|
|
9865
|
-
|
|
9864
|
+
createSolanaRelayWallet as createSharedSolanaRelayWallet,
|
|
9865
|
+
resolveSolanaSigner
|
|
9866
|
+
} from "@funkit/connect-core/clients/solana";
|
|
9866
9867
|
|
|
9867
9868
|
// src/wallets/Wallet.ts
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
}
|
|
9869
|
+
import {
|
|
9870
|
+
isSolanaWithdrawalClient
|
|
9871
|
+
} from "@funkit/connect-core/clients/solana";
|
|
9871
9872
|
function isLighterWithdrawalClient(client) {
|
|
9872
9873
|
return "_type" in client && client._type === "lighter";
|
|
9873
9874
|
}
|
|
9874
9875
|
|
|
9875
9876
|
// src/utils/solanaRelayWallet.ts
|
|
9876
|
-
function resolveSigner(wallet) {
|
|
9877
|
-
if (wallet.signTransaction) {
|
|
9878
|
-
logger.info("solanaSigner:resolved", {
|
|
9879
|
-
address: wallet.address,
|
|
9880
|
-
path: "signTransaction"
|
|
9881
|
-
});
|
|
9882
|
-
return { signTransaction: wallet.signTransaction.bind(wallet) };
|
|
9883
|
-
}
|
|
9884
|
-
if (wallet.signAndSendTransaction) {
|
|
9885
|
-
logger.info("solanaSigner:resolved", {
|
|
9886
|
-
address: wallet.address,
|
|
9887
|
-
path: "signAndSendTransaction"
|
|
9888
|
-
});
|
|
9889
|
-
return {
|
|
9890
|
-
signAndSendTransaction: wallet.signAndSendTransaction.bind(wallet)
|
|
9891
|
-
};
|
|
9892
|
-
}
|
|
9893
|
-
throw new Error("Solana wallet supplied no way to sign a transaction");
|
|
9894
|
-
}
|
|
9895
9877
|
function createSolanaRelayWallet(wallet) {
|
|
9896
|
-
return
|
|
9897
|
-
walletAddress: wallet.address,
|
|
9898
|
-
connection: wallet.connection,
|
|
9899
|
-
signer: resolveSigner(wallet)
|
|
9900
|
-
});
|
|
9878
|
+
return createSharedSolanaRelayWallet(wallet, logger);
|
|
9901
9879
|
}
|
|
9902
9880
|
function resolveSolanaRelayWallet({
|
|
9903
9881
|
sourceChainId,
|
|
@@ -38549,7 +38527,7 @@ function PerpsTransferBody({ form }) {
|
|
|
38549
38527
|
/* @__PURE__ */ React229.createElement(
|
|
38550
38528
|
PerpsTransferAmountInput,
|
|
38551
38529
|
{
|
|
38552
|
-
amount: form.
|
|
38530
|
+
amount: form.displayAmount,
|
|
38553
38531
|
onAmountChange: form.setAmount
|
|
38554
38532
|
}
|
|
38555
38533
|
),
|
|
@@ -38751,9 +38729,13 @@ function parseAmount(amount) {
|
|
|
38751
38729
|
return Number(amount.replace(/,/g, ""));
|
|
38752
38730
|
}
|
|
38753
38731
|
var MAX_AMOUNT_DECIMALS = 6;
|
|
38754
|
-
var
|
|
38755
|
-
|
|
38756
|
-
);
|
|
38732
|
+
var MAX_TYPED_DECIMALS = 2;
|
|
38733
|
+
var VALID_FILLED_AMOUNT = buildAmountInputPattern(MAX_AMOUNT_DECIMALS);
|
|
38734
|
+
var VALID_TYPED_AMOUNT = buildAmountInputPattern(MAX_TYPED_DECIMALS);
|
|
38735
|
+
var VALID_PREFILL_AMOUNT = /^\d+(\.\d{1,2})?$/;
|
|
38736
|
+
function buildAmountInputPattern(maxDecimals) {
|
|
38737
|
+
return new RegExp(`^[\\d,]*\\.?\\d{0,${maxDecimals}}$`);
|
|
38738
|
+
}
|
|
38757
38739
|
function toNumericString(amount) {
|
|
38758
38740
|
const cleaned = amount.replace(/,/g, "").replace(/\.$/, "");
|
|
38759
38741
|
return cleaned.startsWith(".") ? `0${cleaned}` : cleaned;
|
|
@@ -38763,6 +38745,12 @@ function formatAmountValue(value) {
|
|
|
38763
38745
|
maximumFractionDigits: 6
|
|
38764
38746
|
});
|
|
38765
38747
|
}
|
|
38748
|
+
function formatDisplayAmount(amount) {
|
|
38749
|
+
return floorToDecimals(parseAmount(amount), 2).toLocaleString("en-US", {
|
|
38750
|
+
minimumFractionDigits: 2,
|
|
38751
|
+
maximumFractionDigits: 2
|
|
38752
|
+
});
|
|
38753
|
+
}
|
|
38766
38754
|
function getLockedTransferDirection(access) {
|
|
38767
38755
|
if (!access || access.predictions === access.perps) {
|
|
38768
38756
|
return void 0;
|
|
@@ -38784,8 +38772,14 @@ function usePerpsTransferForm({
|
|
|
38784
38772
|
}) {
|
|
38785
38773
|
const { t } = useFunkitTranslation();
|
|
38786
38774
|
const { logEvent } = useTrack();
|
|
38787
|
-
const
|
|
38788
|
-
const
|
|
38775
|
+
const initialAmount = Number(initialAmountUsd);
|
|
38776
|
+
const isInitialAmountUsdValid = VALID_PREFILL_AMOUNT.test(initialAmountUsd) && Number.isFinite(initialAmount) && initialAmount > 0;
|
|
38777
|
+
const [amount, setAmount] = useState62(
|
|
38778
|
+
isInitialAmountUsdValid ? initialAmountUsd : ""
|
|
38779
|
+
);
|
|
38780
|
+
const [amountSelection, setAmountSelection] = useState62(
|
|
38781
|
+
isInitialAmountUsdValid ? "prefill" : null
|
|
38782
|
+
);
|
|
38789
38783
|
const lockedDirection = getLockedTransferDirection(access);
|
|
38790
38784
|
const predictionsAccessible = access?.predictions ?? true;
|
|
38791
38785
|
const perpsAccessible = access?.perps ?? true;
|
|
@@ -38801,10 +38795,12 @@ function usePerpsTransferForm({
|
|
|
38801
38795
|
},
|
|
38802
38796
|
initialDirection,
|
|
38803
38797
|
resolvedDirection: lockedDirection ?? initialDirection,
|
|
38804
|
-
isDirectionLocked: Boolean(lockedDirection) || !hasAccessibleDestination
|
|
38798
|
+
isDirectionLocked: Boolean(lockedDirection) || !hasAccessibleDestination,
|
|
38799
|
+
initialAmountUsd
|
|
38805
38800
|
});
|
|
38806
38801
|
}, [
|
|
38807
38802
|
hasAccessibleDestination,
|
|
38803
|
+
initialAmountUsd,
|
|
38808
38804
|
initialDirection,
|
|
38809
38805
|
lockedDirection,
|
|
38810
38806
|
perpsAccessible,
|
|
@@ -38822,7 +38818,8 @@ function usePerpsTransferForm({
|
|
|
38822
38818
|
}
|
|
38823
38819
|
}, [status]);
|
|
38824
38820
|
const applyValidAmount = (next, selection) => {
|
|
38825
|
-
|
|
38821
|
+
const pattern = selection === "manual" ? VALID_TYPED_AMOUNT : VALID_FILLED_AMOUNT;
|
|
38822
|
+
if (pattern.test(next)) {
|
|
38826
38823
|
setAmount(next);
|
|
38827
38824
|
setAmountSelection(selection);
|
|
38828
38825
|
}
|
|
@@ -38926,8 +38923,10 @@ function usePerpsTransferForm({
|
|
|
38926
38923
|
amountSelection
|
|
38927
38924
|
});
|
|
38928
38925
|
};
|
|
38926
|
+
const displayAmount = amountSelection !== null && amountSelection !== "manual" ? formatDisplayAmount(amount) : amount;
|
|
38929
38927
|
return {
|
|
38930
38928
|
amount,
|
|
38929
|
+
displayAmount,
|
|
38931
38930
|
setAmount: handleAmountChange,
|
|
38932
38931
|
fillMaxAmount,
|
|
38933
38932
|
fillPercentAmount,
|
|
@@ -39039,6 +39038,8 @@ function PerpsTransferStepComponent({
|
|
|
39039
39038
|
perpsBalanceUsd,
|
|
39040
39039
|
predictionsMinTransferUsd: perpsTransfer?.predictions.getMinTopupAmount("pUSD"),
|
|
39041
39040
|
perpsMinTransferUsd: perpsTransfer?.perps.getMinTopupAmount("pUSD"),
|
|
39041
|
+
initialDirection: perpsTransfer?.initialDirection,
|
|
39042
|
+
initialAmountUsd: perpsTransfer?.initialAmountUsd,
|
|
39042
39043
|
status,
|
|
39043
39044
|
isBalanceRefreshing,
|
|
39044
39045
|
pendingTransfers: perpsTransfer?.pending,
|
|
@@ -56581,22 +56582,10 @@ function createConnectedWithdrawalClient(config, ownerAddress, sourceChainId) {
|
|
|
56581
56582
|
// src/wallets/solanaWithdrawal.ts
|
|
56582
56583
|
import { solanaChain as solanaChain8 } from "@funkit/chains";
|
|
56583
56584
|
import { toValidatedSolanaAddress as toValidatedSolanaAddress2, useLogOnce as useLogOnce6 } from "@funkit/connect-core";
|
|
56585
|
+
import {
|
|
56586
|
+
createSolanaWithdrawalClient
|
|
56587
|
+
} from "@funkit/connect-core/clients/solana";
|
|
56584
56588
|
import { useMemo as useMemo76 } from "react";
|
|
56585
|
-
function unsupported(member) {
|
|
56586
|
-
throw new Error(`SolanaWithdrawalClient does not support ${member}`);
|
|
56587
|
-
}
|
|
56588
|
-
function createSolanaWithdrawalClient(wallet) {
|
|
56589
|
-
return {
|
|
56590
|
-
_type: "solana",
|
|
56591
|
-
adaptedWallet: createSolanaRelayWallet(wallet),
|
|
56592
|
-
address: () => wallet.address,
|
|
56593
|
-
getChainId: async () => solanaChain8.id,
|
|
56594
|
-
switchChain: async () => {
|
|
56595
|
-
},
|
|
56596
|
-
sendTransaction: () => unsupported("sendTransaction"),
|
|
56597
|
-
confirmTransaction: () => unsupported("confirmTransaction")
|
|
56598
|
-
};
|
|
56599
|
-
}
|
|
56600
56589
|
function useSolanaWithdrawalConfig(params) {
|
|
56601
56590
|
const signer = params?.signer;
|
|
56602
56591
|
const address = toValidatedSolanaAddress2(signer?.address);
|
|
@@ -56618,7 +56607,10 @@ function useSolanaWithdrawalConfig(params) {
|
|
|
56618
56607
|
// TODO: Cast until #6751 widens the source address type.
|
|
56619
56608
|
sourceTokenAddress,
|
|
56620
56609
|
sourceChainId: String(solanaChain8.id),
|
|
56621
|
-
wallet: createSolanaWithdrawalClient(
|
|
56610
|
+
wallet: createSolanaWithdrawalClient(
|
|
56611
|
+
signer,
|
|
56612
|
+
logger
|
|
56613
|
+
)
|
|
56622
56614
|
};
|
|
56623
56615
|
}, [params, signer, address]);
|
|
56624
56616
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { DepositAccess, PolymarketPerpsTransferPending } from '../../providers/FunkitCheckoutContext/types';
|
|
2
|
+
import type { DepositAccess, PerpsTransferDirection, PolymarketPerpsTransferPending } from '../../providers/FunkitCheckoutContext/types';
|
|
3
3
|
import { type PerpsTransferAmountSelection } from './usePerpsTransferForm';
|
|
4
|
-
export type PerpsTransferDirection
|
|
4
|
+
export type { PerpsTransferDirection };
|
|
5
5
|
/**
|
|
6
6
|
* `pending` and `loading` can be derived by the form from transfer and balance
|
|
7
7
|
* state. Explicit host-provided statuses are honored as well.
|
|
@@ -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
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
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`),
|
|
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
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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,13 +1,9 @@
|
|
|
1
|
-
import {
|
|
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;
|
package/dist/wallets/Wallet.d.ts
CHANGED
|
@@ -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 {};
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
xdefiWallet
|
|
4
4
|
} from "./chunk-HXX4PRE2.js";
|
|
5
|
-
import {
|
|
6
|
-
zerionWallet
|
|
7
|
-
} from "./chunk-34B7OJNT.js";
|
|
8
5
|
import {
|
|
9
6
|
zealWallet
|
|
10
7
|
} from "./chunk-GLX5FULK.js";
|
|
8
|
+
import {
|
|
9
|
+
zerionWallet
|
|
10
|
+
} from "./chunk-34B7OJNT.js";
|
|
11
11
|
import {
|
|
12
12
|
subWallet
|
|
13
13
|
} from "./chunk-XODA5ESL.js";
|
|
@@ -32,21 +32,18 @@ import {
|
|
|
32
32
|
import {
|
|
33
33
|
walletConnectWallet
|
|
34
34
|
} from "./chunk-DUX4XCDV.js";
|
|
35
|
-
import {
|
|
36
|
-
oneKeyWallet
|
|
37
|
-
} from "./chunk-KN32ITJ7.js";
|
|
38
35
|
import {
|
|
39
36
|
rabbyWallet
|
|
40
37
|
} from "./chunk-RQ2GXOJL.js";
|
|
38
|
+
import {
|
|
39
|
+
phantomWallet
|
|
40
|
+
} from "./chunk-Q27YVDDH.js";
|
|
41
41
|
import {
|
|
42
42
|
rainbowWallet
|
|
43
43
|
} from "./chunk-ZSSSLFQF.js";
|
|
44
44
|
import {
|
|
45
45
|
ramperWallet
|
|
46
46
|
} from "./chunk-GPXIBTWN.js";
|
|
47
|
-
import {
|
|
48
|
-
safeWallet
|
|
49
|
-
} from "./chunk-IR3PJMVM.js";
|
|
50
47
|
import {
|
|
51
48
|
roninWallet
|
|
52
49
|
} from "./chunk-IA5432IR.js";
|
|
@@ -56,18 +53,24 @@ import {
|
|
|
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";
|
|
68
65
|
import {
|
|
69
66
|
oktoWallet
|
|
70
67
|
} from "./chunk-V4M3SNPS.js";
|
|
68
|
+
import {
|
|
69
|
+
okxWallet
|
|
70
|
+
} from "./chunk-CU5J53XR.js";
|
|
71
|
+
import {
|
|
72
|
+
metaMaskWallet
|
|
73
|
+
} from "./chunk-RXRYHMRI.js";
|
|
71
74
|
import {
|
|
72
75
|
omniWallet
|
|
73
76
|
} from "./chunk-2TAUCVX7.js";
|
|
@@ -75,23 +78,20 @@ import {
|
|
|
75
78
|
oneInchWallet
|
|
76
79
|
} from "./chunk-GFS2AVAH.js";
|
|
77
80
|
import {
|
|
78
|
-
|
|
79
|
-
} from "./chunk-
|
|
80
|
-
import {
|
|
81
|
-
phantomWallet
|
|
82
|
-
} from "./chunk-Q27YVDDH.js";
|
|
81
|
+
oneKeyWallet
|
|
82
|
+
} from "./chunk-KN32ITJ7.js";
|
|
83
83
|
import {
|
|
84
84
|
foxWallet
|
|
85
85
|
} from "./chunk-U52QO5HF.js";
|
|
86
86
|
import {
|
|
87
|
-
|
|
88
|
-
} from "./chunk-
|
|
87
|
+
frameWallet
|
|
88
|
+
} from "./chunk-B572YIAQ.js";
|
|
89
|
+
import {
|
|
90
|
+
enkryptWallet
|
|
91
|
+
} from "./chunk-Z6LDN2AN.js";
|
|
89
92
|
import {
|
|
90
93
|
frontierWallet
|
|
91
94
|
} from "./chunk-IWOMSW64.js";
|
|
92
|
-
import {
|
|
93
|
-
frameWallet
|
|
94
|
-
} from "./chunk-B572YIAQ.js";
|
|
95
95
|
import {
|
|
96
96
|
gateWallet
|
|
97
97
|
} from "./chunk-YRMBR6NA.js";
|
|
@@ -105,17 +105,17 @@ import {
|
|
|
105
105
|
kresusWallet
|
|
106
106
|
} from "./chunk-V77ATGZT.js";
|
|
107
107
|
import {
|
|
108
|
-
|
|
109
|
-
} from "./chunk-
|
|
108
|
+
bybitWallet
|
|
109
|
+
} from "./chunk-BBDNB5TQ.js";
|
|
110
|
+
import {
|
|
111
|
+
clvWallet
|
|
112
|
+
} from "./chunk-4FHNLTR3.js";
|
|
110
113
|
import {
|
|
111
114
|
coin98Wallet
|
|
112
115
|
} from "./chunk-RFCZYLNR.js";
|
|
113
116
|
import {
|
|
114
117
|
coinbaseWallet
|
|
115
118
|
} from "./chunk-SM2A3OSG.js";
|
|
116
|
-
import {
|
|
117
|
-
coreWallet
|
|
118
|
-
} from "./chunk-TRZDAXCQ.js";
|
|
119
119
|
import {
|
|
120
120
|
customWallet
|
|
121
121
|
} from "./chunk-VKM5M5UK.js";
|
|
@@ -123,11 +123,14 @@ import {
|
|
|
123
123
|
dawnWallet
|
|
124
124
|
} from "./chunk-LV6YV3DE.js";
|
|
125
125
|
import {
|
|
126
|
-
|
|
127
|
-
} from "./chunk-
|
|
126
|
+
coreWallet
|
|
127
|
+
} from "./chunk-TRZDAXCQ.js";
|
|
128
128
|
import {
|
|
129
129
|
desigWallet
|
|
130
130
|
} from "./chunk-DFHP75HV.js";
|
|
131
|
+
import {
|
|
132
|
+
argentWallet
|
|
133
|
+
} from "./chunk-XSDTNMQY.js";
|
|
131
134
|
import {
|
|
132
135
|
bifrostWallet
|
|
133
136
|
} from "./chunk-ALGPGI6V.js";
|
|
@@ -135,21 +138,18 @@ import {
|
|
|
135
138
|
bitgetWallet
|
|
136
139
|
} from "./chunk-HOCKAU5H.js";
|
|
137
140
|
import {
|
|
138
|
-
|
|
139
|
-
} from "./chunk-
|
|
140
|
-
import {
|
|
141
|
-
bloomWallet
|
|
142
|
-
} from "./chunk-PNHDOC77.js";
|
|
141
|
+
bitskiWallet
|
|
142
|
+
} from "./chunk-NPITCCJE.js";
|
|
143
143
|
import {
|
|
144
144
|
bitverseWallet
|
|
145
145
|
} from "./chunk-5AEWIKRA.js";
|
|
146
146
|
import {
|
|
147
|
-
|
|
148
|
-
} from "./chunk-
|
|
149
|
-
import {
|
|
150
|
-
bybitWallet
|
|
151
|
-
} from "./chunk-BBDNB5TQ.js";
|
|
147
|
+
bloomWallet
|
|
148
|
+
} from "./chunk-PNHDOC77.js";
|
|
152
149
|
import "./chunk-AALSJCUR.js";
|
|
150
|
+
import {
|
|
151
|
+
braveWallet
|
|
152
|
+
} from "./chunk-U2XXV45G.js";
|
|
153
153
|
import "./chunk-EYWGX5LT.js";
|
|
154
154
|
import "./chunk-B454LLKJ.js";
|
|
155
155
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funkit/connect",
|
|
3
|
-
"version": "12.
|
|
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,10 +119,10 @@
|
|
|
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.
|
|
122
|
+
"@funkit/api-base": "8.5.0",
|
|
123
123
|
"@funkit/chains": "2.4.0",
|
|
124
|
-
"@funkit/connect-core": "8.
|
|
125
|
-
"@funkit/fun-relay": "3.0
|
|
124
|
+
"@funkit/connect-core": "8.3.0",
|
|
125
|
+
"@funkit/fun-relay": "3.1.0",
|
|
126
126
|
"@funkit/utils": "5.0.0"
|
|
127
127
|
},
|
|
128
128
|
"repository": {
|