thirdweb 5.61.5 → 5.61.6
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/contract/deployment/deploy-with-abi.js +13 -0
- package/dist/cjs/contract/deployment/deploy-with-abi.js.map +1 -1
- package/dist/cjs/exports/extensions/unstoppable-domains.js +6 -1
- package/dist/cjs/exports/extensions/unstoppable-domains.js.map +1 -1
- package/dist/cjs/extensions/modules/__generated__/BatchMetadataERC1155/events/BatchMetadataUpdate.js +1 -1
- package/dist/cjs/extensions/modules/__generated__/BatchMetadataERC1155/events/BatchMetadataUpdate.js.map +1 -1
- package/dist/cjs/extensions/modules/__generated__/BatchMetadataERC1155/read/getBatchIndex.js +114 -0
- package/dist/cjs/extensions/modules/__generated__/BatchMetadataERC1155/read/getBatchIndex.js.map +1 -0
- package/dist/cjs/extensions/modules/__generated__/BatchMetadataERC1155/read/getMetadataBatch.js +128 -0
- package/dist/cjs/extensions/modules/__generated__/BatchMetadataERC1155/read/getMetadataBatch.js.map +1 -0
- package/dist/cjs/extensions/modules/__generated__/BatchMetadataERC1155/read/getModuleConfig.js +109 -0
- package/dist/cjs/extensions/modules/__generated__/BatchMetadataERC1155/read/getModuleConfig.js.map +1 -0
- package/dist/cjs/extensions/modules/__generated__/BatchMetadataERC1155/write/setBaseURI.js +124 -0
- package/dist/cjs/extensions/modules/__generated__/BatchMetadataERC1155/write/setBaseURI.js.map +1 -0
- package/dist/cjs/extensions/modules/__generated__/BatchMetadataERC721/events/BatchMetadataUpdate.js +1 -1
- package/dist/cjs/extensions/modules/__generated__/BatchMetadataERC721/events/BatchMetadataUpdate.js.map +1 -1
- package/dist/cjs/extensions/modules/__generated__/BatchMetadataERC721/read/getBatchIndex.js +114 -0
- package/dist/cjs/extensions/modules/__generated__/BatchMetadataERC721/read/getBatchIndex.js.map +1 -0
- package/dist/cjs/extensions/modules/__generated__/BatchMetadataERC721/read/getMetadataBatch.js +128 -0
- package/dist/cjs/extensions/modules/__generated__/BatchMetadataERC721/read/getMetadataBatch.js.map +1 -0
- package/dist/cjs/extensions/modules/__generated__/BatchMetadataERC721/read/getModuleConfig.js +109 -0
- package/dist/cjs/extensions/modules/__generated__/BatchMetadataERC721/read/getModuleConfig.js.map +1 -0
- package/dist/cjs/extensions/modules/__generated__/BatchMetadataERC721/write/setBaseURI.js +124 -0
- package/dist/cjs/extensions/modules/__generated__/BatchMetadataERC721/write/setBaseURI.js.map +1 -0
- package/dist/cjs/extensions/modules/__generated__/SequentialTokenIdERC1155/encode/encodeBytesOnInstall.js +29 -0
- package/dist/cjs/extensions/modules/__generated__/SequentialTokenIdERC1155/encode/encodeBytesOnInstall.js.map +1 -0
- package/dist/cjs/extensions/modules/__generated__/SequentialTokenIdERC1155/module/install.js +11 -6
- package/dist/cjs/extensions/modules/__generated__/SequentialTokenIdERC1155/module/install.js.map +1 -1
- package/dist/cjs/extensions/modules/__generated__/SequentialTokenIdERC1155/read/getModuleConfig.js +109 -0
- package/dist/cjs/extensions/modules/__generated__/SequentialTokenIdERC1155/read/getModuleConfig.js.map +1 -0
- package/dist/cjs/extensions/modules/__generated__/SequentialTokenIdERC1155/write/updateTokenIdERC1155.js +121 -0
- package/dist/cjs/extensions/modules/__generated__/SequentialTokenIdERC1155/write/updateTokenIdERC1155.js.map +1 -0
- package/dist/cjs/extensions/prebuilts/deploy-published.js +0 -17
- package/dist/cjs/extensions/prebuilts/deploy-published.js.map +1 -1
- package/dist/cjs/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/exists.js +114 -0
- package/dist/cjs/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/exists.js.map +1 -0
- package/dist/cjs/extensions/unstoppable-domains/read/resolveAddress.js +6 -0
- package/dist/cjs/extensions/unstoppable-domains/read/resolveAddress.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/useConnectModal.js.map +1 -1
- package/dist/cjs/transaction/read-contract.js +11 -19
- package/dist/cjs/transaction/read-contract.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/in-app/web/lib/actions/get-enclave-user-status.js +0 -2
- package/dist/cjs/wallets/in-app/web/lib/actions/get-enclave-user-status.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/actions/sign-message.enclave.js +3 -0
- package/dist/cjs/wallets/in-app/web/lib/actions/sign-message.enclave.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/actions/sign-transaction.enclave.js +3 -1
- package/dist/cjs/wallets/in-app/web/lib/actions/sign-transaction.enclave.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/actions/sign-typed-data.enclave.js +3 -0
- package/dist/cjs/wallets/in-app/web/lib/actions/sign-typed-data.enclave.js.map +1 -1
- package/dist/cjs/wallets/wallet-connect/receiver/index.js +1 -1
- package/dist/cjs/wallets/wallet-connect/receiver/session-request.js +13 -14
- package/dist/cjs/wallets/wallet-connect/receiver/session-request.js.map +1 -1
- package/dist/esm/contract/deployment/deploy-with-abi.js +13 -0
- package/dist/esm/contract/deployment/deploy-with-abi.js.map +1 -1
- package/dist/esm/exports/extensions/unstoppable-domains.js +4 -0
- package/dist/esm/exports/extensions/unstoppable-domains.js.map +1 -1
- package/dist/esm/extensions/modules/__generated__/BatchMetadataERC1155/events/BatchMetadataUpdate.js +1 -1
- package/dist/esm/extensions/modules/__generated__/BatchMetadataERC1155/events/BatchMetadataUpdate.js.map +1 -1
- package/dist/esm/extensions/modules/__generated__/BatchMetadataERC1155/read/getBatchIndex.js +106 -0
- package/dist/esm/extensions/modules/__generated__/BatchMetadataERC1155/read/getBatchIndex.js.map +1 -0
- package/dist/esm/extensions/modules/__generated__/BatchMetadataERC1155/read/getMetadataBatch.js +120 -0
- package/dist/esm/extensions/modules/__generated__/BatchMetadataERC1155/read/getMetadataBatch.js.map +1 -0
- package/dist/esm/extensions/modules/__generated__/BatchMetadataERC1155/read/getModuleConfig.js +103 -0
- package/dist/esm/extensions/modules/__generated__/BatchMetadataERC1155/read/getModuleConfig.js.map +1 -0
- package/dist/esm/extensions/modules/__generated__/BatchMetadataERC1155/write/setBaseURI.js +117 -0
- package/dist/esm/extensions/modules/__generated__/BatchMetadataERC1155/write/setBaseURI.js.map +1 -0
- package/dist/esm/extensions/modules/__generated__/BatchMetadataERC721/events/BatchMetadataUpdate.js +1 -1
- package/dist/esm/extensions/modules/__generated__/BatchMetadataERC721/events/BatchMetadataUpdate.js.map +1 -1
- package/dist/esm/extensions/modules/__generated__/BatchMetadataERC721/read/getBatchIndex.js +106 -0
- package/dist/esm/extensions/modules/__generated__/BatchMetadataERC721/read/getBatchIndex.js.map +1 -0
- package/dist/esm/extensions/modules/__generated__/BatchMetadataERC721/read/getMetadataBatch.js +120 -0
- package/dist/esm/extensions/modules/__generated__/BatchMetadataERC721/read/getMetadataBatch.js.map +1 -0
- package/dist/esm/extensions/modules/__generated__/BatchMetadataERC721/read/getModuleConfig.js +103 -0
- package/dist/esm/extensions/modules/__generated__/BatchMetadataERC721/read/getModuleConfig.js.map +1 -0
- package/dist/esm/extensions/modules/__generated__/BatchMetadataERC721/write/setBaseURI.js +117 -0
- package/dist/esm/extensions/modules/__generated__/BatchMetadataERC721/write/setBaseURI.js.map +1 -0
- package/dist/esm/extensions/modules/__generated__/SequentialTokenIdERC1155/encode/encodeBytesOnInstall.js +25 -0
- package/dist/esm/extensions/modules/__generated__/SequentialTokenIdERC1155/encode/encodeBytesOnInstall.js.map +1 -0
- package/dist/esm/extensions/modules/__generated__/SequentialTokenIdERC1155/module/install.js +11 -6
- package/dist/esm/extensions/modules/__generated__/SequentialTokenIdERC1155/module/install.js.map +1 -1
- package/dist/esm/extensions/modules/__generated__/SequentialTokenIdERC1155/read/getModuleConfig.js +103 -0
- package/dist/esm/extensions/modules/__generated__/SequentialTokenIdERC1155/read/getModuleConfig.js.map +1 -0
- package/dist/esm/extensions/modules/__generated__/SequentialTokenIdERC1155/write/updateTokenIdERC1155.js +114 -0
- package/dist/esm/extensions/modules/__generated__/SequentialTokenIdERC1155/write/updateTokenIdERC1155.js.map +1 -0
- package/dist/esm/extensions/prebuilts/deploy-published.js +0 -18
- package/dist/esm/extensions/prebuilts/deploy-published.js.map +1 -1
- package/dist/esm/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/exists.js +106 -0
- package/dist/esm/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/exists.js.map +1 -0
- package/dist/esm/extensions/unstoppable-domains/read/resolveAddress.js +6 -0
- package/dist/esm/extensions/unstoppable-domains/read/resolveAddress.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/useConnectModal.js.map +1 -1
- package/dist/esm/transaction/read-contract.js +11 -19
- package/dist/esm/transaction/read-contract.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/in-app/web/lib/actions/get-enclave-user-status.js +0 -2
- package/dist/esm/wallets/in-app/web/lib/actions/get-enclave-user-status.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/actions/sign-message.enclave.js +3 -0
- package/dist/esm/wallets/in-app/web/lib/actions/sign-message.enclave.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/actions/sign-transaction.enclave.js +3 -1
- package/dist/esm/wallets/in-app/web/lib/actions/sign-transaction.enclave.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/actions/sign-typed-data.enclave.js +3 -0
- package/dist/esm/wallets/in-app/web/lib/actions/sign-typed-data.enclave.js.map +1 -1
- package/dist/esm/wallets/wallet-connect/receiver/index.js +1 -1
- package/dist/esm/wallets/wallet-connect/receiver/session-request.js +6 -7
- package/dist/esm/wallets/wallet-connect/receiver/session-request.js.map +1 -1
- package/dist/types/contract/deployment/deploy-with-abi.d.ts.map +1 -1
- package/dist/types/exports/extensions/unstoppable-domains.d.ts +2 -0
- package/dist/types/exports/extensions/unstoppable-domains.d.ts.map +1 -1
- package/dist/types/extensions/modules/__generated__/BatchMetadataERC1155/events/BatchMetadataUpdate.d.ts +5 -2
- package/dist/types/extensions/modules/__generated__/BatchMetadataERC1155/events/BatchMetadataUpdate.d.ts.map +1 -1
- package/dist/types/extensions/modules/__generated__/BatchMetadataERC1155/read/getBatchIndex.d.ts +83 -0
- package/dist/types/extensions/modules/__generated__/BatchMetadataERC1155/read/getBatchIndex.d.ts.map +1 -0
- package/dist/types/extensions/modules/__generated__/BatchMetadataERC1155/read/getMetadataBatch.d.ts +91 -0
- package/dist/types/extensions/modules/__generated__/BatchMetadataERC1155/read/getMetadataBatch.d.ts.map +1 -0
- package/dist/types/extensions/modules/__generated__/BatchMetadataERC1155/read/getModuleConfig.d.ts +66 -0
- package/dist/types/extensions/modules/__generated__/BatchMetadataERC1155/read/getModuleConfig.d.ts.map +1 -0
- package/dist/types/extensions/modules/__generated__/BatchMetadataERC1155/write/setBaseURI.d.ts +86 -0
- package/dist/types/extensions/modules/__generated__/BatchMetadataERC1155/write/setBaseURI.d.ts.map +1 -0
- package/dist/types/extensions/modules/__generated__/BatchMetadataERC721/events/BatchMetadataUpdate.d.ts +5 -2
- package/dist/types/extensions/modules/__generated__/BatchMetadataERC721/events/BatchMetadataUpdate.d.ts.map +1 -1
- package/dist/types/extensions/modules/__generated__/BatchMetadataERC721/read/getBatchIndex.d.ts +83 -0
- package/dist/types/extensions/modules/__generated__/BatchMetadataERC721/read/getBatchIndex.d.ts.map +1 -0
- package/dist/types/extensions/modules/__generated__/BatchMetadataERC721/read/getMetadataBatch.d.ts +91 -0
- package/dist/types/extensions/modules/__generated__/BatchMetadataERC721/read/getMetadataBatch.d.ts.map +1 -0
- package/dist/types/extensions/modules/__generated__/BatchMetadataERC721/read/getModuleConfig.d.ts +66 -0
- package/dist/types/extensions/modules/__generated__/BatchMetadataERC721/read/getModuleConfig.d.ts.map +1 -0
- package/dist/types/extensions/modules/__generated__/BatchMetadataERC721/write/setBaseURI.d.ts +86 -0
- package/dist/types/extensions/modules/__generated__/BatchMetadataERC721/write/setBaseURI.d.ts.map +1 -0
- package/dist/types/extensions/modules/__generated__/SequentialTokenIdERC1155/encode/encodeBytesOnInstall.d.ts +26 -0
- package/dist/types/extensions/modules/__generated__/SequentialTokenIdERC1155/encode/encodeBytesOnInstall.d.ts.map +1 -0
- package/dist/types/extensions/modules/__generated__/SequentialTokenIdERC1155/module/install.d.ts +11 -6
- package/dist/types/extensions/modules/__generated__/SequentialTokenIdERC1155/module/install.d.ts.map +1 -1
- package/dist/types/extensions/modules/__generated__/SequentialTokenIdERC1155/read/getModuleConfig.d.ts +66 -0
- package/dist/types/extensions/modules/__generated__/SequentialTokenIdERC1155/read/getModuleConfig.d.ts.map +1 -0
- package/dist/types/extensions/modules/__generated__/SequentialTokenIdERC1155/write/updateTokenIdERC1155.d.ts +79 -0
- package/dist/types/extensions/modules/__generated__/SequentialTokenIdERC1155/write/updateTokenIdERC1155.d.ts.map +1 -0
- package/dist/types/extensions/prebuilts/deploy-published.d.ts.map +1 -1
- package/dist/types/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/exists.d.ts +83 -0
- package/dist/types/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/exists.d.ts.map +1 -0
- package/dist/types/extensions/unstoppable-domains/read/resolveAddress.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/useConnectModal.d.ts +8 -0
- package/dist/types/react/web/ui/ConnectWallet/useConnectModal.d.ts.map +1 -1
- package/dist/types/transaction/read-contract.d.ts +11 -19
- package/dist/types/transaction/read-contract.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/in-app/core/authentication/types.d.ts +6 -0
- package/dist/types/wallets/in-app/core/authentication/types.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/actions/get-enclave-user-status.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/actions/sign-message.enclave.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/actions/sign-transaction.enclave.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/actions/sign-typed-data.enclave.d.ts.map +1 -1
- package/dist/types/wallets/wallet-connect/receiver/index.d.ts +1 -1
- package/dist/types/wallets/wallet-connect/receiver/session-request.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/contract/deployment/deploy-with-abi.ts +14 -0
- package/src/exports/extensions/unstoppable-domains.ts +9 -0
- package/src/extensions/ens/resolve-avatar.test.ts +1 -4
- package/src/extensions/modules/MintableERC1155/mintableERC1155.test.ts +3 -1
- package/src/extensions/modules/__generated__/BatchMetadataERC1155/events/BatchMetadataUpdate.ts +1 -1
- package/src/extensions/modules/__generated__/BatchMetadataERC1155/read/getBatchIndex.ts +125 -0
- package/src/extensions/modules/__generated__/BatchMetadataERC1155/read/getMetadataBatch.ts +142 -0
- package/src/extensions/modules/__generated__/BatchMetadataERC1155/read/getModuleConfig.ts +109 -0
- package/src/extensions/modules/__generated__/BatchMetadataERC1155/write/setBaseURI.ts +148 -0
- package/src/extensions/modules/__generated__/BatchMetadataERC721/events/BatchMetadataUpdate.ts +1 -1
- package/src/extensions/modules/__generated__/BatchMetadataERC721/read/getBatchIndex.ts +125 -0
- package/src/extensions/modules/__generated__/BatchMetadataERC721/read/getMetadataBatch.ts +142 -0
- package/src/extensions/modules/__generated__/BatchMetadataERC721/read/getModuleConfig.ts +109 -0
- package/src/extensions/modules/__generated__/BatchMetadataERC721/write/setBaseURI.ts +148 -0
- package/src/extensions/modules/__generated__/SequentialTokenIdERC1155/encode/encodeBytesOnInstall.ts +40 -0
- package/src/extensions/modules/__generated__/SequentialTokenIdERC1155/module/install.ts +18 -9
- package/src/extensions/modules/__generated__/SequentialTokenIdERC1155/read/getModuleConfig.ts +109 -0
- package/src/extensions/modules/__generated__/SequentialTokenIdERC1155/write/updateTokenIdERC1155.ts +145 -0
- package/src/extensions/prebuilts/deploy-published.ts +0 -19
- package/src/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/exists.ts +121 -0
- package/src/extensions/unstoppable-domains/read/resolveAddress.test.ts +11 -0
- package/src/extensions/unstoppable-domains/read/resolveAddress.ts +9 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.ts +1 -1
- package/src/react/web/ui/ConnectWallet/useConnectModal.tsx +11 -0
- package/src/transaction/read-contract.ts +11 -19
- package/src/version.ts +1 -1
- package/src/wallets/in-app/core/authentication/types.ts +13 -2
- package/src/wallets/in-app/web/lib/actions/get-enclave-user-status.ts +0 -2
- package/src/wallets/in-app/web/lib/actions/sign-message.enclave.ts +4 -0
- package/src/wallets/in-app/web/lib/actions/sign-transaction.enclave.ts +4 -1
- package/src/wallets/in-app/web/lib/actions/sign-typed-data.enclave.ts +4 -0
- package/src/wallets/wallet-connect/receiver/index.ts +1 -1
- package/src/wallets/wallet-connect/receiver/session-request.ts +6 -23
- package/dist/cjs/extensions/modules/__generated__/SequentialTokenIdERC1155/read/encodeBytesOnInstall.js +0 -70
- package/dist/cjs/extensions/modules/__generated__/SequentialTokenIdERC1155/read/encodeBytesOnInstall.js.map +0 -1
- package/dist/esm/extensions/modules/__generated__/SequentialTokenIdERC1155/read/encodeBytesOnInstall.js +0 -64
- package/dist/esm/extensions/modules/__generated__/SequentialTokenIdERC1155/read/encodeBytesOnInstall.js.map +0 -1
- package/dist/types/extensions/modules/__generated__/SequentialTokenIdERC1155/read/encodeBytesOnInstall.d.ts +0 -44
- package/dist/types/extensions/modules/__generated__/SequentialTokenIdERC1155/read/encodeBytesOnInstall.d.ts.map +0 -1
- package/src/extensions/modules/__generated__/SequentialTokenIdERC1155/read/encodeBytesOnInstall.ts +0 -70
@@ -0,0 +1,148 @@
|
|
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 "setBaseURI" function.
|
13
|
+
*/
|
14
|
+
export type SetBaseURIParams = WithOverrides<{
|
15
|
+
batchIndex: AbiParameterToPrimitiveType<{
|
16
|
+
type: "uint256";
|
17
|
+
name: "_batchIndex";
|
18
|
+
}>;
|
19
|
+
baseURI: AbiParameterToPrimitiveType<{ type: "string"; name: "_baseURI" }>;
|
20
|
+
}>;
|
21
|
+
|
22
|
+
export const FN_SELECTOR = "0x33cfcb9f" as const;
|
23
|
+
const FN_INPUTS = [
|
24
|
+
{
|
25
|
+
type: "uint256",
|
26
|
+
name: "_batchIndex",
|
27
|
+
},
|
28
|
+
{
|
29
|
+
type: "string",
|
30
|
+
name: "_baseURI",
|
31
|
+
},
|
32
|
+
] as const;
|
33
|
+
const FN_OUTPUTS = [] as const;
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Checks if the `setBaseURI` method is supported by the given contract.
|
37
|
+
* @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.
|
38
|
+
* @returns A boolean indicating if the `setBaseURI` method is supported.
|
39
|
+
* @modules BatchMetadataERC721
|
40
|
+
* @example
|
41
|
+
* ```ts
|
42
|
+
* import { BatchMetadataERC721 } from "thirdweb/modules";
|
43
|
+
*
|
44
|
+
* const supported = BatchMetadataERC721.isSetBaseURISupported(["0x..."]);
|
45
|
+
* ```
|
46
|
+
*/
|
47
|
+
export function isSetBaseURISupported(availableSelectors: string[]) {
|
48
|
+
return detectMethod({
|
49
|
+
availableSelectors,
|
50
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
51
|
+
});
|
52
|
+
}
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Encodes the parameters for the "setBaseURI" function.
|
56
|
+
* @param options - The options for the setBaseURI function.
|
57
|
+
* @returns The encoded ABI parameters.
|
58
|
+
* @modules BatchMetadataERC721
|
59
|
+
* @example
|
60
|
+
* ```ts
|
61
|
+
* import { BatchMetadataERC721 } from "thirdweb/modules";
|
62
|
+
* const result = BatchMetadataERC721.encodeSetBaseURIParams({
|
63
|
+
* batchIndex: ...,
|
64
|
+
* baseURI: ...,
|
65
|
+
* });
|
66
|
+
* ```
|
67
|
+
*/
|
68
|
+
export function encodeSetBaseURIParams(options: SetBaseURIParams) {
|
69
|
+
return encodeAbiParameters(FN_INPUTS, [options.batchIndex, options.baseURI]);
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Encodes the "setBaseURI" function into a Hex string with its parameters.
|
74
|
+
* @param options - The options for the setBaseURI function.
|
75
|
+
* @returns The encoded hexadecimal string.
|
76
|
+
* @modules BatchMetadataERC721
|
77
|
+
* @example
|
78
|
+
* ```ts
|
79
|
+
* import { BatchMetadataERC721 } from "thirdweb/modules";
|
80
|
+
* const result = BatchMetadataERC721.encodeSetBaseURI({
|
81
|
+
* batchIndex: ...,
|
82
|
+
* baseURI: ...,
|
83
|
+
* });
|
84
|
+
* ```
|
85
|
+
*/
|
86
|
+
export function encodeSetBaseURI(options: SetBaseURIParams) {
|
87
|
+
// we do a "manual" concat here to avoid the overhead of the "concatHex" function
|
88
|
+
// we can do this because we know the specific formats of the values
|
89
|
+
return (FN_SELECTOR +
|
90
|
+
encodeSetBaseURIParams(options).slice(
|
91
|
+
2,
|
92
|
+
)) as `${typeof FN_SELECTOR}${string}`;
|
93
|
+
}
|
94
|
+
|
95
|
+
/**
|
96
|
+
* Prepares a transaction to call the "setBaseURI" function on the contract.
|
97
|
+
* @param options - The options for the "setBaseURI" function.
|
98
|
+
* @returns A prepared transaction object.
|
99
|
+
* @modules BatchMetadataERC721
|
100
|
+
* @example
|
101
|
+
* ```ts
|
102
|
+
* import { sendTransaction } from "thirdweb";
|
103
|
+
* import { BatchMetadataERC721 } from "thirdweb/modules";
|
104
|
+
*
|
105
|
+
* const transaction = BatchMetadataERC721.setBaseURI({
|
106
|
+
* contract,
|
107
|
+
* batchIndex: ...,
|
108
|
+
* baseURI: ...,
|
109
|
+
* overrides: {
|
110
|
+
* ...
|
111
|
+
* }
|
112
|
+
* });
|
113
|
+
*
|
114
|
+
* // Send the transaction
|
115
|
+
* await sendTransaction({ transaction, account });
|
116
|
+
* ```
|
117
|
+
*/
|
118
|
+
export function setBaseURI(
|
119
|
+
options: BaseTransactionOptions<
|
120
|
+
| SetBaseURIParams
|
121
|
+
| {
|
122
|
+
asyncParams: () => Promise<SetBaseURIParams>;
|
123
|
+
}
|
124
|
+
>,
|
125
|
+
) {
|
126
|
+
const asyncOptions = once(async () => {
|
127
|
+
return "asyncParams" in options ? await options.asyncParams() : options;
|
128
|
+
});
|
129
|
+
|
130
|
+
return prepareContractCall({
|
131
|
+
contract: options.contract,
|
132
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
133
|
+
params: async () => {
|
134
|
+
const resolvedOptions = await asyncOptions();
|
135
|
+
return [resolvedOptions.batchIndex, resolvedOptions.baseURI] as const;
|
136
|
+
},
|
137
|
+
value: async () => (await asyncOptions()).overrides?.value,
|
138
|
+
accessList: async () => (await asyncOptions()).overrides?.accessList,
|
139
|
+
gas: async () => (await asyncOptions()).overrides?.gas,
|
140
|
+
gasPrice: async () => (await asyncOptions()).overrides?.gasPrice,
|
141
|
+
maxFeePerGas: async () => (await asyncOptions()).overrides?.maxFeePerGas,
|
142
|
+
maxPriorityFeePerGas: async () =>
|
143
|
+
(await asyncOptions()).overrides?.maxPriorityFeePerGas,
|
144
|
+
nonce: async () => (await asyncOptions()).overrides?.nonce,
|
145
|
+
extraGas: async () => (await asyncOptions()).overrides?.extraGas,
|
146
|
+
erc20Value: async () => (await asyncOptions()).overrides?.erc20Value,
|
147
|
+
});
|
148
|
+
}
|
package/src/extensions/modules/__generated__/SequentialTokenIdERC1155/encode/encodeBytesOnInstall.ts
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
import type { AbiParameterToPrimitiveType } from "abitype";
|
2
|
+
|
3
|
+
import { encodeAbiParameters } from "../../../../../utils/abi/encodeAbiParameters.js";
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Represents the parameters for the "encodeBytesOnInstall" function.
|
7
|
+
*/
|
8
|
+
export type EncodeBytesOnInstallParams = {
|
9
|
+
startTokenId: AbiParameterToPrimitiveType<{
|
10
|
+
type: "uint256";
|
11
|
+
name: "startTokenId";
|
12
|
+
}>;
|
13
|
+
};
|
14
|
+
|
15
|
+
export const FN_SELECTOR = "0x579a6021" as const;
|
16
|
+
const FN_INPUTS = [
|
17
|
+
{
|
18
|
+
type: "uint256",
|
19
|
+
name: "startTokenId",
|
20
|
+
},
|
21
|
+
] as const;
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Encodes the parameters for the "encodeBytesOnInstall" function.
|
25
|
+
* @param options - The options for the encodeBytesOnInstall function.
|
26
|
+
* @returns The encoded ABI parameters.
|
27
|
+
* @extension MODULES
|
28
|
+
* @example
|
29
|
+
* ```ts
|
30
|
+
* import { encodeEncodeBytesOnInstallParams } "thirdweb/extensions/modules";
|
31
|
+
* const result = encodeEncodeBytesOnInstallParams({
|
32
|
+
* startTokenId: ...,
|
33
|
+
* });
|
34
|
+
* ```
|
35
|
+
*/
|
36
|
+
export function encodeBytesOnInstallParams(
|
37
|
+
options: EncodeBytesOnInstallParams,
|
38
|
+
) {
|
39
|
+
return encodeAbiParameters(FN_INPUTS, [options.startTokenId]);
|
40
|
+
}
|
@@ -4,7 +4,10 @@ import type { ThirdwebContract } from "../../../../../contract/contract.js";
|
|
4
4
|
import type { PreparedTransaction } from "../../../../../transaction/prepare-transaction.js";
|
5
5
|
import type { Address } from "../../../../../utils/address.js";
|
6
6
|
import type { Account } from "../../../../../wallets/interfaces/wallet.js";
|
7
|
-
|
7
|
+
import {
|
8
|
+
type EncodeBytesOnInstallParams,
|
9
|
+
encodeBytesOnInstallParams,
|
10
|
+
} from "../encode/encodeBytesOnInstall.js";
|
8
11
|
import { getOrDeployModule } from "../../../common/getOrDeployModule.js";
|
9
12
|
import { installPublishedModule } from "../../../common/installPublishedModule.js";
|
10
13
|
|
@@ -27,13 +30,17 @@ const contractId = "SequentialTokenIdERC1155";
|
|
27
30
|
* name: "My Modular Contract",
|
28
31
|
* },
|
29
32
|
* modules: [
|
30
|
-
* SequentialTokenIdERC1155.module(
|
33
|
+
* SequentialTokenIdERC1155.module({
|
34
|
+
* startTokenId: ...,
|
35
|
+
* }),
|
31
36
|
* ],
|
32
37
|
* });
|
33
38
|
* ```
|
34
39
|
* @modules SequentialTokenIdERC1155
|
35
40
|
*/
|
36
|
-
export function module(
|
41
|
+
export function module(
|
42
|
+
params: EncodeBytesOnInstallParams & { publisher?: string },
|
43
|
+
) {
|
37
44
|
return async (args: {
|
38
45
|
client: ThirdwebClient;
|
39
46
|
chain: Chain;
|
@@ -49,7 +56,7 @@ export function module(params?: { publisher?: string }) {
|
|
49
56
|
});
|
50
57
|
return {
|
51
58
|
module: moduleContract.address as Address,
|
52
|
-
data:
|
59
|
+
data: encodeInstall(params),
|
53
60
|
};
|
54
61
|
};
|
55
62
|
}
|
@@ -65,7 +72,9 @@ export function module(params?: { publisher?: string }) {
|
|
65
72
|
* const transaction = SequentialTokenIdERC1155.install({
|
66
73
|
* contract: coreContract,
|
67
74
|
* account: account,
|
68
|
-
|
75
|
+
* params: {
|
76
|
+
* startTokenId: ...,
|
77
|
+
* },
|
69
78
|
* });
|
70
79
|
*
|
71
80
|
* await sendTransaction({
|
@@ -78,13 +87,13 @@ export function module(params?: { publisher?: string }) {
|
|
78
87
|
export function install(options: {
|
79
88
|
contract: ThirdwebContract;
|
80
89
|
account: Account;
|
81
|
-
params
|
90
|
+
params: EncodeBytesOnInstallParams & { publisher?: string };
|
82
91
|
}): PreparedTransaction {
|
83
92
|
return installPublishedModule({
|
84
93
|
account: options.account,
|
85
94
|
contract: options.contract,
|
86
95
|
moduleName: contractId,
|
87
|
-
moduleData:
|
96
|
+
moduleData: encodeInstall(options.params),
|
88
97
|
publisher: options.params?.publisher,
|
89
98
|
});
|
90
99
|
}
|
@@ -95,6 +104,6 @@ export function install(options: {
|
|
95
104
|
* @returns - The encoded data.
|
96
105
|
* @modules SequentialTokenIdERC1155
|
97
106
|
*/
|
98
|
-
export function encodeInstall() {
|
99
|
-
return
|
107
|
+
export function encodeInstall(params: EncodeBytesOnInstallParams) {
|
108
|
+
return encodeBytesOnInstallParams(params);
|
100
109
|
}
|
@@ -0,0 +1,109 @@
|
|
1
|
+
import { readContract } from "../../../../../transaction/read-contract.js";
|
2
|
+
import type { BaseTransactionOptions } from "../../../../../transaction/types.js";
|
3
|
+
|
4
|
+
import { decodeAbiParameters } from "viem";
|
5
|
+
import type { Hex } from "../../../../../utils/encoding/hex.js";
|
6
|
+
import { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
|
7
|
+
|
8
|
+
export const FN_SELECTOR = "0x89e04e0e" as const;
|
9
|
+
const FN_INPUTS = [] as const;
|
10
|
+
const FN_OUTPUTS = [
|
11
|
+
{
|
12
|
+
type: "tuple",
|
13
|
+
name: "config",
|
14
|
+
components: [
|
15
|
+
{
|
16
|
+
type: "bool",
|
17
|
+
name: "registerInstallationCallback",
|
18
|
+
},
|
19
|
+
{
|
20
|
+
type: "bytes4[]",
|
21
|
+
name: "requiredInterfaces",
|
22
|
+
},
|
23
|
+
{
|
24
|
+
type: "bytes4[]",
|
25
|
+
name: "supportedInterfaces",
|
26
|
+
},
|
27
|
+
{
|
28
|
+
type: "tuple[]",
|
29
|
+
name: "callbackFunctions",
|
30
|
+
components: [
|
31
|
+
{
|
32
|
+
type: "bytes4",
|
33
|
+
name: "selector",
|
34
|
+
},
|
35
|
+
],
|
36
|
+
},
|
37
|
+
{
|
38
|
+
type: "tuple[]",
|
39
|
+
name: "fallbackFunctions",
|
40
|
+
components: [
|
41
|
+
{
|
42
|
+
type: "bytes4",
|
43
|
+
name: "selector",
|
44
|
+
},
|
45
|
+
{
|
46
|
+
type: "uint256",
|
47
|
+
name: "permissionBits",
|
48
|
+
},
|
49
|
+
],
|
50
|
+
},
|
51
|
+
],
|
52
|
+
},
|
53
|
+
] as const;
|
54
|
+
|
55
|
+
/**
|
56
|
+
* Checks if the `getModuleConfig` method is supported by the given contract.
|
57
|
+
* @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.
|
58
|
+
* @returns A boolean indicating if the `getModuleConfig` method is supported.
|
59
|
+
* @modules SequentialTokenIdERC1155
|
60
|
+
* @example
|
61
|
+
* ```ts
|
62
|
+
* import { SequentialTokenIdERC1155 } from "thirdweb/modules";
|
63
|
+
* const supported = SequentialTokenIdERC1155.isGetModuleConfigSupported(["0x..."]);
|
64
|
+
* ```
|
65
|
+
*/
|
66
|
+
export function isGetModuleConfigSupported(availableSelectors: string[]) {
|
67
|
+
return detectMethod({
|
68
|
+
availableSelectors,
|
69
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
70
|
+
});
|
71
|
+
}
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Decodes the result of the getModuleConfig function call.
|
75
|
+
* @param result - The hexadecimal result to decode.
|
76
|
+
* @returns The decoded result as per the FN_OUTPUTS definition.
|
77
|
+
* @modules SequentialTokenIdERC1155
|
78
|
+
* @example
|
79
|
+
* ```ts
|
80
|
+
* import { SequentialTokenIdERC1155 } from "thirdweb/modules";
|
81
|
+
* const result = SequentialTokenIdERC1155.decodeGetModuleConfigResultResult("...");
|
82
|
+
* ```
|
83
|
+
*/
|
84
|
+
export function decodeGetModuleConfigResult(result: Hex) {
|
85
|
+
return decodeAbiParameters(FN_OUTPUTS, result)[0];
|
86
|
+
}
|
87
|
+
|
88
|
+
/**
|
89
|
+
* Calls the "getModuleConfig" function on the contract.
|
90
|
+
* @param options - The options for the getModuleConfig function.
|
91
|
+
* @returns The parsed result of the function call.
|
92
|
+
* @modules SequentialTokenIdERC1155
|
93
|
+
* @example
|
94
|
+
* ```ts
|
95
|
+
* import { SequentialTokenIdERC1155 } from "thirdweb/modules";
|
96
|
+
*
|
97
|
+
* const result = await SequentialTokenIdERC1155.getModuleConfig({
|
98
|
+
* contract,
|
99
|
+
* });
|
100
|
+
*
|
101
|
+
* ```
|
102
|
+
*/
|
103
|
+
export async function getModuleConfig(options: BaseTransactionOptions) {
|
104
|
+
return readContract({
|
105
|
+
contract: options.contract,
|
106
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
107
|
+
params: [],
|
108
|
+
});
|
109
|
+
}
|
package/src/extensions/modules/__generated__/SequentialTokenIdERC1155/write/updateTokenIdERC1155.ts
ADDED
@@ -0,0 +1,145 @@
|
|
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 "updateTokenIdERC1155" function.
|
13
|
+
*/
|
14
|
+
export type UpdateTokenIdERC1155Params = WithOverrides<{
|
15
|
+
tokenId: AbiParameterToPrimitiveType<{ type: "uint256"; name: "_tokenId" }>;
|
16
|
+
}>;
|
17
|
+
|
18
|
+
export const FN_SELECTOR = "0x034eb4dd" as const;
|
19
|
+
const FN_INPUTS = [
|
20
|
+
{
|
21
|
+
type: "uint256",
|
22
|
+
name: "_tokenId",
|
23
|
+
},
|
24
|
+
] as const;
|
25
|
+
const FN_OUTPUTS = [
|
26
|
+
{
|
27
|
+
type: "uint256",
|
28
|
+
},
|
29
|
+
] as const;
|
30
|
+
|
31
|
+
/**
|
32
|
+
* Checks if the `updateTokenIdERC1155` method is supported by the given contract.
|
33
|
+
* @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.
|
34
|
+
* @returns A boolean indicating if the `updateTokenIdERC1155` method is supported.
|
35
|
+
* @modules SequentialTokenIdERC1155
|
36
|
+
* @example
|
37
|
+
* ```ts
|
38
|
+
* import { SequentialTokenIdERC1155 } from "thirdweb/modules";
|
39
|
+
*
|
40
|
+
* const supported = SequentialTokenIdERC1155.isUpdateTokenIdERC1155Supported(["0x..."]);
|
41
|
+
* ```
|
42
|
+
*/
|
43
|
+
export function isUpdateTokenIdERC1155Supported(availableSelectors: string[]) {
|
44
|
+
return detectMethod({
|
45
|
+
availableSelectors,
|
46
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
47
|
+
});
|
48
|
+
}
|
49
|
+
|
50
|
+
/**
|
51
|
+
* Encodes the parameters for the "updateTokenIdERC1155" function.
|
52
|
+
* @param options - The options for the updateTokenIdERC1155 function.
|
53
|
+
* @returns The encoded ABI parameters.
|
54
|
+
* @modules SequentialTokenIdERC1155
|
55
|
+
* @example
|
56
|
+
* ```ts
|
57
|
+
* import { SequentialTokenIdERC1155 } from "thirdweb/modules";
|
58
|
+
* const result = SequentialTokenIdERC1155.encodeUpdateTokenIdERC1155Params({
|
59
|
+
* tokenId: ...,
|
60
|
+
* });
|
61
|
+
* ```
|
62
|
+
*/
|
63
|
+
export function encodeUpdateTokenIdERC1155Params(
|
64
|
+
options: UpdateTokenIdERC1155Params,
|
65
|
+
) {
|
66
|
+
return encodeAbiParameters(FN_INPUTS, [options.tokenId]);
|
67
|
+
}
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Encodes the "updateTokenIdERC1155" function into a Hex string with its parameters.
|
71
|
+
* @param options - The options for the updateTokenIdERC1155 function.
|
72
|
+
* @returns The encoded hexadecimal string.
|
73
|
+
* @modules SequentialTokenIdERC1155
|
74
|
+
* @example
|
75
|
+
* ```ts
|
76
|
+
* import { SequentialTokenIdERC1155 } from "thirdweb/modules";
|
77
|
+
* const result = SequentialTokenIdERC1155.encodeUpdateTokenIdERC1155({
|
78
|
+
* tokenId: ...,
|
79
|
+
* });
|
80
|
+
* ```
|
81
|
+
*/
|
82
|
+
export function encodeUpdateTokenIdERC1155(
|
83
|
+
options: UpdateTokenIdERC1155Params,
|
84
|
+
) {
|
85
|
+
// we do a "manual" concat here to avoid the overhead of the "concatHex" function
|
86
|
+
// we can do this because we know the specific formats of the values
|
87
|
+
return (FN_SELECTOR +
|
88
|
+
encodeUpdateTokenIdERC1155Params(options).slice(
|
89
|
+
2,
|
90
|
+
)) as `${typeof FN_SELECTOR}${string}`;
|
91
|
+
}
|
92
|
+
|
93
|
+
/**
|
94
|
+
* Prepares a transaction to call the "updateTokenIdERC1155" function on the contract.
|
95
|
+
* @param options - The options for the "updateTokenIdERC1155" function.
|
96
|
+
* @returns A prepared transaction object.
|
97
|
+
* @modules SequentialTokenIdERC1155
|
98
|
+
* @example
|
99
|
+
* ```ts
|
100
|
+
* import { sendTransaction } from "thirdweb";
|
101
|
+
* import { SequentialTokenIdERC1155 } from "thirdweb/modules";
|
102
|
+
*
|
103
|
+
* const transaction = SequentialTokenIdERC1155.updateTokenIdERC1155({
|
104
|
+
* contract,
|
105
|
+
* tokenId: ...,
|
106
|
+
* overrides: {
|
107
|
+
* ...
|
108
|
+
* }
|
109
|
+
* });
|
110
|
+
*
|
111
|
+
* // Send the transaction
|
112
|
+
* await sendTransaction({ transaction, account });
|
113
|
+
* ```
|
114
|
+
*/
|
115
|
+
export function updateTokenIdERC1155(
|
116
|
+
options: BaseTransactionOptions<
|
117
|
+
| UpdateTokenIdERC1155Params
|
118
|
+
| {
|
119
|
+
asyncParams: () => Promise<UpdateTokenIdERC1155Params>;
|
120
|
+
}
|
121
|
+
>,
|
122
|
+
) {
|
123
|
+
const asyncOptions = once(async () => {
|
124
|
+
return "asyncParams" in options ? await options.asyncParams() : options;
|
125
|
+
});
|
126
|
+
|
127
|
+
return prepareContractCall({
|
128
|
+
contract: options.contract,
|
129
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
130
|
+
params: async () => {
|
131
|
+
const resolvedOptions = await asyncOptions();
|
132
|
+
return [resolvedOptions.tokenId] as const;
|
133
|
+
},
|
134
|
+
value: async () => (await asyncOptions()).overrides?.value,
|
135
|
+
accessList: async () => (await asyncOptions()).overrides?.accessList,
|
136
|
+
gas: async () => (await asyncOptions()).overrides?.gas,
|
137
|
+
gasPrice: async () => (await asyncOptions()).overrides?.gasPrice,
|
138
|
+
maxFeePerGas: async () => (await asyncOptions()).overrides?.maxFeePerGas,
|
139
|
+
maxPriorityFeePerGas: async () =>
|
140
|
+
(await asyncOptions()).overrides?.maxPriorityFeePerGas,
|
141
|
+
nonce: async () => (await asyncOptions()).overrides?.nonce,
|
142
|
+
extraGas: async () => (await asyncOptions()).overrides?.extraGas,
|
143
|
+
erc20Value: async () => (await asyncOptions()).overrides?.erc20Value,
|
144
|
+
});
|
145
|
+
}
|
@@ -4,8 +4,6 @@ import type { ThirdwebClient } from "../../client/client.js";
|
|
4
4
|
import { type ThirdwebContract, getContract } from "../../contract/contract.js";
|
5
5
|
import { fetchPublishedContractMetadata } from "../../contract/deployment/publisher.js";
|
6
6
|
import { getOrDeployInfraContractFromMetadata } from "../../contract/deployment/utils/bootstrap.js";
|
7
|
-
import {} from "../../contract/deployment/utils/infra.js";
|
8
|
-
import { zkDeployContract } from "../../contract/deployment/zksync/zkDeployContract.js";
|
9
7
|
import { sendAndConfirmTransaction } from "../../transaction/actions/send-and-confirm-transaction.js";
|
10
8
|
import { simulateTransaction } from "../../transaction/actions/simulate.js";
|
11
9
|
import { prepareContractCall } from "../../transaction/prepare-contract-call.js";
|
@@ -18,7 +16,6 @@ import {
|
|
18
16
|
fetchBytecodeFromCompilerMetadata,
|
19
17
|
} from "../../utils/any-evm/deploy-metadata.js";
|
20
18
|
import type { FetchDeployMetadataResult } from "../../utils/any-evm/deploy-metadata.js";
|
21
|
-
import { isZkSyncChain } from "../../utils/any-evm/zksync/isZkSyncChain.js";
|
22
19
|
import type { Hex } from "../../utils/encoding/hex.js";
|
23
20
|
import type { Account } from "../../wallets/interfaces/wallet.js";
|
24
21
|
import { getAllDefaultConstructorParamsForImplementation } from "./get-required-transactions.js";
|
@@ -263,22 +260,6 @@ async function directDeploy(options: {
|
|
263
260
|
const { account, client, chain, compilerMetadata, contractParams, salt } =
|
264
261
|
options;
|
265
262
|
|
266
|
-
if (await isZkSyncChain(chain)) {
|
267
|
-
return zkDeployContract({
|
268
|
-
account,
|
269
|
-
client,
|
270
|
-
chain,
|
271
|
-
bytecode: await fetchBytecodeFromCompilerMetadata({
|
272
|
-
compilerMetadata,
|
273
|
-
client,
|
274
|
-
chain,
|
275
|
-
}),
|
276
|
-
abi: compilerMetadata.abi,
|
277
|
-
params: contractParams,
|
278
|
-
salt,
|
279
|
-
});
|
280
|
-
}
|
281
|
-
|
282
263
|
const { deployContract } = await import(
|
283
264
|
"../../contract/deployment/deploy-with-abi.js"
|
284
265
|
);
|
@@ -0,0 +1,121 @@
|
|
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 "exists" function.
|
11
|
+
*/
|
12
|
+
export type ExistsParams = {
|
13
|
+
tokenId: AbiParameterToPrimitiveType<{ type: "uint256"; name: "tokenId" }>;
|
14
|
+
};
|
15
|
+
|
16
|
+
export const FN_SELECTOR = "0x4f558e79" as const;
|
17
|
+
const FN_INPUTS = [
|
18
|
+
{
|
19
|
+
type: "uint256",
|
20
|
+
name: "tokenId",
|
21
|
+
},
|
22
|
+
] as const;
|
23
|
+
const FN_OUTPUTS = [
|
24
|
+
{
|
25
|
+
type: "bool",
|
26
|
+
},
|
27
|
+
] as const;
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Checks if the `exists` method is supported by the given contract.
|
31
|
+
* @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.
|
32
|
+
* @returns A boolean indicating if the `exists` method is supported.
|
33
|
+
* @extension UNSTOPPABLE-DOMAINS
|
34
|
+
* @example
|
35
|
+
* ```ts
|
36
|
+
* import { isExistsSupported } from "thirdweb/extensions/unstoppable-domains";
|
37
|
+
* const supported = isExistsSupported(["0x..."]);
|
38
|
+
* ```
|
39
|
+
*/
|
40
|
+
export function isExistsSupported(availableSelectors: string[]) {
|
41
|
+
return detectMethod({
|
42
|
+
availableSelectors,
|
43
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
44
|
+
});
|
45
|
+
}
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Encodes the parameters for the "exists" function.
|
49
|
+
* @param options - The options for the exists function.
|
50
|
+
* @returns The encoded ABI parameters.
|
51
|
+
* @extension UNSTOPPABLE-DOMAINS
|
52
|
+
* @example
|
53
|
+
* ```ts
|
54
|
+
* import { encodeExistsParams } from "thirdweb/extensions/unstoppable-domains";
|
55
|
+
* const result = encodeExistsParams({
|
56
|
+
* tokenId: ...,
|
57
|
+
* });
|
58
|
+
* ```
|
59
|
+
*/
|
60
|
+
export function encodeExistsParams(options: ExistsParams) {
|
61
|
+
return encodeAbiParameters(FN_INPUTS, [options.tokenId]);
|
62
|
+
}
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Encodes the "exists" function into a Hex string with its parameters.
|
66
|
+
* @param options - The options for the exists function.
|
67
|
+
* @returns The encoded hexadecimal string.
|
68
|
+
* @extension UNSTOPPABLE-DOMAINS
|
69
|
+
* @example
|
70
|
+
* ```ts
|
71
|
+
* import { encodeExists } from "thirdweb/extensions/unstoppable-domains";
|
72
|
+
* const result = encodeExists({
|
73
|
+
* tokenId: ...,
|
74
|
+
* });
|
75
|
+
* ```
|
76
|
+
*/
|
77
|
+
export function encodeExists(options: ExistsParams) {
|
78
|
+
// we do a "manual" concat here to avoid the overhead of the "concatHex" function
|
79
|
+
// we can do this because we know the specific formats of the values
|
80
|
+
return (FN_SELECTOR +
|
81
|
+
encodeExistsParams(options).slice(2)) as `${typeof FN_SELECTOR}${string}`;
|
82
|
+
}
|
83
|
+
|
84
|
+
/**
|
85
|
+
* Decodes the result of the exists function call.
|
86
|
+
* @param result - The hexadecimal result to decode.
|
87
|
+
* @returns The decoded result as per the FN_OUTPUTS definition.
|
88
|
+
* @extension UNSTOPPABLE-DOMAINS
|
89
|
+
* @example
|
90
|
+
* ```ts
|
91
|
+
* import { decodeExistsResult } from "thirdweb/extensions/unstoppable-domains";
|
92
|
+
* const result = decodeExistsResultResult("...");
|
93
|
+
* ```
|
94
|
+
*/
|
95
|
+
export function decodeExistsResult(result: Hex) {
|
96
|
+
return decodeAbiParameters(FN_OUTPUTS, result)[0];
|
97
|
+
}
|
98
|
+
|
99
|
+
/**
|
100
|
+
* Calls the "exists" function on the contract.
|
101
|
+
* @param options - The options for the exists function.
|
102
|
+
* @returns The parsed result of the function call.
|
103
|
+
* @extension UNSTOPPABLE-DOMAINS
|
104
|
+
* @example
|
105
|
+
* ```ts
|
106
|
+
* import { exists } from "thirdweb/extensions/unstoppable-domains";
|
107
|
+
*
|
108
|
+
* const result = await exists({
|
109
|
+
* contract,
|
110
|
+
* tokenId: ...,
|
111
|
+
* });
|
112
|
+
*
|
113
|
+
* ```
|
114
|
+
*/
|
115
|
+
export async function exists(options: BaseTransactionOptions<ExistsParams>) {
|
116
|
+
return readContract({
|
117
|
+
contract: options.contract,
|
118
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
119
|
+
params: [options.tokenId],
|
120
|
+
});
|
121
|
+
}
|
@@ -15,4 +15,15 @@ describe("Unstoppable Domain: resolve address", () => {
|
|
15
15
|
).toLowerCase(),
|
16
16
|
).toBe("0x12345674b599ce99958242b3D3741e7b01841DF3".toLowerCase());
|
17
17
|
});
|
18
|
+
|
19
|
+
it("should throw an error with a non-existent domain name", async () => {
|
20
|
+
await expect(() =>
|
21
|
+
resolveAddress({
|
22
|
+
name: "thirdwebsdk.thissuredoesnotexist",
|
23
|
+
client: TEST_CLIENT,
|
24
|
+
}),
|
25
|
+
).rejects.toThrowError(
|
26
|
+
"Could not resolve a valid tokenId from the domain: thirdwebsdk.thissuredoesnotexist. Make sure it exists.",
|
27
|
+
);
|
28
|
+
});
|
18
29
|
});
|