@b3dotfun/sdk 0.0.84-alpha.0 → 0.0.84-alpha.2

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.
Files changed (47) hide show
  1. package/dist/cjs/anyspend/constants/index.d.ts +6 -0
  2. package/dist/cjs/anyspend/constants/index.js +13 -0
  3. package/dist/cjs/anyspend/react/components/AnySpend.js +4 -2
  4. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +2 -1
  5. package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +2 -2
  6. package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +2 -0
  7. package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.js +2 -2
  8. package/dist/cjs/anyspend/utils/token.d.ts +6 -0
  9. package/dist/cjs/anyspend/utils/token.js +9 -3
  10. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +5 -2
  11. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +4 -3
  12. package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +1 -0
  13. package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +2 -2
  14. package/dist/cjs/shared/utils/payment.utils.d.ts +5 -1
  15. package/dist/cjs/shared/utils/payment.utils.js +13 -5
  16. package/dist/esm/anyspend/constants/index.d.ts +6 -0
  17. package/dist/esm/anyspend/constants/index.js +12 -0
  18. package/dist/esm/anyspend/react/components/AnySpend.js +5 -3
  19. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +2 -1
  20. package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +2 -2
  21. package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +2 -0
  22. package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.js +2 -2
  23. package/dist/esm/anyspend/utils/token.d.ts +6 -0
  24. package/dist/esm/anyspend/utils/token.js +8 -2
  25. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +5 -2
  26. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +4 -3
  27. package/dist/esm/global-account/react/components/B3Provider/types.d.ts +1 -0
  28. package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +2 -2
  29. package/dist/esm/shared/utils/payment.utils.d.ts +5 -1
  30. package/dist/esm/shared/utils/payment.utils.js +14 -6
  31. package/dist/types/anyspend/constants/index.d.ts +6 -0
  32. package/dist/types/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +2 -0
  33. package/dist/types/anyspend/utils/token.d.ts +6 -0
  34. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +5 -2
  35. package/dist/types/global-account/react/components/B3Provider/types.d.ts +1 -0
  36. package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +2 -2
  37. package/dist/types/shared/utils/payment.utils.d.ts +5 -1
  38. package/package.json +1 -1
  39. package/src/anyspend/constants/index.ts +13 -0
  40. package/src/anyspend/react/components/AnySpend.tsx +7 -2
  41. package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +16 -5
  42. package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +2 -2
  43. package/src/anyspend/react/components/webview/WebviewOnrampPayment.tsx +4 -1
  44. package/src/anyspend/utils/token.ts +9 -2
  45. package/src/global-account/react/components/B3Provider/B3Provider.tsx +7 -0
  46. package/src/global-account/react/components/B3Provider/types.ts +1 -0
  47. package/src/shared/utils/payment.utils.ts +16 -6
@@ -25,6 +25,12 @@ export declare const DEFAULT_NFT_CONTRACT: {
25
25
  export declare const STRIPE_CONFIG: {
26
26
  readonly publishableKey: "pk_live_51QkrBwJnoDg53PsPq7QYOxSLfnXvtCVeD9UuyZ6c136i42XtYC2Z2bl1W5xbDg6AaoGyq63ErCc0yv3C2KBX29CG002AE862CP";
27
27
  };
28
+ /**
29
+ * Get the appropriate Stripe publishable key.
30
+ * If a custom key is provided (via B3Provider stripePublishableKey prop), use it.
31
+ * Otherwise, fall back to the default B3 Stripe account.
32
+ */
33
+ export declare function getStripePublishableKey(customKey?: string | null): string;
28
34
  export declare const PAYMENT_METHOD_ICONS: {
29
35
  readonly visa: "https://github.com/marcovoliveira/react-svg-credit-card-payment-icons/raw/main/src/icons/flat-rounded/visa.svg";
30
36
  readonly mastercard: "https://github.com/marcovoliveira/react-svg-credit-card-payment-icons/raw/main/src/icons/flat-rounded/mastercard.svg";
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VENDOR_DISPLAY_NAMES = exports.PAYMENT_METHOD_ICONS = exports.STRIPE_CONFIG = exports.DEFAULT_NFT_CONTRACT = exports.NFT_CONTRACTS = exports.ETH_BASE = exports.USDC_BASE = exports.ANYSPEND_TOKEN = exports.B3_TOKEN = exports.SOLANA_TOKEN_2022_PROGRAM_ID = exports.SOLANA_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = exports.RELAY_SOLANA_MAINNET_CHAIN_ID = exports.RELAY_SOL_ADDRESS = exports.ZERO_ADDRESS = exports.ANYSPEND_MAINNET_BASE_URL = void 0;
4
+ exports.getStripePublishableKey = getStripePublishableKey;
4
5
  const chains_1 = require("viem/chains");
5
6
  exports.ANYSPEND_MAINNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://mainnet.anyspend.com";
6
7
  exports.ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
@@ -75,9 +76,21 @@ exports.NFT_CONTRACTS = [
75
76
  },
76
77
  ];
77
78
  exports.DEFAULT_NFT_CONTRACT = exports.NFT_CONTRACTS[1];
79
+ // Default B3 Stripe publishable key
78
80
  exports.STRIPE_CONFIG = {
79
81
  publishableKey: "pk_live_51QkrBwJnoDg53PsPq7QYOxSLfnXvtCVeD9UuyZ6c136i42XtYC2Z2bl1W5xbDg6AaoGyq63ErCc0yv3C2KBX29CG002AE862CP",
80
82
  };
83
+ /**
84
+ * Get the appropriate Stripe publishable key.
85
+ * If a custom key is provided (via B3Provider stripePublishableKey prop), use it.
86
+ * Otherwise, fall back to the default B3 Stripe account.
87
+ */
88
+ function getStripePublishableKey(customKey) {
89
+ if (customKey) {
90
+ return customKey;
91
+ }
92
+ return exports.STRIPE_CONFIG.publishableKey;
93
+ }
81
94
  exports.PAYMENT_METHOD_ICONS = {
82
95
  visa: "https://github.com/marcovoliveira/react-svg-credit-card-payment-icons/raw/main/src/icons/flat-rounded/visa.svg",
83
96
  mastercard: "https://github.com/marcovoliveira/react-svg-credit-card-payment-icons/raw/main/src/icons/flat-rounded/mastercard.svg",
@@ -113,9 +113,11 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
113
113
  const [srcAmountOnRamp, setSrcAmountOnRamp] = (0, react_4.useState)(searchParams.get("fromAmount") || "5");
114
114
  // State for destination chain/token selection
115
115
  const [selectedDstChainId, setSelectedDstChainId] = (0, react_4.useState)(initialDstChainId);
116
+ // Helper to check if address is Hyperliquid USDC (supports both 34-char and 42-char formats)
117
+ const isHyperliquidUSDCAddress = (address) => (0, anyspend_1.eqci)(address, anyspend_1.HYPERLIQUID_USDC_ADDRESS) || (0, anyspend_1.eqci)(address, anyspend_1.ZERO_ADDRESS);
116
118
  const defaultDstToken = isBuyMode
117
119
  ? // Special case: Hyperliquid uses zero address for USDC
118
- destinationTokenChainId === anyspend_1.HYPERLIQUID_CHAIN_ID && (0, anyspend_1.eqci)(destinationTokenAddress, anyspend_1.ZERO_ADDRESS)
120
+ destinationTokenChainId === anyspend_1.HYPERLIQUID_CHAIN_ID && isHyperliquidUSDCAddress(destinationTokenAddress)
119
121
  ? (0, anyspend_1.getHyperliquidUSDCToken)()
120
122
  : {
121
123
  symbol: "",
@@ -163,7 +165,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
163
165
  (0, react_4.useEffect)(() => {
164
166
  if (selectedDstToken && dstTokenMetadata && !appliedDstMetadataRef.current) {
165
167
  // Skip metadata enhancement for Hyperliquid USDC - we already have correct metadata from getHyperliquidUSDCToken()
166
- if (selectedDstToken.chainId === anyspend_1.HYPERLIQUID_CHAIN_ID && (0, anyspend_1.eqci)(selectedDstToken.address, anyspend_1.ZERO_ADDRESS)) {
168
+ if (selectedDstToken.chainId === anyspend_1.HYPERLIQUID_CHAIN_ID && isHyperliquidUSDCAddress(selectedDstToken.address)) {
167
169
  appliedDstMetadataRef.current = true;
168
170
  return;
169
171
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CryptoReceiveSection = CryptoReceiveSection;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const anyspend_1 = require("../../../../anyspend");
5
6
  const utils_1 = require("../../../../shared/utils");
6
7
  const cn_1 = require("../../../../shared/utils/cn");
7
8
  const formatAddress_1 = require("../../../../shared/utils/formatAddress");
@@ -13,7 +14,7 @@ const PointsBadge_1 = require("./PointsBadge");
13
14
  function CryptoReceiveSection({ isDepositMode = false, isBuyMode = false, effectiveRecipientAddress, recipientName, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, isSrcInputDirty, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, onShowPointsDetail, onShowFeeDetail, }) {
14
15
  return ((0, jsx_runtime_1.jsxs)(react_1.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "receive-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex w-full items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-as-primary/50 flex h-7 items-center gap-1.5 text-sm", children: [isDepositMode ? "Deposit" : "Receive", isSrcInputDirty && anyspendQuote?.data?.fee && onShowFeeDetail && ((0, jsx_runtime_1.jsx)("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Info, { className: "h-4 w-4" }) }))] }), effectiveRecipientAddress ? ((0, jsx_runtime_1.jsx)("button", { className: (0, cn_1.cn)("text-as-tertiarry flex h-7 items-center gap-2 rounded-lg"), onClick: onSelectRecipient, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-tertiarry flex items-center gap-1 text-sm", children: recipientName ? (0, utils_1.formatUsername)(recipientName) : (0, formatAddress_1.shortenAddress)(effectiveRecipientAddress || "") }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "h-4 w-4" })] }) })) : ((0, jsx_runtime_1.jsx)("button", { className: "text-as-primary/70 flex items-center gap-1 rounded-lg", onClick: onSelectRecipient, children: (0, jsx_runtime_1.jsx)("div", { className: "text-sm font-medium", children: "Select recipient" }) }))] }), isBuyMode || isDepositMode ? (
15
16
  // Fixed destination token display for buy mode and deposit mode
16
- (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary text-2xl font-bold", children: dstAmount || "0" }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-brand/10 border-as-brand/30 flex items-center gap-3 rounded-xl border px-4 py-3", children: [(dstTokenLogoURI || dstToken.metadata?.logoURI) && ((0, jsx_runtime_1.jsx)("img", { src: dstTokenLogoURI || dstToken.metadata?.logoURI, alt: dstTokenSymbol || dstToken.symbol, className: "h-8 w-8 rounded-full" })), (0, jsx_runtime_1.jsx)("span", { className: "text-as-brand text-lg font-bold", children: dstTokenSymbol || dstToken.symbol })] })] })) : (
17
+ (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary text-2xl font-bold", children: dstAmount || "0" }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-as-brand/10 border-as-brand/30 flex items-center gap-3 rounded-xl border px-4 py-3", children: [(dstTokenLogoURI || dstToken.metadata?.logoURI) && ((0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [(0, jsx_runtime_1.jsx)("img", { src: dstTokenLogoURI || dstToken.metadata?.logoURI, alt: dstTokenSymbol || dstToken.symbol, className: "h-8 w-8 rounded-full" }), anyspend_1.ALL_CHAINS[dstToken.chainId]?.logoUrl && ((0, jsx_runtime_1.jsx)("img", { src: anyspend_1.ALL_CHAINS[dstToken.chainId].logoUrl, alt: "Chain", className: "absolute -bottom-1 -right-1 h-4 w-4 rounded-full border border-white" }))] })), (0, jsx_runtime_1.jsx)("span", { className: "text-as-brand text-lg font-bold", children: dstTokenSymbol || dstToken.symbol })] })] })) : (
17
18
  // Token selection for regular swap mode
18
19
  (0, jsx_runtime_1.jsx)(OrderTokenAmount_1.OrderTokenAmount, { address: effectiveRecipientAddress, context: "to", inputValue: dstAmount, onChangeInput: onChangeDstAmount || (() => { }), chainId: selectedDstChainId || dstToken.chainId, setChainId: setSelectedDstChainId || (() => { }), token: dstToken, setToken: setSelectedDstToken || (() => { }) })), (0, jsx_runtime_1.jsxs)("div", { className: "text-as-primary/50 flex h-5 items-center justify-start gap-2 text-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, number_1.formatDisplayNumber)(anyspendQuote?.data?.currencyOut?.amountUsd, {
19
20
  style: "currency",
@@ -17,7 +17,7 @@ const AnySpendFingerprintWrapper_1 = require("../AnySpendFingerprintWrapper");
17
17
  const HowItWorks_1 = __importDefault(require("./HowItWorks"));
18
18
  const PaymentMethodIcons_1 = __importDefault(require("./PaymentMethodIcons"));
19
19
  function PaymentStripeWeb2({ order, stripePaymentIntentId, onPaymentSuccess }) {
20
- const { theme } = (0, react_2.useB3)();
20
+ const { theme, stripePublishableKey } = (0, react_2.useB3)();
21
21
  const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
22
22
  const { clientSecret, isLoadingStripeClientSecret, stripeClientSecretError } = (0, react_1.useStripeClientSecret)(stripePaymentIntentId);
23
23
  if (isLoadingStripeClientSecret) {
@@ -26,7 +26,7 @@ function PaymentStripeWeb2({ order, stripePaymentIntentId, onPaymentSuccess }) {
26
26
  if (stripeClientSecretError) {
27
27
  return (0, jsx_runtime_1.jsx)(StripeErrorState, { error: stripeClientSecretError.message });
28
28
  }
29
- return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(react_stripe_js_1.Elements, { stripe: (0, payment_utils_1.getStripePromise)(), options: {
29
+ return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(react_stripe_js_1.Elements, { stripe: (0, payment_utils_1.getStripePromise)(stripePublishableKey), options: {
30
30
  clientSecret: clientSecret || undefined,
31
31
  appearance: { theme: theme === "light" ? "stripe" : "night" },
32
32
  }, children: (0, jsx_runtime_1.jsx)(StripePaymentForm, { order: order, clientSecret: clientSecret, onPaymentSuccess: onPaymentSuccess }) }) }));
@@ -5,6 +5,8 @@ interface WebviewOnrampPaymentProps {
5
5
  recipientAddress?: string;
6
6
  destinationToken: components["schemas"]["Token"];
7
7
  partnerId?: string;
8
+ /** Partner-specific Stripe publishable key. If not provided, uses default B3 Stripe account. */
9
+ stripePublishableKey?: string;
8
10
  anyspendQuote: GetQuoteResponse | undefined;
9
11
  onPaymentSuccess: (orderId: string) => void;
10
12
  userId?: string;
@@ -89,7 +89,7 @@ function StripePaymentForm({ order, onPaymentSuccess, }) {
89
89
  },
90
90
  } }) })), error && ((0, jsx_runtime_1.jsx)("div", { className: "mt-4 rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error })), (0, jsx_runtime_1.jsx)("button", { type: "submit", disabled: !stripe || isProcessing, className: "mt-6 w-full rounded-xl bg-blue-600 px-4 py-3 font-medium text-white hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50", children: isProcessing ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-5 w-5 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { children: "Processing..." })] })) : ((0, jsx_runtime_1.jsx)("span", { children: "Complete Payment" })) })] }) }) }));
91
91
  }
92
- function WebviewOnrampPaymentInner({ srcAmountOnRamp, recipientAddress, destinationToken, anyspendQuote, onPaymentSuccess, userId, }) {
92
+ function WebviewOnrampPaymentInner({ srcAmountOnRamp, recipientAddress, destinationToken, stripePublishableKey, anyspendQuote, onPaymentSuccess, userId, }) {
93
93
  const [createdOrder, setCreatedOrder] = (0, react_4.useState)(null);
94
94
  const orderCreationAttempted = (0, react_4.useRef)(false);
95
95
  const { geoData, stripeWeb2Support, isLoading: isLoadingGeoOnramp } = (0, react_1.useGeoOnrampOptions)(srcAmountOnRamp);
@@ -168,7 +168,7 @@ function WebviewOnrampPaymentInner({ srcAmountOnRamp, recipientAddress, destinat
168
168
  if (createdOrder && clientSecret) {
169
169
  return ((0, jsx_runtime_1.jsxs)("div", { className: "mx-auto flex w-full max-w-[460px] flex-col gap-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "overflow-hidden rounded-xl bg-white", children: (0, jsx_runtime_1.jsxs)("div", { className: "px-6 py-4", children: [(0, jsx_runtime_1.jsx)("h2", { className: "mb-4 text-lg font-semibold", children: "Order summary" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col divide-y", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between py-3", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-gray-600", children: "Receiving" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [destinationToken.metadata?.logoURI && ((0, jsx_runtime_1.jsx)("img", { src: destinationToken.metadata.logoURI, alt: destinationToken.symbol, className: "h-5 w-5 rounded-full" })), (0, jsx_runtime_1.jsxs)("span", { className: "font-medium", children: [anyspendQuote?.data?.currencyOut?.amount
170
170
  ? Number((0, viem_1.formatUnits)(BigInt(anyspendQuote.data.currencyOut.amount), destinationToken.decimals)).toFixed(4)
171
- : "0", " ", destinationToken.symbol] })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between py-3", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-gray-600", children: "Network" }), (0, jsx_runtime_1.jsx)("span", { className: "font-medium", children: (0, anyspend_1.getChainName)(destinationToken.chainId) })] }), recipientAddress && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between py-3", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-gray-600", children: "Recipient" }), (0, jsx_runtime_1.jsx)("span", { className: "font-medium", children: (0, centerTruncate_1.default)(recipientAddress) })] })), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between py-3", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-gray-600", children: "You Pay" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-lg font-semibold", children: ["$", parseFloat(srcAmountOnRamp).toFixed(2)] })] })] })] }) }), (0, jsx_runtime_1.jsx)(react_stripe_js_1.Elements, { stripe: (0, payment_utils_1.getStripePromise)(), options: {
171
+ : "0", " ", destinationToken.symbol] })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between py-3", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-gray-600", children: "Network" }), (0, jsx_runtime_1.jsx)("span", { className: "font-medium", children: (0, anyspend_1.getChainName)(destinationToken.chainId) })] }), recipientAddress && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between py-3", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-gray-600", children: "Recipient" }), (0, jsx_runtime_1.jsx)("span", { className: "font-medium", children: (0, centerTruncate_1.default)(recipientAddress) })] })), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between py-3", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-gray-600", children: "You Pay" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-lg font-semibold", children: ["$", parseFloat(srcAmountOnRamp).toFixed(2)] })] })] })] }) }), (0, jsx_runtime_1.jsx)(react_stripe_js_1.Elements, { stripe: (0, payment_utils_1.getStripePromise)(stripePublishableKey), options: {
172
172
  clientSecret,
173
173
  appearance: {
174
174
  theme: "flat",
@@ -1,6 +1,12 @@
1
1
  import { components } from "../../anyspend/types/api";
2
2
  export declare const HYPERLIQUID_CHAIN_ID = 1337;
3
3
  export declare const HYPEREVM_CHAIN_ID = 999;
4
+ /**
5
+ * Hyperliquid uses a special 34-character USDC address format (0x + 32 hex digits)
6
+ * instead of the standard 42-character EVM address format.
7
+ * This is required by Relay SDK for Hyperliquid integration.
8
+ */
9
+ export declare const HYPERLIQUID_USDC_ADDRESS = "0x00000000000000000000000000000000";
4
10
  export declare function isNativeToken(address: string): boolean;
5
11
  export declare function getSolanaToken(): components["schemas"]["Token"];
6
12
  export declare function getEthToken(chainId: number): components["schemas"]["Token"];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HYPEREVM_CHAIN_ID = exports.HYPERLIQUID_CHAIN_ID = void 0;
3
+ exports.HYPERLIQUID_USDC_ADDRESS = exports.HYPEREVM_CHAIN_ID = exports.HYPERLIQUID_CHAIN_ID = void 0;
4
4
  exports.isNativeToken = isNativeToken;
5
5
  exports.getSolanaToken = getSolanaToken;
6
6
  exports.getEthToken = getEthToken;
@@ -13,6 +13,12 @@ const constants_1 = require("../../anyspend/constants");
13
13
  const chains_1 = require("viem/chains");
14
14
  exports.HYPERLIQUID_CHAIN_ID = 1337;
15
15
  exports.HYPEREVM_CHAIN_ID = 999;
16
+ /**
17
+ * Hyperliquid uses a special 34-character USDC address format (0x + 32 hex digits)
18
+ * instead of the standard 42-character EVM address format.
19
+ * This is required by Relay SDK for Hyperliquid integration.
20
+ */
21
+ exports.HYPERLIQUID_USDC_ADDRESS = "0x00000000000000000000000000000000";
16
22
  function isNativeToken(address) {
17
23
  return address.toLowerCase() === constants_1.ZERO_ADDRESS || address.toLowerCase() === constants_1.RELAY_SOL_ADDRESS;
18
24
  }
@@ -91,10 +97,10 @@ function getHyperEVMNativeToken() {
91
97
  function getHyperliquidUSDCToken() {
92
98
  return {
93
99
  chainId: exports.HYPERLIQUID_CHAIN_ID,
94
- address: constants_1.ZERO_ADDRESS,
100
+ address: exports.HYPERLIQUID_USDC_ADDRESS,
95
101
  symbol: "USDC",
96
102
  name: "USD Coin",
97
- decimals: 6,
103
+ decimals: 8, // Hyperliquid USDC uses 8 decimals, not 6
98
104
  metadata: {
99
105
  logoURI: "https://ethereum-optimism.github.io/data/USDC/logo.png",
100
106
  },
@@ -9,7 +9,7 @@ import { B3ContextType } from "./types";
9
9
  /**
10
10
  * Main B3Provider component
11
11
  */
12
- export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, onConnect, connectors, overrideDefaultConnectors, createClientReferenceId, enableTurnkey, }: {
12
+ export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors, createClientReferenceId, enableTurnkey, }: {
13
13
  theme: "light" | "dark";
14
14
  children: React.ReactNode;
15
15
  accountOverride?: Account;
@@ -23,6 +23,8 @@ export declare function B3Provider({ theme, children, accountOverride, environme
23
23
  clientType?: ClientType;
24
24
  rpcUrls?: Record<number, string>;
25
25
  partnerId: string;
26
+ /** Partner-specific Stripe publishable key. If not provided, uses default B3 Stripe account. */
27
+ stripePublishableKey?: string;
26
28
  onConnect?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
27
29
  connectors?: CreateConnectorFn[];
28
30
  overrideDefaultConnectors?: boolean;
@@ -32,7 +34,7 @@ export declare function B3Provider({ theme, children, accountOverride, environme
32
34
  /**
33
35
  * Inner provider component that provides the actual B3Context
34
36
  */
35
- export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, createClientReferenceId, enableTurnkey, }: {
37
+ export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, stripePublishableKey, createClientReferenceId, enableTurnkey, }: {
36
38
  children: React.ReactNode;
37
39
  accountOverride?: Account;
38
40
  environment: B3ContextType["environment"];
@@ -41,6 +43,7 @@ export declare function InnerProvider({ children, accountOverride, environment,
41
43
  theme: "light" | "dark";
42
44
  clientType?: ClientType;
43
45
  partnerId: string;
46
+ stripePublishableKey?: string;
44
47
  createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
45
48
  enableTurnkey?: boolean;
46
49
  }): import("react/jsx-runtime").JSX.Element;
@@ -34,7 +34,7 @@ const queryClient = new react_query_1.QueryClient();
34
34
  */
35
35
  function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey,
36
36
  // deprecated since v0.0.87
37
- toaster: _toaster, clientType = "rest", rpcUrls, partnerId, onConnect, connectors, overrideDefaultConnectors = false, createClientReferenceId, enableTurnkey = false, }) {
37
+ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors = false, createClientReferenceId, enableTurnkey = false, }) {
38
38
  // Initialize Google Analytics on mount
39
39
  (0, react_2.useEffect)(() => {
40
40
  (0, analytics_1.loadGA4Script)();
@@ -44,12 +44,12 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, onConnect, connector
44
44
  (0, client_manager_1.setClientType)(clientType);
45
45
  }, [clientType]);
46
46
  const wagmiConfig = (0, react_2.useMemo)(() => (0, createWagmiConfig_1.createWagmiConfig)({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }), [partnerId, rpcUrls, connectors, overrideDefaultConnectors]);
47
- return ((0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(index_1.ToastProvider, { children: (0, jsx_runtime_1.jsx)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, children: (0, jsx_runtime_1.jsxs)(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, partnerId: partnerId, createClientReferenceId: createClientReferenceId, enableTurnkey: enableTurnkey, children: [(0, jsx_runtime_1.jsx)(ToastContextConnector, {}), (0, jsx_runtime_1.jsxs)(react_1.RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, (0, jsx_runtime_1.jsx)(StyleRoot_1.StyleRoot, { id: "b3-root" })] })] }) }) }) }) }) }) }));
47
+ return ((0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(index_1.ToastProvider, { children: (0, jsx_runtime_1.jsx)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, children: (0, jsx_runtime_1.jsxs)(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, partnerId: partnerId, stripePublishableKey: stripePublishableKey, createClientReferenceId: createClientReferenceId, enableTurnkey: enableTurnkey, children: [(0, jsx_runtime_1.jsx)(ToastContextConnector, {}), (0, jsx_runtime_1.jsxs)(react_1.RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, (0, jsx_runtime_1.jsx)(StyleRoot_1.StyleRoot, { id: "b3-root" })] })] }) }) }) }) }) }) }));
48
48
  }
49
49
  /**
50
50
  * Inner provider component that provides the actual B3Context
51
51
  */
52
- function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa, theme = "light", clientType = "socket", partnerId, createClientReferenceId, enableTurnkey, }) {
52
+ function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa, theme = "light", clientType = "socket", partnerId, stripePublishableKey, createClientReferenceId, enableTurnkey, }) {
53
53
  const activeAccount = (0, react_3.useActiveAccount)();
54
54
  const [manuallySelectedWallet, setManuallySelectedWallet] = (0, react_2.useState)(undefined);
55
55
  const wallets = (0, react_3.useConnectedWallets)();
@@ -105,6 +105,7 @@ function InnerProvider({ children, accountOverride, environment, defaultPermissi
105
105
  theme,
106
106
  clientType,
107
107
  partnerId: partnerId,
108
+ stripePublishableKey,
108
109
  createClientReferenceId,
109
110
  enableTurnkey,
110
111
  }, children: (0, jsx_runtime_1.jsx)(InnerProvider2, { children: children }) }));
@@ -22,6 +22,7 @@ export interface B3ContextType {
22
22
  theme: "light" | "dark";
23
23
  clientType: ClientType;
24
24
  partnerId: string;
25
+ stripePublishableKey?: string;
25
26
  createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
26
27
  enableTurnkey?: boolean;
27
28
  }
@@ -7454,12 +7454,12 @@ export declare function useFirstEOA(chain?: {
7454
7454
  [x: `bytes18[${string}]`]: undefined;
7455
7455
  [x: `bytes6[${string}]`]: undefined;
7456
7456
  [x: `bytes9[${string}]`]: undefined;
7457
+ [x: `bytes8[${string}]`]: undefined;
7457
7458
  [x: `bytes2[${string}]`]: undefined;
7458
7459
  [x: `bytes3[${string}]`]: undefined;
7459
7460
  [x: `bytes4[${string}]`]: undefined;
7460
7461
  [x: `bytes5[${string}]`]: undefined;
7461
7462
  [x: `bytes7[${string}]`]: undefined;
7462
- [x: `bytes8[${string}]`]: undefined;
7463
7463
  [x: `bytes10[${string}]`]: undefined;
7464
7464
  [x: `bytes11[${string}]`]: undefined;
7465
7465
  [x: `bytes12[${string}]`]: undefined;
@@ -7556,12 +7556,12 @@ export declare function useFirstEOA(chain?: {
7556
7556
  bytes18?: undefined;
7557
7557
  bytes6?: undefined;
7558
7558
  bytes9?: undefined;
7559
+ bytes8?: undefined;
7559
7560
  bytes2?: undefined;
7560
7561
  bytes3?: undefined;
7561
7562
  bytes4?: undefined;
7562
7563
  bytes5?: undefined;
7563
7564
  bytes7?: undefined;
7564
- bytes8?: undefined;
7565
7565
  bytes10?: undefined;
7566
7566
  bytes11?: undefined;
7567
7567
  bytes12?: undefined;
@@ -1,5 +1,9 @@
1
1
  import { components } from "../../anyspend/types/api";
2
- export declare function getStripePromise(): Promise<import("@stripe/stripe-js").Stripe | null>;
2
+ /**
3
+ * Get or create a Stripe promise for the given publishable key.
4
+ * @param stripePublishableKey - Partner-specific Stripe publishable key from B3Provider
5
+ */
6
+ export declare function getStripePromise(stripePublishableKey?: string | null): Promise<import("@stripe/stripe-js").Stripe | null>;
3
7
  export declare function getVendorDisplayName(vendor?: components["schemas"]["OnrampMetadata"]["vendor"]): string;
4
8
  export declare function getPaymentMethodDescription(vendor?: components["schemas"]["OnrampMetadata"]["vendor"]): string;
5
9
  export declare function formatStripeAmount(amount: number): string;
@@ -7,12 +7,20 @@ exports.formatStripeAmount = formatStripeAmount;
7
7
  exports.generateReturnUrl = generateReturnUrl;
8
8
  const constants_1 = require("../../anyspend/constants");
9
9
  const stripe_js_1 = require("@stripe/stripe-js");
10
- let stripePromise = null;
11
- function getStripePromise() {
12
- if (!stripePromise) {
13
- stripePromise = (0, stripe_js_1.loadStripe)(constants_1.STRIPE_CONFIG.publishableKey);
10
+ // Cache Stripe promises per publishable key (supports multiple partners)
11
+ const stripePromiseCache = new Map();
12
+ /**
13
+ * Get or create a Stripe promise for the given publishable key.
14
+ * @param stripePublishableKey - Partner-specific Stripe publishable key from B3Provider
15
+ */
16
+ function getStripePromise(stripePublishableKey) {
17
+ const publishableKey = (0, constants_1.getStripePublishableKey)(stripePublishableKey);
18
+ let cached = stripePromiseCache.get(publishableKey);
19
+ if (!cached) {
20
+ cached = (0, stripe_js_1.loadStripe)(publishableKey);
21
+ stripePromiseCache.set(publishableKey, cached);
14
22
  }
15
- return stripePromise;
23
+ return cached;
16
24
  }
17
25
  function getVendorDisplayName(vendor) {
18
26
  switch (vendor) {
@@ -25,6 +25,12 @@ export declare const DEFAULT_NFT_CONTRACT: {
25
25
  export declare const STRIPE_CONFIG: {
26
26
  readonly publishableKey: "pk_live_51QkrBwJnoDg53PsPq7QYOxSLfnXvtCVeD9UuyZ6c136i42XtYC2Z2bl1W5xbDg6AaoGyq63ErCc0yv3C2KBX29CG002AE862CP";
27
27
  };
28
+ /**
29
+ * Get the appropriate Stripe publishable key.
30
+ * If a custom key is provided (via B3Provider stripePublishableKey prop), use it.
31
+ * Otherwise, fall back to the default B3 Stripe account.
32
+ */
33
+ export declare function getStripePublishableKey(customKey?: string | null): string;
28
34
  export declare const PAYMENT_METHOD_ICONS: {
29
35
  readonly visa: "https://github.com/marcovoliveira/react-svg-credit-card-payment-icons/raw/main/src/icons/flat-rounded/visa.svg";
30
36
  readonly mastercard: "https://github.com/marcovoliveira/react-svg-credit-card-payment-icons/raw/main/src/icons/flat-rounded/mastercard.svg";
@@ -72,9 +72,21 @@ export const NFT_CONTRACTS = [
72
72
  },
73
73
  ];
74
74
  export const DEFAULT_NFT_CONTRACT = NFT_CONTRACTS[1];
75
+ // Default B3 Stripe publishable key
75
76
  export const STRIPE_CONFIG = {
76
77
  publishableKey: "pk_live_51QkrBwJnoDg53PsPq7QYOxSLfnXvtCVeD9UuyZ6c136i42XtYC2Z2bl1W5xbDg6AaoGyq63ErCc0yv3C2KBX29CG002AE862CP",
77
78
  };
79
+ /**
80
+ * Get the appropriate Stripe publishable key.
81
+ * If a custom key is provided (via B3Provider stripePublishableKey prop), use it.
82
+ * Otherwise, fall back to the default B3 Stripe account.
83
+ */
84
+ export function getStripePublishableKey(customKey) {
85
+ if (customKey) {
86
+ return customKey;
87
+ }
88
+ return STRIPE_CONFIG.publishableKey;
89
+ }
78
90
  export const PAYMENT_METHOD_ICONS = {
79
91
  visa: "https://github.com/marcovoliveira/react-svg-credit-card-payment-icons/raw/main/src/icons/flat-rounded/visa.svg",
80
92
  mastercard: "https://github.com/marcovoliveira/react-svg-credit-card-payment-icons/raw/main/src/icons/flat-rounded/mastercard.svg",
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { eqci, getDefaultToken, getHyperliquidUSDCToken, HYPERLIQUID_CHAIN_ID, USDC_BASE, ZERO_ADDRESS, } from "../../../anyspend/index.js";
3
+ import { eqci, getDefaultToken, getHyperliquidUSDCToken, HYPERLIQUID_CHAIN_ID, HYPERLIQUID_USDC_ADDRESS, USDC_BASE, ZERO_ADDRESS, } from "../../../anyspend/index.js";
4
4
  import { useAnyspendCreateOnrampOrder, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, useGeoOnrampOptions, } from "../../../anyspend/react/index.js";
5
5
  import { Button, ShinyButton, StyleRoot, TabsPrimitive, toast, TransitionPanel, useAccountWallet, useB3, useModalStore, useProfile, useRouter, useSearchParamsSSR, useTokenBalanceDirect, useTokenData, useTokenFromUrl, } from "../../../global-account/react/index.js";
6
6
  import BottomNavigation from "../../../global-account/react/components/ManageAccount/BottomNavigation.js";
@@ -106,9 +106,11 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
106
106
  const [srcAmountOnRamp, setSrcAmountOnRamp] = useState(searchParams.get("fromAmount") || "5");
107
107
  // State for destination chain/token selection
108
108
  const [selectedDstChainId, setSelectedDstChainId] = useState(initialDstChainId);
109
+ // Helper to check if address is Hyperliquid USDC (supports both 34-char and 42-char formats)
110
+ const isHyperliquidUSDCAddress = (address) => eqci(address, HYPERLIQUID_USDC_ADDRESS) || eqci(address, ZERO_ADDRESS);
109
111
  const defaultDstToken = isBuyMode
110
112
  ? // Special case: Hyperliquid uses zero address for USDC
111
- destinationTokenChainId === HYPERLIQUID_CHAIN_ID && eqci(destinationTokenAddress, ZERO_ADDRESS)
113
+ destinationTokenChainId === HYPERLIQUID_CHAIN_ID && isHyperliquidUSDCAddress(destinationTokenAddress)
112
114
  ? getHyperliquidUSDCToken()
113
115
  : {
114
116
  symbol: "",
@@ -156,7 +158,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
156
158
  useEffect(() => {
157
159
  if (selectedDstToken && dstTokenMetadata && !appliedDstMetadataRef.current) {
158
160
  // Skip metadata enhancement for Hyperliquid USDC - we already have correct metadata from getHyperliquidUSDCToken()
159
- if (selectedDstToken.chainId === HYPERLIQUID_CHAIN_ID && eqci(selectedDstToken.address, ZERO_ADDRESS)) {
161
+ if (selectedDstToken.chainId === HYPERLIQUID_CHAIN_ID && isHyperliquidUSDCAddress(selectedDstToken.address)) {
160
162
  appliedDstMetadataRef.current = true;
161
163
  return;
162
164
  }
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { ALL_CHAINS } from "../../../../anyspend/index.js";
2
3
  import { formatUsername } from "../../../../shared/utils/index.js";
3
4
  import { cn } from "../../../../shared/utils/cn.js";
4
5
  import { shortenAddress } from "../../../../shared/utils/formatAddress.js";
@@ -10,7 +11,7 @@ import { PointsBadge } from "./PointsBadge.js";
10
11
  export function CryptoReceiveSection({ isDepositMode = false, isBuyMode = false, effectiveRecipientAddress, recipientName, onSelectRecipient, dstAmount, dstToken, selectedDstChainId, setSelectedDstChainId, setSelectedDstToken, isSrcInputDirty, onChangeDstAmount, anyspendQuote, dstTokenSymbol, dstTokenLogoURI, onShowPointsDetail, onShowFeeDetail, }) {
11
12
  return (_jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "receive-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [_jsxs("div", { className: "flex w-full items-center justify-between", children: [_jsxs("div", { className: "text-as-primary/50 flex h-7 items-center gap-1.5 text-sm", children: [isDepositMode ? "Deposit" : "Receive", isSrcInputDirty && anyspendQuote?.data?.fee && onShowFeeDetail && (_jsx("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: _jsx(Info, { className: "h-4 w-4" }) }))] }), effectiveRecipientAddress ? (_jsx("button", { className: cn("text-as-tertiarry flex h-7 items-center gap-2 rounded-lg"), onClick: onSelectRecipient, children: _jsxs(_Fragment, { children: [_jsx("span", { className: "text-as-tertiarry flex items-center gap-1 text-sm", children: recipientName ? formatUsername(recipientName) : shortenAddress(effectiveRecipientAddress || "") }), _jsx(ChevronRight, { className: "h-4 w-4" })] }) })) : (_jsx("button", { className: "text-as-primary/70 flex items-center gap-1 rounded-lg", onClick: onSelectRecipient, children: _jsx("div", { className: "text-sm font-medium", children: "Select recipient" }) }))] }), isBuyMode || isDepositMode ? (
12
13
  // Fixed destination token display for buy mode and deposit mode
13
- _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary text-2xl font-bold", children: dstAmount || "0" }), _jsxs("div", { className: "bg-as-brand/10 border-as-brand/30 flex items-center gap-3 rounded-xl border px-4 py-3", children: [(dstTokenLogoURI || dstToken.metadata?.logoURI) && (_jsx("img", { src: dstTokenLogoURI || dstToken.metadata?.logoURI, alt: dstTokenSymbol || dstToken.symbol, className: "h-8 w-8 rounded-full" })), _jsx("span", { className: "text-as-brand text-lg font-bold", children: dstTokenSymbol || dstToken.symbol })] })] })) : (
14
+ _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary text-2xl font-bold", children: dstAmount || "0" }), _jsxs("div", { className: "bg-as-brand/10 border-as-brand/30 flex items-center gap-3 rounded-xl border px-4 py-3", children: [(dstTokenLogoURI || dstToken.metadata?.logoURI) && (_jsxs("div", { className: "relative", children: [_jsx("img", { src: dstTokenLogoURI || dstToken.metadata?.logoURI, alt: dstTokenSymbol || dstToken.symbol, className: "h-8 w-8 rounded-full" }), ALL_CHAINS[dstToken.chainId]?.logoUrl && (_jsx("img", { src: ALL_CHAINS[dstToken.chainId].logoUrl, alt: "Chain", className: "absolute -bottom-1 -right-1 h-4 w-4 rounded-full border border-white" }))] })), _jsx("span", { className: "text-as-brand text-lg font-bold", children: dstTokenSymbol || dstToken.symbol })] })] })) : (
14
15
  // Token selection for regular swap mode
15
16
  _jsx(OrderTokenAmount, { address: effectiveRecipientAddress, context: "to", inputValue: dstAmount, onChangeInput: onChangeDstAmount || (() => { }), chainId: selectedDstChainId || dstToken.chainId, setChainId: setSelectedDstChainId || (() => { }), token: dstToken, setToken: setSelectedDstToken || (() => { }) })), _jsxs("div", { className: "text-as-primary/50 flex h-5 items-center justify-start gap-2 text-sm", children: [_jsxs("div", { className: "flex items-center gap-2", children: [formatDisplayNumber(anyspendQuote?.data?.currencyOut?.amountUsd, {
16
17
  style: "currency",
@@ -11,7 +11,7 @@ import { AnySpendFingerprintWrapper, getFingerprintConfig } from "../AnySpendFin
11
11
  import HowItWorks from "./HowItWorks.js";
12
12
  import PaymentMethodIcons from "./PaymentMethodIcons.js";
13
13
  export default function PaymentStripeWeb2({ order, stripePaymentIntentId, onPaymentSuccess }) {
14
- const { theme } = useB3();
14
+ const { theme, stripePublishableKey } = useB3();
15
15
  const fingerprintConfig = getFingerprintConfig();
16
16
  const { clientSecret, isLoadingStripeClientSecret, stripeClientSecretError } = useStripeClientSecret(stripePaymentIntentId);
17
17
  if (isLoadingStripeClientSecret) {
@@ -20,7 +20,7 @@ export default function PaymentStripeWeb2({ order, stripePaymentIntentId, onPaym
20
20
  if (stripeClientSecretError) {
21
21
  return _jsx(StripeErrorState, { error: stripeClientSecretError.message });
22
22
  }
23
- return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(Elements, { stripe: getStripePromise(), options: {
23
+ return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(Elements, { stripe: getStripePromise(stripePublishableKey), options: {
24
24
  clientSecret: clientSecret || undefined,
25
25
  appearance: { theme: theme === "light" ? "stripe" : "night" },
26
26
  }, children: _jsx(StripePaymentForm, { order: order, clientSecret: clientSecret, onPaymentSuccess: onPaymentSuccess }) }) }));
@@ -5,6 +5,8 @@ interface WebviewOnrampPaymentProps {
5
5
  recipientAddress?: string;
6
6
  destinationToken: components["schemas"]["Token"];
7
7
  partnerId?: string;
8
+ /** Partner-specific Stripe publishable key. If not provided, uses default B3 Stripe account. */
9
+ stripePublishableKey?: string;
8
10
  anyspendQuote: GetQuoteResponse | undefined;
9
11
  onPaymentSuccess: (orderId: string) => void;
10
12
  userId?: string;
@@ -83,7 +83,7 @@ function StripePaymentForm({ order, onPaymentSuccess, }) {
83
83
  },
84
84
  } }) })), error && (_jsx("div", { className: "mt-4 rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error })), _jsx("button", { type: "submit", disabled: !stripe || isProcessing, className: "mt-6 w-full rounded-xl bg-blue-600 px-4 py-3 font-medium text-white hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50", children: isProcessing ? (_jsxs("div", { className: "flex items-center justify-center gap-2", children: [_jsx(Loader2, { className: "h-5 w-5 animate-spin" }), _jsx("span", { children: "Processing..." })] })) : (_jsx("span", { children: "Complete Payment" })) })] }) }) }));
85
85
  }
86
- function WebviewOnrampPaymentInner({ srcAmountOnRamp, recipientAddress, destinationToken, anyspendQuote, onPaymentSuccess, userId, }) {
86
+ function WebviewOnrampPaymentInner({ srcAmountOnRamp, recipientAddress, destinationToken, stripePublishableKey, anyspendQuote, onPaymentSuccess, userId, }) {
87
87
  const [createdOrder, setCreatedOrder] = useState(null);
88
88
  const orderCreationAttempted = useRef(false);
89
89
  const { geoData, stripeWeb2Support, isLoading: isLoadingGeoOnramp } = useGeoOnrampOptions(srcAmountOnRamp);
@@ -162,7 +162,7 @@ function WebviewOnrampPaymentInner({ srcAmountOnRamp, recipientAddress, destinat
162
162
  if (createdOrder && clientSecret) {
163
163
  return (_jsxs("div", { className: "mx-auto flex w-full max-w-[460px] flex-col gap-6", children: [_jsx("div", { className: "overflow-hidden rounded-xl bg-white", children: _jsxs("div", { className: "px-6 py-4", children: [_jsx("h2", { className: "mb-4 text-lg font-semibold", children: "Order summary" }), _jsxs("div", { className: "flex flex-col divide-y", children: [_jsxs("div", { className: "flex items-center justify-between py-3", children: [_jsx("span", { className: "text-gray-600", children: "Receiving" }), _jsxs("div", { className: "flex items-center gap-2", children: [destinationToken.metadata?.logoURI && (_jsx("img", { src: destinationToken.metadata.logoURI, alt: destinationToken.symbol, className: "h-5 w-5 rounded-full" })), _jsxs("span", { className: "font-medium", children: [anyspendQuote?.data?.currencyOut?.amount
164
164
  ? Number(formatUnits(BigInt(anyspendQuote.data.currencyOut.amount), destinationToken.decimals)).toFixed(4)
165
- : "0", " ", destinationToken.symbol] })] })] }), _jsxs("div", { className: "flex items-center justify-between py-3", children: [_jsx("span", { className: "text-gray-600", children: "Network" }), _jsx("span", { className: "font-medium", children: getChainName(destinationToken.chainId) })] }), recipientAddress && (_jsxs("div", { className: "flex items-center justify-between py-3", children: [_jsx("span", { className: "text-gray-600", children: "Recipient" }), _jsx("span", { className: "font-medium", children: centerTruncate(recipientAddress) })] })), _jsxs("div", { className: "flex items-center justify-between py-3", children: [_jsx("span", { className: "text-gray-600", children: "You Pay" }), _jsxs("span", { className: "text-lg font-semibold", children: ["$", parseFloat(srcAmountOnRamp).toFixed(2)] })] })] })] }) }), _jsx(Elements, { stripe: getStripePromise(), options: {
165
+ : "0", " ", destinationToken.symbol] })] })] }), _jsxs("div", { className: "flex items-center justify-between py-3", children: [_jsx("span", { className: "text-gray-600", children: "Network" }), _jsx("span", { className: "font-medium", children: getChainName(destinationToken.chainId) })] }), recipientAddress && (_jsxs("div", { className: "flex items-center justify-between py-3", children: [_jsx("span", { className: "text-gray-600", children: "Recipient" }), _jsx("span", { className: "font-medium", children: centerTruncate(recipientAddress) })] })), _jsxs("div", { className: "flex items-center justify-between py-3", children: [_jsx("span", { className: "text-gray-600", children: "You Pay" }), _jsxs("span", { className: "text-lg font-semibold", children: ["$", parseFloat(srcAmountOnRamp).toFixed(2)] })] })] })] }) }), _jsx(Elements, { stripe: getStripePromise(stripePublishableKey), options: {
166
166
  clientSecret,
167
167
  appearance: {
168
168
  theme: "flat",
@@ -1,6 +1,12 @@
1
1
  import { components } from "../../anyspend/types/api";
2
2
  export declare const HYPERLIQUID_CHAIN_ID = 1337;
3
3
  export declare const HYPEREVM_CHAIN_ID = 999;
4
+ /**
5
+ * Hyperliquid uses a special 34-character USDC address format (0x + 32 hex digits)
6
+ * instead of the standard 42-character EVM address format.
7
+ * This is required by Relay SDK for Hyperliquid integration.
8
+ */
9
+ export declare const HYPERLIQUID_USDC_ADDRESS = "0x00000000000000000000000000000000";
4
10
  export declare function isNativeToken(address: string): boolean;
5
11
  export declare function getSolanaToken(): components["schemas"]["Token"];
6
12
  export declare function getEthToken(chainId: number): components["schemas"]["Token"];
@@ -2,6 +2,12 @@ import { RELAY_SOL_ADDRESS, RELAY_SOLANA_MAINNET_CHAIN_ID, ZERO_ADDRESS } from "
2
2
  import { avalanche, bsc, polygon } from "viem/chains";
3
3
  export const HYPERLIQUID_CHAIN_ID = 1337;
4
4
  export const HYPEREVM_CHAIN_ID = 999;
5
+ /**
6
+ * Hyperliquid uses a special 34-character USDC address format (0x + 32 hex digits)
7
+ * instead of the standard 42-character EVM address format.
8
+ * This is required by Relay SDK for Hyperliquid integration.
9
+ */
10
+ export const HYPERLIQUID_USDC_ADDRESS = "0x00000000000000000000000000000000";
5
11
  export function isNativeToken(address) {
6
12
  return address.toLowerCase() === ZERO_ADDRESS || address.toLowerCase() === RELAY_SOL_ADDRESS;
7
13
  }
@@ -80,10 +86,10 @@ export function getHyperEVMNativeToken() {
80
86
  export function getHyperliquidUSDCToken() {
81
87
  return {
82
88
  chainId: HYPERLIQUID_CHAIN_ID,
83
- address: ZERO_ADDRESS,
89
+ address: HYPERLIQUID_USDC_ADDRESS,
84
90
  symbol: "USDC",
85
91
  name: "USD Coin",
86
- decimals: 6,
92
+ decimals: 8, // Hyperliquid USDC uses 8 decimals, not 6
87
93
  metadata: {
88
94
  logoURI: "https://ethereum-optimism.github.io/data/USDC/logo.png",
89
95
  },
@@ -9,7 +9,7 @@ import { B3ContextType } from "./types";
9
9
  /**
10
10
  * Main B3Provider component
11
11
  */
12
- export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, onConnect, connectors, overrideDefaultConnectors, createClientReferenceId, enableTurnkey, }: {
12
+ export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors, createClientReferenceId, enableTurnkey, }: {
13
13
  theme: "light" | "dark";
14
14
  children: React.ReactNode;
15
15
  accountOverride?: Account;
@@ -23,6 +23,8 @@ export declare function B3Provider({ theme, children, accountOverride, environme
23
23
  clientType?: ClientType;
24
24
  rpcUrls?: Record<number, string>;
25
25
  partnerId: string;
26
+ /** Partner-specific Stripe publishable key. If not provided, uses default B3 Stripe account. */
27
+ stripePublishableKey?: string;
26
28
  onConnect?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
27
29
  connectors?: CreateConnectorFn[];
28
30
  overrideDefaultConnectors?: boolean;
@@ -32,7 +34,7 @@ export declare function B3Provider({ theme, children, accountOverride, environme
32
34
  /**
33
35
  * Inner provider component that provides the actual B3Context
34
36
  */
35
- export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, createClientReferenceId, enableTurnkey, }: {
37
+ export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, stripePublishableKey, createClientReferenceId, enableTurnkey, }: {
36
38
  children: React.ReactNode;
37
39
  accountOverride?: Account;
38
40
  environment: B3ContextType["environment"];
@@ -41,6 +43,7 @@ export declare function InnerProvider({ children, accountOverride, environment,
41
43
  theme: "light" | "dark";
42
44
  clientType?: ClientType;
43
45
  partnerId: string;
46
+ stripePublishableKey?: string;
44
47
  createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
45
48
  enableTurnkey?: boolean;
46
49
  }): import("react/jsx-runtime").JSX.Element;
@@ -30,7 +30,7 @@ const queryClient = new QueryClient();
30
30
  */
31
31
  export function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey,
32
32
  // deprecated since v0.0.87
33
- toaster: _toaster, clientType = "rest", rpcUrls, partnerId, onConnect, connectors, overrideDefaultConnectors = false, createClientReferenceId, enableTurnkey = false, }) {
33
+ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors = false, createClientReferenceId, enableTurnkey = false, }) {
34
34
  // Initialize Google Analytics on mount
35
35
  useEffect(() => {
36
36
  loadGA4Script();
@@ -40,12 +40,12 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, onConnect, connector
40
40
  setClientType(clientType);
41
41
  }, [clientType]);
42
42
  const wagmiConfig = useMemo(() => createWagmiConfig({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }), [partnerId, rpcUrls, connectors, overrideDefaultConnectors]);
43
- return (_jsx(ThirdwebProvider, { children: _jsx(WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(TooltipProvider, { children: _jsx(ToastProvider, { children: _jsx(LocalSDKProvider, { onConnectCallback: onConnect, children: _jsxs(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, partnerId: partnerId, createClientReferenceId: createClientReferenceId, enableTurnkey: enableTurnkey, children: [_jsx(ToastContextConnector, {}), _jsxs(RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, _jsx(StyleRoot, { id: "b3-root" })] })] }) }) }) }) }) }) }));
43
+ return (_jsx(ThirdwebProvider, { children: _jsx(WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(TooltipProvider, { children: _jsx(ToastProvider, { children: _jsx(LocalSDKProvider, { onConnectCallback: onConnect, children: _jsxs(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, partnerId: partnerId, stripePublishableKey: stripePublishableKey, createClientReferenceId: createClientReferenceId, enableTurnkey: enableTurnkey, children: [_jsx(ToastContextConnector, {}), _jsxs(RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, _jsx(StyleRoot, { id: "b3-root" })] })] }) }) }) }) }) }) }));
44
44
  }
45
45
  /**
46
46
  * Inner provider component that provides the actual B3Context
47
47
  */
48
- export function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa, theme = "light", clientType = "socket", partnerId, createClientReferenceId, enableTurnkey, }) {
48
+ export function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa, theme = "light", clientType = "socket", partnerId, stripePublishableKey, createClientReferenceId, enableTurnkey, }) {
49
49
  const activeAccount = useActiveAccount();
50
50
  const [manuallySelectedWallet, setManuallySelectedWallet] = useState(undefined);
51
51
  const wallets = useConnectedWallets();
@@ -101,6 +101,7 @@ export function InnerProvider({ children, accountOverride, environment, defaultP
101
101
  theme,
102
102
  clientType,
103
103
  partnerId: partnerId,
104
+ stripePublishableKey,
104
105
  createClientReferenceId,
105
106
  enableTurnkey,
106
107
  }, children: _jsx(InnerProvider2, { children: children }) }));
@@ -22,6 +22,7 @@ export interface B3ContextType {
22
22
  theme: "light" | "dark";
23
23
  clientType: ClientType;
24
24
  partnerId: string;
25
+ stripePublishableKey?: string;
25
26
  createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
26
27
  enableTurnkey?: boolean;
27
28
  }
@@ -7454,12 +7454,12 @@ export declare function useFirstEOA(chain?: {
7454
7454
  [x: `bytes18[${string}]`]: undefined;
7455
7455
  [x: `bytes6[${string}]`]: undefined;
7456
7456
  [x: `bytes9[${string}]`]: undefined;
7457
+ [x: `bytes8[${string}]`]: undefined;
7457
7458
  [x: `bytes2[${string}]`]: undefined;
7458
7459
  [x: `bytes3[${string}]`]: undefined;
7459
7460
  [x: `bytes4[${string}]`]: undefined;
7460
7461
  [x: `bytes5[${string}]`]: undefined;
7461
7462
  [x: `bytes7[${string}]`]: undefined;
7462
- [x: `bytes8[${string}]`]: undefined;
7463
7463
  [x: `bytes10[${string}]`]: undefined;
7464
7464
  [x: `bytes11[${string}]`]: undefined;
7465
7465
  [x: `bytes12[${string}]`]: undefined;
@@ -7556,12 +7556,12 @@ export declare function useFirstEOA(chain?: {
7556
7556
  bytes18?: undefined;
7557
7557
  bytes6?: undefined;
7558
7558
  bytes9?: undefined;
7559
+ bytes8?: undefined;
7559
7560
  bytes2?: undefined;
7560
7561
  bytes3?: undefined;
7561
7562
  bytes4?: undefined;
7562
7563
  bytes5?: undefined;
7563
7564
  bytes7?: undefined;
7564
- bytes8?: undefined;
7565
7565
  bytes10?: undefined;
7566
7566
  bytes11?: undefined;
7567
7567
  bytes12?: undefined;
@@ -1,5 +1,9 @@
1
1
  import { components } from "../../anyspend/types/api";
2
- export declare function getStripePromise(): Promise<import("@stripe/stripe-js").Stripe | null>;
2
+ /**
3
+ * Get or create a Stripe promise for the given publishable key.
4
+ * @param stripePublishableKey - Partner-specific Stripe publishable key from B3Provider
5
+ */
6
+ export declare function getStripePromise(stripePublishableKey?: string | null): Promise<import("@stripe/stripe-js").Stripe | null>;
3
7
  export declare function getVendorDisplayName(vendor?: components["schemas"]["OnrampMetadata"]["vendor"]): string;
4
8
  export declare function getPaymentMethodDescription(vendor?: components["schemas"]["OnrampMetadata"]["vendor"]): string;
5
9
  export declare function formatStripeAmount(amount: number): string;
@@ -1,11 +1,19 @@
1
- import { STRIPE_CONFIG, VENDOR_DISPLAY_NAMES } from "../../anyspend/constants/index.js";
1
+ import { getStripePublishableKey, VENDOR_DISPLAY_NAMES } from "../../anyspend/constants/index.js";
2
2
  import { loadStripe } from "@stripe/stripe-js";
3
- let stripePromise = null;
4
- export function getStripePromise() {
5
- if (!stripePromise) {
6
- stripePromise = loadStripe(STRIPE_CONFIG.publishableKey);
3
+ // Cache Stripe promises per publishable key (supports multiple partners)
4
+ const stripePromiseCache = new Map();
5
+ /**
6
+ * Get or create a Stripe promise for the given publishable key.
7
+ * @param stripePublishableKey - Partner-specific Stripe publishable key from B3Provider
8
+ */
9
+ export function getStripePromise(stripePublishableKey) {
10
+ const publishableKey = getStripePublishableKey(stripePublishableKey);
11
+ let cached = stripePromiseCache.get(publishableKey);
12
+ if (!cached) {
13
+ cached = loadStripe(publishableKey);
14
+ stripePromiseCache.set(publishableKey, cached);
7
15
  }
8
- return stripePromise;
16
+ return cached;
9
17
  }
10
18
  export function getVendorDisplayName(vendor) {
11
19
  switch (vendor) {
@@ -25,6 +25,12 @@ export declare const DEFAULT_NFT_CONTRACT: {
25
25
  export declare const STRIPE_CONFIG: {
26
26
  readonly publishableKey: "pk_live_51QkrBwJnoDg53PsPq7QYOxSLfnXvtCVeD9UuyZ6c136i42XtYC2Z2bl1W5xbDg6AaoGyq63ErCc0yv3C2KBX29CG002AE862CP";
27
27
  };
28
+ /**
29
+ * Get the appropriate Stripe publishable key.
30
+ * If a custom key is provided (via B3Provider stripePublishableKey prop), use it.
31
+ * Otherwise, fall back to the default B3 Stripe account.
32
+ */
33
+ export declare function getStripePublishableKey(customKey?: string | null): string;
28
34
  export declare const PAYMENT_METHOD_ICONS: {
29
35
  readonly visa: "https://github.com/marcovoliveira/react-svg-credit-card-payment-icons/raw/main/src/icons/flat-rounded/visa.svg";
30
36
  readonly mastercard: "https://github.com/marcovoliveira/react-svg-credit-card-payment-icons/raw/main/src/icons/flat-rounded/mastercard.svg";
@@ -5,6 +5,8 @@ interface WebviewOnrampPaymentProps {
5
5
  recipientAddress?: string;
6
6
  destinationToken: components["schemas"]["Token"];
7
7
  partnerId?: string;
8
+ /** Partner-specific Stripe publishable key. If not provided, uses default B3 Stripe account. */
9
+ stripePublishableKey?: string;
8
10
  anyspendQuote: GetQuoteResponse | undefined;
9
11
  onPaymentSuccess: (orderId: string) => void;
10
12
  userId?: string;
@@ -1,6 +1,12 @@
1
1
  import { components } from "@b3dotfun/sdk/anyspend/types/api";
2
2
  export declare const HYPERLIQUID_CHAIN_ID = 1337;
3
3
  export declare const HYPEREVM_CHAIN_ID = 999;
4
+ /**
5
+ * Hyperliquid uses a special 34-character USDC address format (0x + 32 hex digits)
6
+ * instead of the standard 42-character EVM address format.
7
+ * This is required by Relay SDK for Hyperliquid integration.
8
+ */
9
+ export declare const HYPERLIQUID_USDC_ADDRESS = "0x00000000000000000000000000000000";
4
10
  export declare function isNativeToken(address: string): boolean;
5
11
  export declare function getSolanaToken(): components["schemas"]["Token"];
6
12
  export declare function getEthToken(chainId: number): components["schemas"]["Token"];
@@ -9,7 +9,7 @@ import { B3ContextType } from "./types";
9
9
  /**
10
10
  * Main B3Provider component
11
11
  */
12
- export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, onConnect, connectors, overrideDefaultConnectors, createClientReferenceId, enableTurnkey, }: {
12
+ export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors, createClientReferenceId, enableTurnkey, }: {
13
13
  theme: "light" | "dark";
14
14
  children: React.ReactNode;
15
15
  accountOverride?: Account;
@@ -23,6 +23,8 @@ export declare function B3Provider({ theme, children, accountOverride, environme
23
23
  clientType?: ClientType;
24
24
  rpcUrls?: Record<number, string>;
25
25
  partnerId: string;
26
+ /** Partner-specific Stripe publishable key. If not provided, uses default B3 Stripe account. */
27
+ stripePublishableKey?: string;
26
28
  onConnect?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
27
29
  connectors?: CreateConnectorFn[];
28
30
  overrideDefaultConnectors?: boolean;
@@ -32,7 +34,7 @@ export declare function B3Provider({ theme, children, accountOverride, environme
32
34
  /**
33
35
  * Inner provider component that provides the actual B3Context
34
36
  */
35
- export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, createClientReferenceId, enableTurnkey, }: {
37
+ export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, stripePublishableKey, createClientReferenceId, enableTurnkey, }: {
36
38
  children: React.ReactNode;
37
39
  accountOverride?: Account;
38
40
  environment: B3ContextType["environment"];
@@ -41,6 +43,7 @@ export declare function InnerProvider({ children, accountOverride, environment,
41
43
  theme: "light" | "dark";
42
44
  clientType?: ClientType;
43
45
  partnerId: string;
46
+ stripePublishableKey?: string;
44
47
  createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
45
48
  enableTurnkey?: boolean;
46
49
  }): import("react/jsx-runtime").JSX.Element;
@@ -22,6 +22,7 @@ export interface B3ContextType {
22
22
  theme: "light" | "dark";
23
23
  clientType: ClientType;
24
24
  partnerId: string;
25
+ stripePublishableKey?: string;
25
26
  createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
26
27
  enableTurnkey?: boolean;
27
28
  }
@@ -7454,12 +7454,12 @@ export declare function useFirstEOA(chain?: {
7454
7454
  [x: `bytes18[${string}]`]: undefined;
7455
7455
  [x: `bytes6[${string}]`]: undefined;
7456
7456
  [x: `bytes9[${string}]`]: undefined;
7457
+ [x: `bytes8[${string}]`]: undefined;
7457
7458
  [x: `bytes2[${string}]`]: undefined;
7458
7459
  [x: `bytes3[${string}]`]: undefined;
7459
7460
  [x: `bytes4[${string}]`]: undefined;
7460
7461
  [x: `bytes5[${string}]`]: undefined;
7461
7462
  [x: `bytes7[${string}]`]: undefined;
7462
- [x: `bytes8[${string}]`]: undefined;
7463
7463
  [x: `bytes10[${string}]`]: undefined;
7464
7464
  [x: `bytes11[${string}]`]: undefined;
7465
7465
  [x: `bytes12[${string}]`]: undefined;
@@ -7556,12 +7556,12 @@ export declare function useFirstEOA(chain?: {
7556
7556
  bytes18?: undefined;
7557
7557
  bytes6?: undefined;
7558
7558
  bytes9?: undefined;
7559
+ bytes8?: undefined;
7559
7560
  bytes2?: undefined;
7560
7561
  bytes3?: undefined;
7561
7562
  bytes4?: undefined;
7562
7563
  bytes5?: undefined;
7563
7564
  bytes7?: undefined;
7564
- bytes8?: undefined;
7565
7565
  bytes10?: undefined;
7566
7566
  bytes11?: undefined;
7567
7567
  bytes12?: undefined;
@@ -1,5 +1,9 @@
1
1
  import { components } from "@b3dotfun/sdk/anyspend/types/api";
2
- export declare function getStripePromise(): Promise<import("@stripe/stripe-js").Stripe | null>;
2
+ /**
3
+ * Get or create a Stripe promise for the given publishable key.
4
+ * @param stripePublishableKey - Partner-specific Stripe publishable key from B3Provider
5
+ */
6
+ export declare function getStripePromise(stripePublishableKey?: string | null): Promise<import("@stripe/stripe-js").Stripe | null>;
3
7
  export declare function getVendorDisplayName(vendor?: components["schemas"]["OnrampMetadata"]["vendor"]): string;
4
8
  export declare function getPaymentMethodDescription(vendor?: components["schemas"]["OnrampMetadata"]["vendor"]): string;
5
9
  export declare function formatStripeAmount(amount: number): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.84-alpha.0",
3
+ "version": "0.0.84-alpha.2",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -86,11 +86,24 @@ export const NFT_CONTRACTS: components["schemas"]["NftContract"][] = [
86
86
 
87
87
  export const DEFAULT_NFT_CONTRACT = NFT_CONTRACTS[1];
88
88
 
89
+ // Default B3 Stripe publishable key
89
90
  export const STRIPE_CONFIG = {
90
91
  publishableKey:
91
92
  "pk_live_51QkrBwJnoDg53PsPq7QYOxSLfnXvtCVeD9UuyZ6c136i42XtYC2Z2bl1W5xbDg6AaoGyq63ErCc0yv3C2KBX29CG002AE862CP",
92
93
  } as const;
93
94
 
95
+ /**
96
+ * Get the appropriate Stripe publishable key.
97
+ * If a custom key is provided (via B3Provider stripePublishableKey prop), use it.
98
+ * Otherwise, fall back to the default B3 Stripe account.
99
+ */
100
+ export function getStripePublishableKey(customKey?: string | null): string {
101
+ if (customKey) {
102
+ return customKey;
103
+ }
104
+ return STRIPE_CONFIG.publishableKey;
105
+ }
106
+
94
107
  export const PAYMENT_METHOD_ICONS = {
95
108
  visa: "https://github.com/marcovoliveira/react-svg-credit-card-payment-icons/raw/main/src/icons/flat-rounded/visa.svg",
96
109
  mastercard:
@@ -5,6 +5,7 @@ import {
5
5
  getDefaultToken,
6
6
  getHyperliquidUSDCToken,
7
7
  HYPERLIQUID_CHAIN_ID,
8
+ HYPERLIQUID_USDC_ADDRESS,
8
9
  USDC_BASE,
9
10
  ZERO_ADDRESS,
10
11
  } from "@b3dotfun/sdk/anyspend";
@@ -230,9 +231,13 @@ function AnySpendInner({
230
231
 
231
232
  // State for destination chain/token selection
232
233
  const [selectedDstChainId, setSelectedDstChainId] = useState<number>(initialDstChainId);
234
+ // Helper to check if address is Hyperliquid USDC (supports both 34-char and 42-char formats)
235
+ const isHyperliquidUSDCAddress = (address?: string) =>
236
+ eqci(address, HYPERLIQUID_USDC_ADDRESS) || eqci(address, ZERO_ADDRESS);
237
+
233
238
  const defaultDstToken = isBuyMode
234
239
  ? // Special case: Hyperliquid uses zero address for USDC
235
- destinationTokenChainId === HYPERLIQUID_CHAIN_ID && eqci(destinationTokenAddress, ZERO_ADDRESS)
240
+ destinationTokenChainId === HYPERLIQUID_CHAIN_ID && isHyperliquidUSDCAddress(destinationTokenAddress)
236
241
  ? getHyperliquidUSDCToken()
237
242
  : {
238
243
  symbol: "",
@@ -288,7 +293,7 @@ function AnySpendInner({
288
293
  useEffect(() => {
289
294
  if (selectedDstToken && dstTokenMetadata && !appliedDstMetadataRef.current) {
290
295
  // Skip metadata enhancement for Hyperliquid USDC - we already have correct metadata from getHyperliquidUSDCToken()
291
- if (selectedDstToken.chainId === HYPERLIQUID_CHAIN_ID && eqci(selectedDstToken.address, ZERO_ADDRESS)) {
296
+ if (selectedDstToken.chainId === HYPERLIQUID_CHAIN_ID && isHyperliquidUSDCAddress(selectedDstToken.address)) {
292
297
  appliedDstMetadataRef.current = true;
293
298
  return;
294
299
  }
@@ -1,3 +1,4 @@
1
+ import { ALL_CHAINS } from "@b3dotfun/sdk/anyspend";
1
2
  import { formatUsername } from "@b3dotfun/sdk/shared/utils";
2
3
  import { cn } from "@b3dotfun/sdk/shared/utils/cn";
3
4
  import { shortenAddress } from "@b3dotfun/sdk/shared/utils/formatAddress";
@@ -94,11 +95,21 @@ export function CryptoReceiveSection({
94
95
  <div className="text-as-primary text-2xl font-bold">{dstAmount || "0"}</div>
95
96
  <div className="bg-as-brand/10 border-as-brand/30 flex items-center gap-3 rounded-xl border px-4 py-3">
96
97
  {(dstTokenLogoURI || dstToken.metadata?.logoURI) && (
97
- <img
98
- src={dstTokenLogoURI || dstToken.metadata?.logoURI}
99
- alt={dstTokenSymbol || dstToken.symbol}
100
- className="h-8 w-8 rounded-full"
101
- />
98
+ <div className="relative">
99
+ <img
100
+ src={dstTokenLogoURI || dstToken.metadata?.logoURI}
101
+ alt={dstTokenSymbol || dstToken.symbol}
102
+ className="h-8 w-8 rounded-full"
103
+ />
104
+ {/* Chain logo overlay */}
105
+ {ALL_CHAINS[dstToken.chainId]?.logoUrl && (
106
+ <img
107
+ src={ALL_CHAINS[dstToken.chainId].logoUrl}
108
+ alt="Chain"
109
+ className="absolute -bottom-1 -right-1 h-4 w-4 rounded-full border border-white"
110
+ />
111
+ )}
112
+ </div>
102
113
  )}
103
114
  <span className="text-as-brand text-lg font-bold">{dstTokenSymbol || dstToken.symbol}</span>
104
115
  </div>
@@ -19,7 +19,7 @@ interface PaymentStripeWeb2Props {
19
19
  }
20
20
 
21
21
  export default function PaymentStripeWeb2({ order, stripePaymentIntentId, onPaymentSuccess }: PaymentStripeWeb2Props) {
22
- const { theme } = useB3();
22
+ const { theme, stripePublishableKey } = useB3();
23
23
  const fingerprintConfig = getFingerprintConfig();
24
24
 
25
25
  const { clientSecret, isLoadingStripeClientSecret, stripeClientSecretError } =
@@ -36,7 +36,7 @@ export default function PaymentStripeWeb2({ order, stripePaymentIntentId, onPaym
36
36
  return (
37
37
  <AnySpendFingerprintWrapper fingerprint={fingerprintConfig}>
38
38
  <Elements
39
- stripe={getStripePromise()}
39
+ stripe={getStripePromise(stripePublishableKey)}
40
40
  options={{
41
41
  clientSecret: clientSecret || undefined,
42
42
  appearance: { theme: theme === "light" ? "stripe" : "night" },
@@ -18,6 +18,8 @@ interface WebviewOnrampPaymentProps {
18
18
  recipientAddress?: string;
19
19
  destinationToken: components["schemas"]["Token"];
20
20
  partnerId?: string;
21
+ /** Partner-specific Stripe publishable key. If not provided, uses default B3 Stripe account. */
22
+ stripePublishableKey?: string;
21
23
  anyspendQuote: GetQuoteResponse | undefined;
22
24
  onPaymentSuccess: (orderId: string) => void;
23
25
  userId?: string;
@@ -153,6 +155,7 @@ function WebviewOnrampPaymentInner({
153
155
  srcAmountOnRamp,
154
156
  recipientAddress,
155
157
  destinationToken,
158
+ stripePublishableKey,
156
159
  anyspendQuote,
157
160
  onPaymentSuccess,
158
161
  userId,
@@ -307,7 +310,7 @@ function WebviewOnrampPaymentInner({
307
310
 
308
311
  {/* Stripe Elements */}
309
312
  <Elements
310
- stripe={getStripePromise()}
313
+ stripe={getStripePromise(stripePublishableKey)}
311
314
  options={{
312
315
  clientSecret,
313
316
  appearance: {
@@ -5,6 +5,13 @@ import { avalanche, bsc, polygon } from "viem/chains";
5
5
  export const HYPERLIQUID_CHAIN_ID = 1337;
6
6
  export const HYPEREVM_CHAIN_ID = 999;
7
7
 
8
+ /**
9
+ * Hyperliquid uses a special 34-character USDC address format (0x + 32 hex digits)
10
+ * instead of the standard 42-character EVM address format.
11
+ * This is required by Relay SDK for Hyperliquid integration.
12
+ */
13
+ export const HYPERLIQUID_USDC_ADDRESS = "0x00000000000000000000000000000000";
14
+
8
15
  export function isNativeToken(address: string): boolean {
9
16
  return address.toLowerCase() === ZERO_ADDRESS || address.toLowerCase() === RELAY_SOL_ADDRESS;
10
17
  }
@@ -90,10 +97,10 @@ export function getHyperEVMNativeToken(): components["schemas"]["Token"] {
90
97
  export function getHyperliquidUSDCToken(): components["schemas"]["Token"] {
91
98
  return {
92
99
  chainId: HYPERLIQUID_CHAIN_ID,
93
- address: ZERO_ADDRESS,
100
+ address: HYPERLIQUID_USDC_ADDRESS,
94
101
  symbol: "USDC",
95
102
  name: "USD Coin",
96
- decimals: 6,
103
+ decimals: 8, // Hyperliquid USDC uses 8 decimals, not 6
97
104
  metadata: {
98
105
  logoURI: "https://ethereum-optimism.github.io/data/USDC/logo.png",
99
106
  },
@@ -58,6 +58,7 @@ export function B3Provider({
58
58
  clientType = "rest",
59
59
  rpcUrls,
60
60
  partnerId,
61
+ stripePublishableKey,
61
62
  onConnect,
62
63
  connectors,
63
64
  overrideDefaultConnectors = false,
@@ -77,6 +78,8 @@ export function B3Provider({
77
78
  clientType?: ClientType;
78
79
  rpcUrls?: Record<number, string>;
79
80
  partnerId: string;
81
+ /** Partner-specific Stripe publishable key. If not provided, uses default B3 Stripe account. */
82
+ stripePublishableKey?: string;
80
83
  onConnect?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
81
84
  connectors?: CreateConnectorFn[];
82
85
  overrideDefaultConnectors?: boolean;
@@ -112,6 +115,7 @@ export function B3Provider({
112
115
  automaticallySetFirstEoa={!!automaticallySetFirstEoa}
113
116
  clientType={clientType}
114
117
  partnerId={partnerId}
118
+ stripePublishableKey={stripePublishableKey}
115
119
  createClientReferenceId={createClientReferenceId}
116
120
  enableTurnkey={enableTurnkey}
117
121
  >
@@ -143,6 +147,7 @@ export function InnerProvider({
143
147
  theme = "light",
144
148
  clientType = "socket",
145
149
  partnerId,
150
+ stripePublishableKey,
146
151
  createClientReferenceId,
147
152
  enableTurnkey,
148
153
  }: {
@@ -154,6 +159,7 @@ export function InnerProvider({
154
159
  theme: "light" | "dark";
155
160
  clientType?: ClientType;
156
161
  partnerId: string;
162
+ stripePublishableKey?: string;
157
163
  createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
158
164
  enableTurnkey?: boolean;
159
165
  }) {
@@ -226,6 +232,7 @@ export function InnerProvider({
226
232
  theme,
227
233
  clientType,
228
234
  partnerId: partnerId,
235
+ stripePublishableKey,
229
236
  createClientReferenceId,
230
237
  enableTurnkey,
231
238
  }}
@@ -24,6 +24,7 @@ export interface B3ContextType {
24
24
  theme: "light" | "dark";
25
25
  clientType: ClientType;
26
26
  partnerId: string;
27
+ stripePublishableKey?: string;
27
28
  createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
28
29
  enableTurnkey?: boolean;
29
30
  }
@@ -1,13 +1,23 @@
1
- import { STRIPE_CONFIG, VENDOR_DISPLAY_NAMES } from "@b3dotfun/sdk/anyspend/constants";
1
+ import { getStripePublishableKey, VENDOR_DISPLAY_NAMES } from "@b3dotfun/sdk/anyspend/constants";
2
2
  import { components } from "@b3dotfun/sdk/anyspend/types/api";
3
3
  import { loadStripe } from "@stripe/stripe-js";
4
4
 
5
- let stripePromise: ReturnType<typeof loadStripe> | null = null;
6
- export function getStripePromise() {
7
- if (!stripePromise) {
8
- stripePromise = loadStripe(STRIPE_CONFIG.publishableKey);
5
+ // Cache Stripe promises per publishable key (supports multiple partners)
6
+ const stripePromiseCache: Map<string, ReturnType<typeof loadStripe>> = new Map();
7
+
8
+ /**
9
+ * Get or create a Stripe promise for the given publishable key.
10
+ * @param stripePublishableKey - Partner-specific Stripe publishable key from B3Provider
11
+ */
12
+ export function getStripePromise(stripePublishableKey?: string | null) {
13
+ const publishableKey = getStripePublishableKey(stripePublishableKey);
14
+
15
+ let cached = stripePromiseCache.get(publishableKey);
16
+ if (!cached) {
17
+ cached = loadStripe(publishableKey);
18
+ stripePromiseCache.set(publishableKey, cached);
9
19
  }
10
- return stripePromise;
20
+ return cached;
11
21
  }
12
22
 
13
23
  export function getVendorDisplayName(vendor?: components["schemas"]["OnrampMetadata"]["vendor"]): string {