@zoralabs/protocol-sdk 0.5.7 → 0.5.8-DEV.2
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/CHANGELOG.md +16 -0
- package/dist/apis/chain-constants.d.ts +1 -0
- package/dist/apis/chain-constants.d.ts.map +1 -1
- package/dist/index.cjs +408 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +398 -4
- package/dist/index.js.map +1 -1
- package/dist/mints/mints-contracts.d.ts +1224 -0
- package/dist/mints/mints-contracts.d.ts.map +1 -0
- package/dist/mints/mints-queries.d.ts +59 -0
- package/dist/mints/mints-queries.d.ts.map +1 -0
- package/package.json +8 -7
- package/src/apis/chain-constants.ts +10 -0
- package/src/index.ts +4 -0
- package/src/mints/mints-contracts.ts +408 -0
- package/src/mints/mints-queries.ts +159 -0
- package/.turbo/turbo-build.log +0 -16
- package/src/create/1155-create-helper.test.ts +0 -104
- package/src/mint/mint-client.test.ts +0 -114
- package/src/premint/premint-client.test.ts +0 -239
- package/src/premint/preminter.test.ts +0 -615
- package/test-integration/premint-client.test.ts +0 -146
- package/tsconfig.build.json +0 -10
- package/tsup.config.ts +0 -12
package/.turbo/turbo-build.log
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
warning package.json: "dependencies" has dependency "vite" with range "4.5.0" that collides with a dependency in "devDependencies" of the same name with version "^4.5.0"
|
|
2
|
-
$ tsup
|
|
3
|
-
[34mCLI[39m Building entry: src/index.ts
|
|
4
|
-
[34mCLI[39m Using tsconfig: tsconfig.build.json
|
|
5
|
-
[34mCLI[39m tsup v7.3.0
|
|
6
|
-
[34mCLI[39m Using tsup config: /home/runner/work/zora-protocol-private/zora-protocol-private/packages/protocol-sdk/tsup.config.ts
|
|
7
|
-
[34mCLI[39m Target: es2021
|
|
8
|
-
[34mCLI[39m Cleaning output folder
|
|
9
|
-
[34mCJS[39m Build start
|
|
10
|
-
[34mESM[39m Build start
|
|
11
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m49.67 KB[39m
|
|
12
|
-
[32mCJS[39m [1mdist/index.cjs.map [22m[32m96.30 KB[39m
|
|
13
|
-
[32mCJS[39m ⚡️ Build success in 84ms
|
|
14
|
-
[32mESM[39m [1mdist/index.js [22m[32m45.77 KB[39m
|
|
15
|
-
[32mESM[39m [1mdist/index.js.map [22m[32m96.35 KB[39m
|
|
16
|
-
[32mESM[39m ⚡️ Build success in 92ms
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { parseEther } from "viem";
|
|
2
|
-
import { describe, expect } from "vitest";
|
|
3
|
-
import {
|
|
4
|
-
create1155CreatorClient,
|
|
5
|
-
getTokenIdFromCreateReceipt,
|
|
6
|
-
} from "./1155-create-helper";
|
|
7
|
-
import { anvilTest } from "src/anvil";
|
|
8
|
-
|
|
9
|
-
const demoTokenMetadataURI = "ipfs://DUMMY/token.json";
|
|
10
|
-
const demoContractMetadataURI = "ipfs://DUMMY/contract.json";
|
|
11
|
-
|
|
12
|
-
describe("create-helper", () => {
|
|
13
|
-
anvilTest(
|
|
14
|
-
"creates a new contract given arguments",
|
|
15
|
-
async ({ viemClients: { testClient, publicClient, walletClient } }) => {
|
|
16
|
-
const addresses = await walletClient.getAddresses();
|
|
17
|
-
const creatorAddress = addresses[0]!;
|
|
18
|
-
await testClient.setBalance({
|
|
19
|
-
address: creatorAddress,
|
|
20
|
-
value: parseEther("1"),
|
|
21
|
-
});
|
|
22
|
-
const creatorClient = create1155CreatorClient({
|
|
23
|
-
publicClient: publicClient,
|
|
24
|
-
});
|
|
25
|
-
const { request } = await creatorClient.createNew1155Token({
|
|
26
|
-
contract: {
|
|
27
|
-
name: "testContract",
|
|
28
|
-
uri: demoContractMetadataURI,
|
|
29
|
-
},
|
|
30
|
-
tokenMetadataURI: demoTokenMetadataURI,
|
|
31
|
-
account: creatorAddress,
|
|
32
|
-
mintToCreatorCount: 1,
|
|
33
|
-
});
|
|
34
|
-
const { request: simulationResponse } =
|
|
35
|
-
await publicClient.simulateContract(request);
|
|
36
|
-
const hash = await walletClient.writeContract(simulationResponse);
|
|
37
|
-
const receipt = await publicClient.waitForTransactionReceipt({ hash });
|
|
38
|
-
expect(receipt).not.toBeNull();
|
|
39
|
-
expect(receipt.to).to.equal("0x777777c338d93e2c7adf08d102d45ca7cc4ed021");
|
|
40
|
-
expect(getTokenIdFromCreateReceipt(receipt)).to.be.equal(1n);
|
|
41
|
-
},
|
|
42
|
-
20 * 1000,
|
|
43
|
-
);
|
|
44
|
-
anvilTest(
|
|
45
|
-
"creates a new contract, than creates a new token on this existing contract",
|
|
46
|
-
async ({ viemClients: { publicClient, walletClient } }) => {
|
|
47
|
-
const addresses = await walletClient.getAddresses();
|
|
48
|
-
const creatorAccount = addresses[0]!;
|
|
49
|
-
|
|
50
|
-
const creatorClient = create1155CreatorClient({
|
|
51
|
-
publicClient: publicClient,
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const { request, contractAddress, contractExists } =
|
|
55
|
-
await creatorClient.createNew1155Token({
|
|
56
|
-
contract: {
|
|
57
|
-
name: "testContract2",
|
|
58
|
-
uri: demoContractMetadataURI,
|
|
59
|
-
},
|
|
60
|
-
tokenMetadataURI: demoTokenMetadataURI,
|
|
61
|
-
account: creatorAccount,
|
|
62
|
-
mintToCreatorCount: 1,
|
|
63
|
-
});
|
|
64
|
-
expect(contractAddress).to.be.equal(
|
|
65
|
-
"0xb1A8928dF830C21eD682949Aa8A83C1C215194d3",
|
|
66
|
-
);
|
|
67
|
-
expect(contractExists).to.be.false;
|
|
68
|
-
const { request: simulateResponse } =
|
|
69
|
-
await publicClient.simulateContract(request);
|
|
70
|
-
const hash = await walletClient.writeContract(simulateResponse);
|
|
71
|
-
const receipt = await publicClient.waitForTransactionReceipt({ hash });
|
|
72
|
-
const firstTokenId = getTokenIdFromCreateReceipt(receipt);
|
|
73
|
-
expect(firstTokenId).to.be.equal(1n);
|
|
74
|
-
expect(receipt).not.toBeNull();
|
|
75
|
-
|
|
76
|
-
const newTokenOnExistingContract = await creatorClient.createNew1155Token(
|
|
77
|
-
{
|
|
78
|
-
contract: {
|
|
79
|
-
name: "testContract2",
|
|
80
|
-
uri: demoContractMetadataURI,
|
|
81
|
-
},
|
|
82
|
-
tokenMetadataURI: demoTokenMetadataURI,
|
|
83
|
-
account: creatorAccount,
|
|
84
|
-
mintToCreatorCount: 1,
|
|
85
|
-
},
|
|
86
|
-
);
|
|
87
|
-
expect(newTokenOnExistingContract.contractAddress).to.be.equal(
|
|
88
|
-
"0xb1A8928dF830C21eD682949Aa8A83C1C215194d3",
|
|
89
|
-
);
|
|
90
|
-
expect(newTokenOnExistingContract.contractExists).to.be.true;
|
|
91
|
-
const { request: simulateRequest } = await publicClient.simulateContract(
|
|
92
|
-
newTokenOnExistingContract.request,
|
|
93
|
-
);
|
|
94
|
-
const newHash = await walletClient.writeContract(simulateRequest);
|
|
95
|
-
const newReceipt = await publicClient.waitForTransactionReceipt({
|
|
96
|
-
hash: newHash,
|
|
97
|
-
});
|
|
98
|
-
const tokenId = getTokenIdFromCreateReceipt(newReceipt);
|
|
99
|
-
expect(tokenId).to.be.equal(2n);
|
|
100
|
-
expect(newReceipt).not.toBeNull();
|
|
101
|
-
},
|
|
102
|
-
20 * 1000,
|
|
103
|
-
);
|
|
104
|
-
});
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { Address, parseAbi, parseEther } from "viem";
|
|
2
|
-
import { zora } from "viem/chains";
|
|
3
|
-
import { describe, expect } from "vitest";
|
|
4
|
-
import { createMintClient } from "./mint-client";
|
|
5
|
-
import { zoraCreator1155ImplABI } from "@zoralabs/protocol-deployments";
|
|
6
|
-
import { anvilTest, forkUrls, makeAnvilTest } from "src/anvil";
|
|
7
|
-
|
|
8
|
-
const erc721ABI = parseAbi([
|
|
9
|
-
"function balanceOf(address owner) public view returns (uint256)",
|
|
10
|
-
] as const);
|
|
11
|
-
|
|
12
|
-
describe("mint-helper", () => {
|
|
13
|
-
anvilTest(
|
|
14
|
-
"mints a new 1155 token",
|
|
15
|
-
async ({ viemClients }) => {
|
|
16
|
-
const { testClient, walletClient, publicClient } = viemClients;
|
|
17
|
-
const creatorAccount = (await walletClient.getAddresses())[0]!;
|
|
18
|
-
await testClient.setBalance({
|
|
19
|
-
address: creatorAccount,
|
|
20
|
-
value: parseEther("2000"),
|
|
21
|
-
});
|
|
22
|
-
const targetContract: Address =
|
|
23
|
-
"0xa2fea3537915dc6c7c7a97a82d1236041e6feb2e";
|
|
24
|
-
const targetTokenId = 1n;
|
|
25
|
-
const minter = createMintClient({ chain: zora });
|
|
26
|
-
|
|
27
|
-
const params = await minter.makePrepareMintTokenParams({
|
|
28
|
-
minterAccount: creatorAccount,
|
|
29
|
-
tokenId: targetTokenId,
|
|
30
|
-
tokenAddress: targetContract,
|
|
31
|
-
mintArguments: {
|
|
32
|
-
mintToAddress: creatorAccount,
|
|
33
|
-
quantityToMint: 1,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const oldBalance = await publicClient.readContract({
|
|
38
|
-
abi: zoraCreator1155ImplABI,
|
|
39
|
-
address: targetContract,
|
|
40
|
-
functionName: "balanceOf",
|
|
41
|
-
args: [creatorAccount, targetTokenId],
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
const simulationResult = await publicClient.simulateContract(params);
|
|
45
|
-
|
|
46
|
-
const hash = await walletClient.writeContract(simulationResult.request);
|
|
47
|
-
const receipt = await publicClient.waitForTransactionReceipt({ hash });
|
|
48
|
-
const newBalance = await publicClient.readContract({
|
|
49
|
-
abi: zoraCreator1155ImplABI,
|
|
50
|
-
address: targetContract,
|
|
51
|
-
functionName: "balanceOf",
|
|
52
|
-
args: [creatorAccount, targetTokenId],
|
|
53
|
-
});
|
|
54
|
-
expect(receipt).to.not.be.null;
|
|
55
|
-
expect(oldBalance).to.be.equal(0n);
|
|
56
|
-
expect(newBalance).to.be.equal(1n);
|
|
57
|
-
},
|
|
58
|
-
12 * 1000,
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
makeAnvilTest({
|
|
62
|
-
forkUrl: forkUrls.zoraMainnet,
|
|
63
|
-
forkBlockNumber: 6133407,
|
|
64
|
-
})(
|
|
65
|
-
"mints a new 721 token",
|
|
66
|
-
async ({ viemClients }) => {
|
|
67
|
-
const { testClient, walletClient, publicClient } = viemClients;
|
|
68
|
-
const creatorAccount = (await walletClient.getAddresses())[0]!;
|
|
69
|
-
await testClient.setBalance({
|
|
70
|
-
address: creatorAccount,
|
|
71
|
-
value: parseEther("2000"),
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
const targetContract: Address =
|
|
75
|
-
"0x7aae7e67515A2CbB8585C707Ca6db37BDd3EA839";
|
|
76
|
-
const targetTokenId = undefined;
|
|
77
|
-
const minter = createMintClient({ chain: zora });
|
|
78
|
-
|
|
79
|
-
const params = await minter.makePrepareMintTokenParams({
|
|
80
|
-
tokenId: targetTokenId,
|
|
81
|
-
tokenAddress: targetContract,
|
|
82
|
-
minterAccount: creatorAccount,
|
|
83
|
-
mintArguments: {
|
|
84
|
-
mintToAddress: creatorAccount,
|
|
85
|
-
quantityToMint: 1,
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
const oldBalance = await publicClient.readContract({
|
|
89
|
-
abi: erc721ABI,
|
|
90
|
-
address: targetContract,
|
|
91
|
-
functionName: "balanceOf",
|
|
92
|
-
args: [creatorAccount],
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
const simulated = await publicClient.simulateContract(params);
|
|
96
|
-
|
|
97
|
-
const hash = await walletClient.writeContract(simulated.request);
|
|
98
|
-
|
|
99
|
-
const receipt = await publicClient.waitForTransactionReceipt({ hash });
|
|
100
|
-
expect(receipt).not.to.be.null;
|
|
101
|
-
|
|
102
|
-
const newBalance = await publicClient.readContract({
|
|
103
|
-
abi: erc721ABI,
|
|
104
|
-
address: targetContract,
|
|
105
|
-
functionName: "balanceOf",
|
|
106
|
-
args: [creatorAccount],
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
expect(oldBalance).to.be.equal(0n);
|
|
110
|
-
expect(newBalance).to.be.equal(1n);
|
|
111
|
-
},
|
|
112
|
-
12 * 1000,
|
|
113
|
-
);
|
|
114
|
-
});
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import { foundry } from "viem/chains";
|
|
2
|
-
import { describe, expect, vi } from "vitest";
|
|
3
|
-
|
|
4
|
-
import { createPremintClient } from "./premint-client";
|
|
5
|
-
import { anvilTest } from "src/anvil";
|
|
6
|
-
import { PremintConfigVersion } from "./contract-types";
|
|
7
|
-
import { getDefaultFixedPriceMinterAddress } from "./preminter";
|
|
8
|
-
|
|
9
|
-
describe("ZoraCreator1155Premint - v1 signatures", () => {
|
|
10
|
-
anvilTest(
|
|
11
|
-
"can sign by default v1 on the forked premint contract",
|
|
12
|
-
async ({ viemClients: { walletClient, publicClient, chain } }) => {
|
|
13
|
-
const [deployerAccount] = await walletClient.getAddresses();
|
|
14
|
-
const premintClient = createPremintClient({
|
|
15
|
-
chain,
|
|
16
|
-
publicClient,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
premintClient.apiClient.getNextUID = vi
|
|
20
|
-
.fn<any, ReturnType<typeof premintClient.apiClient.getNextUID>>()
|
|
21
|
-
.mockResolvedValue(3);
|
|
22
|
-
premintClient.apiClient.postSignature = vi
|
|
23
|
-
.fn<Parameters<typeof premintClient.apiClient.postSignature>>()
|
|
24
|
-
.mockResolvedValue({ ok: true });
|
|
25
|
-
|
|
26
|
-
await premintClient.createPremint({
|
|
27
|
-
walletClient,
|
|
28
|
-
creatorAccount: deployerAccount!,
|
|
29
|
-
checkSignature: true,
|
|
30
|
-
collection: {
|
|
31
|
-
contractAdmin: deployerAccount!,
|
|
32
|
-
contractName: "Testing Contract",
|
|
33
|
-
contractURI:
|
|
34
|
-
"ipfs://bafkreiainxen4b4wz4ubylvbhons6rembxdet4a262nf2lziclqvv7au3e",
|
|
35
|
-
},
|
|
36
|
-
tokenCreationConfig: {
|
|
37
|
-
tokenURI:
|
|
38
|
-
"ipfs://bafkreice23maski3x52tsfqgxstx3kbiifnt5jotg3a5ynvve53c4soi2u",
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
const expectedPostSignatureArgs: Parameters<
|
|
43
|
-
typeof premintClient.apiClient.postSignature
|
|
44
|
-
>[0] = {
|
|
45
|
-
collection: {
|
|
46
|
-
contractAdmin: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
47
|
-
contractName: "Testing Contract",
|
|
48
|
-
contractURI:
|
|
49
|
-
"ipfs://bafkreiainxen4b4wz4ubylvbhons6rembxdet4a262nf2lziclqvv7au3e",
|
|
50
|
-
},
|
|
51
|
-
premintConfig: {
|
|
52
|
-
deleted: false,
|
|
53
|
-
tokenConfig: {
|
|
54
|
-
fixedPriceMinter: getDefaultFixedPriceMinterAddress(chain.id),
|
|
55
|
-
maxSupply: 18446744073709551615n,
|
|
56
|
-
maxTokensPerAddress: 0n,
|
|
57
|
-
mintDuration: 604800n,
|
|
58
|
-
mintStart: 0n,
|
|
59
|
-
pricePerToken: 0n,
|
|
60
|
-
royaltyBPS: 1000,
|
|
61
|
-
royaltyMintSchedule: 0,
|
|
62
|
-
royaltyRecipient: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
63
|
-
tokenURI:
|
|
64
|
-
"ipfs://bafkreice23maski3x52tsfqgxstx3kbiifnt5jotg3a5ynvve53c4soi2u",
|
|
65
|
-
},
|
|
66
|
-
uid: 3,
|
|
67
|
-
version: 0,
|
|
68
|
-
},
|
|
69
|
-
premintConfigVersion: PremintConfigVersion.V1,
|
|
70
|
-
signature:
|
|
71
|
-
"0x70fc1d6e862c42f2b0e4a062f4eb973cc8692df58a24b71b4fe91ae7baa5a26d2c99b1b8ab61f64ff431bf30b0897877b11b7405542c90b89b041808f1561a6c1c",
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
expect(premintClient.apiClient.postSignature).toHaveBeenCalledWith(
|
|
75
|
-
expectedPostSignatureArgs,
|
|
76
|
-
);
|
|
77
|
-
},
|
|
78
|
-
20 * 1000,
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
anvilTest(
|
|
82
|
-
"can execute premint on network",
|
|
83
|
-
async ({ viemClients: { walletClient, publicClient, chain } }) => {
|
|
84
|
-
const [deployerAccount] = await walletClient.getAddresses();
|
|
85
|
-
const premintClient = createPremintClient({
|
|
86
|
-
chain: foundry,
|
|
87
|
-
publicClient,
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
premintClient.apiClient.getSignature = vi
|
|
91
|
-
.fn<any, ReturnType<typeof premintClient.apiClient.getSignature>>()
|
|
92
|
-
.mockResolvedValue({
|
|
93
|
-
collection: {
|
|
94
|
-
contractAdmin: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
95
|
-
contractName: "Testing Contract",
|
|
96
|
-
contractURI:
|
|
97
|
-
"ipfs://bafkreiainxen4b4wz4ubylvbhons6rembxdet4a262nf2lziclqvv7au3e",
|
|
98
|
-
},
|
|
99
|
-
premintConfig: {
|
|
100
|
-
deleted: false,
|
|
101
|
-
tokenConfig: {
|
|
102
|
-
fixedPriceMinter: getDefaultFixedPriceMinterAddress(chain.id),
|
|
103
|
-
maxSupply: 18446744073709551615n,
|
|
104
|
-
maxTokensPerAddress: 0n,
|
|
105
|
-
mintDuration: 604800n,
|
|
106
|
-
mintStart: 0n,
|
|
107
|
-
pricePerToken: 0n,
|
|
108
|
-
royaltyBPS: 1000,
|
|
109
|
-
royaltyMintSchedule: 0,
|
|
110
|
-
royaltyRecipient: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
111
|
-
tokenURI:
|
|
112
|
-
"ipfs://bafkreice23maski3x52tsfqgxstx3kbiifnt5jotg3a5ynvve53c4soi2u",
|
|
113
|
-
},
|
|
114
|
-
uid: 3,
|
|
115
|
-
version: 0,
|
|
116
|
-
},
|
|
117
|
-
premintConfigVersion: PremintConfigVersion.V1,
|
|
118
|
-
signature:
|
|
119
|
-
"0x70fc1d6e862c42f2b0e4a062f4eb973cc8692df58a24b71b4fe91ae7baa5a26d2c99b1b8ab61f64ff431bf30b0897877b11b7405542c90b89b041808f1561a6c1c",
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
premintClient.apiClient.postSignature = vi.fn();
|
|
123
|
-
|
|
124
|
-
const simulateContractParameters = await premintClient.makeMintParameters(
|
|
125
|
-
{
|
|
126
|
-
minterAccount: deployerAccount!,
|
|
127
|
-
tokenContract: "0xf8dA7f53c283d898818af7FB9d98103F559bDac2",
|
|
128
|
-
uid: 3,
|
|
129
|
-
mintArguments: {
|
|
130
|
-
quantityToMint: 1,
|
|
131
|
-
mintComment: "",
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
);
|
|
135
|
-
const { request: simulateRequest } = await publicClient.simulateContract(
|
|
136
|
-
simulateContractParameters,
|
|
137
|
-
);
|
|
138
|
-
const hash = await walletClient.writeContract(simulateRequest);
|
|
139
|
-
const receipt = await publicClient.waitForTransactionReceipt({ hash });
|
|
140
|
-
const { premintedLog, urls } =
|
|
141
|
-
premintClient.getDataFromPremintReceipt(receipt);
|
|
142
|
-
|
|
143
|
-
expect(urls).toEqual({
|
|
144
|
-
explorer:
|
|
145
|
-
"https://undefined/token/0xf8dA7f53c283d898818af7FB9d98103F559bDac2/instance/1",
|
|
146
|
-
zoraCollect:
|
|
147
|
-
"https://testnet.zora.co/collect/zgor:0xf8dA7f53c283d898818af7FB9d98103F559bDac2/1",
|
|
148
|
-
zoraManage:
|
|
149
|
-
"https://testnet.zora.co/collect/zgor:0xf8dA7f53c283d898818af7FB9d98103F559bDac2/1",
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
expect(premintedLog).toEqual({
|
|
153
|
-
contractAddress: "0xf8dA7f53c283d898818af7FB9d98103F559bDac2",
|
|
154
|
-
createdNewContract: expect.any(Boolean),
|
|
155
|
-
minter: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
156
|
-
quantityMinted: 1n,
|
|
157
|
-
tokenId: 1n,
|
|
158
|
-
uid: 3,
|
|
159
|
-
});
|
|
160
|
-
},
|
|
161
|
-
20 * 1000,
|
|
162
|
-
);
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
describe("ZoraCreator1155Premint - v2 signatures", () => {
|
|
166
|
-
anvilTest(
|
|
167
|
-
"can sign on the forked premint contract",
|
|
168
|
-
async ({ viemClients: { walletClient, publicClient, chain } }) => {
|
|
169
|
-
const [creatorAccount, createReferralAccount] =
|
|
170
|
-
await walletClient.getAddresses();
|
|
171
|
-
const premintClient = createPremintClient({
|
|
172
|
-
chain,
|
|
173
|
-
publicClient,
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
premintClient.apiClient.getNextUID = vi
|
|
177
|
-
.fn<any, ReturnType<typeof premintClient.apiClient.getNextUID>>()
|
|
178
|
-
.mockResolvedValue(3);
|
|
179
|
-
premintClient.apiClient.postSignature = vi
|
|
180
|
-
.fn<Parameters<typeof premintClient.apiClient.postSignature>>()
|
|
181
|
-
.mockResolvedValue({ ok: true });
|
|
182
|
-
|
|
183
|
-
await premintClient.createPremint({
|
|
184
|
-
walletClient,
|
|
185
|
-
creatorAccount: creatorAccount!,
|
|
186
|
-
checkSignature: true,
|
|
187
|
-
collection: {
|
|
188
|
-
contractAdmin: creatorAccount!,
|
|
189
|
-
contractName: "Testing Contract Premint V2",
|
|
190
|
-
contractURI:
|
|
191
|
-
"ipfs://bafkreiainxen4b4wz4ubylvbhons6rembxdet4a262nf2lziclqvv7au3e",
|
|
192
|
-
},
|
|
193
|
-
premintConfigVersion: PremintConfigVersion.V2,
|
|
194
|
-
tokenCreationConfig: {
|
|
195
|
-
tokenURI:
|
|
196
|
-
"ipfs://bafkreice23maski3x52tsfqgxstx3kbiifnt5jotg3a5ynvve53c4soi2u",
|
|
197
|
-
createReferral: createReferralAccount,
|
|
198
|
-
},
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
const expectedPostSignatureArgs: Parameters<
|
|
202
|
-
typeof premintClient.apiClient.postSignature
|
|
203
|
-
>[0] = {
|
|
204
|
-
collection: {
|
|
205
|
-
contractAdmin: creatorAccount!,
|
|
206
|
-
contractName: "Testing Contract Premint V2",
|
|
207
|
-
contractURI:
|
|
208
|
-
"ipfs://bafkreiainxen4b4wz4ubylvbhons6rembxdet4a262nf2lziclqvv7au3e",
|
|
209
|
-
},
|
|
210
|
-
premintConfig: {
|
|
211
|
-
deleted: false,
|
|
212
|
-
tokenConfig: {
|
|
213
|
-
fixedPriceMinter: "0x04E2516A2c207E84a1839755675dfd8eF6302F0a",
|
|
214
|
-
maxSupply: 18446744073709551615n,
|
|
215
|
-
maxTokensPerAddress: 0n,
|
|
216
|
-
mintDuration: 604800n,
|
|
217
|
-
mintStart: 0n,
|
|
218
|
-
pricePerToken: 0n,
|
|
219
|
-
royaltyBPS: 1000,
|
|
220
|
-
payoutRecipient: creatorAccount!,
|
|
221
|
-
createReferral: createReferralAccount!,
|
|
222
|
-
tokenURI:
|
|
223
|
-
"ipfs://bafkreice23maski3x52tsfqgxstx3kbiifnt5jotg3a5ynvve53c4soi2u",
|
|
224
|
-
},
|
|
225
|
-
uid: 3,
|
|
226
|
-
version: 0,
|
|
227
|
-
},
|
|
228
|
-
premintConfigVersion: PremintConfigVersion.V2,
|
|
229
|
-
signature:
|
|
230
|
-
"0x8be7932b0b31bdb7fc9269b756e0d0c9514519f083d86576e23b73c033d8ed8440ea363bc8bba0ec5c30eb6bbdf796163a324201bc7520965037102518fb5e991c",
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
expect(premintClient.apiClient.postSignature).toHaveBeenCalledWith(
|
|
234
|
-
expectedPostSignatureArgs,
|
|
235
|
-
);
|
|
236
|
-
},
|
|
237
|
-
20 * 1000,
|
|
238
|
-
);
|
|
239
|
-
});
|