@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.
- package/dist/cjs/anyspend/index.js +0 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +2 -2
- package/dist/cjs/anyspend/react/components/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/index.js +3 -1
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampOrderStatus.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampOrderStatus.js +37 -0
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +3 -2
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.js +141 -61
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +4 -3
- package/dist/cjs/anyspend/services/anyspend.d.ts +2 -1
- package/dist/cjs/anyspend/services/anyspend.js +3 -2
- package/dist/cjs/global-account/react/hooks/useTokenFromUrl.d.ts +4 -0
- package/dist/cjs/global-account/react/hooks/useTokenFromUrl.js +23 -0
- package/dist/cjs/shared/constants/chains/supported.d.ts +2 -6
- package/dist/cjs/shared/constants/chains/supported.js +6 -3
- package/dist/esm/anyspend/index.js +13 -14
- package/dist/esm/anyspend/index.native.js +13 -13
- package/dist/esm/anyspend/react/components/AnySpend.js +15 -15
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +8 -8
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +14 -14
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +7 -7
- package/dist/esm/anyspend/react/components/AnySpendNFTButton.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +7 -7
- package/dist/esm/anyspend/react/components/AnySpendTournament.js +4 -4
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +6 -6
- package/dist/esm/anyspend/react/components/common/OrderHistory.js +3 -3
- package/dist/esm/anyspend/react/components/common/OrderHistoryItem.js +4 -4
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderToken.js +6 -6
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +4 -4
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +3 -3
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +3 -3
- package/dist/esm/anyspend/react/components/common/PaymentMethodIcons.js +1 -1
- package/dist/esm/anyspend/react/components/common/PaymentOneClick.js +3 -3
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +6 -6
- package/dist/esm/anyspend/react/components/common/PaymentVendorUI.js +3 -3
- package/dist/esm/anyspend/react/components/common/TokenBalance.js +1 -1
- package/dist/esm/anyspend/react/components/index.d.ts +1 -0
- package/dist/esm/anyspend/react/components/index.js +16 -15
- package/dist/esm/anyspend/react/components/modals/EnterRecipientModal.js +1 -1
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampOrderStatus.d.ts +6 -0
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampOrderStatus.js +31 -0
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +3 -2
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.js +140 -60
- package/dist/esm/anyspend/react/hooks/index.js +13 -13
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +6 -5
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderAndTransactions.js +1 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.js +1 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendQuote.js +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendSendPermitData.js +1 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendTokens.js +1 -1
- package/dist/esm/anyspend/react/hooks/useCoinbaseOnrampOptions.js +1 -1
- package/dist/esm/anyspend/react/hooks/useGeoOnrampOptions.js +3 -3
- package/dist/esm/anyspend/react/hooks/usePermitData.js +2 -2
- package/dist/esm/anyspend/react/hooks/useStripeClientSecret.js +1 -1
- package/dist/esm/anyspend/react/hooks/useStripeSupport.js +1 -1
- package/dist/esm/anyspend/react/index.js +3 -3
- package/dist/esm/anyspend/services/anyspend.d.ts +2 -1
- package/dist/esm/anyspend/services/anyspend.js +6 -5
- package/dist/esm/anyspend/types/custom.js +1 -1
- package/dist/esm/anyspend/types/index.js +13 -13
- package/dist/esm/anyspend/types/nft.js +1 -1
- package/dist/esm/anyspend/types/order.js +6 -6
- package/dist/esm/anyspend/types/req-res/createOrder.js +6 -6
- package/dist/esm/anyspend/types/req-res/getOrderAndTransactions.js +2 -2
- package/dist/esm/anyspend/types/req-res/getOrderHistory.js +1 -1
- package/dist/esm/anyspend/types/req-res/getQuote.js +3 -3
- package/dist/esm/anyspend/types/req-res/index.js +8 -8
- package/dist/esm/anyspend/types/req-res/sendPermitData.js +1 -1
- package/dist/esm/anyspend/types/swap.js +1 -1
- package/dist/esm/anyspend/types/tournament.js +1 -1
- package/dist/esm/anyspend/types/transaction.js +1 -1
- package/dist/esm/anyspend/utils/chain.js +3 -3
- package/dist/esm/anyspend/utils/format.js +1 -1
- package/dist/esm/anyspend/utils/index.js +8 -8
- package/dist/esm/anyspend/utils/orderPayload.js +2 -2
- package/dist/esm/anyspend/utils/token.js +1 -1
- package/dist/esm/global-account/app.js +1 -1
- package/dist/esm/global-account/index.js +1 -1
- package/dist/esm/global-account/index.native.js +1 -1
- package/dist/esm/global-account/react/components/B3DynamicModal.js +10 -10
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +4 -4
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +1 -1
- package/dist/esm/global-account/react/components/B3Provider/useB3.js +1 -1
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +4 -4
- package/dist/esm/global-account/react/components/MintButton/MintButton.js +2 -2
- package/dist/esm/global-account/react/components/ProfileAvatar.js +1 -1
- package/dist/esm/global-account/react/components/RequestPermissions/RequestPermissions.js +4 -4
- package/dist/esm/global-account/react/components/RequestPermissions/RequestPermissionsButton.js +1 -1
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +5 -5
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/components/AuthButton.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/components/PermissionItem.js +1 -1
- package/dist/esm/global-account/react/components/SignInWithB3/components/WalletRow.js +1 -1
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +3 -3
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -2
- package/dist/esm/global-account/react/components/StyleRoot.js +1 -1
- package/dist/esm/global-account/react/components/Transak/TransakModal.js +2 -2
- package/dist/esm/global-account/react/components/custom/Button.js +1 -1
- package/dist/esm/global-account/react/components/custom/ClientOnly.js +1 -1
- package/dist/esm/global-account/react/components/index.js +45 -45
- package/dist/esm/global-account/react/components/ui/Loading.js +1 -1
- package/dist/esm/global-account/react/components/ui/ShinyButton.js +3 -3
- package/dist/esm/global-account/react/components/ui/TabSystem.js +2 -2
- package/dist/esm/global-account/react/components/ui/Tabs.js +1 -1
- package/dist/esm/global-account/react/components/ui/badge.js +1 -1
- package/dist/esm/global-account/react/components/ui/button.js +1 -1
- package/dist/esm/global-account/react/components/ui/command.js +2 -2
- package/dist/esm/global-account/react/components/ui/dialog.js +1 -1
- package/dist/esm/global-account/react/components/ui/drawer.js +1 -1
- package/dist/esm/global-account/react/components/ui/glare-card-rounded.js +1 -1
- package/dist/esm/global-account/react/components/ui/glare-card.js +1 -1
- package/dist/esm/global-account/react/components/ui/input.js +1 -1
- package/dist/esm/global-account/react/components/ui/popover.js +2 -2
- package/dist/esm/global-account/react/components/ui/scroll-area.js +1 -1
- package/dist/esm/global-account/react/components/ui/skeleton.js +1 -1
- package/dist/esm/global-account/react/components/ui/text-loop.js +1 -1
- package/dist/esm/global-account/react/components/ui/text-shimmer.js +1 -1
- package/dist/esm/global-account/react/components/ui/tooltip.js +1 -1
- package/dist/esm/global-account/react/components/ui/transition-panel.js +1 -1
- package/dist/esm/global-account/react/hooks/index.js +35 -35
- package/dist/esm/global-account/react/hooks/useAccountAssets.js +1 -1
- package/dist/esm/global-account/react/hooks/useAccountWallet.js +3 -3
- package/dist/esm/global-account/react/hooks/useAddTWSessionKey.js +1 -1
- package/dist/esm/global-account/react/hooks/useAuthentication.js +8 -8
- package/dist/esm/global-account/react/hooks/useB3BalanceFromAddresses.js +2 -2
- package/dist/esm/global-account/react/hooks/useBestTransactionPath.js +2 -2
- package/dist/esm/global-account/react/hooks/useBsmntProfile.js +1 -1
- package/dist/esm/global-account/react/hooks/useChainSwitchWithAction.js +2 -2
- package/dist/esm/global-account/react/hooks/useClaim.js +1 -1
- package/dist/esm/global-account/react/hooks/useConnect.js +3 -3
- package/dist/esm/global-account/react/hooks/useGetAllTWSigners.js +1 -1
- package/dist/esm/global-account/react/hooks/useGetGeo.js +1 -1
- package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -2
- package/dist/esm/global-account/react/hooks/useIsMobile.js +1 -1
- package/dist/esm/global-account/react/hooks/useMediaQuery.js +1 -1
- package/dist/esm/global-account/react/hooks/useNativeBalance.js +2 -2
- package/dist/esm/global-account/react/hooks/useOnchainName.js +2 -2
- package/dist/esm/global-account/react/hooks/useOneBalance.js +2 -2
- package/dist/esm/global-account/react/hooks/useQueryB3.js +1 -1
- package/dist/esm/global-account/react/hooks/useQueryBSMNT.js +1 -1
- package/dist/esm/global-account/react/hooks/useRemoveSessionKey.js +1 -1
- package/dist/esm/global-account/react/hooks/useSiwe.js +2 -2
- package/dist/esm/global-account/react/hooks/useTokenBalance.js +4 -4
- package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +4 -4
- package/dist/esm/global-account/react/hooks/useTokenFromUrl.d.ts +4 -0
- package/dist/esm/global-account/react/hooks/useTokenFromUrl.js +23 -1
- package/dist/esm/global-account/react/hooks/useTokenPrice.js +1 -1
- package/dist/esm/global-account/react/hooks/useTokenPriceWithFallback.js +2 -2
- package/dist/esm/global-account/react/hooks/useTokensFromAddress.js +1 -1
- package/dist/esm/global-account/react/hooks/useURLParams.js +1 -1
- package/dist/esm/global-account/react/index.js +3 -3
- package/dist/esm/global-account/react/index.native.js +10 -10
- package/dist/esm/global-account/react/stores/index.js +2 -2
- package/dist/esm/shared/constants/chains/supported.d.ts +2 -6
- package/dist/esm/shared/constants/chains/supported.js +6 -3
- package/dist/esm/shared/thirdweb/generated/@tanstack/react-query.gen.js +2 -2
- package/dist/esm/shared/thirdweb/generated/index.js +2 -2
- package/dist/esm/shared/thirdweb/generated/sdk.gen.js +1 -1
- package/dist/esm/shared/thirdweb/initiateClient.js +2 -2
- package/dist/esm/shared/utils/chains.js +1 -1
- package/dist/esm/shared/utils/fetchBalances.js +2 -2
- package/dist/esm/shared/utils/index.js +1 -1
- package/dist/esm/shared/utils/insights.js +1 -1
- package/dist/esm/shared/utils/payment.utils.js +2 -2
- package/dist/esm/shared/utils/simplehash.js +4 -4
- package/dist/esm/shared/utils/thirdweb-insights.js +2 -2
- package/dist/esm/shared/utils/thirdweb.js +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/index.d.ts +1 -0
- package/dist/types/anyspend/react/components/webview/WebviewOnrampOrderStatus.d.ts +6 -0
- package/dist/types/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +3 -2
- package/dist/types/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -0
- package/dist/types/anyspend/services/anyspend.d.ts +2 -1
- package/dist/types/global-account/react/hooks/useTokenFromUrl.d.ts +4 -0
- package/dist/types/shared/constants/chains/supported.d.ts +2 -6
- package/package.json +2 -2
- package/src/anyspend/index.ts +0 -2
- package/src/anyspend/react/components/AnySpend.tsx +2 -2
- package/src/anyspend/react/components/index.ts +1 -0
- package/src/anyspend/react/components/webview/WebviewOnrampOrderStatus.tsx +120 -0
- package/src/anyspend/react/components/webview/WebviewOnrampPayment.tsx +294 -132
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +7 -4
- package/src/anyspend/services/anyspend.ts +5 -2
- package/src/global-account/react/hooks/useTokenFromUrl.tsx +25 -1
- package/src/shared/constants/chains/supported.ts +8 -4
|
@@ -1,16 +1,65 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
2
|
-
import { getChainName, OnrampVendor, OrderType, useAnyspendCreateOnrampOrder, useGeoOnrampOptions } from "../../../../anyspend";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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
|
-
|
|
11
|
-
|
|
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
|
-
|
|
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
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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("
|
|
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";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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,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,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,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";
|