thirdweb 5.76.0-nightly-e702490f2ff5e2b7d6b28c06731af880583cf8bc-20241210010916 → 5.76.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/extensions/erc721/__generated__/ISignatureMintERC721_v2/events/TokensMintedWithSignature.js +33 -0
- package/dist/cjs/extensions/erc721/__generated__/ISignatureMintERC721_v2/events/TokensMintedWithSignature.js.map +1 -0
- package/dist/cjs/extensions/erc721/__generated__/ISignatureMintERC721_v2/read/verify.js +172 -0
- package/dist/cjs/extensions/erc721/__generated__/ISignatureMintERC721_v2/read/verify.js.map +1 -0
- package/dist/cjs/extensions/erc721/__generated__/ISignatureMintERC721_v2/write/mintWithSignature.js +175 -0
- package/dist/cjs/extensions/erc721/__generated__/ISignatureMintERC721_v2/write/mintWithSignature.js.map +1 -0
- package/dist/cjs/extensions/erc721/write/sigMint.js +99 -4
- package/dist/cjs/extensions/erc721/write/sigMint.js.map +1 -1
- package/dist/cjs/react/core/hooks/wallets/useAddConnectedWallet.js +1 -1
- package/dist/cjs/react/core/hooks/wallets/useAddConnectedWallet.js.map +1 -1
- package/dist/cjs/react/core/hooks/wallets/useAutoConnect.js +1 -1
- package/dist/cjs/react/core/hooks/wallets/useAutoConnect.js.map +1 -1
- package/dist/cjs/react/core/utils/wallet.js +2 -1
- package/dist/cjs/react/core/utils/wallet.js.map +1 -1
- package/dist/cjs/react/native/hooks/wallets/useLinkProfile.js +14 -4
- package/dist/cjs/react/native/hooks/wallets/useLinkProfile.js.map +1 -1
- package/dist/cjs/react/native/hooks/wallets/useProfiles.js +15 -6
- package/dist/cjs/react/native/hooks/wallets/useProfiles.js.map +1 -1
- package/dist/cjs/react/web/hooks/wallets/useLinkProfile.js +14 -4
- package/dist/cjs/react/web/hooks/wallets/useLinkProfile.js.map +1 -1
- package/dist/cjs/react/web/hooks/wallets/useProfiles.js +15 -6
- package/dist/cjs/react/web/hooks/wallets/useProfiles.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/locale/br.js +120 -0
- package/dist/cjs/react/web/ui/ConnectWallet/locale/br.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/locale/getConnectLocale.js +3 -0
- package/dist/cjs/react/web/ui/ConnectWallet/locale/getConnectLocale.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/LinkProfileScreen.js +6 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/LinkProfileScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.js +2 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/Account/avatar.js +6 -1
- package/dist/cjs/react/web/ui/prebuilt/Account/avatar.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/Account/blobbie.js +1 -0
- package/dist/cjs/react/web/ui/prebuilt/Account/blobbie.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/Account/name.js +6 -1
- package/dist/cjs/react/web/ui/prebuilt/Account/name.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/Account/provider.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/Chain/icon.js +1 -0
- package/dist/cjs/react/web/ui/prebuilt/Chain/icon.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/NFT/media.js +1 -0
- package/dist/cjs/react/web/ui/prebuilt/NFT/media.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/NFT/name.js +1 -0
- package/dist/cjs/react/web/ui/prebuilt/NFT/name.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/NFT/provider.js +1 -0
- package/dist/cjs/react/web/ui/prebuilt/NFT/provider.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/Token/icon.js +1 -0
- package/dist/cjs/react/web/ui/prebuilt/Token/icon.js.map +1 -1
- package/dist/cjs/react/web/wallets/injected/locale/br.js +27 -0
- package/dist/cjs/react/web/wallets/injected/locale/br.js.map +1 -0
- package/dist/cjs/react/web/wallets/injected/locale/getInjectedWalletLocale.js +3 -0
- package/dist/cjs/react/web/wallets/injected/locale/getInjectedWalletLocale.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/locale/br.js +59 -0
- package/dist/cjs/react/web/wallets/shared/locale/br.js.map +1 -0
- package/dist/cjs/react/web/wallets/shared/locale/getConnectLocale.js +3 -0
- package/dist/cjs/react/web/wallets/shared/locale/getConnectLocale.js.map +1 -1
- package/dist/cjs/react/web/wallets/smartWallet/locale/br.js +13 -0
- package/dist/cjs/react/web/wallets/smartWallet/locale/br.js.map +1 -0
- package/dist/cjs/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js +3 -0
- package/dist/cjs/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/wallet/enclave-wallet.js +1 -1
- package/dist/cjs/wallets/in-app/core/wallet/enclave-wallet.js.map +1 -1
- package/dist/cjs/wallets/manager/index.js +3 -2
- package/dist/cjs/wallets/manager/index.js.map +1 -1
- package/dist/esm/extensions/erc721/__generated__/ISignatureMintERC721_v2/events/TokensMintedWithSignature.js +30 -0
- package/dist/esm/extensions/erc721/__generated__/ISignatureMintERC721_v2/events/TokensMintedWithSignature.js.map +1 -0
- package/dist/esm/extensions/erc721/__generated__/ISignatureMintERC721_v2/read/verify.js +164 -0
- package/dist/esm/extensions/erc721/__generated__/ISignatureMintERC721_v2/read/verify.js.map +1 -0
- package/dist/esm/extensions/erc721/__generated__/ISignatureMintERC721_v2/write/mintWithSignature.js +168 -0
- package/dist/esm/extensions/erc721/__generated__/ISignatureMintERC721_v2/write/mintWithSignature.js.map +1 -0
- package/dist/esm/extensions/erc721/write/sigMint.js +99 -4
- package/dist/esm/extensions/erc721/write/sigMint.js.map +1 -1
- package/dist/esm/react/core/hooks/wallets/useAddConnectedWallet.js +1 -1
- package/dist/esm/react/core/hooks/wallets/useAddConnectedWallet.js.map +1 -1
- package/dist/esm/react/core/hooks/wallets/useAutoConnect.js +1 -1
- package/dist/esm/react/core/hooks/wallets/useAutoConnect.js.map +1 -1
- package/dist/esm/react/core/utils/wallet.js +2 -1
- package/dist/esm/react/core/utils/wallet.js.map +1 -1
- package/dist/esm/react/native/hooks/wallets/useLinkProfile.js +15 -5
- package/dist/esm/react/native/hooks/wallets/useLinkProfile.js.map +1 -1
- package/dist/esm/react/native/hooks/wallets/useProfiles.js +15 -6
- package/dist/esm/react/native/hooks/wallets/useProfiles.js.map +1 -1
- package/dist/esm/react/web/hooks/wallets/useLinkProfile.js +15 -5
- package/dist/esm/react/web/hooks/wallets/useLinkProfile.js.map +1 -1
- package/dist/esm/react/web/hooks/wallets/useProfiles.js +15 -6
- package/dist/esm/react/web/hooks/wallets/useProfiles.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/locale/br.js +118 -0
- package/dist/esm/react/web/ui/ConnectWallet/locale/br.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/locale/getConnectLocale.js +3 -0
- package/dist/esm/react/web/ui/ConnectWallet/locale/getConnectLocale.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/LinkProfileScreen.js +6 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/LinkProfileScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.js +2 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/Account/avatar.js +6 -1
- package/dist/esm/react/web/ui/prebuilt/Account/avatar.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/Account/blobbie.js +1 -0
- package/dist/esm/react/web/ui/prebuilt/Account/blobbie.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/Account/name.js +6 -1
- package/dist/esm/react/web/ui/prebuilt/Account/name.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/Account/provider.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/Chain/icon.js +1 -0
- package/dist/esm/react/web/ui/prebuilt/Chain/icon.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/NFT/media.js +1 -0
- package/dist/esm/react/web/ui/prebuilt/NFT/media.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/NFT/name.js +1 -0
- package/dist/esm/react/web/ui/prebuilt/NFT/name.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/NFT/provider.js +1 -0
- package/dist/esm/react/web/ui/prebuilt/NFT/provider.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/Token/icon.js +1 -0
- package/dist/esm/react/web/ui/prebuilt/Token/icon.js.map +1 -1
- package/dist/esm/react/web/wallets/injected/locale/br.js +25 -0
- package/dist/esm/react/web/wallets/injected/locale/br.js.map +1 -0
- package/dist/esm/react/web/wallets/injected/locale/getInjectedWalletLocale.js +3 -0
- package/dist/esm/react/web/wallets/injected/locale/getInjectedWalletLocale.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/locale/br.js +57 -0
- package/dist/esm/react/web/wallets/shared/locale/br.js.map +1 -0
- package/dist/esm/react/web/wallets/shared/locale/getConnectLocale.js +3 -0
- package/dist/esm/react/web/wallets/shared/locale/getConnectLocale.js.map +1 -1
- package/dist/esm/react/web/wallets/smartWallet/locale/br.js +11 -0
- package/dist/esm/react/web/wallets/smartWallet/locale/br.js.map +1 -0
- package/dist/esm/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js +3 -0
- package/dist/esm/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/wallets/in-app/core/wallet/enclave-wallet.js +1 -1
- package/dist/esm/wallets/in-app/core/wallet/enclave-wallet.js.map +1 -1
- package/dist/esm/wallets/manager/index.js +3 -2
- package/dist/esm/wallets/manager/index.js.map +1 -1
- package/dist/types/extensions/erc721/__generated__/ISignatureMintERC721_v2/events/TokensMintedWithSignature.d.ts +98 -0
- package/dist/types/extensions/erc721/__generated__/ISignatureMintERC721_v2/events/TokensMintedWithSignature.d.ts.map +1 -0
- package/dist/types/extensions/erc721/__generated__/ISignatureMintERC721_v2/read/verify.d.ts +136 -0
- package/dist/types/extensions/erc721/__generated__/ISignatureMintERC721_v2/read/verify.d.ts.map +1 -0
- package/dist/types/extensions/erc721/__generated__/ISignatureMintERC721_v2/write/mintWithSignature.d.ts +132 -0
- package/dist/types/extensions/erc721/__generated__/ISignatureMintERC721_v2/write/mintWithSignature.d.ts.map +1 -0
- package/dist/types/extensions/erc721/write/sigMint.d.ts +119 -18
- package/dist/types/extensions/erc721/write/sigMint.d.ts.map +1 -1
- package/dist/types/react/core/hooks/wallets/useAddConnectedWallet.d.ts +1 -1
- package/dist/types/react/core/hooks/wallets/useAddConnectedWallet.d.ts.map +1 -1
- package/dist/types/react/core/utils/wallet.d.ts.map +1 -1
- package/dist/types/react/native/hooks/wallets/useLinkProfile.d.ts +1 -1
- package/dist/types/react/native/hooks/wallets/useLinkProfile.d.ts.map +1 -1
- package/dist/types/react/native/hooks/wallets/useProfiles.d.ts.map +1 -1
- package/dist/types/react/web/hooks/wallets/useLinkProfile.d.ts.map +1 -1
- package/dist/types/react/web/hooks/wallets/useProfiles.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/MenuButton.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectEmbed.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/WalletEntryButton.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/locale/br.d.ts +4 -0
- package/dist/types/react/web/ui/ConnectWallet/locale/br.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/locale/getConnectLocale.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/LinkProfileScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/Drawer.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/FadeIn.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/Modal.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/Overlay.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/basic.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/buttons.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/formElements.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/modalElements.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/text.d.ts.map +1 -1
- package/dist/types/react/web/ui/design-system/animations.d.ts +18 -3
- package/dist/types/react/web/ui/design-system/animations.d.ts.map +1 -1
- package/dist/types/react/web/ui/design-system/elements.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/Account/avatar.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/Account/blobbie.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/Account/name.d.ts +1 -1
- package/dist/types/react/web/ui/prebuilt/Account/name.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/Account/provider.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/Chain/icon.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/NFT/media.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/NFT/name.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/NFT/provider.d.ts.map +1 -1
- package/dist/types/react/web/ui/prebuilt/Token/icon.d.ts.map +1 -1
- package/dist/types/react/web/ui/types.d.ts +1 -1
- package/dist/types/react/web/ui/types.d.ts.map +1 -1
- package/dist/types/react/web/wallets/injected/locale/br.d.ts +7 -0
- package/dist/types/react/web/wallets/injected/locale/br.d.ts.map +1 -0
- package/dist/types/react/web/wallets/injected/locale/getInjectedWalletLocale.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/locale/br.d.ts +58 -0
- package/dist/types/react/web/wallets/shared/locale/br.d.ts.map +1 -0
- package/dist/types/react/web/wallets/shared/locale/getConnectLocale.d.ts.map +1 -1
- package/dist/types/react/web/wallets/smartWallet/locale/br.d.ts +4 -0
- package/dist/types/react/web/wallets/smartWallet/locale/br.d.ts.map +1 -0
- package/dist/types/react/web/wallets/smartWallet/locale/getSmartWalletLocale.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/dist/types/wallets/manager/index.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/extensions/erc721/__generated__/ISignatureMintERC721_v2/events/TokensMintedWithSignature.ts +55 -0
- package/src/extensions/erc721/__generated__/ISignatureMintERC721_v2/read/verify.ts +196 -0
- package/src/extensions/erc721/__generated__/ISignatureMintERC721_v2/write/mintWithSignature.ts +214 -0
- package/src/extensions/erc721/write/sigMint.ts +184 -8
- package/src/extensions/erc721/write/sigMint721.test.ts +42 -0
- package/src/react/core/hooks/wallets/useAddConnectedWallet.ts +1 -1
- package/src/react/core/hooks/wallets/useAutoConnect.ts +1 -1
- package/src/react/core/utils/wallet.test.ts +77 -0
- package/src/react/core/utils/wallet.ts +2 -1
- package/src/react/native/hooks/wallets/useLinkProfile.ts +17 -8
- package/src/react/native/hooks/wallets/useProfiles.ts +17 -8
- package/src/react/web/hooks/wallets/useLinkProfile.ts +16 -7
- package/src/react/web/hooks/wallets/useProfiles.ts +17 -8
- package/src/react/web/ui/ConnectWallet/locale/br.ts +124 -0
- package/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts +3 -0
- package/src/react/web/ui/ConnectWallet/screens/LinkProfileScreen.tsx +6 -2
- package/src/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.test.tsx +135 -0
- package/src/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.tsx +2 -0
- package/src/react/web/ui/prebuilt/Account/avatar.tsx +6 -1
- package/src/react/web/ui/prebuilt/Account/blobbie.tsx +2 -0
- package/src/react/web/ui/prebuilt/Account/name.tsx +7 -2
- package/src/react/web/ui/prebuilt/Account/provider.tsx +1 -0
- package/src/react/web/ui/prebuilt/Chain/icon.tsx +2 -0
- package/src/react/web/ui/prebuilt/NFT/media.tsx +2 -0
- package/src/react/web/ui/prebuilt/NFT/name.tsx +2 -0
- package/src/react/web/ui/prebuilt/NFT/provider.tsx +2 -0
- package/src/react/web/ui/prebuilt/Token/icon.tsx +2 -0
- package/src/react/web/ui/types.ts +2 -1
- package/src/react/web/wallets/injected/locale/br.ts +27 -0
- package/src/react/web/wallets/injected/locale/getInjectedWalletLocale.ts +3 -0
- package/src/react/web/wallets/shared/locale/br.ts +62 -0
- package/src/react/web/wallets/shared/locale/getConnectLocale.ts +3 -0
- package/src/react/web/wallets/smartWallet/locale/br.ts +13 -0
- package/src/react/web/wallets/smartWallet/locale/getSmartWalletLocale.ts +3 -0
- package/src/version.ts +1 -1
- package/src/wallets/in-app/core/wallet/enclave-wallet.ts +1 -1
- package/src/wallets/manager/index.ts +6 -2
@@ -0,0 +1,196 @@
|
|
1
|
+
import type { AbiParameterToPrimitiveType } from "abitype";
|
2
|
+
import { readContract } from "../../../../../transaction/read-contract.js";
|
3
|
+
import type { BaseTransactionOptions } from "../../../../../transaction/types.js";
|
4
|
+
import { encodeAbiParameters } from "../../../../../utils/abi/encodeAbiParameters.js";
|
5
|
+
import { decodeAbiParameters } from "viem";
|
6
|
+
import type { Hex } from "../../../../../utils/encoding/hex.js";
|
7
|
+
import { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Represents the parameters for the "verify" function.
|
11
|
+
*/
|
12
|
+
export type VerifyParams = {
|
13
|
+
req: AbiParameterToPrimitiveType<{
|
14
|
+
type: "tuple";
|
15
|
+
name: "req";
|
16
|
+
components: [
|
17
|
+
{ type: "address"; name: "to" },
|
18
|
+
{ type: "address"; name: "royaltyRecipient" },
|
19
|
+
{ type: "uint256"; name: "royaltyBps" },
|
20
|
+
{ type: "address"; name: "primarySaleRecipient" },
|
21
|
+
{ type: "string"; name: "uri" },
|
22
|
+
{ type: "uint256"; name: "quantity" },
|
23
|
+
{ type: "uint256"; name: "pricePerToken" },
|
24
|
+
{ type: "address"; name: "currency" },
|
25
|
+
{ type: "uint128"; name: "validityStartTimestamp" },
|
26
|
+
{ type: "uint128"; name: "validityEndTimestamp" },
|
27
|
+
{ type: "bytes32"; name: "uid" },
|
28
|
+
];
|
29
|
+
}>;
|
30
|
+
signature: AbiParameterToPrimitiveType<{ type: "bytes"; name: "signature" }>;
|
31
|
+
};
|
32
|
+
|
33
|
+
export const FN_SELECTOR = "0x252e82e8" as const;
|
34
|
+
const FN_INPUTS = [
|
35
|
+
{
|
36
|
+
type: "tuple",
|
37
|
+
name: "req",
|
38
|
+
components: [
|
39
|
+
{
|
40
|
+
type: "address",
|
41
|
+
name: "to",
|
42
|
+
},
|
43
|
+
{
|
44
|
+
type: "address",
|
45
|
+
name: "royaltyRecipient",
|
46
|
+
},
|
47
|
+
{
|
48
|
+
type: "uint256",
|
49
|
+
name: "royaltyBps",
|
50
|
+
},
|
51
|
+
{
|
52
|
+
type: "address",
|
53
|
+
name: "primarySaleRecipient",
|
54
|
+
},
|
55
|
+
{
|
56
|
+
type: "string",
|
57
|
+
name: "uri",
|
58
|
+
},
|
59
|
+
{
|
60
|
+
type: "uint256",
|
61
|
+
name: "quantity",
|
62
|
+
},
|
63
|
+
{
|
64
|
+
type: "uint256",
|
65
|
+
name: "pricePerToken",
|
66
|
+
},
|
67
|
+
{
|
68
|
+
type: "address",
|
69
|
+
name: "currency",
|
70
|
+
},
|
71
|
+
{
|
72
|
+
type: "uint128",
|
73
|
+
name: "validityStartTimestamp",
|
74
|
+
},
|
75
|
+
{
|
76
|
+
type: "uint128",
|
77
|
+
name: "validityEndTimestamp",
|
78
|
+
},
|
79
|
+
{
|
80
|
+
type: "bytes32",
|
81
|
+
name: "uid",
|
82
|
+
},
|
83
|
+
],
|
84
|
+
},
|
85
|
+
{
|
86
|
+
type: "bytes",
|
87
|
+
name: "signature",
|
88
|
+
},
|
89
|
+
] as const;
|
90
|
+
const FN_OUTPUTS = [
|
91
|
+
{
|
92
|
+
type: "bool",
|
93
|
+
name: "success",
|
94
|
+
},
|
95
|
+
{
|
96
|
+
type: "address",
|
97
|
+
name: "signer",
|
98
|
+
},
|
99
|
+
] as const;
|
100
|
+
|
101
|
+
/**
|
102
|
+
* Checks if the `verify` method is supported by the given contract.
|
103
|
+
* @param availableSelectors An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors.
|
104
|
+
* @returns A boolean indicating if the `verify` method is supported.
|
105
|
+
* @extension ERC721
|
106
|
+
* @example
|
107
|
+
* ```ts
|
108
|
+
* import { isVerifySupported } from "thirdweb/extensions/erc721";
|
109
|
+
* const supported = isVerifySupported(["0x..."]);
|
110
|
+
* ```
|
111
|
+
*/
|
112
|
+
export function isVerifySupported(availableSelectors: string[]) {
|
113
|
+
return detectMethod({
|
114
|
+
availableSelectors,
|
115
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
116
|
+
});
|
117
|
+
}
|
118
|
+
|
119
|
+
/**
|
120
|
+
* Encodes the parameters for the "verify" function.
|
121
|
+
* @param options - The options for the verify function.
|
122
|
+
* @returns The encoded ABI parameters.
|
123
|
+
* @extension ERC721
|
124
|
+
* @example
|
125
|
+
* ```ts
|
126
|
+
* import { encodeVerifyParams } from "thirdweb/extensions/erc721";
|
127
|
+
* const result = encodeVerifyParams({
|
128
|
+
* req: ...,
|
129
|
+
* signature: ...,
|
130
|
+
* });
|
131
|
+
* ```
|
132
|
+
*/
|
133
|
+
export function encodeVerifyParams(options: VerifyParams) {
|
134
|
+
return encodeAbiParameters(FN_INPUTS, [options.req, options.signature]);
|
135
|
+
}
|
136
|
+
|
137
|
+
/**
|
138
|
+
* Encodes the "verify" function into a Hex string with its parameters.
|
139
|
+
* @param options - The options for the verify function.
|
140
|
+
* @returns The encoded hexadecimal string.
|
141
|
+
* @extension ERC721
|
142
|
+
* @example
|
143
|
+
* ```ts
|
144
|
+
* import { encodeVerify } from "thirdweb/extensions/erc721";
|
145
|
+
* const result = encodeVerify({
|
146
|
+
* req: ...,
|
147
|
+
* signature: ...,
|
148
|
+
* });
|
149
|
+
* ```
|
150
|
+
*/
|
151
|
+
export function encodeVerify(options: VerifyParams) {
|
152
|
+
// we do a "manual" concat here to avoid the overhead of the "concatHex" function
|
153
|
+
// we can do this because we know the specific formats of the values
|
154
|
+
return (FN_SELECTOR +
|
155
|
+
encodeVerifyParams(options).slice(2)) as `${typeof FN_SELECTOR}${string}`;
|
156
|
+
}
|
157
|
+
|
158
|
+
/**
|
159
|
+
* Decodes the result of the verify function call.
|
160
|
+
* @param result - The hexadecimal result to decode.
|
161
|
+
* @returns The decoded result as per the FN_OUTPUTS definition.
|
162
|
+
* @extension ERC721
|
163
|
+
* @example
|
164
|
+
* ```ts
|
165
|
+
* import { decodeVerifyResult } from "thirdweb/extensions/erc721";
|
166
|
+
* const result = decodeVerifyResultResult("...");
|
167
|
+
* ```
|
168
|
+
*/
|
169
|
+
export function decodeVerifyResult(result: Hex) {
|
170
|
+
return decodeAbiParameters(FN_OUTPUTS, result);
|
171
|
+
}
|
172
|
+
|
173
|
+
/**
|
174
|
+
* Calls the "verify" function on the contract.
|
175
|
+
* @param options - The options for the verify function.
|
176
|
+
* @returns The parsed result of the function call.
|
177
|
+
* @extension ERC721
|
178
|
+
* @example
|
179
|
+
* ```ts
|
180
|
+
* import { verify } from "thirdweb/extensions/erc721";
|
181
|
+
*
|
182
|
+
* const result = await verify({
|
183
|
+
* contract,
|
184
|
+
* req: ...,
|
185
|
+
* signature: ...,
|
186
|
+
* });
|
187
|
+
*
|
188
|
+
* ```
|
189
|
+
*/
|
190
|
+
export async function verify(options: BaseTransactionOptions<VerifyParams>) {
|
191
|
+
return readContract({
|
192
|
+
contract: options.contract,
|
193
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
194
|
+
params: [options.req, options.signature],
|
195
|
+
});
|
196
|
+
}
|
package/src/extensions/erc721/__generated__/ISignatureMintERC721_v2/write/mintWithSignature.ts
ADDED
@@ -0,0 +1,214 @@
|
|
1
|
+
import type { AbiParameterToPrimitiveType } from "abitype";
|
2
|
+
import type {
|
3
|
+
BaseTransactionOptions,
|
4
|
+
WithOverrides,
|
5
|
+
} from "../../../../../transaction/types.js";
|
6
|
+
import { prepareContractCall } from "../../../../../transaction/prepare-contract-call.js";
|
7
|
+
import { encodeAbiParameters } from "../../../../../utils/abi/encodeAbiParameters.js";
|
8
|
+
import { once } from "../../../../../utils/promise/once.js";
|
9
|
+
import { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
|
10
|
+
|
11
|
+
/**
|
12
|
+
* Represents the parameters for the "mintWithSignature" function.
|
13
|
+
*/
|
14
|
+
export type MintWithSignatureParams = WithOverrides<{
|
15
|
+
payload: AbiParameterToPrimitiveType<{
|
16
|
+
type: "tuple";
|
17
|
+
name: "payload";
|
18
|
+
components: [
|
19
|
+
{ type: "address"; name: "to" },
|
20
|
+
{ type: "address"; name: "royaltyRecipient" },
|
21
|
+
{ type: "uint256"; name: "royaltyBps" },
|
22
|
+
{ type: "address"; name: "primarySaleRecipient" },
|
23
|
+
{ type: "string"; name: "uri" },
|
24
|
+
{ type: "uint256"; name: "quantity" },
|
25
|
+
{ type: "uint256"; name: "pricePerToken" },
|
26
|
+
{ type: "address"; name: "currency" },
|
27
|
+
{ type: "uint128"; name: "validityStartTimestamp" },
|
28
|
+
{ type: "uint128"; name: "validityEndTimestamp" },
|
29
|
+
{ type: "bytes32"; name: "uid" },
|
30
|
+
];
|
31
|
+
}>;
|
32
|
+
signature: AbiParameterToPrimitiveType<{ type: "bytes"; name: "signature" }>;
|
33
|
+
}>;
|
34
|
+
|
35
|
+
export const FN_SELECTOR = "0x439c7be5" as const;
|
36
|
+
const FN_INPUTS = [
|
37
|
+
{
|
38
|
+
type: "tuple",
|
39
|
+
name: "payload",
|
40
|
+
components: [
|
41
|
+
{
|
42
|
+
type: "address",
|
43
|
+
name: "to",
|
44
|
+
},
|
45
|
+
{
|
46
|
+
type: "address",
|
47
|
+
name: "royaltyRecipient",
|
48
|
+
},
|
49
|
+
{
|
50
|
+
type: "uint256",
|
51
|
+
name: "royaltyBps",
|
52
|
+
},
|
53
|
+
{
|
54
|
+
type: "address",
|
55
|
+
name: "primarySaleRecipient",
|
56
|
+
},
|
57
|
+
{
|
58
|
+
type: "string",
|
59
|
+
name: "uri",
|
60
|
+
},
|
61
|
+
{
|
62
|
+
type: "uint256",
|
63
|
+
name: "quantity",
|
64
|
+
},
|
65
|
+
{
|
66
|
+
type: "uint256",
|
67
|
+
name: "pricePerToken",
|
68
|
+
},
|
69
|
+
{
|
70
|
+
type: "address",
|
71
|
+
name: "currency",
|
72
|
+
},
|
73
|
+
{
|
74
|
+
type: "uint128",
|
75
|
+
name: "validityStartTimestamp",
|
76
|
+
},
|
77
|
+
{
|
78
|
+
type: "uint128",
|
79
|
+
name: "validityEndTimestamp",
|
80
|
+
},
|
81
|
+
{
|
82
|
+
type: "bytes32",
|
83
|
+
name: "uid",
|
84
|
+
},
|
85
|
+
],
|
86
|
+
},
|
87
|
+
{
|
88
|
+
type: "bytes",
|
89
|
+
name: "signature",
|
90
|
+
},
|
91
|
+
] as const;
|
92
|
+
const FN_OUTPUTS = [
|
93
|
+
{
|
94
|
+
type: "address",
|
95
|
+
name: "signer",
|
96
|
+
},
|
97
|
+
] as const;
|
98
|
+
|
99
|
+
/**
|
100
|
+
* Checks if the `mintWithSignature` method is supported by the given contract.
|
101
|
+
* @param availableSelectors An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors.
|
102
|
+
* @returns A boolean indicating if the `mintWithSignature` method is supported.
|
103
|
+
* @extension ERC721
|
104
|
+
* @example
|
105
|
+
* ```ts
|
106
|
+
* import { isMintWithSignatureSupported } from "thirdweb/extensions/erc721";
|
107
|
+
*
|
108
|
+
* const supported = isMintWithSignatureSupported(["0x..."]);
|
109
|
+
* ```
|
110
|
+
*/
|
111
|
+
export function isMintWithSignatureSupported(availableSelectors: string[]) {
|
112
|
+
return detectMethod({
|
113
|
+
availableSelectors,
|
114
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
115
|
+
});
|
116
|
+
}
|
117
|
+
|
118
|
+
/**
|
119
|
+
* Encodes the parameters for the "mintWithSignature" function.
|
120
|
+
* @param options - The options for the mintWithSignature function.
|
121
|
+
* @returns The encoded ABI parameters.
|
122
|
+
* @extension ERC721
|
123
|
+
* @example
|
124
|
+
* ```ts
|
125
|
+
* import { encodeMintWithSignatureParams } from "thirdweb/extensions/erc721";
|
126
|
+
* const result = encodeMintWithSignatureParams({
|
127
|
+
* payload: ...,
|
128
|
+
* signature: ...,
|
129
|
+
* });
|
130
|
+
* ```
|
131
|
+
*/
|
132
|
+
export function encodeMintWithSignatureParams(
|
133
|
+
options: MintWithSignatureParams,
|
134
|
+
) {
|
135
|
+
return encodeAbiParameters(FN_INPUTS, [options.payload, options.signature]);
|
136
|
+
}
|
137
|
+
|
138
|
+
/**
|
139
|
+
* Encodes the "mintWithSignature" function into a Hex string with its parameters.
|
140
|
+
* @param options - The options for the mintWithSignature function.
|
141
|
+
* @returns The encoded hexadecimal string.
|
142
|
+
* @extension ERC721
|
143
|
+
* @example
|
144
|
+
* ```ts
|
145
|
+
* import { encodeMintWithSignature } from "thirdweb/extensions/erc721";
|
146
|
+
* const result = encodeMintWithSignature({
|
147
|
+
* payload: ...,
|
148
|
+
* signature: ...,
|
149
|
+
* });
|
150
|
+
* ```
|
151
|
+
*/
|
152
|
+
export function encodeMintWithSignature(options: MintWithSignatureParams) {
|
153
|
+
// we do a "manual" concat here to avoid the overhead of the "concatHex" function
|
154
|
+
// we can do this because we know the specific formats of the values
|
155
|
+
return (FN_SELECTOR +
|
156
|
+
encodeMintWithSignatureParams(options).slice(
|
157
|
+
2,
|
158
|
+
)) as `${typeof FN_SELECTOR}${string}`;
|
159
|
+
}
|
160
|
+
|
161
|
+
/**
|
162
|
+
* Prepares a transaction to call the "mintWithSignature" function on the contract.
|
163
|
+
* @param options - The options for the "mintWithSignature" function.
|
164
|
+
* @returns A prepared transaction object.
|
165
|
+
* @extension ERC721
|
166
|
+
* @example
|
167
|
+
* ```ts
|
168
|
+
* import { sendTransaction } from "thirdweb";
|
169
|
+
* import { mintWithSignature } from "thirdweb/extensions/erc721";
|
170
|
+
*
|
171
|
+
* const transaction = mintWithSignature({
|
172
|
+
* contract,
|
173
|
+
* payload: ...,
|
174
|
+
* signature: ...,
|
175
|
+
* overrides: {
|
176
|
+
* ...
|
177
|
+
* }
|
178
|
+
* });
|
179
|
+
*
|
180
|
+
* // Send the transaction
|
181
|
+
* await sendTransaction({ transaction, account });
|
182
|
+
* ```
|
183
|
+
*/
|
184
|
+
export function mintWithSignature(
|
185
|
+
options: BaseTransactionOptions<
|
186
|
+
| MintWithSignatureParams
|
187
|
+
| {
|
188
|
+
asyncParams: () => Promise<MintWithSignatureParams>;
|
189
|
+
}
|
190
|
+
>,
|
191
|
+
) {
|
192
|
+
const asyncOptions = once(async () => {
|
193
|
+
return "asyncParams" in options ? await options.asyncParams() : options;
|
194
|
+
});
|
195
|
+
|
196
|
+
return prepareContractCall({
|
197
|
+
contract: options.contract,
|
198
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
199
|
+
params: async () => {
|
200
|
+
const resolvedOptions = await asyncOptions();
|
201
|
+
return [resolvedOptions.payload, resolvedOptions.signature] as const;
|
202
|
+
},
|
203
|
+
value: async () => (await asyncOptions()).overrides?.value,
|
204
|
+
accessList: async () => (await asyncOptions()).overrides?.accessList,
|
205
|
+
gas: async () => (await asyncOptions()).overrides?.gas,
|
206
|
+
gasPrice: async () => (await asyncOptions()).overrides?.gasPrice,
|
207
|
+
maxFeePerGas: async () => (await asyncOptions()).overrides?.maxFeePerGas,
|
208
|
+
maxPriorityFeePerGas: async () =>
|
209
|
+
(await asyncOptions()).overrides?.maxPriorityFeePerGas,
|
210
|
+
nonce: async () => (await asyncOptions()).overrides?.nonce,
|
211
|
+
extraGas: async () => (await asyncOptions()).overrides?.extraGas,
|
212
|
+
erc20Value: async () => (await asyncOptions()).overrides?.erc20Value,
|
213
|
+
});
|
214
|
+
}
|
@@ -15,6 +15,10 @@ import {
|
|
15
15
|
type MintWithSignatureParams,
|
16
16
|
mintWithSignature as generatedMintWithSignature,
|
17
17
|
} from "../__generated__/ISignatureMintERC721/write/mintWithSignature.js";
|
18
|
+
import {
|
19
|
+
type MintWithSignatureParams as MintWithSignatureParamsV2,
|
20
|
+
mintWithSignature as generatedMintWithSignatureV2,
|
21
|
+
} from "../__generated__/ISignatureMintERC721_v2/write/mintWithSignature.js";
|
18
22
|
|
19
23
|
/**
|
20
24
|
* Mints a new ERC721 token with the given minter signature
|
@@ -38,6 +42,23 @@ import {
|
|
38
42
|
* @returns A promise that resolves to the transaction result.
|
39
43
|
*/
|
40
44
|
export function mintWithSignature(
|
45
|
+
options: BaseTransactionOptions<
|
46
|
+
| { payload: PayloadTypeV2; signature: Hex }
|
47
|
+
| { payload: PayloadType; signature: Hex }
|
48
|
+
>,
|
49
|
+
) {
|
50
|
+
const { payload } = options;
|
51
|
+
if ("quantity" in payload) {
|
52
|
+
return mintWithSignatureV2(
|
53
|
+
options as BaseTransactionOptions<MintWithSignatureParamsV2>,
|
54
|
+
);
|
55
|
+
}
|
56
|
+
return mintWithSignatureV1(
|
57
|
+
options as BaseTransactionOptions<MintWithSignatureParams>,
|
58
|
+
);
|
59
|
+
}
|
60
|
+
|
61
|
+
function mintWithSignatureV1(
|
41
62
|
options: BaseTransactionOptions<MintWithSignatureParams>,
|
42
63
|
) {
|
43
64
|
const value = isNativeTokenAddress(options.payload.currency)
|
@@ -51,10 +72,27 @@ export function mintWithSignature(
|
|
51
72
|
});
|
52
73
|
}
|
53
74
|
|
54
|
-
|
75
|
+
function mintWithSignatureV2(
|
76
|
+
options: BaseTransactionOptions<MintWithSignatureParamsV2>,
|
77
|
+
) {
|
78
|
+
const value = isNativeTokenAddress(options.payload.currency)
|
79
|
+
? options.payload.pricePerToken * options.payload.quantity
|
80
|
+
: 0n;
|
81
|
+
return generatedMintWithSignatureV2({
|
82
|
+
...options,
|
83
|
+
overrides: {
|
84
|
+
value,
|
85
|
+
},
|
86
|
+
});
|
87
|
+
}
|
88
|
+
|
89
|
+
export type GenerateMintSignatureOptions<
|
90
|
+
T extends "LoyaltyCard" | "TokenERC721" = "TokenERC721",
|
91
|
+
> = {
|
55
92
|
account: Account;
|
56
93
|
contract: ThirdwebContract;
|
57
94
|
mintRequest: GeneratePayloadInput;
|
95
|
+
contractType?: T;
|
58
96
|
};
|
59
97
|
|
60
98
|
/**
|
@@ -87,10 +125,10 @@ export type GenerateMintSignatureOptions = {
|
|
87
125
|
* @extension ERC721
|
88
126
|
* @returns A promise that resolves to the payload and signature.
|
89
127
|
*/
|
90
|
-
export async function generateMintSignature
|
91
|
-
|
92
|
-
) {
|
93
|
-
const { mintRequest, account, contract } = options;
|
128
|
+
export async function generateMintSignature<
|
129
|
+
T extends "LoyaltyCard" | "TokenERC721" = "TokenERC721",
|
130
|
+
>(options: GenerateMintSignatureOptions<T>): Promise<SignPayloadResult<T>> {
|
131
|
+
const { mintRequest, account, contract, contractType } = options;
|
94
132
|
|
95
133
|
const currency = mintRequest.currency || NATIVE_TOKEN_ADDRESS;
|
96
134
|
const [price, uri, uid] = await Promise.all([
|
@@ -175,15 +213,70 @@ export async function generateMintSignature(
|
|
175
213
|
royaltyRecipient = mintRequest.royaltyRecipient;
|
176
214
|
}
|
177
215
|
|
216
|
+
if (contractType === "LoyaltyCard") {
|
217
|
+
return signPayloadV2({
|
218
|
+
mintRequest,
|
219
|
+
account,
|
220
|
+
contract,
|
221
|
+
uri,
|
222
|
+
currency,
|
223
|
+
uid,
|
224
|
+
price,
|
225
|
+
royaltyRecipient,
|
226
|
+
primarySaleRecipient: saleRecipient,
|
227
|
+
startTime,
|
228
|
+
endTime,
|
229
|
+
}) as Promise<SignPayloadResult<T>>;
|
230
|
+
}
|
231
|
+
return signPayloadV1({
|
232
|
+
mintRequest,
|
233
|
+
account,
|
234
|
+
contract,
|
235
|
+
uri,
|
236
|
+
currency,
|
237
|
+
uid,
|
238
|
+
price,
|
239
|
+
royaltyRecipient,
|
240
|
+
primarySaleRecipient: saleRecipient,
|
241
|
+
startTime,
|
242
|
+
endTime,
|
243
|
+
}) as Promise<SignPayloadResult<T>>;
|
244
|
+
}
|
245
|
+
|
246
|
+
async function signPayloadV1({
|
247
|
+
mintRequest,
|
248
|
+
account,
|
249
|
+
contract,
|
250
|
+
uri,
|
251
|
+
currency,
|
252
|
+
uid,
|
253
|
+
price,
|
254
|
+
royaltyRecipient,
|
255
|
+
primarySaleRecipient,
|
256
|
+
startTime,
|
257
|
+
endTime,
|
258
|
+
}: {
|
259
|
+
mintRequest: GeneratePayloadInput;
|
260
|
+
account: Account;
|
261
|
+
contract: ThirdwebContract;
|
262
|
+
uri: string;
|
263
|
+
currency: Address;
|
264
|
+
uid: Hex;
|
265
|
+
price: bigint;
|
266
|
+
royaltyRecipient: Address;
|
267
|
+
primarySaleRecipient: Address;
|
268
|
+
startTime: Date;
|
269
|
+
endTime: Date;
|
270
|
+
}): Promise<{ payload: PayloadType; signature: Hex }> {
|
178
271
|
const payload: PayloadType = {
|
179
272
|
uri,
|
180
273
|
currency,
|
181
274
|
uid,
|
182
275
|
price,
|
183
276
|
to: mintRequest.to,
|
184
|
-
royaltyRecipient
|
277
|
+
royaltyRecipient,
|
185
278
|
royaltyBps: toBigInt(mintRequest.royaltyBps || 0),
|
186
|
-
primarySaleRecipient
|
279
|
+
primarySaleRecipient,
|
187
280
|
validityStartTimestamp: dateToSeconds(startTime),
|
188
281
|
validityEndTimestamp: dateToSeconds(endTime),
|
189
282
|
};
|
@@ -195,19 +288,86 @@ export async function generateMintSignature(
|
|
195
288
|
chainId: contract.chain.id,
|
196
289
|
verifyingContract: contract.address,
|
197
290
|
},
|
198
|
-
types: {
|
291
|
+
types: {
|
292
|
+
MintRequest: MintRequest721,
|
293
|
+
},
|
294
|
+
primaryType: "MintRequest",
|
295
|
+
message: payload,
|
296
|
+
});
|
297
|
+
return { payload, signature };
|
298
|
+
}
|
299
|
+
|
300
|
+
async function signPayloadV2({
|
301
|
+
mintRequest,
|
302
|
+
account,
|
303
|
+
contract,
|
304
|
+
uri,
|
305
|
+
currency,
|
306
|
+
uid,
|
307
|
+
price,
|
308
|
+
royaltyRecipient,
|
309
|
+
primarySaleRecipient,
|
310
|
+
startTime,
|
311
|
+
endTime,
|
312
|
+
}: {
|
313
|
+
mintRequest: GeneratePayloadInput;
|
314
|
+
account: Account;
|
315
|
+
contract: ThirdwebContract;
|
316
|
+
uri: string;
|
317
|
+
currency: Address;
|
318
|
+
uid: Hex;
|
319
|
+
price: bigint;
|
320
|
+
royaltyRecipient: Address;
|
321
|
+
primarySaleRecipient: Address;
|
322
|
+
startTime: Date;
|
323
|
+
endTime: Date;
|
324
|
+
}): Promise<{ payload: PayloadTypeV2; signature: Hex }> {
|
325
|
+
const payload: PayloadTypeV2 = {
|
326
|
+
uri,
|
327
|
+
currency,
|
328
|
+
uid,
|
329
|
+
quantity: toBigInt(1), // always 1 for 721 NFTs
|
330
|
+
pricePerToken: price,
|
331
|
+
to: mintRequest.to,
|
332
|
+
royaltyRecipient,
|
333
|
+
royaltyBps: toBigInt(mintRequest.royaltyBps || 0),
|
334
|
+
primarySaleRecipient,
|
335
|
+
validityStartTimestamp: dateToSeconds(startTime),
|
336
|
+
validityEndTimestamp: dateToSeconds(endTime),
|
337
|
+
};
|
338
|
+
|
339
|
+
const signature = await account.signTypedData({
|
340
|
+
domain: {
|
341
|
+
name: "SignatureMintERC721",
|
342
|
+
version: "1",
|
343
|
+
chainId: contract.chain.id,
|
344
|
+
verifyingContract: contract.address,
|
345
|
+
},
|
346
|
+
types: {
|
347
|
+
MintRequest: MintRequest721_V2,
|
348
|
+
},
|
199
349
|
primaryType: "MintRequest",
|
200
350
|
message: payload,
|
201
351
|
});
|
202
352
|
return { payload, signature };
|
203
353
|
}
|
204
354
|
|
355
|
+
type SignPayloadResult<T> = T extends "LoyaltyCard"
|
356
|
+
? Awaited<ReturnType<typeof signPayloadV2>>
|
357
|
+
: Awaited<ReturnType<typeof signPayloadV1>>;
|
358
|
+
|
205
359
|
type PayloadType = AbiParameterToPrimitiveType<{
|
206
360
|
type: "tuple";
|
207
361
|
name: "payload";
|
208
362
|
components: typeof MintRequest721;
|
209
363
|
}>;
|
210
364
|
|
365
|
+
type PayloadTypeV2 = AbiParameterToPrimitiveType<{
|
366
|
+
type: "tuple";
|
367
|
+
name: "payload";
|
368
|
+
components: typeof MintRequest721_V2;
|
369
|
+
}>;
|
370
|
+
|
211
371
|
type GeneratePayloadInput = {
|
212
372
|
to: string;
|
213
373
|
metadata: NFTInput | string;
|
@@ -234,3 +394,19 @@ const MintRequest721 = [
|
|
234
394
|
{ name: "validityEndTimestamp", type: "uint128" },
|
235
395
|
{ name: "uid", type: "bytes32" },
|
236
396
|
] as const;
|
397
|
+
|
398
|
+
// used for LoyaltyCard contract and base sigmint contracts
|
399
|
+
// adds quantity to the payload so its the same as 1155
|
400
|
+
const MintRequest721_V2 = [
|
401
|
+
{ name: "to", type: "address" },
|
402
|
+
{ name: "royaltyRecipient", type: "address" },
|
403
|
+
{ name: "royaltyBps", type: "uint256" },
|
404
|
+
{ name: "primarySaleRecipient", type: "address" },
|
405
|
+
{ name: "uri", type: "string" },
|
406
|
+
{ name: "quantity", type: "uint256" },
|
407
|
+
{ name: "pricePerToken", type: "uint256" },
|
408
|
+
{ name: "currency", type: "address" },
|
409
|
+
{ name: "validityStartTimestamp", type: "uint128" },
|
410
|
+
{ name: "validityEndTimestamp", type: "uint128" },
|
411
|
+
{ name: "uid", type: "bytes32" },
|
412
|
+
] as const;
|