@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.
- package/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +22 -0
- package/README.md +7 -26
- package/dist/anvil.d.ts +4 -2
- package/dist/anvil.d.ts.map +1 -1
- package/dist/constants.d.ts +32 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.cjs +470 -338
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +441 -313
- package/dist/index.js.map +1 -1
- package/dist/mint/mint-api-client.d.ts +16 -216
- package/dist/mint/mint-api-client.d.ts.map +1 -1
- package/dist/mint/mint-client.d.ts +7 -227
- package/dist/mint/mint-client.d.ts.map +1 -1
- package/dist/premint/premint-client.d.ts +63 -17
- package/dist/premint/premint-client.d.ts.map +1 -1
- package/dist/premint/preminter.d.ts +106 -19
- package/dist/premint/preminter.d.ts.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/anvil.ts +7 -4
- package/src/constants.ts +7 -0
- package/src/mint/mint-api-client.ts +72 -68
- package/src/mint/mint-client.test.ts +9 -11
- package/src/mint/mint-client.ts +51 -221
- package/src/premint/premint-client.test.ts +9 -8
- package/src/premint/premint-client.ts +113 -61
- package/src/premint/preminter.test.ts +207 -130
- package/src/premint/preminter.ts +388 -51
- package/src/types.ts +1 -0
- package/dist/apis/generated/discover-api-types.d.ts +0 -2131
- package/dist/apis/generated/discover-api-types.d.ts.map +0 -1
- package/src/apis/generated/discover-api-types.ts +0 -2180
package/.turbo/turbo-build.log
CHANGED
|
@@ -7,9 +7,9 @@ $ tsup
|
|
|
7
7
|
[34mCLI[39m Cleaning output folder
|
|
8
8
|
[34mCJS[39m Build start
|
|
9
9
|
[34mESM[39m Build start
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
10
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m44.13 KB[39m
|
|
11
|
+
[32mCJS[39m [1mdist/index.cjs.map [22m[32m83.73 KB[39m
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 44ms
|
|
13
|
+
[32mESM[39m [1mdist/index.js [22m[32m40.87 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m83.86 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ 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
|
-
|
|
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
|
|
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 (!
|
|
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
|
-
|
|
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
|
-
}, [
|
|
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
|
|
9
|
+
export type AnvilTestForkSettings = {
|
|
10
10
|
forkUrl: string;
|
|
11
11
|
forkBlockNumber: number;
|
|
12
|
-
}
|
|
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: {
|
package/dist/anvil.d.ts.map
CHANGED
|
@@ -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,
|
|
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"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -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
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
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"}
|