@b3dotfun/sdk 0.0.17 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +1 -1
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +1 -1
- package/dist/cjs/anyspend/react/providers/AnyspendProvider.d.ts +2 -1
- package/dist/cjs/anyspend/react/providers/AnyspendProvider.js +3 -2
- package/dist/cjs/{global-account/react/components → anyspend/react/providers}/RelayKitProviderWrapper.d.ts +2 -1
- package/dist/cjs/{global-account/react/components → anyspend/react/providers}/RelayKitProviderWrapper.js +3 -3
- package/dist/cjs/anyspend/utils/chain.d.ts +2 -2
- package/dist/cjs/anyspend/utils/chain.js +41 -6
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +1 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +2 -3
- package/dist/cjs/global-account/react/components/index.d.ts +1 -2
- package/dist/cjs/global-account/react/components/index.js +4 -6
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +1 -1
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +1 -1
- package/dist/esm/anyspend/react/providers/AnyspendProvider.d.ts +2 -1
- package/dist/esm/anyspend/react/providers/AnyspendProvider.js +3 -2
- package/dist/{types/global-account/react/components → esm/anyspend/react/providers}/RelayKitProviderWrapper.d.ts +2 -1
- package/dist/esm/{global-account/react/components → anyspend/react/providers}/RelayKitProviderWrapper.js +3 -3
- package/dist/esm/anyspend/utils/chain.d.ts +2 -2
- package/dist/esm/anyspend/utils/chain.js +41 -6
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +1 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.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/types/anyspend/react/providers/AnyspendProvider.d.ts +2 -1
- package/dist/{esm/global-account/react/components → types/anyspend/react/providers}/RelayKitProviderWrapper.d.ts +2 -1
- package/dist/types/anyspend/utils/chain.d.ts +2 -2
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +1 -2
- package/dist/types/global-account/react/components/index.d.ts +1 -2
- package/package.json +3 -3
- package/src/anyspend/react/components/common/OrderDetails.tsx +1 -0
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +1 -0
- package/src/anyspend/react/providers/AnyspendProvider.tsx +9 -5
- package/src/{global-account/react/components → anyspend/react/providers}/RelayKitProviderWrapper.tsx +11 -3
- package/src/anyspend/utils/chain.ts +52 -7
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +0 -1
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +4 -9
- package/src/global-account/react/components/index.ts +1 -2
package/README.md
CHANGED
|
@@ -488,7 +488,7 @@ exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ isMainnet, mode
|
|
|
488
488
|
? (0, centerTruncate_1.default)(phantomWalletAddress, 6)
|
|
489
489
|
: (0, centerTruncate_1.default)(account?.address || "", 6)] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-col items-center gap-2", children: [(0, jsx_runtime_1.jsxs)(react_1.ShinyButton, { accentColor: colorMode === "dark" ? "#ffffff" : "#000000", className: "flex w-5/6 items-center gap-2 sm:px-0", onClick: () => setShowQRCode(true), children: [(0, jsx_runtime_1.jsx)("span", { className: "pl-4 text-lg md:text-sm", children: "Pay from a different wallet" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(react_3.WalletMetamask, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletPhantom, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletTrust, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletWalletConnect, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)("span", { className: "label-style text-as-primary/30 text-xs", children: "& more" })] })] })] }) })) : (
|
|
490
490
|
// Default case - existing QR code flow
|
|
491
|
-
(0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [(0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: (0, anyspend_1.getPaymentUrl)(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === anyspend_1.RELAY_ETH_ADDRESS ? "ETH" : order.srcTokenAddress), className: "max-w-[200px]" }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-3 flex items-center justify-center gap-2 text-sm", children: [(0, jsx_runtime_1.jsx)("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), (0, jsx_runtime_1.jsxs)(react_1.TextLoop, { interval: 3, children: [(0, jsx_runtime_1.jsx)(react_3.WalletMetamask, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletPhantom, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }))] })) })), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-center gap-1 text-sm", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/30", children: "Time remaining:" }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary", children: depositEnoughAmount ? ("Received") : order.status === "expired" ? ("Expired") : ((0, jsx_runtime_1.jsx)(react_timeago_1.default, { date: new Date(order.expiredAt), live: true })) })] }), statusDisplay !== "processing" && ((0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount })), (0, jsx_runtime_1.jsxs)("button", { className: "flex w-full items-center justify-center gap-2", onClick: handleBack, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.RefreshCcw, { className: "ml-2 h-4 w-4" }), " Cancel and start over"] })] }));
|
|
491
|
+
(0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [(0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: (0, anyspend_1.getPaymentUrl)(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === anyspend_1.RELAY_ETH_ADDRESS ? "ETH" : order.srcTokenAddress, order.srcChain), className: "max-w-[200px]" }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-3 flex items-center justify-center gap-2 text-sm", children: [(0, jsx_runtime_1.jsx)("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), (0, jsx_runtime_1.jsxs)(react_1.TextLoop, { interval: 3, children: [(0, jsx_runtime_1.jsx)(react_3.WalletMetamask, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletPhantom, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_3.WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }))] })) })), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-center gap-1 text-sm", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/30", children: "Time remaining:" }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary", children: depositEnoughAmount ? ("Received") : order.status === "expired" ? ("Expired") : ((0, jsx_runtime_1.jsx)(react_timeago_1.default, { date: new Date(order.expiredAt), live: true })) })] }), statusDisplay !== "processing" && ((0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount })), (0, jsx_runtime_1.jsxs)("button", { className: "flex w-full items-center justify-center gap-2", onClick: handleBack, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.RefreshCcw, { className: "ml-2 h-4 w-4" }), " Cancel and start over"] })] }));
|
|
492
492
|
});
|
|
493
493
|
function TransactionDetails({ title, chainId, tx, isProcessing, delay, }) {
|
|
494
494
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full flex-1 items-center justify-between gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex grow items-center gap-4", children: [(0, jsx_runtime_1.jsx)(react_4.motion.div, { className: "bg-b3-react-background relative h-10 w-10 rounded-full", children: isProcessing ? ((0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeInOut", delay }, className: "absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full bg-black/70 shadow-lg backdrop-blur-sm", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-as-primary h-4 w-4 animate-spin" }) })) : ((0, jsx_runtime_1.jsx)(react_4.motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeOut", delay }, className: "bg-as-brand/70 absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border border-white/30 shadow-lg shadow-purple-500/30 backdrop-blur-sm", style: {
|
|
@@ -69,5 +69,5 @@ exports.TransferCryptoDetails = (0, react_3.memo)(function TransferCryptoDetails
|
|
|
69
69
|
transition: "stroke-dashoffset 1s linear",
|
|
70
70
|
} })] }), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 flex items-center justify-center", children: (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary text-[10px] font-semibold", children: formatTime(timeLeft) }) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "w-full", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-content-secondary text-sm font-medium", children: "Amount" }), (0, jsx_runtime_1.jsx)("div", { className: "border-as-border-primary rounded-lg border p-2 shadow-sm", children: (0, jsx_runtime_1.jsx)(react_1.CopyToClipboard, { text: roundedUpSrcAmount || "", onCopy: () => {
|
|
71
71
|
sonner_1.toast.success("Amount copied to clipboard");
|
|
72
|
-
}, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex cursor-pointer items-center justify-between gap-2", children: [(0, jsx_runtime_1.jsxs)("strong", { className: "text-as-primary font-semibold", children: [roundedUpSrcAmount, " ", srcToken.symbol] }), (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "text-as-primary/50 hover:text-as-primary h-4 w-4 transition-all duration-200" })] }) }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "w-full", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-content-secondary text-sm font-medium", children: "Chain" }), (0, jsx_runtime_1.jsx)("div", { className: "border-as-border-primary rounded-lg border p-2 shadow-sm", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[order.srcChain].logoUrl, alt: (0, anyspend_1.getChainName)(order.srcChain), className: (0, utils_1.cn)("h-6 rounded-full", order.srcChain === chains_1.b3.id && "h-5 rounded-none") }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary text-sm font-semibold", children: (0, anyspend_1.getChainName)(order.srcChain) })] }) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "border-b3-react-border bg-as-surface-secondary grid h-[220px] grid-cols-2 overflow-hidden rounded-xl border", children: [(0, jsx_runtime_1.jsx)("div", { className: "border-as-border-primary h-full w-full border-r", children: (0, jsx_runtime_1.jsx)("div", { className: "flex justify-center", children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-surface-secondary flex flex-col items-center rounded-lg p-6", children: [(0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: (0, anyspend_1.getPaymentUrl)(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === anyspend_1.RELAY_ETH_ADDRESS ? "ETH" : order.srcTokenAddress), className: "bg-as-surface-secondary max-h-48 max-w-48" }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-3 flex items-center justify-center gap-2 text-sm", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-brand/70 text-sm font-medium", children: "SCAN WITH" }), (0, jsx_runtime_1.jsxs)(react_1.TextLoop, { interval: 3, children: [(0, jsx_runtime_1.jsx)(react_2.WalletMetamask, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletPhantom, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex h-full w-full flex-col gap-2 p-6", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-content-secondary text-sm font-medium", children: "Deposit address:" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex h-full cursor-pointer flex-col items-stretch justify-between gap-4", onClick: handleCopyAddress, children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary break-all font-mono text-sm font-semibold leading-relaxed", children: order.globalAddress }), (0, jsx_runtime_1.jsx)("div", { className: "place-self-end", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "group-hover:text-as-brand text-as-tertiarry h-4 w-4 cursor-pointer transition-all duration-200" }) })] })] })] }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col gap-3", children: (0, jsx_runtime_1.jsx)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "w-full py-3", onClick: handleCopyAddress, children: "Copy deposit address" }) })] }));
|
|
72
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex cursor-pointer items-center justify-between gap-2", children: [(0, jsx_runtime_1.jsxs)("strong", { className: "text-as-primary font-semibold", children: [roundedUpSrcAmount, " ", srcToken.symbol] }), (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "text-as-primary/50 hover:text-as-primary h-4 w-4 transition-all duration-200" })] }) }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "w-full", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-content-secondary text-sm font-medium", children: "Chain" }), (0, jsx_runtime_1.jsx)("div", { className: "border-as-border-primary rounded-lg border p-2 shadow-sm", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[order.srcChain].logoUrl, alt: (0, anyspend_1.getChainName)(order.srcChain), className: (0, utils_1.cn)("h-6 rounded-full", order.srcChain === chains_1.b3.id && "h-5 rounded-none") }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary text-sm font-semibold", children: (0, anyspend_1.getChainName)(order.srcChain) })] }) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "border-b3-react-border bg-as-surface-secondary grid h-[220px] grid-cols-2 overflow-hidden rounded-xl border", children: [(0, jsx_runtime_1.jsx)("div", { className: "border-as-border-primary h-full w-full border-r", children: (0, jsx_runtime_1.jsx)("div", { className: "flex justify-center", children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-surface-secondary flex flex-col items-center rounded-lg p-6", children: [(0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: (0, anyspend_1.getPaymentUrl)(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === anyspend_1.RELAY_ETH_ADDRESS ? "ETH" : order.srcTokenAddress, order.srcChain), className: "bg-as-surface-secondary max-h-48 max-w-48" }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-3 flex items-center justify-center gap-2 text-sm", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-brand/70 text-sm font-medium", children: "SCAN WITH" }), (0, jsx_runtime_1.jsxs)(react_1.TextLoop, { interval: 3, children: [(0, jsx_runtime_1.jsx)(react_2.WalletMetamask, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletPhantom, { className: "h-5 w-5", variant: "branded" }), (0, jsx_runtime_1.jsx)(react_2.WalletTrust, { className: "h-5 w-5", variant: "branded" })] })] })] }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex h-full w-full flex-col gap-2 p-6", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-content-secondary text-sm font-medium", children: "Deposit address:" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex h-full cursor-pointer flex-col items-stretch justify-between gap-4", onClick: handleCopyAddress, children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary break-all font-mono text-sm font-semibold leading-relaxed", children: order.globalAddress }), (0, jsx_runtime_1.jsx)("div", { className: "place-self-end", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "group-hover:text-as-brand text-as-tertiarry h-4 w-4 cursor-pointer transition-all duration-200" }) })] })] })] }), (0, jsx_runtime_1.jsx)(OrderDetailsCollapsible_1.OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col gap-3", children: (0, jsx_runtime_1.jsx)(react_1.ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "w-full py-3", onClick: handleCopyAddress, children: "Copy deposit address" }) })] }));
|
|
73
73
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
interface AnyspendProviderProps {
|
|
3
3
|
children: ReactNode;
|
|
4
|
+
simDuneApiKey?: string;
|
|
4
5
|
}
|
|
5
6
|
/**
|
|
6
7
|
* AnyspendProvider is a top-level provider that wraps your application to provide
|
|
@@ -24,5 +25,5 @@ interface AnyspendProviderProps {
|
|
|
24
25
|
* }
|
|
25
26
|
* ```
|
|
26
27
|
*/
|
|
27
|
-
export declare const AnyspendProvider: ({ children }: AnyspendProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare const AnyspendProvider: ({ children, simDuneApiKey }: AnyspendProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
29
|
export {};
|
|
@@ -7,6 +7,7 @@ const react_1 = require("../../../global-account/react");
|
|
|
7
7
|
const react_query_1 = require("@tanstack/react-query");
|
|
8
8
|
const react_2 = require("react");
|
|
9
9
|
const StripeRedirectHandler_1 = require("./StripeRedirectHandler");
|
|
10
|
+
const RelayKitProviderWrapper_1 = require("./RelayKitProviderWrapper");
|
|
10
11
|
const defaultQueryClientConfig = {
|
|
11
12
|
defaultOptions: {
|
|
12
13
|
queries: {
|
|
@@ -38,8 +39,8 @@ const defaultQueryClientConfig = {
|
|
|
38
39
|
* }
|
|
39
40
|
* ```
|
|
40
41
|
*/
|
|
41
|
-
const AnyspendProvider = function AnyspendProvider({ children }) {
|
|
42
|
+
const AnyspendProvider = function AnyspendProvider({ children, simDuneApiKey }) {
|
|
42
43
|
const [queryClient] = (0, react_2.useState)(() => new react_query_1.QueryClient(defaultQueryClientConfig));
|
|
43
|
-
return ((0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsxs)(react_1.TooltipProvider, { children: [(0, jsx_runtime_1.jsx)(StripeRedirectHandler_1.StripeRedirectHandler, {}), children] }) }));
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(RelayKitProviderWrapper_1.RelayKitProviderWrapper, { isMainnet: true, simDuneApiKey: simDuneApiKey, children: (0, jsx_runtime_1.jsxs)(react_1.TooltipProvider, { children: [(0, jsx_runtime_1.jsx)(StripeRedirectHandler_1.StripeRedirectHandler, {}), children] }) }) }));
|
|
44
45
|
};
|
|
45
46
|
exports.AnyspendProvider = AnyspendProvider;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export declare function RelayKitProviderWrapper({ isMainnet, children }: {
|
|
1
|
+
export declare function RelayKitProviderWrapper({ isMainnet, children, simDuneApiKey, }: {
|
|
2
2
|
isMainnet: boolean;
|
|
3
3
|
children: React.ReactNode;
|
|
4
|
+
simDuneApiKey?: string;
|
|
4
5
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const relay_kit_ui_1 = require("@reservoir0x/relay-kit-ui");
|
|
6
6
|
const relay_sdk_1 = require("@reservoir0x/relay-sdk");
|
|
7
7
|
const react_1 = require("react");
|
|
8
|
-
function RelayKitProviderWrapper({ isMainnet, children }) {
|
|
8
|
+
function RelayKitProviderWrapper({ isMainnet, children, simDuneApiKey, }) {
|
|
9
9
|
const [relayChains, setRelayChains] = (0, react_1.useState)([]);
|
|
10
10
|
(0, react_1.useEffect)(() => {
|
|
11
11
|
const fetchChains = async () => {
|
|
@@ -18,8 +18,8 @@ function RelayKitProviderWrapper({ isMainnet, children }) {
|
|
|
18
18
|
baseApiUrl: isMainnet ? relay_sdk_1.MAINNET_RELAY_API : relay_sdk_1.TESTNET_RELAY_API,
|
|
19
19
|
source: "anyspend",
|
|
20
20
|
duneConfig: {
|
|
21
|
-
apiKey:
|
|
22
|
-
apiBaseUrl: "https://api.dune.com",
|
|
21
|
+
apiKey: simDuneApiKey,
|
|
22
|
+
apiBaseUrl: "https://api.sim.dune.com",
|
|
23
23
|
},
|
|
24
24
|
chains: relayChains,
|
|
25
25
|
privateChainIds: undefined,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { components } from "../../anyspend/types/api";
|
|
1
2
|
import { Account, Chain, PublicClient, Transport, WalletClient } from "viem";
|
|
2
3
|
import { ChainType, IBaseChain, IEVMChain, ISolanaChain } from "../types/chain";
|
|
3
|
-
import { components } from "../../anyspend/types/api";
|
|
4
4
|
export declare const EVM_MAINNET: Record<number, IEVMChain>;
|
|
5
5
|
export declare const EVM_TESTNET: Record<number, IEVMChain>;
|
|
6
6
|
export declare const SOLANA_MAINNET: ISolanaChain;
|
|
@@ -18,7 +18,7 @@ export declare function isMainnet(chainId: number): boolean;
|
|
|
18
18
|
export declare function isTestnet(chainId: number): boolean;
|
|
19
19
|
export declare function getDefaultToken(chainId: number): components["schemas"]["Token"];
|
|
20
20
|
export declare function getChainName(chainId: number): string;
|
|
21
|
-
export declare function getPaymentUrl(address: string, amount: bigint, currency: string): string;
|
|
21
|
+
export declare function getPaymentUrl(address: string, amount: bigint, currency: string, chainId: number): string;
|
|
22
22
|
export declare function getExplorerTxUrl(chainId: number, txHash: string): string;
|
|
23
23
|
export declare function getExplorerAddressUrl(chainId: number, address: string): string;
|
|
24
24
|
export declare function getMulticall3Address(chainId: number): string;
|
|
@@ -21,12 +21,12 @@ exports.getExplorerAddressUrl = getExplorerAddressUrl;
|
|
|
21
21
|
exports.getMulticall3Address = getMulticall3Address;
|
|
22
22
|
exports.getNativeToken = getNativeToken;
|
|
23
23
|
exports.isEvmChain = isEvmChain;
|
|
24
|
+
const constants_1 = require("../../anyspend/constants");
|
|
24
25
|
const invariant_1 = __importDefault(require("invariant"));
|
|
25
26
|
const viem_1 = require("viem");
|
|
26
27
|
const chains_1 = require("viem/chains");
|
|
27
|
-
const constants_1 = require("../../anyspend/constants");
|
|
28
|
-
const token_1 = require("./token");
|
|
29
28
|
const chain_1 = require("../types/chain");
|
|
29
|
+
const token_1 = require("./token");
|
|
30
30
|
function getCustomEvmChain(chain, rpcUrl) {
|
|
31
31
|
return (0, viem_1.defineChain)({ ...chain, rpcUrls: { default: { http: [rpcUrl] } } });
|
|
32
32
|
}
|
|
@@ -260,11 +260,46 @@ function getChainName(chainId) {
|
|
|
260
260
|
(0, invariant_1.default)(exports.ALL_CHAINS[chainId], `Chain ${chainId} is not supported`);
|
|
261
261
|
return exports.EVM_CHAINS[chainId] ? exports.EVM_CHAINS[chainId].viem.name : "Solana";
|
|
262
262
|
}
|
|
263
|
-
function getPaymentUrl(address, amount, currency) {
|
|
264
|
-
|
|
265
|
-
|
|
263
|
+
function getPaymentUrl(address, amount, currency, chainId) {
|
|
264
|
+
// Get chain type to determine URL format
|
|
265
|
+
const chainType = getChainType(chainId);
|
|
266
|
+
const chain = exports.ALL_CHAINS[chainId];
|
|
267
|
+
(0, invariant_1.default)(chain, `Chain ${chainId} is not supported`);
|
|
268
|
+
switch (chainType) {
|
|
269
|
+
case chain_1.ChainType.EVM: {
|
|
270
|
+
// For EVM chains, follow EIP-681 format
|
|
271
|
+
// Format: ethereum:[address]@[chainId]?value=[amount]&symbol=[symbol]
|
|
272
|
+
const params = new URLSearchParams();
|
|
273
|
+
// Add value for native token transfers
|
|
274
|
+
if (currency === chain.nativeToken.symbol) {
|
|
275
|
+
params.append("value", amount.toString());
|
|
276
|
+
}
|
|
277
|
+
// Add chain ID for non-Ethereum chains
|
|
278
|
+
const chainParam = chainId !== chains_1.mainnet.id ? `@${chainId}` : "";
|
|
279
|
+
// Add token info for non-native token transfers
|
|
280
|
+
if (currency !== chain.nativeToken.symbol) {
|
|
281
|
+
params.append("symbol", currency);
|
|
282
|
+
}
|
|
283
|
+
const queryString = params.toString();
|
|
284
|
+
return `ethereum:${address}${chainParam}${queryString ? `?${queryString}` : ""}`;
|
|
285
|
+
}
|
|
286
|
+
case chain_1.ChainType.SOLANA: {
|
|
287
|
+
// Solana URL format: solana:${address}?amount=${amount}&spl-token=${tokenAddress}
|
|
288
|
+
const params = new URLSearchParams();
|
|
289
|
+
// Add amount for native SOL transfers
|
|
290
|
+
if (currency === "SOL") {
|
|
291
|
+
params.append("amount", amount.toString());
|
|
292
|
+
}
|
|
293
|
+
// Add SPL token info for token transfers
|
|
294
|
+
if (currency !== "SOL") {
|
|
295
|
+
params.append("spl-token", currency); // currency here should be token address
|
|
296
|
+
}
|
|
297
|
+
return `solana:${address}?${params.toString()}`;
|
|
298
|
+
}
|
|
299
|
+
default:
|
|
300
|
+
// Fallback to just the address if chain type is unknown
|
|
301
|
+
return address;
|
|
266
302
|
}
|
|
267
|
-
return `ethereum:${address}`;
|
|
268
303
|
}
|
|
269
304
|
function getExplorerTxUrl(chainId, txHash) {
|
|
270
305
|
if (chainId === chains_1.b3.id) {
|
|
@@ -6,8 +6,7 @@ export declare const wagmiConfig: import("wagmi").Config<readonly [import("viem"
|
|
|
6
6
|
/**
|
|
7
7
|
* Main B3Provider component
|
|
8
8
|
*/
|
|
9
|
-
export declare function B3Provider({
|
|
10
|
-
isMainnetAnySpend?: boolean;
|
|
9
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, }: {
|
|
11
10
|
theme: "light" | "dark";
|
|
12
11
|
children: React.ReactNode;
|
|
13
12
|
accountOverride?: Account;
|
|
@@ -11,7 +11,6 @@ const react_2 = require("react");
|
|
|
11
11
|
const sonner_1 = require("sonner");
|
|
12
12
|
const react_3 = require("thirdweb/react");
|
|
13
13
|
const wagmi_1 = require("wagmi");
|
|
14
|
-
const RelayKitProviderWrapper_1 = require("../RelayKitProviderWrapper");
|
|
15
14
|
const StyleRoot_1 = require("../StyleRoot");
|
|
16
15
|
const types_1 = require("./types");
|
|
17
16
|
require("@reservoir0x/relay-kit-ui/styles.css");
|
|
@@ -33,8 +32,8 @@ const queryClient = new react_query_1.QueryClient();
|
|
|
33
32
|
/**
|
|
34
33
|
* Main B3Provider component
|
|
35
34
|
*/
|
|
36
|
-
function B3Provider({
|
|
37
|
-
return ((0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: exports.wagmiConfig, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.
|
|
35
|
+
function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, }) {
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: exports.wagmiConfig, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsxs)(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, children: [children, (0, jsx_runtime_1.jsx)(StyleRoot_1.StyleRoot, { id: "b3-root" }), (0, jsx_runtime_1.jsx)(sonner_1.Toaster, { theme: theme })] }) }) }) }) }));
|
|
38
37
|
}
|
|
39
38
|
/**
|
|
40
39
|
* Inner provider component that provides the actual B3Context
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export { B3DynamicModal } from "./B3DynamicModal";
|
|
2
2
|
export { B3Provider, InnerProvider } from "./B3Provider/B3Provider";
|
|
3
|
-
export { useB3 } from "./B3Provider/useB3";
|
|
4
3
|
export { B3Context, type B3ContextType } from "./B3Provider/types";
|
|
5
|
-
export {
|
|
4
|
+
export { useB3 } from "./B3Provider/useB3";
|
|
6
5
|
export { StyleRoot } from "./StyleRoot";
|
|
7
6
|
export { AuthButton } from "./SignInWithB3/components/AuthButton";
|
|
8
7
|
export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DialogTitle = exports.DialogPortal = exports.DialogOverlay = exports.DialogHeader = exports.DialogFooter = exports.DialogDescription = exports.DialogContent = exports.DialogClose = exports.Dialog = exports.CommandShortcut = exports.CommandSeparator = exports.CommandList = exports.CommandItem = exports.CommandInput = exports.CommandGroup = exports.CommandEmpty = exports.CommandDialog = exports.Command = exports.buttonVariants = exports.Button = exports.badgeVariants = exports.Badge = exports.WalletConnectorIcon = exports.StaggeredFadeLoader = exports.CopyToClipboard = exports.ClientOnly = exports.customButtonVariants = exports.CustomButton = exports.TransakModal = exports.MintButton = exports.AccountAssets = exports.RequestPermissionsButton = exports.RequestPermissions = exports.ManageAccount = exports.isWalletType = exports.getConnectOptionsFromStrategy = exports.LoginStepContainer = exports.SignInWithB3Privy = exports.SignInWithB3Flow = exports.SignInWithB3 = exports.WalletRow = exports.PermissionItem = exports.AuthButton = exports.StyleRoot = exports.
|
|
4
|
-
exports.AnimatedLottie = exports.TransitionPanel = exports.TooltipTrigger = exports.TooltipProvider = exports.TooltipContent = exports.Tooltip = exports.TextShimmer = exports.TextLoop = exports.TabTrigger = exports.TabsTransitionWrapper = exports.TabsList = exports.TabsContent = exports.Tabs = exports.TabTriggerPrimitive = exports.TabsPrimitive = exports.TabsListPrimitive = exports.TabsContentPrimitive = exports.Skeleton = exports.ShinyButton = exports.ScrollBar = exports.ScrollArea = exports.PopoverTrigger = exports.PopoverContent = exports.Popover = exports.Loading = exports.Input = exports.GlareCardRounded = exports.GlareCard = exports.DrawerTrigger = exports.DrawerTitle = exports.DrawerPortal = exports.DrawerOverlay = exports.DrawerHeader = exports.DrawerFooter = exports.DrawerDescription = exports.DrawerContent = exports.DrawerClose = exports.Drawer =
|
|
3
|
+
exports.DialogTrigger = exports.DialogTitle = exports.DialogPortal = exports.DialogOverlay = exports.DialogHeader = exports.DialogFooter = exports.DialogDescription = exports.DialogContent = exports.DialogClose = exports.Dialog = exports.CommandShortcut = exports.CommandSeparator = exports.CommandList = exports.CommandItem = exports.CommandInput = exports.CommandGroup = exports.CommandEmpty = exports.CommandDialog = exports.Command = exports.buttonVariants = exports.Button = exports.badgeVariants = exports.Badge = exports.WalletConnectorIcon = exports.StaggeredFadeLoader = exports.CopyToClipboard = exports.ClientOnly = exports.customButtonVariants = exports.CustomButton = exports.TransakModal = exports.MintButton = exports.AccountAssets = exports.RequestPermissionsButton = exports.RequestPermissions = exports.ManageAccount = exports.isWalletType = exports.getConnectOptionsFromStrategy = exports.LoginStepContainer = exports.SignInWithB3Privy = exports.SignInWithB3Flow = exports.SignInWithB3 = exports.WalletRow = exports.PermissionItem = exports.AuthButton = exports.StyleRoot = exports.useB3 = exports.B3Context = exports.InnerProvider = exports.B3Provider = exports.B3DynamicModal = void 0;
|
|
4
|
+
exports.AnimatedLottie = exports.TransitionPanel = exports.TooltipTrigger = exports.TooltipProvider = exports.TooltipContent = exports.Tooltip = exports.TextShimmer = exports.TextLoop = exports.TabTrigger = exports.TabsTransitionWrapper = exports.TabsList = exports.TabsContent = exports.Tabs = exports.TabTriggerPrimitive = exports.TabsPrimitive = exports.TabsListPrimitive = exports.TabsContentPrimitive = exports.Skeleton = exports.ShinyButton = exports.ScrollBar = exports.ScrollArea = exports.PopoverTrigger = exports.PopoverContent = exports.Popover = exports.Loading = exports.Input = exports.GlareCardRounded = exports.GlareCard = exports.DrawerTrigger = exports.DrawerTitle = exports.DrawerPortal = exports.DrawerOverlay = exports.DrawerHeader = exports.DrawerFooter = exports.DrawerDescription = exports.DrawerContent = exports.DrawerClose = exports.Drawer = void 0;
|
|
5
5
|
// Core Components
|
|
6
6
|
var B3DynamicModal_1 = require("./B3DynamicModal");
|
|
7
7
|
Object.defineProperty(exports, "B3DynamicModal", { enumerable: true, get: function () { return B3DynamicModal_1.B3DynamicModal; } });
|
|
8
8
|
var B3Provider_1 = require("./B3Provider/B3Provider");
|
|
9
9
|
Object.defineProperty(exports, "B3Provider", { enumerable: true, get: function () { return B3Provider_1.B3Provider; } });
|
|
10
10
|
Object.defineProperty(exports, "InnerProvider", { enumerable: true, get: function () { return B3Provider_1.InnerProvider; } });
|
|
11
|
-
var useB3_1 = require("./B3Provider/useB3");
|
|
12
|
-
Object.defineProperty(exports, "useB3", { enumerable: true, get: function () { return useB3_1.useB3; } });
|
|
13
11
|
var types_1 = require("./B3Provider/types");
|
|
14
12
|
Object.defineProperty(exports, "B3Context", { enumerable: true, get: function () { return types_1.B3Context; } });
|
|
15
|
-
var
|
|
16
|
-
Object.defineProperty(exports, "
|
|
13
|
+
var useB3_1 = require("./B3Provider/useB3");
|
|
14
|
+
Object.defineProperty(exports, "useB3", { enumerable: true, get: function () { return useB3_1.useB3; } });
|
|
17
15
|
var StyleRoot_1 = require("./StyleRoot");
|
|
18
16
|
Object.defineProperty(exports, "StyleRoot", { enumerable: true, get: function () { return StyleRoot_1.StyleRoot; } });
|
|
19
17
|
// SignInWithB3 Components
|
|
@@ -482,7 +482,7 @@ export const OrderDetails = memo(function OrderDetails({ isMainnet, mode = "moda
|
|
|
482
482
|
? centerTruncate(phantomWalletAddress, 6)
|
|
483
483
|
: centerTruncate(account?.address || "", 6)] })] }), _jsxs("div", { className: "flex w-full flex-col items-center gap-2", children: [_jsxs(ShinyButton, { accentColor: colorMode === "dark" ? "#ffffff" : "#000000", className: "flex w-5/6 items-center gap-2 sm:px-0", onClick: () => setShowQRCode(true), children: [_jsx("span", { className: "pl-4 text-lg md:text-sm", children: "Pay from a different wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] }), _jsxs("div", { className: "flex items-center gap-2", 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" }), _jsx(WalletWalletConnect, { className: "h-5 w-5", variant: "branded" }), _jsx("span", { className: "label-style text-as-primary/30 text-xs", children: "& more" })] })] })] }) })) : (
|
|
484
484
|
// Default case - existing QR code flow
|
|
485
|
-
_jsx(motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: _jsxs("div", { className: "mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === RELAY_ETH_ADDRESS ? "ETH" : order.srcTokenAddress), className: "max-w-[200px]" }), _jsxs("div", { className: "mt-3 flex items-center justify-center gap-2 text-sm", children: [_jsx("span", { className: "label-style text-as-brand/70 text-sm", 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 w-full items-center justify-center gap-1 text-sm", children: [_jsx("div", { className: "text-as-primary/30", children: "Time remaining:" }), _jsx("div", { className: "text-as-primary", children: depositEnoughAmount ? ("Received") : order.status === "expired" ? ("Expired") : (_jsx(TimeAgo, { date: new Date(order.expiredAt), live: true })) })] }), statusDisplay !== "processing" && (_jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount })), _jsxs("button", { className: "flex w-full items-center justify-center gap-2", onClick: handleBack, children: [_jsx(RefreshCcw, { className: "ml-2 h-4 w-4" }), " Cancel and start over"] })] }));
|
|
485
|
+
_jsx(motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: _jsxs("div", { className: "mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === RELAY_ETH_ADDRESS ? "ETH" : order.srcTokenAddress, order.srcChain), className: "max-w-[200px]" }), _jsxs("div", { className: "mt-3 flex items-center justify-center gap-2 text-sm", children: [_jsx("span", { className: "label-style text-as-brand/70 text-sm", 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 w-full items-center justify-center gap-1 text-sm", children: [_jsx("div", { className: "text-as-primary/30", children: "Time remaining:" }), _jsx("div", { className: "text-as-primary", children: depositEnoughAmount ? ("Received") : order.status === "expired" ? ("Expired") : (_jsx(TimeAgo, { date: new Date(order.expiredAt), live: true })) })] }), statusDisplay !== "processing" && (_jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount })), _jsxs("button", { className: "flex w-full items-center justify-center gap-2", onClick: handleBack, children: [_jsx(RefreshCcw, { className: "ml-2 h-4 w-4" }), " Cancel and start over"] })] }));
|
|
486
486
|
});
|
|
487
487
|
function TransactionDetails({ title, chainId, tx, isProcessing, delay, }) {
|
|
488
488
|
return (_jsxs("div", { className: "relative flex w-full flex-1 items-center justify-between gap-4", children: [_jsxs("div", { className: "flex grow items-center gap-4", children: [_jsx(motion.div, { className: "bg-b3-react-background relative h-10 w-10 rounded-full", children: isProcessing ? (_jsx(motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeInOut", delay }, className: "absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full bg-black/70 shadow-lg backdrop-blur-sm", children: _jsx(Loader2, { className: "text-as-primary h-4 w-4 animate-spin" }) })) : (_jsx(motion.div, { initial: { opacity: 0, scale: 0.3 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.5, ease: "easeOut", delay }, className: "bg-as-brand/70 absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border border-white/30 shadow-lg shadow-purple-500/30 backdrop-blur-sm", style: {
|
|
@@ -66,5 +66,5 @@ export const TransferCryptoDetails = memo(function TransferCryptoDetails({ order
|
|
|
66
66
|
transition: "stroke-dashoffset 1s linear",
|
|
67
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: () => {
|
|
68
68
|
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), 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 })] }), _jsx("div", { className: "flex flex-col gap-3", children: _jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "w-full py-3", onClick: handleCopyAddress, children: "Copy deposit address" }) })] }));
|
|
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), 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 })] }), _jsx("div", { className: "flex flex-col gap-3", children: _jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "w-full py-3", onClick: handleCopyAddress, children: "Copy deposit address" }) })] }));
|
|
70
70
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
interface AnyspendProviderProps {
|
|
3
3
|
children: ReactNode;
|
|
4
|
+
simDuneApiKey?: string;
|
|
4
5
|
}
|
|
5
6
|
/**
|
|
6
7
|
* AnyspendProvider is a top-level provider that wraps your application to provide
|
|
@@ -24,5 +25,5 @@ interface AnyspendProviderProps {
|
|
|
24
25
|
* }
|
|
25
26
|
* ```
|
|
26
27
|
*/
|
|
27
|
-
export declare const AnyspendProvider: ({ children }: AnyspendProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare const AnyspendProvider: ({ children, simDuneApiKey }: AnyspendProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
29
|
export {};
|
|
@@ -4,6 +4,7 @@ import { TooltipProvider } from "../../../global-account/react/index.js";
|
|
|
4
4
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
5
5
|
import { useState } from "react";
|
|
6
6
|
import { StripeRedirectHandler } from "./StripeRedirectHandler.js";
|
|
7
|
+
import { RelayKitProviderWrapper } from "./RelayKitProviderWrapper.js";
|
|
7
8
|
const defaultQueryClientConfig = {
|
|
8
9
|
defaultOptions: {
|
|
9
10
|
queries: {
|
|
@@ -35,7 +36,7 @@ const defaultQueryClientConfig = {
|
|
|
35
36
|
* }
|
|
36
37
|
* ```
|
|
37
38
|
*/
|
|
38
|
-
export const AnyspendProvider = function AnyspendProvider({ children }) {
|
|
39
|
+
export const AnyspendProvider = function AnyspendProvider({ children, simDuneApiKey }) {
|
|
39
40
|
const [queryClient] = useState(() => new QueryClient(defaultQueryClientConfig));
|
|
40
|
-
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsxs(TooltipProvider, { children: [_jsx(StripeRedirectHandler, {}), children] }) }));
|
|
41
|
+
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(RelayKitProviderWrapper, { isMainnet: true, simDuneApiKey: simDuneApiKey, children: _jsxs(TooltipProvider, { children: [_jsx(StripeRedirectHandler, {}), children] }) }) }));
|
|
41
42
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export declare function RelayKitProviderWrapper({ isMainnet, children }: {
|
|
1
|
+
export declare function RelayKitProviderWrapper({ isMainnet, children, simDuneApiKey, }: {
|
|
2
2
|
isMainnet: boolean;
|
|
3
3
|
children: React.ReactNode;
|
|
4
|
+
simDuneApiKey?: string;
|
|
4
5
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,7 +2,7 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { RelayKitProvider } from "@reservoir0x/relay-kit-ui";
|
|
3
3
|
import { fetchChainConfigs, MAINNET_RELAY_API, TESTNET_RELAY_API } from "@reservoir0x/relay-sdk";
|
|
4
4
|
import { useEffect, useState } from "react";
|
|
5
|
-
export function RelayKitProviderWrapper({ isMainnet, children }) {
|
|
5
|
+
export function RelayKitProviderWrapper({ isMainnet, children, simDuneApiKey, }) {
|
|
6
6
|
const [relayChains, setRelayChains] = useState([]);
|
|
7
7
|
useEffect(() => {
|
|
8
8
|
const fetchChains = async () => {
|
|
@@ -15,8 +15,8 @@ export function RelayKitProviderWrapper({ isMainnet, children }) {
|
|
|
15
15
|
baseApiUrl: isMainnet ? MAINNET_RELAY_API : TESTNET_RELAY_API,
|
|
16
16
|
source: "anyspend",
|
|
17
17
|
duneConfig: {
|
|
18
|
-
apiKey:
|
|
19
|
-
apiBaseUrl: "https://api.dune.com",
|
|
18
|
+
apiKey: simDuneApiKey,
|
|
19
|
+
apiBaseUrl: "https://api.sim.dune.com",
|
|
20
20
|
},
|
|
21
21
|
chains: relayChains,
|
|
22
22
|
privateChainIds: undefined,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { components } from "../../anyspend/types/api";
|
|
1
2
|
import { Account, Chain, PublicClient, Transport, WalletClient } from "viem";
|
|
2
3
|
import { ChainType, IBaseChain, IEVMChain, ISolanaChain } from "../types/chain";
|
|
3
|
-
import { components } from "../../anyspend/types/api";
|
|
4
4
|
export declare const EVM_MAINNET: Record<number, IEVMChain>;
|
|
5
5
|
export declare const EVM_TESTNET: Record<number, IEVMChain>;
|
|
6
6
|
export declare const SOLANA_MAINNET: ISolanaChain;
|
|
@@ -18,7 +18,7 @@ export declare function isMainnet(chainId: number): boolean;
|
|
|
18
18
|
export declare function isTestnet(chainId: number): boolean;
|
|
19
19
|
export declare function getDefaultToken(chainId: number): components["schemas"]["Token"];
|
|
20
20
|
export declare function getChainName(chainId: number): string;
|
|
21
|
-
export declare function getPaymentUrl(address: string, amount: bigint, currency: string): string;
|
|
21
|
+
export declare function getPaymentUrl(address: string, amount: bigint, currency: string, chainId: number): string;
|
|
22
22
|
export declare function getExplorerTxUrl(chainId: number, txHash: string): string;
|
|
23
23
|
export declare function getExplorerAddressUrl(chainId: number, address: string): string;
|
|
24
24
|
export declare function getMulticall3Address(chainId: number): string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { RELAY_SOLANA_MAINNET_CHAIN_ID } from "../../anyspend/constants/index.js";
|
|
1
2
|
import invariant from "invariant";
|
|
2
3
|
import { createPublicClient, createWalletClient, defineChain, http, parseEther, } from "viem";
|
|
3
4
|
import { arbitrum, avalanche, b3, b3Sepolia, base, baseSepolia, bsc, mainnet, optimism, polygon, sepolia, } from "viem/chains";
|
|
4
|
-
import { RELAY_SOLANA_MAINNET_CHAIN_ID } from "../../anyspend/constants/index.js";
|
|
5
|
-
import { getAvaxToken, getBnbToken, getEthToken, getPolToken, getSolanaToken } from "./token.js";
|
|
6
5
|
import { ChainType } from "../types/chain.js";
|
|
6
|
+
import { getAvaxToken, getBnbToken, getEthToken, getPolToken, getSolanaToken } from "./token.js";
|
|
7
7
|
function getCustomEvmChain(chain, rpcUrl) {
|
|
8
8
|
return defineChain({ ...chain, rpcUrls: { default: { http: [rpcUrl] } } });
|
|
9
9
|
}
|
|
@@ -237,11 +237,46 @@ export function getChainName(chainId) {
|
|
|
237
237
|
invariant(ALL_CHAINS[chainId], `Chain ${chainId} is not supported`);
|
|
238
238
|
return EVM_CHAINS[chainId] ? EVM_CHAINS[chainId].viem.name : "Solana";
|
|
239
239
|
}
|
|
240
|
-
export function getPaymentUrl(address, amount, currency) {
|
|
241
|
-
|
|
242
|
-
|
|
240
|
+
export function getPaymentUrl(address, amount, currency, chainId) {
|
|
241
|
+
// Get chain type to determine URL format
|
|
242
|
+
const chainType = getChainType(chainId);
|
|
243
|
+
const chain = ALL_CHAINS[chainId];
|
|
244
|
+
invariant(chain, `Chain ${chainId} is not supported`);
|
|
245
|
+
switch (chainType) {
|
|
246
|
+
case ChainType.EVM: {
|
|
247
|
+
// For EVM chains, follow EIP-681 format
|
|
248
|
+
// Format: ethereum:[address]@[chainId]?value=[amount]&symbol=[symbol]
|
|
249
|
+
const params = new URLSearchParams();
|
|
250
|
+
// Add value for native token transfers
|
|
251
|
+
if (currency === chain.nativeToken.symbol) {
|
|
252
|
+
params.append("value", amount.toString());
|
|
253
|
+
}
|
|
254
|
+
// Add chain ID for non-Ethereum chains
|
|
255
|
+
const chainParam = chainId !== mainnet.id ? `@${chainId}` : "";
|
|
256
|
+
// Add token info for non-native token transfers
|
|
257
|
+
if (currency !== chain.nativeToken.symbol) {
|
|
258
|
+
params.append("symbol", currency);
|
|
259
|
+
}
|
|
260
|
+
const queryString = params.toString();
|
|
261
|
+
return `ethereum:${address}${chainParam}${queryString ? `?${queryString}` : ""}`;
|
|
262
|
+
}
|
|
263
|
+
case ChainType.SOLANA: {
|
|
264
|
+
// Solana URL format: solana:${address}?amount=${amount}&spl-token=${tokenAddress}
|
|
265
|
+
const params = new URLSearchParams();
|
|
266
|
+
// Add amount for native SOL transfers
|
|
267
|
+
if (currency === "SOL") {
|
|
268
|
+
params.append("amount", amount.toString());
|
|
269
|
+
}
|
|
270
|
+
// Add SPL token info for token transfers
|
|
271
|
+
if (currency !== "SOL") {
|
|
272
|
+
params.append("spl-token", currency); // currency here should be token address
|
|
273
|
+
}
|
|
274
|
+
return `solana:${address}?${params.toString()}`;
|
|
275
|
+
}
|
|
276
|
+
default:
|
|
277
|
+
// Fallback to just the address if chain type is unknown
|
|
278
|
+
return address;
|
|
243
279
|
}
|
|
244
|
-
return `ethereum:${address}`;
|
|
245
280
|
}
|
|
246
281
|
export function getExplorerTxUrl(chainId, txHash) {
|
|
247
282
|
if (chainId === b3.id) {
|
|
@@ -6,8 +6,7 @@ export declare const wagmiConfig: import("wagmi").Config<readonly [import("viem"
|
|
|
6
6
|
/**
|
|
7
7
|
* Main B3Provider component
|
|
8
8
|
*/
|
|
9
|
-
export declare function B3Provider({
|
|
10
|
-
isMainnetAnySpend?: boolean;
|
|
9
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, }: {
|
|
11
10
|
theme: "light" | "dark";
|
|
12
11
|
children: React.ReactNode;
|
|
13
12
|
accountOverride?: Account;
|
|
@@ -6,7 +6,6 @@ import { useCallback, useEffect, useState } from "react";
|
|
|
6
6
|
import { Toaster } from "sonner";
|
|
7
7
|
import { getLastAuthProvider, ThirdwebProvider, useActiveAccount, useConnectedWallets, useSetActiveWallet, } from "thirdweb/react";
|
|
8
8
|
import { createConfig, http, WagmiProvider } from "wagmi";
|
|
9
|
-
import { RelayKitProviderWrapper } from "../RelayKitProviderWrapper.js";
|
|
10
9
|
import { StyleRoot } from "../StyleRoot.js";
|
|
11
10
|
import { B3Context } from "./types.js";
|
|
12
11
|
import "@reservoir0x/relay-kit-ui/styles.css";
|
|
@@ -28,8 +27,8 @@ const queryClient = new QueryClient();
|
|
|
28
27
|
/**
|
|
29
28
|
* Main B3Provider component
|
|
30
29
|
*/
|
|
31
|
-
export function B3Provider({
|
|
32
|
-
return (_jsx(WagmiProvider, { config: wagmiConfig, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(ThirdwebProvider, { children: _jsx(TooltipProvider, { children:
|
|
30
|
+
export function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, }) {
|
|
31
|
+
return (_jsx(WagmiProvider, { config: wagmiConfig, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(ThirdwebProvider, { children: _jsx(TooltipProvider, { children: _jsxs(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, children: [children, _jsx(StyleRoot, { id: "b3-root" }), _jsx(Toaster, { theme: theme })] }) }) }) }) }));
|
|
33
32
|
}
|
|
34
33
|
/**
|
|
35
34
|
* Inner provider component that provides the actual B3Context
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export { B3DynamicModal } from "./B3DynamicModal";
|
|
2
2
|
export { B3Provider, InnerProvider } from "./B3Provider/B3Provider";
|
|
3
|
-
export { useB3 } from "./B3Provider/useB3";
|
|
4
3
|
export { B3Context, type B3ContextType } from "./B3Provider/types";
|
|
5
|
-
export {
|
|
4
|
+
export { useB3 } from "./B3Provider/useB3";
|
|
6
5
|
export { StyleRoot } from "./StyleRoot";
|
|
7
6
|
export { AuthButton } from "./SignInWithB3/components/AuthButton";
|
|
8
7
|
export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// Core Components
|
|
2
2
|
export { B3DynamicModal } from "./B3DynamicModal.js";
|
|
3
3
|
export { B3Provider, InnerProvider } from "./B3Provider/B3Provider.js";
|
|
4
|
-
export { useB3 } from "./B3Provider/useB3.js";
|
|
5
4
|
export { B3Context } from "./B3Provider/types.js";
|
|
6
|
-
export {
|
|
5
|
+
export { useB3 } from "./B3Provider/useB3.js";
|
|
7
6
|
export { StyleRoot } from "./StyleRoot.js";
|
|
8
7
|
// SignInWithB3 Components
|
|
9
8
|
export { AuthButton } from "./SignInWithB3/components/AuthButton.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
interface AnyspendProviderProps {
|
|
3
3
|
children: ReactNode;
|
|
4
|
+
simDuneApiKey?: string;
|
|
4
5
|
}
|
|
5
6
|
/**
|
|
6
7
|
* AnyspendProvider is a top-level provider that wraps your application to provide
|
|
@@ -24,5 +25,5 @@ interface AnyspendProviderProps {
|
|
|
24
25
|
* }
|
|
25
26
|
* ```
|
|
26
27
|
*/
|
|
27
|
-
export declare const AnyspendProvider: ({ children }: AnyspendProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare const AnyspendProvider: ({ children, simDuneApiKey }: AnyspendProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
29
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export declare function RelayKitProviderWrapper({ isMainnet, children }: {
|
|
1
|
+
export declare function RelayKitProviderWrapper({ isMainnet, children, simDuneApiKey, }: {
|
|
2
2
|
isMainnet: boolean;
|
|
3
3
|
children: React.ReactNode;
|
|
4
|
+
simDuneApiKey?: string;
|
|
4
5
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
1
2
|
import { Account, Chain, PublicClient, Transport, WalletClient } from "viem";
|
|
2
3
|
import { ChainType, IBaseChain, IEVMChain, ISolanaChain } from "../types/chain";
|
|
3
|
-
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
4
4
|
export declare const EVM_MAINNET: Record<number, IEVMChain>;
|
|
5
5
|
export declare const EVM_TESTNET: Record<number, IEVMChain>;
|
|
6
6
|
export declare const SOLANA_MAINNET: ISolanaChain;
|
|
@@ -18,7 +18,7 @@ export declare function isMainnet(chainId: number): boolean;
|
|
|
18
18
|
export declare function isTestnet(chainId: number): boolean;
|
|
19
19
|
export declare function getDefaultToken(chainId: number): components["schemas"]["Token"];
|
|
20
20
|
export declare function getChainName(chainId: number): string;
|
|
21
|
-
export declare function getPaymentUrl(address: string, amount: bigint, currency: string): string;
|
|
21
|
+
export declare function getPaymentUrl(address: string, amount: bigint, currency: string, chainId: number): string;
|
|
22
22
|
export declare function getExplorerTxUrl(chainId: number, txHash: string): string;
|
|
23
23
|
export declare function getExplorerAddressUrl(chainId: number, address: string): string;
|
|
24
24
|
export declare function getMulticall3Address(chainId: number): string;
|
|
@@ -6,8 +6,7 @@ export declare const wagmiConfig: import("wagmi").Config<readonly [import("viem"
|
|
|
6
6
|
/**
|
|
7
7
|
* Main B3Provider component
|
|
8
8
|
*/
|
|
9
|
-
export declare function B3Provider({
|
|
10
|
-
isMainnetAnySpend?: boolean;
|
|
9
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, }: {
|
|
11
10
|
theme: "light" | "dark";
|
|
12
11
|
children: React.ReactNode;
|
|
13
12
|
accountOverride?: Account;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export { B3DynamicModal } from "./B3DynamicModal";
|
|
2
2
|
export { B3Provider, InnerProvider } from "./B3Provider/B3Provider";
|
|
3
|
-
export { useB3 } from "./B3Provider/useB3";
|
|
4
3
|
export { B3Context, type B3ContextType } from "./B3Provider/types";
|
|
5
|
-
export {
|
|
4
|
+
export { useB3 } from "./B3Provider/useB3";
|
|
6
5
|
export { StyleRoot } from "./StyleRoot";
|
|
7
6
|
export { AuthButton } from "./SignInWithB3/components/AuthButton";
|
|
8
7
|
export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b3dotfun/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"react-native": "./dist/cjs/index.native.js",
|
|
@@ -209,8 +209,8 @@
|
|
|
209
209
|
"@radix-ui/react-slot": "1.1.2",
|
|
210
210
|
"@radix-ui/react-tabs": "1.1.3",
|
|
211
211
|
"@radix-ui/react-tooltip": "1.1.8",
|
|
212
|
-
"@reservoir0x/relay-kit-ui": "2.15.
|
|
213
|
-
"@reservoir0x/relay-sdk": "2.3.
|
|
212
|
+
"@reservoir0x/relay-kit-ui": "2.15.9",
|
|
213
|
+
"@reservoir0x/relay-sdk": "2.3.1",
|
|
214
214
|
"@reservoir0x/reservoir-kit-ui": "2.8.7",
|
|
215
215
|
"@solana/spl-token": "^0.4.13",
|
|
216
216
|
"@solana/web3.js": "^1.98.2",
|
|
@@ -1068,6 +1068,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
1068
1068
|
order.globalAddress,
|
|
1069
1069
|
BigInt(order.srcAmount),
|
|
1070
1070
|
order.srcTokenAddress === RELAY_ETH_ADDRESS ? "ETH" : order.srcTokenAddress,
|
|
1071
|
+
order.srcChain,
|
|
1071
1072
|
)}
|
|
1072
1073
|
className="max-w-[200px]"
|
|
1073
1074
|
/>
|
|
@@ -194,6 +194,7 @@ export const TransferCryptoDetails = memo(function TransferCryptoDetails({
|
|
|
194
194
|
order.globalAddress,
|
|
195
195
|
BigInt(order.srcAmount),
|
|
196
196
|
order.srcTokenAddress === RELAY_ETH_ADDRESS ? "ETH" : order.srcTokenAddress,
|
|
197
|
+
order.srcChain,
|
|
197
198
|
)}
|
|
198
199
|
className="bg-as-surface-secondary max-h-48 max-w-48"
|
|
199
200
|
/>
|
|
@@ -4,9 +4,11 @@ import { TooltipProvider } from "@b3dotfun/sdk/global-account/react";
|
|
|
4
4
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
5
5
|
import { ReactNode, useState } from "react";
|
|
6
6
|
import { StripeRedirectHandler } from "./StripeRedirectHandler";
|
|
7
|
+
import { RelayKitProviderWrapper } from "./RelayKitProviderWrapper";
|
|
7
8
|
|
|
8
9
|
interface AnyspendProviderProps {
|
|
9
10
|
children: ReactNode;
|
|
11
|
+
simDuneApiKey?: string;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
const defaultQueryClientConfig = {
|
|
@@ -41,15 +43,17 @@ const defaultQueryClientConfig = {
|
|
|
41
43
|
* }
|
|
42
44
|
* ```
|
|
43
45
|
*/
|
|
44
|
-
export const AnyspendProvider = function AnyspendProvider({ children }: AnyspendProviderProps) {
|
|
46
|
+
export const AnyspendProvider = function AnyspendProvider({ children, simDuneApiKey }: AnyspendProviderProps) {
|
|
45
47
|
const [queryClient] = useState(() => new QueryClient(defaultQueryClientConfig));
|
|
46
48
|
|
|
47
49
|
return (
|
|
48
50
|
<QueryClientProvider client={queryClient}>
|
|
49
|
-
<
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
<RelayKitProviderWrapper isMainnet={true} simDuneApiKey={simDuneApiKey}>
|
|
52
|
+
<TooltipProvider>
|
|
53
|
+
<StripeRedirectHandler />
|
|
54
|
+
{children}
|
|
55
|
+
</TooltipProvider>
|
|
56
|
+
</RelayKitProviderWrapper>
|
|
53
57
|
</QueryClientProvider>
|
|
54
58
|
);
|
|
55
59
|
};
|
package/src/{global-account/react/components → anyspend/react/providers}/RelayKitProviderWrapper.tsx
RENAMED
|
@@ -2,7 +2,15 @@ import { RelayKitProvider } from "@reservoir0x/relay-kit-ui";
|
|
|
2
2
|
import { fetchChainConfigs, MAINNET_RELAY_API, RelayChain, TESTNET_RELAY_API } from "@reservoir0x/relay-sdk";
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
4
|
|
|
5
|
-
export function RelayKitProviderWrapper({
|
|
5
|
+
export function RelayKitProviderWrapper({
|
|
6
|
+
isMainnet,
|
|
7
|
+
children,
|
|
8
|
+
simDuneApiKey,
|
|
9
|
+
}: {
|
|
10
|
+
isMainnet: boolean;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
simDuneApiKey?: string;
|
|
13
|
+
}) {
|
|
6
14
|
const [relayChains, setRelayChains] = useState<RelayChain[]>([]);
|
|
7
15
|
|
|
8
16
|
useEffect(() => {
|
|
@@ -19,8 +27,8 @@ export function RelayKitProviderWrapper({ isMainnet, children }: { isMainnet: bo
|
|
|
19
27
|
baseApiUrl: isMainnet ? MAINNET_RELAY_API : TESTNET_RELAY_API,
|
|
20
28
|
source: "anyspend",
|
|
21
29
|
duneConfig: {
|
|
22
|
-
apiKey:
|
|
23
|
-
apiBaseUrl: "https://api.dune.com",
|
|
30
|
+
apiKey: simDuneApiKey,
|
|
31
|
+
apiBaseUrl: "https://api.sim.dune.com",
|
|
24
32
|
},
|
|
25
33
|
chains: relayChains,
|
|
26
34
|
privateChainIds: undefined,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { RELAY_SOLANA_MAINNET_CHAIN_ID } from "@b3dotfun/sdk/anyspend/constants";
|
|
2
|
+
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
1
3
|
import invariant from "invariant";
|
|
2
4
|
import {
|
|
3
5
|
Account,
|
|
@@ -24,10 +26,8 @@ import {
|
|
|
24
26
|
polygon,
|
|
25
27
|
sepolia,
|
|
26
28
|
} from "viem/chains";
|
|
27
|
-
import { RELAY_SOLANA_MAINNET_CHAIN_ID } from "@b3dotfun/sdk/anyspend/constants";
|
|
28
|
-
import { getAvaxToken, getBnbToken, getEthToken, getPolToken, getSolanaToken } from "./token";
|
|
29
29
|
import { ChainType, IBaseChain, IEVMChain, ISolanaChain } from "../types/chain";
|
|
30
|
-
import {
|
|
30
|
+
import { getAvaxToken, getBnbToken, getEthToken, getPolToken, getSolanaToken } from "./token";
|
|
31
31
|
|
|
32
32
|
function getCustomEvmChain(chain: Chain, rpcUrl: string): Chain {
|
|
33
33
|
return defineChain({ ...chain, rpcUrls: { default: { http: [rpcUrl] } } });
|
|
@@ -304,11 +304,56 @@ export function getChainName(chainId: number): string {
|
|
|
304
304
|
return EVM_CHAINS[chainId] ? EVM_CHAINS[chainId].viem.name : "Solana";
|
|
305
305
|
}
|
|
306
306
|
|
|
307
|
-
export function getPaymentUrl(address: string, amount: bigint, currency: string) {
|
|
308
|
-
|
|
309
|
-
|
|
307
|
+
export function getPaymentUrl(address: string, amount: bigint, currency: string, chainId: number) {
|
|
308
|
+
// Get chain type to determine URL format
|
|
309
|
+
const chainType = getChainType(chainId);
|
|
310
|
+
const chain = ALL_CHAINS[chainId];
|
|
311
|
+
invariant(chain, `Chain ${chainId} is not supported`);
|
|
312
|
+
|
|
313
|
+
switch (chainType) {
|
|
314
|
+
case ChainType.EVM: {
|
|
315
|
+
// For EVM chains, follow EIP-681 format
|
|
316
|
+
// Format: ethereum:[address]@[chainId]?value=[amount]&symbol=[symbol]
|
|
317
|
+
const params = new URLSearchParams();
|
|
318
|
+
|
|
319
|
+
// Add value for native token transfers
|
|
320
|
+
if (currency === chain.nativeToken.symbol) {
|
|
321
|
+
params.append("value", amount.toString());
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// Add chain ID for non-Ethereum chains
|
|
325
|
+
const chainParam = chainId !== mainnet.id ? `@${chainId}` : "";
|
|
326
|
+
|
|
327
|
+
// Add token info for non-native token transfers
|
|
328
|
+
if (currency !== chain.nativeToken.symbol) {
|
|
329
|
+
params.append("symbol", currency);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
const queryString = params.toString();
|
|
333
|
+
return `ethereum:${address}${chainParam}${queryString ? `?${queryString}` : ""}`;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
case ChainType.SOLANA: {
|
|
337
|
+
// Solana URL format: solana:${address}?amount=${amount}&spl-token=${tokenAddress}
|
|
338
|
+
const params = new URLSearchParams();
|
|
339
|
+
|
|
340
|
+
// Add amount for native SOL transfers
|
|
341
|
+
if (currency === "SOL") {
|
|
342
|
+
params.append("amount", amount.toString());
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// Add SPL token info for token transfers
|
|
346
|
+
if (currency !== "SOL") {
|
|
347
|
+
params.append("spl-token", currency); // currency here should be token address
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
return `solana:${address}?${params.toString()}`;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
default:
|
|
354
|
+
// Fallback to just the address if chain type is unknown
|
|
355
|
+
return address;
|
|
310
356
|
}
|
|
311
|
-
return `ethereum:${address}`;
|
|
312
357
|
}
|
|
313
358
|
|
|
314
359
|
export function getExplorerTxUrl(chainId: number, txHash: string) {
|
|
@@ -3,7 +3,6 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { ThirdwebProvider, useActiveAccount } from "thirdweb/react";
|
|
5
5
|
import { Account } from "thirdweb/wallets";
|
|
6
|
-
// import { RelayKitProviderWrapper } from "./RelayKitProviderWrapper";
|
|
7
6
|
|
|
8
7
|
import { User } from "@b3dotfun/sdk/global-account/types/b3-api.types";
|
|
9
8
|
import { B3Context, B3ContextType } from "./types";
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
} from "thirdweb/react";
|
|
15
15
|
import { Account, Wallet } from "thirdweb/wallets";
|
|
16
16
|
import { createConfig, http, WagmiProvider } from "wagmi";
|
|
17
|
-
import { RelayKitProviderWrapper } from "../RelayKitProviderWrapper";
|
|
18
17
|
import { StyleRoot } from "../StyleRoot";
|
|
19
18
|
import { B3Context, B3ContextType } from "./types";
|
|
20
19
|
|
|
@@ -42,14 +41,12 @@ const queryClient = new QueryClient();
|
|
|
42
41
|
* Main B3Provider component
|
|
43
42
|
*/
|
|
44
43
|
export function B3Provider({
|
|
45
|
-
isMainnetAnySpend = true,
|
|
46
44
|
theme = "light",
|
|
47
45
|
children,
|
|
48
46
|
accountOverride,
|
|
49
47
|
environment,
|
|
50
48
|
automaticallySetFirstEoa,
|
|
51
49
|
}: {
|
|
52
|
-
isMainnetAnySpend?: boolean;
|
|
53
50
|
theme: "light" | "dark";
|
|
54
51
|
children: React.ReactNode;
|
|
55
52
|
accountOverride?: Account;
|
|
@@ -67,12 +64,10 @@ export function B3Provider({
|
|
|
67
64
|
theme={theme}
|
|
68
65
|
automaticallySetFirstEoa={!!automaticallySetFirstEoa}
|
|
69
66
|
>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
<Toaster theme={theme} />
|
|
75
|
-
</RelayKitProviderWrapper>
|
|
67
|
+
{children}
|
|
68
|
+
{/* For the modal https://github.com/b3-fun/b3/blob/main/packages/sdk/src/global-account/react/components/ui/dialog.tsx#L46 */}
|
|
69
|
+
<StyleRoot id="b3-root" />
|
|
70
|
+
<Toaster theme={theme} />
|
|
76
71
|
</InnerProvider>
|
|
77
72
|
</TooltipProvider>
|
|
78
73
|
</ThirdwebProvider>
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// Core Components
|
|
2
2
|
export { B3DynamicModal } from "./B3DynamicModal";
|
|
3
3
|
export { B3Provider, InnerProvider } from "./B3Provider/B3Provider";
|
|
4
|
-
export { useB3 } from "./B3Provider/useB3";
|
|
5
4
|
export { B3Context, type B3ContextType } from "./B3Provider/types";
|
|
6
|
-
export {
|
|
5
|
+
export { useB3 } from "./B3Provider/useB3";
|
|
7
6
|
export { StyleRoot } from "./StyleRoot";
|
|
8
7
|
|
|
9
8
|
// SignInWithB3 Components
|