@zoralabs/protocol-sdk 0.2.0 → 0.3.0

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
- CJS dist/index.cjs 31.18 KB
11
- CJS dist/index.cjs.map 56.54 KB
12
- CJS ⚡️ Build success in 21ms
13
- ESM dist/index.js 28.64 KB
14
- ESM dist/index.js.map 56.31 KB
15
- ESM ⚡️ Build success in 22ms
10
+ ESM dist/index.js 28.56 KB
11
+ ESM dist/index.js.map 56.44 KB
12
+ ESM ⚡️ Build success in 23ms
13
+ CJS dist/index.cjs 31.12 KB
14
+ CJS dist/index.cjs.map 56.67 KB
15
+ CJS ⚡️ Build success in 24ms
package/CHANGELOG.md CHANGED
@@ -1,4 +1,14 @@
1
- # @zoralabs/premint-sdk
1
+ # @zoralabs/protocol-sdk
2
+
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 40e0b32:
8
+ - rename premint-sdk to protocol-sdk
9
+ - added minting sdk, usable with `createMintClient`
10
+ - added 1155 creation sdk, usable with `create1155CreatorClient`
11
+ - premint sdk is now useable with `createPremintClient`
2
12
 
3
13
  ## 0.1.1
4
14
 
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 { MintAPI } from "@zoralabs/protocol-sdk";
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 = new MintAPI(walletClient.chain);
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 premintAPI.createPremint({
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 = new PremintAPI(walletClient.chain);
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 = new PremintAPI(walletClient.chain);
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 = new PremintAPI(walletClient.chain);
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
- ```js
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 = new PremintAPI(walletClient.chain);
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, TransactionReceipt, WalletClient } from "viem";
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
- export declare function createNew1155Token({ publicClient, contract, tokenMetadataURI, mintToCreatorCount, salesConfig, maxSupply, account, royaltySettings, getAdditionalSetupActions, }: {
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
- account: Address;
40
- maxSupply?: bigint | number;
41
- royaltySettings?: RoyaltySettingsType;
42
- royaltyBPS?: number;
43
- contract: ContractType;
44
- tokenMetadataURI: string;
45
- mintToCreatorCount?: bigint | number;
46
- salesConfig?: SalesConfigParamsType;
47
- getAdditionalSetupActions?: (args: {
48
- tokenId: bigint;
49
- contractAddress: Address;
50
- }) => Hex[];
51
- }): Promise<{
52
- send: (walletClient: WalletClient) => Promise<`0x${string}`>;
53
- tokenSetupActions: `0x${string}`[];
54
- contractAddress: `0x${string}`;
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 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 @@ __export(src_exports, {
24
24
  DefaultMintArguments: () => DefaultMintArguments,
25
25
  MintAPIClient: () => MintAPIClient,
26
26
  PremintAPIClient: () => PremintAPIClient,
27
- PremintClient: () => PremintClient,
28
27
  ZORA_API_BASE: () => ZORA_API_BASE,
29
28
  convertCollection: () => convertCollection,
30
29
  convertPremint: () => convertPremint,
30
+ create1155CreatorClient: () => create1155CreatorClient,
31
31
  create1155TokenSetupArgs: () => create1155TokenSetupArgs,
32
- createNew1155Token: () => createNew1155Token,
32
+ createPremintClient: () => createPremintClient,
33
33
  encodePremintForAPI: () => encodePremintForAPI,
34
34
  getPremintedLogFromReceipt: () => getPremintedLogFromReceipt,
35
35
  getSalesConfigFixedPrice: () => getSalesConfigFixedPrice,
@@ -381,6 +381,16 @@ var PremintClient = class extends ClientBase {
381
381
  getFixedPriceMinterAddress() {
382
382
  return import_protocol_deployments.zoraCreatorFixedPriceSaleStrategyAddress[999];
383
383
  }
384
+ getDataFromPremintReceipt(receipt) {
385
+ const premintedLog = getPremintedLogFromReceipt(receipt);
386
+ return {
387
+ premintedLog,
388
+ urls: this.makeUrls({
389
+ address: premintedLog?.contractAddress,
390
+ tokenId: premintedLog?.tokenId
391
+ })
392
+ };
393
+ }
384
394
  /**
385
395
  * Update existing premint given collection address and UID of existing premint.
386
396
  *
@@ -669,14 +679,11 @@ var PremintClient = class extends ClientBase {
669
679
  * @param settings.publicClient Optional public client for preflight checks.
670
680
  * @returns receipt, log, zoraURL
671
681
  */
672
- async executePremintWithWallet({
682
+ async executePremint({
673
683
  data,
674
684
  account,
675
- walletClient,
676
- mintArguments,
677
- publicClient
685
+ mintArguments
678
686
  }) {
679
- publicClient = this.getPublicClient(publicClient);
680
687
  if (mintArguments && mintArguments?.quantityToMint < 1) {
681
688
  throw new Error("Quantity to mint cannot be below 1");
682
689
  }
@@ -689,34 +696,29 @@ var PremintClient = class extends ClientBase {
689
696
  numberToMint,
690
697
  mintArguments?.mintComment || ""
691
698
  ];
692
- if (!account) {
693
- account = walletClient.account;
694
- }
695
699
  if (!account) {
696
700
  throw new Error("Wallet not passed in");
697
701
  }
698
702
  const value = numberToMint * REWARD_PER_TOKEN;
699
- const { request } = await publicClient.simulateContract({
703
+ const request = {
700
704
  account,
701
705
  abi: import_protocol_deployments.zoraCreator1155PremintExecutorImplABI,
702
706
  functionName: "premint",
703
707
  value,
704
708
  address: targetAddress,
705
709
  args
706
- });
707
- const hash = await walletClient.writeContract(request);
708
- const receipt = await publicClient.waitForTransactionReceipt({ hash });
709
- const premintedLog = getPremintedLogFromReceipt(receipt);
710
+ };
710
711
  return {
711
- receipt,
712
- premintedLog,
713
- urls: this.makeUrls({
714
- address: premintedLog?.contractAddress,
715
- tokenId: premintedLog?.tokenId
716
- })
712
+ request
717
713
  };
718
714
  }
719
715
  };
716
+ function createPremintClient({
717
+ chain,
718
+ premintAPIClient
719
+ }) {
720
+ return new PremintClient(chain, premintAPIClient);
721
+ }
720
722
 
721
723
  // src/mint/mint-api-client.ts
722
724
  function encodeQueryParameters(params) {
@@ -788,11 +790,6 @@ function create1155TokenSetupArgs({
788
790
  ...salesConfig
789
791
  };
790
792
  const setupActions = [
791
- (0, import_viem4.encodeFunctionData)({
792
- abi: import_protocol_deployments2.zoraCreator1155ImplABI,
793
- functionName: "addPermission",
794
- args: [0n, fixedPriceMinterAddress, PERMISSION_BIT_MINTER]
795
- }),
796
793
  (0, import_viem4.encodeFunctionData)({
797
794
  abi: import_protocol_deployments2.zoraCreator1155ImplABI,
798
795
  functionName: "assumeLastTokenIdMatches",
@@ -807,6 +804,11 @@ function create1155TokenSetupArgs({
807
804
  functionName: "setupNewToken",
808
805
  args: [tokenMetadataURI, maxSupply]
809
806
  }),
807
+ (0, import_viem4.encodeFunctionData)({
808
+ abi: import_protocol_deployments2.zoraCreator1155ImplABI,
809
+ functionName: "addPermission",
810
+ args: [0n, fixedPriceMinterAddress, PERMISSION_BIT_MINTER]
811
+ }),
810
812
  (0, import_viem4.encodeFunctionData)({
811
813
  abi: import_protocol_deployments2.zoraCreator1155ImplABI,
812
814
  functionName: "callSale",
@@ -895,95 +897,99 @@ async function getContractExists(publicClient, contract, account) {
895
897
  contractAddress: contract
896
898
  };
897
899
  }
898
- async function createNew1155Token({
899
- publicClient,
900
- contract,
901
- tokenMetadataURI,
902
- mintToCreatorCount = 1,
903
- salesConfig = {},
904
- maxSupply,
905
- account,
906
- royaltySettings,
907
- getAdditionalSetupActions
900
+ function create1155CreatorClient({
901
+ publicClient
908
902
  }) {
909
- const { contractExists, contractAddress } = await getContractExists(
910
- publicClient,
903
+ async function createNew1155Token({
911
904
  contract,
912
- account
913
- );
914
- let nextTokenId = 1n;
915
- if (contractExists) {
916
- nextTokenId = await publicClient.readContract({
917
- abi: import_protocol_deployments2.zoraCreator1155ImplABI,
918
- functionName: "nextTokenId",
919
- address: contractAddress
920
- });
921
- }
922
- const fixedPriceMinterAddress = await publicClient.readContract({
923
- abi: import_protocol_deployments2.zoraCreator1155FactoryImplABI,
924
- address: import_protocol_deployments2.zoraCreator1155FactoryImplAddress[999],
925
- functionName: "fixedPriceMinter"
926
- });
927
- let tokenSetupActions = create1155TokenSetupArgs({
928
905
  tokenMetadataURI,
929
- nextTokenId,
930
- salesConfig,
906
+ mintToCreatorCount = 1,
907
+ salesConfig = {},
931
908
  maxSupply,
932
- fixedPriceMinterAddress,
933
909
  account,
934
- mintToCreatorCount,
935
- royaltySettings
936
- });
937
- if (getAdditionalSetupActions) {
938
- tokenSetupActions = [
939
- ...getAdditionalSetupActions({ tokenId: nextTokenId, contractAddress }),
940
- ...tokenSetupActions
941
- ];
942
- }
943
- if (!contractAddress && typeof contract === "string") {
944
- throw new Error("Invariant: contract cannot be missing and an address");
945
- }
946
- if (!contractExists && typeof contract !== "string") {
947
- const { request } = await publicClient.simulateContract({
910
+ royaltySettings,
911
+ getAdditionalSetupActions
912
+ }) {
913
+ const { contractExists, contractAddress } = await getContractExists(
914
+ publicClient,
915
+ contract,
916
+ account
917
+ );
918
+ let nextTokenId = 1n;
919
+ if (contractExists) {
920
+ nextTokenId = await publicClient.readContract({
921
+ abi: import_protocol_deployments2.zoraCreator1155ImplABI,
922
+ functionName: "nextTokenId",
923
+ address: contractAddress
924
+ });
925
+ }
926
+ const fixedPriceMinterAddress = await publicClient.readContract({
948
927
  abi: import_protocol_deployments2.zoraCreator1155FactoryImplABI,
949
- functionName: "createContractDeterministic",
950
- account,
951
928
  address: import_protocol_deployments2.zoraCreator1155FactoryImplAddress[999],
952
- args: [
953
- contract.uri,
954
- contract.name,
955
- {
956
- // deprecated
957
- royaltyMintSchedule: 0,
958
- royaltyBPS: royaltySettings?.royaltyBPS || ROYALTY_BPS_DEFAULT,
959
- royaltyRecipient: royaltySettings?.royaltyRecipient || account
960
- },
961
- contract.defaultAdmin || account,
962
- tokenSetupActions
963
- ]
929
+ functionName: "fixedPriceMinter"
964
930
  });
965
- return {
966
- send: (walletClient) => walletClient.writeContract(request),
967
- tokenSetupActions,
968
- contractAddress,
969
- contractExists
970
- };
971
- } else if (contractExists) {
972
- const { request } = await publicClient.simulateContract({
973
- abi: import_protocol_deployments2.zoraCreator1155ImplABI,
974
- functionName: "multicall",
931
+ let tokenSetupActions = create1155TokenSetupArgs({
932
+ tokenMetadataURI,
933
+ nextTokenId,
934
+ salesConfig,
935
+ maxSupply,
936
+ fixedPriceMinterAddress,
975
937
  account,
976
- address: contractAddress,
977
- args: [tokenSetupActions]
938
+ mintToCreatorCount,
939
+ royaltySettings
978
940
  });
979
- return {
980
- send: (walletClient) => walletClient.writeContract(request),
981
- tokenSetupActions,
982
- contractAddress,
983
- contractExists
984
- };
941
+ if (getAdditionalSetupActions) {
942
+ tokenSetupActions = [
943
+ ...getAdditionalSetupActions({ tokenId: nextTokenId, contractAddress }),
944
+ ...tokenSetupActions
945
+ ];
946
+ }
947
+ if (!contractAddress && typeof contract === "string") {
948
+ throw new Error("Invariant: contract cannot be missing and an address");
949
+ }
950
+ if (!contractExists && typeof contract !== "string") {
951
+ const request = {
952
+ abi: import_protocol_deployments2.zoraCreator1155FactoryImplABI,
953
+ functionName: "createContractDeterministic",
954
+ account,
955
+ address: import_protocol_deployments2.zoraCreator1155FactoryImplAddress[999],
956
+ args: [
957
+ contract.uri,
958
+ contract.name,
959
+ {
960
+ // deprecated
961
+ royaltyMintSchedule: 0,
962
+ royaltyBPS: royaltySettings?.royaltyBPS || ROYALTY_BPS_DEFAULT,
963
+ royaltyRecipient: royaltySettings?.royaltyRecipient || account
964
+ },
965
+ contract.defaultAdmin || account,
966
+ tokenSetupActions
967
+ ]
968
+ };
969
+ return {
970
+ request,
971
+ tokenSetupActions,
972
+ contractAddress,
973
+ contractExists
974
+ };
975
+ } else if (contractExists) {
976
+ const request = {
977
+ abi: import_protocol_deployments2.zoraCreator1155ImplABI,
978
+ functionName: "multicall",
979
+ account,
980
+ address: contractAddress,
981
+ args: [tokenSetupActions]
982
+ };
983
+ return {
984
+ request,
985
+ tokenSetupActions,
986
+ contractAddress,
987
+ contractExists
988
+ };
989
+ }
990
+ throw new Error("Unsupported contract argument type");
985
991
  }
986
- throw new Error("Unsupported contract argument type");
992
+ return { createNew1155Token };
987
993
  }
988
994
  // Annotate the CommonJS export names for ESM import in node:
989
995
  0 && (module.exports = {
@@ -991,12 +997,12 @@ async function createNew1155Token({
991
997
  DefaultMintArguments,
992
998
  MintAPIClient,
993
999
  PremintAPIClient,
994
- PremintClient,
995
1000
  ZORA_API_BASE,
996
1001
  convertCollection,
997
1002
  convertPremint,
1003
+ create1155CreatorClient,
998
1004
  create1155TokenSetupArgs,
999
- createNew1155Token,
1005
+ createPremintClient,
1000
1006
  encodePremintForAPI,
1001
1007
  getPremintedLogFromReceipt,
1002
1008
  getSalesConfigFixedPrice,