@b3dotfun/sdk 0.0.70-alpha.1 → 0.0.70-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.
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +0 -6
- package/dist/cjs/anyspend/react/components/AnySpend.js +1 -13
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.d.ts +1 -3
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +57 -0
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +82 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -3
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +1 -3
- package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendTournament.d.ts +0 -2
- package/dist/cjs/anyspend/react/components/AnySpendTournament.js +1 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +2 -2
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.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/hooks/useAnyspendCreateOnrampOrder.js +5 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +0 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +5 -2
- package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/cjs/anyspend/react/hooks/useValidatedClientReferenceId.d.ts +5 -0
- package/dist/cjs/anyspend/react/hooks/useValidatedClientReferenceId.js +35 -0
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +2 -0
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +4 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +4 -3
- package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +1 -0
- package/dist/cjs/global-account/react/components/B3Provider/types.js +1 -0
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +23 -1
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +0 -6
- package/dist/esm/anyspend/react/components/AnySpend.js +1 -13
- package/dist/esm/anyspend/react/components/AnySpendBondKit.d.ts +1 -3
- package/dist/esm/anyspend/react/components/AnySpendBondKit.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +57 -0
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +79 -0
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -3
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -1
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +1 -3
- package/dist/esm/anyspend/react/components/AnySpendDepositUpside.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnySpendDepositUpside.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeUpside.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeUpside.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendTournament.d.ts +0 -2
- package/dist/esm/anyspend/react/components/AnySpendTournament.js +1 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +2 -2
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.js +2 -2
- package/dist/esm/anyspend/react/components/index.d.ts +1 -0
- package/dist/esm/anyspend/react/components/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +5 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +0 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +5 -2
- package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.d.ts +5 -0
- package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.js +32 -0
- package/dist/esm/global-account/react/components/B3DynamicModal.js +3 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +4 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +4 -3
- package/dist/esm/global-account/react/components/B3Provider/types.d.ts +1 -0
- package/dist/esm/global-account/react/components/B3Provider/types.js +1 -0
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +23 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +0 -6
- package/dist/types/anyspend/react/components/AnySpendBondKit.d.ts +1 -3
- package/dist/types/anyspend/react/components/AnySpendBuySpin.d.ts +1 -2
- package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +57 -0
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -1
- package/dist/types/anyspend/react/components/AnySpendDepositUpside.d.ts +1 -2
- package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +1 -2
- package/dist/types/anyspend/react/components/AnySpendStakeB3.d.ts +1 -2
- package/dist/types/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +1 -2
- package/dist/types/anyspend/react/components/AnySpendStakeUpside.d.ts +1 -2
- package/dist/types/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +1 -2
- package/dist/types/anyspend/react/components/AnySpendTournament.d.ts +0 -2
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +1 -2
- package/dist/types/anyspend/react/components/AnyspendSignatureMint.d.ts +1 -2
- package/dist/types/anyspend/react/components/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +0 -1
- package/dist/types/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/types/anyspend/react/hooks/useValidatedClientReferenceId.d.ts +5 -0
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +4 -2
- package/dist/types/global-account/react/components/B3Provider/types.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +23 -1
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +0 -23
- package/src/anyspend/react/components/AnySpendBondKit.tsx +1 -3
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +0 -3
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +178 -0
- package/src/anyspend/react/components/AnySpendCustom.tsx +0 -5
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +0 -4
- package/src/anyspend/react/components/AnySpendDepositUpside.tsx +0 -3
- package/src/anyspend/react/components/AnySpendNFT.tsx +0 -3
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +0 -3
- package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +0 -3
- package/src/anyspend/react/components/AnySpendStakeUpside.tsx +0 -3
- package/src/anyspend/react/components/AnySpendStakeUpsideExactIn.tsx +0 -3
- package/src/anyspend/react/components/AnySpendTournament.tsx +0 -3
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +0 -3
- package/src/anyspend/react/components/AnyspendSignatureMint.tsx +0 -3
- package/src/anyspend/react/components/index.ts +1 -0
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +5 -2
- package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +6 -13
- package/src/anyspend/react/hooks/useValidatedClientReferenceId.ts +40 -0
- package/src/global-account/react/components/B3DynamicModal.tsx +3 -0
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +6 -0
- package/src/global-account/react/components/B3Provider/types.ts +2 -0
- package/src/global-account/react/stores/useModalStore.ts +25 -1
|
@@ -34,10 +34,4 @@ export declare function AnySpend(props: {
|
|
|
34
34
|
}) => void;
|
|
35
35
|
onSuccess?: (txHash?: string) => void;
|
|
36
36
|
customUsdInputValues?: string[];
|
|
37
|
-
/**
|
|
38
|
-
* Client-provided reference ID for tracking orders.
|
|
39
|
-
* Must be alphanumeric with optional hyphens, underscores, and dots (max 255 chars).
|
|
40
|
-
* Auto-generates UUID if not provided.
|
|
41
|
-
*/
|
|
42
|
-
clientReferenceId?: string;
|
|
43
37
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,7 +9,6 @@ exports.AnySpend = AnySpend;
|
|
|
9
9
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
10
10
|
const anyspend_1 = require("../../../anyspend");
|
|
11
11
|
const react_1 = require("../../../anyspend/react");
|
|
12
|
-
const validation_1 = require("../../../anyspend/utils/validation");
|
|
13
12
|
const react_2 = require("../../../global-account/react");
|
|
14
13
|
const cn_1 = require("../../../shared/utils/cn");
|
|
15
14
|
const number_1 = require("../../../shared/utils/number");
|
|
@@ -56,18 +55,9 @@ function AnySpend(props) {
|
|
|
56
55
|
const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
|
|
57
56
|
return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(AnySpendInner, { ...props }) }));
|
|
58
57
|
}
|
|
59
|
-
function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues,
|
|
58
|
+
function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, }) {
|
|
60
59
|
const searchParams = (0, react_2.useSearchParamsSSR)();
|
|
61
60
|
const router = (0, react_2.useRouter)();
|
|
62
|
-
// Validate and clean clientReferenceId
|
|
63
|
-
const validatedClientReferenceId = (0, react_4.useMemo)(() => {
|
|
64
|
-
const validation = validation_1.Validators.clientReferenceId(clientReferenceIdFromProps);
|
|
65
|
-
if (!validation.isValid) {
|
|
66
|
-
console.error(`[AnySpend] Invalid clientReferenceId: ${validation.error || "Validation failed"}. Will be set to undefined.`);
|
|
67
|
-
return undefined;
|
|
68
|
-
}
|
|
69
|
-
return validation.cleaned;
|
|
70
|
-
}, [clientReferenceIdFromProps]);
|
|
71
61
|
// Determine if we're in "buy mode" based on whether destination token props are provided
|
|
72
62
|
const isBuyMode = !!(destinationTokenAddress && destinationTokenChainId);
|
|
73
63
|
// Add refs to track URL state
|
|
@@ -655,7 +645,6 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
655
645
|
srcAmount: srcAmountBigInt.toString(),
|
|
656
646
|
expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount || "0",
|
|
657
647
|
creatorAddress: globalAddress,
|
|
658
|
-
clientReferenceId: validatedClientReferenceId,
|
|
659
648
|
});
|
|
660
649
|
}
|
|
661
650
|
catch (err) {
|
|
@@ -720,7 +709,6 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
|
|
|
720
709
|
},
|
|
721
710
|
expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount?.toString() || "0",
|
|
722
711
|
creatorAddress: globalAddress,
|
|
723
|
-
clientReferenceId: validatedClientReferenceId,
|
|
724
712
|
});
|
|
725
713
|
}
|
|
726
714
|
catch (err) {
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
import { AnySpendBondKitProps } from "../../../global-account/react/stores/useModalStore";
|
|
2
|
-
export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl, b3Amount: initialB3Amount, onSuccess,
|
|
3
|
-
clientReferenceId?: string;
|
|
4
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function AnySpendBondKit({ mode, recipientAddress, contractAddress, minTokensOut, imageUrl, b3Amount: initialB3Amount, onSuccess, }: AnySpendBondKitProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -23,7 +23,7 @@ function formatNumberWithCommas(x) {
|
|
|
23
23
|
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
24
24
|
return parts.join(".");
|
|
25
25
|
}
|
|
26
|
-
function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, minTokensOut = "0", imageUrl, b3Amount: initialB3Amount, onSuccess,
|
|
26
|
+
function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, minTokensOut = "0", imageUrl, b3Amount: initialB3Amount, onSuccess, }) {
|
|
27
27
|
const hasMounted = (0, react_1.useHasMounted)();
|
|
28
28
|
const [showAmountPrompt, setShowAmountPrompt] = (0, react_3.useState)(!initialB3Amount);
|
|
29
29
|
const [b3Amount, setB3Amount] = (0, react_3.useState)(initialB3Amount || "");
|
|
@@ -203,5 +203,5 @@ function AnySpendBondKit({ mode = "modal", recipientAddress, contractAddress, mi
|
|
|
203
203
|
});
|
|
204
204
|
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: supported_1.baseMainnet.id, dstToken: dstToken, dstAmount: (0, viem_1.parseEther)(b3Amount).toString(), contractAddress: contractAddress, encodedData: encodedData, metadata: {
|
|
205
205
|
action: "BondKit Buy",
|
|
206
|
-
}, header: header, onSuccess: onSuccess, showRecipient: true
|
|
206
|
+
}, header: header, onSuccess: onSuccess, showRecipient: true }));
|
|
207
207
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function AnySpendBuySpin({ loadOrder, mode, spinwheelContractAddress, chainId, recipientAddress, prefillQuantity, onSuccess,
|
|
1
|
+
export declare function AnySpendBuySpin({ loadOrder, mode, spinwheelContractAddress, chainId, recipientAddress, prefillQuantity, onSuccess, }: {
|
|
2
2
|
loadOrder?: string;
|
|
3
3
|
mode?: "modal" | "page";
|
|
4
4
|
spinwheelContractAddress: string;
|
|
@@ -6,5 +6,4 @@ export declare function AnySpendBuySpin({ loadOrder, mode, spinwheelContractAddr
|
|
|
6
6
|
recipientAddress: string;
|
|
7
7
|
prefillQuantity?: string;
|
|
8
8
|
onSuccess?: (txHash?: string) => void;
|
|
9
|
-
clientReferenceId?: string;
|
|
10
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -91,7 +91,7 @@ const basePublicClient = (0, viem_1.createPublicClient)({
|
|
|
91
91
|
chain: supported_1.baseMainnet,
|
|
92
92
|
transport: (0, viem_1.http)(constants_1.PUBLIC_BASE_RPC_URL),
|
|
93
93
|
});
|
|
94
|
-
function AnySpendBuySpin({ loadOrder, mode = "modal", spinwheelContractAddress, chainId, recipientAddress, prefillQuantity, onSuccess,
|
|
94
|
+
function AnySpendBuySpin({ loadOrder, mode = "modal", spinwheelContractAddress, chainId, recipientAddress, prefillQuantity, onSuccess, }) {
|
|
95
95
|
const hasMounted = (0, react_1.useHasMounted)();
|
|
96
96
|
const { setB3ModalOpen } = (0, react_1.useModalStore)();
|
|
97
97
|
// Payment config state
|
|
@@ -397,5 +397,5 @@ function AnySpendBuySpin({ loadOrder, mode = "modal", spinwheelContractAddress,
|
|
|
397
397
|
const encodedData = generateEncodedDataForBuyEntriesAndSpin(address || "", userSpinQuantity);
|
|
398
398
|
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: chainId, dstToken: anyspend_1.B3_TOKEN, dstAmount: totalCost.toString(), contractAddress: spinwheelContractAddress, spenderAddress: paymentConfig.entryModule, encodedData: encodedData, metadata: {
|
|
399
399
|
action: `buy ${userSpinQuantity} spin${userSpinQuantity !== "1" ? "s" : ""}`,
|
|
400
|
-
}, header: header, onSuccess: txHash => onSuccess?.(txHash), showRecipient: false
|
|
400
|
+
}, header: header, onSuccess: txHash => onSuccess?.(txHash), showRecipient: false }));
|
|
401
401
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { components } from "../../../anyspend/types/api";
|
|
2
|
+
import { GetQuoteResponse } from "../../../anyspend/types/api_req_res";
|
|
3
|
+
import React from "react";
|
|
4
|
+
export interface AnySpendCollectorClubPurchaseProps {
|
|
5
|
+
/**
|
|
6
|
+
* Optional order ID to load existing order
|
|
7
|
+
*/
|
|
8
|
+
loadOrder?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Display mode
|
|
11
|
+
*/
|
|
12
|
+
mode?: "modal" | "page";
|
|
13
|
+
/**
|
|
14
|
+
* Active tab (crypto or fiat payment)
|
|
15
|
+
*/
|
|
16
|
+
activeTab?: "crypto" | "fiat";
|
|
17
|
+
/**
|
|
18
|
+
* The pack ID to purchase
|
|
19
|
+
*/
|
|
20
|
+
packId: number;
|
|
21
|
+
/**
|
|
22
|
+
* The number of packs to purchase
|
|
23
|
+
*/
|
|
24
|
+
packAmount: number;
|
|
25
|
+
/**
|
|
26
|
+
* Price per pack in wei (e.g., "10000" for 0.01 USDC with 6 decimals)
|
|
27
|
+
*/
|
|
28
|
+
pricePerPack: string;
|
|
29
|
+
/**
|
|
30
|
+
* The payment token (defaults to USDC on Base)
|
|
31
|
+
*/
|
|
32
|
+
paymentToken?: components["schemas"]["Token"];
|
|
33
|
+
/**
|
|
34
|
+
* Address that will receive the packs
|
|
35
|
+
*/
|
|
36
|
+
recipientAddress: string;
|
|
37
|
+
/**
|
|
38
|
+
* Optional spender address (defaults to contract address)
|
|
39
|
+
*/
|
|
40
|
+
spenderAddress?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Success callback
|
|
43
|
+
*/
|
|
44
|
+
onSuccess?: (txHash?: string) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Optional custom header component
|
|
47
|
+
*/
|
|
48
|
+
header?: (props: {
|
|
49
|
+
anyspendPrice: GetQuoteResponse | undefined;
|
|
50
|
+
isLoadingAnyspendPrice: boolean;
|
|
51
|
+
}) => React.JSX.Element;
|
|
52
|
+
/**
|
|
53
|
+
* Show recipient selection (default: true)
|
|
54
|
+
*/
|
|
55
|
+
showRecipient?: boolean;
|
|
56
|
+
}
|
|
57
|
+
export declare function AnySpendCollectorClubPurchase({ loadOrder, mode, activeTab, packId, packAmount, pricePerPack, paymentToken, recipientAddress, spenderAddress, onSuccess, header, showRecipient, }: AnySpendCollectorClubPurchaseProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnySpendCollectorClubPurchase = AnySpendCollectorClubPurchase;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/**
|
|
6
|
+
* AnySpend component for Collector Club pack purchases
|
|
7
|
+
*
|
|
8
|
+
* This component enables users to purchase Collector Club packs using any token via AnySpend.
|
|
9
|
+
* It calls the `buyPacksFor` function on the Collector Club Shop contract on Base.
|
|
10
|
+
* Uses exact-out flow to ensure the contract receives exactly the required USDC amount.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* import { AnySpendCollectorClubPurchase } from "../../..";
|
|
15
|
+
* import { USDC_BASE } from "../../../anyspend/constants";
|
|
16
|
+
*
|
|
17
|
+
* function MyComponent() {
|
|
18
|
+
* return (
|
|
19
|
+
* <AnySpendCollectorClubPurchase
|
|
20
|
+
* packId={1}
|
|
21
|
+
* packAmount={5}
|
|
22
|
+
* pricePerPack="10000" // 0.01 USDC in wei (6 decimals)
|
|
23
|
+
* paymentToken={USDC_BASE}
|
|
24
|
+
* recipientAddress="0x123..."
|
|
25
|
+
* onSuccess={(txHash) => console.log("Purchase successful!", txHash)}
|
|
26
|
+
* />
|
|
27
|
+
* );
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
const constants_1 = require("../../../anyspend/constants");
|
|
32
|
+
const react_1 = require("react");
|
|
33
|
+
const viem_1 = require("viem");
|
|
34
|
+
const AnySpendCustom_1 = require("./AnySpendCustom");
|
|
35
|
+
// Collector Club Shop contract on Base
|
|
36
|
+
const CC_SHOP_ADDRESS = "0x68B32D594E3c7E5B8cd8046BD66AfB0DB5b9BF9c";
|
|
37
|
+
const BASE_CHAIN_ID = 8453;
|
|
38
|
+
// ABI for buyPacksFor function only
|
|
39
|
+
const BUY_PACKS_FOR_ABI = {
|
|
40
|
+
inputs: [
|
|
41
|
+
{ internalType: "address", name: "user", type: "address" },
|
|
42
|
+
{ internalType: "uint256", name: "packId", type: "uint256" },
|
|
43
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
44
|
+
],
|
|
45
|
+
name: "buyPacksFor",
|
|
46
|
+
outputs: [],
|
|
47
|
+
stateMutability: "nonpayable",
|
|
48
|
+
type: "function",
|
|
49
|
+
};
|
|
50
|
+
function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab = "crypto", packId, packAmount, pricePerPack, paymentToken = constants_1.USDC_BASE, recipientAddress, spenderAddress = CC_SHOP_ADDRESS, onSuccess, header, showRecipient = true, }) {
|
|
51
|
+
// Calculate total amount needed (pricePerPack * packAmount)
|
|
52
|
+
const totalAmount = (0, react_1.useMemo)(() => {
|
|
53
|
+
try {
|
|
54
|
+
return (BigInt(pricePerPack) * BigInt(packAmount)).toString();
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
console.error("Failed to calculate total amount from props", { pricePerPack, packAmount, error });
|
|
58
|
+
return "0";
|
|
59
|
+
}
|
|
60
|
+
}, [pricePerPack, packAmount]);
|
|
61
|
+
// Encode the buyPacksFor function call
|
|
62
|
+
const encodedData = (0, react_1.useMemo)(() => {
|
|
63
|
+
try {
|
|
64
|
+
return (0, viem_1.encodeFunctionData)({
|
|
65
|
+
abi: [BUY_PACKS_FOR_ABI],
|
|
66
|
+
functionName: "buyPacksFor",
|
|
67
|
+
args: [recipientAddress, BigInt(packId), BigInt(packAmount)],
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
console.error("Failed to encode function data", { recipientAddress, packId, packAmount, error });
|
|
72
|
+
return "0x";
|
|
73
|
+
}
|
|
74
|
+
}, [recipientAddress, packId, packAmount]);
|
|
75
|
+
// Default header if not provided
|
|
76
|
+
const defaultHeader = () => ((0, jsx_runtime_1.jsx)("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-as-primary text-xl font-bold", children: "Buy Collector Club Packs" }), (0, jsx_runtime_1.jsxs)("p", { className: "text-as-secondary text-sm", children: ["Purchase ", packAmount, " pack", packAmount !== 1 ? "s" : "", " using any token"] })] }) }));
|
|
77
|
+
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { loadOrder: loadOrder, mode: mode, activeTab: activeTab, recipientAddress: recipientAddress, spenderAddress: spenderAddress, orderType: "custom", dstChainId: BASE_CHAIN_ID, dstToken: paymentToken, dstAmount: totalAmount, contractAddress: CC_SHOP_ADDRESS, encodedData: encodedData, metadata: {
|
|
78
|
+
packId,
|
|
79
|
+
packAmount,
|
|
80
|
+
pricePerPack,
|
|
81
|
+
}, header: header || defaultHeader, onSuccess: onSuccess, showRecipient: showRecipient }));
|
|
82
|
+
}
|
|
@@ -147,7 +147,7 @@ function AnySpendCustom(props) {
|
|
|
147
147
|
const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
|
|
148
148
|
return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(AnySpendCustomInner, { ...props }) }));
|
|
149
149
|
}
|
|
150
|
-
function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabProps = "crypto", recipientAddress: recipientAddressProps, spenderAddress, orderType, dstChainId, dstToken, dstAmount, contractAddress, encodedData, metadata, header, onSuccess, showRecipient = true, onShowPointsDetail,
|
|
150
|
+
function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabProps = "crypto", recipientAddress: recipientAddressProps, spenderAddress, orderType, dstChainId, dstToken, dstAmount, contractAddress, encodedData, metadata, header, onSuccess, showRecipient = true, onShowPointsDetail, }) {
|
|
151
151
|
const hasMounted = (0, react_2.useHasMounted)();
|
|
152
152
|
const featureFlags = (0, FeatureFlagsContext_1.useFeatureFlags)();
|
|
153
153
|
const searchParams = (0, react_2.useSearchParamsSSR)();
|
|
@@ -390,13 +390,11 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
390
390
|
: window.location.origin,
|
|
391
391
|
},
|
|
392
392
|
expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount?.toString() || "0",
|
|
393
|
-
clientReferenceId: clientReferenceId,
|
|
394
393
|
});
|
|
395
394
|
}
|
|
396
395
|
else {
|
|
397
396
|
void createRegularOrder({
|
|
398
397
|
...createOrderParams,
|
|
399
|
-
clientReferenceId: clientReferenceId,
|
|
400
398
|
});
|
|
401
399
|
}
|
|
402
400
|
}
|
|
@@ -31,7 +31,6 @@ export interface AnySpendCustomExactInProps {
|
|
|
31
31
|
anyspendPrice: GetQuoteResponse | undefined;
|
|
32
32
|
isLoadingAnyspendPrice: boolean;
|
|
33
33
|
}) => React.JSX.Element;
|
|
34
|
-
clientReferenceId?: string;
|
|
35
34
|
}
|
|
36
35
|
export declare function AnySpendCustomExactIn(props: AnySpendCustomExactInProps): import("react/jsx-runtime").JSX.Element;
|
|
37
36
|
export {};
|
|
@@ -31,7 +31,7 @@ function AnySpendCustomExactIn(props) {
|
|
|
31
31
|
const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
|
|
32
32
|
return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(AnySpendCustomExactInInner, { ...props }) }));
|
|
33
33
|
}
|
|
34
|
-
function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, destinationToken, destinationChainId, onSuccess, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, customExactInConfig, orderType = "custom_exact_in", minDestinationAmount, header,
|
|
34
|
+
function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, destinationToken, destinationChainId, onSuccess, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, customExactInConfig, orderType = "custom_exact_in", minDestinationAmount, header, }) {
|
|
35
35
|
const actionLabel = customExactInConfig?.action ?? "Custom Execution";
|
|
36
36
|
const DESTINATION_TOKEN_DETAILS = {
|
|
37
37
|
SYMBOL: destinationToken.symbol ?? "TOKEN",
|
|
@@ -195,7 +195,6 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
|
|
|
195
195
|
expectedDstAmount: expectedDstAmountRaw,
|
|
196
196
|
creatorAddress: globalAddress,
|
|
197
197
|
payload,
|
|
198
|
-
clientReferenceId: clientReferenceId,
|
|
199
198
|
});
|
|
200
199
|
}
|
|
201
200
|
catch (err) {
|
|
@@ -248,7 +247,6 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
|
|
|
248
247
|
expectedDstAmount: expectedDstAmountRaw,
|
|
249
248
|
creatorAddress: globalAddress,
|
|
250
249
|
payload,
|
|
251
|
-
clientReferenceId: clientReferenceId,
|
|
252
250
|
});
|
|
253
251
|
}
|
|
254
252
|
catch (err) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { components } from "../../../anyspend/types/api";
|
|
2
|
-
export declare function AnySpendDepositUpside({ loadOrder, mode, recipientAddress, sourceTokenAddress, sourceTokenChainId, depositContractAddress, token, onSuccess,
|
|
2
|
+
export declare function AnySpendDepositUpside({ loadOrder, mode, recipientAddress, sourceTokenAddress, sourceTokenChainId, depositContractAddress, token, onSuccess, }: {
|
|
3
3
|
loadOrder?: string;
|
|
4
4
|
mode?: "modal" | "page";
|
|
5
5
|
recipientAddress: string;
|
|
@@ -8,5 +8,4 @@ export declare function AnySpendDepositUpside({ loadOrder, mode, recipientAddres
|
|
|
8
8
|
depositContractAddress: string;
|
|
9
9
|
token: components["schemas"]["Token"];
|
|
10
10
|
onSuccess?: (amount: string) => void;
|
|
11
|
-
clientReferenceId?: string;
|
|
12
11
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -25,7 +25,7 @@ const DEPOSIT_FOR_FUNCTION_ABI = JSON.stringify([
|
|
|
25
25
|
type: "function",
|
|
26
26
|
},
|
|
27
27
|
]);
|
|
28
|
-
function AnySpendDepositUpside({ loadOrder, mode = "modal", recipientAddress, sourceTokenAddress, sourceTokenChainId, depositContractAddress, token, onSuccess,
|
|
28
|
+
function AnySpendDepositUpside({ loadOrder, mode = "modal", recipientAddress, sourceTokenAddress, sourceTokenChainId, depositContractAddress, token, onSuccess, }) {
|
|
29
29
|
if (!recipientAddress)
|
|
30
30
|
return null;
|
|
31
31
|
const header = () => ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("div", { className: "from-b3-react-background to-as-on-surface-1 w-full rounded-t-lg bg-gradient-to-t", children: (0, jsx_runtime_1.jsx)("div", { className: "mb-1 flex w-full flex-col items-center gap-2", children: (0, jsx_runtime_1.jsxs)("span", { className: "font-sf-rounded text-2xl font-semibold", children: ["Swap & Deposit ", token.symbol] }) }) }) }));
|
|
@@ -37,5 +37,5 @@ function AnySpendDepositUpside({ loadOrder, mode = "modal", recipientAddress, so
|
|
|
37
37
|
spenderAddress: depositContractAddress,
|
|
38
38
|
action: `deposit ${token.symbol}`,
|
|
39
39
|
};
|
|
40
|
-
return ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: token, destinationChainId: chains_1.base.id, customExactInConfig: customExactInConfig, header: header, onSuccess: onSuccess
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: token, destinationChainId: chains_1.base.id, customExactInConfig: customExactInConfig, header: header, onSuccess: onSuccess }));
|
|
41
41
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { components } from "../../../anyspend/types/api";
|
|
2
|
-
export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftContract, onSuccess, onShowPointsDetail,
|
|
2
|
+
export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftContract, onSuccess, onShowPointsDetail, }: {
|
|
3
3
|
loadOrder?: string;
|
|
4
4
|
mode?: "modal" | "page";
|
|
5
5
|
recipientAddress?: string;
|
|
6
6
|
nftContract: components["schemas"]["NftContract"];
|
|
7
7
|
onSuccess?: (txHash?: string) => void;
|
|
8
8
|
onShowPointsDetail?: () => void;
|
|
9
|
-
clientReferenceId?: string;
|
|
10
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -29,7 +29,7 @@ const CONTRACT_URI_ABI = [
|
|
|
29
29
|
type: "function",
|
|
30
30
|
},
|
|
31
31
|
];
|
|
32
|
-
function AnySpendNFT({ loadOrder, mode = "modal", recipientAddress, nftContract, onSuccess, onShowPointsDetail,
|
|
32
|
+
function AnySpendNFT({ loadOrder, mode = "modal", recipientAddress, nftContract, onSuccess, onShowPointsDetail, }) {
|
|
33
33
|
const [imageUrlWithFallback, setFallbackImageUrl] = (0, react_3.useState)(nftContract.imageUrl);
|
|
34
34
|
const [isLoadingFallback, setIsLoadingFallback] = (0, react_3.useState)(false);
|
|
35
35
|
// Fetch contract metadata when imageUrl is empty
|
|
@@ -89,7 +89,7 @@ function AnySpendNFT({ loadOrder, mode = "modal", recipientAddress, nftContract,
|
|
|
89
89
|
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { loadOrder: loadOrder, mode: mode, activeTab: "fiat", recipientAddress: recipientAddress, orderType: "mint_nft", dstChainId: nftContract.chainId, dstToken: nftContract.currency, dstAmount: nftContract.price, contractAddress: nftContract.contractAddress, encodedData: "0x", metadata: {
|
|
90
90
|
type: "mint_nft",
|
|
91
91
|
nftContract: nftContract,
|
|
92
|
-
}, header: header, onSuccess: onSuccess, onShowPointsDetail: onShowPointsDetail
|
|
92
|
+
}, header: header, onSuccess: onSuccess, onShowPointsDetail: onShowPointsDetail }));
|
|
93
93
|
}
|
|
94
94
|
function DropdownMenu({ nftContract }) {
|
|
95
95
|
const [open, setOpen] = (0, react_3.useState)(false);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export declare function AnySpendStakeB3({ loadOrder, mode, recipientAddress, stakeAmount, onSuccess,
|
|
1
|
+
export declare function AnySpendStakeB3({ loadOrder, mode, recipientAddress, stakeAmount, onSuccess, }: {
|
|
2
2
|
loadOrder?: string;
|
|
3
3
|
mode?: "modal" | "page";
|
|
4
4
|
recipientAddress: string;
|
|
5
5
|
stakeAmount?: string;
|
|
6
6
|
onSuccess?: () => void;
|
|
7
|
-
clientReferenceId?: string;
|
|
8
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -35,7 +35,7 @@ function generateEncodedDataForStakingB3(amount, beneficiary) {
|
|
|
35
35
|
});
|
|
36
36
|
return encodedData;
|
|
37
37
|
}
|
|
38
|
-
function AnySpendStakeB3({ loadOrder, mode = "modal", recipientAddress, stakeAmount, onSuccess,
|
|
38
|
+
function AnySpendStakeB3({ loadOrder, mode = "modal", recipientAddress, stakeAmount, onSuccess, }) {
|
|
39
39
|
const hasMounted = (0, react_1.useHasMounted)();
|
|
40
40
|
const { setB3ModalOpen } = (0, react_1.useModalStore)();
|
|
41
41
|
// Wagmi hooks for direct staking
|
|
@@ -277,5 +277,5 @@ function AnySpendStakeB3({ loadOrder, mode = "modal", recipientAddress, stakeAmo
|
|
|
277
277
|
const encodedData = generateEncodedDataForStakingB3(userStakeAmount, recipientAddress);
|
|
278
278
|
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType: "custom", dstChainId: chains_1.base.id, dstToken: anyspend_1.B3_TOKEN, dstAmount: userStakeAmount, contractAddress: ERC20Staking, encodedData: encodedData, metadata: {
|
|
279
279
|
action: "stake B3",
|
|
280
|
-
}, header: header, onSuccess: onSuccess, showRecipient: true
|
|
280
|
+
}, header: header, onSuccess: onSuccess, showRecipient: true }));
|
|
281
281
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function AnySpendStakeB3ExactIn({ loadOrder, mode, sourceTokenAddress, sourceTokenChainId, recipientAddress, stakeAmount, onSuccess,
|
|
1
|
+
export declare function AnySpendStakeB3ExactIn({ loadOrder, mode, sourceTokenAddress, sourceTokenChainId, recipientAddress, stakeAmount, onSuccess, }: {
|
|
2
2
|
loadOrder?: string;
|
|
3
3
|
mode?: "modal" | "page";
|
|
4
4
|
sourceTokenAddress?: string;
|
|
@@ -6,5 +6,4 @@ export declare function AnySpendStakeB3ExactIn({ loadOrder, mode, sourceTokenAdd
|
|
|
6
6
|
recipientAddress: string;
|
|
7
7
|
stakeAmount?: string;
|
|
8
8
|
onSuccess?: (amount: string) => void;
|
|
9
|
-
clientReferenceId?: string;
|
|
10
9
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -35,7 +35,7 @@ const STAKE_FUNCTION_ABI = JSON.stringify([
|
|
|
35
35
|
outputs: [],
|
|
36
36
|
},
|
|
37
37
|
]);
|
|
38
|
-
function AnySpendStakeB3ExactIn({ loadOrder, mode = "modal", sourceTokenAddress, sourceTokenChainId, recipientAddress, stakeAmount, onSuccess,
|
|
38
|
+
function AnySpendStakeB3ExactIn({ loadOrder, mode = "modal", sourceTokenAddress, sourceTokenChainId, recipientAddress, stakeAmount, onSuccess, }) {
|
|
39
39
|
const hasMounted = (0, react_1.useHasMounted)();
|
|
40
40
|
const { setB3ModalOpen } = (0, react_1.useModalStore)();
|
|
41
41
|
// Wagmi hooks for direct staking
|
|
@@ -284,5 +284,5 @@ function AnySpendStakeB3ExactIn({ loadOrder, mode = "modal", sourceTokenAddress,
|
|
|
284
284
|
onSuccess?.((0, number_1.formatTokenAmount)(BigInt(userStakeAmount), 18) ?? "");
|
|
285
285
|
}, className: "bg-as-brand hover:bg-as-brand/90 text-as-primary h-14 w-full rounded-xl text-lg font-medium", children: "Done" })] })] }) }));
|
|
286
286
|
}
|
|
287
|
-
return ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: anyspend_1.B3_TOKEN, destinationChainId: chains_1.base.id, customExactInConfig: customExactInConfig, header: header, onSuccess: onSuccess
|
|
287
|
+
return ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: anyspend_1.B3_TOKEN, destinationChainId: chains_1.base.id, customExactInConfig: customExactInConfig, header: header, onSuccess: onSuccess }));
|
|
288
288
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { components } from "../../../anyspend/types/api";
|
|
2
|
-
export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab,
|
|
2
|
+
export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, }: {
|
|
3
3
|
loadOrder?: string;
|
|
4
4
|
mode?: "modal" | "page";
|
|
5
5
|
beneficiaryAddress: string;
|
|
@@ -8,5 +8,4 @@ export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddres
|
|
|
8
8
|
token: components["schemas"]["Token"];
|
|
9
9
|
onSuccess?: () => void;
|
|
10
10
|
activeTab?: "crypto" | "fiat";
|
|
11
|
-
clientReferenceId?: string;
|
|
12
11
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -20,7 +20,7 @@ function generateEncodedDataForStaking(amount, beneficiary) {
|
|
|
20
20
|
args: [beneficiary, BigInt(amount)],
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
function AnySpendStakeUpside({ loadOrder, mode = "modal", beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab,
|
|
23
|
+
function AnySpendStakeUpside({ loadOrder, mode = "modal", beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, }) {
|
|
24
24
|
const header = () => ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { className: "from-b3-react-background to-as-on-surface-1 mt-[-60px] w-full rounded-t-lg bg-gradient-to-t", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-[60px] w-full" }), (0, jsx_runtime_1.jsx)("div", { className: "mb-1 flex w-full flex-col items-center gap-2 p-5", children: (0, jsx_runtime_1.jsxs)("span", { className: "font-sf-rounded text-2xl font-semibold", children: ["Swap & Stake ", stakeAmount ? (0, number_1.formatTokenAmount)(BigInt(stakeAmount), token.decimals) : "", " ", token.symbol] }) })] }) }));
|
|
25
25
|
// Only generate encoded data if we have a valid beneficiary address
|
|
26
26
|
// This is used for the AnySpendCustom swap & stake flow
|
|
@@ -30,5 +30,5 @@ function AnySpendStakeUpside({ loadOrder, mode = "modal", beneficiaryAddress, st
|
|
|
30
30
|
const encodedData = generateEncodedDataForStaking(stakeAmount, beneficiaryAddress);
|
|
31
31
|
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { loadOrder: loadOrder, mode: mode, recipientAddress: beneficiaryAddress, orderType: "custom", dstChainId: chains_1.base.id, dstToken: token, dstAmount: stakeAmount, contractAddress: stakingContractAddress, encodedData: encodedData, metadata: {
|
|
32
32
|
action: `stake ${token.symbol}`,
|
|
33
|
-
}, header: header, onSuccess: onSuccess, showRecipient: true, activeTab: activeTab
|
|
33
|
+
}, header: header, onSuccess: onSuccess, showRecipient: true, activeTab: activeTab }));
|
|
34
34
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { components } from "../../../anyspend/types/api";
|
|
2
|
-
export declare function AnySpendStakeUpsideExactIn({ loadOrder, mode, recipientAddress, sourceTokenAddress, sourceTokenChainId, stakingContractAddress, token, onSuccess,
|
|
2
|
+
export declare function AnySpendStakeUpsideExactIn({ loadOrder, mode, recipientAddress, sourceTokenAddress, sourceTokenChainId, stakingContractAddress, token, onSuccess, }: {
|
|
3
3
|
loadOrder?: string;
|
|
4
4
|
mode?: "modal" | "page";
|
|
5
5
|
recipientAddress: string;
|
|
@@ -8,5 +8,4 @@ export declare function AnySpendStakeUpsideExactIn({ loadOrder, mode, recipientA
|
|
|
8
8
|
stakingContractAddress: string;
|
|
9
9
|
token: components["schemas"]["Token"];
|
|
10
10
|
onSuccess?: (amount: string) => void;
|
|
11
|
-
clientReferenceId?: string;
|
|
12
11
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -17,7 +17,7 @@ const STAKE_FOR_FUNCTION_ABI = JSON.stringify([
|
|
|
17
17
|
outputs: [],
|
|
18
18
|
},
|
|
19
19
|
]);
|
|
20
|
-
function AnySpendStakeUpsideExactIn({ loadOrder, mode = "modal", recipientAddress, sourceTokenAddress, sourceTokenChainId, stakingContractAddress, token, onSuccess,
|
|
20
|
+
function AnySpendStakeUpsideExactIn({ loadOrder, mode = "modal", recipientAddress, sourceTokenAddress, sourceTokenChainId, stakingContractAddress, token, onSuccess, }) {
|
|
21
21
|
if (!recipientAddress)
|
|
22
22
|
return null;
|
|
23
23
|
const header = () => ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("div", { className: "from-b3-react-background to-as-on-surface-1 w-full rounded-t-lg bg-gradient-to-t", children: (0, jsx_runtime_1.jsx)("div", { className: "mb-1 flex w-full flex-col items-center gap-2", children: (0, jsx_runtime_1.jsxs)("span", { className: "font-sf-rounded text-2xl font-semibold", children: ["Swap & Stake ", token.symbol, " (Exact In)"] }) }) }) }));
|
|
@@ -29,5 +29,5 @@ function AnySpendStakeUpsideExactIn({ loadOrder, mode = "modal", recipientAddres
|
|
|
29
29
|
spenderAddress: stakingContractAddress,
|
|
30
30
|
action: `stake ${token.symbol}`,
|
|
31
31
|
};
|
|
32
|
-
return ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: token, destinationChainId: chains_1.base.id, customExactInConfig: customExactInConfig, header: header, onSuccess: onSuccess
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: token, destinationChainId: chains_1.base.id, customExactInConfig: customExactInConfig, header: header, onSuccess: onSuccess }));
|
|
33
33
|
}
|
|
@@ -10,7 +10,6 @@ type AnySpendTournamentProps = {
|
|
|
10
10
|
tournamentEntryToken: components["schemas"]["Token"];
|
|
11
11
|
tournamentEntryFee: string;
|
|
12
12
|
onSuccess?: () => void;
|
|
13
|
-
clientReferenceId?: string;
|
|
14
13
|
} | {
|
|
15
14
|
mode?: "modal" | "page";
|
|
16
15
|
action: "fund";
|
|
@@ -21,7 +20,6 @@ type AnySpendTournamentProps = {
|
|
|
21
20
|
tournamentFundToken: components["schemas"]["Token"];
|
|
22
21
|
tournamentFundAmount: string;
|
|
23
22
|
onSuccess?: () => void;
|
|
24
|
-
clientReferenceId?: string;
|
|
25
23
|
};
|
|
26
24
|
export declare function AnySpendTournament(props: AnySpendTournamentProps): import("react/jsx-runtime").JSX.Element;
|
|
27
25
|
export {};
|
|
@@ -16,5 +16,5 @@ function AnySpendTournament(props) {
|
|
|
16
16
|
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { loadOrder: loadOrder, mode: mode, recipientAddress: action === "join" ? props.joinFor : undefined, orderType: action === "join" ? "join_tournament" : "fund_tournament", dstChainId: tournamentChainId, dstToken: dstToken, dstAmount: dstAmount, contractAddress: tournamentContractAddress, encodedData: "0x", metadata: {
|
|
17
17
|
type: action === "join" ? "join_tournament" : "fund_tournament",
|
|
18
18
|
tournament: tournamentMetadata,
|
|
19
|
-
}, header: header, onSuccess: onSuccess, showRecipient: action === "join"
|
|
19
|
+
}, header: header, onSuccess: onSuccess, showRecipient: action === "join" }));
|
|
20
20
|
}
|
|
@@ -21,6 +21,5 @@ export interface AnySpendDepositHypeProps {
|
|
|
21
21
|
}) => void;
|
|
22
22
|
customUsdInputValues?: string[];
|
|
23
23
|
preferEoa?: boolean;
|
|
24
|
-
clientReferenceId?: string;
|
|
25
24
|
}
|
|
26
|
-
export declare function AnySpendDepositHype({ loadOrder, mode, recipientAddress, paymentType, sourceTokenAddress, sourceTokenChainId, onSuccess, mainFooter, onTokenSelect, customUsdInputValues, preferEoa,
|
|
25
|
+
export declare function AnySpendDepositHype({ loadOrder, mode, recipientAddress, paymentType, sourceTokenAddress, sourceTokenChainId, onSuccess, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, }: AnySpendDepositHypeProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -10,7 +10,7 @@ exports.HYPE_TOKEN_DETAILS = {
|
|
|
10
10
|
SYMBOL: "HYPE",
|
|
11
11
|
LOGO_URI: "https://cdn.hypeduel.com/hypes-coin.svg",
|
|
12
12
|
};
|
|
13
|
-
function AnySpendDepositHype({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, onSuccess, mainFooter, onTokenSelect, customUsdInputValues, preferEoa,
|
|
13
|
+
function AnySpendDepositHype({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, onSuccess, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, }) {
|
|
14
14
|
if (!recipientAddress)
|
|
15
15
|
return null;
|
|
16
16
|
const header = () => ((0, jsx_runtime_1.jsx)("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("h1", { className: "text-as-primary text-xl font-bold", children: paymentType === "crypto" ? "Deposit Crypto" : "Fund with Fiat" }) }) }));
|
|
@@ -23,5 +23,5 @@ function AnySpendDepositHype({ loadOrder, mode = "modal", recipientAddress, paym
|
|
|
23
23
|
logoURI: exports.HYPE_TOKEN_DETAILS.LOGO_URI,
|
|
24
24
|
},
|
|
25
25
|
};
|
|
26
|
-
return ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, paymentType: paymentType, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: hypeToken, destinationChainId: chains_1.base.id, orderType: "hype_duel", minDestinationAmount: 10, header: header, onSuccess: onSuccess, mainFooter: mainFooter, onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, preferEoa: preferEoa
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, paymentType: paymentType, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: hypeToken, destinationChainId: chains_1.base.id, orderType: "hype_duel", minDestinationAmount: 10, header: header, onSuccess: onSuccess, mainFooter: mainFooter, onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, preferEoa: preferEoa }));
|
|
27
27
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { GenerateSigMintResponse } from "../../types/signatureMint";
|
|
2
|
-
export declare function AnyspendSignatureMint({ loadOrder, mode, signatureData, imageUrl, onSuccess,
|
|
2
|
+
export declare function AnyspendSignatureMint({ loadOrder, mode, signatureData, imageUrl, onSuccess, }: {
|
|
3
3
|
loadOrder?: string;
|
|
4
4
|
mode?: "modal" | "page";
|
|
5
5
|
signatureData: GenerateSigMintResponse;
|
|
6
6
|
imageUrl?: string;
|
|
7
7
|
onSuccess?: (txHash?: string) => void;
|
|
8
|
-
clientReferenceId?: string;
|
|
9
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -41,7 +41,7 @@ function generateEncodedDataForSignatureMint(signatureData) {
|
|
|
41
41
|
});
|
|
42
42
|
return encodedData;
|
|
43
43
|
}
|
|
44
|
-
function AnyspendSignatureMint({ loadOrder, mode = "modal", signatureData, imageUrl, onSuccess,
|
|
44
|
+
function AnyspendSignatureMint({ loadOrder, mode = "modal", signatureData, imageUrl, onSuccess, }) {
|
|
45
45
|
// Get token data
|
|
46
46
|
const { data: tokenData, isError: isTokenError, isLoading, } = (0, react_1.useTokenData)(signatureData.collection.chainId, signatureData.collection.signatureRequestBody?.currency);
|
|
47
47
|
// Convert token data to AnySpend Token type
|
|
@@ -74,5 +74,5 @@ function AnyspendSignatureMint({ loadOrder, mode = "modal", signatureData, image
|
|
|
74
74
|
const price = (0, viem_1.parseEther)(signatureData.payload.price?.toString() || "0");
|
|
75
75
|
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { loadOrder: loadOrder, mode: mode, recipientAddress: signatureData.payload.to, orderType: "custom", dstChainId: signatureData.collection.chainId, dstToken: dstToken, dstAmount: price.toString(), contractAddress: signatureData.collection.address || "", encodedData: encodedData, metadata: {
|
|
76
76
|
action: "Signature Mint",
|
|
77
|
-
}, header: header, onSuccess: onSuccess, showRecipient: true
|
|
77
|
+
}, header: header, onSuccess: onSuccess, showRecipient: true }));
|
|
78
78
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { AnySpend } from "./AnySpend";
|
|
2
2
|
export { AnySpendBondKit } from "./AnySpendBondKit";
|
|
3
3
|
export { AnySpendBuySpin } from "./AnySpendBuySpin";
|
|
4
|
+
export { AnySpendCollectorClubPurchase } from "./AnySpendCollectorClubPurchase";
|
|
4
5
|
export { AnySpendCustom } from "./AnySpendCustom";
|
|
5
6
|
export { AnySpendCustomExactIn } from "./AnySpendCustomExactIn";
|
|
6
7
|
export { AnySpendDepositHype, HYPE_TOKEN_DETAILS } from "./AnyspendDepositHype";
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.WebviewOnrampPayment = exports.WebviewOnrampOrderStatus = exports.TransferCryptoDetails = exports.TokenBalance = exports.StepProgress = exports.RecipientSelection = exports.OrderTokenAmount = exports.OrderToken = exports.OrderStatus = exports.OrderHistoryItem = exports.OrderHistory = exports.OrderDetailsCollapsible = exports.OrderDetails = exports.CryptoReceiveSection = exports.CryptoPaySection = exports.ChainTokenIcon = exports.AnySpendNFTButton = exports.AnySpendTournament = exports.AnySpendStakeUpsideExactIn = exports.AnySpendStakeUpside = exports.AnySpendStakeB3ExactIn = exports.AnySpendStakeB3 = exports.AnyspendSignatureMint = exports.AnySpendNFT = exports.HYPE_TOKEN_DETAILS = exports.AnySpendDepositHype = exports.AnySpendCustomExactIn = exports.AnySpendCustom = exports.AnySpendBuySpin = exports.AnySpendBondKit = exports.AnySpend = void 0;
|
|
17
|
+
exports.WebviewOnrampPayment = exports.WebviewOnrampOrderStatus = exports.TransferCryptoDetails = exports.TokenBalance = exports.StepProgress = exports.RecipientSelection = exports.OrderTokenAmount = exports.OrderToken = exports.OrderStatus = exports.OrderHistoryItem = exports.OrderHistory = exports.OrderDetailsCollapsible = exports.OrderDetails = exports.CryptoReceiveSection = exports.CryptoPaySection = exports.ChainTokenIcon = exports.AnySpendNFTButton = exports.AnySpendTournament = exports.AnySpendStakeUpsideExactIn = exports.AnySpendStakeUpside = exports.AnySpendStakeB3ExactIn = exports.AnySpendStakeB3 = exports.AnyspendSignatureMint = exports.AnySpendNFT = exports.HYPE_TOKEN_DETAILS = exports.AnySpendDepositHype = exports.AnySpendCustomExactIn = exports.AnySpendCustom = exports.AnySpendCollectorClubPurchase = exports.AnySpendBuySpin = exports.AnySpendBondKit = exports.AnySpend = void 0;
|
|
18
18
|
// Components
|
|
19
19
|
var AnySpend_1 = require("./AnySpend");
|
|
20
20
|
Object.defineProperty(exports, "AnySpend", { enumerable: true, get: function () { return AnySpend_1.AnySpend; } });
|
|
@@ -22,6 +22,8 @@ var AnySpendBondKit_1 = require("./AnySpendBondKit");
|
|
|
22
22
|
Object.defineProperty(exports, "AnySpendBondKit", { enumerable: true, get: function () { return AnySpendBondKit_1.AnySpendBondKit; } });
|
|
23
23
|
var AnySpendBuySpin_1 = require("./AnySpendBuySpin");
|
|
24
24
|
Object.defineProperty(exports, "AnySpendBuySpin", { enumerable: true, get: function () { return AnySpendBuySpin_1.AnySpendBuySpin; } });
|
|
25
|
+
var AnySpendCollectorClubPurchase_1 = require("./AnySpendCollectorClubPurchase");
|
|
26
|
+
Object.defineProperty(exports, "AnySpendCollectorClubPurchase", { enumerable: true, get: function () { return AnySpendCollectorClubPurchase_1.AnySpendCollectorClubPurchase; } });
|
|
25
27
|
var AnySpendCustom_1 = require("./AnySpendCustom");
|
|
26
28
|
Object.defineProperty(exports, "AnySpendCustom", { enumerable: true, get: function () { return AnySpendCustom_1.AnySpendCustom; } });
|
|
27
29
|
var AnySpendCustomExactIn_1 = require("./AnySpendCustomExactIn");
|