@zoralabs/protocol-sdk 0.7.2-ALLOWLIST.0 → 0.7.3-SPARKS.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.
- package/CHANGELOG.md +10 -2
- package/dist/apis/http-api-base.d.ts.map +1 -1
- package/dist/constants.d.ts +27 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/create/1155-create-helper.d.ts +0 -1
- package/dist/create/1155-create-helper.d.ts.map +1 -1
- package/dist/create/token-setup.d.ts +4 -3
- package/dist/create/token-setup.d.ts.map +1 -1
- package/dist/create/types.d.ts +4 -24
- package/dist/create/types.d.ts.map +1 -1
- package/dist/index.cjs +128 -238
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +130 -240
- package/dist/index.js.map +1 -1
- package/dist/mint/mint-queries.d.ts +1 -3
- package/dist/mint/mint-queries.d.ts.map +1 -1
- package/dist/mint/mint-transactions.d.ts +3 -5
- package/dist/mint/mint-transactions.d.ts.map +1 -1
- package/dist/mint/subgraph-mint-getter.d.ts +2 -1
- package/dist/mint/subgraph-mint-getter.d.ts.map +1 -1
- package/dist/mint/subgraph-queries.d.ts +14 -27
- package/dist/mint/subgraph-queries.d.ts.map +1 -1
- package/dist/mint/types.d.ts +11 -22
- package/dist/mint/types.d.ts.map +1 -1
- package/dist/mints/mints-contracts.d.ts +14 -14
- package/dist/mints/mints-relay-example.d.ts +4 -4
- package/dist/mints/mints-relay-example.d.ts.map +1 -1
- package/dist/premint/premint-client.d.ts +8 -0
- package/dist/premint/premint-client.d.ts.map +1 -1
- package/package.json +2 -3
- package/src/apis/http-api-base.ts +0 -12
- package/src/constants.ts +36 -0
- package/src/create/1155-create-helper.ts +0 -17
- package/src/create/token-setup.ts +19 -116
- package/src/create/types.ts +4 -32
- package/src/index.ts +0 -4
- package/src/mint/mint-queries.ts +0 -6
- package/src/mint/mint-transactions.ts +8 -74
- package/src/mint/subgraph-mint-getter.ts +41 -17
- package/src/mint/subgraph-queries.ts +36 -39
- package/src/mint/types.ts +12 -38
- package/src/mints/mints-eth-unwrapper-and-caller.ts +2 -2
- package/src/mints/mints-relay-example.ts +10 -10
- package/dist/allow-list/allow-list-client.d.ts +0 -25
- package/dist/allow-list/allow-list-client.d.ts.map +0 -1
- package/dist/allow-list/types.d.ts +0 -14
- package/dist/allow-list/types.d.ts.map +0 -1
- package/dist/apis/generated/allow-list-api-types.d.ts +0 -288
- package/dist/apis/generated/allow-list-api-types.d.ts.map +0 -1
- package/src/allow-list/allow-list-client.ts +0 -102
- package/src/allow-list/types.ts +0 -15
- package/src/apis/generated/allow-list-api-types.ts +0 -288
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IHttpClient,
|
|
3
|
-
httpClient as defaultHttpClient,
|
|
4
|
-
} from "src/apis/http-api-base";
|
|
5
|
-
import { paths } from "../apis/generated/allow-list-api-types";
|
|
6
|
-
import { Hex } from "viem";
|
|
7
|
-
import { AllowList } from "./types";
|
|
8
|
-
|
|
9
|
-
type AllowListCreateType = paths["/allowlist"]["post"];
|
|
10
|
-
type AllowListCreateParameters =
|
|
11
|
-
AllowListCreateType["requestBody"]["content"]["application/json"];
|
|
12
|
-
type AllowListCreateResponse = {
|
|
13
|
-
existing?: {
|
|
14
|
-
entries: AllowListCreateParameters["entries"];
|
|
15
|
-
root: string;
|
|
16
|
-
added: string;
|
|
17
|
-
};
|
|
18
|
-
success: boolean;
|
|
19
|
-
root: string;
|
|
20
|
-
associated_id?: string;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const ALLOW_LIST_API_BASE = "http://allowlist.zora.co/";
|
|
24
|
-
type AllowListAllowedResponse = {
|
|
25
|
-
maxCanMint: number;
|
|
26
|
-
price: string;
|
|
27
|
-
proof: string[];
|
|
28
|
-
}[];
|
|
29
|
-
|
|
30
|
-
export const createAllowList = async ({
|
|
31
|
-
allowList,
|
|
32
|
-
httpClient = defaultHttpClient,
|
|
33
|
-
}: {
|
|
34
|
-
allowList: AllowList;
|
|
35
|
-
httpClient?: IHttpClient;
|
|
36
|
-
baseUrl?: string;
|
|
37
|
-
}) => {
|
|
38
|
-
const { post, retries } = httpClient;
|
|
39
|
-
|
|
40
|
-
const data: AllowListCreateParameters = {
|
|
41
|
-
entries: allowList.entries.map((entry) => ({
|
|
42
|
-
user: entry.user,
|
|
43
|
-
maxCanMint: entry.maxCanMint,
|
|
44
|
-
price: entry.price.toString(),
|
|
45
|
-
})),
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
await retries(() =>
|
|
50
|
-
post<AllowListCreateResponse>(`${ALLOW_LIST_API_BASE}allowlist`, data),
|
|
51
|
-
)
|
|
52
|
-
).root;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
function padHex(value: string): Hex {
|
|
56
|
-
if (value.startsWith("0x")) return value as Hex;
|
|
57
|
-
|
|
58
|
-
return `0x${value}`;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export const getAllowListEntry = async ({
|
|
62
|
-
merkleRoot,
|
|
63
|
-
address,
|
|
64
|
-
httpClient = defaultHttpClient,
|
|
65
|
-
}: {
|
|
66
|
-
merkleRoot: string;
|
|
67
|
-
httpClient?: IHttpClient;
|
|
68
|
-
address: string;
|
|
69
|
-
}) => {
|
|
70
|
-
const { retries, get } = httpClient;
|
|
71
|
-
|
|
72
|
-
const response = await retries(() =>
|
|
73
|
-
get<AllowListAllowedResponse>(
|
|
74
|
-
`${ALLOW_LIST_API_BASE}allowed?user=${address}&root=${merkleRoot}`,
|
|
75
|
-
),
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
const entries = response?.map((x) => ({
|
|
79
|
-
maxCanMint: x.maxCanMint,
|
|
80
|
-
price: BigInt(x.price),
|
|
81
|
-
proof: x.proof.map(padHex),
|
|
82
|
-
}));
|
|
83
|
-
|
|
84
|
-
const entry = entries?.sort(
|
|
85
|
-
(a, b) => Number(a.price) - Number(b.price) || b.maxCanMint - a.maxCanMint,
|
|
86
|
-
)[0];
|
|
87
|
-
|
|
88
|
-
return {
|
|
89
|
-
accessAllowed: entry && entry?.proof?.length,
|
|
90
|
-
allowListEntry: entry,
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export interface IAllowListClient {
|
|
95
|
-
createAllowList: typeof createAllowList;
|
|
96
|
-
getAllowListEntry: typeof getAllowListEntry;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export const defaultAllowListClient = (): IAllowListClient => ({
|
|
100
|
-
createAllowList,
|
|
101
|
-
getAllowListEntry,
|
|
102
|
-
});
|
package/src/allow-list/types.ts
DELETED
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was auto-generated by openapi-typescript.
|
|
3
|
-
* Do not make direct changes to the file.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export interface paths {
|
|
7
|
-
"/_health": {
|
|
8
|
-
parameters: {
|
|
9
|
-
query?: never;
|
|
10
|
-
header?: never;
|
|
11
|
-
path?: never;
|
|
12
|
-
cookie?: never;
|
|
13
|
-
};
|
|
14
|
-
/** Health */
|
|
15
|
-
get: operations["health__health_get"];
|
|
16
|
-
put?: never;
|
|
17
|
-
post?: never;
|
|
18
|
-
delete?: never;
|
|
19
|
-
options?: never;
|
|
20
|
-
head?: never;
|
|
21
|
-
patch?: never;
|
|
22
|
-
trace?: never;
|
|
23
|
-
};
|
|
24
|
-
"/allowlist": {
|
|
25
|
-
parameters: {
|
|
26
|
-
query?: never;
|
|
27
|
-
header?: never;
|
|
28
|
-
path?: never;
|
|
29
|
-
cookie?: never;
|
|
30
|
-
};
|
|
31
|
-
get?: never;
|
|
32
|
-
put?: never;
|
|
33
|
-
/**
|
|
34
|
-
* Add Allowlist
|
|
35
|
-
* @description This route adds a new allowlist
|
|
36
|
-
*/
|
|
37
|
-
post: operations["add_allowlist_allowlist_post"];
|
|
38
|
-
delete?: never;
|
|
39
|
-
options?: never;
|
|
40
|
-
head?: never;
|
|
41
|
-
patch?: never;
|
|
42
|
-
trace?: never;
|
|
43
|
-
};
|
|
44
|
-
"/allowed": {
|
|
45
|
-
parameters: {
|
|
46
|
-
query?: never;
|
|
47
|
-
header?: never;
|
|
48
|
-
path?: never;
|
|
49
|
-
cookie?: never;
|
|
50
|
-
};
|
|
51
|
-
/** Allowed */
|
|
52
|
-
get: operations["allowed_allowed_get"];
|
|
53
|
-
put?: never;
|
|
54
|
-
post?: never;
|
|
55
|
-
delete?: never;
|
|
56
|
-
options?: never;
|
|
57
|
-
head?: never;
|
|
58
|
-
patch?: never;
|
|
59
|
-
trace?: never;
|
|
60
|
-
};
|
|
61
|
-
"/allowlist/{root}": {
|
|
62
|
-
parameters: {
|
|
63
|
-
query?: never;
|
|
64
|
-
header?: never;
|
|
65
|
-
path?: never;
|
|
66
|
-
cookie?: never;
|
|
67
|
-
};
|
|
68
|
-
/** Allowlist */
|
|
69
|
-
get: operations["allowlist_allowlist__root__get"];
|
|
70
|
-
put?: never;
|
|
71
|
-
post?: never;
|
|
72
|
-
delete?: never;
|
|
73
|
-
options?: never;
|
|
74
|
-
head?: never;
|
|
75
|
-
patch?: never;
|
|
76
|
-
trace?: never;
|
|
77
|
-
};
|
|
78
|
-
"/allowlist/{root}/count": {
|
|
79
|
-
parameters: {
|
|
80
|
-
query?: never;
|
|
81
|
-
header?: never;
|
|
82
|
-
path?: never;
|
|
83
|
-
cookie?: never;
|
|
84
|
-
};
|
|
85
|
-
/** Allowlist Count */
|
|
86
|
-
get: operations["allowlist_count_allowlist__root__count_get"];
|
|
87
|
-
put?: never;
|
|
88
|
-
post?: never;
|
|
89
|
-
delete?: never;
|
|
90
|
-
options?: never;
|
|
91
|
-
head?: never;
|
|
92
|
-
patch?: never;
|
|
93
|
-
trace?: never;
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
export type webhooks = Record<string, never>;
|
|
97
|
-
export interface components {
|
|
98
|
-
schemas: {
|
|
99
|
-
/**
|
|
100
|
-
* AllowlistEntry
|
|
101
|
-
* @description Currently matches zora-nft-drops model
|
|
102
|
-
*/
|
|
103
|
-
AllowlistEntry: {
|
|
104
|
-
/** User */
|
|
105
|
-
user: string;
|
|
106
|
-
/** Price */
|
|
107
|
-
price: string;
|
|
108
|
-
/** Maxcanmint */
|
|
109
|
-
maxCanMint: number;
|
|
110
|
-
};
|
|
111
|
-
/** AllowlistRequest */
|
|
112
|
-
AllowlistRequest: {
|
|
113
|
-
/** Entries */
|
|
114
|
-
entries: components["schemas"]["AllowlistEntry"][];
|
|
115
|
-
/** Contract */
|
|
116
|
-
contract?: string;
|
|
117
|
-
};
|
|
118
|
-
/** HTTPValidationError */
|
|
119
|
-
HTTPValidationError: {
|
|
120
|
-
/** Detail */
|
|
121
|
-
detail?: components["schemas"]["ValidationError"][];
|
|
122
|
-
};
|
|
123
|
-
/** ValidationError */
|
|
124
|
-
ValidationError: {
|
|
125
|
-
/** Location */
|
|
126
|
-
loc: (string | number)[];
|
|
127
|
-
/** Message */
|
|
128
|
-
msg: string;
|
|
129
|
-
/** Error Type */
|
|
130
|
-
type: string;
|
|
131
|
-
};
|
|
132
|
-
};
|
|
133
|
-
responses: never;
|
|
134
|
-
parameters: never;
|
|
135
|
-
requestBodies: never;
|
|
136
|
-
headers: never;
|
|
137
|
-
pathItems: never;
|
|
138
|
-
}
|
|
139
|
-
export type $defs = Record<string, never>;
|
|
140
|
-
export interface operations {
|
|
141
|
-
health__health_get: {
|
|
142
|
-
parameters: {
|
|
143
|
-
query?: never;
|
|
144
|
-
header?: never;
|
|
145
|
-
path?: never;
|
|
146
|
-
cookie?: never;
|
|
147
|
-
};
|
|
148
|
-
requestBody?: never;
|
|
149
|
-
responses: {
|
|
150
|
-
/** @description Successful Response */
|
|
151
|
-
200: {
|
|
152
|
-
headers: {
|
|
153
|
-
[name: string]: unknown;
|
|
154
|
-
};
|
|
155
|
-
content: {
|
|
156
|
-
"application/json": unknown;
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
};
|
|
161
|
-
add_allowlist_allowlist_post: {
|
|
162
|
-
parameters: {
|
|
163
|
-
query?: never;
|
|
164
|
-
header?: never;
|
|
165
|
-
path?: never;
|
|
166
|
-
cookie?: never;
|
|
167
|
-
};
|
|
168
|
-
requestBody: {
|
|
169
|
-
content: {
|
|
170
|
-
"application/json": components["schemas"]["AllowlistRequest"];
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
|
-
responses: {
|
|
174
|
-
/** @description Successful Response */
|
|
175
|
-
200: {
|
|
176
|
-
headers: {
|
|
177
|
-
[name: string]: unknown;
|
|
178
|
-
};
|
|
179
|
-
content: {
|
|
180
|
-
"application/json": unknown;
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
/** @description Validation Error */
|
|
184
|
-
422: {
|
|
185
|
-
headers: {
|
|
186
|
-
[name: string]: unknown;
|
|
187
|
-
};
|
|
188
|
-
content: {
|
|
189
|
-
"application/json": components["schemas"]["HTTPValidationError"];
|
|
190
|
-
};
|
|
191
|
-
};
|
|
192
|
-
};
|
|
193
|
-
};
|
|
194
|
-
allowed_allowed_get: {
|
|
195
|
-
parameters: {
|
|
196
|
-
query: {
|
|
197
|
-
user: string;
|
|
198
|
-
root: string;
|
|
199
|
-
};
|
|
200
|
-
header?: never;
|
|
201
|
-
path?: never;
|
|
202
|
-
cookie?: never;
|
|
203
|
-
};
|
|
204
|
-
requestBody?: never;
|
|
205
|
-
responses: {
|
|
206
|
-
/** @description Successful Response */
|
|
207
|
-
200: {
|
|
208
|
-
headers: {
|
|
209
|
-
[name: string]: unknown;
|
|
210
|
-
};
|
|
211
|
-
content: {
|
|
212
|
-
"application/json": unknown;
|
|
213
|
-
};
|
|
214
|
-
};
|
|
215
|
-
/** @description Validation Error */
|
|
216
|
-
422: {
|
|
217
|
-
headers: {
|
|
218
|
-
[name: string]: unknown;
|
|
219
|
-
};
|
|
220
|
-
content: {
|
|
221
|
-
"application/json": components["schemas"]["HTTPValidationError"];
|
|
222
|
-
};
|
|
223
|
-
};
|
|
224
|
-
};
|
|
225
|
-
};
|
|
226
|
-
allowlist_allowlist__root__get: {
|
|
227
|
-
parameters: {
|
|
228
|
-
query?: never;
|
|
229
|
-
header?: never;
|
|
230
|
-
path: {
|
|
231
|
-
root: string;
|
|
232
|
-
};
|
|
233
|
-
cookie?: never;
|
|
234
|
-
};
|
|
235
|
-
requestBody?: never;
|
|
236
|
-
responses: {
|
|
237
|
-
/** @description Successful Response */
|
|
238
|
-
200: {
|
|
239
|
-
headers: {
|
|
240
|
-
[name: string]: unknown;
|
|
241
|
-
};
|
|
242
|
-
content: {
|
|
243
|
-
"application/json": unknown;
|
|
244
|
-
};
|
|
245
|
-
};
|
|
246
|
-
/** @description Validation Error */
|
|
247
|
-
422: {
|
|
248
|
-
headers: {
|
|
249
|
-
[name: string]: unknown;
|
|
250
|
-
};
|
|
251
|
-
content: {
|
|
252
|
-
"application/json": components["schemas"]["HTTPValidationError"];
|
|
253
|
-
};
|
|
254
|
-
};
|
|
255
|
-
};
|
|
256
|
-
};
|
|
257
|
-
allowlist_count_allowlist__root__count_get: {
|
|
258
|
-
parameters: {
|
|
259
|
-
query?: never;
|
|
260
|
-
header?: never;
|
|
261
|
-
path: {
|
|
262
|
-
root: string;
|
|
263
|
-
};
|
|
264
|
-
cookie?: never;
|
|
265
|
-
};
|
|
266
|
-
requestBody?: never;
|
|
267
|
-
responses: {
|
|
268
|
-
/** @description Successful Response */
|
|
269
|
-
200: {
|
|
270
|
-
headers: {
|
|
271
|
-
[name: string]: unknown;
|
|
272
|
-
};
|
|
273
|
-
content: {
|
|
274
|
-
"application/json": unknown;
|
|
275
|
-
};
|
|
276
|
-
};
|
|
277
|
-
/** @description Validation Error */
|
|
278
|
-
422: {
|
|
279
|
-
headers: {
|
|
280
|
-
[name: string]: unknown;
|
|
281
|
-
};
|
|
282
|
-
content: {
|
|
283
|
-
"application/json": components["schemas"]["HTTPValidationError"];
|
|
284
|
-
};
|
|
285
|
-
};
|
|
286
|
-
};
|
|
287
|
-
};
|
|
288
|
-
}
|