@b3dotfun/sdk 0.0.5 → 0.0.6-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 (93) hide show
  1. package/dist/cjs/anyspend/constants/index.js +2 -2
  2. package/dist/cjs/anyspend/react/components/AnySpend.js +2 -2
  3. package/dist/cjs/anyspend/react/components/index.d.ts +7 -5
  4. package/dist/cjs/anyspend/react/components/index.js +15 -11
  5. package/dist/cjs/anyspend/react/components/webview/WebviewOnrampOrderStatus.d.ts +6 -0
  6. package/dist/cjs/anyspend/react/components/webview/WebviewOnrampOrderStatus.js +37 -0
  7. package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +12 -0
  8. package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.js +173 -0
  9. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -0
  10. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +4 -3
  11. package/dist/cjs/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +10 -0
  12. package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +10 -0
  13. package/dist/cjs/anyspend/services/anyspend.d.ts +7 -1
  14. package/dist/cjs/anyspend/services/anyspend.js +3 -2
  15. package/dist/cjs/anyspend/types/order.d.ts +18 -0
  16. package/dist/cjs/anyspend/types/order.js +1 -0
  17. package/dist/cjs/anyspend/types/req-res/createOrder.d.ts +50 -0
  18. package/dist/cjs/anyspend/types/req-res/createOrder.js +1 -0
  19. package/dist/cjs/anyspend/types/req-res/getOrderAndTransactions.d.ts +35 -0
  20. package/dist/cjs/anyspend/types/req-res/getOrderHistory.d.ts +25 -0
  21. package/dist/cjs/global-account/react/hooks/index.d.ts +2 -1
  22. package/dist/cjs/global-account/react/hooks/index.js +3 -1
  23. package/dist/cjs/global-account/react/hooks/useB3EnsName.d.ts +9 -0
  24. package/dist/cjs/global-account/react/hooks/useB3EnsName.js +39 -0
  25. package/dist/cjs/global-account/react/hooks/useTokenFromUrl.d.ts +5 -1
  26. package/dist/cjs/global-account/react/hooks/useTokenFromUrl.js +74 -13
  27. package/dist/cjs/shared/constants/chains/supported.d.ts +13 -3
  28. package/dist/cjs/shared/constants/chains/supported.js +15 -9
  29. package/dist/cjs/shared/generated/coingecko-chains.json +1072 -0
  30. package/dist/esm/anyspend/constants/index.js +2 -2
  31. package/dist/esm/anyspend/react/components/AnySpend.js +2 -2
  32. package/dist/esm/anyspend/react/components/index.d.ts +7 -5
  33. package/dist/esm/anyspend/react/components/index.js +7 -5
  34. package/dist/esm/anyspend/react/components/webview/WebviewOnrampOrderStatus.d.ts +6 -0
  35. package/dist/esm/anyspend/react/components/webview/WebviewOnrampOrderStatus.js +31 -0
  36. package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +12 -0
  37. package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.js +167 -0
  38. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -0
  39. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +5 -4
  40. package/dist/esm/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +10 -0
  41. package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +10 -0
  42. package/dist/esm/anyspend/services/anyspend.d.ts +7 -1
  43. package/dist/esm/anyspend/services/anyspend.js +3 -2
  44. package/dist/esm/anyspend/types/order.d.ts +18 -0
  45. package/dist/esm/anyspend/types/order.js +1 -0
  46. package/dist/esm/anyspend/types/req-res/createOrder.d.ts +50 -0
  47. package/dist/esm/anyspend/types/req-res/createOrder.js +1 -0
  48. package/dist/esm/anyspend/types/req-res/getOrderAndTransactions.d.ts +35 -0
  49. package/dist/esm/anyspend/types/req-res/getOrderHistory.d.ts +25 -0
  50. package/dist/esm/global-account/react/hooks/index.d.ts +2 -1
  51. package/dist/esm/global-account/react/hooks/index.js +1 -0
  52. package/dist/esm/global-account/react/hooks/useB3EnsName.d.ts +9 -0
  53. package/dist/esm/global-account/react/hooks/useB3EnsName.js +32 -0
  54. package/dist/esm/global-account/react/hooks/useTokenFromUrl.d.ts +5 -1
  55. package/dist/esm/global-account/react/hooks/useTokenFromUrl.js +73 -13
  56. package/dist/esm/shared/constants/chains/supported.d.ts +13 -3
  57. package/dist/esm/shared/constants/chains/supported.js +13 -8
  58. package/dist/esm/shared/generated/coingecko-chains.json +1072 -0
  59. package/dist/styles/index.css +1 -1
  60. package/dist/types/anyspend/react/components/index.d.ts +7 -5
  61. package/dist/types/anyspend/react/components/webview/WebviewOnrampOrderStatus.d.ts +6 -0
  62. package/dist/types/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +12 -0
  63. package/dist/types/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -0
  64. package/dist/types/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +10 -0
  65. package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +10 -0
  66. package/dist/types/anyspend/services/anyspend.d.ts +7 -1
  67. package/dist/types/anyspend/types/order.d.ts +18 -0
  68. package/dist/types/anyspend/types/req-res/createOrder.d.ts +50 -0
  69. package/dist/types/anyspend/types/req-res/getOrderAndTransactions.d.ts +35 -0
  70. package/dist/types/anyspend/types/req-res/getOrderHistory.d.ts +25 -0
  71. package/dist/types/global-account/react/hooks/index.d.ts +2 -1
  72. package/dist/types/global-account/react/hooks/useB3EnsName.d.ts +9 -0
  73. package/dist/types/global-account/react/hooks/useTokenFromUrl.d.ts +5 -1
  74. package/dist/types/shared/constants/chains/supported.d.ts +13 -3
  75. package/package.json +6 -3
  76. package/src/anyspend/README.md +626 -0
  77. package/src/anyspend/constants/index.ts +2 -4
  78. package/src/anyspend/react/components/AnySpend.tsx +2 -2
  79. package/src/anyspend/react/components/index.ts +7 -5
  80. package/src/anyspend/react/components/webview/WebviewOnrampOrderStatus.tsx +120 -0
  81. package/src/anyspend/react/components/webview/WebviewOnrampPayment.tsx +369 -0
  82. package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +7 -4
  83. package/src/anyspend/services/anyspend.ts +5 -2
  84. package/src/anyspend/types/order.ts +1 -0
  85. package/src/anyspend/types/req-res/createOrder.ts +1 -0
  86. package/src/global-account/react/hooks/index.ts +2 -1
  87. package/src/global-account/react/hooks/useB3EnsName.ts +49 -0
  88. package/src/global-account/react/hooks/useTokenFromUrl.tsx +95 -13
  89. package/src/shared/constants/chains/supported.ts +23 -8
  90. package/src/shared/generated/coingecko-chains.json +1072 -0
  91. /package/dist/cjs/{generated → shared/generated}/chain-networks.json +0 -0
  92. /package/dist/esm/{generated → shared/generated}/chain-networks.json +0 -0
  93. /package/src/{generated → shared/generated}/chain-networks.json +0 -0
@@ -2,8 +2,8 @@
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.USDC_BASE = 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.RELAY_ETH_ADDRESS = exports.ANYSPEND_TESTNET_BASE_URL = exports.ANYSPEND_MAINNET_BASE_URL = void 0;
4
4
  const chains_1 = require("viem/chains");
5
- exports.ANYSPEND_MAINNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://anyspend-mainnet.up.railway.app";
6
- exports.ANYSPEND_TESTNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://anyspend-testnet.up.railway.app";
5
+ exports.ANYSPEND_MAINNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://mainnet.anyspend.com";
6
+ exports.ANYSPEND_TESTNET_BASE_URL = process.env.NEXT_PUBLIC_ANYSPEND_BASE_URL || "https://testnet.anyspend.com";
7
7
  exports.RELAY_ETH_ADDRESS = "0x0000000000000000000000000000000000000000";
8
8
  exports.RELAY_SOL_ADDRESS = "11111111111111111111111111111111";
9
9
  exports.RELAY_SOLANA_MAINNET_CHAIN_ID = 792703809;
@@ -103,7 +103,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
103
103
  name: srcTokenMetadata.name || selectedSrcToken.name,
104
104
  metadata: {
105
105
  ...selectedSrcToken.metadata,
106
- logoURI: srcTokenMetadata.logoURI || selectedSrcToken.metadata?.logoURI
106
+ logoURI: srcTokenMetadata?.logoURI || selectedSrcToken.metadata.logoURI
107
107
  }
108
108
  };
109
109
  setSelectedSrcToken(enhancedToken);
@@ -125,7 +125,7 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
125
125
  name: dstTokenMetadata.name || selectedDstToken.name,
126
126
  metadata: {
127
127
  ...selectedDstToken.metadata,
128
- logoURI: dstTokenMetadata.logoURI || selectedDstToken.metadata?.logoURI
128
+ logoURI: dstTokenMetadata?.logoURI || selectedDstToken.metadata.logoURI
129
129
  }
130
130
  };
131
131
  setSelectedDstToken(enhancedToken);
@@ -1,14 +1,16 @@
1
1
  export { AnySpend } from "./AnySpend";
2
+ export { AnySpendBuySpin } from "./AnySpendBuySpin";
2
3
  export { AnySpendCustom } from "./AnySpendCustom";
3
4
  export { AnySpendNFT } from "./AnySpendNFT";
4
5
  export { AnySpendNFTButton } from "./AnySpendNFTButton";
5
- export { AnySpendTournament } from "./AnySpendTournament";
6
6
  export { AnySpendStakeB3 } from "./AnySpendStakeB3";
7
- export { AnySpendBuySpin } from "./AnySpendBuySpin";
8
- export { OrderHistoryItem } from "./common/OrderHistoryItem";
9
- export { OrderHistory } from "./common/OrderHistory";
7
+ export { AnySpendTournament } from "./AnySpendTournament";
10
8
  export { OrderDetails } from "./common/OrderDetails";
9
+ export { OrderHistory } from "./common/OrderHistory";
10
+ export { OrderHistoryItem } from "./common/OrderHistoryItem";
11
+ export { OrderStatus } from "./common/OrderStatus";
11
12
  export { OrderToken } from "./common/OrderToken";
12
13
  export { OrderTokenAmount } from "./common/OrderTokenAmount";
13
- export { OrderStatus } from "./common/OrderStatus";
14
14
  export { TokenBalance } from "./common/TokenBalance";
15
+ export { WebviewOnrampOrderStatus } from "./webview/WebviewOnrampOrderStatus";
16
+ export { WebviewOnrampPayment } from "./webview/WebviewOnrampPayment";
@@ -1,33 +1,37 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TokenBalance = exports.OrderStatus = exports.OrderTokenAmount = exports.OrderToken = exports.OrderDetails = exports.OrderHistory = exports.OrderHistoryItem = exports.AnySpendBuySpin = exports.AnySpendStakeB3 = exports.AnySpendTournament = exports.AnySpendNFTButton = exports.AnySpendNFT = exports.AnySpendCustom = exports.AnySpend = void 0;
3
+ exports.WebviewOnrampPayment = exports.WebviewOnrampOrderStatus = exports.TokenBalance = exports.OrderTokenAmount = exports.OrderToken = exports.OrderStatus = exports.OrderHistoryItem = exports.OrderHistory = exports.OrderDetails = exports.AnySpendTournament = exports.AnySpendStakeB3 = exports.AnySpendNFTButton = exports.AnySpendNFT = exports.AnySpendCustom = exports.AnySpendBuySpin = exports.AnySpend = void 0;
4
4
  // Components
5
5
  var AnySpend_1 = require("./AnySpend");
6
6
  Object.defineProperty(exports, "AnySpend", { enumerable: true, get: function () { return AnySpend_1.AnySpend; } });
7
+ var AnySpendBuySpin_1 = require("./AnySpendBuySpin");
8
+ Object.defineProperty(exports, "AnySpendBuySpin", { enumerable: true, get: function () { return AnySpendBuySpin_1.AnySpendBuySpin; } });
7
9
  var AnySpendCustom_1 = require("./AnySpendCustom");
8
10
  Object.defineProperty(exports, "AnySpendCustom", { enumerable: true, get: function () { return AnySpendCustom_1.AnySpendCustom; } });
9
11
  var AnySpendNFT_1 = require("./AnySpendNFT");
10
12
  Object.defineProperty(exports, "AnySpendNFT", { enumerable: true, get: function () { return AnySpendNFT_1.AnySpendNFT; } });
11
13
  var AnySpendNFTButton_1 = require("./AnySpendNFTButton");
12
14
  Object.defineProperty(exports, "AnySpendNFTButton", { enumerable: true, get: function () { return AnySpendNFTButton_1.AnySpendNFTButton; } });
13
- var AnySpendTournament_1 = require("./AnySpendTournament");
14
- Object.defineProperty(exports, "AnySpendTournament", { enumerable: true, get: function () { return AnySpendTournament_1.AnySpendTournament; } });
15
15
  var AnySpendStakeB3_1 = require("./AnySpendStakeB3");
16
16
  Object.defineProperty(exports, "AnySpendStakeB3", { enumerable: true, get: function () { return AnySpendStakeB3_1.AnySpendStakeB3; } });
17
- var AnySpendBuySpin_1 = require("./AnySpendBuySpin");
18
- Object.defineProperty(exports, "AnySpendBuySpin", { enumerable: true, get: function () { return AnySpendBuySpin_1.AnySpendBuySpin; } });
17
+ var AnySpendTournament_1 = require("./AnySpendTournament");
18
+ Object.defineProperty(exports, "AnySpendTournament", { enumerable: true, get: function () { return AnySpendTournament_1.AnySpendTournament; } });
19
19
  // Common Components
20
- var OrderHistoryItem_1 = require("./common/OrderHistoryItem");
21
- Object.defineProperty(exports, "OrderHistoryItem", { enumerable: true, get: function () { return OrderHistoryItem_1.OrderHistoryItem; } });
22
- var OrderHistory_1 = require("./common/OrderHistory");
23
- Object.defineProperty(exports, "OrderHistory", { enumerable: true, get: function () { return OrderHistory_1.OrderHistory; } });
24
20
  var OrderDetails_1 = require("./common/OrderDetails");
25
21
  Object.defineProperty(exports, "OrderDetails", { enumerable: true, get: function () { return OrderDetails_1.OrderDetails; } });
22
+ var OrderHistory_1 = require("./common/OrderHistory");
23
+ Object.defineProperty(exports, "OrderHistory", { enumerable: true, get: function () { return OrderHistory_1.OrderHistory; } });
24
+ var OrderHistoryItem_1 = require("./common/OrderHistoryItem");
25
+ Object.defineProperty(exports, "OrderHistoryItem", { enumerable: true, get: function () { return OrderHistoryItem_1.OrderHistoryItem; } });
26
+ var OrderStatus_1 = require("./common/OrderStatus");
27
+ Object.defineProperty(exports, "OrderStatus", { enumerable: true, get: function () { return OrderStatus_1.OrderStatus; } });
26
28
  var OrderToken_1 = require("./common/OrderToken");
27
29
  Object.defineProperty(exports, "OrderToken", { enumerable: true, get: function () { return OrderToken_1.OrderToken; } });
28
30
  var OrderTokenAmount_1 = require("./common/OrderTokenAmount");
29
31
  Object.defineProperty(exports, "OrderTokenAmount", { enumerable: true, get: function () { return OrderTokenAmount_1.OrderTokenAmount; } });
30
- var OrderStatus_1 = require("./common/OrderStatus");
31
- Object.defineProperty(exports, "OrderStatus", { enumerable: true, get: function () { return OrderStatus_1.OrderStatus; } });
32
32
  var TokenBalance_1 = require("./common/TokenBalance");
33
33
  Object.defineProperty(exports, "TokenBalance", { enumerable: true, get: function () { return TokenBalance_1.TokenBalance; } });
34
+ var WebviewOnrampOrderStatus_1 = require("./webview/WebviewOnrampOrderStatus");
35
+ Object.defineProperty(exports, "WebviewOnrampOrderStatus", { enumerable: true, get: function () { return WebviewOnrampOrderStatus_1.WebviewOnrampOrderStatus; } });
36
+ var WebviewOnrampPayment_1 = require("./webview/WebviewOnrampPayment");
37
+ Object.defineProperty(exports, "WebviewOnrampPayment", { enumerable: true, get: function () { return WebviewOnrampPayment_1.WebviewOnrampPayment; } });
@@ -0,0 +1,6 @@
1
+ import { Order } from "../../../../anyspend";
2
+ interface WebviewOnrampOrderStatusProps {
3
+ order: Order;
4
+ }
5
+ export declare function WebviewOnrampOrderStatus({ order }: WebviewOnrampOrderStatusProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.WebviewOnrampOrderStatus = WebviewOnrampOrderStatus;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const anyspend_1 = require("../../../../anyspend");
9
+ const react_1 = require("../../../../global-account/react");
10
+ const centerTruncate_1 = __importDefault(require("../../../../shared/utils/centerTruncate"));
11
+ const lucide_react_1 = require("lucide-react");
12
+ const sonner_1 = require("sonner");
13
+ const viem_1 = require("viem");
14
+ function WebviewOnrampOrderStatus({ order }) {
15
+ console.log(order.status);
16
+ const isPending = order.status === anyspend_1.OrderStatus.WaitingStripePayment ||
17
+ order.status === anyspend_1.OrderStatus.ScanningDepositTransaction ||
18
+ order.status === anyspend_1.OrderStatus.SendingTokenFromVault ||
19
+ order.status === anyspend_1.OrderStatus.ObtainToken ||
20
+ order.status === anyspend_1.OrderStatus.Relay;
21
+ const isExecuted = order.status === anyspend_1.OrderStatus.Executed;
22
+ const isFailed = order.status === anyspend_1.OrderStatus.Failure;
23
+ const isRefunded = order.status === anyspend_1.OrderStatus.Refunded;
24
+ // Get token metadata
25
+ const { data: tokenMetadata } = (0, react_1.useTokenData)(order.metadata.dstToken.chainId, order.metadata.dstToken.address);
26
+ // Only show expected amount for swap orders
27
+ const expectedAmount = order.type === anyspend_1.OrderType.Swap
28
+ ? Number((0, viem_1.formatUnits)(BigInt(order.payload.expectedDstAmount), order.metadata.dstToken.decimals)).toFixed(2)
29
+ : null;
30
+ // Use token metadata logo if available
31
+ const tokenLogoUrl = tokenMetadata?.logoURI || order.metadata.dstToken.metadata?.logoURI;
32
+ const handleCopy = (text, label) => {
33
+ navigator.clipboard.writeText(text);
34
+ sonner_1.toast.success(`${label} copied to clipboard`);
35
+ };
36
+ 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: "flex justify-center", children: (0, jsx_runtime_1.jsxs)(react_1.Badge, { variant: "default", className: "flex items-center gap-3 px-4 py-2 text-base", children: [isPending && (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-4 w-4 animate-spin" }), isExecuted && (0, jsx_runtime_1.jsx)(lucide_react_1.CheckIcon, { className: "h-4 w-4 text-green-500" }), isFailed && (0, jsx_runtime_1.jsx)(lucide_react_1.ExternalLink, { className: "h-4 w-4 text-red-500" }), (0, jsx_runtime_1.jsxs)("span", { children: [isPending && "Processing Payment...", isExecuted && "Payment Complete", isFailed && "Payment Failed", isRefunded && "Payment Refunded"] })] }) }), (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: "Amount Paid" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-lg font-semibold", children: ["$", Number((0, viem_1.formatUnits)(BigInt(order.srcAmount), order.metadata.srcToken.decimals)).toFixed(2)] })] }), order.type === anyspend_1.OrderType.Swap && expectedAmount && ((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: "Est Token Amount" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [tokenLogoUrl && ((0, jsx_runtime_1.jsx)("img", { src: tokenLogoUrl, alt: order.metadata.dstToken.symbol, className: "h-5 w-5 rounded-full" })), (0, jsx_runtime_1.jsxs)("span", { className: "font-medium", children: [expectedAmount, " ", order.metadata.dstToken.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)(order.dstChain) })] }), (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.jsxs)("button", { onClick: () => handleCopy(order.recipientAddress, "Recipient address"), className: "flex items-center gap-2 font-medium transition-colors hover:text-blue-600", children: [(0, centerTruncate_1.default)(order.recipientAddress, 8), (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "h-4 w-4" })] })] }), (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: "Order ID" }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => handleCopy(order.id, "Order ID"), className: "flex items-center gap-2 font-medium transition-colors hover:text-blue-600", children: [(0, centerTruncate_1.default)(order.id, 8), (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "h-4 w-4" })] })] })] })] }) })] }));
37
+ }
@@ -0,0 +1,12 @@
1
+ import { GetQuoteResponse, Token } from "../../../../anyspend";
2
+ interface WebviewOnrampPaymentProps {
3
+ srcAmountOnRamp: string;
4
+ recipientAddress?: string;
5
+ destinationToken: Token;
6
+ partnerId?: string;
7
+ anyspendQuote: GetQuoteResponse | undefined;
8
+ onPaymentSuccess: (orderId: string) => void;
9
+ userId?: string;
10
+ }
11
+ export declare function WebviewOnrampPayment({ srcAmountOnRamp, recipientAddress, destinationToken, anyspendQuote, onPaymentSuccess, userId, partnerId }: WebviewOnrampPaymentProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.WebviewOnrampPayment = WebviewOnrampPayment;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const anyspend_1 = require("../../../../anyspend");
9
+ const centerTruncate_1 = __importDefault(require("../../../../shared/utils/centerTruncate"));
10
+ const react_stripe_js_1 = require("@stripe/react-stripe-js");
11
+ const stripe_js_1 = require("@stripe/stripe-js");
12
+ const framer_motion_1 = require("framer-motion");
13
+ const lucide_react_1 = require("lucide-react");
14
+ const react_1 = require("react");
15
+ const sonner_1 = require("sonner");
16
+ const viem_1 = require("viem");
17
+ const stripePromise = (0, stripe_js_1.loadStripe)(anyspend_1.STRIPE_CONFIG.publishableKey);
18
+ // Stripe Payment Form Component
19
+ function StripePaymentForm({ order, onPaymentSuccess }) {
20
+ const stripe = (0, react_stripe_js_1.useStripe)();
21
+ const elements = (0, react_stripe_js_1.useElements)();
22
+ const [isProcessing, setIsProcessing] = (0, react_1.useState)(false);
23
+ const [error, setError] = (0, react_1.useState)(null);
24
+ const handleSubmit = async (e) => {
25
+ e.preventDefault();
26
+ if (!stripe || !elements) {
27
+ return;
28
+ }
29
+ setIsProcessing(true);
30
+ setError(null);
31
+ try {
32
+ const { error: submitError } = await stripe.confirmPayment({
33
+ elements,
34
+ redirect: "if_required"
35
+ });
36
+ if (submitError) {
37
+ setError(submitError.message || "An error occurred");
38
+ console.error("Payment error:", submitError);
39
+ }
40
+ else {
41
+ console.log("Payment successful");
42
+ onPaymentSuccess(order.id);
43
+ }
44
+ }
45
+ catch (err) {
46
+ setError(err.message || "An error occurred");
47
+ console.error("Payment error:", err);
48
+ }
49
+ finally {
50
+ setIsProcessing(false);
51
+ }
52
+ };
53
+ const stripeElementOptions = {
54
+ layout: "tabs",
55
+ defaultValues: {
56
+ billingDetails: {
57
+ name: "",
58
+ email: ""
59
+ }
60
+ }
61
+ };
62
+ return ((0, jsx_runtime_1.jsx)("form", { onSubmit: handleSubmit, className: "w-full", 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: "Payment Details" }), (0, jsx_runtime_1.jsx)(react_stripe_js_1.PaymentElement, { options: stripeElementOptions }), 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" })) })] }) }) }));
63
+ }
64
+ function WebviewOnrampPayment({ srcAmountOnRamp, recipientAddress, destinationToken, anyspendQuote, onPaymentSuccess, userId, partnerId }) {
65
+ const [stableAmountForGeo, setStableAmountForGeo] = (0, react_1.useState)(srcAmountOnRamp);
66
+ const hasInitialized = (0, react_1.useRef)(false);
67
+ const [createdOrder, setCreatedOrder] = (0, react_1.useState)(null);
68
+ const orderCreationAttempted = (0, react_1.useRef)(false);
69
+ // Only update the stable amount on first render or when explicitly needed
70
+ (0, react_1.useEffect)(() => {
71
+ if (!hasInitialized.current && srcAmountOnRamp) {
72
+ setStableAmountForGeo(srcAmountOnRamp);
73
+ hasInitialized.current = true;
74
+ }
75
+ }, [srcAmountOnRamp]);
76
+ const { geoData, isStripeWeb2Supported, isLoading: isLoadingGeoOnramp } = (0, anyspend_1.useGeoOnrampOptions)(true, stableAmountForGeo);
77
+ const { createOrder, isCreatingOrder } = (0, anyspend_1.useAnyspendCreateOnrampOrder)({
78
+ onSuccess: data => {
79
+ const orderId = data.data.id;
80
+ setCreatedOrder(data.data);
81
+ },
82
+ onError: error => {
83
+ console.error(error);
84
+ sonner_1.toast.error("Failed to create order: " + error.message);
85
+ }
86
+ });
87
+ const { clientSecret, isLoadingStripeClientSecret } = (0, anyspend_1.useStripeClientSecret)(true, createdOrder?.stripePaymentIntentId || "");
88
+ // Create order when component mounts and all required data is available
89
+ (0, react_1.useEffect)(() => {
90
+ const createOrderIfPossible = async () => {
91
+ if (!orderCreationAttempted.current &&
92
+ recipientAddress &&
93
+ srcAmountOnRamp &&
94
+ parseFloat(srcAmountOnRamp) > 0 &&
95
+ isStripeWeb2Supported &&
96
+ anyspendQuote &&
97
+ geoData) {
98
+ orderCreationAttempted.current = true;
99
+ try {
100
+ const getDstToken = () => {
101
+ return {
102
+ ...destinationToken,
103
+ chainId: destinationToken.chainId,
104
+ address: destinationToken.address
105
+ };
106
+ };
107
+ createOrder({
108
+ isMainnet: true,
109
+ recipientAddress,
110
+ orderType: anyspend_1.OrderType.Swap,
111
+ dstChain: getDstToken().chainId,
112
+ dstToken: getDstToken(),
113
+ srcFiatAmount: srcAmountOnRamp,
114
+ onramp: {
115
+ vendor: anyspend_1.OnrampVendor.StripeWeb2,
116
+ paymentMethod: "",
117
+ country: geoData.country || "US",
118
+ ipAddress: geoData.ip,
119
+ redirectUrl: `${window.location.origin}${userId ? `?userId=${userId}` : ""}`
120
+ },
121
+ expectedDstAmount: anyspendQuote.data?.currencyOut?.amount?.toString() || "0",
122
+ partnerId
123
+ });
124
+ }
125
+ catch (err) {
126
+ console.error(err);
127
+ sonner_1.toast.error("Failed to create order: " + err.message);
128
+ }
129
+ }
130
+ };
131
+ createOrderIfPossible();
132
+ }, [
133
+ recipientAddress,
134
+ srcAmountOnRamp,
135
+ isStripeWeb2Supported,
136
+ anyspendQuote,
137
+ geoData,
138
+ createOrder,
139
+ destinationToken,
140
+ userId,
141
+ partnerId
142
+ ]);
143
+ // Check if all required data is loaded
144
+ const isLoading = isLoadingGeoOnramp || !anyspendQuote || !destinationToken.metadata?.logoURI;
145
+ // Show loading state while data is being fetched or order is being created
146
+ if (isLoading || isCreatingOrder || isLoadingStripeClientSecret) {
147
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "mx-auto flex w-full max-w-[460px] flex-col items-center justify-center gap-3 py-12", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-as-brand h-8 w-8 animate-spin" }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/70", children: isCreatingOrder
148
+ ? "Creating payment session..."
149
+ : isLoadingStripeClientSecret
150
+ ? "Loading payment form..."
151
+ : "Loading payment details..." })] }));
152
+ }
153
+ // If we have a created order and client secret, show the payment form
154
+ if (createdOrder && clientSecret) {
155
+ 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
156
+ ? Number((0, viem_1.formatUnits)(BigInt(anyspendQuote.data.currencyOut.amount), destinationToken.decimals)).toFixed(4)
157
+ : "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: stripePromise, options: {
158
+ clientSecret,
159
+ appearance: {
160
+ theme: "flat",
161
+ variables: {
162
+ colorPrimary: "#2563eb",
163
+ colorBackground: "#ffffff",
164
+ borderRadius: "12px"
165
+ }
166
+ }
167
+ }, children: (0, jsx_runtime_1.jsx)(StripePaymentForm, { order: createdOrder, onPaymentSuccess: onPaymentSuccess }) })] }));
168
+ }
169
+ // Show initial order summary while waiting for order creation
170
+ return ((0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.3 }, className: "mx-auto w-full max-w-[460px]", 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
171
+ ? Number((0, viem_1.formatUnits)(BigInt(anyspendQuote.data.currencyOut.amount), destinationToken.decimals)).toFixed(4)
172
+ : "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)] })] })] })] }) }) }));
173
+ }
@@ -14,6 +14,7 @@ export type CreateOnrampOrderParams = {
14
14
  dstToken: Token;
15
15
  srcFiatAmount: string;
16
16
  onramp: OnrampOptions;
17
+ partnerId?: string;
17
18
  expectedDstAmount: string;
18
19
  creatorAddress?: string;
19
20
  nft?: Nft & {
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useAnyspendCreateOnrampOrder = useAnyspendCreateOnrampOrder;
4
+ const constants_1 = require("../../../anyspend/constants");
4
5
  const anyspend_1 = require("../../../anyspend/services/anyspend");
5
6
  const utils_1 = require("../../../anyspend/utils");
6
7
  const react_query_1 = require("@tanstack/react-query");
7
8
  const react_1 = require("react");
8
9
  const viem_1 = require("viem");
9
10
  const chains_1 = require("viem/chains");
10
- const constants_1 = require("../../../anyspend/constants");
11
11
  /**
12
12
  * Hook for creating onramp orders in the Anyspend protocol
13
13
  * Specifically handles orders that involve fiat-to-crypto onramp functionality
@@ -15,7 +15,7 @@ const constants_1 = require("../../../anyspend/constants");
15
15
  function useAnyspendCreateOnrampOrder({ onSuccess, onError } = {}) {
16
16
  const { mutate: createOrder, isPending } = (0, react_query_1.useMutation)({
17
17
  mutationFn: async (params) => {
18
- const { isMainnet, recipientAddress, orderType, dstChain, dstToken, srcFiatAmount, onramp, creatorAddress, expectedDstAmount, nft, tournament, payload } = params;
18
+ const { isMainnet, recipientAddress, orderType, dstChain, dstToken, srcFiatAmount, onramp, creatorAddress, expectedDstAmount, nft, tournament, payload, partnerId } = params;
19
19
  try {
20
20
  // Validate Stripe onramp options
21
21
  if (onramp.vendor === "stripe" && !onramp.ipAddress) {
@@ -57,7 +57,8 @@ function useAnyspendCreateOnrampOrder({ onSuccess, onError } = {}) {
57
57
  tournament,
58
58
  payload
59
59
  }),
60
- creatorAddress: creatorAddress ? (0, utils_1.normalizeAddress)(creatorAddress) : undefined
60
+ creatorAddress: creatorAddress ? (0, utils_1.normalizeAddress)(creatorAddress) : undefined,
61
+ partnerId
61
62
  });
62
63
  }
63
64
  catch (error) {
@@ -46,6 +46,7 @@ export declare function useAnyspendOrderAndTransactions(isMainnet: boolean, orde
46
46
  ipAddress?: string | undefined;
47
47
  } | null;
48
48
  creatorAddress: string | null;
49
+ partnerId: string | null;
49
50
  oneClickBuyUrl: string | null;
50
51
  stripePaymentIntentId: string | null;
51
52
  permit: {
@@ -117,6 +118,7 @@ export declare function useAnyspendOrderAndTransactions(isMainnet: boolean, orde
117
118
  ipAddress?: string | undefined;
118
119
  } | null;
119
120
  creatorAddress: string | null;
121
+ partnerId: string | null;
120
122
  oneClickBuyUrl: string | null;
121
123
  stripePaymentIntentId: string | null;
122
124
  permit: {
@@ -180,6 +182,7 @@ export declare function useAnyspendOrderAndTransactions(isMainnet: boolean, orde
180
182
  ipAddress?: string | undefined;
181
183
  } | null;
182
184
  creatorAddress: string | null;
185
+ partnerId: string | null;
183
186
  oneClickBuyUrl: string | null;
184
187
  stripePaymentIntentId: string | null;
185
188
  permit: {
@@ -243,6 +246,7 @@ export declare function useAnyspendOrderAndTransactions(isMainnet: boolean, orde
243
246
  ipAddress?: string | undefined;
244
247
  } | null;
245
248
  creatorAddress: string | null;
249
+ partnerId: string | null;
246
250
  oneClickBuyUrl: string | null;
247
251
  stripePaymentIntentId: string | null;
248
252
  permit: {
@@ -301,6 +305,7 @@ export declare function useAnyspendOrderAndTransactions(isMainnet: boolean, orde
301
305
  ipAddress?: string | undefined;
302
306
  } | null;
303
307
  creatorAddress: string | null;
308
+ partnerId: string | null;
304
309
  oneClickBuyUrl: string | null;
305
310
  stripePaymentIntentId: string | null;
306
311
  permit: {
@@ -399,6 +404,7 @@ export declare function useAnyspendOrderAndTransactions(isMainnet: boolean, orde
399
404
  ipAddress?: string | undefined;
400
405
  } | null;
401
406
  creatorAddress: string | null;
407
+ partnerId: string | null;
402
408
  oneClickBuyUrl: string | null;
403
409
  stripePaymentIntentId: string | null;
404
410
  permit: {
@@ -470,6 +476,7 @@ export declare function useAnyspendOrderAndTransactions(isMainnet: boolean, orde
470
476
  ipAddress?: string | undefined;
471
477
  } | null;
472
478
  creatorAddress: string | null;
479
+ partnerId: string | null;
473
480
  oneClickBuyUrl: string | null;
474
481
  stripePaymentIntentId: string | null;
475
482
  permit: {
@@ -533,6 +540,7 @@ export declare function useAnyspendOrderAndTransactions(isMainnet: boolean, orde
533
540
  ipAddress?: string | undefined;
534
541
  } | null;
535
542
  creatorAddress: string | null;
543
+ partnerId: string | null;
536
544
  oneClickBuyUrl: string | null;
537
545
  stripePaymentIntentId: string | null;
538
546
  permit: {
@@ -596,6 +604,7 @@ export declare function useAnyspendOrderAndTransactions(isMainnet: boolean, orde
596
604
  ipAddress?: string | undefined;
597
605
  } | null;
598
606
  creatorAddress: string | null;
607
+ partnerId: string | null;
599
608
  oneClickBuyUrl: string | null;
600
609
  stripePaymentIntentId: string | null;
601
610
  permit: {
@@ -654,6 +663,7 @@ export declare function useAnyspendOrderAndTransactions(isMainnet: boolean, orde
654
663
  ipAddress?: string | undefined;
655
664
  } | null;
656
665
  creatorAddress: string | null;
666
+ partnerId: string | null;
657
667
  oneClickBuyUrl: string | null;
658
668
  stripePaymentIntentId: string | null;
659
669
  permit: {
@@ -43,6 +43,7 @@ export declare function useAnyspendOrderHistory(isMainnet: boolean, creatorAddre
43
43
  ipAddress?: string | undefined;
44
44
  } | null;
45
45
  creatorAddress: string | null;
46
+ partnerId: string | null;
46
47
  oneClickBuyUrl: string | null;
47
48
  stripePaymentIntentId: string | null;
48
49
  permit: {
@@ -114,6 +115,7 @@ export declare function useAnyspendOrderHistory(isMainnet: boolean, creatorAddre
114
115
  ipAddress?: string | undefined;
115
116
  } | null;
116
117
  creatorAddress: string | null;
118
+ partnerId: string | null;
117
119
  oneClickBuyUrl: string | null;
118
120
  stripePaymentIntentId: string | null;
119
121
  permit: {
@@ -177,6 +179,7 @@ export declare function useAnyspendOrderHistory(isMainnet: boolean, creatorAddre
177
179
  ipAddress?: string | undefined;
178
180
  } | null;
179
181
  creatorAddress: string | null;
182
+ partnerId: string | null;
180
183
  oneClickBuyUrl: string | null;
181
184
  stripePaymentIntentId: string | null;
182
185
  permit: {
@@ -240,6 +243,7 @@ export declare function useAnyspendOrderHistory(isMainnet: boolean, creatorAddre
240
243
  ipAddress?: string | undefined;
241
244
  } | null;
242
245
  creatorAddress: string | null;
246
+ partnerId: string | null;
243
247
  oneClickBuyUrl: string | null;
244
248
  stripePaymentIntentId: string | null;
245
249
  permit: {
@@ -298,6 +302,7 @@ export declare function useAnyspendOrderHistory(isMainnet: boolean, creatorAddre
298
302
  ipAddress?: string | undefined;
299
303
  } | null;
300
304
  creatorAddress: string | null;
305
+ partnerId: string | null;
301
306
  oneClickBuyUrl: string | null;
302
307
  stripePaymentIntentId: string | null;
303
308
  permit: {
@@ -360,6 +365,7 @@ export declare function useAnyspendOrderHistory(isMainnet: boolean, creatorAddre
360
365
  ipAddress?: string | undefined;
361
366
  } | null;
362
367
  creatorAddress: string | null;
368
+ partnerId: string | null;
363
369
  oneClickBuyUrl: string | null;
364
370
  stripePaymentIntentId: string | null;
365
371
  permit: {
@@ -431,6 +437,7 @@ export declare function useAnyspendOrderHistory(isMainnet: boolean, creatorAddre
431
437
  ipAddress?: string | undefined;
432
438
  } | null;
433
439
  creatorAddress: string | null;
440
+ partnerId: string | null;
434
441
  oneClickBuyUrl: string | null;
435
442
  stripePaymentIntentId: string | null;
436
443
  permit: {
@@ -494,6 +501,7 @@ export declare function useAnyspendOrderHistory(isMainnet: boolean, creatorAddre
494
501
  ipAddress?: string | undefined;
495
502
  } | null;
496
503
  creatorAddress: string | null;
504
+ partnerId: string | null;
497
505
  oneClickBuyUrl: string | null;
498
506
  stripePaymentIntentId: string | null;
499
507
  permit: {
@@ -557,6 +565,7 @@ export declare function useAnyspendOrderHistory(isMainnet: boolean, creatorAddre
557
565
  ipAddress?: string | undefined;
558
566
  } | null;
559
567
  creatorAddress: string | null;
568
+ partnerId: string | null;
560
569
  oneClickBuyUrl: string | null;
561
570
  stripePaymentIntentId: string | null;
562
571
  permit: {
@@ -615,6 +624,7 @@ export declare function useAnyspendOrderHistory(isMainnet: boolean, creatorAddre
615
624
  ipAddress?: string | undefined;
616
625
  } | null;
617
626
  creatorAddress: string | null;
627
+ partnerId: string | null;
618
628
  oneClickBuyUrl: string | null;
619
629
  stripePaymentIntentId: string | null;
620
630
  permit: {
@@ -4,7 +4,7 @@ export declare const anyspendService: {
4
4
  getTokenList: (isMainnet: boolean, chainId: number, query: string) => Promise<Token[]>;
5
5
  getToken: (isMainnet: boolean, chainId: number, tokenAddress: string) => Promise<Token>;
6
6
  getQuote: (isMainnet: boolean, req: GetQuoteRequest) => Promise<GetQuoteResponse>;
7
- createOrder: ({ isMainnet, recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress }: {
7
+ createOrder: ({ isMainnet, recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress, partnerId }: {
8
8
  isMainnet: boolean;
9
9
  recipientAddress: string;
10
10
  type: string;
@@ -17,6 +17,7 @@ export declare const anyspendService: {
17
17
  onramp?: OnrampOptions;
18
18
  metadata: Record<string, any>;
19
19
  creatorAddress?: string;
20
+ partnerId?: string;
20
21
  }) => Promise<any>;
21
22
  getOrderAndTransactions: (isMainnet: boolean, orderId: string | undefined) => Promise<GetOrderAndTxsResponse>;
22
23
  getOrderHistory: (isMainnet: boolean, creatorAddress: string | undefined, limit?: number, offset?: number) => Promise<{
@@ -65,6 +66,7 @@ export declare const anyspendService: {
65
66
  ipAddress?: string | undefined;
66
67
  } | null;
67
68
  creatorAddress: string | null;
69
+ partnerId: string | null;
68
70
  oneClickBuyUrl: string | null;
69
71
  stripePaymentIntentId: string | null;
70
72
  permit: {
@@ -136,6 +138,7 @@ export declare const anyspendService: {
136
138
  ipAddress?: string | undefined;
137
139
  } | null;
138
140
  creatorAddress: string | null;
141
+ partnerId: string | null;
139
142
  oneClickBuyUrl: string | null;
140
143
  stripePaymentIntentId: string | null;
141
144
  permit: {
@@ -199,6 +202,7 @@ export declare const anyspendService: {
199
202
  ipAddress?: string | undefined;
200
203
  } | null;
201
204
  creatorAddress: string | null;
205
+ partnerId: string | null;
202
206
  oneClickBuyUrl: string | null;
203
207
  stripePaymentIntentId: string | null;
204
208
  permit: {
@@ -262,6 +266,7 @@ export declare const anyspendService: {
262
266
  ipAddress?: string | undefined;
263
267
  } | null;
264
268
  creatorAddress: string | null;
269
+ partnerId: string | null;
265
270
  oneClickBuyUrl: string | null;
266
271
  stripePaymentIntentId: string | null;
267
272
  permit: {
@@ -320,6 +325,7 @@ export declare const anyspendService: {
320
325
  ipAddress?: string | undefined;
321
326
  } | null;
322
327
  creatorAddress: string | null;
328
+ partnerId: string | null;
323
329
  oneClickBuyUrl: string | null;
324
330
  stripePaymentIntentId: string | null;
325
331
  permit: {
@@ -43,7 +43,7 @@ exports.anyspendService = {
43
43
  return data;
44
44
  },
45
45
  // Order related
46
- createOrder: async ({ isMainnet, recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress }) => {
46
+ createOrder: async ({ isMainnet, recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress, partnerId }) => {
47
47
  const response = await fetch(`${isMainnet ? constants_1.ANYSPEND_MAINNET_BASE_URL : constants_1.ANYSPEND_TESTNET_BASE_URL}/orders`, {
48
48
  method: "POST",
49
49
  headers: {
@@ -60,7 +60,8 @@ exports.anyspendService = {
60
60
  payload,
61
61
  onramp,
62
62
  metadata,
63
- creatorAddress
63
+ creatorAddress,
64
+ partnerId
64
65
  })
65
66
  });
66
67
  const data = await response.json();