@b3dotfun/sdk 0.0.9-alpha.3 → 0.0.9-alpha.4

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.
@@ -355,7 +355,7 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
355
355
  }
356
356
  }
357
357
  };
358
- const recipientSection = showRecipient && recipientAddress ? ((0, jsx_runtime_1.jsxs)(framer_motion_1.motion.div, { initial: false, animate: {
358
+ const recipientSection = showRecipient ? ((0, jsx_runtime_1.jsxs)(framer_motion_1.motion.div, { initial: false, animate: {
359
359
  opacity: hasMounted ? 1 : 0,
360
360
  y: hasMounted ? 0 : 20,
361
361
  filter: hasMounted ? "blur(0px)" : "blur(10px)",
@@ -365,7 +365,7 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
365
365
  ? "Receive NFT at"
366
366
  : orderType === "join_tournament"
367
367
  ? "Join for"
368
- : "Recipient" }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)(react_2.Button, { variant: "outline", className: "w-full justify-between border-none p-0", onClick: () => setIsRecipientModalOpen(true), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [recipientImageUrl && ((0, jsx_runtime_1.jsx)("img", { src: recipientImageUrl, alt: recipientImageUrl, className: "bg-b3-react-foreground size-7 rounded-full object-cover opacity-100" })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-start gap-1", children: [recipientEnsName && (0, jsx_runtime_1.jsxs)("span", { children: ["@", recipientEnsName] }), (0, jsx_runtime_1.jsx)("span", { children: (0, centerTruncate_1.default)(recipientAddress) })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "ml-2 size-4 shrink-0 opacity-50" })] }) })] })) : null;
368
+ : "Recipient" }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)(react_2.Button, { variant: "outline", className: "w-full justify-between border-none p-0", onClick: () => setIsRecipientModalOpen(true), children: [recipientAddress ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [recipientImageUrl && ((0, jsx_runtime_1.jsx)("img", { src: recipientImageUrl, alt: recipientImageUrl, className: "bg-b3-react-foreground size-7 rounded-full object-cover opacity-100" })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-start gap-1", children: [recipientEnsName && (0, jsx_runtime_1.jsxs)("span", { children: ["@", recipientEnsName] }), (0, jsx_runtime_1.jsx)("span", { children: (0, centerTruncate_1.default)(recipientAddress) })] })] })) : ((0, jsx_runtime_1.jsx)("div", { className: "text-b3-react-foreground/60 flex items-center gap-2", children: (0, jsx_runtime_1.jsx)("span", { children: "Select address" }) })), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "ml-2 size-4 shrink-0 opacity-50" })] }) })] }, recipientAddress)) : null;
369
369
  const historyView = ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("mx-auto flex w-full max-w-2xl flex-col items-center p-5", mode === "modal" && "bg-b3-react-background"), children: (0, jsx_runtime_1.jsx)(OrderHistory_1.OrderHistory, { mode: mode, onBack: () => {
370
370
  setActivePanel(PanelView.HISTORY);
371
371
  }, onSelectOrder: onSelectOrder }) }));
@@ -394,7 +394,7 @@ function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", recipient
394
394
  opacity: hasMounted ? 1 : 0,
395
395
  y: hasMounted ? 0 : 20,
396
396
  filter: hasMounted ? "blur(0px)" : "blur(10px)",
397
- }, transition: { duration: 0.3, delay: 0.3, ease: "easeInOut" }, className: "flex w-full flex-col gap-2", children: (0, jsx_runtime_1.jsx)(react_2.ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", disabled: isCreatingOrder || isLoadingAnyspendQuote || !anyspendQuote, onClick: () => handleConfirmOrder(), className: "relative w-full", children: isCreatingOrder ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "size-4 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { children: "Creating order..." })] })) : isLoadingAnyspendQuote ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "size-4 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { children: "Loading quote..." })] })) : anyspendQuote ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { children: "Checkout" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "absolute right-0 top-1/2 size-6 -translate-y-1/2 opacity-70" })] })) : ("No quote found") }) }) })] }) }), (0, jsx_runtime_1.jsx)(react_2.TabsContent, { value: "fiat", children: (0, jsx_runtime_1.jsx)("div", { className: "mt-6 flex w-full flex-col gap-6", children: (0, jsx_runtime_1.jsx)(PanelOnrampPayment_1.PanelOnrampPayment, { srcAmountOnRamp: anyspendQuote?.data?.currencyIn?.amountUsd || "0", recipientName: recipientEnsName, recipientAddress: recipientAddress, isMainnet: isMainnet, isBuyMode: false, selectedDstChainId: dstChainId, selectedDstToken: dstToken, anyspendQuote: anyspendQuote, globalAddress: currentWallet?.wallet?.address, onOrderCreated: (orderId) => setOrderId(orderId), onBack: () => setActiveTab("crypto"), orderType: orderType, nft: metadata.type === "mint_nft"
397
+ }, transition: { duration: 0.3, delay: 0.3, ease: "easeInOut" }, className: "flex w-full flex-col gap-2", children: (0, jsx_runtime_1.jsx)(react_2.ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", disabled: isCreatingOrder || isLoadingAnyspendQuote || !anyspendQuote || !recipientAddress, onClick: () => handleConfirmOrder(), className: "relative w-full", children: isCreatingOrder ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "size-4 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { children: "Creating order..." })] })) : isLoadingAnyspendQuote ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "size-4 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { children: "Loading quote..." })] })) : anyspendQuote && recipientAddress ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { children: "Checkout" }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightCircle, { className: "absolute right-0 top-1/2 size-6 -translate-y-1/2 opacity-70" })] })) : recipientAddress ? ("No quote found") : ("Please select a recipient") }) }) })] }) }), (0, jsx_runtime_1.jsx)(react_2.TabsContent, { value: "fiat", children: (0, jsx_runtime_1.jsx)("div", { className: "mt-6 flex w-full flex-col gap-6", children: (0, jsx_runtime_1.jsx)(PanelOnrampPayment_1.PanelOnrampPayment, { srcAmountOnRamp: anyspendQuote?.data?.currencyIn?.amountUsd || "0", recipientName: recipientEnsName, recipientAddress: recipientAddress, isMainnet: isMainnet, isBuyMode: false, selectedDstChainId: dstChainId, selectedDstToken: dstToken, anyspendQuote: anyspendQuote, globalAddress: currentWallet?.wallet?.address, onOrderCreated: (orderId) => setOrderId(orderId), onBack: () => setActiveTab("crypto"), orderType: orderType, nft: metadata.type === "mint_nft"
398
398
  ? metadata.nftContract.type === "erc1155"
399
399
  ? {
400
400
  type: "erc1155",
@@ -349,7 +349,7 @@ export function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", re
349
349
  }
350
350
  }
351
351
  };
352
- const recipientSection = showRecipient && recipientAddress ? (_jsxs(motion.div, { initial: false, animate: {
352
+ const recipientSection = showRecipient ? (_jsxs(motion.div, { initial: false, animate: {
353
353
  opacity: hasMounted ? 1 : 0,
354
354
  y: hasMounted ? 0 : 20,
355
355
  filter: hasMounted ? "blur(0px)" : "blur(10px)",
@@ -359,7 +359,7 @@ export function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", re
359
359
  ? "Receive NFT at"
360
360
  : orderType === "join_tournament"
361
361
  ? "Join for"
362
- : "Recipient" }), _jsx("div", { children: _jsxs(Button, { variant: "outline", className: "w-full justify-between border-none p-0", onClick: () => setIsRecipientModalOpen(true), children: [_jsxs("div", { className: "flex items-center gap-2", children: [recipientImageUrl && (_jsx("img", { src: recipientImageUrl, alt: recipientImageUrl, className: "bg-b3-react-foreground size-7 rounded-full object-cover opacity-100" })), _jsxs("div", { className: "flex flex-col items-start gap-1", children: [recipientEnsName && _jsxs("span", { children: ["@", recipientEnsName] }), _jsx("span", { children: centerTruncate(recipientAddress) })] })] }), _jsx(ChevronRightCircle, { className: "ml-2 size-4 shrink-0 opacity-50" })] }) })] })) : null;
362
+ : "Recipient" }), _jsx("div", { children: _jsxs(Button, { variant: "outline", className: "w-full justify-between border-none p-0", onClick: () => setIsRecipientModalOpen(true), children: [recipientAddress ? (_jsxs("div", { className: "flex items-center gap-2", children: [recipientImageUrl && (_jsx("img", { src: recipientImageUrl, alt: recipientImageUrl, className: "bg-b3-react-foreground size-7 rounded-full object-cover opacity-100" })), _jsxs("div", { className: "flex flex-col items-start gap-1", children: [recipientEnsName && _jsxs("span", { children: ["@", recipientEnsName] }), _jsx("span", { children: centerTruncate(recipientAddress) })] })] })) : (_jsx("div", { className: "text-b3-react-foreground/60 flex items-center gap-2", children: _jsx("span", { children: "Select address" }) })), _jsx(ChevronRightCircle, { className: "ml-2 size-4 shrink-0 opacity-50" })] }) })] }, recipientAddress)) : null;
363
363
  const historyView = (_jsx("div", { className: cn("mx-auto flex w-full max-w-2xl flex-col items-center p-5", mode === "modal" && "bg-b3-react-background"), children: _jsx(OrderHistory, { mode: mode, onBack: () => {
364
364
  setActivePanel(PanelView.HISTORY);
365
365
  }, onSelectOrder: onSelectOrder }) }));
@@ -388,7 +388,7 @@ export function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", re
388
388
  opacity: hasMounted ? 1 : 0,
389
389
  y: hasMounted ? 0 : 20,
390
390
  filter: hasMounted ? "blur(0px)" : "blur(10px)",
391
- }, transition: { duration: 0.3, delay: 0.3, ease: "easeInOut" }, className: "flex w-full flex-col gap-2", children: _jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", disabled: isCreatingOrder || isLoadingAnyspendQuote || !anyspendQuote, onClick: () => handleConfirmOrder(), className: "relative w-full", children: isCreatingOrder ? (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Loader2, { className: "size-4 animate-spin" }), _jsx("span", { children: "Creating order..." })] })) : isLoadingAnyspendQuote ? (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Loader2, { className: "size-4 animate-spin" }), _jsx("span", { children: "Loading quote..." })] })) : anyspendQuote ? (_jsxs(_Fragment, { children: [_jsx("span", { children: "Checkout" }), _jsx(ChevronRightCircle, { className: "absolute right-0 top-1/2 size-6 -translate-y-1/2 opacity-70" })] })) : ("No quote found") }) }) })] }) }), _jsx(TabsContent, { value: "fiat", children: _jsx("div", { className: "mt-6 flex w-full flex-col gap-6", children: _jsx(PanelOnrampPayment, { srcAmountOnRamp: anyspendQuote?.data?.currencyIn?.amountUsd || "0", recipientName: recipientEnsName, recipientAddress: recipientAddress, isMainnet: isMainnet, isBuyMode: false, selectedDstChainId: dstChainId, selectedDstToken: dstToken, anyspendQuote: anyspendQuote, globalAddress: currentWallet?.wallet?.address, onOrderCreated: (orderId) => setOrderId(orderId), onBack: () => setActiveTab("crypto"), orderType: orderType, nft: metadata.type === "mint_nft"
391
+ }, transition: { duration: 0.3, delay: 0.3, ease: "easeInOut" }, className: "flex w-full flex-col gap-2", children: _jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", disabled: isCreatingOrder || isLoadingAnyspendQuote || !anyspendQuote || !recipientAddress, onClick: () => handleConfirmOrder(), className: "relative w-full", children: isCreatingOrder ? (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Loader2, { className: "size-4 animate-spin" }), _jsx("span", { children: "Creating order..." })] })) : isLoadingAnyspendQuote ? (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Loader2, { className: "size-4 animate-spin" }), _jsx("span", { children: "Loading quote..." })] })) : anyspendQuote && recipientAddress ? (_jsxs(_Fragment, { children: [_jsx("span", { children: "Checkout" }), _jsx(ChevronRightCircle, { className: "absolute right-0 top-1/2 size-6 -translate-y-1/2 opacity-70" })] })) : recipientAddress ? ("No quote found") : ("Please select a recipient") }) }) })] }) }), _jsx(TabsContent, { value: "fiat", children: _jsx("div", { className: "mt-6 flex w-full flex-col gap-6", children: _jsx(PanelOnrampPayment, { srcAmountOnRamp: anyspendQuote?.data?.currencyIn?.amountUsd || "0", recipientName: recipientEnsName, recipientAddress: recipientAddress, isMainnet: isMainnet, isBuyMode: false, selectedDstChainId: dstChainId, selectedDstToken: dstToken, anyspendQuote: anyspendQuote, globalAddress: currentWallet?.wallet?.address, onOrderCreated: (orderId) => setOrderId(orderId), onBack: () => setActiveTab("crypto"), orderType: orderType, nft: metadata.type === "mint_nft"
392
392
  ? metadata.nftContract.type === "erc1155"
393
393
  ? {
394
394
  type: "erc1155",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.9-alpha.3",
3
+ "version": "0.0.9-alpha.4",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -494,33 +494,34 @@ export function AnySpendCustom({
494
494
  }
495
495
  };
496
496
 
497
- const recipientSection =
498
- showRecipient && recipientAddress ? (
499
- <motion.div
500
- initial={false}
501
- animate={{
502
- opacity: hasMounted ? 1 : 0,
503
- y: hasMounted ? 0 : 20,
504
- filter: hasMounted ? "blur(0px)" : "blur(10px)",
505
- }}
506
- transition={{ duration: 0.3, delay: 0.2, ease: "easeInOut" }}
507
- className="flex w-full items-center justify-between gap-4"
508
- >
509
- <div className="text-b3-react-foreground">
510
- {orderType === "swap"
511
- ? "Recipient"
512
- : orderType === "mint_nft"
513
- ? "Receive NFT at"
514
- : orderType === "join_tournament"
515
- ? "Join for"
516
- : "Recipient"}
517
- </div>
518
- <div>
519
- <Button
520
- variant="outline"
521
- className="w-full justify-between border-none p-0"
522
- onClick={() => setIsRecipientModalOpen(true)}
523
- >
497
+ const recipientSection = showRecipient ? (
498
+ <motion.div
499
+ initial={false}
500
+ key={recipientAddress}
501
+ animate={{
502
+ opacity: hasMounted ? 1 : 0,
503
+ y: hasMounted ? 0 : 20,
504
+ filter: hasMounted ? "blur(0px)" : "blur(10px)",
505
+ }}
506
+ transition={{ duration: 0.3, delay: 0.2, ease: "easeInOut" }}
507
+ className="flex w-full items-center justify-between gap-4"
508
+ >
509
+ <div className="text-b3-react-foreground">
510
+ {orderType === "swap"
511
+ ? "Recipient"
512
+ : orderType === "mint_nft"
513
+ ? "Receive NFT at"
514
+ : orderType === "join_tournament"
515
+ ? "Join for"
516
+ : "Recipient"}
517
+ </div>
518
+ <div>
519
+ <Button
520
+ variant="outline"
521
+ className="w-full justify-between border-none p-0"
522
+ onClick={() => setIsRecipientModalOpen(true)}
523
+ >
524
+ {recipientAddress ? (
524
525
  <div className="flex items-center gap-2">
525
526
  {recipientImageUrl && (
526
527
  <img
@@ -534,11 +535,16 @@ export function AnySpendCustom({
534
535
  <span>{centerTruncate(recipientAddress)}</span>
535
536
  </div>
536
537
  </div>
537
- <ChevronRightCircle className="ml-2 size-4 shrink-0 opacity-50" />
538
- </Button>
539
- </div>
540
- </motion.div>
541
- ) : null;
538
+ ) : (
539
+ <div className="text-b3-react-foreground/60 flex items-center gap-2">
540
+ <span>Select address</span>
541
+ </div>
542
+ )}
543
+ <ChevronRightCircle className="ml-2 size-4 shrink-0 opacity-50" />
544
+ </Button>
545
+ </div>
546
+ </motion.div>
547
+ ) : null;
542
548
 
543
549
  const historyView = (
544
550
  <div
@@ -776,7 +782,7 @@ export function AnySpendCustom({
776
782
  <ShinyButton
777
783
  accentColor={"hsl(var(--as-brand))"}
778
784
  textColor="text-white"
779
- disabled={isCreatingOrder || isLoadingAnyspendQuote || !anyspendQuote}
785
+ disabled={isCreatingOrder || isLoadingAnyspendQuote || !anyspendQuote || !recipientAddress}
780
786
  onClick={() => handleConfirmOrder()}
781
787
  className="relative w-full"
782
788
  >
@@ -790,13 +796,15 @@ export function AnySpendCustom({
790
796
  <Loader2 className="size-4 animate-spin" />
791
797
  <span>Loading quote...</span>
792
798
  </div>
793
- ) : anyspendQuote ? (
799
+ ) : anyspendQuote && recipientAddress ? (
794
800
  <>
795
801
  <span>Checkout</span>
796
802
  <ChevronRightCircle className="absolute right-0 top-1/2 size-6 -translate-y-1/2 opacity-70" />
797
803
  </>
798
- ) : (
804
+ ) : recipientAddress ? (
799
805
  "No quote found"
806
+ ) : (
807
+ "Please select a recipient"
800
808
  )}
801
809
  </ShinyButton>
802
810
  </motion.div>