@zoralabs/protocol-sdk 0.5.14 → 0.5.16
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 +15 -0
- package/README.md +42 -2
- package/dist/anvil.d.ts +4 -4
- package/dist/anvil.d.ts.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/create/1155-create-helper.d.ts +3 -4
- package/dist/create/1155-create-helper.d.ts.map +1 -1
- package/dist/index.cjs +534 -375
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +517 -356
- package/dist/index.js.map +1 -1
- package/dist/mint/mint-api-client.d.ts +14 -6
- package/dist/mint/mint-api-client.d.ts.map +1 -1
- package/dist/mint/mint-client.d.ts +25 -19
- package/dist/mint/mint-client.d.ts.map +1 -1
- package/dist/mints/mints-contracts.d.ts +688 -3
- package/dist/mints/mints-contracts.d.ts.map +1 -1
- package/dist/premint/premint-client.d.ts +111 -1465
- package/dist/premint/premint-client.d.ts.map +1 -1
- package/dist/premint/preminter.d.ts +2 -1
- package/dist/premint/preminter.d.ts.map +1 -1
- package/dist/utils.d.ts +6872 -1
- package/dist/utils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/constants.ts +36 -0
- package/src/create/1155-create-helper.test.ts +10 -3
- package/src/create/1155-create-helper.ts +8 -7
- package/src/mint/mint-api-client.ts +107 -45
- package/src/mint/mint-client.test.ts +113 -2
- package/src/mint/mint-client.ts +95 -53
- package/src/premint/premint-client.test.ts +16 -10
- package/src/premint/premint-client.ts +566 -374
- package/src/premint/preminter.ts +3 -1
- package/src/utils.ts +25 -0
- package/test-integration/premint-client.test.ts +2 -2
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
|
-
[32mCJS[39m [1mdist/index.cjs [22m[
|
|
11
|
-
[32mCJS[39m [1mdist/index.cjs.map [22m[
|
|
12
|
-
[32mCJS[39m ⚡️ Build success in
|
|
13
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
14
|
-
[32mESM[39m [1mdist/index.js.map [22m[
|
|
15
|
-
[32mESM[39m ⚡️ Build success in
|
|
10
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m60.94 KB[39m
|
|
11
|
+
[32mCJS[39m [1mdist/index.cjs.map [22m[32m127.62 KB[39m
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 96ms
|
|
13
|
+
[32mESM[39m [1mdist/index.js [22m[32m55.49 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m127.51 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 103ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @zoralabs/protocol-sdk
|
|
2
2
|
|
|
3
|
+
## 0.5.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 12387133: `create1155CreatorClient` requires `chain` to be passed as a default argument instead of a `publicClient`
|
|
8
|
+
- Updated dependencies [7af9c4db]
|
|
9
|
+
- @zoralabs/protocol-deployments@0.1.12
|
|
10
|
+
|
|
11
|
+
## 0.5.15
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 888168b8: Fix protocol-sdk to point to `isAuthorizedToCreatePremint`
|
|
16
|
+
- 344f452b: Add support for ERC-20 minting on 1155s using ERC20 minters within the function `makePrepareMintTokenParams`.
|
|
17
|
+
|
|
3
18
|
## 0.5.14
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -9,7 +9,6 @@ Protocol SDK allows developers to create tokens using the Zora Protocol and mint
|
|
|
9
9
|
- `npm install viem`
|
|
10
10
|
- `npm install `
|
|
11
11
|
|
|
12
|
-
|
|
13
12
|
## Examples
|
|
14
13
|
|
|
15
14
|
- [Creating a mint from an on-chain contract](#creating-a-mint-from-an-on-chain-contract)
|
|
@@ -83,6 +82,44 @@ async function mintNFT({
|
|
|
83
82
|
}
|
|
84
83
|
```
|
|
85
84
|
|
|
85
|
+
### Minting an NFT with an ERC20 minter
|
|
86
|
+
|
|
87
|
+
If an 1155 token is set to be an ERC20 mint, use the `makePrepareMintTokenParams` the same way as for
|
|
88
|
+
eth based mints. The underlying function should handle preparing arguments for the ERC20 mint.
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
import type { PublicClient } from "viem";
|
|
92
|
+
|
|
93
|
+
async function mint1155TokenWithERC20Currency(
|
|
94
|
+
publicClient: PublicClient,
|
|
95
|
+
minterAddress: Address,
|
|
96
|
+
) {
|
|
97
|
+
const mintClient = createMintClient({ chain: zora });
|
|
98
|
+
const exampleCurrency = "0xb6b701878a1f80197dF2c209D0BDd292EA73164D";
|
|
99
|
+
// nft collection address
|
|
100
|
+
const targetContract = "0x689bc305456c38656856d12469aed282fbd89fe0";
|
|
101
|
+
const tokenId = 17;
|
|
102
|
+
// the NFT token price in WEI value
|
|
103
|
+
const erc20PricePerToken = 2000000000000000000;
|
|
104
|
+
|
|
105
|
+
const tokenParams = await mintClient.makePrepareMintTokenParams({
|
|
106
|
+
minterAccount: minterAddress,
|
|
107
|
+
tokenId: tokenId,
|
|
108
|
+
tokenAddress: targetContract,
|
|
109
|
+
mintArguments: {
|
|
110
|
+
mintToAddress: minterAddress,
|
|
111
|
+
quantityToMint: 1,
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const simulationResult = await publicClient.simulateContract(params);
|
|
116
|
+
const hash = await walletClient.writeContract(simulationResult.request);
|
|
117
|
+
const receipt = await publicClient.waitForTransactionReceipt({ hash });
|
|
118
|
+
|
|
119
|
+
return receipt;
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
86
123
|
#### Using wagmi
|
|
87
124
|
|
|
88
125
|
```tsx
|
|
@@ -260,7 +297,10 @@ async function createForFree({
|
|
|
260
297
|
checkSignature: true,
|
|
261
298
|
// collection info of collection to create
|
|
262
299
|
collection: {
|
|
263
|
-
contractAdmin:
|
|
300
|
+
contractAdmin:
|
|
301
|
+
typeof creatorAccount === "string"
|
|
302
|
+
? creatorAccount
|
|
303
|
+
: creatorAccount.address,
|
|
264
304
|
contractName: "Testing Contract",
|
|
265
305
|
contractURI:
|
|
266
306
|
"ipfs://bafkreiainxen4b4wz4ubylvbhons6rembxdet4a262nf2lziclqvv7au3e",
|
package/dist/anvil.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Chain, PublicClient, TestClient, WalletClient } from "viem";
|
|
1
|
+
import { Chain, PublicClient, TestClient, Transport, WalletClient } from "viem";
|
|
2
2
|
export interface AnvilViemClientsTest {
|
|
3
3
|
viemClients: {
|
|
4
4
|
walletClient: WalletClient;
|
|
5
|
-
publicClient: PublicClient
|
|
5
|
+
publicClient: PublicClient<Transport, Chain>;
|
|
6
6
|
testClient: TestClient;
|
|
7
7
|
chain: Chain;
|
|
8
8
|
};
|
|
@@ -15,7 +15,7 @@ export type AnvilTestForkSettings = {
|
|
|
15
15
|
export declare const makeAnvilTest: ({ forkUrl, forkBlockNumber, anvilChainId, }: AnvilTestForkSettings) => import("@vitest/runner/dist/tasks-e594cd24").e<{
|
|
16
16
|
viemClients: {
|
|
17
17
|
walletClient: WalletClient;
|
|
18
|
-
publicClient: PublicClient
|
|
18
|
+
publicClient: PublicClient<Transport, Chain>;
|
|
19
19
|
testClient: TestClient;
|
|
20
20
|
chain: Chain;
|
|
21
21
|
};
|
|
@@ -28,7 +28,7 @@ export declare const forkUrls: {
|
|
|
28
28
|
export declare const anvilTest: import("@vitest/runner/dist/tasks-e594cd24").e<{
|
|
29
29
|
viemClients: {
|
|
30
30
|
walletClient: WalletClient;
|
|
31
|
-
publicClient: PublicClient
|
|
31
|
+
publicClient: PublicClient<Transport, Chain>;
|
|
32
32
|
testClient: TestClient;
|
|
33
33
|
chain: Chain;
|
|
34
34
|
};
|
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,KAAK,EACL,YAAY,EACZ,UAAU,EACV,YAAY,EAKb,MAAM,MAAM,CAAC;AAGd,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE;QACX,YAAY,EAAE,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"anvil.d.ts","sourceRoot":"","sources":["../src/anvil.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,EACL,YAAY,EACZ,UAAU,EACV,SAAS,EACT,YAAY,EAKb,MAAM,MAAM,CAAC;AAGd,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE;QACX,YAAY,EAAE,YAAY,CAAC;QAE3B,YAAY,EAAE,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC7C,UAAU,EAAE,UAAU,CAAC;QACvB,KAAK,EAAE,KAAK,CAAC;KACd,CAAC;CACH;AAUD,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,aAAa,gDAIvB,qBAAqB;;sBA1BN,YAAY;sBAEZ,aAAa,SAAS,EAAE,KAAK,CAAC;oBAChC,UAAU;eACf,KAAK;;EA8EZ,CAAC;AAEL,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF,eAAO,MAAM,SAAS;;sBA1FJ,YAAY;sBAEZ,aAAa,SAAS,EAAE,KAAK,CAAC;oBAChC,UAAU;eACf,KAAK;;EA0Fd,CAAC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -33,4 +33,5 @@ export declare const zora721Abi: readonly [{
|
|
|
33
33
|
readonly type: "uint256";
|
|
34
34
|
}];
|
|
35
35
|
}];
|
|
36
|
+
export declare const NFT_SALE_QUERY = "\nfragment SaleStrategy on SalesStrategyConfig {\n type\n fixedPrice {\n address\n pricePerToken\n saleEnd\n saleStart\n maxTokensPerAddress\n }\n erc20Minter {\n address\n pricePerToken\n currency\n saleEnd\n saleStart\n maxTokensPerAddress\n }\n}\n\nquery ($id: ID!) {\n zoraCreateToken(id: $id) {\n id\n contract {\n mintFeePerQuantity\n salesStrategies(where: {type_in: [\"FIXED_PRICE\", \"ERC_20_MINTER\"]}) {\n ...SaleStrategy\n }\n }\n salesStrategies(where: {type_in: [\"FIXED_PRICE\", \"ERC_20_MINTER\"]}) {\n ...SaleStrategy\n }\n }\n}\n";
|
|
36
37
|
//# 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":"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"}
|
|
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;AAEZ,eAAO,MAAM,cAAc,0nBAkC1B,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Account, Address, Hex,
|
|
1
|
+
import type { Account, Address, Hex, SimulateContractParameters, TransactionReceipt } from "viem";
|
|
2
|
+
import { ClientConfig } from "src/utils";
|
|
2
3
|
type SalesConfigParamsType = {
|
|
3
4
|
pricePerToken?: bigint;
|
|
4
5
|
saleStart?: bigint;
|
|
@@ -40,9 +41,7 @@ type CreateNew1155TokenReturn = {
|
|
|
40
41
|
contractAddress: Address;
|
|
41
42
|
contractExists: boolean;
|
|
42
43
|
};
|
|
43
|
-
export declare function create1155CreatorClient(
|
|
44
|
-
publicClient: PublicClient;
|
|
45
|
-
}): {
|
|
44
|
+
export declare function create1155CreatorClient(clientConfig: ClientConfig): {
|
|
46
45
|
createNew1155Token: ({ contract, tokenMetadataURI, mintToCreatorCount, salesConfig, maxSupply, account, royaltySettings, createReferral, getAdditionalSetupActions, }: {
|
|
47
46
|
account: Address;
|
|
48
47
|
maxSupply?: number | bigint | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1155-create-helper.d.ts","sourceRoot":"","sources":["../../src/create/1155-create-helper.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,OAAO,EACP,OAAO,EACP,GAAG,EACH,
|
|
1
|
+
{"version":3,"file":"1155-create-helper.d.ts","sourceRoot":"","sources":["../../src/create/1155-create-helper.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,OAAO,EACP,OAAO,EACP,GAAG,EACH,0BAA0B,EAC1B,kBAAkB,EACnB,MAAM,MAAM,CAAC;AAGd,OAAO,EAEL,YAAY,EAGb,MAAM,WAAW,CAAC;AAQnB,KAAK,qBAAqB,GAAG;IAE3B,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7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