@zoralabs/protocol-sdk 0.5.8 → 0.5.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zoralabs/protocol-sdk",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
4
4
  "repository": "https://github.com/ourzora/zora-protocol",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -29,8 +29,8 @@
29
29
  "abitype": "^0.10.3"
30
30
  },
31
31
  "peerDependencies": {
32
- "viem": "^1.19.15",
33
- "graphql-request": "^6.1.0"
32
+ "graphql-request": "^6.1.0",
33
+ "viem": "^1.19.15"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@lavamoat/preinstall-always-fail": "2.0.0",
@@ -101,4 +101,37 @@ describe("create-helper", () => {
101
101
  },
102
102
  20 * 1000,
103
103
  );
104
+ anvilTest(
105
+ "creates a new token with a create referral address",
106
+ async ({ viemClients: { testClient, publicClient, walletClient } }) => {
107
+ const addresses = await walletClient.getAddresses();
108
+ const creatorAddress = addresses[0]!;
109
+ await testClient.setBalance({
110
+ address: creatorAddress,
111
+ value: parseEther("1"),
112
+ });
113
+ const creatorClient = create1155CreatorClient({
114
+ publicClient: publicClient,
115
+ });
116
+ const { request } = await creatorClient.createNew1155Token({
117
+ contract: {
118
+ name: "testContract",
119
+ uri: demoContractMetadataURI,
120
+ },
121
+ tokenMetadataURI: demoTokenMetadataURI,
122
+ account: creatorAddress,
123
+ mintToCreatorCount: 1,
124
+ createReferral: creatorAddress,
125
+ });
126
+ const { request: simulationResponse } =
127
+ await publicClient.simulateContract(request);
128
+ const hash = await walletClient.writeContract(simulationResponse);
129
+ const receipt = await publicClient.waitForTransactionReceipt({ hash });
130
+ expect(receipt).not.toBeNull();
131
+ console.log(receipt);
132
+ expect(receipt.to).to.equal("0xa72724cc3dcef210141a1b84c61824074151dc99");
133
+ expect(getTokenIdFromCreateReceipt(receipt)).to.be.equal(2n);
134
+ },
135
+ 20 * 1000,
136
+ );
104
137
  });
@@ -246,6 +246,7 @@ export function create1155CreatorClient({
246
246
  maxSupply,
247
247
  account,
248
248
  royaltySettings,
249
+ createReferral,
249
250
  getAdditionalSetupActions,
250
251
  }: {
251
252
  account: Address;
@@ -256,6 +257,7 @@ export function create1155CreatorClient({
256
257
  tokenMetadataURI: string;
257
258
  mintToCreatorCount?: bigint | number;
258
259
  salesConfig?: SalesConfigParamsType;
260
+ createReferral?: Address;
259
261
  getAdditionalSetupActions?: (args: {
260
262
  tokenId: bigint;
261
263
  contractAddress: Address;
@@ -296,6 +298,7 @@ export function create1155CreatorClient({
296
298
  account,
297
299
  mintToCreatorCount,
298
300
  royaltySettings,
301
+ createReferral,
299
302
  });
300
303
  if (getAdditionalSetupActions) {
301
304
  tokenSetupActions = [