@b3dotfun/sdk 0.0.62 → 0.0.63-test.0-alpha.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/dist/cjs/anyspend/react/components/AnySpend.js +61 -23
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +3 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +34 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +275 -0
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +5 -4
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +9 -0
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +288 -0
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +11 -0
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.js +33 -0
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +4 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +4 -6
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +9 -17
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +6 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +11 -1
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +66 -147
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -3
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +39 -15
- package/dist/cjs/anyspend/react/components/common/PaySection.js +1 -1
- package/dist/cjs/anyspend/react/components/common/TokenBalance.js +1 -1
- package/dist/cjs/anyspend/react/components/index.d.ts +5 -1
- package/dist/cjs/anyspend/react/components/index.js +11 -3
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +25 -3
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +42 -19
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +116 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendQuote.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.d.ts +26 -0
- package/dist/cjs/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.js +56 -0
- package/dist/cjs/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +10 -0
- package/dist/cjs/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.js +73 -0
- package/dist/cjs/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +14 -0
- package/dist/cjs/anyspend/react/hooks/useConnectedWalletDisplay.js +57 -0
- package/dist/cjs/anyspend/react/hooks/usePhantomTransfer.d.ts +36 -0
- package/dist/cjs/anyspend/react/hooks/usePhantomTransfer.js +211 -0
- package/dist/cjs/anyspend/types/api.d.ts +665 -3
- package/dist/cjs/anyspend/utils/orderPayload.js +4 -0
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +10 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +3 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
- package/dist/cjs/global-account/react/hooks/index.d.ts +2 -1
- package/dist/cjs/global-account/react/hooks/index.js +5 -3
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +7 -2
- package/dist/cjs/global-account/react/hooks/useSimBalance.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useSimBalance.js +6 -5
- package/dist/cjs/global-account/react/hooks/useTokenBalanceDirect.d.ts +12 -0
- package/dist/cjs/global-account/react/hooks/useTokenBalanceDirect.js +62 -0
- package/dist/cjs/global-account/react/hooks/useTokenFromUrl.js +4 -3
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +31 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +62 -24
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +3 -0
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +34 -0
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +269 -0
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +7 -6
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +9 -0
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +285 -0
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +11 -0
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.js +30 -0
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +4 -4
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +5 -7
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +9 -17
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +6 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +11 -1
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +67 -148
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +2 -3
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.d.ts +2 -1
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +40 -16
- package/dist/esm/anyspend/react/components/common/PaySection.js +1 -1
- package/dist/esm/anyspend/react/components/common/TokenBalance.js +2 -2
- package/dist/esm/anyspend/react/components/index.d.ts +5 -1
- package/dist/esm/anyspend/react/components/index.js +5 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +25 -3
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +42 -19
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +116 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendQuote.js +1 -1
- package/dist/esm/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.d.ts +26 -0
- package/dist/esm/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.js +53 -0
- package/dist/esm/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +10 -0
- package/dist/esm/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.js +70 -0
- package/dist/esm/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +14 -0
- package/dist/esm/anyspend/react/hooks/useConnectedWalletDisplay.js +54 -0
- package/dist/esm/anyspend/react/hooks/usePhantomTransfer.d.ts +36 -0
- package/dist/esm/anyspend/react/hooks/usePhantomTransfer.js +208 -0
- package/dist/esm/anyspend/types/api.d.ts +665 -3
- package/dist/esm/anyspend/utils/orderPayload.js +4 -0
- package/dist/esm/global-account/react/components/B3DynamicModal.js +11 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +3 -1
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
- package/dist/esm/global-account/react/hooks/index.d.ts +2 -1
- package/dist/esm/global-account/react/hooks/index.js +2 -1
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/esm/global-account/react/hooks/useAuthentication.js +7 -2
- package/dist/esm/global-account/react/hooks/useSimBalance.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useSimBalance.js +6 -5
- package/dist/esm/global-account/react/hooks/useTokenBalanceDirect.d.ts +12 -0
- package/dist/esm/global-account/react/hooks/useTokenBalanceDirect.js +59 -0
- package/dist/esm/global-account/react/hooks/useTokenFromUrl.js +4 -3
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +31 -1
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +34 -0
- package/dist/types/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +9 -0
- package/dist/types/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +11 -0
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +6 -1
- package/dist/types/anyspend/react/components/common/OrderTokenAmount.d.ts +2 -1
- package/dist/types/anyspend/react/components/index.d.ts +5 -1
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +25 -3
- package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +116 -0
- package/dist/types/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.d.ts +26 -0
- package/dist/types/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +10 -0
- package/dist/types/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +14 -0
- package/dist/types/anyspend/react/hooks/usePhantomTransfer.d.ts +36 -0
- package/dist/types/anyspend/types/api.d.ts +665 -3
- package/dist/types/global-account/react/hooks/index.d.ts +2 -1
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/types/global-account/react/hooks/useSimBalance.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useTokenBalanceDirect.d.ts +12 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +31 -1
- package/package.json +3 -2
- package/src/anyspend/react/components/AnySpend.tsx +73 -22
- package/src/anyspend/react/components/AnySpendCustom.tsx +4 -0
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +595 -0
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +8 -11
- package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +522 -0
- package/src/anyspend/react/components/AnySpendStakeUpsideExactIn.tsx +73 -0
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +7 -3
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +5 -7
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +9 -18
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +22 -0
- package/src/anyspend/react/components/common/OrderDetails.tsx +76 -190
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +2 -3
- package/src/anyspend/react/components/common/OrderTokenAmount.tsx +48 -17
- package/src/anyspend/react/components/common/PaySection.tsx +1 -0
- package/src/anyspend/react/components/common/TokenBalance.tsx +2 -2
- package/src/anyspend/react/components/index.ts +5 -1
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +51 -18
- package/src/anyspend/react/hooks/useAnyspendQuote.ts +1 -1
- package/src/anyspend/react/hooks/useAutoSelectCryptoPaymentMethod.ts +72 -0
- package/src/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.ts +80 -0
- package/src/anyspend/react/hooks/useConnectedWalletDisplay.ts +69 -0
- package/src/anyspend/react/hooks/usePhantomTransfer.ts +301 -0
- package/src/anyspend/types/api.ts +669 -1
- package/src/anyspend/utils/orderPayload.ts +5 -1
- package/src/global-account/react/components/B3DynamicModal.tsx +11 -1
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +3 -1
- package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +2 -2
- package/src/global-account/react/hooks/index.ts +2 -1
- package/src/global-account/react/hooks/useAuthentication.ts +10 -2
- package/src/global-account/react/hooks/useSimBalance.ts +6 -5
- package/src/global-account/react/hooks/useTokenBalanceDirect.tsx +84 -0
- package/src/global-account/react/hooks/useTokenFromUrl.tsx +6 -5
- package/src/global-account/react/stores/useModalStore.ts +34 -0
|
@@ -53,6 +53,35 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
53
53
|
relay?: Record<string, never>;
|
|
54
54
|
} | null;
|
|
55
55
|
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
56
|
+
} & {
|
|
57
|
+
type: "x402_swap";
|
|
58
|
+
payload: import("../..").components["schemas"]["X402SwapPayload"];
|
|
59
|
+
metadata: import("../..").components["schemas"]["X402SwapMetadata"];
|
|
60
|
+
}) | ({
|
|
61
|
+
id: string;
|
|
62
|
+
recipientAddress: string;
|
|
63
|
+
globalAddress: string;
|
|
64
|
+
srcChain: number;
|
|
65
|
+
dstChain: number;
|
|
66
|
+
srcTokenAddress: string;
|
|
67
|
+
dstTokenAddress: string;
|
|
68
|
+
srcAmount: string;
|
|
69
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
70
|
+
errorDetails: string | null;
|
|
71
|
+
createdAt: number;
|
|
72
|
+
expiredAt: number;
|
|
73
|
+
filledAt: number | null;
|
|
74
|
+
receivedDepositAt: number | null;
|
|
75
|
+
creatorAddress: string | null;
|
|
76
|
+
partnerId: string | null;
|
|
77
|
+
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
78
|
+
oneClickBuyUrl: string | null;
|
|
79
|
+
stripePaymentIntentId: string | null;
|
|
80
|
+
settlement: {
|
|
81
|
+
actualDstAmount?: string;
|
|
82
|
+
relay?: Record<string, never>;
|
|
83
|
+
} | null;
|
|
84
|
+
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
56
85
|
} & {
|
|
57
86
|
type: "hype_duel";
|
|
58
87
|
payload: import("../..").components["schemas"]["HypeDuelPayload"];
|
|
@@ -111,6 +140,35 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
111
140
|
relay?: Record<string, never>;
|
|
112
141
|
} | null;
|
|
113
142
|
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
143
|
+
} & {
|
|
144
|
+
type: "custom_exact_in";
|
|
145
|
+
payload: import("../..").components["schemas"]["CustomExactInPayload"];
|
|
146
|
+
metadata: import("../..").components["schemas"]["CustomMetadata"];
|
|
147
|
+
}) | ({
|
|
148
|
+
id: string;
|
|
149
|
+
recipientAddress: string;
|
|
150
|
+
globalAddress: string;
|
|
151
|
+
srcChain: number;
|
|
152
|
+
dstChain: number;
|
|
153
|
+
srcTokenAddress: string;
|
|
154
|
+
dstTokenAddress: string;
|
|
155
|
+
srcAmount: string;
|
|
156
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
157
|
+
errorDetails: string | null;
|
|
158
|
+
createdAt: number;
|
|
159
|
+
expiredAt: number;
|
|
160
|
+
filledAt: number | null;
|
|
161
|
+
receivedDepositAt: number | null;
|
|
162
|
+
creatorAddress: string | null;
|
|
163
|
+
partnerId: string | null;
|
|
164
|
+
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
165
|
+
oneClickBuyUrl: string | null;
|
|
166
|
+
stripePaymentIntentId: string | null;
|
|
167
|
+
settlement: {
|
|
168
|
+
actualDstAmount?: string;
|
|
169
|
+
relay?: Record<string, never>;
|
|
170
|
+
} | null;
|
|
171
|
+
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
114
172
|
} & {
|
|
115
173
|
type: "mint_nft";
|
|
116
174
|
payload: import("../..").components["schemas"]["MintNftPayload"];
|
|
@@ -230,6 +288,35 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
230
288
|
relay?: Record<string, never>;
|
|
231
289
|
} | null;
|
|
232
290
|
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
291
|
+
} & {
|
|
292
|
+
type: "x402_swap";
|
|
293
|
+
payload: import("../..").components["schemas"]["X402SwapPayload"];
|
|
294
|
+
metadata: import("../..").components["schemas"]["X402SwapMetadata"];
|
|
295
|
+
}) | ({
|
|
296
|
+
id: string;
|
|
297
|
+
recipientAddress: string;
|
|
298
|
+
globalAddress: string;
|
|
299
|
+
srcChain: number;
|
|
300
|
+
dstChain: number;
|
|
301
|
+
srcTokenAddress: string;
|
|
302
|
+
dstTokenAddress: string;
|
|
303
|
+
srcAmount: string;
|
|
304
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
305
|
+
errorDetails: string | null;
|
|
306
|
+
createdAt: number;
|
|
307
|
+
expiredAt: number;
|
|
308
|
+
filledAt: number | null;
|
|
309
|
+
receivedDepositAt: number | null;
|
|
310
|
+
creatorAddress: string | null;
|
|
311
|
+
partnerId: string | null;
|
|
312
|
+
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
313
|
+
oneClickBuyUrl: string | null;
|
|
314
|
+
stripePaymentIntentId: string | null;
|
|
315
|
+
settlement: {
|
|
316
|
+
actualDstAmount?: string;
|
|
317
|
+
relay?: Record<string, never>;
|
|
318
|
+
} | null;
|
|
319
|
+
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
233
320
|
} & {
|
|
234
321
|
type: "hype_duel";
|
|
235
322
|
payload: import("../..").components["schemas"]["HypeDuelPayload"];
|
|
@@ -288,6 +375,35 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
288
375
|
relay?: Record<string, never>;
|
|
289
376
|
} | null;
|
|
290
377
|
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
378
|
+
} & {
|
|
379
|
+
type: "custom_exact_in";
|
|
380
|
+
payload: import("../..").components["schemas"]["CustomExactInPayload"];
|
|
381
|
+
metadata: import("../..").components["schemas"]["CustomMetadata"];
|
|
382
|
+
}) | ({
|
|
383
|
+
id: string;
|
|
384
|
+
recipientAddress: string;
|
|
385
|
+
globalAddress: string;
|
|
386
|
+
srcChain: number;
|
|
387
|
+
dstChain: number;
|
|
388
|
+
srcTokenAddress: string;
|
|
389
|
+
dstTokenAddress: string;
|
|
390
|
+
srcAmount: string;
|
|
391
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
392
|
+
errorDetails: string | null;
|
|
393
|
+
createdAt: number;
|
|
394
|
+
expiredAt: number;
|
|
395
|
+
filledAt: number | null;
|
|
396
|
+
receivedDepositAt: number | null;
|
|
397
|
+
creatorAddress: string | null;
|
|
398
|
+
partnerId: string | null;
|
|
399
|
+
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
400
|
+
oneClickBuyUrl: string | null;
|
|
401
|
+
stripePaymentIntentId: string | null;
|
|
402
|
+
settlement: {
|
|
403
|
+
actualDstAmount?: string;
|
|
404
|
+
relay?: Record<string, never>;
|
|
405
|
+
} | null;
|
|
406
|
+
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
291
407
|
} & {
|
|
292
408
|
type: "mint_nft";
|
|
293
409
|
payload: import("../..").components["schemas"]["MintNftPayload"];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CryptoPaymentMethodType } from "../components/common/CryptoPaymentMethod";
|
|
2
|
+
interface UseAutoSelectCryptoPaymentMethodParams {
|
|
3
|
+
/** Current payment type (crypto or fiat) */
|
|
4
|
+
paymentType?: "crypto" | "fiat";
|
|
5
|
+
/** Currently selected payment method */
|
|
6
|
+
selectedCryptoPaymentMethod: CryptoPaymentMethodType;
|
|
7
|
+
/** Function to update the selected payment method */
|
|
8
|
+
setSelectedCryptoPaymentMethod: (method: CryptoPaymentMethodType) => void;
|
|
9
|
+
/** Whether user has enough balance to pay */
|
|
10
|
+
hasEnoughBalance: boolean;
|
|
11
|
+
/** Whether balance is still loading */
|
|
12
|
+
isBalanceLoading: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Custom hook to automatically select appropriate crypto payment method
|
|
16
|
+
* based on available wallets and balance.
|
|
17
|
+
*
|
|
18
|
+
* Auto-selection logic:
|
|
19
|
+
* - Only auto-selects when payment method is NONE (doesn't override user choices)
|
|
20
|
+
* - If EOA/Wagmi wallet connected + has balance → CONNECT_WALLET
|
|
21
|
+
* - If EOA/Wagmi wallet connected + insufficient balance → TRANSFER_CRYPTO
|
|
22
|
+
* - If only Global wallet available → GLOBAL_WALLET
|
|
23
|
+
* - If no wallets → remains NONE
|
|
24
|
+
*/
|
|
25
|
+
export declare function useAutoSelectCryptoPaymentMethod({ paymentType, selectedCryptoPaymentMethod, setSelectedCryptoPaymentMethod, hasEnoughBalance, isBalanceLoading, }: UseAutoSelectCryptoPaymentMethodParams): void;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook that automatically sets the active thirdweb wallet when a wagmi wallet connects.
|
|
3
|
+
*
|
|
4
|
+
* This is useful for syncing wagmi wallet connections with thirdweb's wallet system,
|
|
5
|
+
* ensuring that when users connect via wagmi, the active wallet is properly set.
|
|
6
|
+
*
|
|
7
|
+
* Place this hook in components that stay mounted throughout the user flow
|
|
8
|
+
* (not in components that unmount during navigation).
|
|
9
|
+
*/
|
|
10
|
+
export declare function useAutoSetActiveWalletFromWagmi(): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CryptoPaymentMethodType } from "../components/common/CryptoPaymentMethod";
|
|
2
|
+
interface UseConnectedWalletDisplayResult {
|
|
3
|
+
walletAddress: string | undefined;
|
|
4
|
+
shouldShowConnectedEOA: boolean;
|
|
5
|
+
shouldShowWagmiWallet: boolean;
|
|
6
|
+
isWalletDuplicated: boolean;
|
|
7
|
+
suggestedPaymentMethod: CryptoPaymentMethodType;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Custom hook to determine which wallet to display and its address
|
|
11
|
+
* Handles logic for showing EOA wallet, wagmi wallet, or global wallet based on payment method
|
|
12
|
+
*/
|
|
13
|
+
export declare function useConnectedWalletDisplay(selectedCryptoPaymentMethod?: CryptoPaymentMethodType): UseConnectedWalletDisplayResult;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
interface UsePhantomTransferParams {
|
|
2
|
+
/** RPC endpoint URL for Solana network */
|
|
3
|
+
rpcEndpoint?: string;
|
|
4
|
+
}
|
|
5
|
+
interface PhantomTransferParams {
|
|
6
|
+
/** Amount in lamports (for SOL) or smallest token unit (for SPL tokens) */
|
|
7
|
+
amountLamports: string;
|
|
8
|
+
/** Token address (use "11111111111111111111111111111111" for native SOL) */
|
|
9
|
+
tokenAddress: string;
|
|
10
|
+
/** Recipient address */
|
|
11
|
+
recipientAddress: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Custom hook for handling Phantom wallet transfers on Solana.
|
|
15
|
+
* Supports both native SOL and SPL token transfers with automatic priority fee calculation.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const { initiateTransfer, isPhantomAvailable } = usePhantomTransfer();
|
|
20
|
+
*
|
|
21
|
+
* await initiateTransfer({
|
|
22
|
+
* amountLamports: "1000000000", // 1 SOL
|
|
23
|
+
* tokenAddress: "11111111111111111111111111111111",
|
|
24
|
+
* recipientAddress: "..."
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function usePhantomTransfer({ rpcEndpoint }?: UsePhantomTransferParams): {
|
|
29
|
+
/** Function to initiate a transfer */
|
|
30
|
+
initiateTransfer: ({ amountLamports, tokenAddress, recipientAddress }: PhantomTransferParams) => Promise<void>;
|
|
31
|
+
/** Whether Phantom wallet is available (installed) */
|
|
32
|
+
isPhantomAvailable: any;
|
|
33
|
+
/** Get the currently connected Phantom wallet address */
|
|
34
|
+
getConnectedAddress: () => any;
|
|
35
|
+
};
|
|
36
|
+
export {};
|