@zoralabs/protocol-sdk 0.2.0 → 0.3.1
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 +19 -1
- package/README.md +42 -11
- package/dist/create/1155-create-helper.d.ts +24 -25
- package/dist/create/1155-create-helper.d.ts.map +1 -1
- package/dist/index.cjs +296 -130
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +287 -115
- package/dist/index.js.map +1 -1
- package/dist/mint/mint-client.d.ts +5 -1
- package/dist/mint/mint-client.d.ts.map +1 -1
- package/dist/premint/premint-client.d.ts +51 -12
- package/dist/premint/premint-client.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/create/1155-create-helper.test.ts +40 -26
- package/src/create/1155-create-helper.ts +120 -103
- package/src/index.ts +2 -0
- package/src/mint/mint-client.test.ts +3 -3
- package/src/mint/mint-client.ts +12 -2
- package/src/premint/premint-client.test.ts +22 -9
- package/src/premint/premint-client.ts +29 -31
- package/dist/preminter.d.ts +0 -25
- package/dist/preminter.d.ts.map +0 -1
- package/dist/preminter.test.d.ts +0 -451
- package/dist/preminter.test.d.ts.map +0 -1
- package/src/preminter.test.ts +0 -510
- package/src/preminter.ts +0 -72
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[32m35.89 KB[39m
|
|
11
|
+
[32mCJS[39m [1mdist/index.cjs.map [22m[32m65.52 KB[39m
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 25ms
|
|
13
|
+
[32mESM[39m [1mdist/index.js [22m[32m33.30 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m65.40 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 24ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
# @zoralabs/
|
|
1
|
+
# @zoralabs/protocol-sdk
|
|
2
|
+
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 92da3ed: Exporting mint client
|
|
8
|
+
- Updated dependencies [293e2c0]
|
|
9
|
+
- @zoralabs/protocol-deployments@0.0.5
|
|
10
|
+
|
|
11
|
+
## 0.3.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- 40e0b32:
|
|
16
|
+
- rename premint-sdk to protocol-sdk
|
|
17
|
+
- added minting sdk, usable with `createMintClient`
|
|
18
|
+
- added 1155 creation sdk, usable with `create1155CreatorClient`
|
|
19
|
+
- premint sdk is now useable with `createPremintClient`
|
|
2
20
|
|
|
3
21
|
## 0.1.1
|
|
4
22
|
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Protocol SDK allows users to manage zora mints and collects.
|
|
|
12
12
|
### Creating a mint from an on-chain contract:
|
|
13
13
|
|
|
14
14
|
```ts
|
|
15
|
-
import {
|
|
15
|
+
import { createMintClient } from "@zoralabs/protocol-sdk";
|
|
16
16
|
import type { Address, WalletClient } from "viem";
|
|
17
17
|
|
|
18
18
|
async function mintNFT(
|
|
@@ -20,7 +20,7 @@ async function mintNFT(
|
|
|
20
20
|
address: Address,
|
|
21
21
|
tokenId: bigint,
|
|
22
22
|
) {
|
|
23
|
-
const mintAPI =
|
|
23
|
+
const mintAPI = createMintClient({ chain: walletClient.chain });
|
|
24
24
|
await mintAPI.mintNFT({
|
|
25
25
|
walletClient,
|
|
26
26
|
address,
|
|
@@ -33,6 +33,40 @@ async function mintNFT(
|
|
|
33
33
|
}
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
+
### Creating an 1155 contract:
|
|
37
|
+
|
|
38
|
+
If an object with {name, uri} is passed in to this helper, it uses the creatorAccount and those values to either 1) create or 2) mint to that existing contract.
|
|
39
|
+
|
|
40
|
+
If you wish to mint on an existing contract, pass that contract in the contract field. The return value is the prepared transaction that you can use viem or wagmi to send.
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import type { PublicClient } from "viem";
|
|
44
|
+
import { create1155CreatorClient } from "@zoralabs/protocol-sdk";
|
|
45
|
+
|
|
46
|
+
export async function createContract({
|
|
47
|
+
publicClient,
|
|
48
|
+
walletClient,
|
|
49
|
+
}: {
|
|
50
|
+
publicClient: PublicClient;
|
|
51
|
+
walletClient: WalletClient;
|
|
52
|
+
}) {
|
|
53
|
+
const creatorClient = create1155CreatorClient({ publicClient });
|
|
54
|
+
const { request } = await creatorClient.createNew1155Token({
|
|
55
|
+
contract: {
|
|
56
|
+
name: "testContract",
|
|
57
|
+
uri: demoContractMetadataURI,
|
|
58
|
+
},
|
|
59
|
+
tokenMetadataURI: demoTokenMetadataURI,
|
|
60
|
+
account: creatorAccount,
|
|
61
|
+
mintToCreatorCount: 1,
|
|
62
|
+
});
|
|
63
|
+
const { request: simulateRequest } = publicClient.simulateContract(request);
|
|
64
|
+
const hash = await walletClient.writeContract(simulateRequest);
|
|
65
|
+
const receipt = await publicClient.waitForTransactionReceipt({ hash });
|
|
66
|
+
return receipt;
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
36
70
|
### Creating a premint:
|
|
37
71
|
|
|
38
72
|
```ts
|
|
@@ -40,11 +74,8 @@ import { PremintAPI } from "@zoralabs/protocol-sdk";
|
|
|
40
74
|
import type { Address, WalletClient } from "viem";
|
|
41
75
|
|
|
42
76
|
async function makePremint(walletClient: WalletClient) {
|
|
43
|
-
// Create premint API object passing in the current wallet chain (only zora and zora testnet are supported currently).
|
|
44
|
-
const premintAPI = new PremintAPI(walletClient.chain);
|
|
45
|
-
|
|
46
77
|
// Create premint
|
|
47
|
-
const premint = await
|
|
78
|
+
const premint = await createPremintAPI(walletClient.chain).createPremint({
|
|
48
79
|
// Extra step to check the signature on-chain before attempting to sign
|
|
49
80
|
checkSignature: true,
|
|
50
81
|
// Collection information that this premint NFT will exist in once minted.
|
|
@@ -76,7 +107,7 @@ import type { Address, WalletClient } from "viem";
|
|
|
76
107
|
|
|
77
108
|
async function updatePremint(walletClient: WalletClient) {
|
|
78
109
|
// Create premint API object passing in the current wallet chain (only zora and zora testnet are supported currently).
|
|
79
|
-
const premintAPI =
|
|
110
|
+
const premintAPI = createPremintAPI(walletClient.chain);
|
|
80
111
|
|
|
81
112
|
// Create premint
|
|
82
113
|
const premint = await premintAPI.updatePremint({
|
|
@@ -105,7 +136,7 @@ import type { Address, WalletClient } from "viem";
|
|
|
105
136
|
|
|
106
137
|
async function deletePremint(walletClient: WalletClient) {
|
|
107
138
|
// Create premint API object passing in the current wallet chain (only zora and zora testnet are supported currently).
|
|
108
|
-
const premintAPI =
|
|
139
|
+
const premintAPI = createPremintClient({ chain: walletClient.chain });
|
|
109
140
|
|
|
110
141
|
// Create premint
|
|
111
142
|
const premint = await premintAPI.deletePremint({
|
|
@@ -132,7 +163,7 @@ async function executePremint(
|
|
|
132
163
|
premintAddress: Address,
|
|
133
164
|
premintUID: number,
|
|
134
165
|
) {
|
|
135
|
-
const premintAPI =
|
|
166
|
+
const premintAPI = createPremintClient({ chain: walletClient.chain });
|
|
136
167
|
|
|
137
168
|
return await premintAPI.executePremintWithWallet({
|
|
138
169
|
data: premintAPI.getPremintData(premintAddress, premintUID),
|
|
@@ -146,12 +177,12 @@ async function executePremint(
|
|
|
146
177
|
|
|
147
178
|
### Deleting a premint:
|
|
148
179
|
|
|
149
|
-
```
|
|
180
|
+
```ts
|
|
150
181
|
import {PremintAPI} from '@zoralabs/premint-sdk';
|
|
151
182
|
import type {Address, WalletClient} from 'viem';
|
|
152
183
|
|
|
153
184
|
async function deletePremint(walletClient: WalletClient, collection: Address, uid: number) {
|
|
154
|
-
const premintAPI =
|
|
185
|
+
const premintAPI = createPremintClient({chain: walletClient.chain});
|
|
155
186
|
|
|
156
187
|
return await premintAPI.deletePremint({
|
|
157
188
|
walletClient,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Address, Hex, PublicClient,
|
|
1
|
+
import type { Address, Hex, PublicClient, SimulateContractParameters, TransactionReceipt } from "viem";
|
|
2
2
|
type SalesConfigParamsType = {
|
|
3
3
|
pricePerToken?: bigint;
|
|
4
4
|
saleStart?: bigint;
|
|
@@ -34,30 +34,29 @@ export declare function create1155TokenSetupArgs({ nextTokenId, mintToCreatorCou
|
|
|
34
34
|
royaltySettings?: RoyaltySettingsType;
|
|
35
35
|
}): `0x${string}`[];
|
|
36
36
|
export declare const getTokenIdFromCreateReceipt: (receipt: TransactionReceipt) => bigint | undefined;
|
|
37
|
-
|
|
37
|
+
type CreateNew1155TokenReturn = {
|
|
38
|
+
request: SimulateContractParameters;
|
|
39
|
+
tokenSetupActions: Hex[];
|
|
40
|
+
contractAddress: Address;
|
|
41
|
+
contractExists: boolean;
|
|
42
|
+
};
|
|
43
|
+
export declare function create1155CreatorClient({ publicClient, }: {
|
|
38
44
|
publicClient: PublicClient;
|
|
39
|
-
|
|
40
|
-
maxSupply
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
contractExists: false;
|
|
56
|
-
} | {
|
|
57
|
-
send: (walletClient: WalletClient) => Promise<`0x${string}`>;
|
|
58
|
-
tokenSetupActions: `0x${string}`[];
|
|
59
|
-
contractAddress: `0x${string}`;
|
|
60
|
-
contractExists: true;
|
|
61
|
-
}>;
|
|
45
|
+
}): {
|
|
46
|
+
createNew1155Token: ({ contract, tokenMetadataURI, mintToCreatorCount, salesConfig, maxSupply, account, royaltySettings, getAdditionalSetupActions, }: {
|
|
47
|
+
account: Address;
|
|
48
|
+
maxSupply?: number | bigint | undefined;
|
|
49
|
+
royaltySettings?: RoyaltySettingsType | undefined;
|
|
50
|
+
royaltyBPS?: number | undefined;
|
|
51
|
+
contract: ContractType;
|
|
52
|
+
tokenMetadataURI: string;
|
|
53
|
+
mintToCreatorCount?: number | bigint | undefined;
|
|
54
|
+
salesConfig?: SalesConfigParamsType | undefined;
|
|
55
|
+
getAdditionalSetupActions?: ((args: {
|
|
56
|
+
tokenId: bigint;
|
|
57
|
+
contractAddress: Address;
|
|
58
|
+
}) => Hex[]) | undefined;
|
|
59
|
+
}) => Promise<CreateNew1155TokenReturn>;
|
|
60
|
+
};
|
|
62
61
|
export {};
|
|
63
62
|
//# sourceMappingURL=1155-create-helper.d.ts.map
|
|
@@ -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,GAAG,EACH,YAAY,EACZ,
|
|
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,GAAG,EACH,YAAY,EACZ,0BAA0B,EAC1B,kBAAkB,EACnB,MAAM,MAAM,CAAC;AAUd,KAAK,qBAAqB,GAAG;IAE3B,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,mBAAmB,C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