@b3dotfun/sdk 0.0.87 → 0.0.88-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +5 -0
- package/dist/cjs/anyspend/react/components/AnySpend.js +77 -73
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +122 -0
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +190 -0
- package/dist/cjs/anyspend/react/components/QRDeposit.d.ts +43 -0
- package/dist/cjs/anyspend/react/components/QRDeposit.js +146 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +17 -12
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +12 -5
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/cjs/anyspend/react/components/common/WarningText.d.ts +32 -0
- package/dist/cjs/anyspend/react/components/common/WarningText.js +36 -0
- package/dist/cjs/anyspend/react/components/icons/CreditCardIcon.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/icons/CreditCardIcon.js +6 -0
- package/dist/cjs/anyspend/react/components/icons/QrCodeIcon.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/icons/QrCodeIcon.js +6 -0
- package/dist/cjs/anyspend/react/components/index.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/index.js +3 -1
- package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/hooks/index.js +1 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +35 -11
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +24 -0
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +86 -0
- package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/cjs/anyspend/utils/format.js +28 -5
- package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +2 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +17 -47
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +6 -7
- package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +0 -5
- package/dist/cjs/global-account/react/components/B3Provider/types.js +4 -4
- package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +1 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3.js +1 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3Account.d.ts +1 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +10 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +9 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +23 -0
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +1 -1
- package/dist/cjs/global-account/react/components/LinkAccount/LinkNewAccount.js +1 -2
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +2 -1
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +2 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3.js +2 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +2 -1
- package/dist/cjs/global-account/react/components/index.d.ts +2 -0
- package/dist/cjs/global-account/react/components/index.js +7 -3
- package/dist/cjs/global-account/react/hooks/useAccountWallet.js +3 -2
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useAutoSelectWallet.d.ts +7 -0
- package/dist/cjs/global-account/react/hooks/useAutoSelectWallet.js +42 -0
- package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +6 -4
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +2 -2
- package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -0
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +5 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +77 -73
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +1 -2
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +122 -0
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +187 -0
- package/dist/esm/anyspend/react/components/QRDeposit.d.ts +43 -0
- package/dist/esm/anyspend/react/components/QRDeposit.js +143 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +17 -12
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +12 -5
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/esm/anyspend/react/components/common/WarningText.d.ts +32 -0
- package/dist/esm/anyspend/react/components/common/WarningText.js +32 -0
- package/dist/esm/anyspend/react/components/icons/CreditCardIcon.d.ts +6 -0
- package/dist/esm/anyspend/react/components/icons/CreditCardIcon.js +2 -0
- package/dist/esm/anyspend/react/components/icons/QrCodeIcon.d.ts +6 -0
- package/dist/esm/anyspend/react/components/icons/QrCodeIcon.js +2 -0
- package/dist/esm/anyspend/react/components/index.d.ts +2 -0
- package/dist/esm/anyspend/react/components/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/esm/anyspend/react/hooks/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +35 -11
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +24 -0
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +83 -0
- package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/esm/anyspend/utils/format.js +28 -5
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +3 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +21 -51
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +6 -7
- package/dist/esm/global-account/react/components/B3Provider/types.d.ts +0 -5
- package/dist/esm/global-account/react/components/B3Provider/types.js +4 -4
- package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +1 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3.js +1 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3Account.d.ts +1 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +6 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +9 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +19 -0
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +2 -2
- package/dist/esm/global-account/react/components/LinkAccount/LinkNewAccount.js +2 -3
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +3 -2
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +3 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3.js +3 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +3 -2
- package/dist/esm/global-account/react/components/index.d.ts +2 -0
- package/dist/esm/global-account/react/components/index.js +2 -0
- package/dist/esm/global-account/react/hooks/useAccountWallet.js +4 -3
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useAutoSelectWallet.d.ts +7 -0
- package/dist/esm/global-account/react/hooks/useAutoSelectWallet.js +39 -0
- package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +6 -4
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +2 -2
- package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +5 -0
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +122 -0
- package/dist/types/anyspend/react/components/QRDeposit.d.ts +43 -0
- package/dist/types/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/WarningText.d.ts +32 -0
- package/dist/types/anyspend/react/components/icons/CreditCardIcon.d.ts +6 -0
- package/dist/types/anyspend/react/components/icons/QrCodeIcon.d.ts +6 -0
- package/dist/types/anyspend/react/components/index.d.ts +2 -0
- package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
- package/dist/types/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +24 -0
- package/dist/types/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/types/global-account/react/components/B3Provider/types.d.ts +0 -5
- package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +1 -0
- package/dist/types/global-account/react/components/B3Provider/useB3Account.d.ts +1 -0
- package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +9 -0
- package/dist/types/global-account/react/components/index.d.ts +2 -0
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useAutoSelectWallet.d.ts +7 -0
- package/dist/types/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +105 -85
- package/src/anyspend/react/components/AnySpendCustom.tsx +0 -2
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +2 -3
- package/src/anyspend/react/components/AnySpendDeposit.tsx +570 -0
- package/src/anyspend/react/components/QRDeposit.tsx +348 -0
- package/src/anyspend/react/components/common/OrderDetails.tsx +26 -8
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +20 -8
- package/src/anyspend/react/components/common/OrderStatus.tsx +2 -2
- package/src/anyspend/react/components/common/WarningText.tsx +52 -0
- package/src/anyspend/react/components/icons/CreditCardIcon.tsx +25 -0
- package/src/anyspend/react/components/icons/QrCodeIcon.tsx +25 -0
- package/src/anyspend/react/components/icons/credit-card.svg +5 -0
- package/src/anyspend/react/components/icons/qr-code.svg +5 -0
- package/src/anyspend/react/components/index.ts +2 -0
- package/src/anyspend/react/hooks/index.ts +1 -0
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +37 -12
- package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +110 -0
- package/src/anyspend/utils/format.ts +33 -5
- package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +10 -2
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +6 -7
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +20 -71
- package/src/global-account/react/components/B3Provider/types.ts +8 -9
- package/src/global-account/react/components/B3Provider/useB3.ts +1 -0
- package/src/global-account/react/components/B3Provider/useB3Account.ts +7 -0
- package/src/global-account/react/components/B3Provider/useB3Config.ts +34 -0
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +2 -2
- package/src/global-account/react/components/LinkAccount/LinkNewAccount.tsx +2 -3
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +10 -2
- package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +3 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +5 -2
- package/src/global-account/react/components/index.ts +2 -0
- package/src/global-account/react/hooks/useAccountWallet.tsx +4 -3
- package/src/global-account/react/hooks/useAutoSelectWallet.ts +51 -0
- package/src/global-account/react/hooks/useTurnkeyAuth.ts +7 -5
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +2 -2
- package/src/global-account/react/stores/useModalStore.ts +4 -0
- package/src/styles/index.css +2 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface WarningTextProps {
|
|
2
|
+
/** The warning message content */
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
/** Additional CSS classes */
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A generic warning text component with consistent styling.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <WarningText>
|
|
12
|
+
* Custom warning message
|
|
13
|
+
* </WarningText>
|
|
14
|
+
*/
|
|
15
|
+
export declare function WarningText({ children, className }: WarningTextProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export interface ChainWarningTextProps {
|
|
17
|
+
/** The chain ID to display warning for */
|
|
18
|
+
chainId: number;
|
|
19
|
+
/** Additional CSS classes */
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A chain-aware warning text component that displays chain-specific warnings.
|
|
24
|
+
* Returns null if there's no warning for the given chain.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* <ChainWarningText chainId={HYPERLIQUID_CHAIN_ID} />
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* <ChainWarningText chainId={destinationChainId} className="mt-4" />
|
|
31
|
+
*/
|
|
32
|
+
export declare function ChainWarningText({ chainId, className }: ChainWarningTextProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { HYPERLIQUID_CHAIN_ID } from "../../../../anyspend/index.js";
|
|
3
|
+
import { cn } from "../../../../shared/utils/cn.js";
|
|
4
|
+
/**
|
|
5
|
+
* A generic warning text component with consistent styling.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <WarningText>
|
|
9
|
+
* Custom warning message
|
|
10
|
+
* </WarningText>
|
|
11
|
+
*/
|
|
12
|
+
export function WarningText({ children, className }) {
|
|
13
|
+
return _jsx("p", { className: cn("anyspend-warning text-center text-xs italic text-red-500", className), children: children });
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A chain-aware warning text component that displays chain-specific warnings.
|
|
17
|
+
* Returns null if there's no warning for the given chain.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <ChainWarningText chainId={HYPERLIQUID_CHAIN_ID} />
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* <ChainWarningText chainId={destinationChainId} className="mt-4" />
|
|
24
|
+
*/
|
|
25
|
+
export function ChainWarningText({ chainId, className }) {
|
|
26
|
+
// Chain-specific warning messages
|
|
27
|
+
if (chainId === HYPERLIQUID_CHAIN_ID) {
|
|
28
|
+
return (_jsxs(WarningText, { className: className, children: ["Minimum deposit amount: ", _jsx("b", { children: "$1" })] }));
|
|
29
|
+
}
|
|
30
|
+
// No warning for this chain
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const CreditCardIcon = ({ className }) => (_jsxs("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: [_jsx("path", { d: "M8 0.5H32C36.1421 0.5 39.5 3.85786 39.5 8V32C39.5 36.1421 36.1421 39.5 32 39.5H8C3.85786 39.5 0.5 36.1421 0.5 32V8C0.5 3.85786 3.85786 0.5 8 0.5Z", fill: "#F4F4F5" }), _jsx("path", { d: "M8 0.5H32C36.1421 0.5 39.5 3.85786 39.5 8V32C39.5 36.1421 36.1421 39.5 32 39.5H8C3.85786 39.5 0.5 36.1421 0.5 32V8C0.5 3.85786 3.85786 0.5 8 0.5Z", stroke: "#E4E4E7" }), _jsx("path", { d: "M30 18H10M19 22H14M10 16.2L10 23.8C10 24.9201 10 25.4802 10.218 25.908C10.4097 26.2843 10.7157 26.5903 11.092 26.782C11.5198 27 12.0799 27 13.2 27L26.8 27C27.9201 27 28.4802 27 28.908 26.782C29.2843 26.5903 29.5903 26.2843 29.782 25.908C30 25.4802 30 24.9201 30 23.8V16.2C30 15.0799 30 14.5198 29.782 14.092C29.5903 13.7157 29.2843 13.4097 28.908 13.218C28.4802 13 27.9201 13 26.8 13L13.2 13C12.0799 13 11.5198 13 11.092 13.218C10.7157 13.4097 10.4097 13.7157 10.218 14.092C10 14.5198 10 15.0799 10 16.2Z", stroke: "#51525C", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const QrCodeIcon = ({ className }) => (_jsxs("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: [_jsx("path", { d: "M8 0.5H32C36.1421 0.5 39.5 3.85786 39.5 8V32C39.5 36.1421 36.1421 39.5 32 39.5H8C3.85786 39.5 0.5 36.1421 0.5 32V8C0.5 3.85786 3.85786 0.5 8 0.5Z", fill: "#F4F4F5" }), _jsx("path", { d: "M8 0.5H32C36.1421 0.5 39.5 3.85786 39.5 8V32C39.5 36.1421 36.1421 39.5 32 39.5H8C3.85786 39.5 0.5 36.1421 0.5 32V8C0.5 3.85786 3.85786 0.5 8 0.5Z", stroke: "#E4E4E7" }), _jsx("path", { d: "M15 20H20V25M11.01 20H11M16.01 25H16M20.01 29H20M29.01 20H29M11 25H12.5M23.5 20H25.5M11 29H16M20 10V16M25.6 29H27.4C27.9601 29 28.2401 29 28.454 28.891C28.6422 28.7951 28.7951 28.6422 28.891 28.454C29 28.2401 29 27.9601 29 27.4V25.6C29 25.0399 29 24.7599 28.891 24.546C28.7951 24.3578 28.6422 24.2049 28.454 24.109C28.2401 24 27.9601 24 27.4 24H25.6C25.0399 24 24.7599 24 24.546 24.109C24.3578 24.2049 24.2049 24.3578 24.109 24.546C24 24.7599 24 25.0399 24 25.6V27.4C24 27.9601 24 28.2401 24.109 28.454C24.2049 28.6422 24.3578 28.7951 24.546 28.891C24.7599 29 25.0399 29 25.6 29ZM25.6 16H27.4C27.9601 16 28.2401 16 28.454 15.891C28.6422 15.7951 28.7951 15.6422 28.891 15.454C29 15.2401 29 14.9601 29 14.4V12.6C29 12.0399 29 11.7599 28.891 11.546C28.7951 11.3578 28.6422 11.2049 28.454 11.109C28.2401 11 27.9601 11 27.4 11H25.6C25.0399 11 24.7599 11 24.546 11.109C24.3578 11.2049 24.2049 11.3578 24.109 11.546C24 11.7599 24 12.0399 24 12.6V14.4C24 14.9601 24 15.2401 24.109 15.454C24.2049 15.6422 24.3578 15.7951 24.546 15.891C24.7599 16 25.0399 16 25.6 16ZM12.6 16H14.4C14.9601 16 15.2401 16 15.454 15.891C15.6422 15.7951 15.7951 15.6422 15.891 15.454C16 15.2401 16 14.9601 16 14.4V12.6C16 12.0399 16 11.7599 15.891 11.546C15.7951 11.3578 15.6422 11.2049 15.454 11.109C15.2401 11 14.9601 11 14.4 11H12.6C12.0399 11 11.7599 11 11.546 11.109C11.3578 11.2049 11.2049 11.3578 11.109 11.546C11 11.7599 11 12.0399 11 12.6V14.4C11 14.9601 11 15.2401 11.109 15.454C11.2049 15.6422 11.3578 15.7951 11.546 15.891C11.7599 16 12.0399 16 12.6 16Z", stroke: "#51525C", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
@@ -4,6 +4,8 @@ export { AnySpendBuySpin } from "./AnySpendBuySpin";
|
|
|
4
4
|
export { AnySpendCollectorClubPurchase } from "./AnySpendCollectorClubPurchase";
|
|
5
5
|
export { AnySpendCustom } from "./AnySpendCustom";
|
|
6
6
|
export { AnySpendCustomExactIn } from "./AnySpendCustomExactIn";
|
|
7
|
+
export { AnySpendDeposit } from "./AnySpendDeposit";
|
|
8
|
+
export type { AnySpendDepositProps, ChainConfig, DepositContractConfig } from "./AnySpendDeposit";
|
|
7
9
|
export { AnySpendDepositHype, HYPE_TOKEN_DETAILS } from "./AnyspendDepositHype";
|
|
8
10
|
export * from "./AnySpendFingerprintWrapper";
|
|
9
11
|
export { AnySpendNFT } from "./AnySpendNFT";
|
|
@@ -5,6 +5,7 @@ export { AnySpendBuySpin } from "./AnySpendBuySpin.js";
|
|
|
5
5
|
export { AnySpendCollectorClubPurchase } from "./AnySpendCollectorClubPurchase.js";
|
|
6
6
|
export { AnySpendCustom } from "./AnySpendCustom.js";
|
|
7
7
|
export { AnySpendCustomExactIn } from "./AnySpendCustomExactIn.js";
|
|
8
|
+
export { AnySpendDeposit } from "./AnySpendDeposit.js";
|
|
8
9
|
export { AnySpendDepositHype, HYPE_TOKEN_DETAILS } from "./AnyspendDepositHype.js";
|
|
9
10
|
export * from "./AnySpendFingerprintWrapper.js";
|
|
10
11
|
export { AnySpendNFT } from "./AnySpendNFT.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./useAnyspendCreateOnrampOrder";
|
|
2
2
|
export * from "./useAnyspendCreateOrder";
|
|
3
|
+
export * from "./useCreateDepositFirstOrder";
|
|
3
4
|
export * from "./useAnyspendOrderAndTransactions";
|
|
4
5
|
export * from "./useAnyspendOrderHistory";
|
|
5
6
|
export * from "./useAnyspendQuote";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./useAnyspendCreateOnrampOrder.js";
|
|
2
2
|
export * from "./useAnyspendCreateOrder.js";
|
|
3
|
+
export * from "./useCreateDepositFirstOrder.js";
|
|
3
4
|
export * from "./useAnyspendOrderAndTransactions.js";
|
|
4
5
|
export * from "./useAnyspendOrderHistory.js";
|
|
5
6
|
export * from "./useAnyspendQuote.js";
|
|
@@ -24,9 +24,9 @@ interface UseAnyspendFlowProps {
|
|
|
24
24
|
destinationTokenChainId?: number;
|
|
25
25
|
slippage?: number;
|
|
26
26
|
disableUrlParamManagement?: boolean;
|
|
27
|
-
orderType?: "hype_duel" | "custom_exact_in";
|
|
27
|
+
orderType?: "hype_duel" | "custom_exact_in" | "swap";
|
|
28
28
|
}
|
|
29
|
-
export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrder,
|
|
29
|
+
export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrder, onOrderSuccess, onTransactionSuccess, sourceTokenAddress, sourceTokenChainId, destinationTokenAddress, destinationTokenChainId, slippage, disableUrlParamManagement, orderType, }: UseAnyspendFlowProps): {
|
|
30
30
|
activePanel: PanelView;
|
|
31
31
|
setActivePanel: import("react").Dispatch<import("react").SetStateAction<PanelView>>;
|
|
32
32
|
orderId: string | undefined;
|
|
@@ -24,7 +24,7 @@ export var PanelView;
|
|
|
24
24
|
PanelView[PanelView["FEE_DETAIL"] = 7] = "FEE_DETAIL";
|
|
25
25
|
})(PanelView || (PanelView = {}));
|
|
26
26
|
// This hook serves for order hype_duel and custom_exact_in
|
|
27
|
-
export function useAnyspendFlow({ paymentType = "crypto", recipientAddress, loadOrder,
|
|
27
|
+
export function useAnyspendFlow({ paymentType = "crypto", recipientAddress, loadOrder, onOrderSuccess, onTransactionSuccess, sourceTokenAddress, sourceTokenChainId, destinationTokenAddress, destinationTokenChainId, slippage = 0, disableUrlParamManagement = false, orderType = "hype_duel", }) {
|
|
28
28
|
const searchParams = useSearchParamsSSR();
|
|
29
29
|
const router = useRouter();
|
|
30
30
|
// Panel and order state
|
|
@@ -131,16 +131,40 @@ export function useAnyspendFlow({ paymentType = "crypto", recipientAddress, load
|
|
|
131
131
|
// For fiat payments, always use USDC decimals (6) regardless of selectedSrcToken
|
|
132
132
|
const effectiveDecimals = paymentType === "fiat" ? USDC_BASE.decimals : selectedSrcToken.decimals;
|
|
133
133
|
const activeInputAmountInWei = parseUnits(srcAmount.replace(/,/g, ""), effectiveDecimals).toString();
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
134
|
+
// Build quote request based on order type
|
|
135
|
+
const quoteRequest = (() => {
|
|
136
|
+
const baseParams = {
|
|
137
|
+
srcChain: paymentType === "fiat" ? base.id : selectedSrcChainId,
|
|
138
|
+
dstChain: selectedDstChainId ?? base.id,
|
|
139
|
+
srcTokenAddress: paymentType === "fiat" ? USDC_BASE.address : selectedSrcToken.address,
|
|
140
|
+
dstTokenAddress: selectedDstToken.address,
|
|
141
|
+
recipientAddress: effectiveRecipientAddress,
|
|
142
|
+
onrampVendor: paymentType === "fiat" ? getOnrampVendor(selectedFiatPaymentMethod) : undefined,
|
|
143
|
+
};
|
|
144
|
+
if (orderType === "swap") {
|
|
145
|
+
return {
|
|
146
|
+
...baseParams,
|
|
147
|
+
type: "swap",
|
|
148
|
+
tradeType: "EXACT_INPUT",
|
|
149
|
+
amount: activeInputAmountInWei,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
else if (orderType === "hype_duel") {
|
|
153
|
+
return {
|
|
154
|
+
...baseParams,
|
|
155
|
+
type: "hype_duel",
|
|
156
|
+
amount: activeInputAmountInWei,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
return {
|
|
161
|
+
...baseParams,
|
|
162
|
+
type: "custom_exact_in",
|
|
163
|
+
amount: activeInputAmountInWei,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
})();
|
|
167
|
+
const { anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError } = useAnyspendQuote(quoteRequest);
|
|
144
168
|
// Get geo options for fiat
|
|
145
169
|
const { geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support } = useGeoOnrampOptions(paymentType === "fiat" ? formatUnits(activeInputAmountInWei, USDC_BASE.decimals) : "0");
|
|
146
170
|
// Update destination amount when quote changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { components } from "../../../anyspend/types/api";
|
|
2
|
+
import { DepositContractConfig } from "../components/AnySpendDeposit";
|
|
3
|
+
export type CreateDepositFirstOrderParams = {
|
|
4
|
+
recipientAddress: string;
|
|
5
|
+
srcChain: number;
|
|
6
|
+
dstChain: number;
|
|
7
|
+
srcToken: components["schemas"]["Token"];
|
|
8
|
+
dstToken: components["schemas"]["Token"];
|
|
9
|
+
creatorAddress?: string;
|
|
10
|
+
/** Optional contract config for custom execution after deposit */
|
|
11
|
+
contractConfig?: DepositContractConfig;
|
|
12
|
+
};
|
|
13
|
+
export type UseCreateDepositFirstOrderProps = {
|
|
14
|
+
onSuccess?: (data: any) => void;
|
|
15
|
+
onError?: (error: Error) => void;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Hook for creating deposit_first orders in the Anyspend protocol.
|
|
19
|
+
* This order type doesn't require srcAmount - the user deposits tokens after the order is created.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useCreateDepositFirstOrder({ onSuccess, onError }?: UseCreateDepositFirstOrderProps): {
|
|
22
|
+
createOrder: import("@tanstack/react-query").UseMutateFunction<any, Error, CreateDepositFirstOrderParams, unknown>;
|
|
23
|
+
isCreatingOrder: boolean;
|
|
24
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { anyspendService } from "../../../anyspend/services/anyspend.js";
|
|
2
|
+
import { normalizeAddress } from "../../../anyspend/utils/index.js";
|
|
3
|
+
import { useB3 } from "../../../global-account/react/index.js";
|
|
4
|
+
import { useVisitorData } from "@fingerprintjs/fingerprintjs-pro-react";
|
|
5
|
+
import { useMutation } from "@tanstack/react-query";
|
|
6
|
+
import { useMemo } from "react";
|
|
7
|
+
/**
|
|
8
|
+
* Hook for creating deposit_first orders in the Anyspend protocol.
|
|
9
|
+
* This order type doesn't require srcAmount - the user deposits tokens after the order is created.
|
|
10
|
+
*/
|
|
11
|
+
export function useCreateDepositFirstOrder({ onSuccess, onError } = {}) {
|
|
12
|
+
const { partnerId } = useB3();
|
|
13
|
+
const { data: fpData } = useVisitorData({ extendedResult: true }, { immediate: true });
|
|
14
|
+
const visitorData = fpData && {
|
|
15
|
+
requestId: fpData.requestId,
|
|
16
|
+
visitorId: fpData.visitorId,
|
|
17
|
+
};
|
|
18
|
+
const { mutate: createOrder, isPending } = useMutation({
|
|
19
|
+
mutationFn: async (params) => {
|
|
20
|
+
const { recipientAddress, srcChain, dstChain, srcToken, dstToken, creatorAddress, contractConfig } = params;
|
|
21
|
+
// Build payload based on whether we have a contract config
|
|
22
|
+
const payload = contractConfig
|
|
23
|
+
? {
|
|
24
|
+
functionAbi: contractConfig.functionAbi,
|
|
25
|
+
functionName: contractConfig.functionName,
|
|
26
|
+
functionArgs: contractConfig.functionArgs,
|
|
27
|
+
to: normalizeAddress(contractConfig.to),
|
|
28
|
+
spenderAddress: contractConfig.spenderAddress ? normalizeAddress(contractConfig.spenderAddress) : undefined,
|
|
29
|
+
action: contractConfig.action,
|
|
30
|
+
}
|
|
31
|
+
: {};
|
|
32
|
+
try {
|
|
33
|
+
return await anyspendService.createOrder({
|
|
34
|
+
recipientAddress: normalizeAddress(recipientAddress),
|
|
35
|
+
type: "deposit_first",
|
|
36
|
+
srcChain,
|
|
37
|
+
dstChain,
|
|
38
|
+
srcTokenAddress: normalizeAddress(srcToken.address),
|
|
39
|
+
dstTokenAddress: normalizeAddress(dstToken.address),
|
|
40
|
+
srcAmount: "", // Not required for deposit_first
|
|
41
|
+
payload,
|
|
42
|
+
metadata: {
|
|
43
|
+
srcToken: {
|
|
44
|
+
chainId: srcToken.chainId,
|
|
45
|
+
address: srcToken.address,
|
|
46
|
+
symbol: srcToken.symbol,
|
|
47
|
+
name: srcToken.name,
|
|
48
|
+
decimals: srcToken.decimals,
|
|
49
|
+
metadata: srcToken.metadata || {},
|
|
50
|
+
},
|
|
51
|
+
dstToken: {
|
|
52
|
+
chainId: dstToken.chainId,
|
|
53
|
+
address: dstToken.address,
|
|
54
|
+
symbol: dstToken.symbol,
|
|
55
|
+
name: dstToken.name,
|
|
56
|
+
decimals: dstToken.decimals,
|
|
57
|
+
metadata: dstToken.metadata || {},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
creatorAddress: creatorAddress ? normalizeAddress(creatorAddress) : undefined,
|
|
61
|
+
partnerId,
|
|
62
|
+
visitorData,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
if (error?.data) {
|
|
67
|
+
throw error.data;
|
|
68
|
+
}
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
onSuccess: (data) => {
|
|
73
|
+
onSuccess?.(data);
|
|
74
|
+
},
|
|
75
|
+
onError: (error) => {
|
|
76
|
+
onError?.(error);
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
return useMemo(() => ({
|
|
80
|
+
createOrder,
|
|
81
|
+
isCreatingOrder: isPending,
|
|
82
|
+
}), [createOrder, isPending]);
|
|
83
|
+
}
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
+
import { formatTokenAmount } from "../../shared/utils/number.js";
|
|
1
2
|
export const getStatusDisplay = (order) => {
|
|
3
|
+
const srcToken = order.metadata?.srcToken;
|
|
4
|
+
const dstToken = order.metadata?.dstToken;
|
|
5
|
+
const formattedSrcAmount = srcToken ? formatTokenAmount(BigInt(order.srcAmount), srcToken.decimals) : undefined;
|
|
6
|
+
const actualDstAmount = order.settlement?.actualDstAmount;
|
|
7
|
+
const formattedActualDstAmount = actualDstAmount && dstToken ? formatTokenAmount(BigInt(actualDstAmount), dstToken.decimals) : undefined;
|
|
2
8
|
switch (order.status) {
|
|
3
|
-
case "scanning_deposit_transaction":
|
|
9
|
+
case "scanning_deposit_transaction": {
|
|
10
|
+
const depositText = formattedSrcAmount && srcToken
|
|
11
|
+
? `Awaiting ${formattedSrcAmount} ${srcToken.symbol}`
|
|
12
|
+
: order.onrampMetadata
|
|
13
|
+
? "Awaiting Payment"
|
|
14
|
+
: "Awaiting Deposit";
|
|
4
15
|
return {
|
|
5
|
-
text:
|
|
16
|
+
text: depositText,
|
|
6
17
|
status: "processing",
|
|
7
18
|
};
|
|
19
|
+
}
|
|
8
20
|
case "waiting_stripe_payment":
|
|
9
21
|
return {
|
|
10
22
|
text: "Awaiting Payment",
|
|
@@ -27,15 +39,16 @@ export const getStatusDisplay = (order) => {
|
|
|
27
39
|
description: "It will take approximately one minute to complete.",
|
|
28
40
|
};
|
|
29
41
|
case "executed": {
|
|
42
|
+
const receivedText = formattedActualDstAmount && dstToken ? `Received ${formattedActualDstAmount} ${dstToken.symbol}` : undefined;
|
|
30
43
|
const { text, description } = order.type === "swap"
|
|
31
|
-
? { text: "Swap Complete", description: "Your swap has been completed successfully." }
|
|
44
|
+
? { text: receivedText || "Swap Complete", description: "Your swap has been completed successfully." }
|
|
32
45
|
: order.type === "mint_nft"
|
|
33
46
|
? { text: "NFT Minted", description: "Your NFT has been minted" }
|
|
34
47
|
: order.type === "join_tournament"
|
|
35
48
|
? { text: "Tournament Joined", description: "You have joined the tournament" }
|
|
36
49
|
: order.type === "fund_tournament"
|
|
37
50
|
? { text: "Tournament Funded", description: "You have funded the tournament" }
|
|
38
|
-
: { text: "Order Complete", description: "Your order has been completed" };
|
|
51
|
+
: { text: receivedText || "Order Complete", description: "Your order has been completed" };
|
|
39
52
|
return { text, status: "success", description };
|
|
40
53
|
}
|
|
41
54
|
case "refunding":
|
|
@@ -48,8 +61,18 @@ export const getStatusDisplay = (order) => {
|
|
|
48
61
|
status: "failure",
|
|
49
62
|
description: "This order has failed. Please try again or contact support.",
|
|
50
63
|
};
|
|
64
|
+
case "quoting_after_deposit": {
|
|
65
|
+
return {
|
|
66
|
+
text: "Quoting After Deposit",
|
|
67
|
+
status: "processing",
|
|
68
|
+
description: "Getting quote for the order",
|
|
69
|
+
};
|
|
70
|
+
}
|
|
51
71
|
default:
|
|
52
|
-
|
|
72
|
+
return {
|
|
73
|
+
text: order.status,
|
|
74
|
+
status: "processing",
|
|
75
|
+
};
|
|
53
76
|
}
|
|
54
77
|
};
|
|
55
78
|
export const getErrorDisplay = (errorDetails) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import app from "../../../../global-account/app.js";
|
|
4
|
-
import { Button, IPFSMediaRenderer, toast,
|
|
4
|
+
import { Button, IPFSMediaRenderer, toast, useAuthentication, useB3Config, useProfile, } from "../../../../global-account/react/index.js";
|
|
5
5
|
import { validateImageUrl } from "../../../../global-account/react/utils/profileDisplay.js";
|
|
6
6
|
import { cn } from "../../../../shared/utils/cn.js";
|
|
7
7
|
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
@@ -37,7 +37,8 @@ export function AvatarEditor({ onSetAvatar, className }) {
|
|
|
37
37
|
const [zoom, setZoom] = useState(1);
|
|
38
38
|
const [croppedAreaPixels, setCroppedAreaPixels] = useState(null);
|
|
39
39
|
const fileInputRef = useRef(null);
|
|
40
|
-
const {
|
|
40
|
+
const { partnerId } = useB3Config();
|
|
41
|
+
const { user, setUser } = useAuthentication(partnerId);
|
|
41
42
|
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
42
43
|
const contentType = useModalStore(state => state.contentType);
|
|
43
44
|
const account = useActiveAccount();
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
2
|
-
import { RelayKitProviderWrapper, TooltipProvider,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { RelayKitProviderWrapper, TooltipProvider, useAuthStore } from "../../../../global-account/react/index.js";
|
|
3
|
+
import { useAutoSelectWallet } from "../../../../global-account/react/hooks/useAutoSelectWallet.js";
|
|
3
4
|
import { createWagmiConfig } from "../../../../global-account/react/utils/createWagmiConfig.js";
|
|
4
5
|
import { loadGA4Script } from "../../../../global-account/utils/analytics.js";
|
|
5
|
-
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
6
6
|
import "@relayprotocol/relay-kit-ui/styles.css";
|
|
7
7
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { useEffect, useMemo } from "react";
|
|
9
|
+
import { ThirdwebProvider, useActiveAccount } from "thirdweb/react";
|
|
10
10
|
import { WagmiProvider } from "wagmi";
|
|
11
11
|
import { setClientType } from "../../../client-manager.js";
|
|
12
12
|
import { StyleRoot } from "../StyleRoot.js";
|
|
13
13
|
import { setToastContext, ToastProvider, useToastContext } from "../Toast/index.js";
|
|
14
14
|
import { LocalSDKProvider } from "./LocalSDKProvider.js";
|
|
15
15
|
import { B3Context } from "./types.js";
|
|
16
|
-
const debug = debugB3React("B3Provider");
|
|
17
16
|
/**
|
|
18
17
|
* Default permissions configuration for B3 provider
|
|
19
18
|
*/
|
|
@@ -47,52 +46,26 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey
|
|
|
47
46
|
*/
|
|
48
47
|
export function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa, theme = "light", clientType = "socket", partnerId, stripePublishableKey, createClientReferenceId, enableTurnkey, }) {
|
|
49
48
|
const activeAccount = useActiveAccount();
|
|
50
|
-
const [manuallySelectedWallet, setManuallySelectedWallet] = useState(undefined);
|
|
51
|
-
const wallets = useConnectedWallets();
|
|
52
49
|
const isAuthenticated = useAuthStore(state => state.isAuthenticated);
|
|
53
|
-
const isConnected = useAuthStore(state => state.isConnected);
|
|
54
|
-
const justCompletedLogin = useAuthStore(state => state.justCompletedLogin);
|
|
55
|
-
const setActiveWallet = useSetActiveWallet();
|
|
56
|
-
const { user, setUser, refetchUser } = useAuthentication(partnerId);
|
|
57
|
-
debug("@@B3Provider:isConnected", isConnected);
|
|
58
|
-
debug("@@wallets", wallets);
|
|
59
|
-
debug("@@B3Provider:user", user);
|
|
60
|
-
debug("@@B3Provider:justCompletedLogin", justCompletedLogin);
|
|
50
|
+
//const isConnected = useAuthStore(state => state.isConnected);
|
|
51
|
+
//const justCompletedLogin = useAuthStore(state => state.justCompletedLogin);
|
|
61
52
|
// Use given accountOverride or activeAccount from thirdweb
|
|
53
|
+
// WOJ: why if isAuthenticated is false, we don't use activeAccount, which should be undefined?
|
|
54
|
+
// skip isAuthenticated check ?
|
|
62
55
|
const effectiveAccount = isAuthenticated ? accountOverride || activeAccount : undefined;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
const autoSelectFirstEOAWallet = async () => {
|
|
71
|
-
// Only proceed if auto-selection is enabled and user is authenticated
|
|
72
|
-
if (!automaticallySetFirstEoa || !isAuthenticated) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
// Find the first EOA wallet (excluding ecosystem wallets)
|
|
76
|
-
const isEOAWallet = (wallet) => !wallet.id.startsWith("ecosystem.");
|
|
77
|
-
const firstEOAWallet = wallets.find(isEOAWallet);
|
|
78
|
-
if (firstEOAWallet) {
|
|
79
|
-
// Only auto-select if the last auth was via wallet or no previous auth provider
|
|
80
|
-
const lastAuthProvider = await getLastAuthProvider();
|
|
81
|
-
const shouldAutoSelect = lastAuthProvider === null || lastAuthProvider === "wallet";
|
|
82
|
-
if (shouldAutoSelect) {
|
|
83
|
-
setWallet(firstEOAWallet);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
autoSelectFirstEOAWallet();
|
|
88
|
-
}, [automaticallySetFirstEoa, isAuthenticated, setWallet, wallets]);
|
|
56
|
+
// Wrapper to set active wallet via thirdweb
|
|
57
|
+
// Note: `wallet` in context is deprecated - use useActiveWallet() from thirdweb/react instead
|
|
58
|
+
// Auto-select first EOA wallet when enabled
|
|
59
|
+
useAutoSelectWallet({
|
|
60
|
+
enabled: automaticallySetFirstEoa,
|
|
61
|
+
});
|
|
89
62
|
return (_jsx(B3Context.Provider, { value: {
|
|
90
63
|
account: effectiveAccount,
|
|
91
|
-
setWallet,
|
|
92
|
-
wallet:
|
|
93
|
-
user,
|
|
94
|
-
setUser,
|
|
95
|
-
refetchUser,
|
|
64
|
+
// setWallet,
|
|
65
|
+
//wallet: undefined, // Deprecated: use useActiveWallet() from thirdweb/react instead
|
|
66
|
+
//user,
|
|
67
|
+
//setUser,
|
|
68
|
+
//refetchUser,
|
|
96
69
|
initialized: true,
|
|
97
70
|
ready: !!effectiveAccount,
|
|
98
71
|
automaticallySetFirstEoa,
|
|
@@ -104,11 +77,8 @@ export function InnerProvider({ children, accountOverride, environment, defaultP
|
|
|
104
77
|
stripePublishableKey,
|
|
105
78
|
createClientReferenceId,
|
|
106
79
|
enableTurnkey,
|
|
107
|
-
}, children:
|
|
80
|
+
}, children: children }));
|
|
108
81
|
}
|
|
109
|
-
const InnerProvider2 = ({ children }) => {
|
|
110
|
-
return _jsx(_Fragment, { children: children });
|
|
111
|
-
};
|
|
112
82
|
/**
|
|
113
83
|
* Component to connect the toast context to the global toast API
|
|
114
84
|
*/
|
|
@@ -2,7 +2,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
3
3
|
import { ThirdwebProvider, useActiveAccount } from "thirdweb/react";
|
|
4
4
|
import { WagmiProvider } from "wagmi";
|
|
5
|
-
import { useAuthentication } from "../../hooks/useAuthentication.js";
|
|
6
5
|
import { createWagmiConfig } from "../../utils/createWagmiConfig.js";
|
|
7
6
|
import { LocalSDKProvider } from "./LocalSDKProvider.js";
|
|
8
7
|
import { B3Context } from "./types.js";
|
|
@@ -28,17 +27,17 @@ export function B3Provider({ theme = "light", children, accountOverride, environ
|
|
|
28
27
|
*/
|
|
29
28
|
export function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, theme = "light", clientType = "socket", partnerId, rpcUrls, }) {
|
|
30
29
|
const activeAccount = useActiveAccount();
|
|
31
|
-
const { user, setUser, refetchUser } = useAuthentication(partnerId);
|
|
30
|
+
//const { user, setUser, refetchUser } = useAuthentication(partnerId);
|
|
32
31
|
const wagmiConfig = createWagmiConfig({ partnerId, rpcUrls });
|
|
33
32
|
// Use given accountOverride or activeAccount from thirdweb
|
|
34
33
|
const effectiveAccount = accountOverride || activeAccount;
|
|
35
34
|
return (_jsx(WagmiProvider, { config: wagmiConfig, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(B3Context.Provider, { value: {
|
|
36
|
-
account: effectiveAccount,
|
|
35
|
+
//account: effectiveAccount,
|
|
37
36
|
automaticallySetFirstEoa: false,
|
|
38
|
-
setWallet: () => {
|
|
37
|
+
//setWallet: () => {},
|
|
39
38
|
wallet: undefined,
|
|
40
|
-
user,
|
|
41
|
-
setUser,
|
|
39
|
+
//user,
|
|
40
|
+
//setUser,
|
|
42
41
|
initialized: true,
|
|
43
42
|
ready: !!effectiveAccount,
|
|
44
43
|
environment,
|
|
@@ -46,6 +45,6 @@ export function InnerProvider({ children, accountOverride, environment, defaultP
|
|
|
46
45
|
theme,
|
|
47
46
|
clientType,
|
|
48
47
|
partnerId,
|
|
49
|
-
refetchUser,
|
|
48
|
+
//refetchUser,
|
|
50
49
|
}, children: children }) }) }));
|
|
51
50
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Users } from "@b3dotfun/b3-api";
|
|
2
1
|
import { CreateOnrampOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOnrampOrder";
|
|
3
2
|
import { CreateOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOrder";
|
|
4
3
|
import { PermissionsConfig } from "../../../../global-account/types/permissions";
|
|
@@ -10,11 +9,7 @@ import { ClientType } from "../../../client-manager";
|
|
|
10
9
|
export interface B3ContextType {
|
|
11
10
|
account?: Account;
|
|
12
11
|
automaticallySetFirstEoa: boolean;
|
|
13
|
-
user?: Users;
|
|
14
|
-
setWallet: (wallet: Wallet) => void;
|
|
15
12
|
wallet?: Wallet;
|
|
16
|
-
setUser: (user?: Users) => void;
|
|
17
|
-
refetchUser: () => Promise<any>;
|
|
18
13
|
initialized: boolean;
|
|
19
14
|
ready: boolean;
|
|
20
15
|
environment?: "development" | "production";
|
|
@@ -5,11 +5,11 @@ import { createContext } from "react";
|
|
|
5
5
|
export const B3Context = createContext({
|
|
6
6
|
account: undefined,
|
|
7
7
|
automaticallySetFirstEoa: false,
|
|
8
|
-
user: undefined,
|
|
9
|
-
setWallet: () => {
|
|
8
|
+
//user: undefined,
|
|
9
|
+
//setWallet: () => {},
|
|
10
10
|
wallet: undefined,
|
|
11
|
-
setUser: () => {
|
|
12
|
-
refetchUser: async () => {
|
|
11
|
+
//setUser: () => {},
|
|
12
|
+
//refetchUser: async () => {},
|
|
13
13
|
initialized: false,
|
|
14
14
|
ready: false,
|
|
15
15
|
environment: "development",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useB3Account: () => import("thirdweb/wallets").Account | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const useB3Config: () => {
|
|
2
|
+
automaticallySetFirstEoa: boolean;
|
|
3
|
+
environment: "development" | "production" | undefined;
|
|
4
|
+
theme: "light" | "dark";
|
|
5
|
+
clientType: import("../../../client-manager").ClientType;
|
|
6
|
+
partnerId: string;
|
|
7
|
+
createClientReferenceId: ((params: import("../../../../anyspend/react").CreateOrderParams | import("../../../../anyspend/react").CreateOnrampOrderParams) => Promise<string>) | undefined;
|
|
8
|
+
enableTurnkey: boolean | undefined;
|
|
9
|
+
};
|