@b3dotfun/sdk 0.0.35 → 0.0.36
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 +5 -3
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +2 -2
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +5 -2
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.d.ts +16 -0
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +58 -0
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +22 -15
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +12 -4
- package/dist/cjs/anyspend/react/components/common/PaySection.d.ts +2 -6
- package/dist/cjs/anyspend/react/components/common/PaySection.js +10 -15
- package/dist/cjs/anyspend/react/components/index.d.ts +2 -2
- package/dist/cjs/anyspend/react/components/index.js +5 -5
- package/dist/cjs/global-account/bsmnt.d.ts +2 -0
- package/dist/cjs/global-account/bsmnt.js +42 -1
- package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +6 -0
- package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.js +55 -0
- package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +6 -0
- package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +108 -0
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +9 -1
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.d.ts +3 -1
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +21 -11
- package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.d.ts +3 -1
- package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +19 -5
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.d.ts +3 -1
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +6 -6
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3.js +2 -2
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +1 -13
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -3
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +0 -3
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +0 -3
- package/dist/cjs/global-account/react/components/icons/AppleIcon.d.ts +9 -0
- package/dist/cjs/global-account/react/components/icons/AppleIcon.js +8 -0
- package/dist/cjs/global-account/react/components/icons/DiscordIcon.d.ts +9 -0
- package/dist/cjs/global-account/react/components/icons/DiscordIcon.js +8 -0
- package/dist/cjs/global-account/react/components/icons/FarcasterIcon.d.ts +9 -0
- package/dist/cjs/global-account/react/components/icons/FarcasterIcon.js +8 -0
- package/dist/cjs/global-account/react/components/icons/GoogleIcon.d.ts +8 -0
- package/dist/cjs/global-account/react/components/icons/GoogleIcon.js +8 -0
- package/dist/cjs/global-account/react/components/icons/XIcon.d.ts +9 -0
- package/dist/cjs/global-account/react/components/icons/XIcon.js +8 -0
- package/dist/cjs/global-account/react/hooks/useAccountWallet.js +3 -2
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +1 -2
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +16 -15
- package/dist/cjs/global-account/react/hooks/useProfile.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useRPMToken.d.ts +7 -0
- package/dist/cjs/global-account/react/hooks/useRPMToken.js +11 -0
- package/dist/cjs/global-account/react/stores/useAuthStore.d.ts +2 -4
- package/dist/cjs/global-account/react/stores/useAuthStore.js +2 -4
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +11 -1
- package/dist/cjs/global-account/react/utils/updateAvatar.d.ts +4 -0
- package/dist/cjs/global-account/react/utils/updateAvatar.js +54 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +5 -3
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +2 -2
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +5 -2
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.d.ts +16 -0
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +55 -0
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.d.ts +1 -0
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +22 -15
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +12 -4
- package/dist/esm/anyspend/react/components/common/PaySection.d.ts +2 -6
- package/dist/esm/anyspend/react/components/common/PaySection.js +10 -15
- package/dist/esm/anyspend/react/components/index.d.ts +2 -2
- package/dist/esm/anyspend/react/components/index.js +2 -2
- package/dist/esm/global-account/bsmnt.d.ts +2 -0
- package/dist/esm/global-account/bsmnt.js +39 -0
- package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +6 -0
- package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.js +52 -0
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +6 -0
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +102 -0
- package/dist/esm/global-account/react/components/B3DynamicModal.js +9 -1
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.d.ts +3 -1
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +22 -12
- package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.d.ts +3 -1
- package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +20 -6
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.d.ts +3 -1
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +6 -6
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +1 -13
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -3
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +0 -3
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +0 -3
- package/dist/esm/global-account/react/components/icons/AppleIcon.d.ts +9 -0
- package/dist/esm/global-account/react/components/icons/AppleIcon.js +5 -0
- package/dist/esm/global-account/react/components/icons/DiscordIcon.d.ts +9 -0
- package/dist/esm/global-account/react/components/icons/DiscordIcon.js +5 -0
- package/dist/esm/global-account/react/components/icons/FarcasterIcon.d.ts +9 -0
- package/dist/esm/global-account/react/components/icons/FarcasterIcon.js +5 -0
- package/dist/esm/global-account/react/components/icons/GoogleIcon.d.ts +8 -0
- package/dist/esm/global-account/react/components/icons/GoogleIcon.js +5 -0
- package/dist/esm/global-account/react/components/icons/XIcon.d.ts +9 -0
- package/dist/esm/global-account/react/components/icons/XIcon.js +5 -0
- package/dist/esm/global-account/react/hooks/useAccountWallet.js +3 -2
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +1 -2
- package/dist/esm/global-account/react/hooks/useAuthentication.js +16 -15
- package/dist/esm/global-account/react/hooks/useProfile.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useRPMToken.d.ts +7 -0
- package/dist/esm/global-account/react/hooks/useRPMToken.js +8 -0
- package/dist/esm/global-account/react/stores/useAuthStore.d.ts +2 -4
- package/dist/esm/global-account/react/stores/useAuthStore.js +2 -4
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +11 -1
- package/dist/esm/global-account/react/utils/updateAvatar.d.ts +4 -0
- package/dist/esm/global-account/react/utils/updateAvatar.js +18 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/common/ConnectWalletPayment.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/CryptoPaySection.d.ts +16 -0
- package/dist/types/anyspend/react/components/common/CryptoPaymentMethod.d.ts +1 -0
- package/dist/types/anyspend/react/components/common/PaySection.d.ts +2 -6
- package/dist/types/anyspend/react/components/index.d.ts +2 -2
- package/dist/types/global-account/bsmnt.d.ts +2 -0
- package/dist/types/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +6 -0
- package/dist/types/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +6 -0
- package/dist/types/global-account/react/components/LinkAccount/LinkAccount.d.ts +3 -1
- package/dist/types/global-account/react/components/ManageAccount/BalanceContent.d.ts +3 -1
- package/dist/types/global-account/react/components/ManageAccount/ManageAccount.d.ts +3 -1
- package/dist/types/global-account/react/components/icons/AppleIcon.d.ts +9 -0
- package/dist/types/global-account/react/components/icons/DiscordIcon.d.ts +9 -0
- package/dist/types/global-account/react/components/icons/FarcasterIcon.d.ts +9 -0
- package/dist/types/global-account/react/components/icons/GoogleIcon.d.ts +8 -0
- package/dist/types/global-account/react/components/icons/XIcon.d.ts +9 -0
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +1 -2
- package/dist/types/global-account/react/hooks/useProfile.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useRPMToken.d.ts +7 -0
- package/dist/types/global-account/react/stores/useAuthStore.d.ts +2 -4
- package/dist/types/global-account/react/stores/useModalStore.d.ts +11 -1
- package/dist/types/global-account/react/utils/updateAvatar.d.ts +4 -0
- package/package.json +8 -7
- package/src/anyspend/react/components/AnySpend.tsx +7 -6
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +2 -5
- package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +6 -1
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +153 -0
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +80 -43
- package/src/anyspend/react/components/common/OrderDetails.tsx +13 -4
- package/src/anyspend/react/components/common/PaySection.tsx +64 -140
- package/src/anyspend/react/components/index.ts +2 -2
- package/src/global-account/bsmnt.ts +47 -0
- package/src/global-account/react/components/AvatarCreator/AvatarCreator.tsx +90 -0
- package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +233 -0
- package/src/global-account/react/components/B3DynamicModal.tsx +27 -2
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +40 -18
- package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +63 -35
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +106 -78
- package/src/global-account/react/components/SignInWithB3/SignInWithB3.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +1 -13
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +1 -3
- package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +0 -3
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +0 -3
- package/src/global-account/react/components/icons/AppleIcon.tsx +33 -0
- package/src/global-account/react/components/icons/DiscordIcon.tsx +32 -0
- package/src/global-account/react/components/icons/FarcasterIcon.tsx +37 -0
- package/src/global-account/react/components/icons/GoogleIcon.tsx +40 -0
- package/src/global-account/react/components/icons/XIcon.tsx +28 -0
- package/src/global-account/react/hooks/useAccountWallet.tsx +3 -2
- package/src/global-account/react/hooks/useAuthentication.ts +18 -15
- package/src/global-account/react/hooks/useProfile.ts +1 -1
- package/src/global-account/react/hooks/useRPMToken.ts +17 -0
- package/src/global-account/react/stores/useAuthStore.ts +4 -8
- package/src/global-account/react/stores/useModalStore.ts +13 -1
- package/src/global-account/react/utils/updateAvatar.ts +21 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { preAuthenticate } from "thirdweb/wallets/in-app";
|
|
2
2
|
export declare function useAuthentication(partnerId: string, loginWithSiwe?: boolean): {
|
|
3
3
|
logout: (callback?: () => void) => Promise<void>;
|
|
4
|
-
isAuthenticating: boolean;
|
|
5
4
|
isAuthenticated: boolean;
|
|
6
5
|
isReady: boolean;
|
|
7
6
|
isConnecting: boolean;
|
|
@@ -9,5 +8,5 @@ export declare function useAuthentication(partnerId: string, loginWithSiwe?: boo
|
|
|
9
8
|
wallet: import("thirdweb/dist/types/wallets/in-app/core/wallet/types").EcosystemWallet;
|
|
10
9
|
preAuthenticate: typeof preAuthenticate;
|
|
11
10
|
connect: (strategyOptions?: import("thirdweb/wallets").SingleStepAuthArgsType) => Promise<import("thirdweb/wallets").Wallet | null>;
|
|
12
|
-
|
|
11
|
+
isAuthenticating: boolean;
|
|
13
12
|
};
|
|
@@ -5,7 +5,6 @@ interface AuthState {
|
|
|
5
5
|
provider?: string;
|
|
6
6
|
accessToken?: string;
|
|
7
7
|
chain?: Chain;
|
|
8
|
-
isAuthenticating: boolean;
|
|
9
8
|
isAuthenticated: boolean;
|
|
10
9
|
isConnecting: boolean;
|
|
11
10
|
isConnected: boolean;
|
|
@@ -15,7 +14,6 @@ interface AuthState {
|
|
|
15
14
|
setStep: (step: "login" | "permissions") => void;
|
|
16
15
|
setIsConnecting: (isConnecting: boolean) => void;
|
|
17
16
|
setIsConnected: (isConnected: boolean) => void;
|
|
18
|
-
setIsAuthenticating: (isAuthenticating: boolean) => void;
|
|
19
17
|
setIsAuthenticated: (isAuthenticated: boolean) => void;
|
|
20
18
|
startAuth: (params: {
|
|
21
19
|
provider: string;
|
|
@@ -25,8 +23,8 @@ interface AuthState {
|
|
|
25
23
|
onError?: (error: Error) => void;
|
|
26
24
|
}) => void;
|
|
27
25
|
reset: () => void;
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
isAuthenticating: boolean;
|
|
27
|
+
setIsAuthenticating: (isAuthenticating: boolean) => void;
|
|
30
28
|
hasStartedConnecting: boolean;
|
|
31
29
|
setHasStartedConnecting: (hasStartedConnecting: boolean) => void;
|
|
32
30
|
}
|
|
@@ -84,6 +84,10 @@ export interface ManageAccountModalProps extends BaseModalProps {
|
|
|
84
84
|
setActiveTab?: (tab: "overview" | "tokens" | "nfts" | "apps" | "settings") => void;
|
|
85
85
|
/** Whether to show the referral information */
|
|
86
86
|
showReferralInfo?: boolean;
|
|
87
|
+
/** Whether to show the swap button */
|
|
88
|
+
showSwap?: boolean;
|
|
89
|
+
/** Whether to show the deposit button */
|
|
90
|
+
showDeposit?: boolean;
|
|
87
91
|
}
|
|
88
92
|
/**
|
|
89
93
|
* Props for the AnySpend modal
|
|
@@ -287,10 +291,16 @@ export interface AnySpendDepositHypeProps extends BaseModalProps {
|
|
|
287
291
|
/** Callback function called when the deposit is successful */
|
|
288
292
|
onSuccess?: (amount?: string) => void;
|
|
289
293
|
}
|
|
294
|
+
export interface AvatarEditorModalProps extends BaseModalProps {
|
|
295
|
+
/** Modal type identifier */
|
|
296
|
+
type: "avatarEditor";
|
|
297
|
+
/** Callback function called when avatar is successfully set */
|
|
298
|
+
onSuccess?: () => void;
|
|
299
|
+
}
|
|
290
300
|
/**
|
|
291
301
|
* Union type of all possible modal content types
|
|
292
302
|
*/
|
|
293
|
-
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps;
|
|
303
|
+
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps | AvatarEditorModalProps;
|
|
294
304
|
/**
|
|
295
305
|
* State interface for the modal store
|
|
296
306
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b3dotfun/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.36",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"react-native": "./dist/cjs/index.native.js",
|
|
@@ -237,7 +237,7 @@
|
|
|
237
237
|
"constants"
|
|
238
238
|
],
|
|
239
239
|
"dependencies": {
|
|
240
|
-
"@b3dotfun/b3-api": "0.0.
|
|
240
|
+
"@b3dotfun/b3-api": "0.0.49",
|
|
241
241
|
"@b3dotfun/basement-api": "0.0.11",
|
|
242
242
|
"@feathersjs/authentication-client": "5.0.33",
|
|
243
243
|
"@feathersjs/feathers": "5.0.33",
|
|
@@ -254,8 +254,8 @@
|
|
|
254
254
|
"@radix-ui/react-slot": "1.1.2",
|
|
255
255
|
"@radix-ui/react-tabs": "1.1.3",
|
|
256
256
|
"@radix-ui/react-tooltip": "1.1.8",
|
|
257
|
-
"@reservoir0x/relay-kit-ui": "2.
|
|
258
|
-
"@reservoir0x/relay-sdk": "2.
|
|
257
|
+
"@reservoir0x/relay-kit-ui": "2.17.2",
|
|
258
|
+
"@reservoir0x/relay-sdk": "2.4.0",
|
|
259
259
|
"@solana/spl-token": "^0.4.13",
|
|
260
260
|
"@solana/web3.js": "^1.98.2",
|
|
261
261
|
"@stripe/react-stripe-js": "^3.7.0",
|
|
@@ -321,9 +321,10 @@
|
|
|
321
321
|
"peerDependencies": {
|
|
322
322
|
"@fingerprintjs/fingerprintjs-pro-react": "^2.7.0",
|
|
323
323
|
"@privy-io/react-auth": "^2.8.0",
|
|
324
|
-
"@react-three/postprocessing": "
|
|
325
|
-
"@readyplayerme/
|
|
326
|
-
"@
|
|
324
|
+
"@react-three/postprocessing": "2.16.6",
|
|
325
|
+
"@readyplayerme/react-avatar-creator": "0.5.0",
|
|
326
|
+
"@readyplayerme/visage": "6.10.0",
|
|
327
|
+
"@tanstack/react-query": "5.55.0",
|
|
327
328
|
"react": "^18.0.0 || ^19.0.0",
|
|
328
329
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
329
330
|
"react-native-mmkv": "^3.2.0",
|
|
@@ -32,6 +32,7 @@ import { base, mainnet } from "viem/chains";
|
|
|
32
32
|
import { components } from "../../types/api";
|
|
33
33
|
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper";
|
|
34
34
|
import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod";
|
|
35
|
+
import { CryptoPaySection } from "./common/CryptoPaySection";
|
|
35
36
|
import { CryptoReceiveSection } from "./common/CryptoReceiveSection";
|
|
36
37
|
import { ErrorSection } from "./common/ErrorSection";
|
|
37
38
|
import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
|
|
@@ -40,7 +41,6 @@ import { OrderHistory } from "./common/OrderHistory";
|
|
|
40
41
|
import { OrderStatus } from "./common/OrderStatus";
|
|
41
42
|
import { PanelOnramp } from "./common/PanelOnramp";
|
|
42
43
|
import { PanelOnrampPayment } from "./common/PanelOnrampPayment";
|
|
43
|
-
import { PaySection } from "./common/PaySection";
|
|
44
44
|
import { RecipientSelection } from "./common/RecipientSelection";
|
|
45
45
|
import { TabSection } from "./common/TabSection";
|
|
46
46
|
|
|
@@ -567,7 +567,10 @@ function AnySpendInner({
|
|
|
567
567
|
return { text: "Choose payment method", disable: false, error: false };
|
|
568
568
|
}
|
|
569
569
|
// If payment method selected, show appropriate action
|
|
570
|
-
if (
|
|
570
|
+
if (
|
|
571
|
+
selectedCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ||
|
|
572
|
+
selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
|
|
573
|
+
) {
|
|
571
574
|
return { text: "Swap", disable: false, error: false };
|
|
572
575
|
}
|
|
573
576
|
if (selectedCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO) {
|
|
@@ -632,6 +635,7 @@ function AnySpendInner({
|
|
|
632
635
|
// If payment method is selected, create order with payment method info
|
|
633
636
|
if (
|
|
634
637
|
selectedCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ||
|
|
638
|
+
selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET ||
|
|
635
639
|
selectedCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO
|
|
636
640
|
) {
|
|
637
641
|
console.log("Creating crypto order with payment method:", selectedCryptoPaymentMethod);
|
|
@@ -856,8 +860,7 @@ function AnySpendInner({
|
|
|
856
860
|
<div className="relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2">
|
|
857
861
|
{/* Send section */}
|
|
858
862
|
{activeTab === "crypto" ? (
|
|
859
|
-
<
|
|
860
|
-
paymentType="crypto"
|
|
863
|
+
<CryptoPaySection
|
|
861
864
|
selectedSrcChainId={selectedSrcChainId}
|
|
862
865
|
setSelectedSrcChainId={setSelectedSrcChainId}
|
|
863
866
|
selectedSrcToken={selectedSrcToken}
|
|
@@ -866,9 +869,7 @@ function AnySpendInner({
|
|
|
866
869
|
setSrcAmount={setSrcAmount}
|
|
867
870
|
setIsSrcInputDirty={setIsSrcInputDirty}
|
|
868
871
|
selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
|
|
869
|
-
selectedFiatPaymentMethod={selectedFiatPaymentMethod}
|
|
870
872
|
onSelectCryptoPaymentMethod={() => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD)}
|
|
871
|
-
onSelectFiatPaymentMethod={() => setActivePanel(PanelView.FIAT_PAYMENT_METHOD)}
|
|
872
873
|
anyspendQuote={anyspendQuote}
|
|
873
874
|
/>
|
|
874
875
|
) : (
|
|
@@ -8,13 +8,13 @@ import { toast } from "sonner";
|
|
|
8
8
|
import { base } from "viem/chains";
|
|
9
9
|
import { PanelView, useAnyspendFlow } from "../hooks/useAnyspendFlow";
|
|
10
10
|
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper";
|
|
11
|
+
import { CryptoPaySection } from "./common/CryptoPaySection";
|
|
11
12
|
import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod";
|
|
12
13
|
import { CryptoReceiveSection } from "./common/CryptoReceiveSection";
|
|
13
14
|
import { ErrorSection } from "./common/ErrorSection";
|
|
14
15
|
import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
|
|
15
16
|
import { OrderDetails } from "./common/OrderDetails";
|
|
16
17
|
import { OrderStatus } from "./common/OrderStatus";
|
|
17
|
-
import { PaySection } from "./common/PaySection";
|
|
18
18
|
import { RecipientSelection } from "./common/RecipientSelection";
|
|
19
19
|
|
|
20
20
|
import { ArrowDown } from "lucide-react";
|
|
@@ -191,8 +191,7 @@ function AnySpendDepositHypeInner({
|
|
|
191
191
|
<div className="relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2">
|
|
192
192
|
{/* Send section */}
|
|
193
193
|
{paymentType === "crypto" ? (
|
|
194
|
-
<
|
|
195
|
-
paymentType="crypto"
|
|
194
|
+
<CryptoPaySection
|
|
196
195
|
selectedSrcChainId={selectedSrcChainId}
|
|
197
196
|
setSelectedSrcChainId={setSelectedSrcChainId}
|
|
198
197
|
selectedSrcToken={selectedSrcToken}
|
|
@@ -201,9 +200,7 @@ function AnySpendDepositHypeInner({
|
|
|
201
200
|
setSrcAmount={setSrcAmount}
|
|
202
201
|
setIsSrcInputDirty={setIsSrcInputDirty}
|
|
203
202
|
selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
|
|
204
|
-
selectedFiatPaymentMethod={selectedFiatPaymentMethod}
|
|
205
203
|
onSelectCryptoPaymentMethod={() => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD)}
|
|
206
|
-
onSelectFiatPaymentMethod={() => setActivePanel(PanelView.FIAT_PAYMENT_METHOD)}
|
|
207
204
|
anyspendQuote={anyspendQuote}
|
|
208
205
|
/>
|
|
209
206
|
) : (
|
|
@@ -8,6 +8,7 @@ import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
|
|
|
8
8
|
import { motion } from "framer-motion";
|
|
9
9
|
import { ChevronRight, Loader2 } from "lucide-react";
|
|
10
10
|
import { useAccount } from "wagmi";
|
|
11
|
+
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
11
12
|
import { OrderDetailsCollapsible } from "./OrderDetailsCollapsible";
|
|
12
13
|
|
|
13
14
|
type Tournament = components["schemas"]["Tournament"];
|
|
@@ -22,6 +23,7 @@ interface ConnectWalletPaymentProps {
|
|
|
22
23
|
phantomWalletAddress?: string | null;
|
|
23
24
|
tournament?: Tournament;
|
|
24
25
|
nft?: NFT;
|
|
26
|
+
cryptoPaymentMethod: CryptoPaymentMethodType;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
export default function ConnectWalletPayment({
|
|
@@ -32,6 +34,7 @@ export default function ConnectWalletPayment({
|
|
|
32
34
|
phantomWalletAddress,
|
|
33
35
|
tournament,
|
|
34
36
|
nft,
|
|
37
|
+
cryptoPaymentMethod,
|
|
35
38
|
}: ConnectWalletPaymentProps) {
|
|
36
39
|
const profile = useProfile({ address: order.recipientAddress });
|
|
37
40
|
const recipientName = profile.data?.name?.replace(/\.b3\.fun/g, "");
|
|
@@ -79,7 +82,9 @@ export default function ConnectWalletPayment({
|
|
|
79
82
|
<span className="whitespace-nowrap pl-4 text-lg md:text-sm">
|
|
80
83
|
{order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
|
|
81
84
|
? "Pay from Phantom Wallet"
|
|
82
|
-
:
|
|
85
|
+
: cryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
|
|
86
|
+
? "Pay from Global Account"
|
|
87
|
+
: "Pay from Connected Wallet"}
|
|
83
88
|
</span>
|
|
84
89
|
<ChevronRight className="h-4 w-4" />
|
|
85
90
|
</>
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { useAccountWallet, useProfile, useTokenData } from "@b3dotfun/sdk/global-account/react";
|
|
2
|
+
import { formatUsername } from "@b3dotfun/sdk/shared/utils";
|
|
3
|
+
import { shortenAddress } from "@b3dotfun/sdk/shared/utils/formatAddress";
|
|
4
|
+
import { formatDisplayNumber } from "@b3dotfun/sdk/shared/utils/number";
|
|
5
|
+
import { ChevronRight } from "lucide-react";
|
|
6
|
+
import { motion } from "motion/react";
|
|
7
|
+
import { useEffect, useRef } from "react";
|
|
8
|
+
import { useAccount } from "wagmi";
|
|
9
|
+
import { components } from "../../../types/api";
|
|
10
|
+
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
11
|
+
import { OrderTokenAmount } from "./OrderTokenAmount";
|
|
12
|
+
import { TokenBalance } from "./TokenBalance";
|
|
13
|
+
|
|
14
|
+
interface CryptoPaySectionProps {
|
|
15
|
+
// Token state
|
|
16
|
+
selectedSrcChainId: number;
|
|
17
|
+
setSelectedSrcChainId: (chainId: number) => void;
|
|
18
|
+
selectedSrcToken: components["schemas"]["Token"];
|
|
19
|
+
setSelectedSrcToken: (token: components["schemas"]["Token"]) => void;
|
|
20
|
+
srcAmount: string;
|
|
21
|
+
setSrcAmount: (amount: string) => void;
|
|
22
|
+
setIsSrcInputDirty: (dirty: boolean) => void;
|
|
23
|
+
// Payment method state
|
|
24
|
+
selectedCryptoPaymentMethod: CryptoPaymentMethodType;
|
|
25
|
+
onSelectCryptoPaymentMethod: () => void;
|
|
26
|
+
// Quote data
|
|
27
|
+
anyspendQuote?: any;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function CryptoPaySection({
|
|
31
|
+
selectedSrcChainId,
|
|
32
|
+
setSelectedSrcChainId,
|
|
33
|
+
selectedSrcToken,
|
|
34
|
+
setSelectedSrcToken,
|
|
35
|
+
srcAmount,
|
|
36
|
+
setSrcAmount,
|
|
37
|
+
setIsSrcInputDirty,
|
|
38
|
+
selectedCryptoPaymentMethod,
|
|
39
|
+
onSelectCryptoPaymentMethod,
|
|
40
|
+
anyspendQuote,
|
|
41
|
+
}: CryptoPaySectionProps) {
|
|
42
|
+
const { address: connectedAddress, isConnected } = useAccount();
|
|
43
|
+
const { data: profileData } = useProfile({ address: connectedAddress });
|
|
44
|
+
const connectedName = profileData?.displayName;
|
|
45
|
+
const { address: globalAddress } = useAccountWallet();
|
|
46
|
+
const { data: srcTokenMetadata } = useTokenData(selectedSrcToken?.chainId, selectedSrcToken?.address);
|
|
47
|
+
|
|
48
|
+
// Determine which address to use based on payment method
|
|
49
|
+
const walletAddress =
|
|
50
|
+
selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET ? globalAddress : connectedAddress;
|
|
51
|
+
|
|
52
|
+
// Add ref to track if we've applied metadata
|
|
53
|
+
const appliedSrcMetadataRef = useRef(false);
|
|
54
|
+
|
|
55
|
+
// Update source token with metadata
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (selectedSrcToken && srcTokenMetadata && !appliedSrcMetadataRef.current) {
|
|
58
|
+
// Mark as applied
|
|
59
|
+
appliedSrcMetadataRef.current = true;
|
|
60
|
+
|
|
61
|
+
const enhancedToken = {
|
|
62
|
+
...selectedSrcToken,
|
|
63
|
+
decimals: srcTokenMetadata.decimals || selectedSrcToken.decimals,
|
|
64
|
+
symbol: srcTokenMetadata.symbol || selectedSrcToken.symbol,
|
|
65
|
+
name: srcTokenMetadata.name || selectedSrcToken.name,
|
|
66
|
+
metadata: {
|
|
67
|
+
...selectedSrcToken.metadata,
|
|
68
|
+
logoURI: srcTokenMetadata?.logoURI || selectedSrcToken.metadata.logoURI,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
setSelectedSrcToken(enhancedToken);
|
|
72
|
+
}
|
|
73
|
+
}, [srcTokenMetadata, selectedSrcToken, setSelectedSrcToken]);
|
|
74
|
+
|
|
75
|
+
// Reset source token ref when address/chain changes
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
appliedSrcMetadataRef.current = false;
|
|
78
|
+
}, [selectedSrcToken.address, selectedSrcToken.chainId]);
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<motion.div
|
|
82
|
+
initial={{ opacity: 0, y: 20, filter: "blur(10px)" }}
|
|
83
|
+
animate={{ opacity: 1, y: 0, filter: "blur(0px)" }}
|
|
84
|
+
transition={{ duration: 0.3, delay: 0, ease: "easeInOut" }}
|
|
85
|
+
className="pay-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6"
|
|
86
|
+
>
|
|
87
|
+
<div className="flex items-center justify-between">
|
|
88
|
+
<div className="text-as-primary/50 flex h-7 items-center text-sm">Pay</div>
|
|
89
|
+
<button
|
|
90
|
+
className="text-as-tertiarry flex h-7 items-center gap-2 text-sm transition-colors focus:!outline-none"
|
|
91
|
+
onClick={onSelectCryptoPaymentMethod}
|
|
92
|
+
>
|
|
93
|
+
{selectedCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ? (
|
|
94
|
+
<>
|
|
95
|
+
{isConnected ? (
|
|
96
|
+
<div className="flex items-center gap-1">
|
|
97
|
+
{connectedName ? formatUsername(connectedName) : shortenAddress(connectedAddress || "")}
|
|
98
|
+
</div>
|
|
99
|
+
) : (
|
|
100
|
+
"Connect wallet"
|
|
101
|
+
)}
|
|
102
|
+
<ChevronRight className="h-4 w-4" />
|
|
103
|
+
</>
|
|
104
|
+
) : selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET ? (
|
|
105
|
+
<>
|
|
106
|
+
Global Account
|
|
107
|
+
<ChevronRight className="h-4 w-4" />
|
|
108
|
+
</>
|
|
109
|
+
) : selectedCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO ? (
|
|
110
|
+
<>
|
|
111
|
+
Transfer crypto
|
|
112
|
+
<ChevronRight className="h-4 w-4" />
|
|
113
|
+
</>
|
|
114
|
+
) : (
|
|
115
|
+
<>
|
|
116
|
+
Select payment method
|
|
117
|
+
<ChevronRight className="h-4 w-4" />
|
|
118
|
+
</>
|
|
119
|
+
)}
|
|
120
|
+
</button>
|
|
121
|
+
</div>
|
|
122
|
+
<OrderTokenAmount
|
|
123
|
+
address={walletAddress}
|
|
124
|
+
context="from"
|
|
125
|
+
inputValue={srcAmount}
|
|
126
|
+
onChangeInput={value => {
|
|
127
|
+
setIsSrcInputDirty(true);
|
|
128
|
+
setSrcAmount(value);
|
|
129
|
+
}}
|
|
130
|
+
chainId={selectedSrcChainId}
|
|
131
|
+
setChainId={setSelectedSrcChainId}
|
|
132
|
+
token={selectedSrcToken}
|
|
133
|
+
setToken={setSelectedSrcToken}
|
|
134
|
+
/>
|
|
135
|
+
<div className="flex items-center justify-between">
|
|
136
|
+
<div className="text-as-primary/50 flex h-5 items-center text-sm">
|
|
137
|
+
{formatDisplayNumber(anyspendQuote?.data?.currencyIn?.amountUsd, {
|
|
138
|
+
style: "currency",
|
|
139
|
+
fallback: "",
|
|
140
|
+
})}
|
|
141
|
+
</div>
|
|
142
|
+
<TokenBalance
|
|
143
|
+
token={selectedSrcToken}
|
|
144
|
+
walletAddress={walletAddress}
|
|
145
|
+
onChangeInput={value => {
|
|
146
|
+
setIsSrcInputDirty(true);
|
|
147
|
+
setSrcAmount(value);
|
|
148
|
+
}}
|
|
149
|
+
/>
|
|
150
|
+
</div>
|
|
151
|
+
</motion.div>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
@@ -13,6 +13,7 @@ import { useAccount, useConnect, useDisconnect, useWalletClient } from "wagmi";
|
|
|
13
13
|
export enum CryptoPaymentMethodType {
|
|
14
14
|
NONE = "none",
|
|
15
15
|
CONNECT_WALLET = "connect_wallet",
|
|
16
|
+
GLOBAL_WALLET = "global_wallet",
|
|
16
17
|
TRANSFER_CRYPTO = "transfer_crypto",
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -37,7 +38,7 @@ export function CryptoPaymentMethod({
|
|
|
37
38
|
onBack,
|
|
38
39
|
onSelectPaymentMethod,
|
|
39
40
|
}: CryptoPaymentMethodProps) {
|
|
40
|
-
const { wallet: globalWallet } = useAccountWallet();
|
|
41
|
+
const { wallet: globalWallet, address: globalAddress } = useAccountWallet();
|
|
41
42
|
const { address, isConnected, connector } = useAccount();
|
|
42
43
|
const { connect, connectors, isPending } = useConnect();
|
|
43
44
|
const { disconnect } = useDisconnect();
|
|
@@ -201,58 +202,94 @@ export function CryptoPaymentMethod({
|
|
|
201
202
|
</button>
|
|
202
203
|
|
|
203
204
|
{/* Installed Wallets Section */}
|
|
204
|
-
{isConnected && (
|
|
205
|
+
{(isConnected || globalAddress) && (
|
|
205
206
|
<div className="installed-wallets">
|
|
206
207
|
<h3 className="text-as-primary/80 mb-3 text-sm font-medium">Connected wallets</h3>
|
|
207
208
|
<div className="space-y-2">
|
|
208
209
|
{/* Current Connected Wallet */}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
<div className="flex items-center
|
|
224
|
-
|
|
225
|
-
<img src={globalWallet.meta.icon} alt="Wallet" className="h-10 w-10 rounded-full" />
|
|
226
|
-
) : (
|
|
210
|
+
{isConnected && (
|
|
211
|
+
<button
|
|
212
|
+
onClick={() => {
|
|
213
|
+
setSelectedPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
214
|
+
onSelectPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
215
|
+
toast.success(`Selected ${connector?.name || "wallet"}`);
|
|
216
|
+
}}
|
|
217
|
+
className={cn(
|
|
218
|
+
"crypto-payment-method-connect-wallet w-full rounded-xl border p-4 text-left transition-all hover:shadow-md",
|
|
219
|
+
selectedPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET
|
|
220
|
+
? "connected-wallet border-as-brand bg-as-brand/5"
|
|
221
|
+
: "border-as-border-secondary bg-as-surface-primary hover:border-as-secondary/80",
|
|
222
|
+
)}
|
|
223
|
+
>
|
|
224
|
+
<div className="flex items-center justify-between">
|
|
225
|
+
<div className="flex items-center gap-3">
|
|
227
226
|
<div className="wallet-icon flex h-10 w-10 items-center justify-center rounded-full bg-blue-100">
|
|
228
227
|
<Wallet className="h-5 w-5 text-blue-600" />
|
|
229
228
|
</div>
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
229
|
+
<div className="flex flex-col">
|
|
230
|
+
<span className="text-as-primary font-semibold">{connector?.name || "Connected Wallet"}</span>
|
|
231
|
+
<span className="text-as-primary/60 text-sm">{shortenAddress(address || "")}</span>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
<div className="flex items-center gap-2">
|
|
235
|
+
{selectedPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET && (
|
|
236
|
+
<div className="h-2 w-2 rounded-full bg-green-500"></div>
|
|
237
|
+
)}
|
|
238
|
+
<button
|
|
239
|
+
onClick={e => {
|
|
240
|
+
e.stopPropagation();
|
|
241
|
+
disconnect();
|
|
242
|
+
toast.success("Wallet disconnected");
|
|
243
|
+
if (selectedPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET) {
|
|
244
|
+
setSelectedPaymentMethod(CryptoPaymentMethodType.NONE);
|
|
245
|
+
}
|
|
246
|
+
}}
|
|
247
|
+
className="text-as-primary/60 hover:text-as-primary/80 rounded-lg p-1.5 transition-colors"
|
|
248
|
+
>
|
|
249
|
+
<X className="h-4 w-4" />
|
|
250
|
+
</button>
|
|
234
251
|
</div>
|
|
235
252
|
</div>
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
+
</button>
|
|
254
|
+
)}
|
|
255
|
+
|
|
256
|
+
{/* Global Wallet (B3 Account) */}
|
|
257
|
+
{globalAddress && (
|
|
258
|
+
<button
|
|
259
|
+
onClick={() => {
|
|
260
|
+
setSelectedPaymentMethod(CryptoPaymentMethodType.GLOBAL_WALLET);
|
|
261
|
+
onSelectPaymentMethod(CryptoPaymentMethodType.GLOBAL_WALLET);
|
|
262
|
+
toast.success("Selected B3 Account");
|
|
263
|
+
}}
|
|
264
|
+
className={cn(
|
|
265
|
+
"crypto-payment-method-global-wallet w-full rounded-xl border p-4 text-left transition-all hover:shadow-md",
|
|
266
|
+
selectedPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
|
|
267
|
+
? "connected-wallet border-as-brand bg-as-brand/5"
|
|
268
|
+
: "border-as-border-secondary bg-as-surface-primary hover:border-as-secondary/80",
|
|
269
|
+
)}
|
|
270
|
+
>
|
|
271
|
+
<div className="flex items-center justify-between">
|
|
272
|
+
<div className="flex items-center gap-3">
|
|
273
|
+
{globalWallet?.meta?.icon ? (
|
|
274
|
+
<img src={globalWallet.meta.icon} alt="Global Account" className="h-10 w-10 rounded-full" />
|
|
275
|
+
) : (
|
|
276
|
+
<div className="wallet-icon flex h-10 w-10 items-center justify-center rounded-full bg-purple-100">
|
|
277
|
+
<Wallet className="h-5 w-5 text-purple-600" />
|
|
278
|
+
</div>
|
|
279
|
+
)}
|
|
280
|
+
<div className="flex flex-col">
|
|
281
|
+
<span className="text-as-primary font-semibold">Global Account</span>
|
|
282
|
+
<span className="text-as-primary/60 text-sm">{shortenAddress(globalAddress || "")}</span>
|
|
283
|
+
</div>
|
|
284
|
+
</div>
|
|
285
|
+
<div className="flex items-center gap-2">
|
|
286
|
+
{selectedPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET && (
|
|
287
|
+
<div className="h-2 w-2 rounded-full bg-green-500"></div>
|
|
288
|
+
)}
|
|
289
|
+
</div>
|
|
253
290
|
</div>
|
|
254
|
-
</
|
|
255
|
-
|
|
291
|
+
</button>
|
|
292
|
+
)}
|
|
256
293
|
</div>
|
|
257
294
|
</div>
|
|
258
295
|
)}
|
|
@@ -240,7 +240,8 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
240
240
|
const [showQRCode, setShowQRCode] = useState(false);
|
|
241
241
|
const { isLoading: txLoading, isSuccess: txSuccess } = useWaitForTransactionReceipt({ hash: txHash });
|
|
242
242
|
|
|
243
|
-
const { switchChainAndExecuteWithEOA, isSwitchingOrExecuting } =
|
|
243
|
+
const { switchChainAndExecuteWithEOA, switchChainAndExecute, isSwitchingOrExecuting } =
|
|
244
|
+
useUnifiedChainSwitchAndExecute();
|
|
244
245
|
|
|
245
246
|
const roundedUpSrcAmount = useMemo(() => {
|
|
246
247
|
// Display the full transfer amount without rounding since users need to see the exact value they're transferring.
|
|
@@ -293,12 +294,18 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
293
294
|
value = BigInt(0);
|
|
294
295
|
}
|
|
295
296
|
|
|
296
|
-
|
|
297
|
+
// Use appropriate execution method based on payment method
|
|
298
|
+
let txHash: string | undefined;
|
|
299
|
+
if (effectiveCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET) {
|
|
300
|
+
txHash = await switchChainAndExecute(order.srcChain, { to, data: txData, value });
|
|
301
|
+
} else {
|
|
302
|
+
txHash = await switchChainAndExecuteWithEOA(order.srcChain, { to, data: txData, value });
|
|
303
|
+
}
|
|
297
304
|
|
|
298
305
|
if (txHash) {
|
|
299
306
|
setTxHash(txHash as `0x${string}`);
|
|
300
307
|
}
|
|
301
|
-
}, [order, switchChainAndExecuteWithEOA, depositDeficit]);
|
|
308
|
+
}, [order, switchChainAndExecuteWithEOA, switchChainAndExecute, depositDeficit, effectiveCryptoPaymentMethod]);
|
|
302
309
|
|
|
303
310
|
// Main payment handler that triggers chain switch and payment
|
|
304
311
|
const handlePayment = async () => {
|
|
@@ -994,7 +1001,8 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
994
1001
|
<>
|
|
995
1002
|
{order.onrampMetadata ? (
|
|
996
1003
|
<PaymentVendorUI order={order} dstTokenSymbol={dstToken.symbol} />
|
|
997
|
-
) : effectiveCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET
|
|
1004
|
+
) : effectiveCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ||
|
|
1005
|
+
effectiveCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET ? (
|
|
998
1006
|
<ConnectWalletPayment
|
|
999
1007
|
order={order}
|
|
1000
1008
|
onPayment={handlePayment}
|
|
@@ -1004,6 +1012,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
1004
1012
|
phantomWalletAddress={phantomWalletAddress}
|
|
1005
1013
|
tournament={tournament}
|
|
1006
1014
|
nft={nft}
|
|
1015
|
+
cryptoPaymentMethod={effectiveCryptoPaymentMethod}
|
|
1007
1016
|
/>
|
|
1008
1017
|
) : effectiveCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO ? (
|
|
1009
1018
|
// Transfer Crypto Payment Method - Show new card-based UI
|