@zoralabs/protocol-sdk 0.3.4 → 0.3.5

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.
@@ -7,9 +7,9 @@ $ tsup
7
7
  CLI Cleaning output folder
8
8
  CJS Build start
9
9
  ESM Build start
10
- ESM dist/index.js 37.02 KB
11
- ESM dist/index.js.map 74.33 KB
12
- ESM ⚡️ Build success in 34ms
13
- CJS dist/index.cjs 39.62 KB
14
- CJS dist/index.cjs.map 74.34 KB
15
- CJS ⚡️ Build success in 35ms
10
+ CJS dist/index.cjs 44.13 KB
11
+ CJS dist/index.cjs.map 83.73 KB
12
+ CJS ⚡️ Build success in 44ms
13
+ ESM dist/index.js 40.87 KB
14
+ ESM dist/index.js.map 83.86 KB
15
+ ESM ⚡️ Build success in 48ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @zoralabs/protocol-sdk
2
2
 
3
+ ## 0.3.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 7eb5e3f: ### Changes to `preminter`
8
+
9
+ lower level `preminter.ts` now supports premint v2 by defining v2 typed data defintions.
10
+
11
+ - `isValidSignature` now takes either v1 or v2 of a premint config, along with the premint config version. and both recovers the signer address and validates if the signer can create a premint on the given contract.
12
+ - new function `premintTypedDataDefinition` which takes a premint config version and returns the signable typed data definition for that version
13
+ - new function `recoverCreatorFromCreatorAttribution` which recovers the creator address from a `CreatorAttribution` event
14
+ - new function `supportsPremintVersion` which checks if a given token contract supports a given premint config version
15
+ - new function `tryRecoverPremintSigner` which takes a premint config version and a premint signature, and tries to recover the signer address from the signature. If the signature is invalid, it returns undefined.
16
+
17
+ ### Changes to PremintClient
18
+
19
+ `PremintClient` creation, updating, and deletion now take both premint config v1 and v2, but currently rejects them until the backend api supports creating v2 premints.
20
+
21
+ - `isValidSignature` now just takes the data directly as a param, instead of `{data}`
22
+
23
+ - 27a2e23: Fix reading the FIXED_PRICE_MINTER from the subgraph
24
+
3
25
  ## 0.3.4
4
26
 
5
27
  ### Patch Changes
package/README.md CHANGED
@@ -43,16 +43,11 @@ async function mintNFT({
43
43
  }) {
44
44
  const mintClient = createMintClient({chain: walletClient.chain!});
45
45
 
46
- // get mintable information about the token.
47
- const mintable = await mintClient.getMintable({
48
- tokenContract,
49
- tokenId,
50
- });
51
-
52
46
  // prepare the mint transaction, which can be simulated via an rpc with the public client.
53
47
  const prepared = await mintClient.makePrepareMintTokenParams({
54
48
  // token to mint
55
- mintable,
49
+ tokenContract,
50
+ tokenId,
56
51
  mintArguments: {
57
52
  // address that will receive the token
58
53
  mintToAddress,
@@ -81,7 +76,7 @@ async function mintNFT({
81
76
  #### Using wagmi
82
77
 
83
78
  ```tsx
84
- import {createMintClient, Mintable} from "@zoralabs/protocol-sdk";
79
+ import {createMintClient} from "@zoralabs/protocol-sdk";
85
80
  import {useEffect, useMemo, useState} from "react";
86
81
  import {BaseError, SimulateContractParameters, stringify} from "viem";
87
82
  import {Address, useAccount, useContractWrite, useNetwork, usePrepareContractWrite, usePublicClient, useWaitForTransaction} from "wagmi";
@@ -104,33 +99,19 @@ export const Mint = ({tokenId, tokenContract}: {tokenId: string; tokenContract:
104
99
  // value will be set by the form
105
100
  const [quantityToMint, setQuantityToMint] = useState<number>(1);
106
101
 
107
- // fetched mintable info from the sdk
108
- const [mintable, setMintable] = useState<Mintable>();
109
-
110
- useEffect(() => {
111
- // fetch the mintable token info
112
- const fetchMintable = async () => {
113
- if (mintClient) {
114
- const mintable = await mintClient.getMintable({tokenId, tokenContract});
115
- setMintable(mintable);
116
- }
117
- };
118
-
119
- fetchMintable();
120
- }, [mintClient, tokenId, tokenContract]);
121
-
122
102
  // params for the prepare contract write hook
123
103
  const [params, setParams] = useState<SimulateContractParameters>();
124
104
 
125
105
  const {address} = useAccount();
126
106
 
127
107
  useEffect(() => {
128
- if (!mintable || !mintClient || !address) return;
108
+ if (!mintClient || !address) return;
129
109
 
130
110
  const makeParams = async () => {
131
111
  // make the params for the prepare contract write hook
132
112
  const params = await mintClient.makePrepareMintTokenParams({
133
- mintable,
113
+ tokenId,
114
+ tokenContract,
134
115
  minterAccount: address,
135
116
  mintArguments: {
136
117
  mintToAddress: address,
@@ -141,7 +122,7 @@ export const Mint = ({tokenId, tokenContract}: {tokenId: string; tokenContract:
141
122
  };
142
123
 
143
124
  makeParams();
144
- }, [mintable, mintClient, address, quantityToMint]);
125
+ }, [mintClient, address, quantityToMint]);
145
126
 
146
127
  const {config} = usePrepareContractWrite(params);
147
128
 
package/dist/anvil.d.ts CHANGED
@@ -6,10 +6,11 @@ export interface AnvilViemClientsTest {
6
6
  testClient: TestClient;
7
7
  };
8
8
  }
9
- export declare const makeAnvilTest: ({ forkUrl, forkBlockNumber, }: {
9
+ export type AnvilTestForkSettings = {
10
10
  forkUrl: string;
11
11
  forkBlockNumber: number;
12
- }) => import("@vitest/runner/dist/tasks-e594cd24").e<{
12
+ };
13
+ export declare const makeAnvilTest: ({ forkUrl, forkBlockNumber, }: AnvilTestForkSettings) => import("@vitest/runner/dist/tasks-e594cd24").e<{
13
14
  viemClients: {
14
15
  walletClient: WalletClient;
15
16
  publicClient: PublicClient;
@@ -19,6 +20,7 @@ export declare const makeAnvilTest: ({ forkUrl, forkBlockNumber, }: {
19
20
  export declare const forkUrls: {
20
21
  zoraMainnet: string;
21
22
  zoraGoerli: string;
23
+ zoraSepoli: string;
22
24
  };
23
25
  export declare const anvilTest: import("@vitest/runner/dist/tasks-e594cd24").e<{
24
26
  viemClients: {
@@ -1 +1 @@
1
- {"version":3,"file":"anvil.d.ts","sourceRoot":"","sources":["../src/anvil.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,EACZ,UAAU,EACV,YAAY,EAKb,MAAM,MAAM,CAAC;AAGd,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE;QACX,YAAY,EAAE,YAAY,CAAC;QAC3B,YAAY,EAAE,YAAY,CAAC;QAC3B,UAAU,EAAE,UAAU,CAAC;KACxB,CAAC;CACH;AAUD,eAAO,MAAM,aAAa;aAIf,MAAM;qBACE,MAAM;;;sBAnBP,YAAY;sBACZ,YAAY;oBACd,UAAU;;EAwEtB,CAAC;AAEL,eAAO,MAAM,QAAQ;;;CAGpB,CAAC;AAEF,eAAO,MAAM,SAAS;;sBAjFJ,YAAY;sBACZ,YAAY;oBACd,UAAU;;EAkFxB,CAAC"}
1
+ {"version":3,"file":"anvil.d.ts","sourceRoot":"","sources":["../src/anvil.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,EACZ,UAAU,EACV,YAAY,EAKb,MAAM,MAAM,CAAC;AAGd,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE;QACX,YAAY,EAAE,YAAY,CAAC;QAC3B,YAAY,EAAE,YAAY,CAAC;QAC3B,UAAU,EAAE,UAAU,CAAC;KACxB,CAAC;CACH;AAUD,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,aAAa,kCAGvB,qBAAqB;;sBAtBN,YAAY;sBACZ,YAAY;oBACd,UAAU;;EA0EtB,CAAC;AAEL,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF,eAAO,MAAM,SAAS;;sBApFJ,YAAY;sBACZ,YAAY;oBACd,UAAU;;EAqFxB,CAAC"}
@@ -1,4 +1,36 @@
1
1
  export declare const ZORA_API_BASE = "https://api.zora.co/";
2
2
  export declare const OPEN_EDITION_MINT_SIZE: bigint;
3
3
  export declare function getSubgraph(name: string, version: string): string;
4
+ export declare const zora721Abi: readonly [{
5
+ readonly name: "mintWithRewards";
6
+ readonly type: "function";
7
+ readonly stateMutability: "payable";
8
+ readonly inputs: readonly [{
9
+ readonly type: "address";
10
+ readonly name: "recipient";
11
+ }, {
12
+ readonly type: "uint256";
13
+ readonly name: "quantity";
14
+ }, {
15
+ readonly type: "string";
16
+ readonly name: "comment";
17
+ }, {
18
+ readonly type: "address";
19
+ readonly name: "mintReferral";
20
+ }];
21
+ readonly outputs: readonly [];
22
+ }, {
23
+ readonly name: "zoraFeeForAmount";
24
+ readonly type: "function";
25
+ readonly stateMutability: "view";
26
+ readonly inputs: readonly [{
27
+ readonly type: "uint256";
28
+ readonly name: "amount";
29
+ }];
30
+ readonly outputs: readonly [{
31
+ readonly type: "address";
32
+ }, {
33
+ readonly type: "uint256";
34
+ }];
35
+ }];
4
36
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,yBAAyB,CAAC;AACpD,eAAO,MAAM,sBAAsB,QAAiC,CAAC;AAMrE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjE"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,yBAAyB,CAAC;AACpD,eAAO,MAAM,sBAAsB,QAAiC,CAAC;AAMrE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGZ,CAAC"}