@zoralabs/protocol-sdk 0.7.3-SPARKS.0 → 0.7.4

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.
Files changed (46) hide show
  1. package/.turbo/turbo-build.log +18 -0
  2. package/CHANGELOG.md +17 -4
  3. package/LICENSE +21 -0
  4. package/dist/anvil.d.ts +2 -2
  5. package/dist/anvil.d.ts.map +1 -1
  6. package/dist/apis/http-api-base.d.ts.map +1 -1
  7. package/dist/index.cjs +2265 -319
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.js +2289 -320
  10. package/dist/index.js.map +1 -1
  11. package/dist/ipfs/token-metadata.d.ts.map +1 -1
  12. package/dist/mint/mint-client.d.ts +1 -1
  13. package/dist/mint/mint-queries.d.ts +1 -1
  14. package/dist/mint/types.d.ts.map +1 -1
  15. package/dist/mints/mints-contracts.d.ts +1 -1
  16. package/dist/mints/mints-contracts.d.ts.map +1 -1
  17. package/dist/mints/mints-eth-unwrapper-and-caller.d.ts.map +1 -1
  18. package/dist/mints/mints-queries.d.ts.map +1 -1
  19. package/dist/mints/mints-relay-example.d.ts +7 -7
  20. package/dist/mints/mints-relay-example.d.ts.map +1 -1
  21. package/dist/premint/conversions.d.ts +5 -5
  22. package/dist/premint/conversions.d.ts.map +1 -1
  23. package/dist/premint/premint-api-client.d.ts +1 -1
  24. package/dist/premint/premint-api-client.d.ts.map +1 -1
  25. package/dist/premint/premint-client.d.ts +4 -4
  26. package/dist/premint/premint-client.d.ts.map +1 -1
  27. package/dist/premint/preminter.d.ts +3 -3
  28. package/dist/premint/preminter.d.ts.map +1 -1
  29. package/dist/preminter.d.ts +2 -2
  30. package/dist/preminter.d.ts.map +1 -1
  31. package/dist/test-utils.d.ts.map +1 -1
  32. package/package.json +21 -16
  33. package/src/create/1155-create-helper.test.ts +325 -0
  34. package/src/mint/mint-client.test.ts +263 -0
  35. package/src/mints/mints-contracts.test.ts +529 -0
  36. package/src/mints/mints-eth-unwrapper-and-caller.test.ts +467 -0
  37. package/src/mints/mints-eth-unwrapper-and-caller.ts +2 -2
  38. package/src/mints/mints-queries.test.ts +105 -0
  39. package/src/mints/mints-relay-example.ts +22 -13
  40. package/src/premint/premint-client.test.ts +290 -0
  41. package/src/premint/preminter.test.ts +866 -0
  42. package/test-integration/setup-test-contracts.ts +96 -0
  43. package/tsconfig.build.json +10 -0
  44. package/tsconfig.json +1 -1
  45. package/tsup.config.ts +12 -0
  46. package/yarn-error.log +0 -8602
@@ -0,0 +1,96 @@
1
+ import {
2
+ createCollectorClient,
3
+ createCreatorClient,
4
+ getPremintCollectionAddress,
5
+ } from "src";
6
+ import {
7
+ LocalAccount,
8
+ createPublicClient,
9
+ createWalletClient,
10
+ http,
11
+ parseEther,
12
+ } from "viem";
13
+ import { privateKeyToAccount } from "viem/accounts";
14
+ import { zoraSepolia } from "viem/chains";
15
+
16
+ const publicClient = createPublicClient({
17
+ chain: zoraSepolia,
18
+ transport: http(),
19
+ });
20
+
21
+ const walletClient = createWalletClient({
22
+ chain: zoraSepolia,
23
+ transport: http(),
24
+ });
25
+
26
+ const creatorClient = createCreatorClient({
27
+ chainId: zoraSepolia.id,
28
+ publicClient,
29
+ });
30
+
31
+ const collectorClient = createCollectorClient({
32
+ chainId: zoraSepolia.id,
33
+ publicClient,
34
+ });
35
+
36
+ export const createPremintsOnContract = async ({
37
+ creatorAccount,
38
+ }: {
39
+ creatorAccount: LocalAccount;
40
+ }) => {
41
+ const collectionAddress = await getPremintCollectionAddress({
42
+ publicClient,
43
+ contract: {
44
+ contractAdmin: creatorAccount.address,
45
+ contractName: "testContract",
46
+ contractURI:
47
+ "ipfs://bafkreiainxen4b4wz4ubylvbhons6rembxdet4a262nf2lziclqvv7au3e",
48
+ },
49
+ });
50
+
51
+ console.log({ collectionAddress });
52
+
53
+ const { typedDataDefinition, submit } = await creatorClient.createPremint({
54
+ contract: {
55
+ contractAdmin: creatorAccount.address,
56
+ contractName: "testContract",
57
+ contractURI:
58
+ "ipfs://bafkreiainxen4b4wz4ubylvbhons6rembxdet4a262nf2lziclqvv7au3e",
59
+ },
60
+ token: {
61
+ payoutRecipient: creatorAccount.address,
62
+ tokenURI:
63
+ "ipfs://bafkreice23maski3x52tsfqgxstx3kbiifnt5jotg3a5ynvve53c4soi2u",
64
+ pricePerToken: parseEther("0.001"),
65
+ },
66
+ });
67
+
68
+ const signature = await walletClient.signTypedData({
69
+ account: creatorAccount,
70
+ ...typedDataDefinition,
71
+ });
72
+
73
+ await submit({
74
+ signature,
75
+ });
76
+
77
+ const mints = await collectorClient.getTokensOfContract({
78
+ tokenContract: collectionAddress,
79
+ });
80
+
81
+ console.log({ mints: mints.map((x) => x.mintable) });
82
+ };
83
+
84
+ const setupTestContracts = async () => {
85
+ const creatorAccount = privateKeyToAccount(
86
+ // random private key created by cast
87
+ "0x0d32fcabfe28c779974a77dc635163f062be2bc0b10eea62994235617b44092f",
88
+ );
89
+
90
+ // create 2 premints on a contract
91
+ await createPremintsOnContract({
92
+ creatorAccount,
93
+ });
94
+ };
95
+
96
+ setupTestContracts();
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "@zoralabs/tsconfig/tsconfig.json",
3
+ "compilerOptions": {
4
+ "lib": ["es2021", "DOM"],
5
+ "baseUrl": ".",
6
+ "outDir": "dist"
7
+ },
8
+ "exclude": ["node_modules/**", "dist/**", "**/*test.ts"],
9
+ "include": ["src/**/*.ts"]
10
+ }
package/tsconfig.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "zoralabs-tsconfig/tsconfig.json",
2
+ "extends": "@zoralabs/tsconfig/tsconfig.json",
3
3
  "compilerOptions": {
4
4
  "lib": ["es2021", "DOM"],
5
5
  "baseUrl": ".",
package/tsup.config.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { defineConfig } from "tsup";
2
+
3
+ export default defineConfig({
4
+ entry: ["src/index.ts"],
5
+ sourcemap: true,
6
+ clean: true,
7
+ tsconfig: "tsconfig.build.json",
8
+ dts: false,
9
+ format: ["cjs", "esm"],
10
+ onSuccess:
11
+ "tsc --project tsconfig.build.json --emitDeclarationOnly --declaration --declarationMap",
12
+ });