@b3dotfun/sdk 0.0.40-test.3 → 0.0.40
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/constants/index.d.ts +0 -1
- package/dist/cjs/anyspend/constants/index.js +1 -2
- package/dist/cjs/anyspend/react/components/AnySpend.js +5 -6
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +8 -9
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +4 -5
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +3 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +23 -19
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +9 -8
- package/dist/cjs/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
- package/dist/cjs/anyspend/react/components/common/PaymentMethodSwitch.js +24 -0
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +6 -4
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +3 -3
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +8 -27
- package/dist/esm/anyspend/constants/index.d.ts +0 -1
- package/dist/esm/anyspend/constants/index.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +6 -7
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +8 -9
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +5 -6
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
- package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +3 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +24 -20
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +10 -9
- package/dist/esm/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
- package/dist/esm/anyspend/react/components/common/PaymentMethodSwitch.js +21 -0
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +6 -4
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +3 -3
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +7 -27
- package/dist/types/anyspend/constants/index.d.ts +0 -1
- package/dist/types/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
- package/dist/types/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +3 -3
- package/package.json +4 -5
- package/src/anyspend/constants/index.ts +0 -2
- package/src/anyspend/react/components/AnySpend.tsx +15 -17
- package/src/anyspend/react/components/AnySpendCustom.tsx +19 -21
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +16 -18
- package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +5 -0
- package/src/anyspend/react/components/common/OrderDetails.tsx +60 -43
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +62 -41
- package/src/anyspend/react/components/common/PaymentMethodSwitch.tsx +38 -0
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +65 -43
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +9 -35
- package/dist/cjs/global-account/examples/client-selection-example.d.ts +0 -5
- package/dist/cjs/global-account/examples/client-selection-example.js +0 -96
- package/dist/esm/global-account/examples/client-selection-example.d.ts +0 -5
- package/dist/esm/global-account/examples/client-selection-example.js +0 -93
- package/dist/types/global-account/examples/client-selection-example.d.ts +0 -5
- package/src/global-account/docs/client-selection.md +0 -292
- package/src/global-account/examples/client-selection-example.tsx +0 -197
|
@@ -10,8 +10,10 @@ import { QRCodeSVG } from "qrcode.react";
|
|
|
10
10
|
import { memo, useEffect, useMemo, useState } from "react";
|
|
11
11
|
import { toast } from "sonner";
|
|
12
12
|
import { b3 } from "viem/chains";
|
|
13
|
+
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod.js";
|
|
13
14
|
import { OrderDetailsCollapsible } from "./OrderDetailsCollapsible.js";
|
|
14
|
-
|
|
15
|
+
import { PaymentMethodSwitch } from "./PaymentMethodSwitch.js";
|
|
16
|
+
export const TransferCryptoDetails = memo(function TransferCryptoDetails({ order, srcToken, dstToken, tournament, nft, onBack, recipientName, onPaymentMethodChange, }) {
|
|
15
17
|
const [timeLeft, setTimeLeft] = useState(0);
|
|
16
18
|
useEffect(() => {
|
|
17
19
|
const calculateTimeLeft = () => {
|
|
@@ -62,9 +64,9 @@ export const TransferCryptoDetails = memo(function TransferCryptoDetails({ order
|
|
|
62
64
|
navigator.clipboard.writeText(order.globalAddress);
|
|
63
65
|
toast.success("Deposit address copied to clipboard");
|
|
64
66
|
};
|
|
65
|
-
return (_jsxs("div", { className: "flex w-full flex-col gap-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("button", { onClick: onBack, className: "text-as-primary/60 hover:text-as-primary flex h-10 w-10 items-center justify-center rounded-full transition-colors", children: _jsx(ChevronLeft, { size: 24, className: "text-as-quaternary" }) }), _jsx("h2", { className: "text-as-primary text-lg font-semibold", children: "Transfer crypto" }), _jsxs("div", { className: "relative flex h-11 w-11 items-center justify-center", children: [_jsxs("svg", { className: "h-11 w-11 -rotate-90", viewBox: "0 0 44 44", children: [_jsx("circle", { cx: "22", cy: "22", r: "18", stroke: "currentColor", strokeWidth: "3", fill: "none", className: "text-gray-200" }), _jsx("circle", { cx: "22", cy: "22", r: "18", stroke: "currentColor", strokeWidth: "3", fill: "none", strokeLinecap: "round", className: "text-blue-500", strokeDasharray: `${2 * Math.PI * 18}`, strokeDashoffset: `${2 * Math.PI * 18 * (1 - timeLeft / totalTime)}`, style: {
|
|
67
|
+
return (_jsxs("div", { className: "order-transfer-crypto flex w-full flex-col gap-6", children: [_jsxs("div", { className: "order-transfer-crypto-header flex items-center justify-between", children: [_jsx("button", { onClick: onBack, className: "order-transfer-crypto-back-btn text-as-primary/60 hover:text-as-primary flex h-10 w-10 items-center justify-center rounded-full transition-colors", children: _jsx(ChevronLeft, { size: 24, className: "text-as-quaternary" }) }), _jsx("h2", { className: "order-transfer-crypto-title text-as-primary text-lg font-semibold", children: "Transfer crypto" }), _jsxs("div", { className: "order-transfer-crypto-timer relative flex h-11 w-11 items-center justify-center", children: [_jsxs("svg", { className: "order-transfer-crypto-timer-svg h-11 w-11 -rotate-90", viewBox: "0 0 44 44", children: [_jsx("circle", { cx: "22", cy: "22", r: "18", stroke: "currentColor", strokeWidth: "3", fill: "none", className: "order-transfer-crypto-timer-bg text-gray-200" }), _jsx("circle", { cx: "22", cy: "22", r: "18", stroke: "currentColor", strokeWidth: "3", fill: "none", strokeLinecap: "round", className: "order-transfer-crypto-timer-progress text-blue-500", strokeDasharray: `${2 * Math.PI * 18}`, strokeDashoffset: `${2 * Math.PI * 18 * (1 - timeLeft / totalTime)}`, style: {
|
|
66
68
|
transition: "stroke-dashoffset 1s linear",
|
|
67
|
-
} })] }), _jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: _jsx("span", { className: "text-as-primary text-[10px] font-semibold", children: formatTime(timeLeft) }) })] })] }), _jsxs("div", { className: "flex w-full flex-col gap-4", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsxs("div", { className: "w-full", children: [_jsx("span", { className: "text-as-content-secondary text-sm font-medium", children: "Amount" }), _jsx("div", { className: "border-as-border-primary rounded-lg border p-2 shadow-sm", children: _jsx(CopyToClipboard, { text: roundedUpSrcAmount || "", onCopy: () => {
|
|
69
|
+
} })] }), _jsx("div", { className: "order-transfer-crypto-timer-text absolute inset-0 flex items-center justify-center", children: _jsx("span", { className: "text-as-primary text-[10px] font-semibold", children: formatTime(timeLeft) }) })] })] }), _jsxs("div", { className: "order-transfer-crypto-content flex w-full flex-col gap-4", children: [_jsxs("div", { className: "order-transfer-crypto-cards flex items-center gap-4", children: [_jsxs("div", { className: "order-transfer-crypto-amount-card w-full", children: [_jsx("span", { className: "order-transfer-crypto-amount-label text-as-content-secondary text-sm font-medium", children: "Amount" }), _jsx("div", { className: "order-transfer-crypto-amount-container border-as-border-primary rounded-lg border p-2 shadow-sm", children: _jsx(CopyToClipboard, { text: roundedUpSrcAmount || "", onCopy: () => {
|
|
68
70
|
toast.success("Amount copied to clipboard");
|
|
69
|
-
}, children: _jsxs("div", { className: "flex cursor-pointer items-center justify-between gap-2", children: [_jsxs("strong", { className: "text-as-primary font-semibold", children: [roundedUpSrcAmount, " ", srcToken.symbol] }), _jsx(Copy, { className: "text-as-primary/50 hover:text-as-primary h-4 w-4 transition-all duration-200" })] }) }) })] }), _jsxs("div", { className: "w-full", children: [_jsx("span", { className: "text-as-content-secondary text-sm font-medium", children: "Chain" }), _jsx("div", { className: "border-as-border-primary rounded-lg border p-2 shadow-sm", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("img", { src: ALL_CHAINS[order.srcChain].logoUrl, alt: getChainName(order.srcChain), className: cn("h-6 rounded-full", order.srcChain === b3.id && "h-5 rounded-none") }), _jsx("span", { className: "text-as-primary text-sm font-semibold", children: getChainName(order.srcChain) })] }) })] })] }), _jsxs("div", { className: "border-b3-react-border bg-as-surface-secondary grid h-[220px] grid-cols-2 overflow-hidden rounded-xl border", children: [_jsx("div", { className: "border-as-border-primary h-full w-full border-r", children: _jsx("div", { className: "flex justify-center", children: _jsxs("div", { className: "bg-as-surface-secondary flex flex-col items-center rounded-lg p-6", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === RELAY_ETH_ADDRESS ? "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "bg-as-surface-secondary max-h-48 max-w-48" }), _jsxs("div", { className: "mt-3 flex items-center justify-center gap-2 text-sm", children: [_jsx("span", { className: "text-as-brand/70 text-sm font-medium", children: "SCAN WITH" }), _jsxs(TextLoop, { interval: 3, children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }) }), _jsxs("div", { className: "flex h-full w-full flex-col gap-2 p-6", children: [_jsx("span", { className: "text-as-content-secondary text-sm font-medium", children: "Deposit address:" }), _jsxs("div", { className: "flex h-full cursor-pointer flex-col items-stretch justify-between gap-4", onClick: handleCopyAddress, children: [_jsx("div", { className: "text-as-primary break-all font-mono text-sm font-semibold leading-relaxed", children: order.globalAddress }), _jsx("div", { className: "place-self-end", children: _jsx(Copy, { className: "group-hover:text-as-brand text-as-tertiarry h-4 w-4 cursor-pointer transition-all duration-200" }) })] })] })] }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount })] }),
|
|
71
|
+
}, children: _jsxs("div", { className: "order-transfer-crypto-amount-copy flex cursor-pointer items-center justify-between gap-2", children: [_jsxs("strong", { className: "order-transfer-crypto-amount-text text-as-primary font-semibold", children: [roundedUpSrcAmount, " ", srcToken.symbol] }), _jsx(Copy, { className: "order-transfer-crypto-amount-copy-icon text-as-primary/50 hover:text-as-primary h-4 w-4 transition-all duration-200" })] }) }) })] }), _jsxs("div", { className: "order-transfer-crypto-chain-card w-full", children: [_jsx("span", { className: "order-transfer-crypto-chain-label text-as-content-secondary text-sm font-medium", children: "Chain" }), _jsx("div", { className: "order-transfer-crypto-chain-container border-as-border-primary rounded-lg border p-2 shadow-sm", children: _jsxs("div", { className: "order-transfer-crypto-chain-info flex items-center gap-2", children: [_jsx("img", { src: ALL_CHAINS[order.srcChain].logoUrl, alt: getChainName(order.srcChain), className: cn("order-transfer-crypto-chain-logo h-6 rounded-full", order.srcChain === b3.id && "h-5 rounded-none") }), _jsx("span", { className: "order-transfer-crypto-chain-name text-as-primary text-sm font-semibold", children: getChainName(order.srcChain) })] }) })] })] }), _jsxs("div", { className: "order-transfer-crypto-qr-deposit-card border-b3-react-border bg-as-surface-secondary grid h-[220px] grid-cols-2 overflow-hidden rounded-xl border", children: [_jsx("div", { className: "order-transfer-crypto-qr-section border-as-border-primary h-full w-full border-r", children: _jsx("div", { className: "order-transfer-crypto-qr-wrapper flex justify-center", children: _jsxs("div", { className: "order-transfer-crypto-qr-container bg-as-surface-secondary flex flex-col items-center rounded-lg p-6", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === RELAY_ETH_ADDRESS ? "ETH" : order.srcTokenAddress, order.srcChain, srcToken?.decimals), className: "order-transfer-crypto-qr-code bg-as-surface-secondary max-h-48 max-w-48" }), _jsxs("div", { className: "order-transfer-crypto-wallet-hint mt-3 flex items-center justify-center gap-2 text-sm", children: [_jsx("span", { className: "order-transfer-crypto-wallet-text text-as-brand/70 text-sm font-medium", children: "SCAN WITH" }), _jsxs(TextLoop, { interval: 3, children: [_jsx(WalletMetamask, { className: "order-transfer-crypto-wallet-icon h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "order-transfer-crypto-wallet-icon h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "order-transfer-crypto-wallet-icon h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "order-transfer-crypto-wallet-icon h-5 w-5", variant: "branded" })] })] })] }) }) }), _jsxs("div", { className: "order-transfer-crypto-address-section flex h-full w-full flex-col gap-2 p-6", children: [_jsx("span", { className: "order-transfer-crypto-address-label text-as-content-secondary text-sm font-medium", children: "Deposit address:" }), _jsxs("div", { className: "order-transfer-crypto-address-copy flex h-full cursor-pointer flex-col items-stretch justify-between gap-4", onClick: handleCopyAddress, children: [_jsx("div", { className: "order-transfer-crypto-address-text text-as-primary break-all font-mono text-sm font-semibold leading-relaxed", children: order.globalAddress }), _jsx("div", { className: "order-transfer-crypto-address-copy-icon-wrapper place-self-end", children: _jsx(Copy, { className: "order-transfer-crypto-address-copy-icon group-hover:text-as-brand text-as-tertiarry h-4 w-4 cursor-pointer transition-all duration-200" }) })] })] })] }), _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount })] }), _jsxs("div", { className: "order-transfer-crypto-actions flex flex-col gap-3", children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "order-transfer-crypto-copy-btn w-full py-3", onClick: handleCopyAddress, children: "Copy deposit address" }), _jsx(PaymentMethodSwitch, { currentMethod: CryptoPaymentMethodType.TRANSFER_CRYPTO, onMethodChange: onPaymentMethodChange })] })] }));
|
|
70
72
|
});
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { PermissionsConfig } from "../../../../global-account/types/permissions";
|
|
2
|
-
import "@reservoir0x/relay-kit-ui/styles.css";
|
|
3
2
|
import { Account } from "thirdweb/wallets";
|
|
4
3
|
import { ClientType } from "../../../client-manager";
|
|
5
4
|
import { B3ContextType } from "./types";
|
|
5
|
+
import "@reservoir0x/relay-kit-ui/styles.css";
|
|
6
|
+
export declare const wagmiConfig: import("wagmi").Config<readonly [import("viem").Chain, ...import("viem").Chain[]], any, readonly import("wagmi").CreateConnectorFn[]>;
|
|
6
7
|
/**
|
|
7
8
|
* Main B3Provider component
|
|
8
9
|
*/
|
|
9
|
-
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType,
|
|
10
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, }: {
|
|
10
11
|
theme: "light" | "dark";
|
|
11
12
|
children: React.ReactNode;
|
|
12
13
|
accountOverride?: Account;
|
|
@@ -18,7 +19,6 @@ export declare function B3Provider({ theme, children, accountOverride, environme
|
|
|
18
19
|
style?: React.CSSProperties;
|
|
19
20
|
};
|
|
20
21
|
clientType?: ClientType;
|
|
21
|
-
partnerId?: string;
|
|
22
22
|
}): import("react/jsx-runtime").JSX.Element;
|
|
23
23
|
/**
|
|
24
24
|
* Inner provider component that provides the actual B3Context
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { RelayKitProviderWrapper, TooltipProvider, useAuthStore } from "../../../../global-account/react/index.js";
|
|
3
3
|
import { loadGA4Script } from "../../../../global-account/utils/analytics.js";
|
|
4
|
-
import { ecosystemWalletId } from "../../../../shared/constants/index.js";
|
|
5
4
|
import { supportedChains } from "../../../../shared/constants/chains/supported.js";
|
|
6
|
-
import { client } from "../../../../shared/utils/thirdweb.js";
|
|
7
|
-
import "@reservoir0x/relay-kit-ui/styles.css";
|
|
8
5
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
9
|
-
import {
|
|
10
|
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
6
|
+
import { useCallback, useEffect, useState } from "react";
|
|
11
7
|
import { Toaster } from "sonner";
|
|
12
8
|
import { getLastAuthProvider, ThirdwebProvider, useActiveAccount, useConnectedWallets, useSetActiveWallet, } from "thirdweb/react";
|
|
13
9
|
import { createConfig, http, WagmiProvider } from "wagmi";
|
|
14
10
|
import { setClientType } from "../../../client-manager.js";
|
|
15
11
|
import { StyleRoot } from "../StyleRoot.js";
|
|
16
12
|
import { B3Context } from "./types.js";
|
|
13
|
+
import "@reservoir0x/relay-kit-ui/styles.css";
|
|
17
14
|
/**
|
|
18
15
|
* Default permissions configuration for B3 provider
|
|
19
16
|
*/
|
|
@@ -23,12 +20,16 @@ const DEFAULT_PERMISSIONS = {
|
|
|
23
20
|
startDate: new Date(),
|
|
24
21
|
endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
|
|
25
22
|
};
|
|
23
|
+
export const wagmiConfig = createConfig({
|
|
24
|
+
chains: [supportedChains[0], ...supportedChains.slice(1)],
|
|
25
|
+
transports: Object.fromEntries(supportedChains.map(chain => [chain.id, http()])),
|
|
26
|
+
});
|
|
26
27
|
// Create queryClient instance
|
|
27
28
|
const queryClient = new QueryClient();
|
|
28
29
|
/**
|
|
29
30
|
* Main B3Provider component
|
|
30
31
|
*/
|
|
31
|
-
export function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType = "rest",
|
|
32
|
+
export function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType = "rest", }) {
|
|
32
33
|
// Initialize Google Analytics on mount
|
|
33
34
|
useEffect(() => {
|
|
34
35
|
loadGA4Script();
|
|
@@ -37,27 +38,6 @@ export function B3Provider({ theme = "light", children, accountOverride, environ
|
|
|
37
38
|
useEffect(() => {
|
|
38
39
|
setClientType(clientType);
|
|
39
40
|
}, [clientType]);
|
|
40
|
-
const ecocystemConfig = useMemo(() => {
|
|
41
|
-
if (!partnerId)
|
|
42
|
-
return undefined;
|
|
43
|
-
return {
|
|
44
|
-
ecosystemId: ecosystemWalletId,
|
|
45
|
-
partnerId: partnerId,
|
|
46
|
-
client,
|
|
47
|
-
};
|
|
48
|
-
}, [partnerId]);
|
|
49
|
-
const wagmiConfig = useMemo(() => createConfig({
|
|
50
|
-
chains: [supportedChains[0], ...supportedChains.slice(1)],
|
|
51
|
-
transports: Object.fromEntries(supportedChains.map(chain => [chain.id, http()])),
|
|
52
|
-
connectors: [
|
|
53
|
-
inAppWalletConnector({
|
|
54
|
-
...ecocystemConfig,
|
|
55
|
-
client,
|
|
56
|
-
}),
|
|
57
|
-
// injected(),
|
|
58
|
-
// coinbaseWallet({ appName: "HypeDuel" }),
|
|
59
|
-
],
|
|
60
|
-
}), [partnerId]);
|
|
61
41
|
return (_jsx(WagmiProvider, { config: wagmiConfig, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(ThirdwebProvider, { children: _jsx(TooltipProvider, { children: _jsx(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, children: _jsxs(RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, _jsx(StyleRoot, { id: "b3-root" }), _jsx(Toaster, { theme: theme, position: toaster?.position, style: toaster?.style })] }) }) }) }) }) }));
|
|
62
42
|
}
|
|
63
43
|
/**
|
|
@@ -12,6 +12,7 @@ interface ConnectWalletPaymentProps {
|
|
|
12
12
|
tournament?: Tournament;
|
|
13
13
|
nft?: NFT;
|
|
14
14
|
cryptoPaymentMethod: CryptoPaymentMethodType;
|
|
15
|
+
onPaymentMethodChange?: (method: CryptoPaymentMethodType) => void;
|
|
15
16
|
}
|
|
16
|
-
export default function ConnectWalletPayment({ order, onPayment, txLoading, isSwitchingOrExecuting, phantomWalletAddress, tournament, nft, cryptoPaymentMethod, }: ConnectWalletPaymentProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default function ConnectWalletPayment({ order, onPayment, txLoading, isSwitchingOrExecuting, phantomWalletAddress, tournament, nft, cryptoPaymentMethod, onPaymentMethodChange, }: ConnectWalletPaymentProps): import("react/jsx-runtime").JSX.Element;
|
|
17
18
|
export {};
|
|
@@ -8,6 +8,8 @@ interface OrderDetailsProps {
|
|
|
8
8
|
executeTx: components["schemas"]["ExecuteTx"] | null;
|
|
9
9
|
refundTxs: components["schemas"]["RefundTx"][];
|
|
10
10
|
cryptoPaymentMethod?: CryptoPaymentMethodType;
|
|
11
|
+
selectedCryptoPaymentMethod?: CryptoPaymentMethodType;
|
|
12
|
+
onPaymentMethodChange?: (method: CryptoPaymentMethodType) => void;
|
|
11
13
|
onBack?: () => void;
|
|
12
14
|
disableUrlParamManagement?: boolean;
|
|
13
15
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
2
|
+
interface PaymentMethodSwitchProps {
|
|
3
|
+
currentMethod: CryptoPaymentMethodType;
|
|
4
|
+
onMethodChange?: (method: CryptoPaymentMethodType) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function PaymentMethodSwitch({ currentMethod, onMethodChange }: PaymentMethodSwitchProps): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
|
+
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
2
3
|
type Order = components["schemas"]["Order"];
|
|
3
4
|
type Token = components["schemas"]["Token"];
|
|
4
5
|
type Tournament = components["schemas"]["Tournament"];
|
|
@@ -11,6 +12,7 @@ interface TransferCryptoDetailsProps {
|
|
|
11
12
|
nft?: NFT;
|
|
12
13
|
onBack: () => void;
|
|
13
14
|
recipientName?: string;
|
|
15
|
+
onPaymentMethodChange?: (method: CryptoPaymentMethodType) => void;
|
|
14
16
|
}
|
|
15
17
|
export declare const TransferCryptoDetails: import("react").NamedExoticComponent<TransferCryptoDetailsProps>;
|
|
16
18
|
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
|
|
2
|
-
import "@reservoir0x/relay-kit-ui/styles.css";
|
|
3
2
|
import { Account } from "thirdweb/wallets";
|
|
4
3
|
import { ClientType } from "../../../client-manager";
|
|
5
4
|
import { B3ContextType } from "./types";
|
|
5
|
+
import "@reservoir0x/relay-kit-ui/styles.css";
|
|
6
|
+
export declare const wagmiConfig: import("wagmi").Config<readonly [import("viem").Chain, ...import("viem").Chain[]], any, readonly import("wagmi").CreateConnectorFn[]>;
|
|
6
7
|
/**
|
|
7
8
|
* Main B3Provider component
|
|
8
9
|
*/
|
|
9
|
-
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType,
|
|
10
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, }: {
|
|
10
11
|
theme: "light" | "dark";
|
|
11
12
|
children: React.ReactNode;
|
|
12
13
|
accountOverride?: Account;
|
|
@@ -18,7 +19,6 @@ export declare function B3Provider({ theme, children, accountOverride, environme
|
|
|
18
19
|
style?: React.CSSProperties;
|
|
19
20
|
};
|
|
20
21
|
clientType?: ClientType;
|
|
21
|
-
partnerId?: string;
|
|
22
22
|
}): import("react/jsx-runtime").JSX.Element;
|
|
23
23
|
/**
|
|
24
24
|
* Inner provider component that provides the actual B3Context
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b3dotfun/sdk",
|
|
3
|
-
"version": "0.0.40
|
|
3
|
+
"version": "0.0.40",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"react-native": "./dist/cjs/index.native.js",
|
|
@@ -241,8 +241,8 @@
|
|
|
241
241
|
"@b3dotfun/basement-api": "0.0.11",
|
|
242
242
|
"@feathersjs/authentication-client": "5.0.33",
|
|
243
243
|
"@feathersjs/feathers": "5.0.33",
|
|
244
|
-
"@feathersjs/rest-client": "5.0.33",
|
|
245
244
|
"@feathersjs/socketio-client": "5.0.33",
|
|
245
|
+
"@feathersjs/rest-client": "5.0.33",
|
|
246
246
|
"@feathersjs/typebox": "5.0.33",
|
|
247
247
|
"@fingerprintjs/fingerprintjs-pro-react": "^2.7.0",
|
|
248
248
|
"@hey-api/client-fetch": "0.8.3",
|
|
@@ -261,7 +261,6 @@
|
|
|
261
261
|
"@solana/web3.js": "^1.98.2",
|
|
262
262
|
"@stripe/react-stripe-js": "^3.7.0",
|
|
263
263
|
"@stripe/stripe-js": "^7.3.1",
|
|
264
|
-
"@thirdweb-dev/wagmi-adapter": "^0.2.141",
|
|
265
264
|
"@web3icons/react": "3.16.0",
|
|
266
265
|
"big.js": "^7.0.1",
|
|
267
266
|
"class-variance-authority": "0.7.0",
|
|
@@ -332,8 +331,8 @@
|
|
|
332
331
|
"react-native-mmkv": "^3.2.0",
|
|
333
332
|
"thirdweb": "^5.105.20",
|
|
334
333
|
"three": "^0.175.0",
|
|
335
|
-
"
|
|
336
|
-
"
|
|
334
|
+
"wagmi": "^2.14.15",
|
|
335
|
+
"viem": "^2.28.1"
|
|
337
336
|
},
|
|
338
337
|
"peerDependenciesMeta": {
|
|
339
338
|
"@react-three/postprocessing": {
|
|
@@ -38,7 +38,6 @@ import { ErrorSection } from "./common/ErrorSection";
|
|
|
38
38
|
import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
|
|
39
39
|
import { OrderDetails, OrderDetailsLoadingView } from "./common/OrderDetails";
|
|
40
40
|
import { OrderHistory } from "./common/OrderHistory";
|
|
41
|
-
import { OrderStatus } from "./common/OrderStatus";
|
|
42
41
|
import { PanelOnramp } from "./common/PanelOnramp";
|
|
43
42
|
import { PanelOnrampPayment } from "./common/PanelOnrampPayment";
|
|
44
43
|
import { RecipientSelection } from "./common/RecipientSelection";
|
|
@@ -807,22 +806,21 @@ function AnySpendInner({
|
|
|
807
806
|
<div className={"mx-auto w-[460px] max-w-full"}>
|
|
808
807
|
<div className="relative flex flex-col gap-4">
|
|
809
808
|
{oat && (
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
</>
|
|
809
|
+
<OrderDetails
|
|
810
|
+
mode={mode}
|
|
811
|
+
order={oat.data.order}
|
|
812
|
+
depositTxs={oat.data.depositTxs}
|
|
813
|
+
relayTxs={oat.data.relayTxs}
|
|
814
|
+
executeTx={oat.data.executeTx}
|
|
815
|
+
refundTxs={oat.data.refundTxs}
|
|
816
|
+
selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
|
|
817
|
+
onPaymentMethodChange={setSelectedCryptoPaymentMethod}
|
|
818
|
+
onBack={() => {
|
|
819
|
+
setOrderId(undefined);
|
|
820
|
+
setActivePanel(PanelView.MAIN);
|
|
821
|
+
setSelectedCryptoPaymentMethod(CryptoPaymentMethodType.NONE); // Reset payment method when going back
|
|
822
|
+
}}
|
|
823
|
+
/>
|
|
826
824
|
)}
|
|
827
825
|
{/* {mode === "page" && <div className="h-12" />} */}
|
|
828
826
|
</div>
|
|
@@ -47,7 +47,6 @@ import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPay
|
|
|
47
47
|
import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
|
|
48
48
|
import { OrderDetails } from "./common/OrderDetails";
|
|
49
49
|
import { OrderHistory } from "./common/OrderHistory";
|
|
50
|
-
import { OrderStatus as OrderStatusDisplay } from "./common/OrderStatus";
|
|
51
50
|
import { OrderToken } from "./common/OrderToken";
|
|
52
51
|
import { RecipientSelection } from "./common/RecipientSelection";
|
|
53
52
|
|
|
@@ -648,26 +647,25 @@ function AnySpendCustomInner({
|
|
|
648
647
|
)}
|
|
649
648
|
>
|
|
650
649
|
{oat && (
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
</>
|
|
650
|
+
<OrderDetails
|
|
651
|
+
mode={mode}
|
|
652
|
+
order={oat.data.order}
|
|
653
|
+
depositTxs={oat.data.depositTxs}
|
|
654
|
+
relayTxs={oat.data.relayTxs}
|
|
655
|
+
executeTx={oat.data.executeTx}
|
|
656
|
+
refundTxs={oat.data.refundTxs}
|
|
657
|
+
cryptoPaymentMethod={activeTab === "fiat" ? CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod}
|
|
658
|
+
selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
|
|
659
|
+
onPaymentMethodChange={setSelectedCryptoPaymentMethod}
|
|
660
|
+
onBack={() => {
|
|
661
|
+
setOrderId(undefined);
|
|
662
|
+
setActivePanel(PanelView.CONFIRM_ORDER);
|
|
663
|
+
// Remove orderId from URL when canceling
|
|
664
|
+
const params = new URLSearchParams(searchParams.toString());
|
|
665
|
+
params.delete("orderId");
|
|
666
|
+
router.push(`${window.location.pathname}?${params.toString()}`);
|
|
667
|
+
}}
|
|
668
|
+
/>
|
|
671
669
|
)}
|
|
672
670
|
{mode === "page" && <div className="h-12" />}
|
|
673
671
|
</div>
|
|
@@ -14,7 +14,6 @@ import { CryptoReceiveSection } from "./common/CryptoReceiveSection";
|
|
|
14
14
|
import { ErrorSection } from "./common/ErrorSection";
|
|
15
15
|
import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
|
|
16
16
|
import { OrderDetails } from "./common/OrderDetails";
|
|
17
|
-
import { OrderStatus } from "./common/OrderStatus";
|
|
18
17
|
import { RecipientSelection } from "./common/RecipientSelection";
|
|
19
18
|
|
|
20
19
|
import { ArrowDown } from "lucide-react";
|
|
@@ -381,23 +380,22 @@ function AnySpendDepositHypeInner({
|
|
|
381
380
|
<div className={"mx-auto w-[460px] max-w-full"}>
|
|
382
381
|
<div className="relative flex flex-col gap-4">
|
|
383
382
|
{oat && (
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
</>
|
|
383
|
+
<OrderDetails
|
|
384
|
+
mode={mode}
|
|
385
|
+
order={oat.data.order}
|
|
386
|
+
depositTxs={oat.data.depositTxs}
|
|
387
|
+
relayTxs={oat.data.relayTxs}
|
|
388
|
+
executeTx={oat.data.executeTx}
|
|
389
|
+
refundTxs={oat.data.refundTxs}
|
|
390
|
+
cryptoPaymentMethod={paymentType === "fiat" ? CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod}
|
|
391
|
+
selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
|
|
392
|
+
onPaymentMethodChange={setSelectedCryptoPaymentMethod}
|
|
393
|
+
onBack={() => {
|
|
394
|
+
setOrderId(undefined);
|
|
395
|
+
setActivePanel(PanelView.MAIN);
|
|
396
|
+
}}
|
|
397
|
+
disableUrlParamManagement
|
|
398
|
+
/>
|
|
401
399
|
)}
|
|
402
400
|
</div>
|
|
403
401
|
</div>
|
|
@@ -10,6 +10,7 @@ import { ChevronRight, Loader2 } from "lucide-react";
|
|
|
10
10
|
import { useAccount } from "wagmi";
|
|
11
11
|
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
12
12
|
import { OrderDetailsCollapsible } from "./OrderDetailsCollapsible";
|
|
13
|
+
import { PaymentMethodSwitch } from "./PaymentMethodSwitch";
|
|
13
14
|
|
|
14
15
|
type Tournament = components["schemas"]["Tournament"];
|
|
15
16
|
type NFT = components["schemas"]["NFT"];
|
|
@@ -24,6 +25,7 @@ interface ConnectWalletPaymentProps {
|
|
|
24
25
|
tournament?: Tournament;
|
|
25
26
|
nft?: NFT;
|
|
26
27
|
cryptoPaymentMethod: CryptoPaymentMethodType;
|
|
28
|
+
onPaymentMethodChange?: (method: CryptoPaymentMethodType) => void;
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
export default function ConnectWalletPayment({
|
|
@@ -35,6 +37,7 @@ export default function ConnectWalletPayment({
|
|
|
35
37
|
tournament,
|
|
36
38
|
nft,
|
|
37
39
|
cryptoPaymentMethod,
|
|
40
|
+
onPaymentMethodChange,
|
|
38
41
|
}: ConnectWalletPaymentProps) {
|
|
39
42
|
const profile = useProfile({ address: order.recipientAddress });
|
|
40
43
|
const recipientName = profile.data?.name?.replace(/\.b3\.fun/g, "");
|
|
@@ -97,6 +100,8 @@ export default function ConnectWalletPayment({
|
|
|
97
100
|
: centerTruncate(connectedAddress || "")}
|
|
98
101
|
</span>
|
|
99
102
|
|
|
103
|
+
<PaymentMethodSwitch currentMethod={cryptoPaymentMethod} onMethodChange={onPaymentMethodChange} />
|
|
104
|
+
|
|
100
105
|
<div className="mt-4">
|
|
101
106
|
<OrderDetailsCollapsible
|
|
102
107
|
order={order}
|