@zoralabs/protocol-sdk 0.7.2-ALLOWLIST.0 → 0.7.2

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.
Files changed (63) hide show
  1. package/.turbo/turbo-build.log +15 -0
  2. package/CHANGELOG.md +2 -2
  3. package/dist/apis/http-api-base.d.ts.map +1 -1
  4. package/dist/constants.d.ts +27 -0
  5. package/dist/constants.d.ts.map +1 -1
  6. package/dist/create/1155-create-helper.d.ts +0 -1
  7. package/dist/create/1155-create-helper.d.ts.map +1 -1
  8. package/dist/create/token-setup.d.ts +4 -3
  9. package/dist/create/token-setup.d.ts.map +1 -1
  10. package/dist/create/types.d.ts +4 -24
  11. package/dist/create/types.d.ts.map +1 -1
  12. package/dist/index.cjs +127 -237
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.ts +0 -2
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +128 -238
  17. package/dist/index.js.map +1 -1
  18. package/dist/mint/mint-queries.d.ts +1 -3
  19. package/dist/mint/mint-queries.d.ts.map +1 -1
  20. package/dist/mint/mint-transactions.d.ts +3 -5
  21. package/dist/mint/mint-transactions.d.ts.map +1 -1
  22. package/dist/mint/subgraph-mint-getter.d.ts +2 -1
  23. package/dist/mint/subgraph-mint-getter.d.ts.map +1 -1
  24. package/dist/mint/subgraph-queries.d.ts +14 -27
  25. package/dist/mint/subgraph-queries.d.ts.map +1 -1
  26. package/dist/mint/types.d.ts +11 -22
  27. package/dist/mint/types.d.ts.map +1 -1
  28. package/dist/mints/mints-contracts.d.ts +16 -0
  29. package/dist/mints/mints-contracts.d.ts.map +1 -1
  30. package/dist/premint/premint-client.d.ts +8 -0
  31. package/dist/premint/premint-client.d.ts.map +1 -1
  32. package/package.json +1 -2
  33. package/src/apis/http-api-base.ts +0 -12
  34. package/src/constants.ts +36 -0
  35. package/src/create/1155-create-helper.test.ts +325 -0
  36. package/src/create/1155-create-helper.ts +0 -17
  37. package/src/create/token-setup.ts +19 -116
  38. package/src/create/types.ts +4 -32
  39. package/src/index.ts +0 -4
  40. package/src/mint/mint-client.test.ts +263 -0
  41. package/src/mint/mint-queries.ts +0 -6
  42. package/src/mint/mint-transactions.ts +8 -74
  43. package/src/mint/subgraph-mint-getter.ts +41 -17
  44. package/src/mint/subgraph-queries.ts +36 -39
  45. package/src/mint/types.ts +12 -38
  46. package/src/mints/mints-contracts.test.ts +529 -0
  47. package/src/mints/mints-eth-unwrapper-and-caller.test.ts +467 -0
  48. package/src/mints/mints-queries.test.ts +105 -0
  49. package/src/premint/premint-client.test.ts +290 -0
  50. package/src/premint/preminter.test.ts +866 -0
  51. package/test-integration/setup-test-contracts.ts +96 -0
  52. package/tsconfig.build.json +10 -0
  53. package/tsup.config.ts +12 -0
  54. package/dist/allow-list/allow-list-client.d.ts +0 -25
  55. package/dist/allow-list/allow-list-client.d.ts.map +0 -1
  56. package/dist/allow-list/types.d.ts +0 -14
  57. package/dist/allow-list/types.d.ts.map +0 -1
  58. package/dist/apis/generated/allow-list-api-types.d.ts +0 -288
  59. package/dist/apis/generated/allow-list-api-types.d.ts.map +0 -1
  60. package/src/allow-list/allow-list-client.ts +0 -102
  61. package/src/allow-list/types.ts +0 -15
  62. package/src/apis/generated/allow-list-api-types.ts +0 -288
  63. package/yarn-error.log +0 -8602
@@ -2,42 +2,26 @@ import { GenericTokenIdTypes } from "src/types";
2
2
  import { Address } from "viem";
3
3
 
4
4
  export type FixedPriceSaleStrategyResult = {
5
- type: "FIXED_PRICE";
6
- fixedPrice: {
7
- address: Address;
8
- pricePerToken: string;
9
- saleEnd: string;
10
- saleStart: string;
11
- maxTokensPerAddress: string;
12
- };
5
+ address: Address;
6
+ pricePerToken: string;
7
+ saleEnd: string;
8
+ saleStart: string;
9
+ maxTokensPerAddress: string;
13
10
  };
14
11
 
15
- export type ERC20SaleStrategyResult = {
16
- type: "ERC_20_MINTER";
17
- erc20Minter: {
18
- address: Address;
19
- pricePerToken: string;
20
- saleEnd: string;
21
- saleStart: string;
22
- maxTokensPerAddress: string;
23
- currency: Address;
24
- };
25
- };
26
-
27
- export type PresaleSalesStrategyResult = {
28
- type: "PRESALE";
29
- presale: {
30
- address: Address;
31
- presaleStart: string;
32
- presaleEnd: string;
33
- merkleRoot: string;
34
- };
12
+ export type ERC20SaleStrategyResult = FixedPriceSaleStrategyResult & {
13
+ currency: Address;
35
14
  };
36
15
 
37
16
  export type SalesStrategyResult =
38
- | FixedPriceSaleStrategyResult
39
- | ERC20SaleStrategyResult
40
- | PresaleSalesStrategyResult;
17
+ | {
18
+ type: "FIXED_PRICE";
19
+ fixedPrice: FixedPriceSaleStrategyResult;
20
+ }
21
+ | {
22
+ type: "ERC_20_MINTER";
23
+ erc20Minter: ERC20SaleStrategyResult;
24
+ };
41
25
 
42
26
  export type TokenQueryResult = {
43
27
  tokenId?: string;
@@ -75,12 +59,6 @@ fragment SaleStrategy on SalesStrategyConfig {
75
59
  saleStart
76
60
  maxTokensPerAddress
77
61
  }
78
- presale {
79
- address
80
- presaleStart
81
- presaleEnd
82
- merkleRoot
83
- }
84
62
  }`;
85
63
 
86
64
  const TOKEN_FRAGMENT = `
@@ -91,7 +69,7 @@ fragment Token on ZoraCreateToken {
91
69
  totalMinted
92
70
  maxSupply
93
71
  tokenStandard
94
- salesStrategies(where: {type_in: ["FIXED_PRICE", "ERC_20_MINTER", "PRESALE"]}) {
72
+ salesStrategies(where: {type_in: ["FIXED_PRICE", "ERC_20_MINTER"]}) {
95
73
  ...SaleStrategy
96
74
  }
97
75
  contract {
@@ -100,7 +78,7 @@ fragment Token on ZoraCreateToken {
100
78
  contractVersion
101
79
  contractURI
102
80
  name
103
- salesStrategies(where: {type_in: ["FIXED_PRICE", "ERC_20_MINTER", "PRESALE"]}) {
81
+ salesStrategies(where: {type_in: ["FIXED_PRICE", "ERC_20_MINTER"]}) {
104
82
  ...SaleStrategy
105
83
  }
106
84
  }
@@ -139,6 +117,25 @@ query ($id: ID!) {
139
117
  };
140
118
  }
141
119
 
120
+ export function buildGetDefaultMintPriceQuery({}): ISubgraphQuery<
121
+ bigint | undefined
122
+ > {
123
+ return {
124
+ query: `
125
+ {
126
+ defaultMintPrice(id: "0x0000000000000000000000000000000000000000") {
127
+ pricePerToken
128
+ }
129
+ }
130
+ `,
131
+ variables: {},
132
+ parseResponseData: (responseData: any | undefined) =>
133
+ responseData?.defaultMintPrice?.pricePerToken
134
+ ? BigInt(responseData?.defaultMintPrice?.pricePerToken)
135
+ : undefined,
136
+ };
137
+ }
138
+
142
139
  export function buildContractTokensQuery({
143
140
  tokenAddress,
144
141
  }: {
package/src/mint/types.ts CHANGED
@@ -3,7 +3,6 @@ import {
3
3
  GenericTokenIdTypes,
4
4
  SimulateContractParametersWithAccount,
5
5
  } from "src/types";
6
- import { AllowListEntry } from "src/allow-list/types";
7
6
 
8
7
  export type MintParameters<MintType> = {
9
8
  /** Type of the collection to be minted. */
@@ -26,7 +25,7 @@ export type PremintMintParameters = MintParameters<"premint"> & {
26
25
  uid: number;
27
26
  };
28
27
 
29
- export type MintType = "1155" | "721" | "allowlist" | "premint";
28
+ export type MintType = "1155" | "721" | "premint";
30
29
 
31
30
  export type MintTypes =
32
31
  | Erc1155MintParameters
@@ -64,8 +63,6 @@ export type MintParametersBase = {
64
63
  mintRecipient?: Address;
65
64
  /** If this is a premint, the address to get the first minter reward */
66
65
  firstMinter?: Address;
67
- /** If this is an allow list mint, the info for the allow list entry */
68
- allowListEntry?: AllowListEntry;
69
66
  };
70
67
 
71
68
  export type MakeMintParametersArgumentsBase = MintParametersBase & {
@@ -102,60 +99,40 @@ export type GetMintCostsParameters = {
102
99
  quantityMinted: number | bigint;
103
100
  } & MintTypes;
104
101
 
105
- export type SaleType = "fixedPrice" | "erc20" | "allowlist" | "premint";
102
+ export type SaleType = "fixedPrice" | "erc20" | "premint";
106
103
 
107
104
  type SaleStrategy<T extends SaleType> = {
108
105
  saleType: T;
109
- };
110
-
111
- type PricedSaleStrategy = {
112
106
  pricePerToken: bigint;
113
107
  maxTokensPerAddress: bigint;
114
108
  };
115
109
 
116
- export type StartAndEnd = {
110
+ type FixedPriceSaleStrategy = SaleStrategy<"fixedPrice"> & {
111
+ address: Address;
117
112
  saleStart: string;
118
113
  saleEnd: string;
119
114
  };
120
115
 
121
- type FixedPriceSaleStrategy = SaleStrategy<"fixedPrice"> &
122
- PricedSaleStrategy &
123
- StartAndEnd & {
124
- address: Address;
125
- };
126
-
127
- type ERC20SaleStrategy = SaleStrategy<"erc20"> &
128
- PricedSaleStrategy &
129
- StartAndEnd & {
130
- address: Address;
131
- currency: Address;
132
- };
133
-
134
- type AllowListSaleStrategy = SaleStrategy<"allowlist"> & {
116
+ type ERC20SaleStrategy = SaleStrategy<"erc20"> & {
135
117
  address: Address;
136
118
  saleStart: string;
137
119
  saleEnd: string;
138
- merkleRoot: string;
120
+ currency: Address;
139
121
  };
140
122
 
141
- type PremintSaleStrategy = SaleStrategy<"premint"> &
142
- PricedSaleStrategy & {
143
- duration: bigint;
144
- };
123
+ type PremintSaleStrategy = SaleStrategy<"premint"> & {
124
+ duration: bigint;
125
+ };
145
126
 
146
127
  export type SaleStrategies =
147
128
  | FixedPriceSaleStrategy
148
129
  | ERC20SaleStrategy
149
- | AllowListSaleStrategy
150
130
  | PremintSaleStrategy;
151
131
 
152
- export type OnchainSalesStrategies =
153
- | FixedPriceSaleStrategy
154
- | ERC20SaleStrategy
155
- | AllowListSaleStrategy;
132
+ export type OnchainSalesStrategies = FixedPriceSaleStrategy | ERC20SaleStrategy;
156
133
 
157
134
  export function isErc20SaleStrategy(
158
- salesConfig: SaleStrategies,
135
+ salesConfig: FixedPriceSaleStrategy | ERC20SaleStrategy | PremintSaleStrategy,
159
136
  ): salesConfig is ERC20SaleStrategy {
160
137
  return salesConfig.saleType === "erc20";
161
138
  }
@@ -196,10 +173,7 @@ export type PremintMintable = MintableBase & {
196
173
  };
197
174
 
198
175
  export type OnchainSalesConfigAndTokenInfo = {
199
- salesConfig:
200
- | FixedPriceSaleStrategy
201
- | ERC20SaleStrategy
202
- | AllowListSaleStrategy;
176
+ salesConfig: FixedPriceSaleStrategy | ERC20SaleStrategy;
203
177
  } & OnchainMintable;
204
178
 
205
179
  export type PremintSalesConfigAndTokenInfo = {