@b3dotfun/sdk 0.0.4-alpha.2 → 0.0.5-alpha.1

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 (190) hide show
  1. package/dist/cjs/anyspend/index.js +0 -1
  2. package/dist/cjs/anyspend/react/components/AnySpend.js +2 -2
  3. package/dist/cjs/anyspend/react/components/index.d.ts +1 -0
  4. package/dist/cjs/anyspend/react/components/index.js +3 -1
  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 +3 -2
  8. package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.js +141 -61
  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/services/anyspend.d.ts +2 -1
  12. package/dist/cjs/anyspend/services/anyspend.js +3 -2
  13. package/dist/cjs/global-account/react/hooks/useTokenFromUrl.d.ts +4 -0
  14. package/dist/cjs/global-account/react/hooks/useTokenFromUrl.js +23 -0
  15. package/dist/cjs/shared/constants/chains/supported.d.ts +2 -6
  16. package/dist/cjs/shared/constants/chains/supported.js +6 -3
  17. package/dist/esm/anyspend/index.js +13 -14
  18. package/dist/esm/anyspend/index.native.js +13 -13
  19. package/dist/esm/anyspend/react/components/AnySpend.js +15 -15
  20. package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +8 -8
  21. package/dist/esm/anyspend/react/components/AnySpendCustom.js +14 -14
  22. package/dist/esm/anyspend/react/components/AnySpendNFT.js +7 -7
  23. package/dist/esm/anyspend/react/components/AnySpendNFTButton.js +2 -2
  24. package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +7 -7
  25. package/dist/esm/anyspend/react/components/AnySpendTournament.js +4 -4
  26. package/dist/esm/anyspend/react/components/common/OrderDetails.js +6 -6
  27. package/dist/esm/anyspend/react/components/common/OrderHistory.js +3 -3
  28. package/dist/esm/anyspend/react/components/common/OrderHistoryItem.js +4 -4
  29. package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
  30. package/dist/esm/anyspend/react/components/common/OrderToken.js +6 -6
  31. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +4 -4
  32. package/dist/esm/anyspend/react/components/common/PanelOnramp.js +3 -3
  33. package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +3 -3
  34. package/dist/esm/anyspend/react/components/common/PaymentMethodIcons.js +1 -1
  35. package/dist/esm/anyspend/react/components/common/PaymentOneClick.js +3 -3
  36. package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +6 -6
  37. package/dist/esm/anyspend/react/components/common/PaymentVendorUI.js +3 -3
  38. package/dist/esm/anyspend/react/components/common/TokenBalance.js +1 -1
  39. package/dist/esm/anyspend/react/components/index.d.ts +1 -0
  40. package/dist/esm/anyspend/react/components/index.js +16 -15
  41. package/dist/esm/anyspend/react/components/modals/EnterRecipientModal.js +1 -1
  42. package/dist/esm/anyspend/react/components/webview/WebviewOnrampOrderStatus.d.ts +6 -0
  43. package/dist/esm/anyspend/react/components/webview/WebviewOnrampOrderStatus.js +31 -0
  44. package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +3 -2
  45. package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.js +140 -60
  46. package/dist/esm/anyspend/react/hooks/index.js +13 -13
  47. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -0
  48. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +6 -5
  49. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +2 -2
  50. package/dist/esm/anyspend/react/hooks/useAnyspendOrderAndTransactions.js +1 -1
  51. package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.js +1 -1
  52. package/dist/esm/anyspend/react/hooks/useAnyspendQuote.js +2 -2
  53. package/dist/esm/anyspend/react/hooks/useAnyspendSendPermitData.js +1 -1
  54. package/dist/esm/anyspend/react/hooks/useAnyspendTokens.js +1 -1
  55. package/dist/esm/anyspend/react/hooks/useCoinbaseOnrampOptions.js +1 -1
  56. package/dist/esm/anyspend/react/hooks/useGeoOnrampOptions.js +3 -3
  57. package/dist/esm/anyspend/react/hooks/usePermitData.js +2 -2
  58. package/dist/esm/anyspend/react/hooks/useStripeClientSecret.js +1 -1
  59. package/dist/esm/anyspend/react/hooks/useStripeSupport.js +1 -1
  60. package/dist/esm/anyspend/react/index.js +3 -3
  61. package/dist/esm/anyspend/services/anyspend.d.ts +2 -1
  62. package/dist/esm/anyspend/services/anyspend.js +6 -5
  63. package/dist/esm/anyspend/types/custom.js +1 -1
  64. package/dist/esm/anyspend/types/index.js +13 -13
  65. package/dist/esm/anyspend/types/nft.js +1 -1
  66. package/dist/esm/anyspend/types/order.js +6 -6
  67. package/dist/esm/anyspend/types/req-res/createOrder.js +6 -6
  68. package/dist/esm/anyspend/types/req-res/getOrderAndTransactions.js +2 -2
  69. package/dist/esm/anyspend/types/req-res/getOrderHistory.js +1 -1
  70. package/dist/esm/anyspend/types/req-res/getQuote.js +3 -3
  71. package/dist/esm/anyspend/types/req-res/index.js +8 -8
  72. package/dist/esm/anyspend/types/req-res/sendPermitData.js +1 -1
  73. package/dist/esm/anyspend/types/swap.js +1 -1
  74. package/dist/esm/anyspend/types/tournament.js +1 -1
  75. package/dist/esm/anyspend/types/transaction.js +1 -1
  76. package/dist/esm/anyspend/utils/chain.js +3 -3
  77. package/dist/esm/anyspend/utils/format.js +1 -1
  78. package/dist/esm/anyspend/utils/index.js +8 -8
  79. package/dist/esm/anyspend/utils/orderPayload.js +2 -2
  80. package/dist/esm/anyspend/utils/token.js +1 -1
  81. package/dist/esm/global-account/app.js +1 -1
  82. package/dist/esm/global-account/index.js +1 -1
  83. package/dist/esm/global-account/index.native.js +1 -1
  84. package/dist/esm/global-account/react/components/B3DynamicModal.js +10 -10
  85. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +4 -4
  86. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +1 -1
  87. package/dist/esm/global-account/react/components/B3Provider/useB3.js +1 -1
  88. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +4 -4
  89. package/dist/esm/global-account/react/components/MintButton/MintButton.js +2 -2
  90. package/dist/esm/global-account/react/components/ProfileAvatar.js +1 -1
  91. package/dist/esm/global-account/react/components/RequestPermissions/RequestPermissions.js +4 -4
  92. package/dist/esm/global-account/react/components/RequestPermissions/RequestPermissionsButton.js +1 -1
  93. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3.js +2 -2
  94. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +5 -5
  95. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +2 -2
  96. package/dist/esm/global-account/react/components/SignInWithB3/components/AuthButton.js +2 -2
  97. package/dist/esm/global-account/react/components/SignInWithB3/components/PermissionItem.js +1 -1
  98. package/dist/esm/global-account/react/components/SignInWithB3/components/WalletRow.js +1 -1
  99. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +3 -3
  100. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -2
  101. package/dist/esm/global-account/react/components/StyleRoot.js +1 -1
  102. package/dist/esm/global-account/react/components/Transak/TransakModal.js +2 -2
  103. package/dist/esm/global-account/react/components/custom/Button.js +1 -1
  104. package/dist/esm/global-account/react/components/custom/ClientOnly.js +1 -1
  105. package/dist/esm/global-account/react/components/index.js +45 -45
  106. package/dist/esm/global-account/react/components/ui/Loading.js +1 -1
  107. package/dist/esm/global-account/react/components/ui/ShinyButton.js +3 -3
  108. package/dist/esm/global-account/react/components/ui/TabSystem.js +2 -2
  109. package/dist/esm/global-account/react/components/ui/Tabs.js +1 -1
  110. package/dist/esm/global-account/react/components/ui/badge.js +1 -1
  111. package/dist/esm/global-account/react/components/ui/button.js +1 -1
  112. package/dist/esm/global-account/react/components/ui/command.js +2 -2
  113. package/dist/esm/global-account/react/components/ui/dialog.js +1 -1
  114. package/dist/esm/global-account/react/components/ui/drawer.js +1 -1
  115. package/dist/esm/global-account/react/components/ui/glare-card-rounded.js +1 -1
  116. package/dist/esm/global-account/react/components/ui/glare-card.js +1 -1
  117. package/dist/esm/global-account/react/components/ui/input.js +1 -1
  118. package/dist/esm/global-account/react/components/ui/popover.js +2 -2
  119. package/dist/esm/global-account/react/components/ui/scroll-area.js +1 -1
  120. package/dist/esm/global-account/react/components/ui/skeleton.js +1 -1
  121. package/dist/esm/global-account/react/components/ui/text-loop.js +1 -1
  122. package/dist/esm/global-account/react/components/ui/text-shimmer.js +1 -1
  123. package/dist/esm/global-account/react/components/ui/tooltip.js +1 -1
  124. package/dist/esm/global-account/react/components/ui/transition-panel.js +1 -1
  125. package/dist/esm/global-account/react/hooks/index.js +35 -35
  126. package/dist/esm/global-account/react/hooks/useAccountAssets.js +1 -1
  127. package/dist/esm/global-account/react/hooks/useAccountWallet.js +3 -3
  128. package/dist/esm/global-account/react/hooks/useAddTWSessionKey.js +1 -1
  129. package/dist/esm/global-account/react/hooks/useAuthentication.js +8 -8
  130. package/dist/esm/global-account/react/hooks/useB3BalanceFromAddresses.js +2 -2
  131. package/dist/esm/global-account/react/hooks/useBestTransactionPath.js +2 -2
  132. package/dist/esm/global-account/react/hooks/useBsmntProfile.js +1 -1
  133. package/dist/esm/global-account/react/hooks/useChainSwitchWithAction.js +2 -2
  134. package/dist/esm/global-account/react/hooks/useClaim.js +1 -1
  135. package/dist/esm/global-account/react/hooks/useConnect.js +3 -3
  136. package/dist/esm/global-account/react/hooks/useGetAllTWSigners.js +1 -1
  137. package/dist/esm/global-account/react/hooks/useGetGeo.js +1 -1
  138. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -2
  139. package/dist/esm/global-account/react/hooks/useIsMobile.js +1 -1
  140. package/dist/esm/global-account/react/hooks/useMediaQuery.js +1 -1
  141. package/dist/esm/global-account/react/hooks/useNativeBalance.js +2 -2
  142. package/dist/esm/global-account/react/hooks/useOnchainName.js +2 -2
  143. package/dist/esm/global-account/react/hooks/useOneBalance.js +2 -2
  144. package/dist/esm/global-account/react/hooks/useQueryB3.js +1 -1
  145. package/dist/esm/global-account/react/hooks/useQueryBSMNT.js +1 -1
  146. package/dist/esm/global-account/react/hooks/useRemoveSessionKey.js +1 -1
  147. package/dist/esm/global-account/react/hooks/useSiwe.js +2 -2
  148. package/dist/esm/global-account/react/hooks/useTokenBalance.js +4 -4
  149. package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +4 -4
  150. package/dist/esm/global-account/react/hooks/useTokenFromUrl.d.ts +4 -0
  151. package/dist/esm/global-account/react/hooks/useTokenFromUrl.js +23 -1
  152. package/dist/esm/global-account/react/hooks/useTokenPrice.js +1 -1
  153. package/dist/esm/global-account/react/hooks/useTokenPriceWithFallback.js +2 -2
  154. package/dist/esm/global-account/react/hooks/useTokensFromAddress.js +1 -1
  155. package/dist/esm/global-account/react/hooks/useURLParams.js +1 -1
  156. package/dist/esm/global-account/react/index.js +3 -3
  157. package/dist/esm/global-account/react/index.native.js +10 -10
  158. package/dist/esm/global-account/react/stores/index.js +2 -2
  159. package/dist/esm/shared/constants/chains/supported.d.ts +2 -6
  160. package/dist/esm/shared/constants/chains/supported.js +6 -3
  161. package/dist/esm/shared/thirdweb/generated/@tanstack/react-query.gen.js +2 -2
  162. package/dist/esm/shared/thirdweb/generated/index.js +2 -2
  163. package/dist/esm/shared/thirdweb/generated/sdk.gen.js +1 -1
  164. package/dist/esm/shared/thirdweb/initiateClient.js +2 -2
  165. package/dist/esm/shared/utils/chains.js +1 -1
  166. package/dist/esm/shared/utils/fetchBalances.js +2 -2
  167. package/dist/esm/shared/utils/index.js +1 -1
  168. package/dist/esm/shared/utils/insights.js +1 -1
  169. package/dist/esm/shared/utils/payment.utils.js +2 -2
  170. package/dist/esm/shared/utils/simplehash.js +4 -4
  171. package/dist/esm/shared/utils/thirdweb-insights.js +2 -2
  172. package/dist/esm/shared/utils/thirdweb.js +1 -1
  173. package/dist/styles/index.css +1 -1
  174. package/dist/types/anyspend/react/components/index.d.ts +1 -0
  175. package/dist/types/anyspend/react/components/webview/WebviewOnrampOrderStatus.d.ts +6 -0
  176. package/dist/types/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +3 -2
  177. package/dist/types/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -0
  178. package/dist/types/anyspend/services/anyspend.d.ts +2 -1
  179. package/dist/types/global-account/react/hooks/useTokenFromUrl.d.ts +4 -0
  180. package/dist/types/shared/constants/chains/supported.d.ts +2 -6
  181. package/package.json +2 -2
  182. package/src/anyspend/index.ts +0 -2
  183. package/src/anyspend/react/components/AnySpend.tsx +2 -2
  184. package/src/anyspend/react/components/index.ts +1 -0
  185. package/src/anyspend/react/components/webview/WebviewOnrampOrderStatus.tsx +120 -0
  186. package/src/anyspend/react/components/webview/WebviewOnrampPayment.tsx +294 -132
  187. package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +7 -4
  188. package/src/anyspend/services/anyspend.ts +5 -2
  189. package/src/global-account/react/hooks/useTokenFromUrl.tsx +25 -1
  190. package/src/shared/constants/chains/supported.ts +8 -4
@@ -1,16 +1,65 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { getChainName, OnrampVendor, OrderType, useAnyspendCreateOnrampOrder, useGeoOnrampOptions } from "../../../../anyspend";
3
- import { Button } from "../../../../global-account/react";
4
- import centerTruncate from "../../../../shared/utils/centerTruncate";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getChainName, OnrampVendor, OrderType, STRIPE_CONFIG, useAnyspendCreateOnrampOrder, useGeoOnrampOptions, useStripeClientSecret } from "../../../../anyspend/index.js";
3
+ import centerTruncate from "../../../../shared/utils/centerTruncate.js";
4
+ import { Elements, PaymentElement, useElements, useStripe } from "@stripe/react-stripe-js";
5
+ import { loadStripe } from "@stripe/stripe-js";
5
6
  import { motion } from "framer-motion";
6
7
  import { Loader2 } from "lucide-react";
7
8
  import { useEffect, useRef, useState } from "react";
8
9
  import { toast } from "sonner";
9
10
  import { formatUnits } from "viem";
10
- export function WebviewOnrampPayment({ srcAmountOnRamp, recipientAddress, destinationToken, anyspendQuote, onOrderCreated, userId }) {
11
- // Use a stable amount for geo onramp options to prevent unnecessary refetches
11
+ const stripePromise = loadStripe(STRIPE_CONFIG.publishableKey);
12
+ // Stripe Payment Form Component
13
+ function StripePaymentForm({ order, onPaymentSuccess }) {
14
+ const stripe = useStripe();
15
+ const elements = useElements();
16
+ const [isProcessing, setIsProcessing] = useState(false);
17
+ const [error, setError] = useState(null);
18
+ const handleSubmit = async (e) => {
19
+ e.preventDefault();
20
+ if (!stripe || !elements) {
21
+ return;
22
+ }
23
+ setIsProcessing(true);
24
+ setError(null);
25
+ try {
26
+ const { error: submitError } = await stripe.confirmPayment({
27
+ elements,
28
+ redirect: "if_required"
29
+ });
30
+ if (submitError) {
31
+ setError(submitError.message || "An error occurred");
32
+ console.error("Payment error:", submitError);
33
+ }
34
+ else {
35
+ console.log("Payment successful");
36
+ onPaymentSuccess(order.id);
37
+ }
38
+ }
39
+ catch (err) {
40
+ setError(err.message || "An error occurred");
41
+ console.error("Payment error:", err);
42
+ }
43
+ finally {
44
+ setIsProcessing(false);
45
+ }
46
+ };
47
+ const stripeElementOptions = {
48
+ layout: "tabs",
49
+ defaultValues: {
50
+ billingDetails: {
51
+ name: "",
52
+ email: ""
53
+ }
54
+ }
55
+ };
56
+ return (_jsx("form", { onSubmit: handleSubmit, className: "w-full", 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: "Payment Details" }), _jsx(PaymentElement, { options: stripeElementOptions }), 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" })) })] }) }) }));
57
+ }
58
+ export function WebviewOnrampPayment({ srcAmountOnRamp, recipientAddress, destinationToken, anyspendQuote, onPaymentSuccess, userId, partnerId }) {
12
59
  const [stableAmountForGeo, setStableAmountForGeo] = useState(srcAmountOnRamp);
13
60
  const hasInitialized = useRef(false);
61
+ const [createdOrder, setCreatedOrder] = useState(null);
62
+ const orderCreationAttempted = useRef(false);
14
63
  // Only update the stable amount on first render or when explicitly needed
15
64
  useEffect(() => {
16
65
  if (!hasInitialized.current && srcAmountOnRamp) {
@@ -19,69 +68,100 @@ export function WebviewOnrampPayment({ srcAmountOnRamp, recipientAddress, destin
19
68
  }
20
69
  }, [srcAmountOnRamp]);
21
70
  const { geoData, isStripeWeb2Supported, isLoading: isLoadingGeoOnramp } = useGeoOnrampOptions(true, stableAmountForGeo);
22
- console.log("isStripeWeb2Supported", isStripeWeb2Supported);
23
71
  const { createOrder, isCreatingOrder } = useAnyspendCreateOnrampOrder({
24
72
  onSuccess: data => {
25
73
  const orderId = data.data.id;
26
- window.location.href = `${window.location.origin}/?orderId=${orderId}`;
74
+ setCreatedOrder(data.data);
27
75
  },
28
76
  onError: error => {
29
77
  console.error(error);
30
78
  toast.error("Failed to create order: " + error.message);
31
79
  }
32
80
  });
33
- const handleContinueToPayment = async () => {
34
- try {
35
- if (!recipientAddress) {
36
- toast.error("Please select a recipient");
37
- return;
38
- }
39
- if (!srcAmountOnRamp || parseFloat(srcAmountOnRamp) <= 0) {
40
- toast.error("Please enter a valid amount");
41
- return;
42
- }
43
- if (!isStripeWeb2Supported) {
44
- toast.error("Stripe credit card not available");
45
- return;
46
- }
47
- if (!anyspendQuote) {
48
- toast.error("Failed to get quote");
49
- return;
81
+ const { clientSecret, isLoadingStripeClientSecret } = useStripeClientSecret(true, createdOrder?.stripePaymentIntentId || "");
82
+ // Create order when component mounts and all required data is available
83
+ useEffect(() => {
84
+ const createOrderIfPossible = async () => {
85
+ if (!orderCreationAttempted.current &&
86
+ recipientAddress &&
87
+ srcAmountOnRamp &&
88
+ parseFloat(srcAmountOnRamp) > 0 &&
89
+ isStripeWeb2Supported &&
90
+ anyspendQuote &&
91
+ geoData) {
92
+ orderCreationAttempted.current = true;
93
+ try {
94
+ const getDstToken = () => {
95
+ return {
96
+ ...destinationToken,
97
+ chainId: destinationToken.chainId,
98
+ address: destinationToken.address
99
+ };
100
+ };
101
+ createOrder({
102
+ isMainnet: true,
103
+ recipientAddress,
104
+ orderType: OrderType.Swap,
105
+ dstChain: getDstToken().chainId,
106
+ dstToken: getDstToken(),
107
+ srcFiatAmount: srcAmountOnRamp,
108
+ onramp: {
109
+ vendor: OnrampVendor.StripeWeb2,
110
+ paymentMethod: "",
111
+ country: geoData.country || "US",
112
+ ipAddress: geoData.ip,
113
+ redirectUrl: `${window.location.origin}${userId ? `?userId=${userId}` : ""}`
114
+ },
115
+ expectedDstAmount: anyspendQuote.data?.currencyOut?.amount?.toString() || "0",
116
+ partnerId
117
+ });
118
+ }
119
+ catch (err) {
120
+ console.error(err);
121
+ toast.error("Failed to create order: " + err.message);
122
+ }
50
123
  }
51
- const getDstToken = () => {
52
- return {
53
- ...destinationToken,
54
- chainId: destinationToken.chainId,
55
- address: destinationToken.address
56
- };
57
- };
58
- createOrder({
59
- isMainnet: true,
60
- recipientAddress,
61
- orderType: OrderType.Swap,
62
- dstChain: getDstToken().chainId,
63
- dstToken: getDstToken(),
64
- srcFiatAmount: srcAmountOnRamp,
65
- onramp: {
66
- vendor: OnrampVendor.StripeWeb2,
67
- paymentMethod: "",
68
- country: geoData?.country || "US",
69
- ipAddress: geoData?.ip,
70
- redirectUrl: `${window.location.origin}${userId ? `?userId=${userId}` : ""}`
71
- },
72
- expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount?.toString() || "0"
73
- });
74
- }
75
- catch (err) {
76
- console.error(err);
77
- toast.error("Failed to create order: " + err.message);
78
- }
79
- };
80
- return (_jsxs("div", { className: "mx-auto flex w-full max-w-[460px] flex-col gap-6", children: [_jsxs(_Fragment, { children: [_jsx("h2", { className: "-mb-3 text-lg font-semibold", children: "Order summary" }), _jsxs("div", { className: "bg-b3-react-background border-b3-react-border flex flex-col gap-3 rounded-lg border p-4", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("p", { className: "text-b3-react-foreground/60", 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-6 w-6 rounded-full" })), _jsxs("span", { className: "text-b3-react-foreground/80", children: [anyspendQuote?.data?.currencyOut?.amount
124
+ };
125
+ createOrderIfPossible();
126
+ }, [
127
+ recipientAddress,
128
+ srcAmountOnRamp,
129
+ isStripeWeb2Supported,
130
+ anyspendQuote,
131
+ geoData,
132
+ createOrder,
133
+ destinationToken,
134
+ userId,
135
+ partnerId
136
+ ]);
137
+ // Check if all required data is loaded
138
+ const isLoading = isLoadingGeoOnramp || !anyspendQuote || !destinationToken.metadata?.logoURI;
139
+ // Show loading state while data is being fetched or order is being created
140
+ if (isLoading || isCreatingOrder || isLoadingStripeClientSecret) {
141
+ return (_jsxs("div", { className: "mx-auto flex w-full max-w-[460px] flex-col items-center justify-center gap-3 py-12", children: [_jsx(Loader2, { className: "text-as-brand h-8 w-8 animate-spin" }), _jsx("span", { className: "text-as-primary/70", children: isCreatingOrder
142
+ ? "Creating payment session..."
143
+ : isLoadingStripeClientSecret
144
+ ? "Loading payment form..."
145
+ : "Loading payment details..." })] }));
146
+ }
147
+ // If we have a created order and client secret, show the payment form
148
+ if (createdOrder && clientSecret) {
149
+ 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
150
+ ? Number(formatUnits(BigInt(anyspendQuote.data.currencyOut.amount), destinationToken.decimals)).toFixed(4)
151
+ : "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: stripePromise, options: {
152
+ clientSecret,
153
+ appearance: {
154
+ theme: "flat",
155
+ variables: {
156
+ colorPrimary: "#2563eb",
157
+ colorBackground: "#ffffff",
158
+ borderRadius: "12px"
159
+ }
160
+ }
161
+ }, children: _jsx(StripePaymentForm, { order: createdOrder, onPaymentSuccess: onPaymentSuccess }) })] }));
162
+ }
163
+ // Show initial order summary while waiting for order creation
164
+ return (_jsx(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: _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
81
165
  ? Number(formatUnits(BigInt(anyspendQuote.data.currencyOut.amount), destinationToken.decimals)).toFixed(4)
82
- : "0", " ", destinationToken.symbol] })] })] }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("p", { className: "text-b3-react-foreground/60", children: "Network" }), _jsx("span", { className: "text-b3-react-foreground/80", children: getChainName(destinationToken.chainId) })] }), recipientAddress && (_jsxs(motion.div, { initial: false, animate: {
83
- opacity: 1,
84
- y: 0,
85
- filter: "blur(0px)"
86
- }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: "flex items-center justify-between", children: [_jsx("p", { className: "text-b3-react-foreground/60", children: "Recipient" }), _jsx("div", { className: "flex items-center gap-2", children: _jsx("span", { className: "text-b3-react-foreground/80", children: centerTruncate(recipientAddress) }) })] })), _jsx("div", { className: "border-b3-react-border border-t pt-3", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("p", { className: "text-b3-react-foreground font-semibold", children: "You Pay" }), _jsxs("p", { className: "text-b3-react-foreground text-xl font-semibold", children: ["$", parseFloat(srcAmountOnRamp).toFixed(2)] })] }) })] })] }), isCreatingOrder ? (_jsxs("div", { className: "bg-b3-react-background border-b3-react-border flex items-center justify-center gap-3 rounded-lg border p-6", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin" }), _jsx("span", { className: "text-as-primary/70", children: "Creating payment session..." })] })) : isLoadingGeoOnramp ? (_jsxs("div", { className: "bg-b3-react-background border-b3-react-border flex items-center justify-center gap-3 rounded-lg border p-6", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin" }), _jsx("span", { className: "text-as-primary/70", children: "Loading payment options..." })] })) : (_jsx("div", { className: "flex flex-col gap-4", children: _jsx(Button, { onClick: handleContinueToPayment, disabled: isCreatingOrder || !isStripeWeb2Supported, className: "bg-as-brand hover:bg-as-brand/90 text-as-primary h-14 w-full rounded-xl text-lg font-medium", children: isCreatingOrder ? "Creating Payment..." : "Continue to Payment" }) }))] }));
166
+ : "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)] })] })] })] }) }) }));
87
167
  }
@@ -1,13 +1,13 @@
1
- export * from "./useAnyspendCreateOnrampOrder";
2
- export * from "./useAnyspendCreateOrder";
3
- export * from "./useAnyspendOrderAndTransactions";
4
- export * from "./useAnyspendOrderHistory";
5
- export * from "./useAnyspendQuote";
6
- export * from "./useAnyspendSendPermitData";
7
- export * from "./useAnyspendTokens";
8
- export * from "./useCoinbaseOnrampOptions";
9
- export * from "./useGeoOnrampOptions";
10
- export * from "./useGetGeo";
11
- export * from "./usePermitData";
12
- export * from "./useStripeClientSecret";
13
- export * from "./useStripeSupport";
1
+ export * from "./useAnyspendCreateOnrampOrder.js";
2
+ export * from "./useAnyspendCreateOrder.js";
3
+ export * from "./useAnyspendOrderAndTransactions.js";
4
+ export * from "./useAnyspendOrderHistory.js";
5
+ export * from "./useAnyspendQuote.js";
6
+ export * from "./useAnyspendSendPermitData.js";
7
+ export * from "./useAnyspendTokens.js";
8
+ export * from "./useCoinbaseOnrampOptions.js";
9
+ export * from "./useGeoOnrampOptions.js";
10
+ export * from "./useGetGeo.js";
11
+ export * from "./usePermitData.js";
12
+ export * from "./useStripeClientSecret.js";
13
+ export * from "./useStripeSupport.js";
@@ -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,10 +1,10 @@
1
- import { anyspendService } from "../../../anyspend/services/anyspend";
2
- import { normalizeAddress, buildMetadata, buildPayload } from "../../../anyspend/utils";
1
+ import { USDC_BASE } from "../../../anyspend/constants/index.js";
2
+ import { anyspendService } from "../../../anyspend/services/anyspend.js";
3
+ import { buildMetadata, buildPayload, normalizeAddress } from "../../../anyspend/utils/index.js";
3
4
  import { useMutation } from "@tanstack/react-query";
4
5
  import { useMemo } from "react";
5
6
  import { parseUnits } from "viem";
6
7
  import { base } from "viem/chains";
7
- import { USDC_BASE } from "../../../anyspend/constants";
8
8
  /**
9
9
  * Hook for creating onramp orders in the Anyspend protocol
10
10
  * Specifically handles orders that involve fiat-to-crypto onramp functionality
@@ -12,7 +12,7 @@ import { USDC_BASE } from "../../../anyspend/constants";
12
12
  export function useAnyspendCreateOnrampOrder({ onSuccess, onError } = {}) {
13
13
  const { mutate: createOrder, isPending } = useMutation({
14
14
  mutationFn: async (params) => {
15
- const { isMainnet, recipientAddress, orderType, dstChain, dstToken, srcFiatAmount, onramp, creatorAddress, expectedDstAmount, nft, tournament, payload } = params;
15
+ const { isMainnet, recipientAddress, orderType, dstChain, dstToken, srcFiatAmount, onramp, creatorAddress, expectedDstAmount, nft, tournament, payload, partnerId } = params;
16
16
  try {
17
17
  // Validate Stripe onramp options
18
18
  if (onramp.vendor === "stripe" && !onramp.ipAddress) {
@@ -54,7 +54,8 @@ export function useAnyspendCreateOnrampOrder({ onSuccess, onError } = {}) {
54
54
  tournament,
55
55
  payload
56
56
  }),
57
- creatorAddress: creatorAddress ? normalizeAddress(creatorAddress) : undefined
57
+ creatorAddress: creatorAddress ? normalizeAddress(creatorAddress) : undefined,
58
+ partnerId
58
59
  });
59
60
  }
60
61
  catch (error) {
@@ -1,5 +1,5 @@
1
- import { anyspendService } from "../../../anyspend/services/anyspend";
2
- import { normalizeAddress, buildMetadata, buildPayload } from "../../../anyspend/utils";
1
+ import { anyspendService } from "../../../anyspend/services/anyspend.js";
2
+ import { normalizeAddress, buildMetadata, buildPayload } from "../../../anyspend/utils/index.js";
3
3
  import { useMutation } from "@tanstack/react-query";
4
4
  import { useMemo } from "react";
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { anyspendService } from "../../../anyspend/services/anyspend";
1
+ import { anyspendService } from "../../../anyspend/services/anyspend.js";
2
2
  import { useQuery } from "@tanstack/react-query";
3
3
  import isEqual from "lodash/isEqual.js";
4
4
  import { useCallback, useMemo } from "react";
@@ -1,4 +1,4 @@
1
- import { anyspendService } from "../../../anyspend/services/anyspend";
1
+ import { anyspendService } from "../../../anyspend/services/anyspend.js";
2
2
  import { useQuery } from "@tanstack/react-query";
3
3
  export function useAnyspendOrderHistory(isMainnet, creatorAddress, limit = 100, offset = 0) {
4
4
  const { data: rawData = [], isLoading, refetch, error } = useQuery({
@@ -1,5 +1,5 @@
1
- import { anyspendService } from "../../../anyspend/services/anyspend";
2
- import { OrderType } from "../../../anyspend/types";
1
+ import { anyspendService } from "../../../anyspend/services/anyspend.js";
2
+ import { OrderType } from "../../../anyspend/types/index.js";
3
3
  import { useQuery } from "@tanstack/react-query";
4
4
  import { useMemo } from "react";
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { anyspendService } from "../../../anyspend/services/anyspend";
1
+ import { anyspendService } from "../../../anyspend/services/anyspend.js";
2
2
  import { useMutation } from "@tanstack/react-query";
3
3
  export function useAnyspendSendPermitData({ onSuccess, onError } = {}) {
4
4
  const { mutate: sendPermitData, isPending } = useMutation({
@@ -1,4 +1,4 @@
1
- import { anyspendService } from "../../../anyspend/services/anyspend";
1
+ import { anyspendService } from "../../../anyspend/services/anyspend.js";
2
2
  import { useQuery } from "@tanstack/react-query";
3
3
  import { useMemo } from "react";
4
4
  export function useAnyspendTokenList(isMainnet, chainId, query) {
@@ -1,4 +1,4 @@
1
- import { anyspendService } from "../../../anyspend/services/anyspend";
1
+ import { anyspendService } from "../../../anyspend/services/anyspend.js";
2
2
  import { useQuery } from "@tanstack/react-query";
3
3
  import { useMemo } from "react";
4
4
  export function useCoinbaseOnrampOptions(isMainnet, country) {
@@ -1,7 +1,7 @@
1
1
  import { useMemo } from "react";
2
- import { useCoinbaseOnrampOptions } from "./useCoinbaseOnrampOptions";
3
- import { useGetGeo } from "./useGetGeo";
4
- import { useStripeSupport } from "./useStripeSupport";
2
+ import { useCoinbaseOnrampOptions } from "./useCoinbaseOnrampOptions.js";
3
+ import { useGetGeo } from "./useGetGeo.js";
4
+ import { useStripeSupport } from "./useStripeSupport.js";
5
5
  export function useGeoOnrampOptions(isMainnet, srcFiatAmount) {
6
6
  // Use existing hooks
7
7
  const { geoData, loading: isLoadingGeo, error: geoError } = useGetGeo();
@@ -1,6 +1,6 @@
1
- import { chainIdToPublicClient, getMulticall3Address, isEvmChain, isNativeToken } from "../../../anyspend/utils";
1
+ import { chainIdToPublicClient, getMulticall3Address, isEvmChain, isNativeToken } from "../../../anyspend/utils/index.js";
2
2
  import { useQuery } from "@tanstack/react-query";
3
- import { ABI_USDC_BASE } from "../../../anyspend/abis/abi-usdc-base";
3
+ import { ABI_USDC_BASE } from "../../../anyspend/abis/abi-usdc-base.js";
4
4
  // EIP-5267 ABI for eip712Domain function
5
5
  const EIP5267_ABI = [
6
6
  {
@@ -1,6 +1,6 @@
1
1
  import { useQuery } from "@tanstack/react-query";
2
2
  import { useMemo } from "react";
3
- import { anyspendService } from "../../../anyspend/services/anyspend";
3
+ import { anyspendService } from "../../../anyspend/services/anyspend.js";
4
4
  export function useStripeClientSecret(isMainnet, paymentIntentId) {
5
5
  const { data, isLoading, error, refetch } = useQuery({
6
6
  queryKey: ["stripeClientSecret", isMainnet, paymentIntentId],
@@ -1,4 +1,4 @@
1
- import { anyspendService } from "../../../anyspend/services/anyspend";
1
+ import { anyspendService } from "../../../anyspend/services/anyspend.js";
2
2
  import { useQuery } from "@tanstack/react-query";
3
3
  import { useMemo } from "react";
4
4
  export function useStripeSupport(isMainnet, ipAddress, usdAmount) {
@@ -1,3 +1,3 @@
1
- export * from "./components";
2
- export * from "./hooks";
3
- export * from "./providers/AnyspendProvider";
1
+ export * from "./components/index.js";
2
+ export * from "./hooks/index.js";
3
+ export * from "./providers/AnyspendProvider.js";
@@ -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<{
@@ -1,7 +1,7 @@
1
- import { zGetCoinbaseOnrampOptionsResponse, zGetOrderAndTxsResponse, zGetOrderHistoryResponse, zGetTokenListResponse } from "../../anyspend/types";
2
- import { getNativeToken, isNativeToken } from "../../anyspend/utils";
1
+ import { zGetCoinbaseOnrampOptionsResponse, zGetOrderAndTxsResponse, zGetOrderHistoryResponse, zGetTokenListResponse } from "../../anyspend/types/index.js";
2
+ import { getNativeToken, isNativeToken } from "../../anyspend/utils/index.js";
3
3
  import invariant from "invariant";
4
- import { ANYSPEND_MAINNET_BASE_URL, ANYSPEND_TESTNET_BASE_URL } from "../../anyspend/constants";
4
+ import { ANYSPEND_MAINNET_BASE_URL, ANYSPEND_TESTNET_BASE_URL } from "../../anyspend/constants/index.js";
5
5
  // Service functions
6
6
  export const anyspendService = {
7
7
  getTokenList: async (isMainnet, chainId, query) => {
@@ -37,7 +37,7 @@ export const anyspendService = {
37
37
  return data;
38
38
  },
39
39
  // Order related
40
- createOrder: async ({ isMainnet, recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress }) => {
40
+ createOrder: async ({ isMainnet, recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress, partnerId }) => {
41
41
  const response = await fetch(`${isMainnet ? ANYSPEND_MAINNET_BASE_URL : ANYSPEND_TESTNET_BASE_URL}/orders`, {
42
42
  method: "POST",
43
43
  headers: {
@@ -54,7 +54,8 @@ export const anyspendService = {
54
54
  payload,
55
55
  onramp,
56
56
  metadata,
57
- creatorAddress
57
+ creatorAddress,
58
+ partnerId
58
59
  })
59
60
  });
60
61
  const data = await response.json();
@@ -1,5 +1,5 @@
1
1
  import z from "zod";
2
- import { zToken } from "./token";
2
+ import { zToken } from "./token.js";
3
3
  export const zCustomPayload = z.object({
4
4
  data: z.string(),
5
5
  to: z.string(),
@@ -1,13 +1,13 @@
1
- export * from "./req-res";
2
- export * from "./chain";
3
- export * from "./custom";
4
- export * from "./globalWallet";
5
- export * from "./nft";
6
- export * from "./onramp";
7
- export * from "./order";
8
- export * from "./permit";
9
- export * from "./relay";
10
- export * from "./swap";
11
- export * from "./token";
12
- export * from "./tournament";
13
- export * from "./transaction";
1
+ export * from "./req-res/index.js";
2
+ export * from "./chain.js";
3
+ export * from "./custom.js";
4
+ export * from "./globalWallet.js";
5
+ export * from "./nft.js";
6
+ export * from "./onramp.js";
7
+ export * from "./order.js";
8
+ export * from "./permit.js";
9
+ export * from "./relay.js";
10
+ export * from "./swap.js";
11
+ export * from "./token.js";
12
+ export * from "./tournament.js";
13
+ export * from "./transaction.js";
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { zToken } from "./token";
2
+ import { zToken } from "./token.js";
3
3
  export var NftType;
4
4
  (function (NftType) {
5
5
  NftType["ERC721"] = "erc721";
@@ -1,10 +1,10 @@
1
1
  import { z } from "zod";
2
- import { zOnrampMetadata } from "./onramp";
3
- import { zPermit } from "./permit";
4
- import { zMintNftMetadata, zMintNftPayload } from "./nft";
5
- import { zSwapMetadata, zSwapPayload } from "./swap";
6
- import { zFundTournamentPayload, zJoinTournamentPayload, zTournamentMetadata } from "./tournament";
7
- import { zCustomMetadata, zCustomPayload } from "./custom";
2
+ import { zOnrampMetadata } from "./onramp.js";
3
+ import { zPermit } from "./permit.js";
4
+ import { zMintNftMetadata, zMintNftPayload } from "./nft.js";
5
+ import { zSwapMetadata, zSwapPayload } from "./swap.js";
6
+ import { zFundTournamentPayload, zJoinTournamentPayload, zTournamentMetadata } from "./tournament.js";
7
+ import { zCustomMetadata, zCustomPayload } from "./custom.js";
8
8
  export var OrderStatus;
9
9
  (function (OrderStatus) {
10
10
  // Prepare steps: For non-permit orders
@@ -1,10 +1,10 @@
1
1
  import { z } from "zod";
2
- import { zCustomMetadata, zCustomPayload } from "../custom";
3
- import { zMintNftMetadata, zMintNftPayload } from "../nft";
4
- import { zOnrampMetadata } from "../onramp";
5
- import { OrderType, zOrder } from "../order";
6
- import { zSwapMetadata, zSwapPayload } from "../swap";
7
- import { zFundTournamentPayload, zJoinTournamentPayload, zTournamentMetadata } from "../tournament";
2
+ import { zCustomMetadata, zCustomPayload } from "../custom.js";
3
+ import { zMintNftMetadata, zMintNftPayload } from "../nft.js";
4
+ import { zOnrampMetadata } from "../onramp.js";
5
+ import { OrderType, zOrder } from "../order.js";
6
+ import { zSwapMetadata, zSwapPayload } from "../swap.js";
7
+ import { zFundTournamentPayload, zJoinTournamentPayload, zTournamentMetadata } from "../tournament.js";
8
8
  const zBaseCreateOrderBody = z.object({
9
9
  recipientAddress: z.string(),
10
10
  srcChain: z.number(),
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { zOrder } from "../order";
3
- import { zDepositTransaction, zExecuteTransaction, zRefundTransaction, zRelayTransaction } from "../transaction";
2
+ import { zOrder } from "../order.js";
3
+ import { zDepositTransaction, zExecuteTransaction, zRefundTransaction, zRelayTransaction } from "../transaction.js";
4
4
  export const zGetOrderAndTransactionsRequest = z.object({
5
5
  params: z.object({
6
6
  orderId: z.string()
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { zOrder } from "../order";
2
+ import { zOrder } from "../order.js";
3
3
  export const zGetOrderHistoryResponse = z.object({
4
4
  success: z.boolean(),
5
5
  message: z.string(),
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
- import { OrderType } from "../order";
3
- import { TradeType } from "../relay";
4
- import { zCustomPayload } from "../custom";
2
+ import { OrderType } from "../order.js";
3
+ import { TradeType } from "../relay.js";
4
+ import { zCustomPayload } from "../custom.js";
5
5
  const zGetQuoteBody = z.object({
6
6
  srcChain: z.number(),
7
7
  dstChain: z.number(),
@@ -1,8 +1,8 @@
1
- export * from "./createOrder";
2
- export * from "./getCoinbaseOnrampOptions";
3
- export * from "./getOrderAndTransactions";
4
- export * from "./getOrderByCreator";
5
- export * from "./getOrderHistory";
6
- export * from "./getQuote";
7
- export * from "./getTokenList";
8
- export * from "./sendPermitData";
1
+ export * from "./createOrder.js";
2
+ export * from "./getCoinbaseOnrampOptions.js";
3
+ export * from "./getOrderAndTransactions.js";
4
+ export * from "./getOrderByCreator.js";
5
+ export * from "./getOrderHistory.js";
6
+ export * from "./getQuote.js";
7
+ export * from "./getTokenList.js";
8
+ export * from "./sendPermitData.js";
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { zPermit } from "../permit";
2
+ import { zPermit } from "../permit.js";
3
3
  export const zSendPermitDataRequest = z.object({
4
4
  body: z.object({
5
5
  orderId: z.string(),
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { zToken } from "./token";
2
+ import { zToken } from "./token.js";
3
3
  export const zSwapPayload = z.object({
4
4
  expectedDstAmount: z.string(),
5
5
  actualDstAmount: z.string().nullable()
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { zToken } from "./token";
2
+ import { zToken } from "./token.js";
3
3
  export const zTournament = z.object({
4
4
  slug: z.string(),
5
5
  name: z.string(),