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,11 +1,13 @@
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
2
2
|
import { ANVIL_CHAIN } from "../../../test/src/chains.js";
|
3
3
|
import { TEST_CLIENT } from "../../../test/src/test-clients.js";
|
4
|
-
import {
|
4
|
+
import { TEST_ACCOUNT_B } from "../../../test/src/test-wallets.js";
|
5
5
|
import { getContract } from "../../contract/contract.js";
|
6
6
|
import { name } from "../common/read/name.js";
|
7
7
|
import { deployERC721Contract } from "./deploy-erc721.js";
|
8
8
|
|
9
|
+
const account = TEST_ACCOUNT_B;
|
10
|
+
|
9
11
|
// skip this test suite if there is no secret key available to test with
|
10
12
|
// TODO: remove reliance on secret key during unit tests entirely
|
11
13
|
describe.runIf(process.env.TW_SECRET_KEY)("deployERC721", () => {
|
@@ -13,7 +15,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("deployERC721", () => {
|
|
13
15
|
const address = await deployERC721Contract({
|
14
16
|
client: TEST_CLIENT,
|
15
17
|
chain: ANVIL_CHAIN,
|
16
|
-
account
|
18
|
+
account,
|
17
19
|
type: "DropERC721",
|
18
20
|
params: {
|
19
21
|
name: "NFTDrop",
|
@@ -34,7 +36,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("deployERC721", () => {
|
|
34
36
|
const address = await deployERC721Contract({
|
35
37
|
client: TEST_CLIENT,
|
36
38
|
chain: ANVIL_CHAIN,
|
37
|
-
account
|
39
|
+
account,
|
38
40
|
type: "TokenERC721",
|
39
41
|
params: {
|
40
42
|
name: "NFTCollection",
|
@@ -55,7 +57,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("deployERC721", () => {
|
|
55
57
|
const address = await deployERC721Contract({
|
56
58
|
client: TEST_CLIENT,
|
57
59
|
chain: ANVIL_CHAIN,
|
58
|
-
account
|
60
|
+
account,
|
59
61
|
type: "OpenEditionERC721",
|
60
62
|
params: {
|
61
63
|
name: "OE",
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
2
|
+
import { ANVIL_CHAIN } from "~test/chains.js";
|
3
|
+
import { TEST_CLIENT } from "~test/test-clients.js";
|
4
|
+
import { TEST_ACCOUNT_A } from "~test/test-wallets.js";
|
5
|
+
import { isAddress } from "../../utils/address.js";
|
6
|
+
import { deployPackContract } from "./deploy-pack.js";
|
7
|
+
|
8
|
+
describe.runIf(process.env.TW_SECRET_KEY)("deploy-pack contract", () => {
|
9
|
+
it("should deploy Pack contract", async () => {
|
10
|
+
const address = await deployPackContract({
|
11
|
+
account: TEST_ACCOUNT_A,
|
12
|
+
client: TEST_CLIENT,
|
13
|
+
chain: ANVIL_CHAIN,
|
14
|
+
params: {
|
15
|
+
name: "pack-contract",
|
16
|
+
},
|
17
|
+
});
|
18
|
+
expect(address).toBeDefined();
|
19
|
+
expect(isAddress(address)).toBe(true);
|
20
|
+
// Further tests to verify the functionality of this contract
|
21
|
+
// are done in other Pack tests
|
22
|
+
});
|
23
|
+
});
|
@@ -0,0 +1,173 @@
|
|
1
|
+
import type { Chain } from "../../chains/types.js";
|
2
|
+
import type { ThirdwebClient } from "../../client/client.js";
|
3
|
+
import type { ThirdwebContract } from "../../contract/contract.js";
|
4
|
+
import { deployViaAutoFactory } from "../../contract/deployment/deploy-via-autofactory.js";
|
5
|
+
import {
|
6
|
+
getOrDeployInfraContract,
|
7
|
+
getOrDeployInfraForPublishedContract,
|
8
|
+
} from "../../contract/deployment/utils/bootstrap.js";
|
9
|
+
import { upload } from "../../storage/upload.js";
|
10
|
+
import type { FileOrBufferOrString } from "../../storage/upload/types.js";
|
11
|
+
import type { Prettify } from "../../utils/type-utils.js";
|
12
|
+
import type { ClientAndChainAndAccount } from "../../utils/types.js";
|
13
|
+
import { initialize } from "./__generated__/Pack/write/initialize.js";
|
14
|
+
|
15
|
+
/**
|
16
|
+
* @extension DEPLOY
|
17
|
+
*/
|
18
|
+
export type PackContractParams = {
|
19
|
+
/**
|
20
|
+
* Name of the Pack contract
|
21
|
+
*/
|
22
|
+
name: string;
|
23
|
+
/**
|
24
|
+
* Defaults to the deployer's address
|
25
|
+
*/
|
26
|
+
royaltyRecipient?: string;
|
27
|
+
/**
|
28
|
+
* Defaults to 0 (zero)
|
29
|
+
*/
|
30
|
+
royaltyBps?: number | string;
|
31
|
+
|
32
|
+
description?: string;
|
33
|
+
image?: FileOrBufferOrString;
|
34
|
+
external_link?: string;
|
35
|
+
social_urls?: Record<string, string>;
|
36
|
+
/**
|
37
|
+
* Defaults to an empty string ("")
|
38
|
+
*/
|
39
|
+
symbol?: string;
|
40
|
+
contractURI?: string;
|
41
|
+
/**
|
42
|
+
* Defaults to the deployer's address
|
43
|
+
*/
|
44
|
+
defaultAdmin?: string;
|
45
|
+
trustedForwarders?: string[];
|
46
|
+
};
|
47
|
+
|
48
|
+
/**
|
49
|
+
* @extension DEPLOY
|
50
|
+
*/
|
51
|
+
export type DeployPackContractOptions = Prettify<
|
52
|
+
ClientAndChainAndAccount & {
|
53
|
+
params: PackContractParams;
|
54
|
+
}
|
55
|
+
>;
|
56
|
+
|
57
|
+
/**
|
58
|
+
* Deploy a thirdweb Pack contract
|
59
|
+
* @param options params for deploying [`Pack contract`](https://thirdweb.com/thirdweb.eth/Pack)
|
60
|
+
* @returns
|
61
|
+
*
|
62
|
+
* @example
|
63
|
+
* ```ts
|
64
|
+
* import { deployPackContract } from "thirdweb/extensions/deploy";
|
65
|
+
*
|
66
|
+
* const packAddress = await deployPackContract({
|
67
|
+
* account,
|
68
|
+
* client,
|
69
|
+
* chain,
|
70
|
+
* params: {
|
71
|
+
* name: "Pack contract name",
|
72
|
+
* symbol: "PACK1155",
|
73
|
+
* },
|
74
|
+
* });
|
75
|
+
* ```
|
76
|
+
*/
|
77
|
+
export async function deployPackContract(options: DeployPackContractOptions) {
|
78
|
+
const { chain, client, account, params } = options;
|
79
|
+
const [WETH, forwarder] = await Promise.all([
|
80
|
+
getOrDeployInfraContract({
|
81
|
+
chain,
|
82
|
+
client,
|
83
|
+
account,
|
84
|
+
contractId: "WETH9",
|
85
|
+
}),
|
86
|
+
getOrDeployInfraContract({
|
87
|
+
chain,
|
88
|
+
client,
|
89
|
+
account,
|
90
|
+
contractId: "Forwarder",
|
91
|
+
}),
|
92
|
+
]);
|
93
|
+
const { cloneFactoryContract, implementationContract } =
|
94
|
+
await getOrDeployInfraForPublishedContract({
|
95
|
+
chain,
|
96
|
+
client,
|
97
|
+
account,
|
98
|
+
contractId: "Pack",
|
99
|
+
constructorParams: {
|
100
|
+
nativeTokenWrapper: WETH.address,
|
101
|
+
trustedForwarder: forwarder.address,
|
102
|
+
},
|
103
|
+
});
|
104
|
+
const initializeTransaction = await getInitializeTransaction({
|
105
|
+
client,
|
106
|
+
implementationContract,
|
107
|
+
params,
|
108
|
+
accountAddress: account.address,
|
109
|
+
chain,
|
110
|
+
});
|
111
|
+
|
112
|
+
return deployViaAutoFactory({
|
113
|
+
client,
|
114
|
+
chain,
|
115
|
+
account,
|
116
|
+
cloneFactoryContract,
|
117
|
+
initializeTransaction,
|
118
|
+
});
|
119
|
+
}
|
120
|
+
|
121
|
+
/**
|
122
|
+
* @internal
|
123
|
+
*/
|
124
|
+
async function getInitializeTransaction(options: {
|
125
|
+
client: ThirdwebClient;
|
126
|
+
implementationContract: ThirdwebContract;
|
127
|
+
params: PackContractParams;
|
128
|
+
accountAddress: string;
|
129
|
+
chain: Chain;
|
130
|
+
}) {
|
131
|
+
const { params, implementationContract, accountAddress, client } = options;
|
132
|
+
const contractURI =
|
133
|
+
params.contractURI ||
|
134
|
+
(await upload({
|
135
|
+
client,
|
136
|
+
files: [
|
137
|
+
{
|
138
|
+
name: params.name,
|
139
|
+
description: params.description,
|
140
|
+
symbol: params.symbol || "",
|
141
|
+
image: params.image,
|
142
|
+
external_link: params.external_link,
|
143
|
+
social_urls: params.social_urls,
|
144
|
+
},
|
145
|
+
],
|
146
|
+
})) ||
|
147
|
+
"";
|
148
|
+
let royaltyBps = 0n;
|
149
|
+
if (params.royaltyBps) {
|
150
|
+
const numberVal = Number(params.royaltyBps);
|
151
|
+
if (Number.isNaN(numberVal)) {
|
152
|
+
throw new Error("royaltyBps: Invalid royaltyBps value");
|
153
|
+
}
|
154
|
+
if (numberVal < 0 || numberVal > 100) {
|
155
|
+
throw new Error("royaltyBps: should be between 0 and 100");
|
156
|
+
}
|
157
|
+
// If is a float, make sure it only has 2 digit after the decimal point
|
158
|
+
if (numberVal % 1 !== 0 && !/^\d+(\.\d{1,2})?$/.test(String(numberVal))) {
|
159
|
+
throw new Error("royaltyBps: Maximum 2 decimal places allowed.");
|
160
|
+
}
|
161
|
+
royaltyBps = BigInt(numberVal * 100); // 21.12 -> 2112n
|
162
|
+
}
|
163
|
+
return initialize({
|
164
|
+
contract: implementationContract,
|
165
|
+
name: params.name,
|
166
|
+
symbol: params.symbol || "",
|
167
|
+
defaultAdmin: params.defaultAdmin || accountAddress,
|
168
|
+
royaltyRecipient: params.royaltyRecipient || accountAddress,
|
169
|
+
contractURI,
|
170
|
+
trustedForwarders: params.trustedForwarders || [],
|
171
|
+
royaltyBps,
|
172
|
+
});
|
173
|
+
}
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
2
2
|
import { ANVIL_CHAIN } from "~test/chains.js";
|
3
3
|
import { TEST_CLIENT } from "~test/test-clients.js";
|
4
|
-
import {
|
4
|
+
import { TEST_ACCOUNT_D } from "~test/test-wallets.js";
|
5
5
|
import { isAddress } from "../../utils/address.js";
|
6
6
|
import { deploySplitContract } from "./deploy-split.js";
|
7
7
|
|
8
8
|
describe.runIf(process.env.TW_SECRET_KEY)("deploy-split contract", () => {
|
9
9
|
it("should deploy Split contract", async () => {
|
10
10
|
const address = await deploySplitContract({
|
11
|
-
account:
|
11
|
+
account: TEST_ACCOUNT_D,
|
12
12
|
client: TEST_CLIENT,
|
13
13
|
chain: ANVIL_CHAIN,
|
14
14
|
params: {
|
@@ -2,17 +2,19 @@ import { describe, expect, it } from "vitest";
|
|
2
2
|
import { ANVIL_CHAIN } from "~test/chains.js";
|
3
3
|
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
4
4
|
import { TEST_CLIENT } from "~test/test-clients.js";
|
5
|
-
import {
|
5
|
+
import { TEST_ACCOUNT_B } from "~test/test-wallets.js";
|
6
6
|
import { isAddress } from "../../utils/address.js";
|
7
7
|
import { deployERC20Contract } from "./deploy-erc20.js";
|
8
8
|
import { deployVoteContract } from "./deploy-vote.js";
|
9
9
|
|
10
|
+
const account = TEST_ACCOUNT_B;
|
11
|
+
|
10
12
|
describe.runIf(process.env.TW_SECRET_KEY)("deploy-voteERC20 contract", () => {
|
11
13
|
it("should deploy Vote contract", async () => {
|
12
14
|
const tokenAddress = await deployERC20Contract({
|
13
15
|
client: TEST_CLIENT,
|
14
16
|
chain: ANVIL_CHAIN,
|
15
|
-
account
|
17
|
+
account,
|
16
18
|
type: "TokenERC20",
|
17
19
|
params: {
|
18
20
|
name: "Token",
|
@@ -20,7 +22,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("deploy-voteERC20 contract", () => {
|
|
20
22
|
},
|
21
23
|
});
|
22
24
|
const address = await deployVoteContract({
|
23
|
-
account
|
25
|
+
account,
|
24
26
|
client: TEST_CLIENT,
|
25
27
|
chain: ANVIL_CHAIN,
|
26
28
|
params: {
|
@@ -45,7 +47,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("deploy-voteERC20 contract", () => {
|
|
45
47
|
const tokenAddress = await deployERC20Contract({
|
46
48
|
client: TEST_CLIENT,
|
47
49
|
chain: ANVIL_CHAIN,
|
48
|
-
account
|
50
|
+
account,
|
49
51
|
type: "TokenERC20",
|
50
52
|
params: {
|
51
53
|
name: "Token",
|
@@ -54,7 +56,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("deploy-voteERC20 contract", () => {
|
|
54
56
|
});
|
55
57
|
await expect(() =>
|
56
58
|
deployVoteContract({
|
57
|
-
account
|
59
|
+
account,
|
58
60
|
client: TEST_CLIENT,
|
59
61
|
chain: ANVIL_CHAIN,
|
60
62
|
params: {
|
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
|
|
2
2
|
import { ANVIL_CHAIN } from "~test/chains.js";
|
3
3
|
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
4
4
|
import { TEST_CLIENT } from "~test/test-clients.js";
|
5
|
-
import {
|
5
|
+
import { TEST_ACCOUNT_C } from "~test/test-wallets.js";
|
6
6
|
import { getContract } from "../../../contract/contract.js";
|
7
7
|
import { deploySplitContract } from "../../../extensions/prebuilts/deploy-split.js";
|
8
8
|
import { getAllRecipientsAddresses } from "./getAllRecipientsAddresses.js";
|
@@ -17,7 +17,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("getAllRecipientsAddresses", () => {
|
|
17
17
|
"0xA6f11e47dE28B3dB934e945daeb6F538E9019694",
|
18
18
|
];
|
19
19
|
const address = await deploySplitContract({
|
20
|
-
account:
|
20
|
+
account: TEST_ACCOUNT_C,
|
21
21
|
client: TEST_CLIENT,
|
22
22
|
chain: ANVIL_CHAIN,
|
23
23
|
params: {
|
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
|
|
2
2
|
import { ANVIL_CHAIN } from "~test/chains.js";
|
3
3
|
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
4
4
|
import { TEST_CLIENT } from "~test/test-clients.js";
|
5
|
-
import {
|
5
|
+
import { TEST_ACCOUNT_C } from "~test/test-wallets.js";
|
6
6
|
import { getContract } from "../../../contract/contract.js";
|
7
7
|
import { deploySplitContract } from "../../../extensions/prebuilts/deploy-split.js";
|
8
8
|
import { getAllRecipientsPercentages } from "./getAllRecipientsPercentages.js";
|
@@ -17,7 +17,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("getAllRecipientsPercentages", () => {
|
|
17
17
|
"0xA6f11e47dE28B3dB934e945daeb6F538E9019694",
|
18
18
|
];
|
19
19
|
const address = await deploySplitContract({
|
20
|
-
account:
|
20
|
+
account: TEST_ACCOUNT_C,
|
21
21
|
client: TEST_CLIENT,
|
22
22
|
chain: ANVIL_CHAIN,
|
23
23
|
params: {
|
@@ -2,12 +2,14 @@ import { describe, expect, it } from "vitest";
|
|
2
2
|
import { ANVIL_CHAIN } from "~test/chains.js";
|
3
3
|
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
4
4
|
import { TEST_CLIENT } from "~test/test-clients.js";
|
5
|
-
import {
|
5
|
+
import { TEST_ACCOUNT_C } from "~test/test-wallets.js";
|
6
6
|
import { getContract } from "../../../contract/contract.js";
|
7
7
|
import { deploySplitContract } from "../../../extensions/prebuilts/deploy-split.js";
|
8
8
|
import { getRecipientSplitPercentage } from "./getRecipientSplitPercentage.js";
|
9
|
+
|
9
10
|
const chain = ANVIL_CHAIN;
|
10
11
|
const client = TEST_CLIENT;
|
12
|
+
const account = TEST_ACCOUNT_C;
|
11
13
|
|
12
14
|
describe.runIf(process.env.TW_SECRET_KEY)("getRecipientSplitPercentage", () => {
|
13
15
|
it("should work", async () => {
|
@@ -16,7 +18,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("getRecipientSplitPercentage", () => {
|
|
16
18
|
"0xA6f11e47dE28B3dB934e945daeb6F538E9019694",
|
17
19
|
];
|
18
20
|
const address = await deploySplitContract({
|
19
|
-
account
|
21
|
+
account,
|
20
22
|
client: TEST_CLIENT,
|
21
23
|
chain: ANVIL_CHAIN,
|
22
24
|
params: {
|
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
|
|
2
2
|
import { ANVIL_CHAIN } from "~test/chains.js";
|
3
3
|
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
4
4
|
import { TEST_CLIENT } from "~test/test-clients.js";
|
5
|
-
import {
|
5
|
+
import { TEST_ACCOUNT_C } from "~test/test-wallets.js";
|
6
6
|
import { getContract } from "../../../contract/contract.js";
|
7
7
|
import { delegate } from "../../../extensions/erc20/__generated__/IVotes/write/delegate.js";
|
8
8
|
import { mintTo } from "../../../extensions/erc20/write/mintTo.js";
|
@@ -13,7 +13,7 @@ import { propose } from "../__generated__/Vote/write/propose.js";
|
|
13
13
|
import { getAll } from "./getAll.js";
|
14
14
|
import { proposalExists } from "./proposalExists.js";
|
15
15
|
|
16
|
-
const account =
|
16
|
+
const account = TEST_ACCOUNT_C;
|
17
17
|
const client = TEST_CLIENT;
|
18
18
|
const chain = ANVIL_CHAIN;
|
19
19
|
|
@@ -22,7 +22,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("proposal exists", () => {
|
|
22
22
|
const tokenAddress = await deployERC20Contract({
|
23
23
|
client: TEST_CLIENT,
|
24
24
|
chain: ANVIL_CHAIN,
|
25
|
-
account
|
25
|
+
account,
|
26
26
|
type: "TokenERC20",
|
27
27
|
params: {
|
28
28
|
name: "Token",
|
@@ -30,7 +30,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("proposal exists", () => {
|
|
30
30
|
},
|
31
31
|
});
|
32
32
|
const address = await deployVoteContract({
|
33
|
-
account
|
33
|
+
account,
|
34
34
|
client: TEST_CLIENT,
|
35
35
|
chain: ANVIL_CHAIN,
|
36
36
|
params: {
|
@@ -57,7 +57,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("proposal exists", () => {
|
|
57
57
|
const tokenAddress = await deployERC20Contract({
|
58
58
|
client: TEST_CLIENT,
|
59
59
|
chain: ANVIL_CHAIN,
|
60
|
-
account
|
60
|
+
account,
|
61
61
|
type: "TokenERC20",
|
62
62
|
params: {
|
63
63
|
name: "Token",
|
@@ -65,7 +65,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("proposal exists", () => {
|
|
65
65
|
},
|
66
66
|
});
|
67
67
|
const address = await deployVoteContract({
|
68
|
-
account
|
68
|
+
account,
|
69
69
|
client: TEST_CLIENT,
|
70
70
|
chain: ANVIL_CHAIN,
|
71
71
|
params: {
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { Chain } from "../chains/types.js";
|
2
2
|
import type { ThirdwebClient } from "../client/client.js";
|
3
|
+
import { sleep } from "../utils/sleep.js";
|
3
4
|
import { eth_blockNumber } from "./actions/eth_blockNumber.js";
|
4
5
|
import { getRpcClient } from "./rpc.js";
|
5
6
|
|
@@ -138,14 +139,6 @@ function createBlockNumberPoller(
|
|
138
139
|
};
|
139
140
|
}
|
140
141
|
|
141
|
-
/**
|
142
|
-
* TODO: document
|
143
|
-
* @internal
|
144
|
-
*/
|
145
|
-
function sleep(ms: number) {
|
146
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
147
|
-
}
|
148
|
-
|
149
142
|
const existingPollers = new Map<
|
150
143
|
number,
|
151
144
|
ReturnType<typeof createBlockNumberPoller>
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.
|
1
|
+
export const version = "5.60.0-nightly-6c26012a71d884f99dd5d8c914b3879037b36d56-20240929000339";
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import { sleep } from "../../../../../utils/sleep.js";
|
2
|
+
|
1
3
|
type IFrameCommunicatorProps = {
|
2
4
|
link: string;
|
3
5
|
baseUrl: string;
|
@@ -6,12 +8,6 @@ type IFrameCommunicatorProps = {
|
|
6
8
|
onIframeInitialize?: () => void;
|
7
9
|
};
|
8
10
|
|
9
|
-
function sleep(seconds: number) {
|
10
|
-
return new Promise((resolve) => {
|
11
|
-
setTimeout(resolve, seconds * 1000);
|
12
|
-
});
|
13
|
-
}
|
14
|
-
|
15
11
|
const iframeBaseStyle = {
|
16
12
|
height: "100%",
|
17
13
|
width: "100%",
|
@@ -152,12 +148,12 @@ export class IframeCommunicator<T extends { [key: string]: any }> {
|
|
152
148
|
showIframe?: boolean;
|
153
149
|
}) {
|
154
150
|
while (!isIframeLoaded.get(this.iframe.src)) {
|
155
|
-
await sleep(this.POLLING_INTERVAL_SECONDS);
|
151
|
+
await sleep(this.POLLING_INTERVAL_SECONDS * 1000);
|
156
152
|
}
|
157
153
|
if (showIframe) {
|
158
154
|
this.iframe.style.display = "block";
|
159
155
|
// magic number to let the display render before performing the animation of the modal in
|
160
|
-
await sleep(0.005);
|
156
|
+
await sleep(0.005 * 1000);
|
161
157
|
}
|
162
158
|
|
163
159
|
const channel = new MessageChannel();
|
@@ -168,7 +164,7 @@ export class IframeCommunicator<T extends { [key: string]: any }> {
|
|
168
164
|
channel.port1.close();
|
169
165
|
if (showIframe) {
|
170
166
|
// magic number to let modal fade out before hiding it
|
171
|
-
await sleep(0.1);
|
167
|
+
await sleep(0.1 * 1000);
|
172
168
|
this.iframe.style.display = "none";
|
173
169
|
}
|
174
170
|
if (!data.success) {
|
@@ -683,6 +683,7 @@ export async function createAndSignUserOp(options: {
|
|
683
683
|
const tx = options.transactions[0] as PreparedTransaction;
|
684
684
|
const serializedTx = await toSerializableTransaction({
|
685
685
|
transaction: tx,
|
686
|
+
from: accountAddress,
|
686
687
|
});
|
687
688
|
executeTx = prepareExecute({
|
688
689
|
accountContract,
|
@@ -694,6 +695,7 @@ export async function createAndSignUserOp(options: {
|
|
694
695
|
options.transactions.map((tx) =>
|
695
696
|
toSerializableTransaction({
|
696
697
|
transaction: tx,
|
698
|
+
from: accountAddress,
|
697
699
|
}),
|
698
700
|
),
|
699
701
|
);
|
@@ -20,6 +20,7 @@ import { sendBatchTransaction } from "../../transaction/actions/send-batch-trans
|
|
20
20
|
import { waitForReceipt } from "../../transaction/actions/wait-for-tx-receipt.js";
|
21
21
|
import { getAddress } from "../../utils/address.js";
|
22
22
|
import { isContractDeployed } from "../../utils/bytecode/is-contract-deployed.js";
|
23
|
+
import { sleep } from "../../utils/sleep.js";
|
23
24
|
import type { Account, Wallet } from "../interfaces/wallet.js";
|
24
25
|
import { generateAccount } from "../utils/generateAccount.js";
|
25
26
|
import { ENTRYPOINT_ADDRESS_v0_7 } from "./lib/constants.js";
|
@@ -235,15 +236,17 @@ describe.runIf(process.env.TW_SECRET_KEY).sequential(
|
|
235
236
|
}),
|
236
237
|
account: newSmartAccount,
|
237
238
|
}),
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
239
|
+
sleep(1000).then(() =>
|
240
|
+
sendAndConfirmTransaction({
|
241
|
+
transaction: claimTo({
|
242
|
+
contract,
|
243
|
+
quantity: 1n,
|
244
|
+
to: newSmartAccount.address,
|
245
|
+
tokenId: 0n,
|
246
|
+
}),
|
247
|
+
account: newSmartAccount,
|
244
248
|
}),
|
245
|
-
|
246
|
-
}),
|
249
|
+
),
|
247
250
|
]);
|
248
251
|
expect(txs.length).toEqual(2);
|
249
252
|
expect(txs.every((t) => t.transactionHash.length === 66)).toBe(true);
|
@@ -2,17 +2,19 @@ import { describe, expect, it } from "vitest";
|
|
2
2
|
import { ANVIL_CHAIN, FORKED_ETHEREUM_CHAIN } from "~test/chains.js";
|
3
3
|
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
4
4
|
import { TEST_CLIENT } from "~test/test-clients.js";
|
5
|
-
import {
|
5
|
+
import { TEST_ACCOUNT_D } from "~test/test-wallets.js";
|
6
6
|
import { getContract } from "../../contract/contract.js";
|
7
7
|
import { mintTo } from "../../extensions/erc20/write/mintTo.js";
|
8
8
|
import { deployERC20Contract } from "../../extensions/prebuilts/deploy-erc20.js";
|
9
9
|
import { sendAndConfirmTransaction } from "../../transaction/actions/send-and-confirm-transaction.js";
|
10
10
|
import { getTokenBalance } from "./getTokenBalance.js";
|
11
11
|
|
12
|
+
const account = TEST_ACCOUNT_D;
|
13
|
+
|
12
14
|
describe.runIf(process.env.TW_SECRET_KEY)("getTokenBalance", () => {
|
13
15
|
it("should work for native token", async () => {
|
14
16
|
const result = await getTokenBalance({
|
15
|
-
account
|
17
|
+
account,
|
16
18
|
client: TEST_CLIENT,
|
17
19
|
chain: FORKED_ETHEREUM_CHAIN,
|
18
20
|
});
|
@@ -30,7 +32,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("getTokenBalance", () => {
|
|
30
32
|
const erc20Address = await deployERC20Contract({
|
31
33
|
client: TEST_CLIENT,
|
32
34
|
chain: ANVIL_CHAIN,
|
33
|
-
account
|
35
|
+
account,
|
34
36
|
type: "TokenERC20",
|
35
37
|
params: {
|
36
38
|
name: "",
|
@@ -48,18 +50,18 @@ describe.runIf(process.env.TW_SECRET_KEY)("getTokenBalance", () => {
|
|
48
50
|
// Mint some tokens
|
49
51
|
const tx = mintTo({
|
50
52
|
contract: erc20Contract,
|
51
|
-
to:
|
53
|
+
to: account.address,
|
52
54
|
amount,
|
53
55
|
});
|
54
56
|
|
55
57
|
await sendAndConfirmTransaction({
|
56
58
|
transaction: tx,
|
57
|
-
account
|
59
|
+
account,
|
58
60
|
});
|
59
61
|
|
60
62
|
const result = await getTokenBalance({
|
61
63
|
client: TEST_CLIENT,
|
62
|
-
account
|
64
|
+
account,
|
63
65
|
tokenAddress: erc20Address,
|
64
66
|
chain: ANVIL_CHAIN,
|
65
67
|
});
|