@b3dotfun/sdk 0.0.88-alpha.4 → 0.0.88-alpha.6
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 +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +2 -2
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +14 -1
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +2 -2
- package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +3 -4
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useValidatedClientReferenceId.js +1 -1
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +2 -3
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.js +12 -0
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +2 -18
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +23 -57
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +38 -35
- package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +14 -4
- package/dist/cjs/global-account/react/components/B3Provider/useB3.js +4 -11
- package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +5 -2
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +10 -2
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +18 -17
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +1 -2
- package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.js +6 -6
- package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.js +7 -7
- package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.js +7 -7
- package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.js +5 -5
- package/dist/cjs/global-account/react/components/RequestPermissions/RequestPermissions.js +8 -9
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +1 -1
- package/dist/cjs/global-account/react/components/StyleRoot.js +3 -3
- package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +1 -2
- package/dist/cjs/global-account/react/components/index.d.ts +1 -2
- package/dist/cjs/global-account/react/components/index.js +3 -6
- package/dist/cjs/global-account/react/hooks/index.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/index.js +3 -1
- package/dist/cjs/global-account/react/hooks/useAuth.js +1 -2
- package/dist/cjs/global-account/react/hooks/useClient.js +1 -1
- package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +1 -1
- package/dist/cjs/global-account/react/hooks/useNotifications.js +14 -14
- package/dist/cjs/global-account/react/hooks/useTokenBalance.js +5 -5
- package/dist/cjs/global-account/react/hooks/useUser.d.ts +60 -0
- package/dist/cjs/global-account/react/hooks/useUser.js +20 -0
- package/dist/cjs/global-account/react/hooks/useUserQuery.js +9 -35
- package/dist/cjs/global-account/react/index.native.d.ts +0 -2
- package/dist/cjs/global-account/react/index.native.js +1 -5
- package/dist/cjs/global-account/react/stores/configStore.d.ts +24 -0
- package/dist/cjs/global-account/react/stores/configStore.js +30 -0
- package/dist/cjs/global-account/react/stores/index.d.ts +1 -0
- package/dist/cjs/global-account/react/stores/index.js +3 -1
- package/dist/cjs/global-account/react/stores/userStore.d.ts +22 -0
- package/dist/cjs/global-account/react/stores/userStore.js +30 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +2 -2
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +14 -1
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +3 -3
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +3 -4
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.js +2 -2
- package/dist/esm/global-account/react/components/B3DynamicModal.js +3 -4
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.js +10 -0
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +2 -18
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +22 -58
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +36 -36
- package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +14 -4
- package/dist/esm/global-account/react/components/B3Provider/useB3.js +4 -11
- package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +5 -2
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +10 -2
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +18 -17
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +2 -3
- package/dist/esm/global-account/react/components/ManageAccount/channels/DiscordChannel.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/EmailChannel.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/PhoneChannel.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.js +2 -2
- package/dist/esm/global-account/react/components/RequestPermissions/RequestPermissions.js +2 -3
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -2
- package/dist/esm/global-account/react/components/StyleRoot.js +3 -3
- package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +2 -3
- package/dist/esm/global-account/react/components/index.d.ts +1 -2
- package/dist/esm/global-account/react/components/index.js +1 -2
- package/dist/esm/global-account/react/hooks/index.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/index.js +1 -0
- package/dist/esm/global-account/react/hooks/useAuth.js +2 -3
- package/dist/esm/global-account/react/hooks/useClient.js +2 -2
- package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -2
- package/dist/esm/global-account/react/hooks/useNotifications.js +2 -2
- package/dist/esm/global-account/react/hooks/useTokenBalance.js +6 -6
- package/dist/esm/global-account/react/hooks/useUser.d.ts +60 -0
- package/dist/esm/global-account/react/hooks/useUser.js +17 -0
- package/dist/esm/global-account/react/hooks/useUserQuery.js +1 -27
- package/dist/esm/global-account/react/index.native.d.ts +0 -2
- package/dist/esm/global-account/react/index.native.js +0 -2
- package/dist/esm/global-account/react/stores/configStore.d.ts +24 -0
- package/dist/esm/global-account/react/stores/configStore.js +27 -0
- package/dist/esm/global-account/react/stores/index.d.ts +1 -0
- package/dist/esm/global-account/react/stores/index.js +1 -0
- package/dist/esm/global-account/react/stores/userStore.d.ts +22 -0
- package/dist/esm/global-account/react/stores/userStore.js +27 -0
- package/dist/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +2 -18
- package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +14 -4
- package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +10 -2
- package/dist/types/global-account/react/components/index.d.ts +1 -2
- package/dist/types/global-account/react/hooks/index.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useUser.d.ts +60 -0
- package/dist/types/global-account/react/index.native.d.ts +0 -2
- package/dist/types/global-account/react/stores/configStore.d.ts +24 -0
- package/dist/types/global-account/react/stores/index.d.ts +1 -0
- package/dist/types/global-account/react/stores/userStore.d.ts +22 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +2 -2
- package/src/anyspend/react/components/AnySpendDeposit.tsx +3 -1
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +15 -1
- package/src/anyspend/react/components/common/OrderDetails.tsx +8 -2
- package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +3 -4
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +2 -2
- package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +2 -2
- package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +2 -2
- package/src/anyspend/react/hooks/useValidatedClientReferenceId.ts +2 -2
- package/src/global-account/react/components/B3DynamicModal.tsx +3 -4
- package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +19 -0
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +43 -54
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +32 -117
- package/src/global-account/react/components/B3Provider/useB3.ts +4 -13
- package/src/global-account/react/components/B3Provider/useB3Account.ts +6 -2
- package/src/global-account/react/components/B3Provider/useB3Config.ts +18 -31
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +2 -4
- package/src/global-account/react/components/ManageAccount/channels/DiscordChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/EmailChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/PhoneChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/TelegramChannel.tsx +2 -2
- package/src/global-account/react/components/RequestPermissions/RequestPermissions.tsx +4 -4
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
- package/src/global-account/react/components/StyleRoot.tsx +3 -3
- package/src/global-account/react/components/custom/ManageAccountButton.tsx +2 -3
- package/src/global-account/react/components/index.ts +1 -2
- package/src/global-account/react/hooks/index.ts +1 -0
- package/src/global-account/react/hooks/useAuth.ts +2 -3
- package/src/global-account/react/hooks/useClient.ts +2 -2
- package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +2 -2
- package/src/global-account/react/hooks/useNotifications.ts +2 -2
- package/src/global-account/react/hooks/useTokenBalance.tsx +8 -7
- package/src/global-account/react/hooks/useUser.ts +20 -0
- package/src/global-account/react/hooks/useUserQuery.ts +1 -40
- package/src/global-account/react/index.native.ts +0 -2
- package/src/global-account/react/stores/configStore.ts +51 -0
- package/src/global-account/react/stores/index.ts +1 -0
- package/src/global-account/react/stores/userStore.ts +41 -0
- package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +0 -27
- package/dist/cjs/global-account/react/components/B3Provider/types.js +0 -24
- package/dist/esm/global-account/react/components/B3Provider/types.d.ts +0 -27
- package/dist/esm/global-account/react/components/B3Provider/types.js +0 -21
- package/dist/types/global-account/react/components/B3Provider/types.d.ts +0 -27
- package/src/global-account/react/components/B3Provider/types.ts +0 -50
|
@@ -60,7 +60,7 @@ function AnySpend(props) {
|
|
|
60
60
|
function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, }) {
|
|
61
61
|
const searchParams = (0, react_2.useSearchParamsSSR)();
|
|
62
62
|
const router = (0, react_2.useRouter)();
|
|
63
|
-
const { partnerId } = (0, react_2.
|
|
63
|
+
const { partnerId } = (0, react_2.useB3Config)();
|
|
64
64
|
const setB3ModalContentType = (0, react_2.useModalStore)(state => state.setB3ModalContentType);
|
|
65
65
|
// Determine if we're in "buy mode" based on whether destination token props are provided
|
|
66
66
|
const isBuyMode = !!(destinationTokenAddress && destinationTokenChainId);
|
|
@@ -177,7 +177,7 @@ function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentT
|
|
|
177
177
|
};
|
|
178
178
|
// Chain selection view
|
|
179
179
|
if (step === "select-chain") {
|
|
180
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("anyspend-deposit anyspend-deposit-chain-selection font-inter bg-as-surface-primary relative mx-auto w-full max-w-[460px]", mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: [onClose && ((0, jsx_runtime_1.jsx)("button", { onClick: onClose, className: "anyspend-deposit-close-button text-as-secondary hover:text-as-primary absolute right-4 top-4 z-10", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })), !isBalanceLoading && totalBalance > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-balance border-secondary border-b p-5", children: [(0, jsx_runtime_1.jsx)("p", { className: "anyspend-deposit-balance-label text-as-secondary text-sm", children: "Your Balance" }), (0, jsx_runtime_1.jsxs)("p", { className: "anyspend-deposit-balance-value text-as-primary text-3xl font-semibold", children: [formatDecimal(totalBalance), " ", (0, jsx_runtime_1.jsx)("span", { className: "text-sm", children: "USD" })] })] })), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-options flex flex-col gap-2 p-6", children: [isBalanceLoading && ((0, jsx_runtime_1.jsx)("div", { className: "anyspend-deposit-chains-skeleton flex flex-col gap-2", children: [1, 2].map((_, i) => ((0, jsx_runtime_1.jsxs)("div", { className: "border-border-primary flex items-center justify-between rounded-xl border p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-6 w-6 rounded-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-1", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-4 w-32" }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-3 w-20" })] })] }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-5 w-5" })] }, i))) })), topChainsWithBalance.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: "anyspend-deposit-chains flex flex-col gap-2", children: topChainsWithBalance.map(chain => ((0, jsx_runtime_1.jsxs)("button", { onClick: () => handleSelectChain(chain.id), className: "anyspend-deposit-chain-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [(0, jsx_runtime_1.jsx)("div", { className: "anyspend-deposit-chain-content", children: (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-chain-info", children: [(0, jsx_runtime_1.jsxs)("span", { className: "anyspend-deposit-chain-name text-as-primary flex items-center gap-1.5 font-medium", children: ["Deposit from ", chain.name, (0, jsx_runtime_1.jsx)(ChainIcon, { chainId: chain.id, className: "h-5 w-5" })] }), (0, jsx_runtime_1.jsxs)("p", { className: "anyspend-deposit-chain-balance text-as-secondary text-xs", children: [formatUsd(chain.balance), " available"] })] }) }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "anyspend-deposit-chain-chevron text-as-secondary h-5 w-5" })] }, chain.id))) })), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-general-options flex flex-col gap-2", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectCrypto, className: "anyspend-deposit-option-button anyspend-deposit-crypto-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [(0, jsx_runtime_1.jsx)("div", { className: "anyspend-deposit-option-content", children: (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-info", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-option-title text-as-primary font-medium", children: "Deposit Crypto" }), (0, jsx_runtime_1.jsx)("p", { className: "anyspend-deposit-option-description text-as-secondary text-xs", children: "Swap from any token on any chain" })] }) }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-divider flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-stroke h-px flex-1" }), (0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-divider-text text-as-secondary text-sm", children: "More options" }), (0, jsx_runtime_1.jsx)("div", { className: "bg-as-stroke h-px flex-1" })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectQrDeposit, className: "anyspend-deposit-option-button anyspend-deposit-qr-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-content flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(QrCodeIcon_1.QrCodeIcon, { className: "anyspend-deposit-option-icon h-10 w-10" }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-info", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-option-title text-as-primary font-medium", children: "Deposit with QR Code" }), (0, jsx_runtime_1.jsx)("p", { className: "anyspend-deposit-option-description text-as-secondary text-xs", children: "Send tokens directly to deposit address" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectFiat, className: "anyspend-deposit-option-button anyspend-deposit-fiat-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left transition-all", children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-content flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(CreditCardIcon_1.CreditCardIcon, { className: "anyspend-deposit-option-icon h-10 w-10" }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-info", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-option-title text-as-primary font-medium", children: "Fund with Fiat" }), (0, jsx_runtime_1.jsx)("p", { className: "anyspend-deposit-option-description text-as-secondary text-xs", children: "Pay with card or bank transfer" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] })] }), (0, jsx_runtime_1.jsx)(WarningText_1.ChainWarningText, { chainId: destinationChainId, className: "mt-2" })] })] }));
|
|
180
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("anyspend-deposit anyspend-deposit-chain-selection font-inter bg-as-surface-primary relative mx-auto w-full max-w-[460px]", mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: [onClose && ((0, jsx_runtime_1.jsx)("button", { onClick: onClose, className: "anyspend-deposit-close-button text-as-secondary hover:text-as-primary absolute right-4 top-4 z-10", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })), !isBalanceLoading && totalBalance > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-balance border-theme-border-secondary border-b p-5", children: [(0, jsx_runtime_1.jsx)("p", { className: "anyspend-deposit-balance-label text-as-secondary text-sm", children: "Your Balance" }), (0, jsx_runtime_1.jsxs)("p", { className: "anyspend-deposit-balance-value text-as-primary text-3xl font-semibold", children: [formatDecimal(totalBalance), " ", (0, jsx_runtime_1.jsx)("span", { className: "text-sm", children: "USD" })] })] })), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-options flex flex-col gap-2 p-6", children: [isBalanceLoading && ((0, jsx_runtime_1.jsx)("div", { className: "anyspend-deposit-chains-skeleton flex flex-col gap-2", children: [1, 2].map((_, i) => ((0, jsx_runtime_1.jsxs)("div", { className: "border-border-primary flex items-center justify-between rounded-xl border p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-6 w-6 rounded-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-1", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-4 w-32" }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-3 w-20" })] })] }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-5 w-5" })] }, i))) })), topChainsWithBalance.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: "anyspend-deposit-chains flex flex-col gap-2", children: topChainsWithBalance.map(chain => ((0, jsx_runtime_1.jsxs)("button", { onClick: () => handleSelectChain(chain.id), className: "anyspend-deposit-chain-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [(0, jsx_runtime_1.jsx)("div", { className: "anyspend-deposit-chain-content", children: (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-chain-info", children: [(0, jsx_runtime_1.jsxs)("span", { className: "anyspend-deposit-chain-name text-as-primary flex items-center gap-1.5 font-medium", children: ["Deposit from ", chain.name, (0, jsx_runtime_1.jsx)(ChainIcon, { chainId: chain.id, className: "h-5 w-5" })] }), (0, jsx_runtime_1.jsxs)("p", { className: "anyspend-deposit-chain-balance text-as-secondary text-xs", children: [formatUsd(chain.balance), " available"] })] }) }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "anyspend-deposit-chain-chevron text-as-secondary h-5 w-5" })] }, chain.id))) })), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-general-options flex flex-col gap-2", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectCrypto, className: "anyspend-deposit-option-button anyspend-deposit-crypto-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [(0, jsx_runtime_1.jsx)("div", { className: "anyspend-deposit-option-content", children: (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-info", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-option-title text-as-primary font-medium", children: "Deposit Crypto" }), (0, jsx_runtime_1.jsx)("p", { className: "anyspend-deposit-option-description text-as-secondary text-xs", children: "Swap from any token on any chain" })] }) }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-divider flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-stroke h-px flex-1" }), (0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-divider-text text-as-secondary text-sm", children: "More options" }), (0, jsx_runtime_1.jsx)("div", { className: "bg-as-stroke h-px flex-1" })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectQrDeposit, className: "anyspend-deposit-option-button anyspend-deposit-qr-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-content flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(QrCodeIcon_1.QrCodeIcon, { className: "anyspend-deposit-option-icon h-10 w-10" }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-info", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-option-title text-as-primary font-medium", children: "Deposit with QR Code" }), (0, jsx_runtime_1.jsx)("p", { className: "anyspend-deposit-option-description text-as-secondary text-xs", children: "Send tokens directly to deposit address" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectFiat, className: "anyspend-deposit-option-button anyspend-deposit-fiat-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left transition-all", children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-content flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(CreditCardIcon_1.CreditCardIcon, { className: "anyspend-deposit-option-icon h-10 w-10" }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-info", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-option-title text-as-primary font-medium", children: "Fund with Fiat" }), (0, jsx_runtime_1.jsx)("p", { className: "anyspend-deposit-option-description text-as-secondary text-xs", children: "Pay with card or bank transfer" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] })] }), (0, jsx_runtime_1.jsx)(WarningText_1.ChainWarningText, { chainId: destinationChainId, className: "mt-2" })] })] }));
|
|
181
181
|
}
|
|
182
182
|
// QR Deposit view
|
|
183
183
|
if (step === "qr-deposit") {
|
|
@@ -186,5 +186,5 @@ function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentT
|
|
|
186
186
|
// Check if destination is Hyperliquid
|
|
187
187
|
const isHyperliquidDeposit = destinationChainId === anyspend_1.HYPERLIQUID_CHAIN_ID;
|
|
188
188
|
// Deposit view
|
|
189
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit anyspend-deposit-form relative", children: [shouldShowChainSelection && ((0, jsx_runtime_1.jsxs)("button", { onClick: handleBack, className: "anyspend-deposit-back-button text-as-secondary hover:text-as-primary absolute left-4 top-4 z-10 flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)("svg", { className: "anyspend-deposit-back-icon h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }), (0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-back-text text-sm", children: "Back" })] })), onClose && ((0, jsx_runtime_1.jsx)("button", { onClick: onClose, className: "anyspend-deposit-close-button text-as-secondary hover:text-as-primary absolute right-4 top-4 z-10", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })), (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("anyspend-deposit-form-content", shouldShowChainSelection && "pt-8"), children: isHyperliquidDeposit ? ((0, jsx_runtime_1.jsx)(AnySpend_1.AnySpend, { loadOrder: loadOrder, mode: mode, defaultActiveTab: paymentType, recipientAddress: recipientAddress, sourceChainId: selectedChainId, destinationTokenAddress: destinationToken.address, destinationTokenChainId: destinationChainId, onSuccess: txHash => onSuccess?.(txHash ?? ""), onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, hideHeader: true, hideBottomNavigation: true, disableUrlParamManagement: true })) : ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, paymentType: paymentType, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: selectedChainId, destinationToken: destinationToken, destinationChainId: destinationChainId, orderType: effectiveOrderType, minDestinationAmount: minDestinationAmount, header: header ?? defaultHeader, onSuccess: onSuccess, onOpenCustomModal: onOpenCustomModal, mainFooter: mainFooter, onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, preferEoa: preferEoa, customExactInConfig: depositContractConfig })) }), (0, jsx_runtime_1.jsx)(WarningText_1.ChainWarningText, { chainId: destinationChainId, className: "px-4 pb-4" })] }));
|
|
189
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit anyspend-deposit-form relative", children: [shouldShowChainSelection && ((0, jsx_runtime_1.jsxs)("button", { onClick: handleBack, className: "anyspend-deposit-back-button text-as-secondary hover:text-as-primary absolute left-4 top-4 z-10 flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)("svg", { className: "anyspend-deposit-back-icon h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }), (0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-back-text text-sm", children: "Back" })] })), onClose && ((0, jsx_runtime_1.jsx)("button", { onClick: onClose, className: "anyspend-deposit-close-button text-as-secondary hover:text-as-primary absolute right-4 top-4 z-10", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })), (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("anyspend-deposit-form-content", shouldShowChainSelection && "pt-8"), children: isHyperliquidDeposit ? ((0, jsx_runtime_1.jsx)(AnySpend_1.AnySpend, { loadOrder: loadOrder, mode: mode, defaultActiveTab: paymentType, recipientAddress: recipientAddress, sourceChainId: selectedChainId, destinationTokenAddress: destinationToken.address, destinationTokenChainId: destinationChainId, onSuccess: txHash => onSuccess?.(txHash ?? ""), onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, hideHeader: true, hideBottomNavigation: true, disableUrlParamManagement: true }, selectedChainId)) : ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, paymentType: paymentType, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: selectedChainId, destinationToken: destinationToken, destinationChainId: destinationChainId, orderType: effectiveOrderType, minDestinationAmount: minDestinationAmount, header: header ?? defaultHeader, onSuccess: onSuccess, onOpenCustomModal: onOpenCustomModal, mainFooter: mainFooter, onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, preferEoa: preferEoa, customExactInConfig: depositContractConfig }, selectedChainId)) }), (0, jsx_runtime_1.jsx)(WarningText_1.ChainWarningText, { chainId: destinationChainId, className: "px-4 pb-4" })] }));
|
|
190
190
|
}
|
|
@@ -10,6 +10,7 @@ const formatAddress_1 = require("../../../../shared/utils/formatAddress");
|
|
|
10
10
|
const thirdweb_1 = require("../../../../shared/utils/thirdweb");
|
|
11
11
|
const lucide_react_1 = require("lucide-react");
|
|
12
12
|
const react_2 = require("thirdweb/react");
|
|
13
|
+
const wallets_1 = require("thirdweb/wallets");
|
|
13
14
|
const useConnectedWalletDisplay_1 = require("../../hooks/useConnectedWalletDisplay");
|
|
14
15
|
var CryptoPaymentMethodType;
|
|
15
16
|
(function (CryptoPaymentMethodType) {
|
|
@@ -18,6 +19,12 @@ var CryptoPaymentMethodType;
|
|
|
18
19
|
CryptoPaymentMethodType["GLOBAL_WALLET"] = "global_wallet";
|
|
19
20
|
CryptoPaymentMethodType["TRANSFER_CRYPTO"] = "transfer_crypto";
|
|
20
21
|
})(CryptoPaymentMethodType || (exports.CryptoPaymentMethodType = CryptoPaymentMethodType = {}));
|
|
22
|
+
const recommendWallets = [
|
|
23
|
+
(0, wallets_1.createWallet)("io.metamask"),
|
|
24
|
+
(0, wallets_1.createWallet)("com.coinbase.wallet"),
|
|
25
|
+
(0, wallets_1.createWallet)("me.rainbow"),
|
|
26
|
+
(0, wallets_1.createWallet)("io.rabby"),
|
|
27
|
+
];
|
|
21
28
|
function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentMethod, isCreatingOrder, onBack, onSelectPaymentMethod, }) {
|
|
22
29
|
const { connectedEOAWallet, connectedSmartWallet } = (0, react_1.useAccountWallet)();
|
|
23
30
|
const { disconnect } = (0, react_2.useDisconnect)();
|
|
@@ -33,7 +40,13 @@ function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentMethod,
|
|
|
33
40
|
if (connectedEOAWallet) {
|
|
34
41
|
await disconnect(connectedEOAWallet);
|
|
35
42
|
}
|
|
36
|
-
const wallet = await openConnectModal({
|
|
43
|
+
const wallet = await openConnectModal({
|
|
44
|
+
client: thirdweb_1.client,
|
|
45
|
+
setActive: false,
|
|
46
|
+
size: "compact",
|
|
47
|
+
showThirdwebBranding: false,
|
|
48
|
+
wallets: recommendWallets,
|
|
49
|
+
});
|
|
37
50
|
if (wallet) {
|
|
38
51
|
// setActiveWallet(wallet);
|
|
39
52
|
setSelectedPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
@@ -141,7 +141,7 @@ exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ mode = "modal",
|
|
|
141
141
|
const router = (0, hooks_1.useRouter)();
|
|
142
142
|
const searchParams = (0, hooks_1.useSearchParams)();
|
|
143
143
|
// Get theme from B3Provider context
|
|
144
|
-
const { theme } = (0, react_1.
|
|
144
|
+
const { theme } = (0, react_1.useB3Config)();
|
|
145
145
|
const colorMode = theme || "light";
|
|
146
146
|
// Read crypto payment method from URL parameters
|
|
147
147
|
const cryptoPaymentMethodFromUrl = searchParams.get("cryptoPaymentMethod");
|
|
@@ -407,7 +407,7 @@ exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ mode = "modal",
|
|
|
407
407
|
? "Funding Tournament"
|
|
408
408
|
: "Processing Transaction", chainId: order.srcChain, tx: null, isProcessing: true, delay: 0.5 })) : ((0, jsx_runtime_1.jsx)(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
|
|
409
409
|
? `Waiting for payment`
|
|
410
|
-
: `Waiting for deposit ${formattedDepositDeficit} ${srcToken.symbol}`, chainId: order.srcChain, tx: null, isProcessing: true, delay: 0.5 }))] }) })] }) }), depositTxs?.length > 0 && !depositEnoughAmount && order.status === "scanning_deposit_transaction" && ((0, jsx_runtime_1.jsx)(InsufficientDepositPayment_1.InsufficientDepositPayment, { order: order, srcToken: srcToken, depositDeficit: depositDeficit, phantomWalletAddress: phantomWalletAddress, txLoading: txLoading, isSwitchingOrExecuting: isSwitchingOrExecuting, onPayment: handlePayment }))] }));
|
|
410
|
+
: `Waiting for deposit ${formattedDepositDeficit} ${srcToken.symbol}`, chainId: order.srcChain, tx: null, isProcessing: true, delay: 0.5 }))] }) })] }) }), depositTxs?.length > 0 && !depositEnoughAmount && order.status === "scanning_deposit_transaction" && ((0, jsx_runtime_1.jsx)(InsufficientDepositPayment_1.InsufficientDepositPayment, { order: order, srcToken: srcToken, depositDeficit: depositDeficit, phantomWalletAddress: phantomWalletAddress, txLoading: txLoading, isSwitchingOrExecuting: isSwitchingOrExecuting, onPayment: handlePayment })), (0, jsx_runtime_1.jsxs)("button", { className: "text-b3-primary-blue hover:text-b3-primary-blue/50 order-details-cancel-btn flex w-full items-center justify-center gap-2 underline", onClick: handleBack, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.RefreshCcw, { className: "ml-2 h-4 w-4" }), " Cancel and start over"] })] }));
|
|
411
411
|
}
|
|
412
412
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrderStatus_1.OrderStatus, { order: order, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod }), statusDisplay === "processing" && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: order.onrampMetadata ? ((0, jsx_runtime_1.jsx)(PaymentVendorUI_1.default, { order: order, dstTokenSymbol: dstToken.symbol })) : effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.CONNECT_WALLET ||
|
|
413
413
|
effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.GLOBAL_WALLET ? ((0, jsx_runtime_1.jsx)(ConnectWalletPayment_1.default, { order: order, onPayment: handlePayment, onCancel: handleBack, txLoading: txLoading, isSwitchingOrExecuting: isSwitchingOrExecuting, phantomWalletAddress: phantomWalletAddress, tournament: tournament, nft: nft, cryptoPaymentMethod: effectiveCryptoPaymentMethod, onPaymentMethodChange: onPaymentMethodChange })) : effectiveCryptoPaymentMethod === CryptoPaymentMethod_1.CryptoPaymentMethodType.TRANSFER_CRYPTO ? (
|
|
@@ -5,11 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.default = PaymentStripeWeb2;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const payment_utils_1 = require("../../../../shared/utils/payment.utils");
|
|
9
8
|
const react_1 = require("../../../../anyspend/react");
|
|
10
9
|
const react_2 = require("../../../../global-account/react");
|
|
11
10
|
const number_1 = require("../../../../shared/utils/number");
|
|
12
|
-
const
|
|
11
|
+
const payment_utils_1 = require("../../../../shared/utils/payment.utils");
|
|
13
12
|
const react_stripe_js_1 = require("@stripe/react-stripe-js");
|
|
14
13
|
const lucide_react_1 = require("lucide-react");
|
|
15
14
|
const react_3 = require("react");
|
|
@@ -17,7 +16,7 @@ const AnySpendFingerprintWrapper_1 = require("../AnySpendFingerprintWrapper");
|
|
|
17
16
|
const HowItWorks_1 = __importDefault(require("./HowItWorks"));
|
|
18
17
|
const PaymentMethodIcons_1 = __importDefault(require("./PaymentMethodIcons"));
|
|
19
18
|
function PaymentStripeWeb2({ order, stripePaymentIntentId, onPaymentSuccess }) {
|
|
20
|
-
const { theme, stripePublishableKey } = (0, react_2.
|
|
19
|
+
const { theme, stripePublishableKey } = (0, react_2.useB3Config)();
|
|
21
20
|
const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
|
|
22
21
|
const { clientSecret, isLoadingStripeClientSecret, stripeClientSecretError } = (0, react_1.useStripeClientSecret)(stripePaymentIntentId);
|
|
23
22
|
if (isLoadingStripeClientSecret) {
|
|
@@ -59,7 +58,7 @@ function StripePaymentForm({ order, clientSecret, onPaymentSuccess, }) {
|
|
|
59
58
|
try {
|
|
60
59
|
const paymentIntent = await stripe.retrievePaymentIntent(clientSecret);
|
|
61
60
|
const amount = paymentIntent.paymentIntent?.amount
|
|
62
|
-
? (0,
|
|
61
|
+
? (0, payment_utils_1.formatStripeAmount)(paymentIntent.paymentIntent.amount)
|
|
63
62
|
: null;
|
|
64
63
|
setAmount(amount);
|
|
65
64
|
}
|
|
@@ -17,7 +17,7 @@ const useValidatedClientReferenceId_1 = require("./useValidatedClientReferenceId
|
|
|
17
17
|
*/
|
|
18
18
|
function useAnyspendCreateOnrampOrder({ onSuccess, onError } = {}) {
|
|
19
19
|
// Get B3 context values
|
|
20
|
-
const { partnerId } = (0, react_1.
|
|
20
|
+
const { partnerId } = (0, react_1.useB3Config)();
|
|
21
21
|
// Get validated client reference ID from B3 context
|
|
22
22
|
const createValidatedClientReferenceId = (0, useValidatedClientReferenceId_1.useValidatedClientReferenceId)();
|
|
23
23
|
// Get fingerprint data
|
|
@@ -15,7 +15,7 @@ const useValidatedClientReferenceId_1 = require("./useValidatedClientReferenceId
|
|
|
15
15
|
*/
|
|
16
16
|
function useAnyspendCreateOrder({ onSuccess, onError } = {}) {
|
|
17
17
|
// Get B3 context values
|
|
18
|
-
const { partnerId } = (0, react_1.
|
|
18
|
+
const { partnerId } = (0, react_1.useB3Config)();
|
|
19
19
|
// Get validated client reference ID from B3 context
|
|
20
20
|
const createValidatedClientReferenceId = (0, useValidatedClientReferenceId_1.useValidatedClientReferenceId)();
|
|
21
21
|
// Get fingerprint data
|
|
@@ -12,7 +12,7 @@ const react_2 = require("react");
|
|
|
12
12
|
* This order type doesn't require srcAmount - the user deposits tokens after the order is created.
|
|
13
13
|
*/
|
|
14
14
|
function useCreateDepositFirstOrder({ onSuccess, onError } = {}) {
|
|
15
|
-
const { partnerId } = (0, react_1.
|
|
15
|
+
const { partnerId } = (0, react_1.useB3Config)();
|
|
16
16
|
const { data: fpData } = (0, fingerprintjs_pro_react_1.useVisitorData)({ extendedResult: true }, { immediate: true });
|
|
17
17
|
const visitorData = fpData && {
|
|
18
18
|
requestId: fpData.requestId,
|
|
@@ -9,7 +9,7 @@ const react_2 = require("react");
|
|
|
9
9
|
* Gets the createClientReferenceId function from B3 context and validates the result
|
|
10
10
|
*/
|
|
11
11
|
function useValidatedClientReferenceId() {
|
|
12
|
-
const { createClientReferenceId } = (0, react_1.
|
|
12
|
+
const { createClientReferenceId } = (0, react_1.useB3Config)();
|
|
13
13
|
const createValidatedClientReferenceId = (0, react_2.useCallback)(async (params) => {
|
|
14
14
|
// If no function provided, return undefined
|
|
15
15
|
if (!createClientReferenceId) {
|
|
@@ -17,7 +17,6 @@ const framer_motion_1 = require("framer-motion");
|
|
|
17
17
|
const react_3 = require("react");
|
|
18
18
|
const react_4 = require("thirdweb/react");
|
|
19
19
|
const AvatarEditor_1 = require("./AvatarEditor/AvatarEditor");
|
|
20
|
-
const useB3_1 = require("./B3Provider/useB3");
|
|
21
20
|
const Deposit_1 = require("./Deposit/Deposit");
|
|
22
21
|
const LinkAccount_1 = require("./LinkAccount/LinkAccount");
|
|
23
22
|
const LinkNewAccount_1 = require("./LinkAccount/LinkNewAccount");
|
|
@@ -26,8 +25,8 @@ const NotificationsContent_1 = __importDefault(require("./ManageAccount/Notifica
|
|
|
26
25
|
const RequestPermissions_1 = require("./RequestPermissions/RequestPermissions");
|
|
27
26
|
const Send_1 = require("./Send/Send");
|
|
28
27
|
const SignInWithB3Flow_1 = require("./SignInWithB3/SignInWithB3Flow");
|
|
29
|
-
const TurnkeyAuthModal_1 = require("./TurnkeyAuthModal");
|
|
30
28
|
const index_1 = require("./Toast/index");
|
|
29
|
+
const TurnkeyAuthModal_1 = require("./TurnkeyAuthModal");
|
|
31
30
|
const dialog_1 = require("./ui/dialog");
|
|
32
31
|
const drawer_1 = require("./ui/drawer");
|
|
33
32
|
const debug = (0, debug_1.debugB3React)("B3DynamicModal");
|
|
@@ -36,7 +35,7 @@ function B3DynamicModal() {
|
|
|
36
35
|
const setB3ModalOpen = (0, react_2.useModalStore)(state => state.setB3ModalOpen);
|
|
37
36
|
const contentType = (0, react_2.useModalStore)(state => state.contentType);
|
|
38
37
|
const navigateBack = (0, react_2.useModalStore)(state => state.navigateBack);
|
|
39
|
-
const { theme } = (0,
|
|
38
|
+
const { theme } = (0, react_2.useB3Config)();
|
|
40
39
|
const isMobile = (0, react_2.useIsMobile)();
|
|
41
40
|
const prevIsOpenRef = (0, react_3.useRef)(isOpen);
|
|
42
41
|
const { wallet } = (0, react_2.useGlobalAccount)();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const hooks_1 = require("../../hooks");
|
|
4
|
+
const useAutoSelectWallet_1 = require("../../hooks/useAutoSelectWallet");
|
|
5
|
+
const AuthenticationProvider = ({ partnerId, automaticallySetFirstEoa, }) => {
|
|
6
|
+
(0, hooks_1.useAuthentication)(partnerId);
|
|
7
|
+
(0, useAutoSelectWallet_1.useAutoSelectWallet)({
|
|
8
|
+
enabled: automaticallySetFirstEoa,
|
|
9
|
+
});
|
|
10
|
+
return null;
|
|
11
|
+
};
|
|
12
|
+
exports.default = AuthenticationProvider;
|
|
@@ -5,15 +5,14 @@ import "@relayprotocol/relay-kit-ui/styles.css";
|
|
|
5
5
|
import { Account, Wallet } from "thirdweb/wallets";
|
|
6
6
|
import { CreateConnectorFn } from "wagmi";
|
|
7
7
|
import { ClientType } from "../../../client-manager";
|
|
8
|
-
import { B3ContextType } from "./types";
|
|
9
8
|
/**
|
|
10
9
|
* Main B3Provider component
|
|
11
10
|
*/
|
|
12
|
-
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors, createClientReferenceId, enableTurnkey, }: {
|
|
11
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors, createClientReferenceId, enableTurnkey, defaultPermissions, }: {
|
|
13
12
|
theme: "light" | "dark";
|
|
14
13
|
children: React.ReactNode;
|
|
15
14
|
accountOverride?: Account;
|
|
16
|
-
environment
|
|
15
|
+
environment?: "development" | "production";
|
|
17
16
|
automaticallySetFirstEoa?: boolean;
|
|
18
17
|
simDuneApiKey?: string;
|
|
19
18
|
toaster?: {
|
|
@@ -30,20 +29,5 @@ export declare function B3Provider({ theme, children, accountOverride, environme
|
|
|
30
29
|
overrideDefaultConnectors?: boolean;
|
|
31
30
|
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
32
31
|
enableTurnkey?: boolean;
|
|
33
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
34
|
-
/**
|
|
35
|
-
* Inner provider component that provides the actual B3Context
|
|
36
|
-
*/
|
|
37
|
-
export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, stripePublishableKey, createClientReferenceId, enableTurnkey, }: {
|
|
38
|
-
children: React.ReactNode;
|
|
39
|
-
accountOverride?: Account;
|
|
40
|
-
environment: B3ContextType["environment"];
|
|
41
32
|
defaultPermissions?: PermissionsConfig;
|
|
42
|
-
automaticallySetFirstEoa: boolean;
|
|
43
|
-
theme: "light" | "dark";
|
|
44
|
-
clientType?: ClientType;
|
|
45
|
-
partnerId: string;
|
|
46
|
-
stripePublishableKey?: string;
|
|
47
|
-
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
48
|
-
enableTurnkey?: boolean;
|
|
49
33
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.B3Provider = B3Provider;
|
|
4
|
-
exports.InnerProvider = InnerProvider;
|
|
5
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
8
|
const react_1 = require("../../../../global-account/react");
|
|
7
|
-
const useAutoSelectWallet_1 = require("../../../../global-account/react/hooks/useAutoSelectWallet");
|
|
8
9
|
const createWagmiConfig_1 = require("../../../../global-account/react/utils/createWagmiConfig");
|
|
9
10
|
const analytics_1 = require("../../../../global-account/utils/analytics");
|
|
10
11
|
require("@relayprotocol/relay-kit-ui/styles.css");
|
|
@@ -13,19 +14,11 @@ const react_2 = require("react");
|
|
|
13
14
|
const react_3 = require("thirdweb/react");
|
|
14
15
|
const wagmi_1 = require("wagmi");
|
|
15
16
|
const client_manager_1 = require("../../../client-manager");
|
|
17
|
+
const configStore_1 = require("../../stores/configStore");
|
|
16
18
|
const StyleRoot_1 = require("../StyleRoot");
|
|
17
19
|
const index_1 = require("../Toast/index");
|
|
20
|
+
const AuthenticationProvider_1 = __importDefault(require("./AuthenticationProvider"));
|
|
18
21
|
const LocalSDKProvider_1 = require("./LocalSDKProvider");
|
|
19
|
-
const types_1 = require("./types");
|
|
20
|
-
/**
|
|
21
|
-
* Default permissions configuration for B3 provider
|
|
22
|
-
*/
|
|
23
|
-
const DEFAULT_PERMISSIONS = {
|
|
24
|
-
approvedTargets: ["0xa8e42121e318e3D3BeD7f5969AF6D360045317DD"], // Example contract
|
|
25
|
-
nativeTokenLimitPerTransaction: 0.1, // in ETH
|
|
26
|
-
startDate: new Date(),
|
|
27
|
-
endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
|
|
28
|
-
};
|
|
29
22
|
// Create queryClient instance
|
|
30
23
|
const queryClient = new react_query_1.QueryClient();
|
|
31
24
|
/**
|
|
@@ -33,7 +26,23 @@ const queryClient = new react_query_1.QueryClient();
|
|
|
33
26
|
*/
|
|
34
27
|
function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey,
|
|
35
28
|
// deprecated since v0.0.87
|
|
36
|
-
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors = false, createClientReferenceId, enableTurnkey = false, }) {
|
|
29
|
+
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors = false, createClientReferenceId, enableTurnkey = false, defaultPermissions, }) {
|
|
30
|
+
const setConfig = (0, configStore_1.useB3ConfigStore)(state => state.setConfig);
|
|
31
|
+
// Initialize config store on mount - props are static and never change
|
|
32
|
+
(0, react_2.useEffect)(() => {
|
|
33
|
+
setConfig({
|
|
34
|
+
accountOverride,
|
|
35
|
+
environment: environment ?? "development",
|
|
36
|
+
automaticallySetFirstEoa: !!automaticallySetFirstEoa,
|
|
37
|
+
theme,
|
|
38
|
+
clientType,
|
|
39
|
+
partnerId,
|
|
40
|
+
stripePublishableKey,
|
|
41
|
+
createClientReferenceId,
|
|
42
|
+
enableTurnkey,
|
|
43
|
+
defaultPermissions,
|
|
44
|
+
});
|
|
45
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
37
46
|
// Initialize Google Analytics on mount
|
|
38
47
|
(0, react_2.useEffect)(() => {
|
|
39
48
|
(0, analytics_1.loadGA4Script)();
|
|
@@ -43,50 +52,7 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey
|
|
|
43
52
|
(0, client_manager_1.setClientType)(clientType);
|
|
44
53
|
}, [clientType]);
|
|
45
54
|
const wagmiConfig = (0, react_2.useMemo)(() => (0, createWagmiConfig_1.createWagmiConfig)({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }), [partnerId, rpcUrls, connectors, overrideDefaultConnectors]);
|
|
46
|
-
return ((0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(index_1.ToastProvider, { children: (0, jsx_runtime_1.
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Inner provider component that provides the actual B3Context
|
|
50
|
-
*/
|
|
51
|
-
function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa, theme = "light", clientType = "socket", partnerId, stripePublishableKey, createClientReferenceId, enableTurnkey, }) {
|
|
52
|
-
const activeAccount = (0, react_3.useActiveAccount)();
|
|
53
|
-
const isAuthenticated = (0, react_1.useAuthStore)(state => state.isAuthenticated);
|
|
54
|
-
//const isConnected = useAuthStore(state => state.isConnected);
|
|
55
|
-
//const justCompletedLogin = useAuthStore(state => state.justCompletedLogin);
|
|
56
|
-
// Note: This fixes a bug where useAuthentication is no longer rendered on every page, as of this PR https://github.com/b3-fun/b3/pull/385/files#diff-3ef996931b8fc8e49021ba1b42ddaa97535214681610dc5fdacf63542e261af7
|
|
57
|
-
// The above PR removes useAuthentication from the overall B3Provider. useAuthentication should be everywhere the provider is, since it sets the overall auth state
|
|
58
|
-
// By just calling it manually, we fix that issue
|
|
59
|
-
// As a follow up, we should fix the SDK directly
|
|
60
|
-
(0, react_1.useAuthentication)(partnerId);
|
|
61
|
-
// Use given accountOverride or activeAccount from thirdweb
|
|
62
|
-
// WOJ: why if isAuthenticated is false, we don't use activeAccount, which should be undefined?
|
|
63
|
-
// skip isAuthenticated check ?
|
|
64
|
-
const effectiveAccount = isAuthenticated ? accountOverride || activeAccount : undefined;
|
|
65
|
-
// Wrapper to set active wallet via thirdweb
|
|
66
|
-
// Note: `wallet` in context is deprecated - use useActiveWallet() from thirdweb/react instead
|
|
67
|
-
// Auto-select first EOA wallet when enabled
|
|
68
|
-
(0, useAutoSelectWallet_1.useAutoSelectWallet)({
|
|
69
|
-
enabled: automaticallySetFirstEoa,
|
|
70
|
-
});
|
|
71
|
-
return ((0, jsx_runtime_1.jsx)(types_1.B3Context.Provider, { value: {
|
|
72
|
-
account: effectiveAccount,
|
|
73
|
-
// setWallet,
|
|
74
|
-
//wallet: undefined, // Deprecated: use useActiveWallet() from thirdweb/react instead
|
|
75
|
-
//user,
|
|
76
|
-
//setUser,
|
|
77
|
-
//refetchUser,
|
|
78
|
-
initialized: true,
|
|
79
|
-
ready: !!effectiveAccount,
|
|
80
|
-
automaticallySetFirstEoa,
|
|
81
|
-
environment,
|
|
82
|
-
defaultPermissions,
|
|
83
|
-
theme,
|
|
84
|
-
clientType,
|
|
85
|
-
partnerId: partnerId,
|
|
86
|
-
stripePublishableKey,
|
|
87
|
-
createClientReferenceId,
|
|
88
|
-
enableTurnkey,
|
|
89
|
-
}, children: children }));
|
|
55
|
+
return ((0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(index_1.ToastProvider, { children: (0, jsx_runtime_1.jsxs)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, children: [(0, jsx_runtime_1.jsx)(ToastContextConnector, {}), (0, jsx_runtime_1.jsxs)(react_1.RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, (0, jsx_runtime_1.jsx)(StyleRoot_1.StyleRoot, { id: "b3-root" })] }), (0, jsx_runtime_1.jsx)(AuthenticationProvider_1.default, { partnerId: partnerId, automaticallySetFirstEoa: !!automaticallySetFirstEoa })] }) }) }) }) }) }));
|
|
90
56
|
}
|
|
91
57
|
/**
|
|
92
58
|
* Component to connect the toast context to the global toast API
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { PermissionsConfig } from "../../../../global-account/types/permissions";
|
|
2
2
|
import { Account, Wallet } from "thirdweb/wallets";
|
|
3
3
|
import { ClientType } from "../../../client-manager";
|
|
4
|
-
import { B3ContextType } from "./types";
|
|
5
4
|
/**
|
|
6
5
|
* Main B3Provider component
|
|
7
6
|
*/
|
|
8
|
-
export declare function B3Provider({ theme, children, accountOverride, environment, clientType, partnerId, rpcUrls, onConnect, }: {
|
|
7
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, clientType, partnerId, rpcUrls, onConnect, defaultPermissions, }: {
|
|
9
8
|
theme: "light" | "dark";
|
|
10
9
|
children: React.ReactNode;
|
|
11
10
|
accountOverride?: Account;
|
|
12
|
-
environment
|
|
11
|
+
environment?: "development" | "production";
|
|
13
12
|
clientType?: ClientType;
|
|
14
13
|
partnerId: string;
|
|
15
14
|
rpcUrls?: Record<number, string>;
|
|
16
15
|
onConnect?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
|
|
16
|
+
defaultPermissions?: PermissionsConfig;
|
|
17
17
|
}): import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
/**
|
|
19
|
-
* Inner provider component
|
|
19
|
+
* Inner provider component for native
|
|
20
20
|
*/
|
|
21
21
|
export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, theme, clientType, partnerId, rpcUrls, }: {
|
|
22
22
|
children: React.ReactNode;
|
|
23
23
|
accountOverride?: Account;
|
|
24
|
-
environment
|
|
24
|
+
environment?: "development" | "production";
|
|
25
25
|
defaultPermissions?: PermissionsConfig;
|
|
26
26
|
theme: "light" | "dark";
|
|
27
27
|
clientType?: ClientType;
|
|
@@ -1,54 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.B3Provider = B3Provider;
|
|
4
7
|
exports.InnerProvider = InnerProvider;
|
|
5
8
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
9
|
const react_query_1 = require("@tanstack/react-query");
|
|
7
|
-
const react_1 = require("
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const react_2 = require("thirdweb/react");
|
|
8
12
|
const wagmi_1 = require("wagmi");
|
|
13
|
+
const configStore_1 = require("../../stores/configStore");
|
|
9
14
|
const createWagmiConfig_1 = require("../../utils/createWagmiConfig");
|
|
15
|
+
const AuthenticationProvider_1 = __importDefault(require("./AuthenticationProvider"));
|
|
10
16
|
const LocalSDKProvider_1 = require("./LocalSDKProvider");
|
|
11
|
-
const types_1 = require("./types");
|
|
12
|
-
/**
|
|
13
|
-
* Default permissions configuration for B3 provider
|
|
14
|
-
*/
|
|
15
|
-
const DEFAULT_PERMISSIONS = {
|
|
16
|
-
approvedTargets: ["0xa8e42121e318e3D3BeD7f5969AF6D360045317DD"], // Example contract
|
|
17
|
-
nativeTokenLimitPerTransaction: 0.1, // in ETH
|
|
18
|
-
startDate: new Date(),
|
|
19
|
-
endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
|
|
20
|
-
};
|
|
21
17
|
// Create queryClient instance
|
|
22
18
|
const queryClient = new react_query_1.QueryClient();
|
|
23
19
|
/**
|
|
24
20
|
* Main B3Provider component
|
|
25
21
|
*/
|
|
26
|
-
function B3Provider({ theme = "light", children, accountOverride, environment, clientType = "socket", partnerId, rpcUrls, onConnect, }) {
|
|
27
|
-
|
|
22
|
+
function B3Provider({ theme = "light", children, accountOverride, environment, clientType = "socket", partnerId, rpcUrls, onConnect, defaultPermissions, }) {
|
|
23
|
+
const setConfig = (0, configStore_1.useB3ConfigStore)(state => state.setConfig);
|
|
24
|
+
// Initialize config store on mount - props are static and never change
|
|
25
|
+
(0, react_1.useEffect)(() => {
|
|
26
|
+
setConfig({
|
|
27
|
+
accountOverride,
|
|
28
|
+
environment: environment ?? "development",
|
|
29
|
+
automaticallySetFirstEoa: false,
|
|
30
|
+
theme,
|
|
31
|
+
clientType,
|
|
32
|
+
partnerId,
|
|
33
|
+
defaultPermissions,
|
|
34
|
+
});
|
|
35
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(react_2.ThirdwebProvider, { children: (0, jsx_runtime_1.jsxs)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, children: [children, (0, jsx_runtime_1.jsx)(AuthenticationProvider_1.default, { partnerId: partnerId, automaticallySetFirstEoa: false })] }) }));
|
|
28
37
|
}
|
|
29
38
|
/**
|
|
30
|
-
* Inner provider component
|
|
39
|
+
* Inner provider component for native
|
|
31
40
|
*/
|
|
32
|
-
function InnerProvider({ children, accountOverride, environment, defaultPermissions
|
|
33
|
-
const
|
|
34
|
-
//const { user, setUser, refetchUser } = useAuthentication(partnerId);
|
|
41
|
+
function InnerProvider({ children, accountOverride, environment, defaultPermissions, theme = "light", clientType = "socket", partnerId, rpcUrls, }) {
|
|
42
|
+
const setConfig = (0, configStore_1.useB3ConfigStore)(state => state.setConfig);
|
|
35
43
|
const wagmiConfig = (0, createWagmiConfig_1.createWagmiConfig)({ partnerId, rpcUrls });
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
theme,
|
|
50
|
-
clientType,
|
|
51
|
-
partnerId,
|
|
52
|
-
//refetchUser,
|
|
53
|
-
}, children: children }) }) }));
|
|
44
|
+
// Initialize config store on mount - props are static and never change
|
|
45
|
+
(0, react_1.useEffect)(() => {
|
|
46
|
+
setConfig({
|
|
47
|
+
accountOverride,
|
|
48
|
+
environment: environment ?? "development",
|
|
49
|
+
automaticallySetFirstEoa: false,
|
|
50
|
+
theme,
|
|
51
|
+
clientType,
|
|
52
|
+
partnerId,
|
|
53
|
+
defaultPermissions,
|
|
54
|
+
});
|
|
55
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: children }) }));
|
|
54
57
|
}
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Hook to access the B3
|
|
3
|
-
* @
|
|
4
|
-
* @deprecated Use useB3Config or useB3Account instead
|
|
2
|
+
* Hook to access the B3 configuration
|
|
3
|
+
* @deprecated This is just an alias for useB3Config. Use useB3Config directly instead.
|
|
5
4
|
*/
|
|
6
|
-
export declare function useB3():
|
|
5
|
+
export declare function useB3(): {
|
|
6
|
+
automaticallySetFirstEoa: boolean;
|
|
7
|
+
environment: "development" | "production";
|
|
8
|
+
theme: "light" | "dark";
|
|
9
|
+
clientType: import("../../../client-manager").ClientType;
|
|
10
|
+
partnerId: string;
|
|
11
|
+
createClientReferenceId: ((params: import("../../../../anyspend/react").CreateOrderParams | import("../../../../anyspend/react").CreateOnrampOrderParams) => Promise<string>) | undefined;
|
|
12
|
+
enableTurnkey: boolean;
|
|
13
|
+
stripePublishableKey: string | undefined;
|
|
14
|
+
defaultPermissions: import("../../../types/permissions").PermissionsConfig;
|
|
15
|
+
accountOverride: import("thirdweb/wallets").Account | undefined;
|
|
16
|
+
};
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useB3 = useB3;
|
|
4
|
-
const
|
|
5
|
-
const types_1 = require("./types");
|
|
4
|
+
const useB3Config_1 = require("./useB3Config");
|
|
6
5
|
/**
|
|
7
|
-
* Hook to access the B3
|
|
8
|
-
* @
|
|
9
|
-
* @deprecated Use useB3Config or useB3Account instead
|
|
6
|
+
* Hook to access the B3 configuration
|
|
7
|
+
* @deprecated This is just an alias for useB3Config. Use useB3Config directly instead.
|
|
10
8
|
*/
|
|
11
9
|
function useB3() {
|
|
12
|
-
|
|
13
|
-
if (!context.initialized) {
|
|
14
|
-
throw new Error("useB3 must be used within a B3Provider");
|
|
15
|
-
}
|
|
16
|
-
// Return a stable reference
|
|
17
|
-
return (0, react_1.useMemo)(() => context, [context]);
|
|
10
|
+
return (0, useB3Config_1.useB3Config)();
|
|
18
11
|
}
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useB3Account = void 0;
|
|
4
4
|
const react_1 = require("thirdweb/react");
|
|
5
|
+
const useAuthStore_1 = require("../../stores/useAuthStore");
|
|
5
6
|
// Wrapper around useActiveAccount
|
|
6
7
|
const useB3Account = () => {
|
|
7
|
-
const
|
|
8
|
-
|
|
8
|
+
const isAuthenticated = (0, useAuthStore_1.useAuthStore)(state => state.isAuthenticated);
|
|
9
|
+
const activeAccount = (0, react_1.useActiveAccount)();
|
|
10
|
+
const effectiveAccount = isAuthenticated ? activeAccount : undefined;
|
|
11
|
+
return effectiveAccount;
|
|
9
12
|
};
|
|
10
13
|
exports.useB3Account = useB3Account;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to access B3 configuration
|
|
3
|
+
* Returns all config values from the Zustand store
|
|
4
|
+
* Since config is static (set once at initialization), destructuring is fine here
|
|
5
|
+
*/
|
|
1
6
|
export declare const useB3Config: () => {
|
|
2
7
|
automaticallySetFirstEoa: boolean;
|
|
3
|
-
environment: "development" | "production"
|
|
8
|
+
environment: "development" | "production";
|
|
4
9
|
theme: "light" | "dark";
|
|
5
10
|
clientType: import("../../../client-manager").ClientType;
|
|
6
11
|
partnerId: string;
|
|
7
12
|
createClientReferenceId: ((params: import("../../../../anyspend/react").CreateOrderParams | import("../../../../anyspend/react").CreateOnrampOrderParams) => Promise<string>) | undefined;
|
|
8
|
-
enableTurnkey: boolean
|
|
13
|
+
enableTurnkey: boolean;
|
|
14
|
+
stripePublishableKey: string | undefined;
|
|
15
|
+
defaultPermissions: import("../../../types/permissions").PermissionsConfig;
|
|
16
|
+
accountOverride: import("thirdweb/wallets").Account | undefined;
|
|
9
17
|
};
|