@zoralabs/protocol-sdk 0.5.9 → 0.5.10

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.
@@ -1,8 +1,4 @@
1
1
  import { Address } from "viem";
2
- type CollectQueryResult = {
3
- tokenIds: bigint[];
4
- quantities: bigint[];
5
- };
6
2
  export declare const getMintsAccountBalanceWithPriceQuery: (account: Address) => {
7
3
  query: string;
8
4
  variables: {
@@ -33,27 +29,4 @@ export declare const selectMintsToCollectWithFromQueryResult: (mintAccountBalanc
33
29
  * @returns Total balance
34
30
  */
35
31
  export declare const sumBalances: (mintAccountBalances: Pick<MintAccountBalance, "balance">[]) => bigint;
36
- /***
37
- * Given an account and quantity of MINTs to use to collect with, queries for MINTs
38
- * owned by an account, and selects the best MINTs to use to collect with that will satisfy that quantity.
39
- * @param account Account to query for MINTs
40
- * @param chainId
41
- * @param quantityToCollect How many MINTs to use to collect with
42
- * @returns
43
- */
44
- export declare const getMINTsToCollectWith: ({ account, chainId, quantityToCollect, }: {
45
- account: Address;
46
- chainId: number;
47
- quantityToCollect: bigint;
48
- }) => Promise<CollectQueryResult>;
49
- /***
50
- * Given an account, queries for MINTs owned by an account, and sums the balances.
51
- * @param account Account to query for MINTs
52
- * @returns Total MINTs balance of account
53
- */
54
- export declare const getMINTsBalance: ({ chainId, account, }: {
55
- account: Address;
56
- chainId: number;
57
- }) => Promise<bigint>;
58
- export {};
59
32
  //# sourceMappingURL=mints-queries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mints-queries.d.ts","sourceRoot":"","sources":["../../src/mints/mints-queries.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAG/B,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,oCAAoC,YAAa,OAAO;;;;;CAiBpE,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AAS,CAAC,EAAE,WAK3D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zoralabs/protocol-sdk",
3
- "version": "0.5.9",
3
+ "version": "0.5.10",
4
4
  "repository": "https://github.com/ourzora/zora-protocol",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -29,12 +29,12 @@
29
29
  "abitype": "^0.10.3"
30
30
  },
31
31
  "peerDependencies": {
32
- "graphql-request": "^6.1.0",
33
32
  "viem": "^1.19.15"
34
33
  },
35
34
  "devDependencies": {
36
35
  "@lavamoat/preinstall-always-fail": "2.0.0",
37
36
  "graphql-prettier": "^1.0.6",
37
+ "graphql-request": "^6.1.0",
38
38
  "typescript": "^5.2.2",
39
39
  "vite": "^4.5.0",
40
40
  "vitest": "^0.34.6",
@@ -214,6 +214,7 @@ describe("MINTs collecting and redeeming.", () => {
214
214
 
215
215
  expect(totalMintsBalance).toEqual(initialMintsQuantityToMint);
216
216
  },
217
+ 20_000,
217
218
  );
218
219
  anvilTest(
219
220
  "can use MINTSs to collect premint and non-premint",
@@ -362,6 +363,7 @@ describe("MINTs collecting and redeeming.", () => {
362
363
  (firstQuantityToCollect + secondQuantityToCollect),
363
364
  );
364
365
  },
366
+ 20_000,
365
367
  );
366
368
  anvilTest(
367
369
  "can decode errors from transferBatchToManagerAndCall",
@@ -440,6 +442,7 @@ describe("MINTs collecting and redeeming.", () => {
440
442
  }
441
443
  }
442
444
  },
445
+ 20_000,
443
446
  );
444
447
  anvilTest(
445
448
  "can use MINTs to gaslessly collect premint",
@@ -546,6 +549,7 @@ describe("MINTs collecting and redeeming.", () => {
546
549
  ),
547
550
  ).toBe(initialMintsBalance - premintQuantityToCollect);
548
551
  },
552
+ 20_000,
549
553
  );
550
554
 
551
555
  anvilTest(
@@ -715,5 +719,6 @@ describe("MINTs collecting and redeeming.", () => {
715
719
 
716
720
  expect(tokenBalance).toBe(quantityToMintOn1155 * 2n);
717
721
  },
722
+ 20_000,
718
723
  );
719
724
  });
@@ -1,11 +1,5 @@
1
- import { getSubgraphUrl } from "src/apis/chain-constants";
2
1
  import { Address } from "viem";
3
- import { request, gql } from "graphql-request";
4
-
5
- type CollectQueryResult = {
6
- tokenIds: bigint[];
7
- quantities: bigint[];
8
- };
2
+ import { gql } from "graphql-request";
9
3
 
10
4
  export const getMintsAccountBalanceWithPriceQuery = (account: Address) => {
11
5
  const query = gql`
@@ -99,61 +93,3 @@ export const sumBalances = (
99
93
  return acc + BigInt(curr.balance);
100
94
  }, BigInt(0));
101
95
  };
102
-
103
- /***
104
- * Given an account and quantity of MINTs to use to collect with, queries for MINTs
105
- * owned by an account, and selects the best MINTs to use to collect with that will satisfy that quantity.
106
- * @param account Account to query for MINTs
107
- * @param chainId
108
- * @param quantityToCollect How many MINTs to use to collect with
109
- * @returns
110
- */
111
- export const getMINTsToCollectWith = async ({
112
- account,
113
- chainId,
114
- quantityToCollect,
115
- }: {
116
- account: Address;
117
- chainId: number;
118
- quantityToCollect: bigint;
119
- }): Promise<CollectQueryResult> => {
120
- const subgraphUrl = getSubgraphUrl(chainId);
121
-
122
- const { query, variables } = getMintsAccountBalanceWithPriceQuery(account);
123
-
124
- const result = await request<MintAccountBalancesQueryResult>(
125
- subgraphUrl,
126
- query,
127
- variables,
128
- );
129
-
130
- return selectMintsToCollectWithFromQueryResult(
131
- result.mintTokenBalances,
132
- quantityToCollect,
133
- );
134
- };
135
-
136
- /***
137
- * Given an account, queries for MINTs owned by an account, and sums the balances.
138
- * @param account Account to query for MINTs
139
- * @returns Total MINTs balance of account
140
- */
141
- export const getMINTsBalance = async ({
142
- chainId,
143
- account,
144
- }: {
145
- account: Address;
146
- chainId: number;
147
- }) => {
148
- const subgraphUrl = getSubgraphUrl(chainId);
149
-
150
- const { query, variables } = getMintsAccountBalanceWithPriceQuery(account);
151
-
152
- const result = await request<MintAccountBalancesQueryResult>(
153
- subgraphUrl,
154
- query,
155
- variables,
156
- );
157
-
158
- return sumBalances(result.mintTokenBalances);
159
- };