thirdweb 5.59.1 → 5.60.0-nightly-6c26012a71d884f99dd5d8c914b3879037b36d56-20240929000339
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/exports/deploys.js +3 -1
- package/dist/cjs/exports/deploys.js.map +1 -1
- package/dist/cjs/exports/extensions/pack.js +24 -0
- package/dist/cjs/exports/extensions/pack.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/events/PackCreated.js +31 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/events/PackCreated.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/events/PackOpened.js +32 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/events/PackOpened.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/events/PackUpdated.js +31 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/events/PackUpdated.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/read/canUpdatePack.js +114 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/read/canUpdatePack.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/read/getPackContents.js +137 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/read/getPackContents.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/read/getTokenCountOfBundle.js +114 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/read/getTokenCountOfBundle.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/read/getTokenOfBundle.js +139 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/read/getTokenOfBundle.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/read/getUriOfBundle.js +114 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/read/getUriOfBundle.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/write/addPackContents.js +175 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/write/addPackContents.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/write/createPack.js +193 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/write/createPack.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/write/openPack.js +146 -0
- package/dist/cjs/extensions/pack/__generated__/IPack/write/openPack.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPackVRFDirect/events/PackOpenRequested.js +32 -0
- package/dist/cjs/extensions/pack/__generated__/IPackVRFDirect/events/PackOpenRequested.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPackVRFDirect/events/PackRandomnessFulfilled.js +32 -0
- package/dist/cjs/extensions/pack/__generated__/IPackVRFDirect/events/PackRandomnessFulfilled.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPackVRFDirect/read/canClaimRewards.js +114 -0
- package/dist/cjs/extensions/pack/__generated__/IPackVRFDirect/read/canClaimRewards.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPackVRFDirect/write/claimRewards.js +74 -0
- package/dist/cjs/extensions/pack/__generated__/IPackVRFDirect/write/claimRewards.js.map +1 -0
- package/dist/cjs/extensions/pack/__generated__/IPackVRFDirect/write/openPackAndClaimRewards.js +143 -0
- package/dist/cjs/extensions/pack/__generated__/IPackVRFDirect/write/openPackAndClaimRewards.js.map +1 -0
- package/dist/cjs/extensions/pack/createNewPack.js +285 -0
- package/dist/cjs/extensions/pack/createNewPack.js.map +1 -0
- package/dist/cjs/extensions/prebuilts/__generated__/Pack/write/initialize.js +175 -0
- package/dist/cjs/extensions/prebuilts/__generated__/Pack/write/initialize.js.map +1 -0
- package/dist/cjs/extensions/prebuilts/deploy-pack.js +115 -0
- package/dist/cjs/extensions/prebuilts/deploy-pack.js.map +1 -0
- package/dist/cjs/rpc/watchBlockNumber.js +2 -8
- package/dist/cjs/rpc/watchBlockNumber.js.map +1 -1
- package/dist/cjs/utils/sleep.js +12 -0
- package/dist/cjs/utils/sleep.js.map +1 -0
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/utils/iFrameCommunication/IframeCommunicator.js +4 -8
- package/dist/cjs/wallets/in-app/web/utils/iFrameCommunication/IframeCommunicator.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/userop.js +2 -0
- package/dist/cjs/wallets/smart/lib/userop.js.map +1 -1
- package/dist/cjs/wallets/wallet-connect/controller.js +9 -9
- package/dist/cjs/wallets/wallet-connect/controller.js.map +1 -1
- package/dist/esm/exports/deploys.js +1 -0
- package/dist/esm/exports/deploys.js.map +1 -1
- package/dist/esm/exports/extensions/pack.js +12 -0
- package/dist/esm/exports/extensions/pack.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/events/PackCreated.js +28 -0
- package/dist/esm/extensions/pack/__generated__/IPack/events/PackCreated.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/events/PackOpened.js +29 -0
- package/dist/esm/extensions/pack/__generated__/IPack/events/PackOpened.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/events/PackUpdated.js +28 -0
- package/dist/esm/extensions/pack/__generated__/IPack/events/PackUpdated.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/read/canUpdatePack.js +106 -0
- package/dist/esm/extensions/pack/__generated__/IPack/read/canUpdatePack.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/read/getPackContents.js +129 -0
- package/dist/esm/extensions/pack/__generated__/IPack/read/getPackContents.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/read/getTokenCountOfBundle.js +106 -0
- package/dist/esm/extensions/pack/__generated__/IPack/read/getTokenCountOfBundle.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/read/getTokenOfBundle.js +131 -0
- package/dist/esm/extensions/pack/__generated__/IPack/read/getTokenOfBundle.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/read/getUriOfBundle.js +106 -0
- package/dist/esm/extensions/pack/__generated__/IPack/read/getUriOfBundle.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/write/addPackContents.js +168 -0
- package/dist/esm/extensions/pack/__generated__/IPack/write/addPackContents.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/write/createPack.js +186 -0
- package/dist/esm/extensions/pack/__generated__/IPack/write/createPack.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPack/write/openPack.js +139 -0
- package/dist/esm/extensions/pack/__generated__/IPack/write/openPack.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPackVRFDirect/events/PackOpenRequested.js +29 -0
- package/dist/esm/extensions/pack/__generated__/IPackVRFDirect/events/PackOpenRequested.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPackVRFDirect/events/PackRandomnessFulfilled.js +29 -0
- package/dist/esm/extensions/pack/__generated__/IPackVRFDirect/events/PackRandomnessFulfilled.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPackVRFDirect/read/canClaimRewards.js +106 -0
- package/dist/esm/extensions/pack/__generated__/IPackVRFDirect/read/canClaimRewards.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPackVRFDirect/write/claimRewards.js +69 -0
- package/dist/esm/extensions/pack/__generated__/IPackVRFDirect/write/claimRewards.js.map +1 -0
- package/dist/esm/extensions/pack/__generated__/IPackVRFDirect/write/openPackAndClaimRewards.js +136 -0
- package/dist/esm/extensions/pack/__generated__/IPackVRFDirect/write/openPackAndClaimRewards.js.map +1 -0
- package/dist/esm/extensions/pack/createNewPack.js +281 -0
- package/dist/esm/extensions/pack/createNewPack.js.map +1 -0
- package/dist/esm/extensions/prebuilts/__generated__/Pack/write/initialize.js +168 -0
- package/dist/esm/extensions/prebuilts/__generated__/Pack/write/initialize.js.map +1 -0
- package/dist/esm/extensions/prebuilts/deploy-pack.js +112 -0
- package/dist/esm/extensions/prebuilts/deploy-pack.js.map +1 -0
- package/dist/esm/rpc/watchBlockNumber.js +1 -7
- package/dist/esm/rpc/watchBlockNumber.js.map +1 -1
- package/dist/esm/utils/sleep.js +9 -0
- package/dist/esm/utils/sleep.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/wallets/in-app/web/utils/iFrameCommunication/IframeCommunicator.js +4 -8
- package/dist/esm/wallets/in-app/web/utils/iFrameCommunication/IframeCommunicator.js.map +1 -1
- package/dist/esm/wallets/smart/lib/userop.js +2 -0
- package/dist/esm/wallets/smart/lib/userop.js.map +1 -1
- package/dist/esm/wallets/wallet-connect/controller.js +9 -9
- package/dist/esm/wallets/wallet-connect/controller.js.map +1 -1
- package/dist/types/exports/deploys.d.ts +1 -0
- package/dist/types/exports/deploys.d.ts.map +1 -1
- package/dist/types/exports/extensions/pack.d.ts +9 -0
- package/dist/types/exports/extensions/pack.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/events/PackCreated.d.ts +47 -0
- package/dist/types/extensions/pack/__generated__/IPack/events/PackCreated.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/events/PackOpened.d.ts +70 -0
- package/dist/types/extensions/pack/__generated__/IPack/events/PackOpened.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/events/PackUpdated.d.ts +47 -0
- package/dist/types/extensions/pack/__generated__/IPack/events/PackUpdated.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/read/canUpdatePack.d.ts +83 -0
- package/dist/types/extensions/pack/__generated__/IPack/read/canUpdatePack.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/read/getPackContents.d.ts +93 -0
- package/dist/types/extensions/pack/__generated__/IPack/read/getPackContents.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/read/getTokenCountOfBundle.d.ts +83 -0
- package/dist/types/extensions/pack/__generated__/IPack/read/getTokenCountOfBundle.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/read/getTokenOfBundle.d.ts +100 -0
- package/dist/types/extensions/pack/__generated__/IPack/read/getTokenOfBundle.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/read/getUriOfBundle.d.ts +83 -0
- package/dist/types/extensions/pack/__generated__/IPack/read/getUriOfBundle.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/write/addPackContents.d.ts +118 -0
- package/dist/types/extensions/pack/__generated__/IPack/write/addPackContents.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/write/createPack.d.ts +132 -0
- package/dist/types/extensions/pack/__generated__/IPack/write/createPack.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPack/write/openPack.d.ts +86 -0
- package/dist/types/extensions/pack/__generated__/IPack/write/openPack.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPackVRFDirect/events/PackOpenRequested.d.ts +57 -0
- package/dist/types/extensions/pack/__generated__/IPackVRFDirect/events/PackOpenRequested.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPackVRFDirect/events/PackRandomnessFulfilled.d.ts +51 -0
- package/dist/types/extensions/pack/__generated__/IPackVRFDirect/events/PackRandomnessFulfilled.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPackVRFDirect/read/canClaimRewards.d.ts +83 -0
- package/dist/types/extensions/pack/__generated__/IPackVRFDirect/read/canClaimRewards.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPackVRFDirect/write/claimRewards.d.ts +33 -0
- package/dist/types/extensions/pack/__generated__/IPackVRFDirect/write/claimRewards.d.ts.map +1 -0
- package/dist/types/extensions/pack/__generated__/IPackVRFDirect/write/openPackAndClaimRewards.d.ts +93 -0
- package/dist/types/extensions/pack/__generated__/IPackVRFDirect/write/openPackAndClaimRewards.d.ts.map +1 -0
- package/dist/types/extensions/pack/createNewPack.d.ts +104 -0
- package/dist/types/extensions/pack/createNewPack.d.ts.map +1 -0
- package/dist/types/extensions/prebuilts/__generated__/Pack/write/initialize.d.ts +121 -0
- package/dist/types/extensions/prebuilts/__generated__/Pack/write/initialize.d.ts.map +1 -0
- package/dist/types/extensions/prebuilts/deploy-pack.d.ts +62 -0
- package/dist/types/extensions/prebuilts/deploy-pack.d.ts.map +1 -0
- package/dist/types/rpc/watchBlockNumber.d.ts.map +1 -1
- package/dist/types/utils/sleep.d.ts +7 -0
- package/dist/types/utils/sleep.d.ts.map +1 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/utils/iFrameCommunication/IframeCommunicator.d.ts.map +1 -1
- package/dist/types/wallets/smart/lib/userop.d.ts.map +1 -1
- package/dist/types/wallets/wallet-connect/controller.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/exports/deploys.ts +6 -0
- package/src/exports/extensions/pack.ts +42 -0
- package/src/extensions/erc1155/drop1155.test.ts +2 -11
- package/src/extensions/erc1155/drops/read/getActiveClaimCondition.test.ts +6 -4
- package/src/extensions/erc1155/token1155.test.ts +2 -11
- package/src/extensions/erc20/drop20.test.ts +2 -11
- package/src/extensions/erc721/drop721.test.ts +3 -11
- package/src/extensions/erc721/drops/write/updateMetadata.test.ts +2 -2
- package/src/extensions/erc721/lazyMinting/write/createAndReveal.test.ts +2 -2
- package/src/extensions/erc721/read/getTotalClaimedSupply.test.ts +2 -2
- package/src/extensions/erc721/read/getTotalUnclaimedSupply.test.ts +2 -2
- package/src/extensions/erc721/write/mintTo.test.ts +2 -0
- package/src/extensions/erc721/write/updateTokenURI.test.ts +2 -2
- package/src/extensions/marketplace/english-auctions/english-auctions.test.ts +3 -0
- package/src/extensions/marketplace/offers/offers.test.ts +3 -0
- package/src/extensions/modules/ClaimableERC1155/claimableERC1155.test.ts +2 -1
- package/src/extensions/modules/ClaimableERC20/claimableERC20.test.ts +2 -1
- package/src/extensions/modules/ClaimableERC721/claimableERC721.test.ts +2 -1
- package/src/extensions/modules/MintableERC1155/mintableERC1155.test.ts +2 -0
- package/src/extensions/modules/MintableERC20/mintableERC20.test.ts +2 -0
- package/src/extensions/modules/MintableERC721/mintableERC721.test.ts +2 -0
- package/src/extensions/modules/OpenEditionMetadataERC721/openEditionERC721.test.ts +2 -0
- package/src/extensions/pack/__generated__/IPack/events/PackCreated.ts +41 -0
- package/src/extensions/pack/__generated__/IPack/events/PackOpened.ts +47 -0
- package/src/extensions/pack/__generated__/IPack/events/PackUpdated.ts +41 -0
- package/src/extensions/pack/__generated__/IPack/read/canUpdatePack.ts +125 -0
- package/src/extensions/pack/__generated__/IPack/read/getPackContents.ts +148 -0
- package/src/extensions/pack/__generated__/IPack/read/getTokenCountOfBundle.ts +129 -0
- package/src/extensions/pack/__generated__/IPack/read/getTokenOfBundle.ts +151 -0
- package/src/extensions/pack/__generated__/IPack/read/getUriOfBundle.ts +125 -0
- package/src/extensions/pack/__generated__/IPack/write/addPackContents.ts +213 -0
- package/src/extensions/pack/__generated__/IPack/write/createPack.ts +239 -0
- package/src/extensions/pack/__generated__/IPack/write/openPack.ts +168 -0
- package/src/extensions/pack/__generated__/IPackVRFDirect/events/PackOpenRequested.ts +49 -0
- package/src/extensions/pack/__generated__/IPackVRFDirect/events/PackRandomnessFulfilled.ts +49 -0
- package/src/extensions/pack/__generated__/IPackVRFDirect/read/canClaimRewards.ts +125 -0
- package/src/extensions/pack/__generated__/IPackVRFDirect/write/claimRewards.ts +73 -0
- package/src/extensions/pack/__generated__/IPackVRFDirect/write/openPackAndClaimRewards.ts +177 -0
- package/src/extensions/pack/createNewPack.test.ts +207 -0
- package/src/extensions/pack/createNewPack.ts +433 -0
- package/src/extensions/permissions/permissions.test.ts +3 -0
- package/src/extensions/prebuilts/__generated__/Pack/write/initialize.ts +216 -0
- package/src/extensions/prebuilts/deploy-erc20.test.ts +5 -3
- package/src/extensions/prebuilts/deploy-erc721.test.ts +6 -4
- package/src/extensions/prebuilts/deploy-pack.test.ts +23 -0
- package/src/extensions/prebuilts/deploy-pack.ts +173 -0
- package/src/extensions/prebuilts/deploy-split.test.ts +2 -2
- package/src/extensions/prebuilts/deploy-vote.test.ts +7 -5
- package/src/extensions/split/read/getAllRecipientsAddresses.test.ts +2 -2
- package/src/extensions/split/read/getAllRecipientsPercentages.test.ts +2 -2
- package/src/extensions/split/read/getRecipientSplitPercentage.test.ts +4 -2
- package/src/extensions/vote/read/proposalExists.test.ts +6 -6
- package/src/rpc/watchBlockNumber.ts +1 -8
- package/src/utils/sleep.ts +8 -0
- package/src/version.ts +1 -1
- package/src/wallets/in-app/web/utils/iFrameCommunication/IframeCommunicator.ts +5 -9
- package/src/wallets/smart/lib/userop.ts +2 -0
- package/src/wallets/smart/smart-wallet-integration-v07.test.ts +11 -8
- package/src/wallets/utils/getTokenBalance.test.ts +8 -6
- package/src/wallets/wallet-connect/controller.ts +23 -11
@@ -1,4 +1,5 @@
|
|
1
1
|
import { beforeAll, describe, expect, it } from "vitest";
|
2
|
+
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
2
3
|
import { ANVIL_CHAIN } from "../../../../test/src/chains.js";
|
3
4
|
import { TEST_CLIENT } from "../../../../test/src/test-clients.js";
|
4
5
|
import {
|
@@ -37,6 +38,7 @@ describe.skip("Marketplace: English Auctions", () => {
|
|
37
38
|
client: TEST_CLIENT,
|
38
39
|
params: {
|
39
40
|
name: "TestMarketPlace",
|
41
|
+
contractURI: TEST_CONTRACT_URI,
|
40
42
|
},
|
41
43
|
});
|
42
44
|
marketplaceContract = getContract({
|
@@ -53,6 +55,7 @@ describe.skip("Marketplace: English Auctions", () => {
|
|
53
55
|
client: TEST_CLIENT,
|
54
56
|
params: {
|
55
57
|
name: "TestERC721",
|
58
|
+
contractURI: TEST_CONTRACT_URI,
|
56
59
|
},
|
57
60
|
});
|
58
61
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { beforeAll, describe, expect, it } from "vitest";
|
2
|
+
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
2
3
|
import { ANVIL_CHAIN } from "../../../../test/src/chains.js";
|
3
4
|
import { TEST_CLIENT } from "../../../../test/src/test-clients.js";
|
4
5
|
import {
|
@@ -43,6 +44,7 @@ describe.skip("Marketplace: Offers", () => {
|
|
43
44
|
client: TEST_CLIENT,
|
44
45
|
params: {
|
45
46
|
name: "TestMarketPlace",
|
47
|
+
contractURI: TEST_CONTRACT_URI,
|
46
48
|
},
|
47
49
|
});
|
48
50
|
marketplaceContract = getContract({
|
@@ -59,6 +61,7 @@ describe.skip("Marketplace: Offers", () => {
|
|
59
61
|
client: TEST_CLIENT,
|
60
62
|
params: {
|
61
63
|
name: "TestERC721",
|
64
|
+
contractURI: TEST_CONTRACT_URI,
|
62
65
|
},
|
63
66
|
});
|
64
67
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { beforeAll, describe, expect, it } from "vitest";
|
2
|
+
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
2
3
|
import { ANVIL_CHAIN } from "../../../../test/src/chains.js";
|
3
4
|
import { TEST_CLIENT } from "../../../../test/src/test-clients.js";
|
4
5
|
import {
|
@@ -29,7 +30,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("ModularClaimableERC1155", () => {
|
|
29
30
|
core: "ERC1155",
|
30
31
|
params: {
|
31
32
|
name: "TestDropERC1155",
|
32
|
-
|
33
|
+
contractURI: TEST_CONTRACT_URI,
|
33
34
|
},
|
34
35
|
modules: [
|
35
36
|
ClaimableERC1155.module({
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { beforeAll, describe, expect, it } from "vitest";
|
2
|
+
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
2
3
|
import { ANVIL_CHAIN } from "../../../../test/src/chains.js";
|
3
4
|
import { TEST_CLIENT } from "../../../../test/src/test-clients.js";
|
4
5
|
import {
|
@@ -26,7 +27,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("ModularDropERC20", () => {
|
|
26
27
|
core: "ERC20",
|
27
28
|
params: {
|
28
29
|
name: "TestDropERC20",
|
29
|
-
|
30
|
+
contractURI: TEST_CONTRACT_URI,
|
30
31
|
},
|
31
32
|
modules: [
|
32
33
|
ClaimableERC20.module({
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { beforeAll, describe, expect, it } from "vitest";
|
2
|
+
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
2
3
|
import { ANVIL_CHAIN } from "../../../../test/src/chains.js";
|
3
4
|
import { TEST_CLIENT } from "../../../../test/src/test-clients.js";
|
4
5
|
import {
|
@@ -27,7 +28,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("ModularClaimableERC721", () => {
|
|
27
28
|
core: "ERC721",
|
28
29
|
params: {
|
29
30
|
name: "TestDropERC721",
|
30
|
-
|
31
|
+
contractURI: TEST_CONTRACT_URI,
|
31
32
|
},
|
32
33
|
modules: [
|
33
34
|
ClaimableERC721.module({
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { beforeAll, describe, expect, it } from "vitest";
|
2
|
+
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
2
3
|
import { ANVIL_CHAIN } from "../../../../test/src/chains.js";
|
3
4
|
import { TEST_CLIENT } from "../../../../test/src/test-clients.js";
|
4
5
|
import {
|
@@ -32,6 +33,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("ModularTokenERC1155", () => {
|
|
32
33
|
params: {
|
33
34
|
name: "TestTokenERC1155",
|
34
35
|
symbol: "TT",
|
36
|
+
contractURI: TEST_CONTRACT_URI,
|
35
37
|
},
|
36
38
|
modules: [
|
37
39
|
MintableERC1155.module({
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { beforeAll, describe, expect, it } from "vitest";
|
2
|
+
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
2
3
|
import { ANVIL_CHAIN } from "../../../../test/src/chains.js";
|
3
4
|
import { TEST_CLIENT } from "../../../../test/src/test-clients.js";
|
4
5
|
import {
|
@@ -27,6 +28,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("ModularTokenERC20", () => {
|
|
27
28
|
params: {
|
28
29
|
name: "TestTokenERC20",
|
29
30
|
symbol: "TT",
|
31
|
+
contractURI: TEST_CONTRACT_URI,
|
30
32
|
},
|
31
33
|
modules: [
|
32
34
|
MintableERC20.module({
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { beforeAll, describe, expect, it } from "vitest";
|
2
|
+
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
2
3
|
import { ANVIL_CHAIN } from "../../../../test/src/chains.js";
|
3
4
|
import { TEST_CLIENT } from "../../../../test/src/test-clients.js";
|
4
5
|
import {
|
@@ -31,6 +32,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("ModularTokenERC721", () => {
|
|
31
32
|
params: {
|
32
33
|
name: "TestTokenERC721",
|
33
34
|
symbol: "TT",
|
35
|
+
contractURI: TEST_CONTRACT_URI,
|
34
36
|
},
|
35
37
|
modules: [
|
36
38
|
MintableERC721.module({
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { beforeAll, describe, expect, it } from "vitest";
|
2
|
+
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
2
3
|
import { ANVIL_CHAIN } from "../../../../test/src/chains.js";
|
3
4
|
import { TEST_CLIENT } from "../../../../test/src/test-clients.js";
|
4
5
|
import {
|
@@ -30,6 +31,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("ModularOpenEditionERC721", () => {
|
|
30
31
|
params: {
|
31
32
|
name: "TestDropERC721",
|
32
33
|
symbol: "TT",
|
34
|
+
contractURI: TEST_CONTRACT_URI,
|
33
35
|
},
|
34
36
|
modules: [
|
35
37
|
ClaimableERC721.module({
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import { prepareEvent } from "../../../../../event/prepare-event.js";
|
2
|
+
import type { AbiParameterToPrimitiveType } from "abitype";
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Represents the filters for the "PackCreated" event.
|
6
|
+
*/
|
7
|
+
export type PackCreatedEventFilters = Partial<{
|
8
|
+
packId: AbiParameterToPrimitiveType<{
|
9
|
+
type: "uint256";
|
10
|
+
name: "packId";
|
11
|
+
indexed: true;
|
12
|
+
}>;
|
13
|
+
}>;
|
14
|
+
|
15
|
+
/**
|
16
|
+
* Creates an event object for the PackCreated event.
|
17
|
+
* @param filters - Optional filters to apply to the event.
|
18
|
+
* @returns The prepared event object.
|
19
|
+
* @extension PACK
|
20
|
+
* @example
|
21
|
+
* ```ts
|
22
|
+
* import { getContractEvents } from "thirdweb";
|
23
|
+
* import { packCreatedEvent } from "thirdweb/extensions/pack";
|
24
|
+
*
|
25
|
+
* const events = await getContractEvents({
|
26
|
+
* contract,
|
27
|
+
* events: [
|
28
|
+
* packCreatedEvent({
|
29
|
+
* packId: ...,
|
30
|
+
* })
|
31
|
+
* ],
|
32
|
+
* });
|
33
|
+
* ```
|
34
|
+
*/
|
35
|
+
export function packCreatedEvent(filters: PackCreatedEventFilters = {}) {
|
36
|
+
return prepareEvent({
|
37
|
+
signature:
|
38
|
+
"event PackCreated(uint256 indexed packId, address recipient, uint256 totalPacksCreated)",
|
39
|
+
filters,
|
40
|
+
});
|
41
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import { prepareEvent } from "../../../../../event/prepare-event.js";
|
2
|
+
import type { AbiParameterToPrimitiveType } from "abitype";
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Represents the filters for the "PackOpened" event.
|
6
|
+
*/
|
7
|
+
export type PackOpenedEventFilters = Partial<{
|
8
|
+
packId: AbiParameterToPrimitiveType<{
|
9
|
+
type: "uint256";
|
10
|
+
name: "packId";
|
11
|
+
indexed: true;
|
12
|
+
}>;
|
13
|
+
opener: AbiParameterToPrimitiveType<{
|
14
|
+
type: "address";
|
15
|
+
name: "opener";
|
16
|
+
indexed: true;
|
17
|
+
}>;
|
18
|
+
}>;
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Creates an event object for the PackOpened event.
|
22
|
+
* @param filters - Optional filters to apply to the event.
|
23
|
+
* @returns The prepared event object.
|
24
|
+
* @extension PACK
|
25
|
+
* @example
|
26
|
+
* ```ts
|
27
|
+
* import { getContractEvents } from "thirdweb";
|
28
|
+
* import { packOpenedEvent } from "thirdweb/extensions/pack";
|
29
|
+
*
|
30
|
+
* const events = await getContractEvents({
|
31
|
+
* contract,
|
32
|
+
* events: [
|
33
|
+
* packOpenedEvent({
|
34
|
+
* packId: ...,
|
35
|
+
* opener: ...,
|
36
|
+
* })
|
37
|
+
* ],
|
38
|
+
* });
|
39
|
+
* ```
|
40
|
+
*/
|
41
|
+
export function packOpenedEvent(filters: PackOpenedEventFilters = {}) {
|
42
|
+
return prepareEvent({
|
43
|
+
signature:
|
44
|
+
"event PackOpened(uint256 indexed packId, address indexed opener, uint256 numOfPacksOpened, (address assetContract, uint8 tokenType, uint256 tokenId, uint256 totalAmount)[] rewardUnitsDistributed)",
|
45
|
+
filters,
|
46
|
+
});
|
47
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import { prepareEvent } from "../../../../../event/prepare-event.js";
|
2
|
+
import type { AbiParameterToPrimitiveType } from "abitype";
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Represents the filters for the "PackUpdated" event.
|
6
|
+
*/
|
7
|
+
export type PackUpdatedEventFilters = Partial<{
|
8
|
+
packId: AbiParameterToPrimitiveType<{
|
9
|
+
type: "uint256";
|
10
|
+
name: "packId";
|
11
|
+
indexed: true;
|
12
|
+
}>;
|
13
|
+
}>;
|
14
|
+
|
15
|
+
/**
|
16
|
+
* Creates an event object for the PackUpdated event.
|
17
|
+
* @param filters - Optional filters to apply to the event.
|
18
|
+
* @returns The prepared event object.
|
19
|
+
* @extension PACK
|
20
|
+
* @example
|
21
|
+
* ```ts
|
22
|
+
* import { getContractEvents } from "thirdweb";
|
23
|
+
* import { packUpdatedEvent } from "thirdweb/extensions/pack";
|
24
|
+
*
|
25
|
+
* const events = await getContractEvents({
|
26
|
+
* contract,
|
27
|
+
* events: [
|
28
|
+
* packUpdatedEvent({
|
29
|
+
* packId: ...,
|
30
|
+
* })
|
31
|
+
* ],
|
32
|
+
* });
|
33
|
+
* ```
|
34
|
+
*/
|
35
|
+
export function packUpdatedEvent(filters: PackUpdatedEventFilters = {}) {
|
36
|
+
return prepareEvent({
|
37
|
+
signature:
|
38
|
+
"event PackUpdated(uint256 indexed packId, address recipient, uint256 totalPacksCreated)",
|
39
|
+
filters,
|
40
|
+
});
|
41
|
+
}
|
@@ -0,0 +1,125 @@
|
|
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 "canUpdatePack" function.
|
11
|
+
*/
|
12
|
+
export type CanUpdatePackParams = {
|
13
|
+
key: AbiParameterToPrimitiveType<{ type: "uint256"; name: "_key" }>;
|
14
|
+
};
|
15
|
+
|
16
|
+
export const FN_SELECTOR = "0xb0381b08" as const;
|
17
|
+
const FN_INPUTS = [
|
18
|
+
{
|
19
|
+
type: "uint256",
|
20
|
+
name: "_key",
|
21
|
+
},
|
22
|
+
] as const;
|
23
|
+
const FN_OUTPUTS = [
|
24
|
+
{
|
25
|
+
type: "bool",
|
26
|
+
},
|
27
|
+
] as const;
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Checks if the `canUpdatePack` 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 `canUpdatePack` method is supported.
|
33
|
+
* @extension PACK
|
34
|
+
* @example
|
35
|
+
* ```ts
|
36
|
+
* import { isCanUpdatePackSupported } from "thirdweb/extensions/pack";
|
37
|
+
* const supported = isCanUpdatePackSupported(["0x..."]);
|
38
|
+
* ```
|
39
|
+
*/
|
40
|
+
export function isCanUpdatePackSupported(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 "canUpdatePack" function.
|
49
|
+
* @param options - The options for the canUpdatePack function.
|
50
|
+
* @returns The encoded ABI parameters.
|
51
|
+
* @extension PACK
|
52
|
+
* @example
|
53
|
+
* ```ts
|
54
|
+
* import { encodeCanUpdatePackParams } from "thirdweb/extensions/pack";
|
55
|
+
* const result = encodeCanUpdatePackParams({
|
56
|
+
* key: ...,
|
57
|
+
* });
|
58
|
+
* ```
|
59
|
+
*/
|
60
|
+
export function encodeCanUpdatePackParams(options: CanUpdatePackParams) {
|
61
|
+
return encodeAbiParameters(FN_INPUTS, [options.key]);
|
62
|
+
}
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Encodes the "canUpdatePack" function into a Hex string with its parameters.
|
66
|
+
* @param options - The options for the canUpdatePack function.
|
67
|
+
* @returns The encoded hexadecimal string.
|
68
|
+
* @extension PACK
|
69
|
+
* @example
|
70
|
+
* ```ts
|
71
|
+
* import { encodeCanUpdatePack } from "thirdweb/extensions/pack";
|
72
|
+
* const result = encodeCanUpdatePack({
|
73
|
+
* key: ...,
|
74
|
+
* });
|
75
|
+
* ```
|
76
|
+
*/
|
77
|
+
export function encodeCanUpdatePack(options: CanUpdatePackParams) {
|
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
|
+
encodeCanUpdatePackParams(options).slice(
|
82
|
+
2,
|
83
|
+
)) as `${typeof FN_SELECTOR}${string}`;
|
84
|
+
}
|
85
|
+
|
86
|
+
/**
|
87
|
+
* Decodes the result of the canUpdatePack function call.
|
88
|
+
* @param result - The hexadecimal result to decode.
|
89
|
+
* @returns The decoded result as per the FN_OUTPUTS definition.
|
90
|
+
* @extension PACK
|
91
|
+
* @example
|
92
|
+
* ```ts
|
93
|
+
* import { decodeCanUpdatePackResult } from "thirdweb/extensions/pack";
|
94
|
+
* const result = decodeCanUpdatePackResultResult("...");
|
95
|
+
* ```
|
96
|
+
*/
|
97
|
+
export function decodeCanUpdatePackResult(result: Hex) {
|
98
|
+
return decodeAbiParameters(FN_OUTPUTS, result)[0];
|
99
|
+
}
|
100
|
+
|
101
|
+
/**
|
102
|
+
* Calls the "canUpdatePack" function on the contract.
|
103
|
+
* @param options - The options for the canUpdatePack function.
|
104
|
+
* @returns The parsed result of the function call.
|
105
|
+
* @extension PACK
|
106
|
+
* @example
|
107
|
+
* ```ts
|
108
|
+
* import { canUpdatePack } from "thirdweb/extensions/pack";
|
109
|
+
*
|
110
|
+
* const result = await canUpdatePack({
|
111
|
+
* contract,
|
112
|
+
* key: ...,
|
113
|
+
* });
|
114
|
+
*
|
115
|
+
* ```
|
116
|
+
*/
|
117
|
+
export async function canUpdatePack(
|
118
|
+
options: BaseTransactionOptions<CanUpdatePackParams>,
|
119
|
+
) {
|
120
|
+
return readContract({
|
121
|
+
contract: options.contract,
|
122
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
123
|
+
params: [options.key],
|
124
|
+
});
|
125
|
+
}
|
@@ -0,0 +1,148 @@
|
|
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 "getPackContents" function.
|
11
|
+
*/
|
12
|
+
export type GetPackContentsParams = {
|
13
|
+
packId: AbiParameterToPrimitiveType<{ type: "uint256"; name: "_packId" }>;
|
14
|
+
};
|
15
|
+
|
16
|
+
export const FN_SELECTOR = "0x8d4c446a" as const;
|
17
|
+
const FN_INPUTS = [
|
18
|
+
{
|
19
|
+
type: "uint256",
|
20
|
+
name: "_packId",
|
21
|
+
},
|
22
|
+
] as const;
|
23
|
+
const FN_OUTPUTS = [
|
24
|
+
{
|
25
|
+
type: "tuple[]",
|
26
|
+
name: "contents",
|
27
|
+
components: [
|
28
|
+
{
|
29
|
+
type: "address",
|
30
|
+
name: "assetContract",
|
31
|
+
},
|
32
|
+
{
|
33
|
+
type: "uint8",
|
34
|
+
name: "tokenType",
|
35
|
+
},
|
36
|
+
{
|
37
|
+
type: "uint256",
|
38
|
+
name: "tokenId",
|
39
|
+
},
|
40
|
+
{
|
41
|
+
type: "uint256",
|
42
|
+
name: "totalAmount",
|
43
|
+
},
|
44
|
+
],
|
45
|
+
},
|
46
|
+
{
|
47
|
+
type: "uint256[]",
|
48
|
+
name: "perUnitAmounts",
|
49
|
+
},
|
50
|
+
] as const;
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Checks if the `getPackContents` method is supported by the given contract.
|
54
|
+
* @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.
|
55
|
+
* @returns A boolean indicating if the `getPackContents` method is supported.
|
56
|
+
* @extension PACK
|
57
|
+
* @example
|
58
|
+
* ```ts
|
59
|
+
* import { isGetPackContentsSupported } from "thirdweb/extensions/pack";
|
60
|
+
* const supported = isGetPackContentsSupported(["0x..."]);
|
61
|
+
* ```
|
62
|
+
*/
|
63
|
+
export function isGetPackContentsSupported(availableSelectors: string[]) {
|
64
|
+
return detectMethod({
|
65
|
+
availableSelectors,
|
66
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
67
|
+
});
|
68
|
+
}
|
69
|
+
|
70
|
+
/**
|
71
|
+
* Encodes the parameters for the "getPackContents" function.
|
72
|
+
* @param options - The options for the getPackContents function.
|
73
|
+
* @returns The encoded ABI parameters.
|
74
|
+
* @extension PACK
|
75
|
+
* @example
|
76
|
+
* ```ts
|
77
|
+
* import { encodeGetPackContentsParams } from "thirdweb/extensions/pack";
|
78
|
+
* const result = encodeGetPackContentsParams({
|
79
|
+
* packId: ...,
|
80
|
+
* });
|
81
|
+
* ```
|
82
|
+
*/
|
83
|
+
export function encodeGetPackContentsParams(options: GetPackContentsParams) {
|
84
|
+
return encodeAbiParameters(FN_INPUTS, [options.packId]);
|
85
|
+
}
|
86
|
+
|
87
|
+
/**
|
88
|
+
* Encodes the "getPackContents" function into a Hex string with its parameters.
|
89
|
+
* @param options - The options for the getPackContents function.
|
90
|
+
* @returns The encoded hexadecimal string.
|
91
|
+
* @extension PACK
|
92
|
+
* @example
|
93
|
+
* ```ts
|
94
|
+
* import { encodeGetPackContents } from "thirdweb/extensions/pack";
|
95
|
+
* const result = encodeGetPackContents({
|
96
|
+
* packId: ...,
|
97
|
+
* });
|
98
|
+
* ```
|
99
|
+
*/
|
100
|
+
export function encodeGetPackContents(options: GetPackContentsParams) {
|
101
|
+
// we do a "manual" concat here to avoid the overhead of the "concatHex" function
|
102
|
+
// we can do this because we know the specific formats of the values
|
103
|
+
return (FN_SELECTOR +
|
104
|
+
encodeGetPackContentsParams(options).slice(
|
105
|
+
2,
|
106
|
+
)) as `${typeof FN_SELECTOR}${string}`;
|
107
|
+
}
|
108
|
+
|
109
|
+
/**
|
110
|
+
* Decodes the result of the getPackContents function call.
|
111
|
+
* @param result - The hexadecimal result to decode.
|
112
|
+
* @returns The decoded result as per the FN_OUTPUTS definition.
|
113
|
+
* @extension PACK
|
114
|
+
* @example
|
115
|
+
* ```ts
|
116
|
+
* import { decodeGetPackContentsResult } from "thirdweb/extensions/pack";
|
117
|
+
* const result = decodeGetPackContentsResultResult("...");
|
118
|
+
* ```
|
119
|
+
*/
|
120
|
+
export function decodeGetPackContentsResult(result: Hex) {
|
121
|
+
return decodeAbiParameters(FN_OUTPUTS, result);
|
122
|
+
}
|
123
|
+
|
124
|
+
/**
|
125
|
+
* Calls the "getPackContents" function on the contract.
|
126
|
+
* @param options - The options for the getPackContents function.
|
127
|
+
* @returns The parsed result of the function call.
|
128
|
+
* @extension PACK
|
129
|
+
* @example
|
130
|
+
* ```ts
|
131
|
+
* import { getPackContents } from "thirdweb/extensions/pack";
|
132
|
+
*
|
133
|
+
* const result = await getPackContents({
|
134
|
+
* contract,
|
135
|
+
* packId: ...,
|
136
|
+
* });
|
137
|
+
*
|
138
|
+
* ```
|
139
|
+
*/
|
140
|
+
export async function getPackContents(
|
141
|
+
options: BaseTransactionOptions<GetPackContentsParams>,
|
142
|
+
) {
|
143
|
+
return readContract({
|
144
|
+
contract: options.contract,
|
145
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
146
|
+
params: [options.packId],
|
147
|
+
});
|
148
|
+
}
|
@@ -0,0 +1,129 @@
|
|
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 "getTokenCountOfBundle" function.
|
11
|
+
*/
|
12
|
+
export type GetTokenCountOfBundleParams = {
|
13
|
+
bundleId: AbiParameterToPrimitiveType<{ type: "uint256"; name: "_bundleId" }>;
|
14
|
+
};
|
15
|
+
|
16
|
+
export const FN_SELECTOR = "0xd0d2fe25" as const;
|
17
|
+
const FN_INPUTS = [
|
18
|
+
{
|
19
|
+
type: "uint256",
|
20
|
+
name: "_bundleId",
|
21
|
+
},
|
22
|
+
] as const;
|
23
|
+
const FN_OUTPUTS = [
|
24
|
+
{
|
25
|
+
type: "uint256",
|
26
|
+
},
|
27
|
+
] as const;
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Checks if the `getTokenCountOfBundle` 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 `getTokenCountOfBundle` method is supported.
|
33
|
+
* @extension PACK
|
34
|
+
* @example
|
35
|
+
* ```ts
|
36
|
+
* import { isGetTokenCountOfBundleSupported } from "thirdweb/extensions/pack";
|
37
|
+
* const supported = isGetTokenCountOfBundleSupported(["0x..."]);
|
38
|
+
* ```
|
39
|
+
*/
|
40
|
+
export function isGetTokenCountOfBundleSupported(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 "getTokenCountOfBundle" function.
|
49
|
+
* @param options - The options for the getTokenCountOfBundle function.
|
50
|
+
* @returns The encoded ABI parameters.
|
51
|
+
* @extension PACK
|
52
|
+
* @example
|
53
|
+
* ```ts
|
54
|
+
* import { encodeGetTokenCountOfBundleParams } from "thirdweb/extensions/pack";
|
55
|
+
* const result = encodeGetTokenCountOfBundleParams({
|
56
|
+
* bundleId: ...,
|
57
|
+
* });
|
58
|
+
* ```
|
59
|
+
*/
|
60
|
+
export function encodeGetTokenCountOfBundleParams(
|
61
|
+
options: GetTokenCountOfBundleParams,
|
62
|
+
) {
|
63
|
+
return encodeAbiParameters(FN_INPUTS, [options.bundleId]);
|
64
|
+
}
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Encodes the "getTokenCountOfBundle" function into a Hex string with its parameters.
|
68
|
+
* @param options - The options for the getTokenCountOfBundle function.
|
69
|
+
* @returns The encoded hexadecimal string.
|
70
|
+
* @extension PACK
|
71
|
+
* @example
|
72
|
+
* ```ts
|
73
|
+
* import { encodeGetTokenCountOfBundle } from "thirdweb/extensions/pack";
|
74
|
+
* const result = encodeGetTokenCountOfBundle({
|
75
|
+
* bundleId: ...,
|
76
|
+
* });
|
77
|
+
* ```
|
78
|
+
*/
|
79
|
+
export function encodeGetTokenCountOfBundle(
|
80
|
+
options: GetTokenCountOfBundleParams,
|
81
|
+
) {
|
82
|
+
// we do a "manual" concat here to avoid the overhead of the "concatHex" function
|
83
|
+
// we can do this because we know the specific formats of the values
|
84
|
+
return (FN_SELECTOR +
|
85
|
+
encodeGetTokenCountOfBundleParams(options).slice(
|
86
|
+
2,
|
87
|
+
)) as `${typeof FN_SELECTOR}${string}`;
|
88
|
+
}
|
89
|
+
|
90
|
+
/**
|
91
|
+
* Decodes the result of the getTokenCountOfBundle function call.
|
92
|
+
* @param result - The hexadecimal result to decode.
|
93
|
+
* @returns The decoded result as per the FN_OUTPUTS definition.
|
94
|
+
* @extension PACK
|
95
|
+
* @example
|
96
|
+
* ```ts
|
97
|
+
* import { decodeGetTokenCountOfBundleResult } from "thirdweb/extensions/pack";
|
98
|
+
* const result = decodeGetTokenCountOfBundleResultResult("...");
|
99
|
+
* ```
|
100
|
+
*/
|
101
|
+
export function decodeGetTokenCountOfBundleResult(result: Hex) {
|
102
|
+
return decodeAbiParameters(FN_OUTPUTS, result)[0];
|
103
|
+
}
|
104
|
+
|
105
|
+
/**
|
106
|
+
* Calls the "getTokenCountOfBundle" function on the contract.
|
107
|
+
* @param options - The options for the getTokenCountOfBundle function.
|
108
|
+
* @returns The parsed result of the function call.
|
109
|
+
* @extension PACK
|
110
|
+
* @example
|
111
|
+
* ```ts
|
112
|
+
* import { getTokenCountOfBundle } from "thirdweb/extensions/pack";
|
113
|
+
*
|
114
|
+
* const result = await getTokenCountOfBundle({
|
115
|
+
* contract,
|
116
|
+
* bundleId: ...,
|
117
|
+
* });
|
118
|
+
*
|
119
|
+
* ```
|
120
|
+
*/
|
121
|
+
export async function getTokenCountOfBundle(
|
122
|
+
options: BaseTransactionOptions<GetTokenCountOfBundleParams>,
|
123
|
+
) {
|
124
|
+
return readContract({
|
125
|
+
contract: options.contract,
|
126
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
127
|
+
params: [options.bundleId],
|
128
|
+
});
|
129
|
+
}
|