@zoralabs/protocol-sdk 0.11.11 → 0.12.0
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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +17 -0
- package/dist/apis/network-config.d.ts +3 -0
- package/dist/apis/network-config.d.ts.map +1 -0
- package/dist/create/contract-setup.d.ts +3 -4
- package/dist/create/contract-setup.d.ts.map +1 -1
- package/dist/create/create-client.d.ts +53 -0
- package/dist/create/create-client.d.ts.map +1 -0
- package/dist/create/types.d.ts +11 -3
- package/dist/create/types.d.ts.map +1 -1
- package/dist/fixtures/contract-setup.d.ts +2 -2
- package/dist/fixtures/contract-setup.d.ts.map +1 -1
- package/dist/fixtures/rewards-query-results.d.ts +0 -1
- package/dist/fixtures/rewards-query-results.d.ts.map +1 -1
- package/dist/fixtures/secondary.d.ts +3 -6
- package/dist/fixtures/secondary.d.ts.map +1 -1
- package/dist/index.cjs +1509 -1396
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1559 -1465
- package/dist/index.js.map +1 -1
- package/dist/mint/mint-client.d.ts +21 -9
- package/dist/mint/mint-client.d.ts.map +1 -1
- package/dist/mint/mint-queries.d.ts +24 -22
- package/dist/mint/mint-queries.d.ts.map +1 -1
- package/dist/mint/strategies-parsing.d.ts +28 -0
- package/dist/mint/strategies-parsing.d.ts.map +1 -0
- package/dist/mint/subgraph-mint-getter.d.ts +2 -6
- package/dist/mint/subgraph-mint-getter.d.ts.map +1 -1
- package/dist/mint/types.d.ts +25 -8
- package/dist/mint/types.d.ts.map +1 -1
- package/dist/premint/premint-api-client.d.ts.map +1 -1
- package/dist/premint/premint-client.d.ts.map +1 -1
- package/dist/rewards/rewards-client.d.ts +7 -3
- package/dist/rewards/rewards-client.d.ts.map +1 -1
- package/dist/rewards/rewards-queries.d.ts +14 -11
- package/dist/rewards/rewards-queries.d.ts.map +1 -1
- package/dist/rewards/subgraph-queries.d.ts +0 -1
- package/dist/rewards/subgraph-queries.d.ts.map +1 -1
- package/dist/rewards/subgraph-rewards-getter.d.ts +2 -8
- package/dist/rewards/subgraph-rewards-getter.d.ts.map +1 -1
- package/dist/sdk.d.ts +9 -3
- package/dist/sdk.d.ts.map +1 -1
- package/dist/secondary/secondary-client.d.ts +7 -8
- package/dist/secondary/secondary-client.d.ts.map +1 -1
- package/dist/secondary/uniswap/uniswapQuote.d.ts +0 -1
- package/dist/secondary/uniswap/uniswapQuote.d.ts.map +1 -1
- package/dist/secondary/utils.d.ts +1 -2
- package/dist/secondary/utils.d.ts.map +1 -1
- package/dist/types.d.ts +6 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +2 -2
- package/dist/utils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/apis/network-config.ts +8 -0
- package/src/apis/subgraph-getter.ts +1 -1
- package/src/comments/comments.test.ts +11 -22
- package/src/create/contract-setup.ts +3 -4
- package/src/create/{1155-create-helper.test.ts → create-client.test.ts} +52 -88
- package/src/create/{1155-create-helper.ts → create-client.ts} +129 -63
- package/src/create/types.ts +13 -3
- package/src/fixtures/contract-setup.ts +3 -3
- package/src/fixtures/rewards-query-results.ts +2 -9
- package/src/fixtures/secondary.ts +16 -10
- package/src/index.ts +34 -4
- package/src/mint/mint-client.test.ts +37 -64
- package/src/mint/mint-client.ts +36 -32
- package/src/mint/mint-queries.ts +73 -54
- package/src/mint/strategies-parsing.ts +311 -0
- package/src/mint/subgraph-mint-getter.ts +4 -304
- package/src/mint/types.ts +36 -7
- package/src/premint/premint-api-client.ts +1 -1
- package/src/premint/premint-client.ts +1 -1
- package/src/rewards/rewards-client.test.ts +318 -21
- package/src/rewards/rewards-client.ts +15 -16
- package/src/rewards/rewards-queries.ts +116 -36
- package/src/rewards/subgraph-queries.ts +0 -2
- package/src/rewards/subgraph-rewards-getter.ts +3 -13
- package/src/sdk.ts +9 -7
- package/src/secondary/secondary-client.test.ts +39 -40
- package/src/secondary/secondary-client.ts +14 -33
- package/src/secondary/uniswap/uniswapQuote.ts +3 -2
- package/src/secondary/utils.ts +2 -2
- package/src/types.ts +15 -4
- package/src/utils.ts +9 -3
- package/dist/create/1155-create-helper.d.ts +0 -29
- package/dist/create/1155-create-helper.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniswapQuote.d.ts","sourceRoot":"","sources":["../../../src/secondary/uniswap/uniswapQuote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAY,MAAM,MAAM,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAOzC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAoD1C,KAAK,aAAa,GAAG;IAEnB,IAAI,EAAE,KAAK,GAAG,MAAM,CAAC;IAErB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"uniswapQuote.d.ts","sourceRoot":"","sources":["../../../src/secondary/uniswap/uniswapQuote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAY,MAAM,MAAM,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAOzC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAoD1C,KAAK,aAAa,GAAG;IAEnB,IAAI,EAAE,KAAK,GAAG,MAAM,CAAC;IAErB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AACF,wBAAsB,eAAe,CACnC,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,cAAc,CAAC,CA8DzB"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Address } from "viem";
|
|
2
2
|
import { PublicClient } from "src/utils";
|
|
3
3
|
import { SecondaryInfo } from "./types";
|
|
4
|
-
export declare function getSecondaryInfo({ contract, tokenId, publicClient,
|
|
4
|
+
export declare function getSecondaryInfo({ contract, tokenId, publicClient, }: {
|
|
5
5
|
contract: Address;
|
|
6
6
|
tokenId: bigint;
|
|
7
7
|
publicClient: PublicClient;
|
|
8
|
-
chainId: number;
|
|
9
8
|
}): Promise<SecondaryInfo | undefined>;
|
|
10
9
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/secondary/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAc,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAKzC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAMxC,wBAAsB,gBAAgB,CAAC,EACrC,QAAQ,EACR,OAAO,EACP,YAAY,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/secondary/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAc,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAKzC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAMxC,wBAAsB,gBAAgB,CAAC,EACrC,QAAQ,EACR,OAAO,EACP,YAAY,GACb,EAAE;IACD,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,YAAY,CAAC;CAC5B,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAmDrC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { Account, Address, SimulateContractParameters } from "viem";
|
|
2
|
-
import { PublicClient } from "src/utils";
|
|
1
|
+
import { Account, Address, PublicClient, SimulateContractParameters, Transport, Chain } from "viem";
|
|
3
2
|
export type GenericTokenIdTypes = number | bigint | string;
|
|
4
|
-
export type IPublicClient = Pick<PublicClient, "readContract" | "getBlock" | "simulateContract" | "getBalance">;
|
|
3
|
+
export type IPublicClient = Pick<PublicClient<Transport, Chain>, "readContract" | "getBlock" | "simulateContract" | "getBalance" | "chain">;
|
|
4
|
+
export type WithPublicClient<T> = T & {
|
|
5
|
+
/** Public client used to read data from the blockchain. Chain id will determine which chain is used. */
|
|
6
|
+
publicClient: IPublicClient;
|
|
7
|
+
};
|
|
5
8
|
export type SimulateContractParametersWithAccount = SimulateContractParameters<any, any, any, any, any, Account | Address>;
|
|
6
9
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,OAAO,EACP,YAAY,EACZ,0BAA0B,EAC1B,SAAS,EACT,KAAK,EACN,MAAM,MAAM,CAAC;AAEd,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAE3D,MAAM,MAAM,aAAa,GAAG,IAAI,CAC9B,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,EAC9B,cAAc,GAAG,UAAU,GAAG,kBAAkB,GAAG,YAAY,GAAG,OAAO,CAC1E,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,GAAG;IACpC,yGAAyG;IACzG,YAAY,EAAE,aAAa,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,qCAAqC,GAAG,0BAA0B,CAC5E,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,OAAO,GAAG,OAAO,CAClB,CAAC"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Account, Address, PublicClient as BasePublicClient } from "viem";
|
|
1
|
+
import { Account, Address, PublicClient as BasePublicClient, Transport, Chain } from "viem";
|
|
2
2
|
import { SimulateContractParametersWithAccount } from "./types";
|
|
3
3
|
export declare const makeContractParameters: (args: SimulateContractParametersWithAccount) => SimulateContractParametersWithAccount;
|
|
4
|
-
export type PublicClient = Pick<BasePublicClient, "readContract" | "getBlock" | "simulateContract" | "getBalance">;
|
|
4
|
+
export type PublicClient = Pick<BasePublicClient<Transport, Chain>, "readContract" | "getBlock" | "simulateContract" | "getBalance" | "chain">;
|
|
5
5
|
export type ClientConfig = {
|
|
6
6
|
/** The chain that the client is to run on. */
|
|
7
7
|
chainId: number;
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,OAAO,EACP,YAAY,IAAI,gBAAgB,EAChC,SAAS,EACT,KAAK,EACN,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,qCAAqC,EAAE,MAAM,SAAS,CAAC;AAEhE,eAAO,MAAM,sBAAsB,SAC3B,qCAAqC,0CACpC,CAAC;AAEV,MAAM,MAAM,YAAY,GAAG,IAAI,CAC7B,gBAAgB,CAAC,SAAS,EAAE,KAAK,CAAC,EAClC,cAAc,GAAG,UAAU,GAAG,kBAAkB,GAAG,YAAY,GAAG,OAAO,CAC1E,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,YAAY,EAAE,YAAY,CAAC;CAC5B,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,YAAY;;;EAKlE;AAED,wBAAgB,sBAAsB,CAAC,EACrC,aAAa,EACb,aAAa,GACd,EAAE;IACD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC;CAClC,GAAG,OAAO,CAKV;AAED,MAAM,MAAM,QAAQ,CAAC,IAAI,IAAI;KAC1B,QAAQ,IAAI,MAAM,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;CAC3C,CAAC;AAEF,eAAO,MAAM,uBAAuB,YAAa,OAAO,GAAG,OAAO,kBACT,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zoralabs/protocol-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"repository": "https://github.com/ourzora/zora-protocol",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@zoralabs/protocol-deployments": "^0.
|
|
19
|
+
"@zoralabs/protocol-deployments": "^0.4.0"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"viem": "^2.21.21",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NetworkConfig, networkConfigByChain } from "./chain-constants";
|
|
2
|
+
|
|
3
|
+
export const getApiNetworkConfigForChain = (chainId: number): NetworkConfig => {
|
|
4
|
+
if (!networkConfigByChain[chainId]) {
|
|
5
|
+
throw new Error(`chain id ${chainId} network not configured `);
|
|
6
|
+
}
|
|
7
|
+
return networkConfigByChain[chainId]!;
|
|
8
|
+
};
|
|
@@ -25,12 +25,12 @@ import {
|
|
|
25
25
|
parseEventLogs,
|
|
26
26
|
hashTypedData,
|
|
27
27
|
} from "viem";
|
|
28
|
-
import { createCreatorClient } from "src/sdk";
|
|
29
|
-
import { randomNewContract } from "src/test-utils";
|
|
30
28
|
import { waitForSuccess } from "src/waitForSuccess";
|
|
29
|
+
import { randomNewContract } from "src/test-utils";
|
|
31
30
|
import { permitCommentTypedDataDefinition } from "@zoralabs/protocol-deployments";
|
|
32
31
|
import { demoTokenMetadataURI } from "src/fixtures/contract-setup";
|
|
33
32
|
import { randomNonce, thirtySecondsFromNow } from "src/test-utils";
|
|
33
|
+
import { create1155 } from "src/create/create-client";
|
|
34
34
|
|
|
35
35
|
const getCommentIdentifierFromReceipt = (
|
|
36
36
|
receipt: TransactionReceipt,
|
|
@@ -73,20 +73,15 @@ describe("comments", () => {
|
|
|
73
73
|
Address,
|
|
74
74
|
];
|
|
75
75
|
|
|
76
|
-
// Create a creator client for interacting with the protocol
|
|
77
|
-
const creatorClient = createCreatorClient({
|
|
78
|
-
chainId,
|
|
79
|
-
publicClient,
|
|
80
|
-
});
|
|
81
|
-
|
|
82
76
|
// Step 1: Create a new 1155 contract and token
|
|
83
77
|
const { contractAddress, newTokenId, parameters, prepareMint } =
|
|
84
|
-
await
|
|
78
|
+
await create1155({
|
|
85
79
|
contract: randomNewContract(),
|
|
86
80
|
token: {
|
|
87
81
|
tokenMetadataURI: demoTokenMetadataURI,
|
|
88
82
|
},
|
|
89
83
|
account: creatorAddress,
|
|
84
|
+
publicClient,
|
|
90
85
|
});
|
|
91
86
|
|
|
92
87
|
// Deploy the new contract
|
|
@@ -247,22 +242,16 @@ describe("comments", () => {
|
|
|
247
242
|
const [commenterAddress, executorAddress] =
|
|
248
243
|
(await walletClient.getAddresses()!) as [Address, Address, Address];
|
|
249
244
|
|
|
250
|
-
// Create a
|
|
251
|
-
const
|
|
252
|
-
|
|
245
|
+
// Step 1: Create a new 1155 contract and token
|
|
246
|
+
const { contractAddress, newTokenId, parameters } = await create1155({
|
|
247
|
+
contract: randomNewContract(),
|
|
248
|
+
token: {
|
|
249
|
+
tokenMetadataURI: demoTokenMetadataURI,
|
|
250
|
+
},
|
|
251
|
+
account: commenterAddress,
|
|
253
252
|
publicClient,
|
|
254
253
|
});
|
|
255
254
|
|
|
256
|
-
// Step 1: Create a new 1155 contract and token
|
|
257
|
-
const { contractAddress, newTokenId, parameters } =
|
|
258
|
-
await creatorClient.create1155({
|
|
259
|
-
contract: randomNewContract(),
|
|
260
|
-
token: {
|
|
261
|
-
tokenMetadataURI: demoTokenMetadataURI,
|
|
262
|
-
},
|
|
263
|
-
account: commenterAddress,
|
|
264
|
-
});
|
|
265
|
-
|
|
266
255
|
// Deploy the new contract
|
|
267
256
|
const { request } = await publicClient.simulateContract(parameters);
|
|
268
257
|
await writeContractWithRetries({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address, Hex, PublicClient } from "viem";
|
|
1
|
+
import { Address, Hex, PublicClient, Transport, Chain } from "viem";
|
|
2
2
|
import {
|
|
3
3
|
contracts1155,
|
|
4
4
|
zoraCreator1155FactoryImplABI,
|
|
@@ -23,15 +23,14 @@ export async function getDeterministicContractAddress({
|
|
|
23
23
|
account,
|
|
24
24
|
setupActions,
|
|
25
25
|
contract,
|
|
26
|
-
chainId,
|
|
27
26
|
}: {
|
|
28
27
|
account: Address;
|
|
29
|
-
publicClient: Pick<PublicClient, "readContract">;
|
|
28
|
+
publicClient: Pick<PublicClient<Transport, Chain>, "readContract" | "chain">;
|
|
30
29
|
setupActions: Hex[];
|
|
31
30
|
contract: NewContractParams;
|
|
32
|
-
chainId: number;
|
|
33
31
|
// Account that is the creator of the contract
|
|
34
32
|
}): Promise<Address> {
|
|
33
|
+
const chainId = publicClient.chain.id;
|
|
35
34
|
const contractAddress = await publicClient.readContract({
|
|
36
35
|
abi: zoraCreator1155FactoryImplABI,
|
|
37
36
|
address:
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { describe, expect, vi } from "vitest";
|
|
2
2
|
import {
|
|
3
|
+
create1155,
|
|
4
|
+
createNew1155Token,
|
|
3
5
|
getContractAddressFromReceipt,
|
|
4
6
|
getTokenIdFromCreateReceipt,
|
|
5
|
-
} from "./
|
|
6
|
-
import { createCollectorClient, createCreatorClient } from "src/sdk";
|
|
7
|
+
} from "./create-client";
|
|
7
8
|
import {
|
|
8
9
|
zoraCreator1155ImplABI,
|
|
9
10
|
zoraTimedSaleStrategyABI,
|
|
@@ -27,6 +28,7 @@ import {
|
|
|
27
28
|
} from "./minter-defaults";
|
|
28
29
|
import { randomNewContract } from "src/test-utils";
|
|
29
30
|
import { demoTokenMetadataURI } from "src/fixtures/contract-setup";
|
|
31
|
+
import { getSecondaryInfo } from "src/secondary/utils";
|
|
30
32
|
|
|
31
33
|
const anvilTest = makeAnvilTest({
|
|
32
34
|
forkUrl: forkUrls.zoraMainnet,
|
|
@@ -64,18 +66,13 @@ describe("create-helper", () => {
|
|
|
64
66
|
const addresses = await walletClient.getAddresses();
|
|
65
67
|
const creatorAddress = addresses[0]!;
|
|
66
68
|
|
|
67
|
-
const creatorClient = createCreatorClient({
|
|
68
|
-
chainId: chain.id,
|
|
69
|
-
publicClient: publicClient,
|
|
70
|
-
});
|
|
71
|
-
|
|
72
69
|
const saleStart = 5n;
|
|
73
70
|
const contract = randomNewContract();
|
|
74
71
|
const {
|
|
75
72
|
parameters: parameters,
|
|
76
73
|
contractAddress,
|
|
77
74
|
newTokenId,
|
|
78
|
-
} = await
|
|
75
|
+
} = await create1155({
|
|
79
76
|
contract,
|
|
80
77
|
token: {
|
|
81
78
|
tokenMetadataURI: demoTokenMetadataURI,
|
|
@@ -86,6 +83,7 @@ describe("create-helper", () => {
|
|
|
86
83
|
},
|
|
87
84
|
},
|
|
88
85
|
account: creatorAddress,
|
|
86
|
+
publicClient,
|
|
89
87
|
});
|
|
90
88
|
|
|
91
89
|
const { request } = await publicClient.simulateContract(parameters);
|
|
@@ -141,14 +139,10 @@ describe("create-helper", () => {
|
|
|
141
139
|
// get secondary info, minimum mints count should be 1111, sale end should be undefined,
|
|
142
140
|
// market countdown should be 24 hours
|
|
143
141
|
|
|
144
|
-
const
|
|
145
|
-
chainId: chain.id,
|
|
146
|
-
publicClient,
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
const secondaryInfo = await collectorClient.getSecondaryInfo({
|
|
142
|
+
const secondaryInfo = await getSecondaryInfo({
|
|
150
143
|
contract: contractAddress,
|
|
151
144
|
tokenId: newTokenId,
|
|
145
|
+
publicClient,
|
|
152
146
|
});
|
|
153
147
|
|
|
154
148
|
expect(secondaryInfo).toBeDefined();
|
|
@@ -165,28 +159,23 @@ describe("create-helper", () => {
|
|
|
165
159
|
const addresses = await walletClient.getAddresses();
|
|
166
160
|
const creatorAddress = addresses[0]!;
|
|
167
161
|
|
|
168
|
-
const creatorClient = createCreatorClient({
|
|
169
|
-
chainId: chain.id,
|
|
170
|
-
publicClient: publicClient,
|
|
171
|
-
});
|
|
172
|
-
|
|
173
162
|
const saleStart = 5n;
|
|
174
163
|
const contract = randomNewContract();
|
|
175
|
-
const { parameters, contractAddress, newTokenId } =
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
type: "timed",
|
|
186
|
-
},
|
|
164
|
+
const { parameters, contractAddress, newTokenId } = await create1155({
|
|
165
|
+
contract,
|
|
166
|
+
token: {
|
|
167
|
+
tokenMetadataURI: demoTokenMetadataURI,
|
|
168
|
+
mintToCreatorCount: 1,
|
|
169
|
+
salesConfig: {
|
|
170
|
+
saleStart,
|
|
171
|
+
minimumMintsForCountdown: 500n,
|
|
172
|
+
marketCountdown: 100n,
|
|
173
|
+
type: "timed",
|
|
187
174
|
},
|
|
188
|
-
|
|
189
|
-
|
|
175
|
+
},
|
|
176
|
+
account: creatorAddress,
|
|
177
|
+
publicClient,
|
|
178
|
+
});
|
|
190
179
|
|
|
191
180
|
await simulateAndWriteContractWithRetries({
|
|
192
181
|
parameters,
|
|
@@ -194,12 +183,10 @@ describe("create-helper", () => {
|
|
|
194
183
|
publicClient,
|
|
195
184
|
});
|
|
196
185
|
|
|
197
|
-
const secondaryInfo = await
|
|
198
|
-
chainId: chain.id,
|
|
199
|
-
publicClient,
|
|
200
|
-
}).getSecondaryInfo({
|
|
186
|
+
const secondaryInfo = await getSecondaryInfo({
|
|
201
187
|
contract: contractAddress,
|
|
202
188
|
tokenId: newTokenId,
|
|
189
|
+
publicClient,
|
|
203
190
|
});
|
|
204
191
|
|
|
205
192
|
expect(secondaryInfo).toBeDefined();
|
|
@@ -214,15 +201,11 @@ describe("create-helper", () => {
|
|
|
214
201
|
const addresses = await walletClient.getAddresses();
|
|
215
202
|
const creatorAddress = addresses[0]!;
|
|
216
203
|
|
|
217
|
-
const creatorClient = createCreatorClient({
|
|
218
|
-
chainId: chain.id,
|
|
219
|
-
publicClient: publicClient,
|
|
220
|
-
});
|
|
221
204
|
const {
|
|
222
205
|
parameters: parameters,
|
|
223
206
|
contractAddress,
|
|
224
207
|
newTokenId,
|
|
225
|
-
} = await
|
|
208
|
+
} = await create1155({
|
|
226
209
|
contract: randomNewContract(),
|
|
227
210
|
token: {
|
|
228
211
|
tokenMetadataURI: demoTokenMetadataURI,
|
|
@@ -231,6 +214,7 @@ describe("create-helper", () => {
|
|
|
231
214
|
},
|
|
232
215
|
},
|
|
233
216
|
account: creatorAddress,
|
|
217
|
+
publicClient,
|
|
234
218
|
});
|
|
235
219
|
|
|
236
220
|
const { request } = await publicClient.simulateContract(parameters);
|
|
@@ -260,20 +244,15 @@ describe("create-helper", () => {
|
|
|
260
244
|
|
|
261
245
|
const contractGetter = new SubgraphContractGetter(chain.id);
|
|
262
246
|
|
|
263
|
-
const creatorClient = createCreatorClient({
|
|
264
|
-
chainId: chain.id,
|
|
265
|
-
publicClient: publicClient,
|
|
266
|
-
contractGetter,
|
|
267
|
-
});
|
|
268
|
-
|
|
269
247
|
const { parameters: request, contractAddress: contractAddress } =
|
|
270
|
-
await
|
|
248
|
+
await create1155({
|
|
271
249
|
contract: randomNewContract(),
|
|
272
250
|
token: {
|
|
273
251
|
tokenMetadataURI: demoTokenMetadataURI,
|
|
274
252
|
mintToCreatorCount: 3,
|
|
275
253
|
},
|
|
276
254
|
account: creatorAccount,
|
|
255
|
+
publicClient,
|
|
277
256
|
});
|
|
278
257
|
const { request: simulateResponse } =
|
|
279
258
|
await publicClient.simulateContract(request);
|
|
@@ -310,15 +289,16 @@ describe("create-helper", () => {
|
|
|
310
289
|
nextTokenId: 2n,
|
|
311
290
|
});
|
|
312
291
|
|
|
313
|
-
const newTokenOnExistingContract =
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
292
|
+
const newTokenOnExistingContract = await createNew1155Token({
|
|
293
|
+
contractAddress: contractAddress,
|
|
294
|
+
token: {
|
|
295
|
+
tokenMetadataURI: demoTokenMetadataURI,
|
|
296
|
+
mintToCreatorCount: 2,
|
|
297
|
+
},
|
|
298
|
+
account: creatorAccount,
|
|
299
|
+
contractGetter,
|
|
300
|
+
chainId: publicClient.chain.id,
|
|
301
|
+
});
|
|
322
302
|
const { request: simulateRequest } = await publicClient.simulateContract(
|
|
323
303
|
newTokenOnExistingContract.parameters,
|
|
324
304
|
);
|
|
@@ -340,21 +320,18 @@ describe("create-helper", () => {
|
|
|
340
320
|
const creatorAddress = addresses[0]!;
|
|
341
321
|
const createReferral = addresses[1]!;
|
|
342
322
|
|
|
343
|
-
const creatorClient = createCreatorClient({
|
|
344
|
-
chainId: chain.id,
|
|
345
|
-
publicClient: publicClient,
|
|
346
|
-
});
|
|
347
323
|
const {
|
|
348
324
|
parameters: request,
|
|
349
325
|
contractAddress: collectionAddress,
|
|
350
326
|
newTokenId,
|
|
351
|
-
} = await
|
|
327
|
+
} = await create1155({
|
|
352
328
|
contract: randomNewContract(),
|
|
353
329
|
token: {
|
|
354
330
|
tokenMetadataURI: demoTokenMetadataURI,
|
|
355
331
|
createReferral,
|
|
356
332
|
},
|
|
357
333
|
account: creatorAddress,
|
|
334
|
+
publicClient,
|
|
358
335
|
});
|
|
359
336
|
const { request: simulationResponse } =
|
|
360
337
|
await publicClient.simulateContract(request);
|
|
@@ -388,19 +365,14 @@ describe("create-helper", () => {
|
|
|
388
365
|
}) => {
|
|
389
366
|
const addresses = await walletClient.getAddresses();
|
|
390
367
|
const creatorAddress = addresses[0]!;
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
368
|
+
const { parameters: request, prepareMint } = await create1155({
|
|
369
|
+
contract: randomNewContract(),
|
|
370
|
+
token: {
|
|
371
|
+
tokenMetadataURI: demoTokenMetadataURI,
|
|
372
|
+
},
|
|
373
|
+
account: creatorAddress,
|
|
374
|
+
publicClient,
|
|
395
375
|
});
|
|
396
|
-
const { parameters: request, prepareMint } =
|
|
397
|
-
await creatorClient.create1155({
|
|
398
|
-
contract: randomNewContract(),
|
|
399
|
-
token: {
|
|
400
|
-
tokenMetadataURI: demoTokenMetadataURI,
|
|
401
|
-
},
|
|
402
|
-
account: creatorAddress,
|
|
403
|
-
});
|
|
404
376
|
const { request: createSimulation } =
|
|
405
377
|
await publicClient.simulateContract(request);
|
|
406
378
|
|
|
@@ -443,11 +415,6 @@ describe("create-helper", () => {
|
|
|
443
415
|
const addresses = await walletClient.getAddresses();
|
|
444
416
|
const creatorAddress = addresses[0]!;
|
|
445
417
|
|
|
446
|
-
const creatorClient = createCreatorClient({
|
|
447
|
-
chainId: chain.id,
|
|
448
|
-
publicClient: publicClient,
|
|
449
|
-
});
|
|
450
|
-
|
|
451
418
|
const pricePerToken = parseEther("0.01");
|
|
452
419
|
|
|
453
420
|
const blockTime = (await publicClient.getBlock()).timestamp;
|
|
@@ -458,7 +425,7 @@ describe("create-helper", () => {
|
|
|
458
425
|
newTokenId,
|
|
459
426
|
minter,
|
|
460
427
|
contractVersion,
|
|
461
|
-
} = await
|
|
428
|
+
} = await create1155({
|
|
462
429
|
contract: randomNewContract(),
|
|
463
430
|
token: {
|
|
464
431
|
tokenMetadataURI: demoTokenMetadataURI,
|
|
@@ -468,6 +435,7 @@ describe("create-helper", () => {
|
|
|
468
435
|
},
|
|
469
436
|
},
|
|
470
437
|
account: creatorAddress,
|
|
438
|
+
publicClient,
|
|
471
439
|
});
|
|
472
440
|
const { request: createSimulation } =
|
|
473
441
|
await publicClient.simulateContract(request);
|
|
@@ -524,7 +492,7 @@ describe("create-helper", () => {
|
|
|
524
492
|
|
|
525
493
|
anvilTest(
|
|
526
494
|
"creates an allow list mint contract",
|
|
527
|
-
async ({ viemClients: { publicClient, walletClient
|
|
495
|
+
async ({ viemClients: { publicClient, walletClient } }) => {
|
|
528
496
|
const creator = (await walletClient.getAddresses())[0]!;
|
|
529
497
|
const allowList: AllowList = {
|
|
530
498
|
entries: [
|
|
@@ -545,12 +513,7 @@ describe("create-helper", () => {
|
|
|
545
513
|
allowList,
|
|
546
514
|
});
|
|
547
515
|
|
|
548
|
-
const
|
|
549
|
-
chainId: chain.id,
|
|
550
|
-
publicClient: publicClient,
|
|
551
|
-
});
|
|
552
|
-
|
|
553
|
-
const { parameters: parameters } = await creatorClient.create1155({
|
|
516
|
+
const { parameters } = await create1155({
|
|
554
517
|
contract: {
|
|
555
518
|
name: "test allowlists",
|
|
556
519
|
uri: "ipfs://bafkreiainxen4b4wz4ubylvbhons6rembxdet4a262nf2lziclqvv7au3e",
|
|
@@ -564,6 +527,7 @@ describe("create-helper", () => {
|
|
|
564
527
|
},
|
|
565
528
|
},
|
|
566
529
|
account: creator,
|
|
530
|
+
publicClient,
|
|
567
531
|
});
|
|
568
532
|
|
|
569
533
|
const { request } = await publicClient.simulateContract(parameters);
|