@b3dotfun/sdk 0.0.7-alpha.19 → 0.0.7-alpha.20
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/abis/signature-minting.d.ts +79 -0
- package/dist/cjs/anyspend/abis/signature-minting.js +45 -0
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.d.ts +8 -0
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.js +77 -0
- 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/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/hooks/index.js +1 -0
- package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +140 -0
- package/dist/cjs/anyspend/react/hooks/useSigMint.js +39 -0
- package/dist/cjs/anyspend/types/signature-mint.d.ts +69 -0
- package/dist/cjs/anyspend/types/signature-mint.js +2 -0
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +11 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +16 -1
- package/dist/esm/anyspend/abis/signature-minting.d.ts +79 -0
- package/dist/esm/anyspend/abis/signature-minting.js +42 -0
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.d.ts +8 -0
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.js +71 -0
- 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/index.d.ts +1 -0
- package/dist/esm/anyspend/react/hooks/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +140 -0
- package/dist/esm/anyspend/react/hooks/useSigMint.js +33 -0
- package/dist/esm/anyspend/types/signature-mint.d.ts +69 -0
- package/dist/esm/anyspend/types/signature-mint.js +1 -0
- package/dist/esm/global-account/react/components/B3DynamicModal.js +12 -2
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +16 -1
- package/dist/types/anyspend/abis/signature-minting.d.ts +79 -0
- package/dist/types/anyspend/react/components/AnyspendSignatureMint.d.ts +8 -0
- package/dist/types/anyspend/react/components/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useSigMint.d.ts +140 -0
- package/dist/types/anyspend/types/signature-mint.d.ts +69 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +16 -1
- package/package.json +2 -2
- package/src/anyspend/abis/signature-minting.ts +43 -0
- package/src/anyspend/react/components/AnyspendSignatureMint.tsx +147 -0
- package/src/anyspend/react/components/index.ts +1 -0
- package/src/anyspend/react/hooks/index.ts +1 -0
- package/src/anyspend/react/hooks/useSigMint.tsx +55 -0
- package/src/anyspend/types/signature-mint.ts +77 -0
- package/src/global-account/react/components/B3DynamicModal.tsx +12 -3
- package/src/global-account/react/stores/useModalStore.ts +18 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export declare const ABI_SIGNATURE_MINTING: readonly [{
|
|
2
|
+
readonly inputs: readonly [{
|
|
3
|
+
readonly components: readonly [{
|
|
4
|
+
readonly name: "to";
|
|
5
|
+
readonly type: "address";
|
|
6
|
+
}, {
|
|
7
|
+
readonly name: "royaltyRecipient";
|
|
8
|
+
readonly type: "address";
|
|
9
|
+
}, {
|
|
10
|
+
readonly name: "royaltyBps";
|
|
11
|
+
readonly type: "uint256";
|
|
12
|
+
}, {
|
|
13
|
+
readonly name: "primarySaleRecipient";
|
|
14
|
+
readonly type: "address";
|
|
15
|
+
}, {
|
|
16
|
+
readonly name: "tokenId";
|
|
17
|
+
readonly type: "uint256";
|
|
18
|
+
}, {
|
|
19
|
+
readonly name: "uri";
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "quantity";
|
|
23
|
+
readonly type: "uint256";
|
|
24
|
+
}, {
|
|
25
|
+
readonly name: "pricePerToken";
|
|
26
|
+
readonly type: "uint256";
|
|
27
|
+
}, {
|
|
28
|
+
readonly name: "currency";
|
|
29
|
+
readonly type: "address";
|
|
30
|
+
}, {
|
|
31
|
+
readonly name: "validityStartTimestamp";
|
|
32
|
+
readonly type: "uint128";
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "validityEndTimestamp";
|
|
35
|
+
readonly type: "uint128";
|
|
36
|
+
}, {
|
|
37
|
+
readonly name: "uid";
|
|
38
|
+
readonly type: "bytes32";
|
|
39
|
+
}];
|
|
40
|
+
readonly name: "_req";
|
|
41
|
+
readonly type: "tuple";
|
|
42
|
+
}, {
|
|
43
|
+
readonly name: "_signature";
|
|
44
|
+
readonly type: "bytes";
|
|
45
|
+
}];
|
|
46
|
+
readonly name: "mintWithSignature";
|
|
47
|
+
readonly outputs: readonly [{
|
|
48
|
+
readonly name: "";
|
|
49
|
+
readonly type: "uint256";
|
|
50
|
+
}];
|
|
51
|
+
readonly stateMutability: "payable";
|
|
52
|
+
readonly type: "function";
|
|
53
|
+
}];
|
|
54
|
+
export declare const ABI_TRANSFER_SINGLE_EVENT: {
|
|
55
|
+
readonly anonymous: false;
|
|
56
|
+
readonly inputs: readonly [{
|
|
57
|
+
readonly indexed: true;
|
|
58
|
+
readonly name: "operator";
|
|
59
|
+
readonly type: "address";
|
|
60
|
+
}, {
|
|
61
|
+
readonly indexed: true;
|
|
62
|
+
readonly name: "from";
|
|
63
|
+
readonly type: "address";
|
|
64
|
+
}, {
|
|
65
|
+
readonly indexed: true;
|
|
66
|
+
readonly name: "to";
|
|
67
|
+
readonly type: "address";
|
|
68
|
+
}, {
|
|
69
|
+
readonly indexed: false;
|
|
70
|
+
readonly name: "id";
|
|
71
|
+
readonly type: "uint256";
|
|
72
|
+
}, {
|
|
73
|
+
readonly indexed: false;
|
|
74
|
+
readonly name: "value";
|
|
75
|
+
readonly type: "uint256";
|
|
76
|
+
}];
|
|
77
|
+
readonly name: "TransferSingle";
|
|
78
|
+
readonly type: "event";
|
|
79
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ABI_TRANSFER_SINGLE_EVENT = exports.ABI_SIGNATURE_MINTING = void 0;
|
|
4
|
+
// ABI for ERC1155 signature minting
|
|
5
|
+
exports.ABI_SIGNATURE_MINTING = [
|
|
6
|
+
{
|
|
7
|
+
inputs: [
|
|
8
|
+
{
|
|
9
|
+
components: [
|
|
10
|
+
{ name: "to", type: "address" },
|
|
11
|
+
{ name: "royaltyRecipient", type: "address" },
|
|
12
|
+
{ name: "royaltyBps", type: "uint256" },
|
|
13
|
+
{ name: "primarySaleRecipient", type: "address" },
|
|
14
|
+
{ name: "tokenId", type: "uint256" },
|
|
15
|
+
{ name: "uri", type: "string" },
|
|
16
|
+
{ name: "quantity", type: "uint256" },
|
|
17
|
+
{ name: "pricePerToken", type: "uint256" },
|
|
18
|
+
{ name: "currency", type: "address" },
|
|
19
|
+
{ name: "validityStartTimestamp", type: "uint128" },
|
|
20
|
+
{ name: "validityEndTimestamp", type: "uint128" },
|
|
21
|
+
{ name: "uid", type: "bytes32" },
|
|
22
|
+
],
|
|
23
|
+
name: "_req",
|
|
24
|
+
type: "tuple",
|
|
25
|
+
},
|
|
26
|
+
{ name: "_signature", type: "bytes" },
|
|
27
|
+
],
|
|
28
|
+
name: "mintWithSignature",
|
|
29
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
30
|
+
stateMutability: "payable",
|
|
31
|
+
type: "function",
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
exports.ABI_TRANSFER_SINGLE_EVENT = {
|
|
35
|
+
anonymous: false,
|
|
36
|
+
inputs: [
|
|
37
|
+
{ indexed: true, name: "operator", type: "address" },
|
|
38
|
+
{ indexed: true, name: "from", type: "address" },
|
|
39
|
+
{ indexed: true, name: "to", type: "address" },
|
|
40
|
+
{ indexed: false, name: "id", type: "uint256" },
|
|
41
|
+
{ indexed: false, name: "value", type: "uint256" },
|
|
42
|
+
],
|
|
43
|
+
name: "TransferSingle",
|
|
44
|
+
type: "event",
|
|
45
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GenerateSigMintResponse } from "../../types/signature-mint";
|
|
2
|
+
export declare function AnyspendSignatureMint({ loadOrder, mode, signatureData, imageUrl, onSuccess, }: {
|
|
3
|
+
loadOrder?: string;
|
|
4
|
+
mode?: "modal" | "page";
|
|
5
|
+
signatureData: GenerateSigMintResponse;
|
|
6
|
+
imageUrl?: string;
|
|
7
|
+
onSuccess?: () => void;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AnyspendSignatureMint = AnyspendSignatureMint;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const anyspend_1 = require("../../../anyspend");
|
|
9
|
+
const react_1 = require("../../../global-account/react");
|
|
10
|
+
const debug_1 = __importDefault(require("../../../shared/utils/debug"));
|
|
11
|
+
const react_2 = require("react");
|
|
12
|
+
const viem_1 = require("viem");
|
|
13
|
+
const signature_minting_1 = require("../../abis/signature-minting");
|
|
14
|
+
const AnySpendCustom_1 = require("./AnySpendCustom");
|
|
15
|
+
// Helper function to determine if URL is a video
|
|
16
|
+
function isVideoURL(url) {
|
|
17
|
+
const videoExtensions = [".mp4", ".webm", ".ogg"];
|
|
18
|
+
return videoExtensions.some(ext => url.toLowerCase().endsWith(ext));
|
|
19
|
+
}
|
|
20
|
+
function generateEncodedDataForSignatureMint(signatureData) {
|
|
21
|
+
const { signature, payload } = signatureData;
|
|
22
|
+
(0, debug_1.default)(signature, "Signature is required");
|
|
23
|
+
(0, debug_1.default)(payload, "Payload is required");
|
|
24
|
+
const mintRequest = {
|
|
25
|
+
to: payload.to,
|
|
26
|
+
royaltyRecipient: payload.royaltyRecipient,
|
|
27
|
+
royaltyBps: BigInt(payload.royaltyBps || 0),
|
|
28
|
+
primarySaleRecipient: payload.primarySaleRecipient,
|
|
29
|
+
tokenId: BigInt(payload.tokenId || 0),
|
|
30
|
+
uri: payload.uri,
|
|
31
|
+
quantity: BigInt(payload.quantity || 1),
|
|
32
|
+
pricePerToken: (0, viem_1.parseEther)(payload.price?.toString() || "0"),
|
|
33
|
+
currency: payload.currencyAddress,
|
|
34
|
+
validityStartTimestamp: BigInt(payload.mintStartTime || 0),
|
|
35
|
+
validityEndTimestamp: BigInt(payload.mintEndTime || 0),
|
|
36
|
+
uid: payload.uid,
|
|
37
|
+
};
|
|
38
|
+
const encodedData = (0, viem_1.encodeFunctionData)({
|
|
39
|
+
abi: [signature_minting_1.ABI_SIGNATURE_MINTING[0]],
|
|
40
|
+
functionName: "mintWithSignature",
|
|
41
|
+
args: [mintRequest, signature],
|
|
42
|
+
});
|
|
43
|
+
return encodedData;
|
|
44
|
+
}
|
|
45
|
+
function AnyspendSignatureMint({ loadOrder, mode = "modal", signatureData, imageUrl, onSuccess, }) {
|
|
46
|
+
const hasMounted = (0, react_1.useHasMounted)();
|
|
47
|
+
// Get token data
|
|
48
|
+
const { data: tokenData, isError: isTokenError } = (0, react_1.useTokenData)(signatureData.collection.chainId, signatureData.collection.signatureRequestBody?.currency);
|
|
49
|
+
// Convert token data to AnySpend Token type
|
|
50
|
+
const dstToken = (0, react_2.useMemo)(() => {
|
|
51
|
+
if (!tokenData)
|
|
52
|
+
return null;
|
|
53
|
+
return {
|
|
54
|
+
address: tokenData.address,
|
|
55
|
+
chainId: signatureData.collection.chainId,
|
|
56
|
+
name: tokenData.name,
|
|
57
|
+
symbol: tokenData.symbol,
|
|
58
|
+
decimals: tokenData.decimals,
|
|
59
|
+
metadata: {
|
|
60
|
+
logoURI: tokenData.logoURI,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}, [tokenData, signatureData.collection.chainId]);
|
|
64
|
+
const mediaUrl = imageUrl || signatureData.payload.metadata.image || "https://cdn.b3.fun/nft-placeholder.png";
|
|
65
|
+
const isVideo = isVideoURL(mediaUrl);
|
|
66
|
+
const header = () => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "relative mx-auto size-32", children: isVideo ? ((0, jsx_runtime_1.jsxs)("video", { autoPlay: true, loop: true, muted: true, playsInline: true, className: "size-full rounded-lg object-cover", children: [(0, jsx_runtime_1.jsx)("source", { src: mediaUrl, type: `video/${mediaUrl.split(".").pop()}` }), "Your browser does not support the video tag."] })) : ((0, jsx_runtime_1.jsx)("img", { alt: "nft preview", className: "size-full rounded-lg object-cover", src: mediaUrl })) }), (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: [signatureData.payload.metadata.name || "Mint NFT", " ", Number(signatureData.payload.quantity) > 1 ? `(${signatureData.payload.quantity}x)` : ""] }) })] })] }));
|
|
67
|
+
// If we don't have token data, show error state
|
|
68
|
+
if (!dstToken || isTokenError) {
|
|
69
|
+
return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)("div", { className: "b3-root b3-modal bg-b3-react-background flex w-full flex-col items-center p-8", children: (0, jsx_runtime_1.jsxs)("p", { className: "text-as-red text-center text-sm", children: ["Failed to fetch payment token information for ", signatureData.collection.signatureRequestBody?.currency, " on chain ", signatureData.collection.chainId, ". Please try again."] }) }) }));
|
|
70
|
+
}
|
|
71
|
+
const encodedData = generateEncodedDataForSignatureMint(signatureData);
|
|
72
|
+
const price = (0, viem_1.parseEther)(signatureData.payload.price?.toString() || "0");
|
|
73
|
+
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { isMainnet: true, loadOrder: loadOrder, mode: mode, recipientAddress: signatureData.payload.to, orderType: anyspend_1.OrderType.Custom, dstChainId: signatureData.collection.chainId, dstToken: dstToken, dstAmount: price.toString(), contractAddress: signatureData.collection.address, encodedData: encodedData, metadata: {
|
|
74
|
+
type: anyspend_1.OrderType.Custom,
|
|
75
|
+
action: "Signature Mint",
|
|
76
|
+
}, header: header, onSuccess: onSuccess, showRecipient: true }));
|
|
77
|
+
}
|
|
@@ -3,6 +3,7 @@ export { AnySpendBuySpin } from "./AnySpendBuySpin";
|
|
|
3
3
|
export { AnySpendCustom } from "./AnySpendCustom";
|
|
4
4
|
export { AnySpendNFT } from "./AnySpendNFT";
|
|
5
5
|
export { AnySpendNFTButton } from "./AnySpendNFTButton";
|
|
6
|
+
export { AnyspendSignatureMint } from "./AnyspendSignatureMint";
|
|
6
7
|
export { AnySpendStakeB3 } from "./AnySpendStakeB3";
|
|
7
8
|
export { AnySpendTournament } from "./AnySpendTournament";
|
|
8
9
|
export { ChainTokenIcon } from "./common/ChainTokenIcon";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebviewOnrampPayment = exports.WebviewOnrampOrderStatus = exports.TokenBalance = exports.OrderTokenAmount = exports.OrderToken = exports.OrderStatus = exports.OrderHistoryItem = exports.OrderHistory = exports.OrderDetails = exports.ChainTokenIcon = exports.AnySpendTournament = exports.AnySpendStakeB3 = exports.AnySpendNFTButton = exports.AnySpendNFT = exports.AnySpendCustom = exports.AnySpendBuySpin = exports.AnySpend = void 0;
|
|
3
|
+
exports.WebviewOnrampPayment = exports.WebviewOnrampOrderStatus = exports.TokenBalance = exports.OrderTokenAmount = exports.OrderToken = exports.OrderStatus = exports.OrderHistoryItem = exports.OrderHistory = exports.OrderDetails = exports.ChainTokenIcon = exports.AnySpendTournament = exports.AnySpendStakeB3 = exports.AnyspendSignatureMint = exports.AnySpendNFTButton = exports.AnySpendNFT = exports.AnySpendCustom = exports.AnySpendBuySpin = exports.AnySpend = void 0;
|
|
4
4
|
// Components
|
|
5
5
|
var AnySpend_1 = require("./AnySpend");
|
|
6
6
|
Object.defineProperty(exports, "AnySpend", { enumerable: true, get: function () { return AnySpend_1.AnySpend; } });
|
|
@@ -12,6 +12,8 @@ var AnySpendNFT_1 = require("./AnySpendNFT");
|
|
|
12
12
|
Object.defineProperty(exports, "AnySpendNFT", { enumerable: true, get: function () { return AnySpendNFT_1.AnySpendNFT; } });
|
|
13
13
|
var AnySpendNFTButton_1 = require("./AnySpendNFTButton");
|
|
14
14
|
Object.defineProperty(exports, "AnySpendNFTButton", { enumerable: true, get: function () { return AnySpendNFTButton_1.AnySpendNFTButton; } });
|
|
15
|
+
var AnyspendSignatureMint_1 = require("./AnyspendSignatureMint");
|
|
16
|
+
Object.defineProperty(exports, "AnyspendSignatureMint", { enumerable: true, get: function () { return AnyspendSignatureMint_1.AnyspendSignatureMint; } });
|
|
15
17
|
var AnySpendStakeB3_1 = require("./AnySpendStakeB3");
|
|
16
18
|
Object.defineProperty(exports, "AnySpendStakeB3", { enumerable: true, get: function () { return AnySpendStakeB3_1.AnySpendStakeB3; } });
|
|
17
19
|
var AnySpendTournament_1 = require("./AnySpendTournament");
|
|
@@ -9,5 +9,6 @@ export * from "./useCoinbaseOnrampOptions";
|
|
|
9
9
|
export * from "./useGeoOnrampOptions";
|
|
10
10
|
export * from "./useGetGeo";
|
|
11
11
|
export * from "./usePermitData";
|
|
12
|
+
export * from "./useSigMint";
|
|
12
13
|
export * from "./useStripeClientSecret";
|
|
13
14
|
export * from "./useStripeSupport";
|
|
@@ -25,5 +25,6 @@ __exportStar(require("./useCoinbaseOnrampOptions"), exports);
|
|
|
25
25
|
__exportStar(require("./useGeoOnrampOptions"), exports);
|
|
26
26
|
__exportStar(require("./useGetGeo"), exports);
|
|
27
27
|
__exportStar(require("./usePermitData"), exports);
|
|
28
|
+
__exportStar(require("./useSigMint"), exports);
|
|
28
29
|
__exportStar(require("./useStripeClientSecret"), exports);
|
|
29
30
|
__exportStar(require("./useStripeSupport"), exports);
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { FindByAddressParams, GenerateSigMintParams, IsMintEligibleParams } from "../../types/signature-mint";
|
|
2
|
+
/**
|
|
3
|
+
* Hook to generate signature for minting
|
|
4
|
+
*/
|
|
5
|
+
export declare const useGenerateSigMintData: ({ recipientAddress, contractAddress, chainId, quantity, prompt, }: GenerateSigMintParams) => {
|
|
6
|
+
data: {
|
|
7
|
+
payload: any;
|
|
8
|
+
signature: string;
|
|
9
|
+
collection: {
|
|
10
|
+
status?: "DRAFT" | "ACTIVE" | "INACTIVE" | undefined;
|
|
11
|
+
metadata?: {} | undefined;
|
|
12
|
+
logoURI?: string | undefined;
|
|
13
|
+
description?: string | undefined;
|
|
14
|
+
createdAt?: string | undefined;
|
|
15
|
+
updatedAt?: string | undefined;
|
|
16
|
+
creator?: string | undefined;
|
|
17
|
+
signatureRequestBody?: {
|
|
18
|
+
price?: string | undefined;
|
|
19
|
+
currency?: string | undefined;
|
|
20
|
+
clonePrice?: string | undefined;
|
|
21
|
+
primarySaleRecipient?: string | undefined;
|
|
22
|
+
royaltyRecipient?: string | undefined;
|
|
23
|
+
royaltyBps?: number | undefined;
|
|
24
|
+
validityStartTimestamp?: number | undefined;
|
|
25
|
+
validityEndTimestamp?: number | undefined;
|
|
26
|
+
metadata: {
|
|
27
|
+
name?: string | undefined;
|
|
28
|
+
description?: string | undefined;
|
|
29
|
+
properties?: any;
|
|
30
|
+
image?: string | undefined;
|
|
31
|
+
externalLink?: string | undefined;
|
|
32
|
+
appUri?: string | undefined;
|
|
33
|
+
attributes?: any;
|
|
34
|
+
backgroundColor?: string | undefined;
|
|
35
|
+
promptImageUrl?: string | undefined;
|
|
36
|
+
};
|
|
37
|
+
} | undefined;
|
|
38
|
+
maxSupply?: number | undefined;
|
|
39
|
+
conditions?: {
|
|
40
|
+
chainId: number;
|
|
41
|
+
tokenAddress: string;
|
|
42
|
+
conditionType: "user-owns-tokens";
|
|
43
|
+
isOnchain: boolean;
|
|
44
|
+
tokenAmount: string;
|
|
45
|
+
}[] | undefined;
|
|
46
|
+
isFreeMint?: boolean | undefined;
|
|
47
|
+
engineWallet?: string | undefined;
|
|
48
|
+
creatorMap?: {} | undefined;
|
|
49
|
+
chainId: number;
|
|
50
|
+
address: string;
|
|
51
|
+
title: string;
|
|
52
|
+
_id: string | {};
|
|
53
|
+
};
|
|
54
|
+
} | null;
|
|
55
|
+
error: Error | null;
|
|
56
|
+
isLoading: boolean;
|
|
57
|
+
runQuery: (queryParams: {
|
|
58
|
+
imageUrl?: string | undefined;
|
|
59
|
+
tokenId?: string | undefined;
|
|
60
|
+
quantity?: string | undefined;
|
|
61
|
+
prompt?: string | undefined;
|
|
62
|
+
chainId: number;
|
|
63
|
+
contractAddress: string;
|
|
64
|
+
recipientAddress: string;
|
|
65
|
+
}) => Promise<any>;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Hook to fetch a signature minting collection by address
|
|
69
|
+
*/
|
|
70
|
+
export declare const useSigMintCollection: ({ address, chainId }: FindByAddressParams) => {
|
|
71
|
+
data: {
|
|
72
|
+
description?: string | undefined;
|
|
73
|
+
createdAt?: string | undefined;
|
|
74
|
+
updatedAt?: string | undefined;
|
|
75
|
+
status?: "DRAFT" | "ACTIVE" | "INACTIVE" | undefined;
|
|
76
|
+
metadata?: {} | undefined;
|
|
77
|
+
logoURI?: string | undefined;
|
|
78
|
+
creator?: string | undefined;
|
|
79
|
+
signatureRequestBody?: {
|
|
80
|
+
price?: string | undefined;
|
|
81
|
+
clonePrice?: string | undefined;
|
|
82
|
+
currency?: string | undefined;
|
|
83
|
+
primarySaleRecipient?: string | undefined;
|
|
84
|
+
royaltyRecipient?: string | undefined;
|
|
85
|
+
royaltyBps?: number | undefined;
|
|
86
|
+
validityStartTimestamp?: number | undefined;
|
|
87
|
+
validityEndTimestamp?: number | undefined;
|
|
88
|
+
metadata: {
|
|
89
|
+
properties?: any;
|
|
90
|
+
description?: string | undefined;
|
|
91
|
+
name?: string | undefined;
|
|
92
|
+
image?: string | undefined;
|
|
93
|
+
externalLink?: string | undefined;
|
|
94
|
+
appUri?: string | undefined;
|
|
95
|
+
attributes?: any;
|
|
96
|
+
backgroundColor?: string | undefined;
|
|
97
|
+
promptImageUrl?: string | undefined;
|
|
98
|
+
};
|
|
99
|
+
} | undefined;
|
|
100
|
+
maxSupply?: number | undefined;
|
|
101
|
+
conditions?: {
|
|
102
|
+
chainId: number;
|
|
103
|
+
tokenAddress: string;
|
|
104
|
+
conditionType: "user-owns-tokens";
|
|
105
|
+
isOnchain: boolean;
|
|
106
|
+
tokenAmount: string;
|
|
107
|
+
}[] | undefined;
|
|
108
|
+
isFreeMint?: boolean | undefined;
|
|
109
|
+
engineWallet?: string | undefined;
|
|
110
|
+
creatorMap?: {} | undefined;
|
|
111
|
+
_id: string | {};
|
|
112
|
+
address: string;
|
|
113
|
+
chainId: number;
|
|
114
|
+
title: string;
|
|
115
|
+
} | null;
|
|
116
|
+
error: Error | null;
|
|
117
|
+
isLoading: boolean;
|
|
118
|
+
runQuery: (queryParams: {
|
|
119
|
+
chainId: number;
|
|
120
|
+
address: string;
|
|
121
|
+
}) => Promise<any>;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Hook to check if an address is eligible for minting
|
|
125
|
+
*/
|
|
126
|
+
export declare const useIsMintEligible: ({ contractAddress, chainId, recipientAddress, quantity }: IsMintEligibleParams) => {
|
|
127
|
+
data: {
|
|
128
|
+
eligible: boolean;
|
|
129
|
+
reason?: string;
|
|
130
|
+
} | null;
|
|
131
|
+
error: Error | null;
|
|
132
|
+
isLoading: boolean;
|
|
133
|
+
runQuery: (queryParams: {
|
|
134
|
+
tokenId?: string | undefined;
|
|
135
|
+
quantity?: string | undefined;
|
|
136
|
+
chainId: number;
|
|
137
|
+
contractAddress: string;
|
|
138
|
+
recipientAddress: string;
|
|
139
|
+
}) => Promise<any>;
|
|
140
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useIsMintEligible = exports.useSigMintCollection = exports.useGenerateSigMintData = void 0;
|
|
4
|
+
const useQueryB3_1 = require("../../../global-account/react/hooks/useQueryB3");
|
|
5
|
+
/**
|
|
6
|
+
* Hook to generate signature for minting
|
|
7
|
+
*/
|
|
8
|
+
const useGenerateSigMintData = ({ recipientAddress, contractAddress, chainId, quantity, prompt, }) => {
|
|
9
|
+
return (0, useQueryB3_1.useQueryB3)("signature-minting-collections", "generateSignature", {
|
|
10
|
+
recipientAddress,
|
|
11
|
+
contractAddress,
|
|
12
|
+
chainId,
|
|
13
|
+
quantity,
|
|
14
|
+
prompt,
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
exports.useGenerateSigMintData = useGenerateSigMintData;
|
|
18
|
+
/**
|
|
19
|
+
* Hook to fetch a signature minting collection by address
|
|
20
|
+
*/
|
|
21
|
+
const useSigMintCollection = ({ address, chainId }) => {
|
|
22
|
+
return (0, useQueryB3_1.useQueryB3)("signature-minting-collections", "findByAddress", {
|
|
23
|
+
address,
|
|
24
|
+
chainId,
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
exports.useSigMintCollection = useSigMintCollection;
|
|
28
|
+
/**
|
|
29
|
+
* Hook to check if an address is eligible for minting
|
|
30
|
+
*/
|
|
31
|
+
const useIsMintEligible = ({ contractAddress, chainId, recipientAddress, quantity }) => {
|
|
32
|
+
return (0, useQueryB3_1.useQueryB3)("signature-minting-collections", "isMintEligible", {
|
|
33
|
+
contractAddress,
|
|
34
|
+
chainId,
|
|
35
|
+
recipientAddress,
|
|
36
|
+
quantity,
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
exports.useIsMintEligible = useIsMintEligible;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export interface SigMintPayloadMetadata {
|
|
2
|
+
name?: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
image?: string;
|
|
5
|
+
attributes?: Array<Record<string, unknown>>;
|
|
6
|
+
}
|
|
7
|
+
export interface SigMintPayload {
|
|
8
|
+
uri: string;
|
|
9
|
+
tokenId: string;
|
|
10
|
+
to: string;
|
|
11
|
+
royaltyRecipient: string;
|
|
12
|
+
quantity: string;
|
|
13
|
+
royaltyBps: string;
|
|
14
|
+
primarySaleRecipient: string;
|
|
15
|
+
uid: string;
|
|
16
|
+
metadata: SigMintPayloadMetadata;
|
|
17
|
+
currencyAddress: string;
|
|
18
|
+
price: string;
|
|
19
|
+
mintStartTime: number;
|
|
20
|
+
mintEndTime: number;
|
|
21
|
+
}
|
|
22
|
+
export interface SigMintCollection {
|
|
23
|
+
title: string;
|
|
24
|
+
chainId: number;
|
|
25
|
+
description?: string;
|
|
26
|
+
signatureRequestBody?: {
|
|
27
|
+
metadata?: SigMintPayloadMetadata;
|
|
28
|
+
price?: string;
|
|
29
|
+
currency?: string;
|
|
30
|
+
primarySaleRecipient?: string;
|
|
31
|
+
royaltyRecipient?: string;
|
|
32
|
+
royaltyBps?: number;
|
|
33
|
+
validityStartTimestamp?: number;
|
|
34
|
+
validityEndTimestamp?: number;
|
|
35
|
+
clonePrice?: string;
|
|
36
|
+
};
|
|
37
|
+
maxSupply?: number;
|
|
38
|
+
isFreeMint?: boolean;
|
|
39
|
+
conditions?: Array<unknown>;
|
|
40
|
+
address?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface GenerateSigMintParams {
|
|
43
|
+
recipientAddress: string;
|
|
44
|
+
contractAddress: string;
|
|
45
|
+
chainId: number;
|
|
46
|
+
quantity: string;
|
|
47
|
+
prompt: string;
|
|
48
|
+
}
|
|
49
|
+
export interface GenerateSigMintResponse {
|
|
50
|
+
signature: string;
|
|
51
|
+
payload: SigMintPayload;
|
|
52
|
+
collection: SigMintCollection;
|
|
53
|
+
}
|
|
54
|
+
export interface FindByAddressParams {
|
|
55
|
+
address: string;
|
|
56
|
+
chainId: number;
|
|
57
|
+
}
|
|
58
|
+
export interface IsMintEligibleParams {
|
|
59
|
+
contractAddress: string;
|
|
60
|
+
chainId: number;
|
|
61
|
+
recipientAddress: string;
|
|
62
|
+
quantity: string;
|
|
63
|
+
}
|
|
64
|
+
export interface IsMintEligibleResponse {
|
|
65
|
+
eligible: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface FindAllParams {
|
|
68
|
+
chainId: number;
|
|
69
|
+
}
|
|
@@ -28,10 +28,18 @@ function B3DynamicModal() {
|
|
|
28
28
|
"anySpendBuySpin",
|
|
29
29
|
"anySpendOrderHistory",
|
|
30
30
|
"signInWithB3",
|
|
31
|
+
"anySpendSignatureMint",
|
|
31
32
|
].find(type => contentType?.type === type)) {
|
|
32
33
|
contentClass += " max-h-[90dvh] overflow-y-auto no-scrollbar w-full";
|
|
33
34
|
}
|
|
34
|
-
if ([
|
|
35
|
+
if ([
|
|
36
|
+
"anySpendNft",
|
|
37
|
+
"anySpendJoinTournament",
|
|
38
|
+
"anySpendFundTournament",
|
|
39
|
+
"anySpendStakeB3",
|
|
40
|
+
"anySpendBuySpin",
|
|
41
|
+
"anySpendSignatureMint",
|
|
42
|
+
].find(type => contentType?.type === type)) {
|
|
35
43
|
// Due to the dynamic of (Pay with crypto),(Pay with fiat), we want the height fixed to 90dvh but still scrollable.
|
|
36
44
|
// NOTE: Just leave it here in case we want the fixed height
|
|
37
45
|
// contentClass += " min-h-[90dvh] b3-modal-freestyle";
|
|
@@ -70,6 +78,8 @@ function B3DynamicModal() {
|
|
|
70
78
|
return (0, jsx_runtime_1.jsx)(react_1.AnySpendStakeB3, { ...contentType, mode: "modal" });
|
|
71
79
|
case "anySpendBuySpin":
|
|
72
80
|
return (0, jsx_runtime_1.jsx)(react_1.AnySpendBuySpin, { ...contentType, mode: "modal" });
|
|
81
|
+
case "anySpendSignatureMint":
|
|
82
|
+
return (0, jsx_runtime_1.jsx)(react_1.AnyspendSignatureMint, { ...contentType, mode: "modal" });
|
|
73
83
|
// Add other modal types here
|
|
74
84
|
default:
|
|
75
85
|
return null;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Token, Tournament } from "../../../anyspend";
|
|
2
2
|
import { NftContract } from "../../../anyspend/types";
|
|
3
|
+
import { GenerateSigMintResponse } from "../../../anyspend/types/signature-mint";
|
|
3
4
|
import { AllowedStrategy } from "../../../global-account/react";
|
|
4
5
|
import { PermissionsConfig } from "../../../global-account/types/permissions";
|
|
5
6
|
import { Address, Chain } from "thirdweb";
|
|
@@ -236,10 +237,24 @@ export interface AnySpendBuySpinProps extends BaseModalProps {
|
|
|
236
237
|
/** Prefill quantity of spins to purchase */
|
|
237
238
|
prefillQuantity?: string;
|
|
238
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* Props for the AnySpend Signature Mint modal
|
|
242
|
+
* Handles signature-based NFT minting
|
|
243
|
+
*/
|
|
244
|
+
export interface AnySpendSignatureMintProps extends BaseModalProps {
|
|
245
|
+
/** Modal type identifier */
|
|
246
|
+
type: "anySpendSignatureMint";
|
|
247
|
+
/** Signature data required for minting */
|
|
248
|
+
signatureData: GenerateSigMintResponse;
|
|
249
|
+
/** Optional image URL for NFT preview */
|
|
250
|
+
imageUrl?: string;
|
|
251
|
+
/** Callback function called when minting is successful */
|
|
252
|
+
onSuccess?: () => void;
|
|
253
|
+
}
|
|
239
254
|
/**
|
|
240
255
|
* Union type of all possible modal content types
|
|
241
256
|
*/
|
|
242
|
-
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | TransakProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendBuySpinProps;
|
|
257
|
+
export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | TransakProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendBuySpinProps | AnySpendSignatureMintProps;
|
|
243
258
|
/**
|
|
244
259
|
* State interface for the modal store
|
|
245
260
|
*/
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export declare const ABI_SIGNATURE_MINTING: readonly [{
|
|
2
|
+
readonly inputs: readonly [{
|
|
3
|
+
readonly components: readonly [{
|
|
4
|
+
readonly name: "to";
|
|
5
|
+
readonly type: "address";
|
|
6
|
+
}, {
|
|
7
|
+
readonly name: "royaltyRecipient";
|
|
8
|
+
readonly type: "address";
|
|
9
|
+
}, {
|
|
10
|
+
readonly name: "royaltyBps";
|
|
11
|
+
readonly type: "uint256";
|
|
12
|
+
}, {
|
|
13
|
+
readonly name: "primarySaleRecipient";
|
|
14
|
+
readonly type: "address";
|
|
15
|
+
}, {
|
|
16
|
+
readonly name: "tokenId";
|
|
17
|
+
readonly type: "uint256";
|
|
18
|
+
}, {
|
|
19
|
+
readonly name: "uri";
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "quantity";
|
|
23
|
+
readonly type: "uint256";
|
|
24
|
+
}, {
|
|
25
|
+
readonly name: "pricePerToken";
|
|
26
|
+
readonly type: "uint256";
|
|
27
|
+
}, {
|
|
28
|
+
readonly name: "currency";
|
|
29
|
+
readonly type: "address";
|
|
30
|
+
}, {
|
|
31
|
+
readonly name: "validityStartTimestamp";
|
|
32
|
+
readonly type: "uint128";
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "validityEndTimestamp";
|
|
35
|
+
readonly type: "uint128";
|
|
36
|
+
}, {
|
|
37
|
+
readonly name: "uid";
|
|
38
|
+
readonly type: "bytes32";
|
|
39
|
+
}];
|
|
40
|
+
readonly name: "_req";
|
|
41
|
+
readonly type: "tuple";
|
|
42
|
+
}, {
|
|
43
|
+
readonly name: "_signature";
|
|
44
|
+
readonly type: "bytes";
|
|
45
|
+
}];
|
|
46
|
+
readonly name: "mintWithSignature";
|
|
47
|
+
readonly outputs: readonly [{
|
|
48
|
+
readonly name: "";
|
|
49
|
+
readonly type: "uint256";
|
|
50
|
+
}];
|
|
51
|
+
readonly stateMutability: "payable";
|
|
52
|
+
readonly type: "function";
|
|
53
|
+
}];
|
|
54
|
+
export declare const ABI_TRANSFER_SINGLE_EVENT: {
|
|
55
|
+
readonly anonymous: false;
|
|
56
|
+
readonly inputs: readonly [{
|
|
57
|
+
readonly indexed: true;
|
|
58
|
+
readonly name: "operator";
|
|
59
|
+
readonly type: "address";
|
|
60
|
+
}, {
|
|
61
|
+
readonly indexed: true;
|
|
62
|
+
readonly name: "from";
|
|
63
|
+
readonly type: "address";
|
|
64
|
+
}, {
|
|
65
|
+
readonly indexed: true;
|
|
66
|
+
readonly name: "to";
|
|
67
|
+
readonly type: "address";
|
|
68
|
+
}, {
|
|
69
|
+
readonly indexed: false;
|
|
70
|
+
readonly name: "id";
|
|
71
|
+
readonly type: "uint256";
|
|
72
|
+
}, {
|
|
73
|
+
readonly indexed: false;
|
|
74
|
+
readonly name: "value";
|
|
75
|
+
readonly type: "uint256";
|
|
76
|
+
}];
|
|
77
|
+
readonly name: "TransferSingle";
|
|
78
|
+
readonly type: "event";
|
|
79
|
+
};
|