Skip to content

Commit b5f33c2

Browse files
committed
test(sdk): deployErc721
1 parent 42da432 commit b5f33c2

File tree

4 files changed

+73
-32
lines changed

4 files changed

+73
-32
lines changed

.changeset/selfish-deers-destroy.md

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,10 @@
22
"thirdweb": minor
33
---
44

5-
Adds Multiwrap and LoyaltyCard support to ERC721 deployment.
5+
Adds LoyaltyCard extensions and support for ERC721 deployment.
66

77
```ts
88
import { deployERC721Contract } from "thirdweb/deploys";
9-
const multiwrapContractAddress = await deployERC721Contract({
10-
chain: "your-chain-id", // replace with your chain ID
11-
client: yourThirdwebClient, // replace with your Thirdweb client instance
12-
account: yourAccount, // replace with your account details
13-
type: "Multiwrap",
14-
params: {
15-
name: "MyMultiwrapNFT",
16-
symbol: "MWNFT",
17-
description: "A multiwrap NFT contract",
18-
image: "path/to/image.png", // replace with your image path
19-
defaultAdmin: "0xYourAdminAddress", // replace with your admin address
20-
royaltyRecipient: "0xYourRoyaltyRecipient", // replace with your royalty recipient address
21-
royaltyBps: 500n, // 5% royalty
22-
trustedForwarders: ["0xTrustedForwarderAddress"], // replace with your trusted forwarder addresses
23-
},
24-
});
259

2610
const loyaltyCardContractAddress = await deployERC721Contract({
2711
chain: "your-chain-id", // replace with your chain ID

codecov.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ coverage:
88
target: 80%
99
flags:
1010
- packages
11+
ignore:
12+
- "**/__generated__/**"
1113

1214

1315
github_checks:

packages/thirdweb/src/extensions/prebuilts/deploy-erc721.test.ts

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import { deployERC721Contract } from "./deploy-erc721.js";
88

99
const account = TEST_ACCOUNT_B;
1010

11-
// skip this test suite if there is no secret key available to test with
12-
// TODO: remove reliance on secret key during unit tests entirely
1311
describe.runIf(process.env.TW_SECRET_KEY)("deployERC721", () => {
1412
it("should deploy ERC721 open edition", async () => {
1513
const address = await deployERC721Contract({
@@ -21,6 +19,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("deployERC721", () => {
2119
name: "OE",
2220
},
2321
});
22+
2423
expect(address).toBeDefined();
2524
const deployedName = await name({
2625
contract: getContract({
@@ -31,4 +30,73 @@ describe.runIf(process.env.TW_SECRET_KEY)("deployERC721", () => {
3130
});
3231
expect(deployedName).toBe("OE");
3332
});
33+
34+
it("should deploy ERC721 drop", async () => {
35+
const address = await deployERC721Contract({
36+
client: TEST_CLIENT,
37+
chain: ANVIL_CHAIN,
38+
account,
39+
type: "DropERC721",
40+
params: {
41+
name: "Drop",
42+
symbol: "DRP",
43+
},
44+
});
45+
46+
expect(address).toBeDefined();
47+
const deployedName = await name({
48+
contract: getContract({
49+
client: TEST_CLIENT,
50+
chain: ANVIL_CHAIN,
51+
address,
52+
}),
53+
});
54+
expect(deployedName).toBe("Drop");
55+
});
56+
57+
it("should deploy ERC721 token", async () => {
58+
const address = await deployERC721Contract({
59+
client: TEST_CLIENT,
60+
chain: ANVIL_CHAIN,
61+
account,
62+
type: "TokenERC721",
63+
params: {
64+
name: "Token",
65+
symbol: "TKN",
66+
},
67+
});
68+
69+
expect(address).toBeDefined();
70+
const deployedName = await name({
71+
contract: getContract({
72+
client: TEST_CLIENT,
73+
chain: ANVIL_CHAIN,
74+
address,
75+
}),
76+
});
77+
expect(deployedName).toBe("Token");
78+
});
79+
80+
it("should deploy ERC721 loyalty card", async () => {
81+
const address = await deployERC721Contract({
82+
client: TEST_CLIENT,
83+
chain: ANVIL_CHAIN,
84+
account,
85+
type: "LoyaltyCard",
86+
params: {
87+
name: "Loyalty",
88+
symbol: "LOY",
89+
},
90+
});
91+
92+
expect(address).toBeDefined();
93+
const deployedName = await name({
94+
contract: getContract({
95+
client: TEST_CLIENT,
96+
chain: ANVIL_CHAIN,
97+
address,
98+
}),
99+
});
100+
expect(deployedName).toBe("Loyalty");
101+
});
34102
});

packages/thirdweb/src/extensions/prebuilts/deploy-erc721.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type { FileOrBufferOrString } from "../../storage/upload/types.js";
77
import type { Prettify } from "../../utils/type-utils.js";
88
import type { ClientAndChainAndAccount } from "../../utils/types.js";
99
import { initialize as initLoyaltyCard } from "../erc721/__generated__/LoyaltyCard/write/initialize.js";
10-
import { initialize as initMultiwrap } from "../erc721/__generated__/Multiwrap/write/initialize.js";
1110
import { initialize as initDropERC721 } from "./__generated__/DropERC721/write/initialize.js";
1211
import { initialize as initOpenEditionERC721 } from "./__generated__/OpenEditionERC721/write/initialize.js";
1312
import { initialize as initTokenERC721 } from "./__generated__/TokenERC721/write/initialize.js";
@@ -19,7 +18,6 @@ export type ERC721ContractType =
1918
| "DropERC721"
2019
| "TokenERC721"
2120
| "OpenEditionERC721"
22-
| "Multiwrap"
2321
| "LoyaltyCard";
2422

2523
/**
@@ -171,17 +169,6 @@ async function getInitializeTransaction(options: {
171169
royaltyBps: params.royaltyBps || 0n,
172170
trustedForwarders: params.trustedForwarders || [],
173171
});
174-
case "Multiwrap":
175-
return initMultiwrap({
176-
contract: implementationContract,
177-
defaultAdmin: params.defaultAdmin || accountAddress,
178-
name: params.name || "",
179-
symbol: params.symbol || "",
180-
contractURI,
181-
royaltyRecipient: params.royaltyRecipient || accountAddress,
182-
royaltyBps: params.royaltyBps || 0n,
183-
trustedForwarders: params.trustedForwarders || [],
184-
});
185172
case "LoyaltyCard":
186173
return initLoyaltyCard({
187174
contract: implementationContract,

0 commit comments

Comments
 (0)