@medialane/sdk 0.154.0 → 0.156.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/README.md +1 -1
- package/dist/chunk-3PZUSEAW.js +63 -0
- package/dist/chunk-3PZUSEAW.js.map +1 -0
- package/dist/chunk-ASDN46XU.js +1778 -0
- package/dist/chunk-ASDN46XU.js.map +1 -0
- package/dist/chunk-OUPVVMLK.cjs +68 -0
- package/dist/chunk-OUPVVMLK.cjs.map +1 -0
- package/dist/chunk-ZFRHADHR.cjs +1854 -0
- package/dist/chunk-ZFRHADHR.cjs.map +1 -0
- package/dist/{errors-CKO_JGDP.d.ts → errors-BKaHnCOI.d.ts} +1 -27
- package/dist/{errors-BfiX06G4.d.cts → errors-CAKnNI3N.d.cts} +1 -27
- package/dist/evm/index.cjs +3 -55
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.js +1 -53
- package/dist/evm/index.js.map +1 -1
- package/dist/index.cjs +275 -1732
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -1665
- package/dist/index.js.map +1 -1
- package/dist/solana/index.cjs +2 -56
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.js +1 -55
- package/dist/solana/index.js.map +1 -1
- package/dist/starknet/index.cjs +113 -1981
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +3 -113
- package/dist/starknet/index.d.ts +3 -113
- package/dist/starknet/index.js +9 -1901
- package/dist/starknet/index.js.map +1 -1
- package/dist/stellar/index.cjs +2 -56
- package/dist/stellar/index.cjs.map +1 -1
- package/dist/stellar/index.js +1 -55
- package/dist/stellar/index.js.map +1 -1
- package/package.json +1 -1
package/dist/starknet/index.cjs
CHANGED
|
@@ -1,1164 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var base = require('@scure/base');
|
|
3
|
+
var chunkZFRHADHR_cjs = require('../chunk-ZFRHADHR.cjs');
|
|
4
|
+
var chunkOUPVVMLK_cjs = require('../chunk-OUPVVMLK.cjs');
|
|
6
5
|
var starknet = require('starknet');
|
|
7
6
|
var hkdf_js = require('@noble/hashes/hkdf.js');
|
|
8
7
|
var sha2_js = require('@noble/hashes/sha2.js');
|
|
9
8
|
|
|
10
|
-
// src/config.ts
|
|
11
|
-
|
|
12
|
-
// src/chains.ts
|
|
13
|
-
var CHAINS = ["STARKNET", "ETHEREUM", "SOLANA", "BASE", "STELLAR", "BITCOIN"];
|
|
14
|
-
var COORDINATES = {
|
|
15
|
-
STARKNET: {
|
|
16
|
-
rpcUrl: "https://rpc.starknet.lava.build",
|
|
17
|
-
marketplace721: "0x03eda9a2b6ad90845a43591bac8083ebaf677d51fdf20f503b2c01889e3131fc",
|
|
18
|
-
marketplace721ClassHash: "0x0700d9230d07e5203e27778c0dc70f9134d2b25bf319f7cf8348dc66a6923e90",
|
|
19
|
-
marketplace721StartBlock: 11198146,
|
|
20
|
-
marketplace1155: "0x07c4ce1c19ea48cc11135ed22b19ff745f5aec508c3828593002e4f76fdb1b38",
|
|
21
|
-
marketplace1155ClassHash: "0x0242f5c388da7cee2d99e2a69453c8159bf927fbec4e797a3cfdcbbcb5b68328",
|
|
22
|
-
marketplace1155StartBlock: 11198267,
|
|
23
|
-
collection721: "0x0225c3ae09506b8d97adc39649ca740dad5aac195b7f5f0441cc1852947acaea",
|
|
24
|
-
collection721StartBlock: 11198496,
|
|
25
|
-
dataTokenization721: "0x07421b4442f7f2052c65408fb3561484154cf8175a0bbb41e3cd38d9087af6d2",
|
|
26
|
-
dataTokenization721StartBlock: 14670294,
|
|
27
|
-
ipNftClassHash: "0x012d3ae40ba35c7e2be0946532dac60e48932447912fdf96b674da67c029b9cc",
|
|
28
|
-
ipCollectionClassHash: "0x022155a1a130a40e57aac4b89c07fab3f616bc351b1270fc40f756b963afe8b4",
|
|
29
|
-
collection1155: "0x015368976d46fae5bfa1c58600f641d5aa5dbbf53ebc6b78aa3922194aad3551",
|
|
30
|
-
collection1155FactoryClassHash: "0x04eb6b419770f13bd191f120b9fc9ee624c0613ad4490062d293ca2016b3b1d2",
|
|
31
|
-
collection1155ClassHash: "0x06cf3f5a2322dac35e07a6064a5b8802f19fda8aa3f4726f0cb7bc05dea1bd78",
|
|
32
|
-
collection1155StartBlock: 11199527,
|
|
33
|
-
popFactory: "0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111",
|
|
34
|
-
popCollectionClassHash: "0x077c421686f10851872561953ea16898d933364b7f8937a5d7e2b1ba0a36263f",
|
|
35
|
-
dropFactory: "0x03587f42e29daee1b193f6cf83bf8627908ed6632d0d83fcb26225c50547d800",
|
|
36
|
-
dropCollectionClassHash: "0x00092e72cdb63067521e803aaf7d4101c3e3ce026ae6bc045ec4228027e58282",
|
|
37
|
-
nftComments: "0x02cdac70c94447189af0389dfea63f4d5e4154ea8a563de288a5ab1c39e37843",
|
|
38
|
-
creatorCoinFactory: "0x50fa807b5274079fb19374673d7bab6d2dc3af7e1032ea43eb6e44bcbde4c3c",
|
|
39
|
-
creatorCoinEkuboLauncher: "0x4f7fceb5ac10f12f9544a09580592e5bdf1b7f04f48765eecf12286d8ccb7b4",
|
|
40
|
-
creatorCoinClassHash: "0x743e4c8a5b96bb83bbf4af04edbbb482d5ece89eed9b729a79fb7df0cd0b6b6",
|
|
41
|
-
creatorCoinFactoryClassHash: "0x51765926b1344c9a20b8cd4b5abe7b7d47375ae97cf6804db3ea5d4b05a9b55",
|
|
42
|
-
creatorCoinStartBlock: 10474544,
|
|
43
|
-
ekuboCore: "0x00000005dd3d2f4429af886cd1a3b08289dbcea99a294197e9eb43b0e0325b4b",
|
|
44
|
-
ipTicketsFactory: "0x0767bf5b57e1f812463159b5ed683183e1b0c3f942b74871b5c6cd6a93c15e99",
|
|
45
|
-
ipTicketCollectionClassHash: "0x0449e8eb7c117740d07cb8e0157d32c8ba3d19d1cfd2784ed5e139f5a1e04acc",
|
|
46
|
-
ipTicketsFactoryClassHash: "0x04a739ac3a673ebd0db96bb24475600797c3ed34827e79517f9b2b1640276e6a",
|
|
47
|
-
ipTicketsStartBlock: 11933694,
|
|
48
|
-
ipClubFactory: "0x06a0b0be16d70c78f2e18119dbf90e5911cbfd5d8d484bc555dc61d96f56a2b9",
|
|
49
|
-
ipClubFactoryClassHash: "0x05d9d431bd3532b1fa4d5bab572f49c5ad8034ee3cc83951aa41ae82c9cad266",
|
|
50
|
-
ipClubCollectionClassHash: "0x05b8477c72e6bf0cf64967d71155021fd4d77d9a57e8805c6b40709121c002c5",
|
|
51
|
-
ipClubFactoryStartBlock: 11928775,
|
|
52
|
-
ipSponsorship: "0x03729ebe0fedf29ec97fca34db09174772af7f870af26a26e024a61040143e5c",
|
|
53
|
-
ipSponsorshipClassHash: "0x0626daac2ed7e2bf630ef5b10104b3202db1559216c0c1a504c0e99be2fbfec3",
|
|
54
|
-
ipSponsorshipStartBlock: 11896456,
|
|
55
|
-
mediaWalletClassHash: "0x014b210c7d47392691144bafecdca3c6c7791cc295ea305988da0a724c05ac31",
|
|
56
|
-
genesisMint: "0x06ed61abba98a44d45bed2c4b1a456df15053c3321cfd6e007afb33b7226c9f0"
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
function getCoordinates(chain) {
|
|
60
|
-
const c = COORDINATES[chain];
|
|
61
|
-
if (!c) throw new Error(`No coordinates configured for chain "${chain}"`);
|
|
62
|
-
return c;
|
|
63
|
-
}
|
|
64
|
-
var DEFAULT_CHAIN = "STARKNET";
|
|
65
|
-
function getStarknetCoordinates(chain) {
|
|
66
|
-
if (chain !== "STARKNET") {
|
|
67
|
-
throw new Error(`This module is Starknet-only (client chain: "${chain}")`);
|
|
68
|
-
}
|
|
69
|
-
return getCoordinates("STARKNET");
|
|
70
|
-
}
|
|
71
|
-
var FeeConfigSchema = zod.z.object({
|
|
72
|
-
enabled: zod.z.boolean().default(true),
|
|
73
|
-
fundAddress: zod.z.string().min(1).optional(),
|
|
74
|
-
marketplaceBps: zod.z.number().int().min(0).max(1e4).default(100),
|
|
75
|
-
launchpadBps: zod.z.number().int().min(0).max(1e4).default(100),
|
|
76
|
-
sponsorshipBps: zod.z.number().int().min(0).max(1e4).default(100)
|
|
77
|
-
});
|
|
78
|
-
function resolveFeeConfig(raw) {
|
|
79
|
-
const p = FeeConfigSchema.parse(raw ?? {});
|
|
80
|
-
return {
|
|
81
|
-
enabled: p.enabled,
|
|
82
|
-
fundAddress: p.fundAddress,
|
|
83
|
-
marketplaceBps: p.marketplaceBps,
|
|
84
|
-
launchpadBps: p.launchpadBps,
|
|
85
|
-
sponsorshipBps: p.sponsorshipBps
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// src/config.ts
|
|
90
|
-
var MedialaneConfigSchema = zod.z.object({
|
|
91
|
-
chain: zod.z.enum(CHAINS).default(DEFAULT_CHAIN),
|
|
92
|
-
rpcUrl: zod.z.string().url().optional(),
|
|
93
|
-
backendUrl: zod.z.string().url().optional(),
|
|
94
|
-
apiKey: zod.z.string().optional(),
|
|
95
|
-
marketplace721Contract: zod.z.string().optional(),
|
|
96
|
-
marketplaceContract: zod.z.string().optional(),
|
|
97
|
-
marketplace1155Contract: zod.z.string().optional(),
|
|
98
|
-
collection721Contract: zod.z.string().optional(),
|
|
99
|
-
collectionContract: zod.z.string().optional(),
|
|
100
|
-
collection1155Contract: zod.z.string().optional(),
|
|
101
|
-
retryOptions: zod.z.object({
|
|
102
|
-
maxAttempts: zod.z.number().int().min(1).max(10).optional(),
|
|
103
|
-
baseDelayMs: zod.z.number().int().min(0).optional(),
|
|
104
|
-
maxDelayMs: zod.z.number().int().min(0).optional()
|
|
105
|
-
}).optional(),
|
|
106
|
-
feeConfig: FeeConfigSchema.optional()
|
|
107
|
-
});
|
|
108
|
-
function resolveConfig(raw) {
|
|
109
|
-
const parsed = MedialaneConfigSchema.parse(raw);
|
|
110
|
-
const coords = getCoordinates(parsed.chain);
|
|
111
|
-
const sn = parsed.chain === "STARKNET" ? coords : {};
|
|
112
|
-
const marketplace721Contract = parsed.marketplace721Contract ?? parsed.marketplaceContract ?? sn.marketplace721;
|
|
113
|
-
const collection721Contract = parsed.collection721Contract ?? parsed.collectionContract ?? sn.collection721;
|
|
114
|
-
return {
|
|
115
|
-
chain: parsed.chain,
|
|
116
|
-
rpcUrl: parsed.rpcUrl ?? coords.rpcUrl,
|
|
117
|
-
backendUrl: parsed.backendUrl,
|
|
118
|
-
apiKey: parsed.apiKey,
|
|
119
|
-
marketplace721Contract,
|
|
120
|
-
marketplaceContract: marketplace721Contract,
|
|
121
|
-
marketplace1155Contract: parsed.marketplace1155Contract ?? sn.marketplace1155,
|
|
122
|
-
collection721Contract,
|
|
123
|
-
collectionContract: collection721Contract,
|
|
124
|
-
collection1155Contract: parsed.collection1155Contract ?? sn.collection1155,
|
|
125
|
-
retryOptions: parsed.retryOptions,
|
|
126
|
-
feeConfig: resolveFeeConfig(parsed.feeConfig)
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
function normalizeAddress(chain, address) {
|
|
130
|
-
switch (chain) {
|
|
131
|
-
case "STARKNET":
|
|
132
|
-
return normalizeStarknet(address);
|
|
133
|
-
case "ETHEREUM":
|
|
134
|
-
case "BASE":
|
|
135
|
-
return normalizeEvm(address);
|
|
136
|
-
case "SOLANA":
|
|
137
|
-
return normalizeSolana(address);
|
|
138
|
-
case "STELLAR":
|
|
139
|
-
return normalizeStellar(address);
|
|
140
|
-
case "BITCOIN":
|
|
141
|
-
throw new Error("BITCOIN address normalization not implemented");
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
function normalizeStarknet(address) {
|
|
145
|
-
try {
|
|
146
|
-
const hex = BigInt(address).toString(16);
|
|
147
|
-
return "0x" + hex.padStart(64, "0").toLowerCase();
|
|
148
|
-
} catch {
|
|
149
|
-
throw new Error(`Invalid STARKNET address: "${address}"`);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
function normalizeEvm(address) {
|
|
153
|
-
const m = /^0x([0-9a-fA-F]{40})$/.exec(address);
|
|
154
|
-
if (!m) throw new Error(`Invalid ETHEREUM/BASE address: "${address}"`);
|
|
155
|
-
const lower = m[1].toLowerCase();
|
|
156
|
-
const hash8 = sha3_js.keccak_256(new TextEncoder().encode(lower));
|
|
157
|
-
let out = "0x";
|
|
158
|
-
for (let i = 0; i < 40; i++) {
|
|
159
|
-
const nibble = hash8[i >> 1] >> (i % 2 === 0 ? 4 : 0) & 15;
|
|
160
|
-
out += nibble >= 8 ? lower[i].toUpperCase() : lower[i];
|
|
161
|
-
}
|
|
162
|
-
return out;
|
|
163
|
-
}
|
|
164
|
-
function normalizeSolana(address) {
|
|
165
|
-
try {
|
|
166
|
-
const bytes = base.base58.decode(address);
|
|
167
|
-
if (bytes.length !== 32) throw new Error("not a 32-byte key");
|
|
168
|
-
return address;
|
|
169
|
-
} catch {
|
|
170
|
-
throw new Error(`Invalid SOLANA address: "${address}"`);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
var STELLAR_VERSION_BYTES = /* @__PURE__ */ new Set([6 << 3, 2 << 3]);
|
|
174
|
-
function normalizeStellar(address) {
|
|
175
|
-
const upper = address.toUpperCase();
|
|
176
|
-
if (!/^[GC][A-Z2-7]{55}$/.test(upper)) {
|
|
177
|
-
throw new Error(`Invalid STELLAR address: "${address}"`);
|
|
178
|
-
}
|
|
179
|
-
let decoded;
|
|
180
|
-
try {
|
|
181
|
-
decoded = base.base32.decode(upper);
|
|
182
|
-
} catch {
|
|
183
|
-
throw new Error(`Invalid STELLAR address: "${address}"`);
|
|
184
|
-
}
|
|
185
|
-
if (decoded.length !== 35 || !STELLAR_VERSION_BYTES.has(decoded[0])) {
|
|
186
|
-
throw new Error(`Invalid STELLAR address: "${address}"`);
|
|
187
|
-
}
|
|
188
|
-
const payload = decoded.subarray(0, 33);
|
|
189
|
-
const checksum = decoded[33] | decoded[34] << 8;
|
|
190
|
-
if (crc16xmodem(payload) !== checksum) {
|
|
191
|
-
throw new Error(`Invalid STELLAR address: "${address}"`);
|
|
192
|
-
}
|
|
193
|
-
return upper;
|
|
194
|
-
}
|
|
195
|
-
function crc16xmodem(bytes) {
|
|
196
|
-
let crc = 0;
|
|
197
|
-
for (const byte of bytes) {
|
|
198
|
-
crc ^= byte << 8;
|
|
199
|
-
for (let i = 0; i < 8; i++) {
|
|
200
|
-
crc = crc & 32768 ? (crc << 1 ^ 4129) & 65535 : crc << 1 & 65535;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
return crc;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
// src/utils/retry.ts
|
|
207
|
-
var DEFAULT_MAX_ATTEMPTS = 3;
|
|
208
|
-
var DEFAULT_BASE_DELAY_MS = 300;
|
|
209
|
-
var DEFAULT_MAX_DELAY_MS = 5e3;
|
|
210
|
-
function sleep(ms) {
|
|
211
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
212
|
-
}
|
|
213
|
-
function isRetryableFor(method, err) {
|
|
214
|
-
if (err instanceof MedialaneApiError && err.status === 429) return true;
|
|
215
|
-
const isRead = method === "GET" || method === "HEAD";
|
|
216
|
-
if (!isRead) return false;
|
|
217
|
-
return err instanceof MedialaneApiError && err.status >= 500 || err instanceof TypeError;
|
|
218
|
-
}
|
|
219
|
-
async function withRetry(fn, opts, method = "GET") {
|
|
220
|
-
const maxAttempts = opts?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS;
|
|
221
|
-
const baseDelayMs = opts?.baseDelayMs ?? DEFAULT_BASE_DELAY_MS;
|
|
222
|
-
const maxDelayMs = opts?.maxDelayMs ?? DEFAULT_MAX_DELAY_MS;
|
|
223
|
-
let lastError;
|
|
224
|
-
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
225
|
-
try {
|
|
226
|
-
return await fn();
|
|
227
|
-
} catch (err) {
|
|
228
|
-
lastError = err;
|
|
229
|
-
if (!isRetryableFor(method, err) || attempt === maxAttempts - 1) {
|
|
230
|
-
throw err;
|
|
231
|
-
}
|
|
232
|
-
const retryAfterMs = err instanceof MedialaneApiError ? err.retryAfterMs : void 0;
|
|
233
|
-
const backoff = baseDelayMs * Math.pow(2, attempt) + Math.random() * baseDelayMs;
|
|
234
|
-
const delay = Math.min(retryAfterMs ?? backoff, maxDelayMs);
|
|
235
|
-
await sleep(delay);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
throw lastError;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
// src/api/client.ts
|
|
242
|
-
function deriveErrorCode(status) {
|
|
243
|
-
if (status === 404) return "TOKEN_NOT_FOUND";
|
|
244
|
-
if (status === 429) return "RATE_LIMITED";
|
|
245
|
-
if (status === 410) return "INTENT_EXPIRED";
|
|
246
|
-
if (status === 401 || status === 403) return "UNAUTHORIZED";
|
|
247
|
-
if (status === 400) return "INVALID_PARAMS";
|
|
248
|
-
return "UNKNOWN";
|
|
249
|
-
}
|
|
250
|
-
var MedialaneApiError = class extends Error {
|
|
251
|
-
constructor(status, message, retryAfterMs, details) {
|
|
252
|
-
super(message);
|
|
253
|
-
this.status = status;
|
|
254
|
-
this.retryAfterMs = retryAfterMs;
|
|
255
|
-
this.details = details;
|
|
256
|
-
this.name = "MedialaneApiError";
|
|
257
|
-
this.code = deriveErrorCode(status);
|
|
258
|
-
}
|
|
259
|
-
};
|
|
260
|
-
function parseRetryAfter(value) {
|
|
261
|
-
if (!value) return void 0;
|
|
262
|
-
const seconds = Number(value);
|
|
263
|
-
if (Number.isFinite(seconds)) return Math.max(0, seconds * 1e3);
|
|
264
|
-
const date = Date.parse(value);
|
|
265
|
-
if (!Number.isNaN(date)) return Math.max(0, date - Date.now());
|
|
266
|
-
return void 0;
|
|
267
|
-
}
|
|
268
|
-
var ApiClient = class {
|
|
269
|
-
constructor(baseUrl, apiKey, retryOptions, chain = "STARKNET") {
|
|
270
|
-
this.baseUrl = baseUrl;
|
|
271
|
-
this.chain = chain;
|
|
272
|
-
this.baseHeaders = apiKey ? { "x-api-key": apiKey } : {};
|
|
273
|
-
this.retryOptions = retryOptions;
|
|
274
|
-
}
|
|
275
|
-
addr(a) {
|
|
276
|
-
return normalizeAddress(this.chain, a);
|
|
277
|
-
}
|
|
278
|
-
async request(path, init, opts) {
|
|
279
|
-
const url = `${this.baseUrl.replace(/\/$/, "")}${path}`;
|
|
280
|
-
const headers = { ...this.baseHeaders };
|
|
281
|
-
if (!(init?.body instanceof FormData)) {
|
|
282
|
-
headers["Content-Type"] = "application/json";
|
|
283
|
-
}
|
|
284
|
-
const allowed = (status) => opts?.allow404 === true && status === 404 || opts?.allow403 === true && status === 403;
|
|
285
|
-
const res = await withRetry(async () => {
|
|
286
|
-
const response = await fetch(url, {
|
|
287
|
-
...init,
|
|
288
|
-
headers: { ...headers, ...init?.headers }
|
|
289
|
-
});
|
|
290
|
-
if (!response.ok && !allowed(response.status)) {
|
|
291
|
-
const text = await response.text().catch(() => response.statusText);
|
|
292
|
-
let message = `Request failed with status ${response.status}`;
|
|
293
|
-
let details = text;
|
|
294
|
-
try {
|
|
295
|
-
const body = JSON.parse(text);
|
|
296
|
-
if (typeof body.error === "string" && body.error.trim() !== "") {
|
|
297
|
-
message = body.error;
|
|
298
|
-
}
|
|
299
|
-
details = body;
|
|
300
|
-
} catch {
|
|
301
|
-
}
|
|
302
|
-
throw new MedialaneApiError(
|
|
303
|
-
response.status,
|
|
304
|
-
message,
|
|
305
|
-
parseRetryAfter(response.headers.get("retry-after")),
|
|
306
|
-
details
|
|
307
|
-
);
|
|
308
|
-
}
|
|
309
|
-
return response;
|
|
310
|
-
}, this.retryOptions, (init?.method ?? "GET").toUpperCase());
|
|
311
|
-
if (allowed(res.status)) return null;
|
|
312
|
-
return res.json();
|
|
313
|
-
}
|
|
314
|
-
get(path) {
|
|
315
|
-
return this.request(path, { method: "GET" });
|
|
316
|
-
}
|
|
317
|
-
post(path, body) {
|
|
318
|
-
return this.request(path, { method: "POST", body: JSON.stringify(body) });
|
|
319
|
-
}
|
|
320
|
-
patch(path, body) {
|
|
321
|
-
return this.request(path, { method: "PATCH", body: JSON.stringify(body) });
|
|
322
|
-
}
|
|
323
|
-
del(path) {
|
|
324
|
-
return this.request(path, { method: "DELETE" });
|
|
325
|
-
}
|
|
326
|
-
bearer(siwsToken) {
|
|
327
|
-
return { Authorization: `Bearer ${siwsToken}` };
|
|
328
|
-
}
|
|
329
|
-
asSubject(siwsToken) {
|
|
330
|
-
return siwsToken ? this.bearer(siwsToken) : void 0;
|
|
331
|
-
}
|
|
332
|
-
getOrders(query = {}) {
|
|
333
|
-
const params = new URLSearchParams();
|
|
334
|
-
if (query.status) params.set("status", query.status);
|
|
335
|
-
if (query.collection) params.set("collection", query.collection);
|
|
336
|
-
if (query.currency) params.set("currency", query.currency);
|
|
337
|
-
if (query.sort) params.set("sort", query.sort);
|
|
338
|
-
if (query.page !== void 0) params.set("page", String(query.page));
|
|
339
|
-
if (query.limit !== void 0) params.set("limit", String(query.limit));
|
|
340
|
-
if (query.offerer) params.set("offerer", this.addr(query.offerer));
|
|
341
|
-
if (query.minPrice) params.set("minPrice", query.minPrice);
|
|
342
|
-
if (query.maxPrice) params.set("maxPrice", query.maxPrice);
|
|
343
|
-
if (query.chain) params.set("chain", query.chain);
|
|
344
|
-
const qs = params.toString();
|
|
345
|
-
return this.get(`/v1/orders${qs ? `?${qs}` : ""}`);
|
|
346
|
-
}
|
|
347
|
-
getOrder(orderHash) {
|
|
348
|
-
return this.get(`/v1/orders/${orderHash}`);
|
|
349
|
-
}
|
|
350
|
-
getActiveOrdersForToken(contract, tokenId) {
|
|
351
|
-
return this.get(`/v1/orders/token/${this.addr(contract)}/${tokenId}`);
|
|
352
|
-
}
|
|
353
|
-
getReceivedOffers(address, opts = {}) {
|
|
354
|
-
const params = new URLSearchParams({ page: String(opts.page ?? 1), limit: String(opts.limit ?? 50) });
|
|
355
|
-
return this.get(`/v1/orders/received/${this.addr(address)}?${params}`);
|
|
356
|
-
}
|
|
357
|
-
getOrdersByUser(address, page = 1, limit = 20) {
|
|
358
|
-
return this.get(
|
|
359
|
-
`/v1/orders/user/${this.addr(address)}?page=${page}&limit=${limit}`
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
|
-
getToken(contract, tokenId, wait = false) {
|
|
363
|
-
return this.get(
|
|
364
|
-
`/v1/tokens/${contract}/${tokenId}${wait ? "?wait=true" : ""}`
|
|
365
|
-
);
|
|
366
|
-
}
|
|
367
|
-
getTokensByOwner(address, page = 1, limit = 20) {
|
|
368
|
-
return this.get(
|
|
369
|
-
`/v1/tokens/owned/${this.addr(address)}?page=${page}&limit=${limit}`
|
|
370
|
-
);
|
|
371
|
-
}
|
|
372
|
-
getTokenHistory(contract, tokenId, page = 1, limit = 20) {
|
|
373
|
-
return this.get(
|
|
374
|
-
`/v1/tokens/${contract}/${tokenId}/history?page=${page}&limit=${limit}`
|
|
375
|
-
);
|
|
376
|
-
}
|
|
377
|
-
getCollection(contract) {
|
|
378
|
-
return this.get(`/v1/collections/${this.addr(contract)}`);
|
|
379
|
-
}
|
|
380
|
-
getCollectionTokens(contract, page = 1, limit = 20, sort = "recent") {
|
|
381
|
-
return this.get(
|
|
382
|
-
`/v1/collections/${this.addr(contract)}/tokens?page=${page}&limit=${limit}&sort=${sort}`
|
|
383
|
-
);
|
|
384
|
-
}
|
|
385
|
-
getActivities(query = {}) {
|
|
386
|
-
const params = new URLSearchParams();
|
|
387
|
-
if (query.type) params.set("type", query.type);
|
|
388
|
-
if (query.contract) params.set("contract", query.contract);
|
|
389
|
-
if (query.page !== void 0) params.set("page", String(query.page));
|
|
390
|
-
if (query.limit !== void 0) params.set("limit", String(query.limit));
|
|
391
|
-
if (query.chain) params.set("chain", query.chain);
|
|
392
|
-
const qs = params.toString();
|
|
393
|
-
return this.get(`/v1/activities${qs ? `?${qs}` : ""}`);
|
|
394
|
-
}
|
|
395
|
-
getActivitiesByAddress(address, page = 1, limit = 20) {
|
|
396
|
-
return this.get(
|
|
397
|
-
`/v1/activities/${this.addr(address)}?page=${page}&limit=${limit}`
|
|
398
|
-
);
|
|
399
|
-
}
|
|
400
|
-
getTokenComments(contract, tokenId, opts = {}) {
|
|
401
|
-
const params = new URLSearchParams();
|
|
402
|
-
if (opts.page !== void 0) params.set("page", String(opts.page));
|
|
403
|
-
if (opts.limit !== void 0) params.set("limit", String(opts.limit));
|
|
404
|
-
const qs = params.toString();
|
|
405
|
-
return this.get(
|
|
406
|
-
`/v1/tokens/${this.addr(contract)}/${tokenId}/comments${qs ? `?${qs}` : ""}`
|
|
407
|
-
);
|
|
408
|
-
}
|
|
409
|
-
search(q, limit = 10, chain) {
|
|
410
|
-
const params = new URLSearchParams({ q, limit: String(limit) });
|
|
411
|
-
if (chain) params.set("chain", chain);
|
|
412
|
-
return this.get(
|
|
413
|
-
`/v1/search?${params.toString()}`
|
|
414
|
-
);
|
|
415
|
-
}
|
|
416
|
-
createListingIntent(params) {
|
|
417
|
-
return this.post("/v1/intents/listing", params);
|
|
418
|
-
}
|
|
419
|
-
createOfferIntent(params) {
|
|
420
|
-
return this.post("/v1/intents/offer", params);
|
|
421
|
-
}
|
|
422
|
-
createFulfillIntent(params) {
|
|
423
|
-
return this.post("/v1/intents/fulfill", params);
|
|
424
|
-
}
|
|
425
|
-
createCancelIntent(params) {
|
|
426
|
-
return this.post("/v1/intents/cancel", params);
|
|
427
|
-
}
|
|
428
|
-
createCheckoutIntent(params) {
|
|
429
|
-
return this.post("/v1/intents/checkout", params);
|
|
430
|
-
}
|
|
431
|
-
getIntent(id) {
|
|
432
|
-
return this.get(`/v1/intents/${id}`);
|
|
433
|
-
}
|
|
434
|
-
submitIntentSignature(id, signature) {
|
|
435
|
-
return this.patch(`/v1/intents/${id}/signature`, { signature });
|
|
436
|
-
}
|
|
437
|
-
confirmIntent(id, txHash) {
|
|
438
|
-
return this.patch(`/v1/intents/${id}/confirm`, { txHash });
|
|
439
|
-
}
|
|
440
|
-
syncTransaction(txHash) {
|
|
441
|
-
return this.post("/v1/tx/sync", { txHash });
|
|
442
|
-
}
|
|
443
|
-
createMintIntent(params) {
|
|
444
|
-
return this.post("/v1/intents/mint", params);
|
|
445
|
-
}
|
|
446
|
-
createCollectionIntent(params) {
|
|
447
|
-
return this.post("/v1/intents/create-collection", params);
|
|
448
|
-
}
|
|
449
|
-
createTierIntent(params) {
|
|
450
|
-
return this.post("/v1/intents/create-tier", params);
|
|
451
|
-
}
|
|
452
|
-
emitToRecipients(params) {
|
|
453
|
-
return this.post("/v1/business/issuance/emission", params);
|
|
454
|
-
}
|
|
455
|
-
createCoinIntent(params) {
|
|
456
|
-
return this.post("/v1/intents/create-coin", params);
|
|
457
|
-
}
|
|
458
|
-
launchCoinIntent(params) {
|
|
459
|
-
return this.post("/v1/intents/launch-coin", params);
|
|
460
|
-
}
|
|
461
|
-
createSponsorshipOfferIntent(params) {
|
|
462
|
-
return this.post("/v1/intents/sponsorship-offer", params);
|
|
463
|
-
}
|
|
464
|
-
setSponsorshipOfferOpenIntent(params) {
|
|
465
|
-
return this.post("/v1/intents/sponsorship-offer-open", params);
|
|
466
|
-
}
|
|
467
|
-
placeSponsorshipBidIntent(params) {
|
|
468
|
-
return this.post("/v1/intents/sponsorship-bid", params);
|
|
469
|
-
}
|
|
470
|
-
retractSponsorshipBidIntent(params) {
|
|
471
|
-
return this.post("/v1/intents/sponsorship-bid-retract", params);
|
|
472
|
-
}
|
|
473
|
-
acceptSponsorshipBidIntent(params) {
|
|
474
|
-
return this.post("/v1/intents/sponsorship-bid-accept", params);
|
|
475
|
-
}
|
|
476
|
-
createSponsorshipProposalIntent(params) {
|
|
477
|
-
return this.post("/v1/intents/sponsorship-proposal", params);
|
|
478
|
-
}
|
|
479
|
-
withdrawSponsorshipProposalIntent(params) {
|
|
480
|
-
return this.post("/v1/intents/sponsorship-proposal-withdraw", params);
|
|
481
|
-
}
|
|
482
|
-
acceptSponsorshipProposalIntent(params) {
|
|
483
|
-
return this.post("/v1/intents/sponsorship-proposal-accept", params);
|
|
484
|
-
}
|
|
485
|
-
rejectSponsorshipProposalIntent(params) {
|
|
486
|
-
return this.post("/v1/intents/sponsorship-proposal-reject", params);
|
|
487
|
-
}
|
|
488
|
-
createCounterOfferIntent(params, siwsToken) {
|
|
489
|
-
const extraHeaders = siwsToken ? { "Authorization": `Bearer ${siwsToken}` } : {};
|
|
490
|
-
return this.request("/v1/intents/counter-offer", {
|
|
491
|
-
method: "POST",
|
|
492
|
-
body: JSON.stringify(params),
|
|
493
|
-
headers: extraHeaders
|
|
494
|
-
});
|
|
495
|
-
}
|
|
496
|
-
getCounterOffers(query) {
|
|
497
|
-
const params = new URLSearchParams();
|
|
498
|
-
if (query.originalOrderHash) params.set("originalOrderHash", query.originalOrderHash);
|
|
499
|
-
if (query.sellerAddress) params.set("sellerAddress", query.sellerAddress);
|
|
500
|
-
if (query.page !== void 0) params.set("page", String(query.page));
|
|
501
|
-
if (query.limit !== void 0) params.set("limit", String(query.limit));
|
|
502
|
-
return this.get(`/v1/orders/counter-offers?${params}`);
|
|
503
|
-
}
|
|
504
|
-
getMetadataSignedUrl(kind) {
|
|
505
|
-
const params = kind ? `?kind=${kind}` : "";
|
|
506
|
-
return this.get(`/v1/metadata/signed-url${params}`);
|
|
507
|
-
}
|
|
508
|
-
uploadMetadata(metadata) {
|
|
509
|
-
return this.post("/v1/metadata/upload", metadata);
|
|
510
|
-
}
|
|
511
|
-
async uploadMetadataDirectory(files) {
|
|
512
|
-
const res = await this.post("/v1/metadata/upload-directory", { files });
|
|
513
|
-
return res.data;
|
|
514
|
-
}
|
|
515
|
-
resolveMetadata(uri) {
|
|
516
|
-
const params = new URLSearchParams({ uri });
|
|
517
|
-
return this.get(`/v1/metadata/resolve?${params.toString()}`);
|
|
518
|
-
}
|
|
519
|
-
uploadFile(file) {
|
|
520
|
-
const formData = new FormData();
|
|
521
|
-
formData.append("file", file);
|
|
522
|
-
return this.request("/v1/metadata/upload-file", {
|
|
523
|
-
method: "POST",
|
|
524
|
-
body: formData
|
|
525
|
-
});
|
|
526
|
-
}
|
|
527
|
-
getMe(siwsToken) {
|
|
528
|
-
return this.request("/v1/portal/me", {
|
|
529
|
-
method: "GET",
|
|
530
|
-
headers: this.asSubject(siwsToken)
|
|
531
|
-
});
|
|
532
|
-
}
|
|
533
|
-
getApiKeys(siwsToken) {
|
|
534
|
-
return this.request("/v1/portal/keys", {
|
|
535
|
-
method: "GET",
|
|
536
|
-
headers: this.asSubject(siwsToken)
|
|
537
|
-
});
|
|
538
|
-
}
|
|
539
|
-
createApiKey(input, siwsToken) {
|
|
540
|
-
return this.request("/v1/portal/keys", {
|
|
541
|
-
method: "POST",
|
|
542
|
-
body: JSON.stringify(input ?? {}),
|
|
543
|
-
headers: this.asSubject(siwsToken)
|
|
544
|
-
});
|
|
545
|
-
}
|
|
546
|
-
deleteApiKey(id, siwsToken) {
|
|
547
|
-
return this.request(`/v1/portal/keys/${id}`, {
|
|
548
|
-
method: "DELETE",
|
|
549
|
-
headers: this.asSubject(siwsToken)
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
|
-
getCreditHistory(siwsToken) {
|
|
553
|
-
return this.request("/v1/portal/credits/history", {
|
|
554
|
-
method: "GET",
|
|
555
|
-
headers: this.asSubject(siwsToken)
|
|
556
|
-
});
|
|
557
|
-
}
|
|
558
|
-
getSpend(siwsToken) {
|
|
559
|
-
return this.request("/v1/portal/credits/spend", {
|
|
560
|
-
method: "GET",
|
|
561
|
-
headers: this.asSubject(siwsToken)
|
|
562
|
-
});
|
|
563
|
-
}
|
|
564
|
-
checkDeposit(txHash, siwsToken) {
|
|
565
|
-
return this.request("/v1/portal/credits/check", {
|
|
566
|
-
method: "POST",
|
|
567
|
-
body: JSON.stringify({ txHash }),
|
|
568
|
-
headers: this.asSubject(siwsToken)
|
|
569
|
-
});
|
|
570
|
-
}
|
|
571
|
-
getFundingMethods(siwsToken) {
|
|
572
|
-
return this.request("/v1/portal/funding/methods", {
|
|
573
|
-
method: "GET",
|
|
574
|
-
headers: this.asSubject(siwsToken)
|
|
575
|
-
});
|
|
576
|
-
}
|
|
577
|
-
createFunding(input, siwsToken) {
|
|
578
|
-
return this.request("/v1/portal/funding", {
|
|
579
|
-
method: "POST",
|
|
580
|
-
body: JSON.stringify({ method: input.method, params: input.params }),
|
|
581
|
-
headers: this.asSubject(siwsToken)
|
|
582
|
-
});
|
|
583
|
-
}
|
|
584
|
-
getFunding(id, siwsToken) {
|
|
585
|
-
return this.request(`/v1/portal/funding/${encodeURIComponent(id)}`, {
|
|
586
|
-
method: "GET",
|
|
587
|
-
headers: this.asSubject(siwsToken)
|
|
588
|
-
});
|
|
589
|
-
}
|
|
590
|
-
getFundingChallenge(id, payer, siwsToken) {
|
|
591
|
-
return this.request(`/v1/portal/funding/${encodeURIComponent(id)}/challenge`, {
|
|
592
|
-
method: "POST",
|
|
593
|
-
body: JSON.stringify({ payer }),
|
|
594
|
-
headers: this.asSubject(siwsToken)
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
authorizeFunding(id, input, siwsToken) {
|
|
598
|
-
return this.request(
|
|
599
|
-
`/v1/portal/funding/${encodeURIComponent(id)}/authorize`,
|
|
600
|
-
{ method: "POST", body: JSON.stringify({ payer: input.payer, signature: input.signature }), headers: this.asSubject(siwsToken) }
|
|
601
|
-
);
|
|
602
|
-
}
|
|
603
|
-
submitFunding(id, txHash, siwsToken) {
|
|
604
|
-
return this.request(`/v1/portal/funding/${encodeURIComponent(id)}/submit`, {
|
|
605
|
-
method: "POST",
|
|
606
|
-
body: JSON.stringify({ txHash }),
|
|
607
|
-
headers: this.asSubject(siwsToken)
|
|
608
|
-
});
|
|
609
|
-
}
|
|
610
|
-
cancelFunding(id, siwsToken) {
|
|
611
|
-
return this.request(`/v1/portal/funding/${encodeURIComponent(id)}/cancel`, {
|
|
612
|
-
method: "POST",
|
|
613
|
-
body: JSON.stringify({}),
|
|
614
|
-
headers: this.asSubject(siwsToken)
|
|
615
|
-
});
|
|
616
|
-
}
|
|
617
|
-
getWebhooks() {
|
|
618
|
-
return this.get("/v1/portal/webhooks");
|
|
619
|
-
}
|
|
620
|
-
createWebhook(params) {
|
|
621
|
-
return this.post("/v1/portal/webhooks", params);
|
|
622
|
-
}
|
|
623
|
-
deleteWebhook(id) {
|
|
624
|
-
return this.del(
|
|
625
|
-
`/v1/portal/webhooks/${id}`
|
|
626
|
-
);
|
|
627
|
-
}
|
|
628
|
-
async claimCollection(contractAddress, walletAddress, siwsToken) {
|
|
629
|
-
return this.request("/v1/collections/claim", {
|
|
630
|
-
method: "POST",
|
|
631
|
-
body: JSON.stringify({ contractAddress, walletAddress }),
|
|
632
|
-
headers: this.bearer(siwsToken)
|
|
633
|
-
});
|
|
634
|
-
}
|
|
635
|
-
requestCollectionClaim(params) {
|
|
636
|
-
return this.request("/v1/collections/claim/request", {
|
|
637
|
-
method: "POST",
|
|
638
|
-
body: JSON.stringify(params)
|
|
639
|
-
});
|
|
640
|
-
}
|
|
641
|
-
registerBusinessProvisioning(params) {
|
|
642
|
-
return this.post(
|
|
643
|
-
"/v1/business/provisioning",
|
|
644
|
-
{ chain: params.chain ?? "STARKNET", email: params.email }
|
|
645
|
-
);
|
|
646
|
-
}
|
|
647
|
-
getCollectionProfile(contractAddress) {
|
|
648
|
-
return this.request(
|
|
649
|
-
`/v1/collections/${this.addr(contractAddress)}/profile`,
|
|
650
|
-
{ method: "GET" },
|
|
651
|
-
{ allow404: true }
|
|
652
|
-
);
|
|
653
|
-
}
|
|
654
|
-
updateCollectionProfile(contractAddress, data, siwsToken) {
|
|
655
|
-
return this.request(
|
|
656
|
-
`/v1/collections/${this.addr(contractAddress)}/profile`,
|
|
657
|
-
{ method: "PATCH", body: JSON.stringify(data), headers: this.bearer(siwsToken) }
|
|
658
|
-
);
|
|
659
|
-
}
|
|
660
|
-
getWalletActivity(address, chain = "STARKNET") {
|
|
661
|
-
return this.get(
|
|
662
|
-
`/v1/wallet-activity?address=${this.addr(address)}&chain=${chain}`
|
|
663
|
-
);
|
|
664
|
-
}
|
|
665
|
-
getGatedContent(contractAddress, siwsToken) {
|
|
666
|
-
return this.request(
|
|
667
|
-
`/v1/collections/${this.addr(contractAddress)}/gated-content`,
|
|
668
|
-
{ method: "GET", headers: this.bearer(siwsToken) },
|
|
669
|
-
{ allow404: true, allow403: true }
|
|
670
|
-
);
|
|
671
|
-
}
|
|
672
|
-
getCreators(opts = {}) {
|
|
673
|
-
const params = new URLSearchParams();
|
|
674
|
-
if (opts.search) params.set("search", opts.search);
|
|
675
|
-
if (opts.page) params.set("page", String(opts.page));
|
|
676
|
-
if (opts.limit) params.set("limit", String(opts.limit));
|
|
677
|
-
const qs = params.toString();
|
|
678
|
-
return this.get(`/v1/creators${qs ? `?${qs}` : ""}`);
|
|
679
|
-
}
|
|
680
|
-
getCreatorProfile(walletAddress) {
|
|
681
|
-
return this.request(
|
|
682
|
-
`/v1/creators/${this.addr(walletAddress)}/profile`,
|
|
683
|
-
{ method: "GET" },
|
|
684
|
-
{ allow404: true }
|
|
685
|
-
);
|
|
686
|
-
}
|
|
687
|
-
getCreatorByUsername(username) {
|
|
688
|
-
return this.request(
|
|
689
|
-
`/v1/creators/by-username/${encodeURIComponent(username.toLowerCase().trim())}`,
|
|
690
|
-
{ method: "GET" },
|
|
691
|
-
{ allow404: true }
|
|
692
|
-
);
|
|
693
|
-
}
|
|
694
|
-
updateCreatorProfile(walletAddress, data, siwsToken) {
|
|
695
|
-
return this.request(
|
|
696
|
-
`/v1/creators/${this.addr(walletAddress)}/profile`,
|
|
697
|
-
{ method: "PATCH", body: JSON.stringify(data), headers: this.bearer(siwsToken) }
|
|
698
|
-
);
|
|
699
|
-
}
|
|
700
|
-
checkCollectionSlugAvailability(slug) {
|
|
701
|
-
return this.get(
|
|
702
|
-
`/v1/collection-slug-claims/check/${encodeURIComponent(slug.toLowerCase().trim())}`
|
|
703
|
-
);
|
|
704
|
-
}
|
|
705
|
-
submitCollectionSlugClaim(contractAddress, slug, siwsToken, notifyEmail) {
|
|
706
|
-
return this.request("/v1/collection-slug-claims", {
|
|
707
|
-
method: "POST",
|
|
708
|
-
body: JSON.stringify({ contractAddress, slug, notifyEmail }),
|
|
709
|
-
headers: this.bearer(siwsToken)
|
|
710
|
-
});
|
|
711
|
-
}
|
|
712
|
-
getMyCollectionSlugClaims(siwsToken) {
|
|
713
|
-
return this.request("/v1/collection-slug-claims/me", {
|
|
714
|
-
method: "GET",
|
|
715
|
-
headers: this.bearer(siwsToken)
|
|
716
|
-
});
|
|
717
|
-
}
|
|
718
|
-
async getCollectionBySlug(slug) {
|
|
719
|
-
const res = await this.request(
|
|
720
|
-
`/v1/collections/by-slug/${encodeURIComponent(slug.toLowerCase().trim())}`,
|
|
721
|
-
{ method: "GET" },
|
|
722
|
-
{ allow404: true }
|
|
723
|
-
);
|
|
724
|
-
return res?.data ?? null;
|
|
725
|
-
}
|
|
726
|
-
async registerUser(params) {
|
|
727
|
-
return this.post("/v1/users/register", params);
|
|
728
|
-
}
|
|
729
|
-
async upsertMyWallet(siwsToken, options = {}) {
|
|
730
|
-
const body = {
|
|
731
|
-
walletType: options.walletType ?? "UNKNOWN"
|
|
732
|
-
};
|
|
733
|
-
if (options.chain) body.chain = options.chain;
|
|
734
|
-
if (options.email) body.email = options.email;
|
|
735
|
-
if (options.accountToken) body.accountToken = options.accountToken;
|
|
736
|
-
return this.request("/v1/users/me", {
|
|
737
|
-
method: "POST",
|
|
738
|
-
body: JSON.stringify(body),
|
|
739
|
-
headers: this.bearer(siwsToken)
|
|
740
|
-
});
|
|
741
|
-
}
|
|
742
|
-
async checkEmail(email) {
|
|
743
|
-
const body = await this.get(`/v1/auth/email/exists?email=${encodeURIComponent(email)}`);
|
|
744
|
-
return { exists: body.exists };
|
|
745
|
-
}
|
|
746
|
-
async requestEmailCode(email) {
|
|
747
|
-
await this.post("/v1/auth/email/request-code", { email });
|
|
748
|
-
}
|
|
749
|
-
async registerEmailAccount(email) {
|
|
750
|
-
await this.post("/v1/auth/email/register-account", { email });
|
|
751
|
-
}
|
|
752
|
-
async verifyEmailCode(email, code) {
|
|
753
|
-
await this.post("/v1/auth/email/verify-code", { email, code });
|
|
754
|
-
}
|
|
755
|
-
async confirmEmail(token) {
|
|
756
|
-
const body = await this.post("/v1/auth/email/confirm", { token });
|
|
757
|
-
return { email: body.email };
|
|
758
|
-
}
|
|
759
|
-
setupWalletKey(params) {
|
|
760
|
-
return this.post("/v1/users/me/wallet/key", params);
|
|
761
|
-
}
|
|
762
|
-
async getSessionWallet() {
|
|
763
|
-
const body = await this.post("/v1/users/me/wallet", {});
|
|
764
|
-
return body.walletAddress ? { walletAddress: body.walletAddress, needsKeySetup: body.needsKeySetup === true } : null;
|
|
765
|
-
}
|
|
766
|
-
getMyWallet(siwsToken) {
|
|
767
|
-
return this.request(
|
|
768
|
-
"/v1/users/me",
|
|
769
|
-
{ method: "GET", headers: this.bearer(siwsToken) },
|
|
770
|
-
{ allow404: true }
|
|
771
|
-
);
|
|
772
|
-
}
|
|
773
|
-
changeMyEmail(email, siwsToken) {
|
|
774
|
-
return this.request("/v1/users/me/email", {
|
|
775
|
-
method: "POST",
|
|
776
|
-
headers: this.bearer(siwsToken),
|
|
777
|
-
body: JSON.stringify({ email })
|
|
778
|
-
});
|
|
779
|
-
}
|
|
780
|
-
getTokenRemixes(contract, tokenId, opts = {}) {
|
|
781
|
-
const params = new URLSearchParams();
|
|
782
|
-
if (opts.page !== void 0) params.set("page", String(opts.page));
|
|
783
|
-
if (opts.limit !== void 0) params.set("limit", String(opts.limit));
|
|
784
|
-
const qs = params.toString();
|
|
785
|
-
return this.get(
|
|
786
|
-
`/v1/tokens/${this.addr(contract)}/${tokenId}/remixes${qs ? `?${qs}` : ""}`
|
|
787
|
-
);
|
|
788
|
-
}
|
|
789
|
-
submitRemixOffer(params, siwsToken) {
|
|
790
|
-
return this.request("/v1/remix-offers", {
|
|
791
|
-
method: "POST",
|
|
792
|
-
body: JSON.stringify(params),
|
|
793
|
-
headers: { "Authorization": `Bearer ${siwsToken}` }
|
|
794
|
-
});
|
|
795
|
-
}
|
|
796
|
-
submitAutoRemixOffer(params, siwsToken) {
|
|
797
|
-
return this.request("/v1/remix-offers/auto", {
|
|
798
|
-
method: "POST",
|
|
799
|
-
body: JSON.stringify(params),
|
|
800
|
-
headers: { "Authorization": `Bearer ${siwsToken}` }
|
|
801
|
-
});
|
|
802
|
-
}
|
|
803
|
-
confirmSelfRemix(params, siwsToken) {
|
|
804
|
-
return this.request("/v1/remix-offers/self/confirm", {
|
|
805
|
-
method: "POST",
|
|
806
|
-
body: JSON.stringify(params),
|
|
807
|
-
headers: { "Authorization": `Bearer ${siwsToken}` }
|
|
808
|
-
});
|
|
809
|
-
}
|
|
810
|
-
getRemixOffers(query, siwsToken) {
|
|
811
|
-
const params = new URLSearchParams({ role: query.role });
|
|
812
|
-
if (query.status) params.set("status", query.status);
|
|
813
|
-
if (query.page !== void 0) params.set("page", String(query.page));
|
|
814
|
-
if (query.limit !== void 0) params.set("limit", String(query.limit));
|
|
815
|
-
return this.request(`/v1/remix-offers?${params}`, {
|
|
816
|
-
method: "GET",
|
|
817
|
-
headers: this.bearer(siwsToken)
|
|
818
|
-
});
|
|
819
|
-
}
|
|
820
|
-
getRemixOffer(id, siwsToken) {
|
|
821
|
-
return this.request(`/v1/remix-offers/${id}`, {
|
|
822
|
-
method: "GET",
|
|
823
|
-
headers: siwsToken ? this.bearer(siwsToken) : void 0
|
|
824
|
-
});
|
|
825
|
-
}
|
|
826
|
-
confirmRemixOffer(id, params, siwsToken) {
|
|
827
|
-
return this.request(`/v1/remix-offers/${id}/confirm`, {
|
|
828
|
-
method: "POST",
|
|
829
|
-
body: JSON.stringify(params),
|
|
830
|
-
headers: { "Authorization": `Bearer ${siwsToken}` }
|
|
831
|
-
});
|
|
832
|
-
}
|
|
833
|
-
rejectRemixOffer(id, siwsToken) {
|
|
834
|
-
return this.request(`/v1/remix-offers/${id}/reject`, {
|
|
835
|
-
method: "POST",
|
|
836
|
-
body: JSON.stringify({}),
|
|
837
|
-
headers: { "Authorization": `Bearer ${siwsToken}` }
|
|
838
|
-
});
|
|
839
|
-
}
|
|
840
|
-
extendRemixOffer(id, days, siwsToken) {
|
|
841
|
-
return this.request(`/v1/remix-offers/${id}/extend`, {
|
|
842
|
-
method: "POST",
|
|
843
|
-
body: JSON.stringify({ days }),
|
|
844
|
-
headers: { "Authorization": `Bearer ${siwsToken}` }
|
|
845
|
-
});
|
|
846
|
-
}
|
|
847
|
-
async getPopEligibility(collection, wallet) {
|
|
848
|
-
const res = await this.get(
|
|
849
|
-
`/v1/pop/eligibility/${this.addr(collection)}/${this.addr(wallet)}`
|
|
850
|
-
);
|
|
851
|
-
return res.data;
|
|
852
|
-
}
|
|
853
|
-
async getPopEligibilityBatch(collection, wallets) {
|
|
854
|
-
const params = new URLSearchParams({ wallets: wallets.map((w) => this.addr(w)).join(",") });
|
|
855
|
-
const res = await this.get(
|
|
856
|
-
`/v1/pop/eligibility/${this.addr(collection)}?${params}`
|
|
857
|
-
);
|
|
858
|
-
return res.data;
|
|
859
|
-
}
|
|
860
|
-
getCoins(opts = {}) {
|
|
861
|
-
const params = new URLSearchParams();
|
|
862
|
-
if (opts.page) params.set("page", String(opts.page));
|
|
863
|
-
if (opts.limit) params.set("limit", String(opts.limit));
|
|
864
|
-
if (opts.service) params.set("service", opts.service);
|
|
865
|
-
if (opts.sort) params.set("sort", opts.sort);
|
|
866
|
-
if (opts.creator) params.set("creator", this.addr(opts.creator));
|
|
867
|
-
if (opts.chain) params.set("chain", opts.chain);
|
|
868
|
-
const qs = params.toString();
|
|
869
|
-
return this.get(`/v1/coins${qs ? `?${qs}` : ""}`);
|
|
870
|
-
}
|
|
871
|
-
getCoin(contract) {
|
|
872
|
-
return this.get(`/v1/coins/${this.addr(contract)}`);
|
|
873
|
-
}
|
|
874
|
-
getCoinPrices() {
|
|
875
|
-
return this.get("/v1/coins/prices");
|
|
876
|
-
}
|
|
877
|
-
claimCoin(coinAddress, siwsToken) {
|
|
878
|
-
return this.request("/v1/coins/claim", {
|
|
879
|
-
method: "POST",
|
|
880
|
-
headers: { Authorization: `Bearer ${siwsToken}` },
|
|
881
|
-
body: JSON.stringify({ coinAddress })
|
|
882
|
-
});
|
|
883
|
-
}
|
|
884
|
-
getCoinClaims(status = "PENDING") {
|
|
885
|
-
return this.get(
|
|
886
|
-
`/v1/coins/claims?status=${encodeURIComponent(status)}`
|
|
887
|
-
);
|
|
888
|
-
}
|
|
889
|
-
updateCoinProfile(contract, data, siwsToken) {
|
|
890
|
-
return this.request(`/v1/coins/${this.addr(contract)}`, {
|
|
891
|
-
method: "PATCH",
|
|
892
|
-
body: JSON.stringify(data),
|
|
893
|
-
headers: this.bearer(siwsToken)
|
|
894
|
-
});
|
|
895
|
-
}
|
|
896
|
-
async getDropMintStatus(collection, wallet) {
|
|
897
|
-
const res = await this.get(
|
|
898
|
-
`/v1/drop/mint-status/${this.addr(collection)}/${this.addr(wallet)}`
|
|
899
|
-
);
|
|
900
|
-
return res.data;
|
|
901
|
-
}
|
|
902
|
-
async getDropInfo(contract) {
|
|
903
|
-
const res = await this.request(
|
|
904
|
-
`/v1/drop/${this.addr(contract)}/info`,
|
|
905
|
-
{ method: "GET" },
|
|
906
|
-
{ allow404: true }
|
|
907
|
-
);
|
|
908
|
-
return res?.data ?? null;
|
|
909
|
-
}
|
|
910
|
-
async getDropState(contract) {
|
|
911
|
-
const res = await this.get(`/v1/drop/${this.addr(contract)}/state`);
|
|
912
|
-
return res.data;
|
|
913
|
-
}
|
|
914
|
-
async getTicket(contract, tokenId) {
|
|
915
|
-
const res = await this.get(`/v1/tickets/${this.addr(contract)}/${tokenId}`);
|
|
916
|
-
return res.data;
|
|
917
|
-
}
|
|
918
|
-
async getTicketCount(contract) {
|
|
919
|
-
const res = await this.get(`/v1/tickets/${this.addr(contract)}/count`);
|
|
920
|
-
return res.data.count;
|
|
921
|
-
}
|
|
922
|
-
async getClubMembershipCount(contract) {
|
|
923
|
-
const res = await this.get(`/v1/club/${this.addr(contract)}/count`);
|
|
924
|
-
return res.data.count;
|
|
925
|
-
}
|
|
926
|
-
async getClubMembership(contract, tokenId) {
|
|
927
|
-
const res = await this.get(`/v1/club/${this.addr(contract)}/${tokenId}`);
|
|
928
|
-
return res.data;
|
|
929
|
-
}
|
|
930
|
-
async isClubMember(contract, tokenId, wallet) {
|
|
931
|
-
const res = await this.get(
|
|
932
|
-
`/v1/club/${this.addr(contract)}/${tokenId}/member/${this.addr(wallet)}`
|
|
933
|
-
);
|
|
934
|
-
return res.data.isMember;
|
|
935
|
-
}
|
|
936
|
-
async getIpNftTokenData(contract, tokenId) {
|
|
937
|
-
const res = await this.get(`/v1/ipnft/${this.addr(contract)}/${tokenId}`);
|
|
938
|
-
return res.data;
|
|
939
|
-
}
|
|
940
|
-
async getPlatformStats() {
|
|
941
|
-
const res = await this.get("/v1/stats");
|
|
942
|
-
return res.data;
|
|
943
|
-
}
|
|
944
|
-
getTokens(query = {}) {
|
|
945
|
-
const params = new URLSearchParams();
|
|
946
|
-
if (query.page !== void 0) params.set("page", String(query.page));
|
|
947
|
-
if (query.limit !== void 0) params.set("limit", String(query.limit));
|
|
948
|
-
if (query.sort) params.set("sort", query.sort);
|
|
949
|
-
if (query.ipType) params.set("ipType", query.ipType);
|
|
950
|
-
if (query.derivatives) params.set("derivatives", query.derivatives);
|
|
951
|
-
const qs = params.toString();
|
|
952
|
-
return this.get(`/v1/tokens${qs ? `?${qs}` : ""}`);
|
|
953
|
-
}
|
|
954
|
-
async isCreatorHidden(wallet) {
|
|
955
|
-
const res = await this.get(`/v1/creators/${this.addr(wallet)}/hidden`);
|
|
956
|
-
return res.isHidden;
|
|
957
|
-
}
|
|
958
|
-
getMyUsernameClaim(siwsToken) {
|
|
959
|
-
return this.request("/v1/username-claims/me", {
|
|
960
|
-
method: "GET",
|
|
961
|
-
headers: this.bearer(siwsToken)
|
|
962
|
-
});
|
|
963
|
-
}
|
|
964
|
-
checkUsernameAvailability(username) {
|
|
965
|
-
return this.get(
|
|
966
|
-
`/v1/username-claims/check/${encodeURIComponent(username)}`
|
|
967
|
-
);
|
|
968
|
-
}
|
|
969
|
-
async submitUsernameClaim(username, siwsToken, notifyEmail) {
|
|
970
|
-
const res = await this.request("/v1/username-claims", {
|
|
971
|
-
method: "POST",
|
|
972
|
-
headers: this.bearer(siwsToken),
|
|
973
|
-
body: JSON.stringify({ username, ...notifyEmail ? { notifyEmail } : {} })
|
|
974
|
-
});
|
|
975
|
-
return res.claim;
|
|
976
|
-
}
|
|
977
|
-
async submitReport(report, siwsToken) {
|
|
978
|
-
const targetContract = report.targetContract ? this.addr(report.targetContract) : void 0;
|
|
979
|
-
const targetAddress = report.targetAddress ? this.addr(report.targetAddress) : void 0;
|
|
980
|
-
let targetKey = null;
|
|
981
|
-
if (report.targetType === "TOKEN" && targetContract && report.targetTokenId) {
|
|
982
|
-
targetKey = `TOKEN:${targetContract}:${report.targetTokenId}`;
|
|
983
|
-
} else if (report.targetType === "COLLECTION" && targetContract) {
|
|
984
|
-
targetKey = `COLLECTION:${targetContract}`;
|
|
985
|
-
} else if (report.targetType === "CREATOR" && targetAddress) {
|
|
986
|
-
targetKey = `CREATOR:${targetAddress}`;
|
|
987
|
-
} else if (report.targetType === "COMMENT" && report.targetId) {
|
|
988
|
-
targetKey = `COMMENT::${report.targetId}`;
|
|
989
|
-
}
|
|
990
|
-
if (!targetKey) throw new Error(`A ${report.targetType} report needs its target`);
|
|
991
|
-
await this.request("/v1/reports", {
|
|
992
|
-
method: "POST",
|
|
993
|
-
headers: this.bearer(siwsToken),
|
|
994
|
-
body: JSON.stringify({ ...report, targetKey, targetContract, targetAddress })
|
|
995
|
-
});
|
|
996
|
-
}
|
|
997
|
-
getPricing() {
|
|
998
|
-
return this.get("/v1/pricing");
|
|
999
|
-
}
|
|
1000
|
-
listCollections(query = {}) {
|
|
1001
|
-
const params = new URLSearchParams();
|
|
1002
|
-
if (query.page !== void 0) params.set("page", String(query.page));
|
|
1003
|
-
if (query.limit !== void 0) params.set("limit", String(query.limit));
|
|
1004
|
-
if (query.owner) params.set("owner", this.addr(query.owner));
|
|
1005
|
-
if (query.service) params.set("service", query.service);
|
|
1006
|
-
if (query.sort) params.set("sort", query.sort);
|
|
1007
|
-
if (query.isFeatured !== void 0) params.set("isFeatured", String(query.isFeatured));
|
|
1008
|
-
if (query.hideEmpty !== void 0) params.set("hideEmpty", String(query.hideEmpty));
|
|
1009
|
-
if (query.standard) params.set("standard", query.standard);
|
|
1010
|
-
if (query.chain) params.set("chain", query.chain);
|
|
1011
|
-
const qs = params.toString();
|
|
1012
|
-
return this.get(`/v1/collections${qs ? `?${qs}` : ""}`);
|
|
1013
|
-
}
|
|
1014
|
-
generateWallet(newWalletSiwsToken, siwsToken) {
|
|
1015
|
-
return this.request("/v1/users/me/generate-wallet", {
|
|
1016
|
-
method: "POST",
|
|
1017
|
-
headers: this.bearer(siwsToken),
|
|
1018
|
-
body: JSON.stringify({ newWalletSiwsToken })
|
|
1019
|
-
});
|
|
1020
|
-
}
|
|
1021
|
-
syncCoin(coinAddress, owner) {
|
|
1022
|
-
return this.post("/v1/coins/sync", { coinAddress, ...owner ? { owner } : {} });
|
|
1023
|
-
}
|
|
1024
|
-
registerCollection(contractAddress) {
|
|
1025
|
-
return this.post("/v1/collections/register", { contractAddress });
|
|
1026
|
-
}
|
|
1027
|
-
getSponsorshipOffers(query = {}) {
|
|
1028
|
-
const params = new URLSearchParams({ limit: String(query.limit ?? 50) });
|
|
1029
|
-
if (query.nftContract) params.set("nftContract", query.nftContract);
|
|
1030
|
-
if (query.author) params.set("author", query.author);
|
|
1031
|
-
if (query.owner) params.set("owner", query.owner);
|
|
1032
|
-
if (query.open !== void 0) params.set("open", String(query.open));
|
|
1033
|
-
return this.get(`/v1/sponsorship/offers?${params}`);
|
|
1034
|
-
}
|
|
1035
|
-
async getSponsorshipOffer(offerId) {
|
|
1036
|
-
const res = await this.request(
|
|
1037
|
-
`/v1/sponsorship/offers/${encodeURIComponent(offerId)}`,
|
|
1038
|
-
{ method: "GET" },
|
|
1039
|
-
{ allow404: true }
|
|
1040
|
-
);
|
|
1041
|
-
return res?.data ?? null;
|
|
1042
|
-
}
|
|
1043
|
-
async getSponsorshipProposal(proposalId) {
|
|
1044
|
-
const res = await this.request(
|
|
1045
|
-
`/v1/sponsorship/proposals/${encodeURIComponent(proposalId)}`,
|
|
1046
|
-
{ method: "GET" },
|
|
1047
|
-
{ allow404: true }
|
|
1048
|
-
);
|
|
1049
|
-
return res?.data ?? null;
|
|
1050
|
-
}
|
|
1051
|
-
async getSponsorshipBids(offerId) {
|
|
1052
|
-
const res = await this.get(`/v1/sponsorship/offers/${encodeURIComponent(offerId)}/bids`);
|
|
1053
|
-
return res.data;
|
|
1054
|
-
}
|
|
1055
|
-
getSponsorshipProposals(query = {}) {
|
|
1056
|
-
const params = new URLSearchParams({ limit: String(query.limit ?? 50) });
|
|
1057
|
-
if (query.nftContract) params.set("nftContract", query.nftContract);
|
|
1058
|
-
if (query.proposer) params.set("proposer", query.proposer);
|
|
1059
|
-
if (query.owner) params.set("owner", query.owner);
|
|
1060
|
-
if (query.open !== void 0) params.set("open", String(query.open));
|
|
1061
|
-
return this.get(`/v1/sponsorship/proposals?${params}`);
|
|
1062
|
-
}
|
|
1063
|
-
getSponsorshipLicenses(query = {}) {
|
|
1064
|
-
const params = new URLSearchParams({ limit: String(query.limit ?? 50) });
|
|
1065
|
-
if (query.holder) params.set("holder", query.holder);
|
|
1066
|
-
if (query.author) params.set("author", query.author);
|
|
1067
|
-
return this.get(`/v1/sponsorship/licenses?${params}`);
|
|
1068
|
-
}
|
|
1069
|
-
async getRewards(address) {
|
|
1070
|
-
const res = await this.get(`/v1/rewards/${this.addr(address)}`);
|
|
1071
|
-
return res.data;
|
|
1072
|
-
}
|
|
1073
|
-
getRewardsLeaderboard(page = 1, limit = 50) {
|
|
1074
|
-
return this.get(`/v1/rewards?page=${page}&limit=${limit}`);
|
|
1075
|
-
}
|
|
1076
|
-
getRewardsEvents(address, page = 1, limit = 20) {
|
|
1077
|
-
return this.get(
|
|
1078
|
-
`/v1/rewards/${this.addr(address)}/events?page=${page}&limit=${limit}`
|
|
1079
|
-
);
|
|
1080
|
-
}
|
|
1081
|
-
async getRewardsConfig() {
|
|
1082
|
-
const res = await this.get(`/v1/rewards/config`);
|
|
1083
|
-
return res.data;
|
|
1084
|
-
}
|
|
1085
|
-
async getRewardsBatch(addresses) {
|
|
1086
|
-
if (addresses.length === 0) return [];
|
|
1087
|
-
const params = new URLSearchParams({ addresses: addresses.map((a) => this.addr(a)).join(",") });
|
|
1088
|
-
const res = await this.get(`/v1/rewards/batch?${params}`);
|
|
1089
|
-
return res.data;
|
|
1090
|
-
}
|
|
1091
|
-
};
|
|
1092
|
-
|
|
1093
|
-
// src/constants.ts
|
|
1094
|
-
var SN = getCoordinates("STARKNET");
|
|
1095
|
-
SN.marketplace721;
|
|
1096
|
-
SN.marketplace721ClassHash;
|
|
1097
|
-
SN.marketplace721StartBlock;
|
|
1098
|
-
SN.marketplace1155;
|
|
1099
|
-
SN.marketplace1155ClassHash;
|
|
1100
|
-
SN.marketplace1155StartBlock;
|
|
1101
|
-
SN.collection721;
|
|
1102
|
-
SN.dataTokenization721;
|
|
1103
|
-
SN.collection721StartBlock;
|
|
1104
|
-
SN.ipNftClassHash;
|
|
1105
|
-
SN.ipCollectionClassHash;
|
|
1106
|
-
SN.collection1155;
|
|
1107
|
-
SN.collection1155FactoryClassHash;
|
|
1108
|
-
SN.collection1155ClassHash;
|
|
1109
|
-
SN.collection1155StartBlock;
|
|
1110
|
-
SN.popFactory;
|
|
1111
|
-
SN.popCollectionClassHash;
|
|
1112
|
-
SN.dropFactory;
|
|
1113
|
-
SN.dropCollectionClassHash;
|
|
1114
|
-
SN.nftComments;
|
|
1115
|
-
SN.ipTicketsFactory;
|
|
1116
|
-
SN.ipTicketCollectionClassHash;
|
|
1117
|
-
SN.ipClubFactory;
|
|
1118
|
-
SN.ipClubCollectionClassHash;
|
|
1119
|
-
SN.ipSponsorship;
|
|
1120
|
-
SN.ipSponsorshipClassHash;
|
|
1121
|
-
var STARKNET_MEDIAWALLET_CLASS_HASH = SN.mediaWalletClassHash;
|
|
1122
|
-
SN.creatorCoinFactory;
|
|
1123
|
-
SN.creatorCoinEkuboLauncher;
|
|
1124
|
-
SN.creatorCoinClassHash;
|
|
1125
|
-
SN.creatorCoinFactoryClassHash;
|
|
1126
|
-
SN.creatorCoinStartBlock;
|
|
1127
|
-
SN.genesisMint;
|
|
1128
|
-
SN.ekuboCore;
|
|
1129
|
-
var SUPPORTED_TOKENS = [
|
|
1130
|
-
{
|
|
1131
|
-
symbol: "USDC",
|
|
1132
|
-
address: "0x033068f6539f8e6e6b131e6b2b814e6c34a5224bc66947c47dab9dfee93b35fb",
|
|
1133
|
-
decimals: 6,
|
|
1134
|
-
listable: true
|
|
1135
|
-
},
|
|
1136
|
-
{
|
|
1137
|
-
symbol: "USDT",
|
|
1138
|
-
address: "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",
|
|
1139
|
-
decimals: 6,
|
|
1140
|
-
listable: true
|
|
1141
|
-
},
|
|
1142
|
-
{
|
|
1143
|
-
symbol: "ETH",
|
|
1144
|
-
address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
|
|
1145
|
-
decimals: 18,
|
|
1146
|
-
listable: true
|
|
1147
|
-
},
|
|
1148
|
-
{
|
|
1149
|
-
symbol: "STRK",
|
|
1150
|
-
address: "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d",
|
|
1151
|
-
decimals: 18,
|
|
1152
|
-
listable: true
|
|
1153
|
-
},
|
|
1154
|
-
{
|
|
1155
|
-
symbol: "WBTC",
|
|
1156
|
-
address: "0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac",
|
|
1157
|
-
decimals: 8,
|
|
1158
|
-
listable: true
|
|
1159
|
-
}
|
|
1160
|
-
];
|
|
1161
|
-
|
|
1162
9
|
// src/starknet/marketplace/errors.ts
|
|
1163
10
|
var MedialaneError = class extends Error {
|
|
1164
11
|
constructor(message, code = "UNKNOWN", cause) {
|
|
@@ -1169,71 +16,6 @@ var MedialaneError = class extends Error {
|
|
|
1169
16
|
}
|
|
1170
17
|
};
|
|
1171
18
|
|
|
1172
|
-
// src/utils/rpc.ts
|
|
1173
|
-
var TRANSIENT_BODY_RE = /"code"\s*:\s*-32001|"code"\s*:\s*-32603|unable to complete|rate.?limit|too many|throttl|exceed.*quota|temporarily unavailable|service unavailable|overload|gateway.*time|upstream.*time|backend.*error/i;
|
|
1174
|
-
var POLICY_REFUSAL_CODES = [-32003, -32005, -32600];
|
|
1175
|
-
function isPolicyRefusal(input) {
|
|
1176
|
-
let body = input.body;
|
|
1177
|
-
if (typeof body === "string") {
|
|
1178
|
-
try {
|
|
1179
|
-
body = JSON.parse(body);
|
|
1180
|
-
} catch {
|
|
1181
|
-
return false;
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
const err = body?.error;
|
|
1185
|
-
const code = err && typeof err === "object" ? err.code : void 0;
|
|
1186
|
-
return typeof code === "number" && POLICY_REFUSAL_CODES.includes(code);
|
|
1187
|
-
}
|
|
1188
|
-
function isTransientRpcError(input) {
|
|
1189
|
-
const { status, body } = input;
|
|
1190
|
-
if (isPolicyRefusal({ body })) return false;
|
|
1191
|
-
if (typeof status === "number" && (status === 429 || status >= 500)) return true;
|
|
1192
|
-
if (body == null) return false;
|
|
1193
|
-
if (typeof body === "object") {
|
|
1194
|
-
const err = body.error;
|
|
1195
|
-
if (!err || typeof err !== "object") return false;
|
|
1196
|
-
const code = err.code;
|
|
1197
|
-
if (typeof code === "number") {
|
|
1198
|
-
if (code === 429) return true;
|
|
1199
|
-
if (code >= -32099 && code <= -32e3) return true;
|
|
1200
|
-
if (code === -32603) return true;
|
|
1201
|
-
}
|
|
1202
|
-
const message = err.message;
|
|
1203
|
-
return typeof message === "string" ? TRANSIENT_BODY_RE.test(message) : false;
|
|
1204
|
-
}
|
|
1205
|
-
return TRANSIENT_BODY_RE.test(String(body));
|
|
1206
|
-
}
|
|
1207
|
-
function createFailoverFetch(urls, options = {}) {
|
|
1208
|
-
const endpoints = urls.filter((u) => Boolean(u));
|
|
1209
|
-
if (endpoints.length === 0) {
|
|
1210
|
-
throw new Error("createFailoverFetch: at least one RPC URL is required");
|
|
1211
|
-
}
|
|
1212
|
-
const doFetch = options.baseFetch ?? fetch;
|
|
1213
|
-
const failover = async (_input, init) => {
|
|
1214
|
-
let lastError;
|
|
1215
|
-
for (let i = 0; i < endpoints.length; i++) {
|
|
1216
|
-
const url = endpoints[i];
|
|
1217
|
-
const isLast = i === endpoints.length - 1;
|
|
1218
|
-
try {
|
|
1219
|
-
const res = await doFetch(url, init);
|
|
1220
|
-
const text = await res.text();
|
|
1221
|
-
const rebuilt = () => new Response(text, { status: res.status, statusText: res.statusText, headers: res.headers });
|
|
1222
|
-
if (isLast || !isTransientRpcError({ status: res.status, body: text })) {
|
|
1223
|
-
return rebuilt();
|
|
1224
|
-
}
|
|
1225
|
-
options.onFailover?.({ url, status: res.status });
|
|
1226
|
-
} catch (err) {
|
|
1227
|
-
lastError = err;
|
|
1228
|
-
if (isLast) throw err;
|
|
1229
|
-
options.onFailover?.({ url, error: err });
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
throw lastError ?? new Error("createFailoverFetch: all endpoints failed");
|
|
1233
|
-
};
|
|
1234
|
-
return failover;
|
|
1235
|
-
}
|
|
1236
|
-
|
|
1237
19
|
// src/starknet/marketplace/utils.ts
|
|
1238
20
|
var START_TIME_BUFFER_SECS = 30;
|
|
1239
21
|
function newContract(abi, address, providerOrAccount) {
|
|
@@ -1251,7 +33,7 @@ function getChainId(config) {
|
|
|
1251
33
|
return starknet.constants.StarknetChainId.SN_MAIN;
|
|
1252
34
|
}
|
|
1253
35
|
function resolveToken(currency) {
|
|
1254
|
-
const token = SUPPORTED_TOKENS.find(
|
|
36
|
+
const token = chunkZFRHADHR_cjs.SUPPORTED_TOKENS.find(
|
|
1255
37
|
(t) => t.symbol === currency.toUpperCase() || t.address.toLowerCase() === currency.toLowerCase()
|
|
1256
38
|
);
|
|
1257
39
|
if (!token) throw new MedialaneError(`Unsupported currency: ${currency}`, "INVALID_PARAMS");
|
|
@@ -1262,7 +44,7 @@ function getProvider(config) {
|
|
|
1262
44
|
let p = _providerCache.get(config);
|
|
1263
45
|
if (!p) {
|
|
1264
46
|
const urls = [config.rpcUrl];
|
|
1265
|
-
p = new starknet.RpcProvider({ nodeUrl: urls[0], baseFetch: createFailoverFetch(urls) });
|
|
47
|
+
p = new starknet.RpcProvider({ nodeUrl: urls[0], baseFetch: chunkZFRHADHR_cjs.createFailoverFetch(urls) });
|
|
1266
48
|
_providerCache.set(config, p);
|
|
1267
49
|
}
|
|
1268
50
|
return p;
|
|
@@ -10298,10 +9080,10 @@ var IPGenesisABI = [
|
|
|
10298
9080
|
// src/starknet/services/pop.ts
|
|
10299
9081
|
var PopService = class {
|
|
10300
9082
|
constructor(config) {
|
|
10301
|
-
this.factoryAddress = getStarknetCoordinates(config.chain).popFactory;
|
|
9083
|
+
this.factoryAddress = chunkOUPVVMLK_cjs.getStarknetCoordinates(config.chain).popFactory;
|
|
10302
9084
|
}
|
|
10303
9085
|
_collection(address, account) {
|
|
10304
|
-
return newContract(POPCollectionABI, normalizeAddress("STARKNET", address), account);
|
|
9086
|
+
return newContract(POPCollectionABI, chunkZFRHADHR_cjs.normalizeAddress("STARKNET", address), account);
|
|
10305
9087
|
}
|
|
10306
9088
|
async claim(account, collectionAddress) {
|
|
10307
9089
|
const call = this._collection(collectionAddress, account).populate("claim", []);
|
|
@@ -10388,11 +9170,11 @@ function toContractConditions(c) {
|
|
|
10388
9170
|
}
|
|
10389
9171
|
var DropService = class {
|
|
10390
9172
|
constructor(config) {
|
|
10391
|
-
this.factoryAddress = getStarknetCoordinates(config.chain).dropFactory;
|
|
9173
|
+
this.factoryAddress = chunkOUPVVMLK_cjs.getStarknetCoordinates(config.chain).dropFactory;
|
|
10392
9174
|
this.config = config;
|
|
10393
9175
|
}
|
|
10394
9176
|
_collection(address, account) {
|
|
10395
|
-
return newContract(DropCollectionABI, normalizeAddress("STARKNET", address), account);
|
|
9177
|
+
return newContract(DropCollectionABI, chunkZFRHADHR_cjs.normalizeAddress("STARKNET", address), account);
|
|
10396
9178
|
}
|
|
10397
9179
|
async claim(account, collectionAddress, quantity = 1) {
|
|
10398
9180
|
const collection = this._collection(collectionAddress, account);
|
|
@@ -10472,19 +9254,19 @@ var DropService = class {
|
|
|
10472
9254
|
// src/starknet/services/erc1155collection.ts
|
|
10473
9255
|
var ERC1155CollectionService = class {
|
|
10474
9256
|
constructor(config) {
|
|
10475
|
-
this.factoryAddress = config.collection1155Contract ?? getStarknetCoordinates(config.chain).collection1155;
|
|
9257
|
+
this.factoryAddress = config.collection1155Contract ?? chunkOUPVVMLK_cjs.getStarknetCoordinates(config.chain).collection1155;
|
|
10476
9258
|
}
|
|
10477
9259
|
_factory(account) {
|
|
10478
9260
|
return newContract(
|
|
10479
9261
|
IPCollection1155FactoryABI,
|
|
10480
|
-
normalizeAddress("STARKNET", this.factoryAddress),
|
|
9262
|
+
chunkZFRHADHR_cjs.normalizeAddress("STARKNET", this.factoryAddress),
|
|
10481
9263
|
account
|
|
10482
9264
|
);
|
|
10483
9265
|
}
|
|
10484
9266
|
_collection(address, account) {
|
|
10485
9267
|
return newContract(
|
|
10486
9268
|
IPCollection1155ABI,
|
|
10487
|
-
normalizeAddress("STARKNET", address),
|
|
9269
|
+
chunkZFRHADHR_cjs.normalizeAddress("STARKNET", address),
|
|
10488
9270
|
account
|
|
10489
9271
|
);
|
|
10490
9272
|
}
|
|
@@ -10667,7 +9449,7 @@ function factoryContract() {
|
|
|
10667
9449
|
if (!_factoryContract) {
|
|
10668
9450
|
_factoryContract = newContract(
|
|
10669
9451
|
CreatorCoinFactoryABI,
|
|
10670
|
-
getStarknetCoordinates("STARKNET").creatorCoinFactory
|
|
9452
|
+
chunkOUPVVMLK_cjs.getStarknetCoordinates("STARKNET").creatorCoinFactory
|
|
10671
9453
|
);
|
|
10672
9454
|
}
|
|
10673
9455
|
return _factoryContract;
|
|
@@ -10704,7 +9486,7 @@ function buildLaunchOnEkuboCalls(params) {
|
|
|
10704
9486
|
calls.push({
|
|
10705
9487
|
contractAddress: params.quoteToken,
|
|
10706
9488
|
entrypoint: "transfer",
|
|
10707
|
-
calldata: [getStarknetCoordinates("STARKNET").creatorCoinFactory, amt.low, amt.high]
|
|
9489
|
+
calldata: [chunkOUPVVMLK_cjs.getStarknetCoordinates("STARKNET").creatorCoinFactory, amt.low, amt.high]
|
|
10708
9490
|
});
|
|
10709
9491
|
}
|
|
10710
9492
|
calls.push(factoryContract().populate("launch_on_ekubo", [launchParameters, ekuboParameters]));
|
|
@@ -10712,26 +9494,26 @@ function buildLaunchOnEkuboCalls(params) {
|
|
|
10712
9494
|
}
|
|
10713
9495
|
var CREATOR_COIN_CREATED_SELECTOR = starknet.hash.getSelectorFromName("CreatorCoinCreated");
|
|
10714
9496
|
function parseCreatorCoinCreated(receipt) {
|
|
10715
|
-
const factory = normalizeAddress("STARKNET", getStarknetCoordinates("STARKNET").creatorCoinFactory);
|
|
9497
|
+
const factory = chunkZFRHADHR_cjs.normalizeAddress("STARKNET", chunkOUPVVMLK_cjs.getStarknetCoordinates("STARKNET").creatorCoinFactory);
|
|
10716
9498
|
for (const ev of receipt?.events ?? []) {
|
|
10717
9499
|
let from;
|
|
10718
9500
|
try {
|
|
10719
|
-
from = normalizeAddress("STARKNET", ev.from_address ?? "");
|
|
9501
|
+
from = chunkZFRHADHR_cjs.normalizeAddress("STARKNET", ev.from_address ?? "");
|
|
10720
9502
|
} catch {
|
|
10721
9503
|
continue;
|
|
10722
9504
|
}
|
|
10723
9505
|
if (from !== factory) continue;
|
|
10724
9506
|
const k0 = ev.keys?.[0];
|
|
10725
|
-
if (!k0 || normalizeAddress("STARKNET", k0) !== normalizeAddress("STARKNET", CREATOR_COIN_CREATED_SELECTOR)) continue;
|
|
9507
|
+
if (!k0 || chunkZFRHADHR_cjs.normalizeAddress("STARKNET", k0) !== chunkZFRHADHR_cjs.normalizeAddress("STARKNET", CREATOR_COIN_CREATED_SELECTOR)) continue;
|
|
10726
9508
|
const data = ev.data ?? [];
|
|
10727
9509
|
if (data.length < 1) continue;
|
|
10728
|
-
return normalizeAddress("STARKNET", data[data.length - 1]);
|
|
9510
|
+
return chunkZFRHADHR_cjs.normalizeAddress("STARKNET", data[data.length - 1]);
|
|
10729
9511
|
}
|
|
10730
9512
|
throw new Error("Coin deployed but the coin address could not be read from the receipt");
|
|
10731
9513
|
}
|
|
10732
9514
|
var CreatorCoinService = class {
|
|
10733
9515
|
constructor(config) {
|
|
10734
|
-
this.factoryAddress = getStarknetCoordinates(config.chain).creatorCoinFactory;
|
|
9516
|
+
this.factoryAddress = chunkOUPVVMLK_cjs.getStarknetCoordinates(config.chain).creatorCoinFactory;
|
|
10735
9517
|
this.config = config;
|
|
10736
9518
|
}
|
|
10737
9519
|
_factory(account) {
|
|
@@ -10756,19 +9538,19 @@ var CreatorCoinService = class {
|
|
|
10756
9538
|
var TicketService = class {
|
|
10757
9539
|
constructor(config) {
|
|
10758
9540
|
this.config = config;
|
|
10759
|
-
this.factoryAddress = getStarknetCoordinates(config.chain).ipTicketsFactory;
|
|
9541
|
+
this.factoryAddress = chunkOUPVVMLK_cjs.getStarknetCoordinates(config.chain).ipTicketsFactory;
|
|
10760
9542
|
}
|
|
10761
9543
|
_factory(account, factoryAddress) {
|
|
10762
9544
|
const address = factoryAddress ?? this.factoryAddress;
|
|
10763
9545
|
if (!address) throw new Error("IP-Tickets factory address not configured for this chain");
|
|
10764
|
-
return newContract(IPTicketCollectionFactoryABI, normalizeAddress("STARKNET", address), account);
|
|
9546
|
+
return newContract(IPTicketCollectionFactoryABI, chunkZFRHADHR_cjs.normalizeAddress("STARKNET", address), account);
|
|
10765
9547
|
}
|
|
10766
9548
|
_collection(address, account) {
|
|
10767
|
-
return newContract(IPTicketCollectionABI, normalizeAddress("STARKNET", address), account);
|
|
9549
|
+
return newContract(IPTicketCollectionABI, chunkZFRHADHR_cjs.normalizeAddress("STARKNET", address), account);
|
|
10768
9550
|
}
|
|
10769
9551
|
_collectionRead(address) {
|
|
10770
9552
|
const provider = new starknet.RpcProvider({ nodeUrl: this.config.rpcUrl });
|
|
10771
|
-
return newContract(IPTicketCollectionABI, normalizeAddress("STARKNET", address), provider);
|
|
9553
|
+
return newContract(IPTicketCollectionABI, chunkZFRHADHR_cjs.normalizeAddress("STARKNET", address), provider);
|
|
10772
9554
|
}
|
|
10773
9555
|
async deployCollection(account, params) {
|
|
10774
9556
|
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
@@ -10829,19 +9611,19 @@ var TicketService = class {
|
|
|
10829
9611
|
var ClubService = class {
|
|
10830
9612
|
constructor(config) {
|
|
10831
9613
|
this.config = config;
|
|
10832
|
-
this.factoryAddress = getStarknetCoordinates(config.chain).ipClubFactory;
|
|
9614
|
+
this.factoryAddress = chunkOUPVVMLK_cjs.getStarknetCoordinates(config.chain).ipClubFactory;
|
|
10833
9615
|
}
|
|
10834
9616
|
_factory(account, factoryAddress) {
|
|
10835
9617
|
const address = factoryAddress ?? this.factoryAddress;
|
|
10836
9618
|
if (!address) throw new Error("IP-Club factory address not configured for this chain");
|
|
10837
|
-
return newContract(IPClubFactoryABI, normalizeAddress("STARKNET", address), account);
|
|
9619
|
+
return newContract(IPClubFactoryABI, chunkZFRHADHR_cjs.normalizeAddress("STARKNET", address), account);
|
|
10838
9620
|
}
|
|
10839
9621
|
_collection(address, account) {
|
|
10840
|
-
return newContract(IPClubCollectionABI, normalizeAddress("STARKNET", address), account);
|
|
9622
|
+
return newContract(IPClubCollectionABI, chunkZFRHADHR_cjs.normalizeAddress("STARKNET", address), account);
|
|
10841
9623
|
}
|
|
10842
9624
|
_collectionRead(address) {
|
|
10843
9625
|
const provider = new starknet.RpcProvider({ nodeUrl: this.config.rpcUrl });
|
|
10844
|
-
return newContract(IPClubCollectionABI, normalizeAddress("STARKNET", address), provider);
|
|
9626
|
+
return newContract(IPClubCollectionABI, chunkZFRHADHR_cjs.normalizeAddress("STARKNET", address), provider);
|
|
10845
9627
|
}
|
|
10846
9628
|
async deployCollection(account, params) {
|
|
10847
9629
|
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
@@ -10904,14 +9686,14 @@ var ClubService = class {
|
|
|
10904
9686
|
var SponsorshipService = class {
|
|
10905
9687
|
constructor(config) {
|
|
10906
9688
|
this.config = config;
|
|
10907
|
-
this.sponsorshipAddress = getStarknetCoordinates(config.chain).ipSponsorship;
|
|
9689
|
+
this.sponsorshipAddress = chunkOUPVVMLK_cjs.getStarknetCoordinates(config.chain).ipSponsorship;
|
|
10908
9690
|
}
|
|
10909
9691
|
_contract(account, address) {
|
|
10910
9692
|
const resolved = address ?? this.sponsorshipAddress;
|
|
10911
9693
|
if (!resolved) {
|
|
10912
9694
|
throw new Error("IP-Sponsorship address not configured for this chain");
|
|
10913
9695
|
}
|
|
10914
|
-
return newContract(IPSponsorshipABI, normalizeAddress("STARKNET", resolved), account);
|
|
9696
|
+
return newContract(IPSponsorshipABI, chunkZFRHADHR_cjs.normalizeAddress("STARKNET", resolved), account);
|
|
10915
9697
|
}
|
|
10916
9698
|
_contractRead(address) {
|
|
10917
9699
|
const resolved = address ?? this.sponsorshipAddress;
|
|
@@ -10919,7 +9701,7 @@ var SponsorshipService = class {
|
|
|
10919
9701
|
throw new Error("IP-Sponsorship address not configured for this chain");
|
|
10920
9702
|
}
|
|
10921
9703
|
const provider = new starknet.RpcProvider({ nodeUrl: this.config.rpcUrl });
|
|
10922
|
-
return newContract(IPSponsorshipABI, normalizeAddress("STARKNET", resolved), provider);
|
|
9704
|
+
return newContract(IPSponsorshipABI, chunkZFRHADHR_cjs.normalizeAddress("STARKNET", resolved), provider);
|
|
10923
9705
|
}
|
|
10924
9706
|
async createOffer(account, params) {
|
|
10925
9707
|
const specificSponsor = params.specificSponsor ? new starknet.CairoOption(starknet.CairoOptionVariant.Some, params.specificSponsor) : new starknet.CairoOption(starknet.CairoOptionVariant.None);
|
|
@@ -10954,7 +9736,7 @@ var SponsorshipService = class {
|
|
|
10954
9736
|
const approveCall = {
|
|
10955
9737
|
contractAddress: params.paymentToken,
|
|
10956
9738
|
entrypoint: "approve",
|
|
10957
|
-
calldata: [normalizeAddress("STARKNET", sponsorshipAddress), amount.low.toString(), amount.high.toString()]
|
|
9739
|
+
calldata: [chunkZFRHADHR_cjs.normalizeAddress("STARKNET", sponsorshipAddress), amount.low.toString(), amount.high.toString()]
|
|
10958
9740
|
};
|
|
10959
9741
|
const bidCall = this._contract(account, sponsorshipAddress).populate("place_bid", [
|
|
10960
9742
|
starknet.cairo.uint256(params.offerId),
|
|
@@ -11081,7 +9863,7 @@ var SponsorshipService = class {
|
|
|
11081
9863
|
// src/starknet/client.ts
|
|
11082
9864
|
var MedialaneClient = class {
|
|
11083
9865
|
constructor(rawConfig = {}) {
|
|
11084
|
-
this.config = resolveConfig(rawConfig);
|
|
9866
|
+
this.config = chunkZFRHADHR_cjs.resolveConfig(rawConfig);
|
|
11085
9867
|
this.services = {
|
|
11086
9868
|
pop: new PopService(this.config),
|
|
11087
9869
|
drop: new DropService(this.config),
|
|
@@ -11092,9 +9874,9 @@ var MedialaneClient = class {
|
|
|
11092
9874
|
sponsorship: new SponsorshipService(this.config)
|
|
11093
9875
|
};
|
|
11094
9876
|
if (!this.config.backendUrl) {
|
|
11095
|
-
const sentinel = new ApiClient("https://medialane-sdk-no-backend.invalid", this.config.apiKey);
|
|
9877
|
+
const sentinel = new chunkZFRHADHR_cjs.ApiClient("https://medialane-sdk-no-backend.invalid", this.config.apiKey);
|
|
11096
9878
|
const apiMethodNames = new Set(
|
|
11097
|
-
Object.getOwnPropertyNames(ApiClient.prototype).filter(
|
|
9879
|
+
Object.getOwnPropertyNames(chunkZFRHADHR_cjs.ApiClient.prototype).filter(
|
|
11098
9880
|
(k) => k !== "constructor" && typeof sentinel[k] === "function"
|
|
11099
9881
|
)
|
|
11100
9882
|
);
|
|
@@ -11111,7 +9893,7 @@ var MedialaneClient = class {
|
|
|
11111
9893
|
}
|
|
11112
9894
|
});
|
|
11113
9895
|
} else {
|
|
11114
|
-
this.api = new ApiClient(this.config.backendUrl, this.config.apiKey, this.config.retryOptions, this.config.chain);
|
|
9896
|
+
this.api = new chunkZFRHADHR_cjs.ApiClient(this.config.backendUrl, this.config.apiKey, this.config.retryOptions, this.config.chain);
|
|
11115
9897
|
}
|
|
11116
9898
|
}
|
|
11117
9899
|
get chain() {
|
|
@@ -11166,25 +9948,6 @@ async function getCounter1155(address, config) {
|
|
|
11166
9948
|
const contract = getContract(config);
|
|
11167
9949
|
return BigInt((await contract.get_counter(address)).toString());
|
|
11168
9950
|
}
|
|
11169
|
-
|
|
11170
|
-
// src/utils/bigint.ts
|
|
11171
|
-
function stringifyBigInts(obj) {
|
|
11172
|
-
if (typeof obj === "bigint") {
|
|
11173
|
-
return obj.toString();
|
|
11174
|
-
}
|
|
11175
|
-
if (Array.isArray(obj)) {
|
|
11176
|
-
return obj.map(stringifyBigInts);
|
|
11177
|
-
}
|
|
11178
|
-
if (obj !== null && typeof obj === "object") {
|
|
11179
|
-
return Object.fromEntries(
|
|
11180
|
-
Object.entries(obj).map(([key, value]) => [
|
|
11181
|
-
key,
|
|
11182
|
-
stringifyBigInts(value)
|
|
11183
|
-
])
|
|
11184
|
-
);
|
|
11185
|
-
}
|
|
11186
|
-
return obj;
|
|
11187
|
-
}
|
|
11188
9951
|
var STARKNET_DOMAIN = [
|
|
11189
9952
|
{ name: "name", type: "shortstring" },
|
|
11190
9953
|
{ name: "version", type: "shortstring" },
|
|
@@ -11302,7 +10065,7 @@ function buildListingOrder(i, cfg) {
|
|
|
11302
10065
|
salt: i.salt,
|
|
11303
10066
|
counter: i.counter
|
|
11304
10067
|
};
|
|
11305
|
-
const typedData = stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
|
|
10068
|
+
const typedData = chunkZFRHADHR_cjs.stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
|
|
11306
10069
|
return { orderParams, typedData };
|
|
11307
10070
|
}
|
|
11308
10071
|
function buildOfferOrder(i, cfg) {
|
|
@@ -11323,11 +10086,11 @@ function buildOfferOrder(i, cfg) {
|
|
|
11323
10086
|
salt: i.salt,
|
|
11324
10087
|
counter: i.counter
|
|
11325
10088
|
};
|
|
11326
|
-
const typedData = stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
|
|
10089
|
+
const typedData = chunkZFRHADHR_cjs.stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
|
|
11327
10090
|
return { orderParams, typedData };
|
|
11328
10091
|
}
|
|
11329
10092
|
function registerPayload(orderParams, signature) {
|
|
11330
|
-
return stringifyBigInts({
|
|
10093
|
+
return chunkZFRHADHR_cjs.stringifyBigInts({
|
|
11331
10094
|
parameters: {
|
|
11332
10095
|
...orderParams,
|
|
11333
10096
|
offer: { ...orderParams.offer, item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type) },
|
|
@@ -11358,14 +10121,14 @@ function buildFulfillCalls(a, cfg) {
|
|
|
11358
10121
|
return fee ? [approve, fulfill, fee] : [approve, fulfill];
|
|
11359
10122
|
}
|
|
11360
10123
|
function buildCancelCalls(a, cfg) {
|
|
11361
|
-
const cancelRequest = stringifyBigInts({
|
|
10124
|
+
const cancelRequest = chunkZFRHADHR_cjs.stringifyBigInts({
|
|
11362
10125
|
cancelation: { order_hash: a.orderHash, offerer: a.offerer },
|
|
11363
10126
|
signature: a.signature
|
|
11364
10127
|
});
|
|
11365
10128
|
return [contractFor(cfg).populate("cancel_order", [cancelRequest])];
|
|
11366
10129
|
}
|
|
11367
10130
|
function buildCancelTypedData(orderHash, offerer, cfg) {
|
|
11368
|
-
return stringifyBigInts(buildCancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg)));
|
|
10131
|
+
return chunkZFRHADHR_cjs.stringifyBigInts(buildCancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg)));
|
|
11369
10132
|
}
|
|
11370
10133
|
function contractFor2(cfg) {
|
|
11371
10134
|
return newContract(Medialane1155ABI, cfg.marketplace1155Contract, getProvider(cfg));
|
|
@@ -11388,7 +10151,7 @@ function buildListing1155Order(i, cfg) {
|
|
|
11388
10151
|
salt: i.salt,
|
|
11389
10152
|
counter: i.counter
|
|
11390
10153
|
};
|
|
11391
|
-
const typedData = stringifyBigInts(
|
|
10154
|
+
const typedData = chunkZFRHADHR_cjs.stringifyBigInts(
|
|
11392
10155
|
build1155OrderTypedData(orderParams, getChainId(cfg))
|
|
11393
10156
|
);
|
|
11394
10157
|
return { orderParams, typedData };
|
|
@@ -11411,13 +10174,13 @@ function buildOffer1155Order(i, cfg) {
|
|
|
11411
10174
|
salt: i.salt,
|
|
11412
10175
|
counter: i.counter
|
|
11413
10176
|
};
|
|
11414
|
-
const typedData = stringifyBigInts(
|
|
10177
|
+
const typedData = chunkZFRHADHR_cjs.stringifyBigInts(
|
|
11415
10178
|
build1155OrderTypedData(orderParams, getChainId(cfg))
|
|
11416
10179
|
);
|
|
11417
10180
|
return { orderParams, typedData };
|
|
11418
10181
|
}
|
|
11419
10182
|
function registerPayload2(orderParams, signature) {
|
|
11420
|
-
return stringifyBigInts({
|
|
10183
|
+
return chunkZFRHADHR_cjs.stringifyBigInts({
|
|
11421
10184
|
parameters: {
|
|
11422
10185
|
...orderParams,
|
|
11423
10186
|
offer: { ...orderParams.offer, item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type) },
|
|
@@ -11448,14 +10211,14 @@ function buildFulfill1155Calls(a, cfg) {
|
|
|
11448
10211
|
return fee ? [approve, fulfill, fee] : [approve, fulfill];
|
|
11449
10212
|
}
|
|
11450
10213
|
function buildCancel1155Calls(a, cfg) {
|
|
11451
|
-
const cancelPayload = stringifyBigInts({
|
|
10214
|
+
const cancelPayload = chunkZFRHADHR_cjs.stringifyBigInts({
|
|
11452
10215
|
cancelation: { order_hash: a.orderHash, offerer: a.offerer },
|
|
11453
10216
|
signature: a.signature
|
|
11454
10217
|
});
|
|
11455
10218
|
return [contractFor2(cfg).populate("cancel_order", [cancelPayload])];
|
|
11456
10219
|
}
|
|
11457
10220
|
function buildCancel1155TypedData(orderHash, offerer, cfg) {
|
|
11458
|
-
return stringifyBigInts(
|
|
10221
|
+
return chunkZFRHADHR_cjs.stringifyBigInts(
|
|
11459
10222
|
build1155CancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg))
|
|
11460
10223
|
);
|
|
11461
10224
|
}
|
|
@@ -11616,135 +10379,6 @@ var StarknetVenue = class {
|
|
|
11616
10379
|
}
|
|
11617
10380
|
};
|
|
11618
10381
|
|
|
11619
|
-
// src/starknet/admin-auth/types.ts
|
|
11620
|
-
var ADMIN_SCOPE = "admin-api";
|
|
11621
|
-
function adminRequestDigest(req) {
|
|
11622
|
-
return starknet.hash.computePoseidonHashOnElements([
|
|
11623
|
-
starknet.hash.starknetKeccak(req.method.toUpperCase()),
|
|
11624
|
-
starknet.hash.starknetKeccak(req.path),
|
|
11625
|
-
starknet.hash.starknetKeccak(req.body ?? ""),
|
|
11626
|
-
starknet.num.toBigInt(req.nonce),
|
|
11627
|
-
BigInt(req.ts)
|
|
11628
|
-
]);
|
|
11629
|
-
}
|
|
11630
|
-
function signAdminRequest(sessionPrivateKey, req) {
|
|
11631
|
-
const digest = adminRequestDigest(req);
|
|
11632
|
-
return starknet.ec.starkCurve.sign(digest, sessionPrivateKey).toCompactHex();
|
|
11633
|
-
}
|
|
11634
|
-
function verifyAdminRequestSig(sessionPublicKey, req, sig) {
|
|
11635
|
-
try {
|
|
11636
|
-
return starknet.ec.starkCurve.verify(sig, adminRequestDigest(req), sessionPublicKey);
|
|
11637
|
-
} catch {
|
|
11638
|
-
return false;
|
|
11639
|
-
}
|
|
11640
|
-
}
|
|
11641
|
-
function buildAdminSessionTypedData(p) {
|
|
11642
|
-
return {
|
|
11643
|
-
types: {
|
|
11644
|
-
StarknetDomain: [
|
|
11645
|
-
{ name: "name", type: "shortstring" },
|
|
11646
|
-
{ name: "version", type: "shortstring" },
|
|
11647
|
-
{ name: "chainId", type: "shortstring" },
|
|
11648
|
-
{ name: "revision", type: "shortstring" }
|
|
11649
|
-
],
|
|
11650
|
-
AdminSession: [
|
|
11651
|
-
{ name: "sessionKeyHash", type: "felt" },
|
|
11652
|
-
{ name: "scope", type: "shortstring" },
|
|
11653
|
-
{ name: "issuedAt", type: "felt" },
|
|
11654
|
-
{ name: "expiresAt", type: "felt" }
|
|
11655
|
-
]
|
|
11656
|
-
},
|
|
11657
|
-
primaryType: "AdminSession",
|
|
11658
|
-
domain: { name: "Medialane Admin", version: "1", chainId: p.chainId ?? "SN_MAIN", revision: "1" },
|
|
11659
|
-
message: {
|
|
11660
|
-
sessionKeyHash: p.sessionKeyHash,
|
|
11661
|
-
scope: p.scope,
|
|
11662
|
-
issuedAt: String(p.issuedAt),
|
|
11663
|
-
expiresAt: String(p.expiresAt)
|
|
11664
|
-
}
|
|
11665
|
-
};
|
|
11666
|
-
}
|
|
11667
|
-
function sessionKeyHashOf(sessionPublicKey) {
|
|
11668
|
-
return starknet.num.toHex(starknet.hash.starknetKeccak(sessionPublicKey));
|
|
11669
|
-
}
|
|
11670
|
-
async function createAdminSessionGrant(signTypedData, opts) {
|
|
11671
|
-
const priv = starknet.ec.starkCurve.utils.randomPrivateKey();
|
|
11672
|
-
const sessionPrivateKey = "0x" + starknet.encode.buf2hex(priv);
|
|
11673
|
-
const sessionPublicKey = "0x" + starknet.encode.buf2hex(starknet.ec.starkCurve.getPublicKey(sessionPrivateKey, false));
|
|
11674
|
-
const sessionKeyHash = sessionKeyHashOf(sessionPublicKey);
|
|
11675
|
-
const nowSec = Math.floor((opts.now?.() ?? Date.now()) / 1e3);
|
|
11676
|
-
const issuedAt = nowSec;
|
|
11677
|
-
const expiresAt = nowSec + (opts.ttlSeconds ?? 7200);
|
|
11678
|
-
const data = buildAdminSessionTypedData({ sessionKeyHash, scope: ADMIN_SCOPE, issuedAt, expiresAt, chainId: opts.chainId });
|
|
11679
|
-
const walletSig = await signTypedData(data);
|
|
11680
|
-
const grant = {
|
|
11681
|
-
wallet: opts.wallet,
|
|
11682
|
-
chain: opts.chain ?? "STARKNET",
|
|
11683
|
-
sessionPublicKey,
|
|
11684
|
-
sessionKeyHash,
|
|
11685
|
-
scope: ADMIN_SCOPE,
|
|
11686
|
-
issuedAt,
|
|
11687
|
-
expiresAt,
|
|
11688
|
-
walletSig
|
|
11689
|
-
};
|
|
11690
|
-
return { grant, sessionPrivateKey };
|
|
11691
|
-
}
|
|
11692
|
-
|
|
11693
|
-
// src/starknet/admin-auth/headers.ts
|
|
11694
|
-
var ADMIN_HEADERS = {
|
|
11695
|
-
grant: "x-ml-admin-grant",
|
|
11696
|
-
sig: "x-ml-admin-sig",
|
|
11697
|
-
nonce: "x-ml-admin-nonce",
|
|
11698
|
-
ts: "x-ml-admin-ts"
|
|
11699
|
-
};
|
|
11700
|
-
function b64urlEncode(s) {
|
|
11701
|
-
const bytes = new TextEncoder().encode(s);
|
|
11702
|
-
let bin = "";
|
|
11703
|
-
for (const b of bytes) bin += String.fromCharCode(b);
|
|
11704
|
-
return btoa(bin).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
11705
|
-
}
|
|
11706
|
-
function b64urlDecode(s) {
|
|
11707
|
-
const pad = s.length % 4 ? "=".repeat(4 - s.length % 4) : "";
|
|
11708
|
-
const bin = atob(s.replace(/-/g, "+").replace(/_/g, "/") + pad);
|
|
11709
|
-
const bytes = Uint8Array.from(bin, (c) => c.charCodeAt(0));
|
|
11710
|
-
return new TextDecoder().decode(bytes);
|
|
11711
|
-
}
|
|
11712
|
-
function randomNonce() {
|
|
11713
|
-
const b = new Uint8Array(16);
|
|
11714
|
-
crypto.getRandomValues(b);
|
|
11715
|
-
let hex = "";
|
|
11716
|
-
for (const x of b) hex += x.toString(16).padStart(2, "0");
|
|
11717
|
-
return "0x" + hex;
|
|
11718
|
-
}
|
|
11719
|
-
function encodeAdminHeaders(session, reqInit) {
|
|
11720
|
-
const nonce = randomNonce();
|
|
11721
|
-
const ts = Math.floor((reqInit.now?.() ?? Date.now()) / 1e3);
|
|
11722
|
-
const req = { method: reqInit.method, path: reqInit.path, body: reqInit.body ?? "", nonce, ts };
|
|
11723
|
-
const sig = signAdminRequest(session.sessionPrivateKey, req);
|
|
11724
|
-
return {
|
|
11725
|
-
[ADMIN_HEADERS.grant]: b64urlEncode(JSON.stringify(session.grant)),
|
|
11726
|
-
[ADMIN_HEADERS.sig]: sig,
|
|
11727
|
-
[ADMIN_HEADERS.nonce]: nonce,
|
|
11728
|
-
[ADMIN_HEADERS.ts]: String(ts)
|
|
11729
|
-
};
|
|
11730
|
-
}
|
|
11731
|
-
function parseAdminHeaders(get) {
|
|
11732
|
-
const rawGrant = get(ADMIN_HEADERS.grant);
|
|
11733
|
-
const sig = get(ADMIN_HEADERS.sig);
|
|
11734
|
-
const nonce = get(ADMIN_HEADERS.nonce);
|
|
11735
|
-
const tsRaw = get(ADMIN_HEADERS.ts);
|
|
11736
|
-
if (!rawGrant || !sig || !nonce || !tsRaw) return null;
|
|
11737
|
-
try {
|
|
11738
|
-
const grant = JSON.parse(b64urlDecode(rawGrant));
|
|
11739
|
-
if (!grant.wallet || !grant.sessionPublicKey || !grant.sessionKeyHash || !Array.isArray(grant.walletSig) || typeof grant.expiresAt !== "number") return null;
|
|
11740
|
-
const ts = Number(tsRaw);
|
|
11741
|
-
if (!Number.isFinite(ts)) return null;
|
|
11742
|
-
return { grant, sig, nonce, ts };
|
|
11743
|
-
} catch {
|
|
11744
|
-
return null;
|
|
11745
|
-
}
|
|
11746
|
-
}
|
|
11747
|
-
|
|
11748
10382
|
// src/starknet/siws/client.ts
|
|
11749
10383
|
var STORAGE_PREFIX = "ml_siws_";
|
|
11750
10384
|
function decodeBase64url(str) {
|
|
@@ -11863,7 +10497,7 @@ function buildFundingTransferCall(instructions) {
|
|
|
11863
10497
|
async function fundWithChainTransfer(api, wallet, options) {
|
|
11864
10498
|
const step = options.onStep ?? (() => {
|
|
11865
10499
|
});
|
|
11866
|
-
const
|
|
10500
|
+
const sleep = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
11867
10501
|
const pollMs = options.pollMs ?? 3e3;
|
|
11868
10502
|
const maxPolls = options.maxPolls ?? 20;
|
|
11869
10503
|
step("creating");
|
|
@@ -11893,19 +10527,11 @@ async function fundWithChainTransfer(api, wallet, options) {
|
|
|
11893
10527
|
return { status: "SETTLED", intentId: intent.id, credited: res.data.credited };
|
|
11894
10528
|
}
|
|
11895
10529
|
reason = res.data.reason;
|
|
11896
|
-
await
|
|
10530
|
+
await sleep(pollMs);
|
|
11897
10531
|
}
|
|
11898
10532
|
return { status: "PENDING", intentId: intent.id, reason };
|
|
11899
10533
|
}
|
|
11900
10534
|
|
|
11901
|
-
// src/errors.ts
|
|
11902
|
-
var UserFacingError = class extends Error {
|
|
11903
|
-
constructor(message) {
|
|
11904
|
-
super(message);
|
|
11905
|
-
this.name = "UserFacingError";
|
|
11906
|
-
}
|
|
11907
|
-
};
|
|
11908
|
-
|
|
11909
10535
|
// src/starknet/services/executeIntent.ts
|
|
11910
10536
|
async function confirmIntentBestEffort(client, intentId, txHash) {
|
|
11911
10537
|
await client.api.confirmIntent(intentId, txHash).catch(() => {
|
|
@@ -11935,14 +10561,14 @@ async function assertTransactionSucceeded(provider, txHash, retryDelaysMs = RECE
|
|
|
11935
10561
|
const receipt = await provider.getTransactionReceipt(txHash);
|
|
11936
10562
|
const status = receipt.execution_status ?? receipt.status;
|
|
11937
10563
|
if (status === "REVERTED" || status === "REJECTED") {
|
|
11938
|
-
throw new UserFacingError("Transaction was submitted but reverted onchain. Please check your balance and try again.");
|
|
10564
|
+
throw new chunkZFRHADHR_cjs.UserFacingError("Transaction was submitted but reverted onchain. Please check your balance and try again.");
|
|
11939
10565
|
}
|
|
11940
10566
|
if (status) return receipt;
|
|
11941
10567
|
} catch (err) {
|
|
11942
10568
|
if (err instanceof Error && err.message.includes("reverted onchain")) throw err;
|
|
11943
10569
|
}
|
|
11944
10570
|
}
|
|
11945
|
-
throw new UserFacingError("Verification timed out. Check your account for the transaction status.");
|
|
10571
|
+
throw new chunkZFRHADHR_cjs.UserFacingError("Verification timed out. Check your account for the transaction status.");
|
|
11946
10572
|
}
|
|
11947
10573
|
async function executeIntent(provider, signer, client, intent, opts = {}) {
|
|
11948
10574
|
let calls;
|
|
@@ -11974,323 +10600,6 @@ async function executeIntents(provider, signer, client, intents, opts = {}) {
|
|
|
11974
10600
|
]);
|
|
11975
10601
|
return { txHash, receipt };
|
|
11976
10602
|
}
|
|
11977
|
-
|
|
11978
|
-
// src/services/registry.ts
|
|
11979
|
-
var SN2 = getStarknetCoordinates("STARKNET");
|
|
11980
|
-
var SERVICES = {
|
|
11981
|
-
"mip-erc721": {
|
|
11982
|
-
id: "mip-erc721",
|
|
11983
|
-
displayName: "IP Collection",
|
|
11984
|
-
description: "Tokenize intellectual property as a per-creator ERC-721 collection.",
|
|
11985
|
-
standard: "ERC721",
|
|
11986
|
-
provenance: "MEDIALANE",
|
|
11987
|
-
onchain: {
|
|
11988
|
-
STARKNET: {
|
|
11989
|
-
factoryAddress: SN2.collection721,
|
|
11990
|
-
startBlock: SN2.collection721StartBlock
|
|
11991
|
-
}
|
|
11992
|
-
},
|
|
11993
|
-
uiVariant: "standard",
|
|
11994
|
-
capabilities: ["list", "buy", "make_offer", "cancel", "transfer", "mint", "remix", "license"],
|
|
11995
|
-
events: [
|
|
11996
|
-
{ name: "CollectionCreated", emittedBy: "factory" }
|
|
11997
|
-
],
|
|
11998
|
-
metadataSchema: { licenseDefault: "CC BY-SA" }
|
|
11999
|
-
},
|
|
12000
|
-
"ip-erc721": {
|
|
12001
|
-
id: "ip-erc721",
|
|
12002
|
-
displayName: "Programmable IP",
|
|
12003
|
-
description: "One shared ERC-721 contract any wallet can mint into.",
|
|
12004
|
-
standard: "ERC721",
|
|
12005
|
-
provenance: "MEDIALANE",
|
|
12006
|
-
uiVariant: "standard",
|
|
12007
|
-
capabilities: ["list", "buy", "make_offer", "cancel", "transfer", "mint", "remix", "license"],
|
|
12008
|
-
metadataSchema: { licenseDefault: "CC BY-SA" }
|
|
12009
|
-
},
|
|
12010
|
-
"data-tokenization-erc721": {
|
|
12011
|
-
id: "data-tokenization-erc721",
|
|
12012
|
-
displayName: "Data Tokenization",
|
|
12013
|
-
description: "Establish verifiable ownership of your data, with licensing terms that hold up wherever it travels.",
|
|
12014
|
-
standard: "ERC721",
|
|
12015
|
-
provenance: "MEDIALANE",
|
|
12016
|
-
onchain: {
|
|
12017
|
-
STARKNET: {
|
|
12018
|
-
factoryAddress: SN2.dataTokenization721,
|
|
12019
|
-
startBlock: SN2.dataTokenization721StartBlock
|
|
12020
|
-
}
|
|
12021
|
-
},
|
|
12022
|
-
uiVariant: "standard",
|
|
12023
|
-
capabilities: ["list", "buy", "make_offer", "cancel", "transfer", "mint", "remix", "license"],
|
|
12024
|
-
events: [
|
|
12025
|
-
{ name: "CollectionCreated", emittedBy: "factory" }
|
|
12026
|
-
],
|
|
12027
|
-
metadataSchema: { licenseDefault: "CC BY-SA" }
|
|
12028
|
-
},
|
|
12029
|
-
"mip-erc1155": {
|
|
12030
|
-
id: "mip-erc1155",
|
|
12031
|
-
displayName: "NFT Editions",
|
|
12032
|
-
description: "Per-creator ERC-1155 collection; creator mints editions.",
|
|
12033
|
-
standard: "ERC1155",
|
|
12034
|
-
provenance: "MEDIALANE",
|
|
12035
|
-
onchain: {
|
|
12036
|
-
STARKNET: {
|
|
12037
|
-
factoryAddress: SN2.collection1155,
|
|
12038
|
-
classHash: SN2.collection1155ClassHash,
|
|
12039
|
-
startBlock: SN2.collection1155StartBlock
|
|
12040
|
-
}
|
|
12041
|
-
},
|
|
12042
|
-
uiVariant: "edition",
|
|
12043
|
-
capabilities: ["list", "buy", "make_offer", "cancel", "transfer", "mint", "remix", "license"],
|
|
12044
|
-
events: [
|
|
12045
|
-
{ name: "CollectionDeployed", emittedBy: "factory" }
|
|
12046
|
-
],
|
|
12047
|
-
metadataSchema: { licenseDefault: "CC BY-SA" }
|
|
12048
|
-
},
|
|
12049
|
-
"pop-protocol": {
|
|
12050
|
-
id: "pop-protocol",
|
|
12051
|
-
displayName: "POP Protocol",
|
|
12052
|
-
description: "Soulbound proof-of-presence collectibles per event.",
|
|
12053
|
-
standard: "ERC721",
|
|
12054
|
-
provenance: "MEDIALANE",
|
|
12055
|
-
onchain: {
|
|
12056
|
-
STARKNET: {
|
|
12057
|
-
factoryAddress: SN2.popFactory,
|
|
12058
|
-
classHash: SN2.popCollectionClassHash
|
|
12059
|
-
}
|
|
12060
|
-
},
|
|
12061
|
-
uiVariant: "pop",
|
|
12062
|
-
capabilities: ["claim", "mint"],
|
|
12063
|
-
events: [
|
|
12064
|
-
{ name: "CollectionCreated", emittedBy: "factory" },
|
|
12065
|
-
{ name: "AllowlistUpdated", emittedBy: "instance", poll: "slow" }
|
|
12066
|
-
],
|
|
12067
|
-
metadataSchema: { licenseDefault: "CC BY-SA" }
|
|
12068
|
-
},
|
|
12069
|
-
"certificate-emission": {
|
|
12070
|
-
id: "certificate-emission",
|
|
12071
|
-
displayName: "Certificate Emission",
|
|
12072
|
-
description: "Issue a soulbound credential to a list of recipients in one run \u2014 everyone gets a wallet and their certificate.",
|
|
12073
|
-
standard: "ERC721",
|
|
12074
|
-
provenance: "MEDIALANE",
|
|
12075
|
-
onchain: {
|
|
12076
|
-
STARKNET: {
|
|
12077
|
-
factoryAddress: SN2.popFactory,
|
|
12078
|
-
classHash: SN2.popCollectionClassHash
|
|
12079
|
-
}
|
|
12080
|
-
},
|
|
12081
|
-
uiVariant: "pop",
|
|
12082
|
-
capabilities: ["mint", "airdrop"],
|
|
12083
|
-
events: [
|
|
12084
|
-
{ name: "CollectionCreated", emittedBy: "factory" }
|
|
12085
|
-
],
|
|
12086
|
-
metadataSchema: { licenseDefault: "CC BY-SA" }
|
|
12087
|
-
},
|
|
12088
|
-
"drop-collection": {
|
|
12089
|
-
id: "drop-collection",
|
|
12090
|
-
displayName: "Collection Drop",
|
|
12091
|
-
description: "Sequential mint with claim windows + allowlist.",
|
|
12092
|
-
standard: "ERC721",
|
|
12093
|
-
provenance: "MEDIALANE",
|
|
12094
|
-
onchain: {
|
|
12095
|
-
STARKNET: {
|
|
12096
|
-
factoryAddress: SN2.dropFactory,
|
|
12097
|
-
classHash: SN2.dropCollectionClassHash
|
|
12098
|
-
}
|
|
12099
|
-
},
|
|
12100
|
-
uiVariant: "drop",
|
|
12101
|
-
capabilities: ["claim", "list", "buy", "make_offer", "cancel", "transfer"],
|
|
12102
|
-
events: [
|
|
12103
|
-
{ name: "DropCreated", emittedBy: "factory" },
|
|
12104
|
-
{ name: "AllowlistUpdated", emittedBy: "instance", poll: "slow" }
|
|
12105
|
-
],
|
|
12106
|
-
metadataSchema: { licenseDefault: "CC BY-SA" }
|
|
12107
|
-
},
|
|
12108
|
-
"ip-tickets": {
|
|
12109
|
-
id: "ip-tickets",
|
|
12110
|
-
displayName: "IP Tickets",
|
|
12111
|
-
description: "Create verifiable on-chain tickets \u2014 mint to attendees, trade like any collection.",
|
|
12112
|
-
standard: "ERC1155",
|
|
12113
|
-
provenance: "MEDIALANE",
|
|
12114
|
-
onchain: {
|
|
12115
|
-
STARKNET: {
|
|
12116
|
-
factoryAddress: SN2.ipTicketsFactory,
|
|
12117
|
-
classHash: SN2.ipTicketCollectionClassHash
|
|
12118
|
-
}
|
|
12119
|
-
},
|
|
12120
|
-
uiVariant: "ticket",
|
|
12121
|
-
capabilities: ["mint", "redeem", "list", "buy", "make_offer", "cancel", "transfer"],
|
|
12122
|
-
events: [
|
|
12123
|
-
{ name: "CollectionDeployed", emittedBy: "factory" },
|
|
12124
|
-
{ name: "TicketCreated", emittedBy: "instance" }
|
|
12125
|
-
],
|
|
12126
|
-
metadataSchema: { licenseDefault: "CC BY-SA" }
|
|
12127
|
-
},
|
|
12128
|
-
"ip-ticketing": {
|
|
12129
|
-
id: "ip-ticketing",
|
|
12130
|
-
displayName: "IP Ticketing",
|
|
12131
|
-
description: "Distribute verifiable on-chain tickets to a list of recipients in one run \u2014 everyone gets a wallet and their ticket.",
|
|
12132
|
-
standard: "ERC1155",
|
|
12133
|
-
provenance: "MEDIALANE",
|
|
12134
|
-
onchain: {
|
|
12135
|
-
STARKNET: {
|
|
12136
|
-
factoryAddress: SN2.ipTicketsFactory,
|
|
12137
|
-
classHash: SN2.ipTicketCollectionClassHash
|
|
12138
|
-
}
|
|
12139
|
-
},
|
|
12140
|
-
uiVariant: "ticket",
|
|
12141
|
-
capabilities: ["mint", "airdrop", "redeem", "list", "buy", "make_offer", "cancel", "transfer"],
|
|
12142
|
-
events: [
|
|
12143
|
-
{ name: "CollectionDeployed", emittedBy: "factory" },
|
|
12144
|
-
{ name: "TicketCreated", emittedBy: "instance" }
|
|
12145
|
-
],
|
|
12146
|
-
metadataSchema: { licenseDefault: "CC BY-SA" }
|
|
12147
|
-
},
|
|
12148
|
-
"ip-club": {
|
|
12149
|
-
id: "ip-club",
|
|
12150
|
-
displayName: "IP Club",
|
|
12151
|
-
description: "Membership clubs \u2014 create tiers, mint membership cards, trade like any collection.",
|
|
12152
|
-
standard: "ERC1155",
|
|
12153
|
-
provenance: "MEDIALANE",
|
|
12154
|
-
onchain: {
|
|
12155
|
-
STARKNET: {
|
|
12156
|
-
factoryAddress: SN2.ipClubFactory,
|
|
12157
|
-
classHash: SN2.ipClubCollectionClassHash
|
|
12158
|
-
}
|
|
12159
|
-
},
|
|
12160
|
-
uiVariant: "club",
|
|
12161
|
-
capabilities: ["mint", "list", "buy", "make_offer", "cancel", "transfer"],
|
|
12162
|
-
events: [
|
|
12163
|
-
{ name: "ClubDeployed", emittedBy: "factory" },
|
|
12164
|
-
{ name: "MembershipCreated", emittedBy: "instance" }
|
|
12165
|
-
],
|
|
12166
|
-
metadataSchema: { licenseDefault: "CC BY-SA" }
|
|
12167
|
-
},
|
|
12168
|
-
"ip-sponsorship": {
|
|
12169
|
-
id: "ip-sponsorship",
|
|
12170
|
-
displayName: "IP Sponsorship",
|
|
12171
|
-
description: "Sponsorship offers and licenses anchored to an existing Medialane asset.",
|
|
12172
|
-
standard: "ERC721",
|
|
12173
|
-
provenance: "MEDIALANE",
|
|
12174
|
-
onchain: {
|
|
12175
|
-
STARKNET: {
|
|
12176
|
-
factoryAddress: SN2.ipSponsorship,
|
|
12177
|
-
classHash: SN2.ipSponsorshipClassHash,
|
|
12178
|
-
startBlock: SN2.ipSponsorshipStartBlock
|
|
12179
|
-
}
|
|
12180
|
-
},
|
|
12181
|
-
uiVariant: "standard",
|
|
12182
|
-
capabilities: ["sponsor", "transfer"],
|
|
12183
|
-
events: [
|
|
12184
|
-
{ name: "OfferCreated", emittedBy: "factory" },
|
|
12185
|
-
{ name: "ProposalCreated", emittedBy: "factory" },
|
|
12186
|
-
{ name: "LicenseMinted", emittedBy: "factory" }
|
|
12187
|
-
],
|
|
12188
|
-
metadataSchema: { licenseDefault: "CC BY-SA" }
|
|
12189
|
-
},
|
|
12190
|
-
"creator-coin": {
|
|
12191
|
-
id: "creator-coin",
|
|
12192
|
-
displayName: "Creator Coin",
|
|
12193
|
-
description: "Launch a fixed-supply social token with permanently-locked Ekubo liquidity.",
|
|
12194
|
-
standard: "ERC20",
|
|
12195
|
-
provenance: "MEDIALANE",
|
|
12196
|
-
onchain: {
|
|
12197
|
-
STARKNET: {
|
|
12198
|
-
factoryAddress: SN2.creatorCoinFactory,
|
|
12199
|
-
classHash: SN2.creatorCoinFactoryClassHash,
|
|
12200
|
-
startBlock: SN2.creatorCoinStartBlock
|
|
12201
|
-
}
|
|
12202
|
-
},
|
|
12203
|
-
uiVariant: "coin",
|
|
12204
|
-
capabilities: ["launch", "swap", "transfer"],
|
|
12205
|
-
events: [
|
|
12206
|
-
{ name: "CreatorCoinCreated", emittedBy: "factory" },
|
|
12207
|
-
{ name: "CreatorCoinLaunched", emittedBy: "factory" }
|
|
12208
|
-
]
|
|
12209
|
-
},
|
|
12210
|
-
"medialane-marketplace-erc721": {
|
|
12211
|
-
id: "medialane-marketplace-erc721",
|
|
12212
|
-
displayName: "Medialane Marketplace (ERC-721)",
|
|
12213
|
-
description: "ERC-721 order matching venue.",
|
|
12214
|
-
standard: "ERC721",
|
|
12215
|
-
provenance: "MEDIALANE",
|
|
12216
|
-
onchain: {
|
|
12217
|
-
STARKNET: {
|
|
12218
|
-
factoryAddress: SN2.marketplace721,
|
|
12219
|
-
classHash: SN2.marketplace721ClassHash,
|
|
12220
|
-
startBlock: SN2.marketplace721StartBlock
|
|
12221
|
-
}
|
|
12222
|
-
},
|
|
12223
|
-
uiVariant: "standard",
|
|
12224
|
-
capabilities: ["list", "buy", "make_offer", "cancel"],
|
|
12225
|
-
events: [
|
|
12226
|
-
{ name: "OrderCreated", emittedBy: "factory" },
|
|
12227
|
-
{ name: "OrderFulfilled", emittedBy: "factory" },
|
|
12228
|
-
{ name: "OrderCancelled", emittedBy: "factory" }
|
|
12229
|
-
]
|
|
12230
|
-
},
|
|
12231
|
-
"medialane-marketplace-erc1155": {
|
|
12232
|
-
id: "medialane-marketplace-erc1155",
|
|
12233
|
-
displayName: "Medialane Marketplace (ERC-1155)",
|
|
12234
|
-
description: "ERC-1155 order matching venue.",
|
|
12235
|
-
standard: "ERC1155",
|
|
12236
|
-
provenance: "MEDIALANE",
|
|
12237
|
-
onchain: {
|
|
12238
|
-
STARKNET: {
|
|
12239
|
-
factoryAddress: SN2.marketplace1155,
|
|
12240
|
-
classHash: SN2.marketplace1155ClassHash,
|
|
12241
|
-
startBlock: SN2.marketplace1155StartBlock
|
|
12242
|
-
}
|
|
12243
|
-
},
|
|
12244
|
-
uiVariant: "edition",
|
|
12245
|
-
capabilities: ["list", "buy", "make_offer", "cancel"],
|
|
12246
|
-
events: [
|
|
12247
|
-
{ name: "OrderCreated", emittedBy: "factory" },
|
|
12248
|
-
{ name: "OrderFulfilled", emittedBy: "factory" },
|
|
12249
|
-
{ name: "OrderCancelled", emittedBy: "factory" }
|
|
12250
|
-
]
|
|
12251
|
-
},
|
|
12252
|
-
"unruggable-erc20": {
|
|
12253
|
-
id: "unruggable-erc20",
|
|
12254
|
-
displayName: "Unruggable",
|
|
12255
|
-
description: "An ERC-20 launched through the unruggable.meme protocol, the same contract Medialane's Creator Coin is forked from. Not deployed via a Medialane service, but exposes the same on-chain guarantees: capped team allocation, permanently locked liquidity, fixed supply. Brought in by owner claim or admin/partnership \u2014 never bulk-indexed.",
|
|
12256
|
-
standard: "ERC20",
|
|
12257
|
-
provenance: "EXTERNAL",
|
|
12258
|
-
uiVariant: "coin",
|
|
12259
|
-
capabilities: ["swap", "transfer"]
|
|
12260
|
-
},
|
|
12261
|
-
"external-erc20": {
|
|
12262
|
-
id: "external-erc20",
|
|
12263
|
-
displayName: "Memecoin",
|
|
12264
|
-
description: "A plain ERC-20 not deployed via a Medialane service and carrying no protocol-level guarantees. Brought in by owner claim or admin/partnership \u2014 never bulk-indexed. Generalizes to future chains.",
|
|
12265
|
-
standard: "ERC20",
|
|
12266
|
-
provenance: "EXTERNAL",
|
|
12267
|
-
uiVariant: "coin",
|
|
12268
|
-
capabilities: ["swap", "transfer"]
|
|
12269
|
-
},
|
|
12270
|
-
"external-erc721": {
|
|
12271
|
-
id: "external-erc721",
|
|
12272
|
-
displayName: "External ERC-721",
|
|
12273
|
-
description: "ERC-721 contract not deployed via a Medialane service.",
|
|
12274
|
-
standard: "ERC721",
|
|
12275
|
-
provenance: "EXTERNAL",
|
|
12276
|
-
uiVariant: "standard",
|
|
12277
|
-
capabilities: ["list", "buy", "make_offer", "cancel", "transfer"]
|
|
12278
|
-
},
|
|
12279
|
-
"external-erc1155": {
|
|
12280
|
-
id: "external-erc1155",
|
|
12281
|
-
displayName: "External ERC-1155",
|
|
12282
|
-
description: "ERC-1155 contract not deployed via a Medialane service.",
|
|
12283
|
-
standard: "ERC1155",
|
|
12284
|
-
provenance: "EXTERNAL",
|
|
12285
|
-
uiVariant: "edition",
|
|
12286
|
-
capabilities: ["list", "buy", "make_offer", "cancel", "transfer"]
|
|
12287
|
-
}
|
|
12288
|
-
};
|
|
12289
|
-
function getService(id) {
|
|
12290
|
-
return id && id in SERVICES ? SERVICES[id] : void 0;
|
|
12291
|
-
}
|
|
12292
|
-
|
|
12293
|
-
// src/starknet/services/receipts.ts
|
|
12294
10603
|
var DEPLOY_EVENTS = {
|
|
12295
10604
|
"mip-erc1155": { event: "CollectionDeployed", address: (e) => e.keys?.[1] },
|
|
12296
10605
|
"ip-tickets": { event: "CollectionDeployed", address: (e) => e.keys?.[1] },
|
|
@@ -12312,14 +10621,14 @@ function u2562(low, high) {
|
|
|
12312
10621
|
return (BigInt(low ?? 0) + (BigInt(high ?? 0) << 128n)).toString();
|
|
12313
10622
|
}
|
|
12314
10623
|
function deployedCollectionFromReceipt(receipt, service) {
|
|
12315
|
-
const factory = getService(service)?.onchain?.STARKNET?.factoryAddress;
|
|
10624
|
+
const factory = chunkZFRHADHR_cjs.getService(service)?.onchain?.STARKNET?.factoryAddress;
|
|
12316
10625
|
const { event, address } = DEPLOY_EVENTS[service];
|
|
12317
10626
|
const selector = BigInt(starknet.hash.getSelectorFromName(event));
|
|
12318
10627
|
for (const e of receipt.events ?? []) {
|
|
12319
10628
|
if (factory && !sameFelt(e.from_address, factory)) continue;
|
|
12320
10629
|
if (!sameFelt(e.keys?.[0], selector)) continue;
|
|
12321
10630
|
const value = address(e);
|
|
12322
|
-
if (value) return normalizeAddress("STARKNET", value);
|
|
10631
|
+
if (value) return chunkZFRHADHR_cjs.normalizeAddress("STARKNET", value);
|
|
12323
10632
|
}
|
|
12324
10633
|
return null;
|
|
12325
10634
|
}
|
|
@@ -12410,17 +10719,6 @@ function deriveOwnerKeyPair(secret, recipientId) {
|
|
|
12410
10719
|
const publicKey = starknet.ec.starkCurve.getStarkKey(privateKey);
|
|
12411
10720
|
return { privateKey, publicKey };
|
|
12412
10721
|
}
|
|
12413
|
-
function ownerConstructorCalldata(ownerPubkey) {
|
|
12414
|
-
return ["0x0", starknet.num.toHex(ownerPubkey), "0x1"];
|
|
12415
|
-
}
|
|
12416
|
-
function computeAccountAddress(ownerPubkey, salt = 0) {
|
|
12417
|
-
return starknet.hash.calculateContractAddressFromHash(
|
|
12418
|
-
starknet.num.toHex(salt),
|
|
12419
|
-
STARKNET_MEDIAWALLET_CLASS_HASH,
|
|
12420
|
-
ownerConstructorCalldata(ownerPubkey),
|
|
12421
|
-
0
|
|
12422
|
-
);
|
|
12423
|
-
}
|
|
12424
10722
|
var STARKNET_SIGNER_TYPE = "0x537461726b6e6574205369676e6572";
|
|
12425
10723
|
var OPTION_NONE = "0x1";
|
|
12426
10724
|
var SIGNER_STARKNET = "0x0";
|
|
@@ -12451,13 +10749,13 @@ function buildRemoveOwnerByGuidCall(accountAddress, ownerGuid) {
|
|
|
12451
10749
|
}
|
|
12452
10750
|
function buildDeployAccountParams(ownerPubkey, salt = 0) {
|
|
12453
10751
|
return {
|
|
12454
|
-
classHash: STARKNET_MEDIAWALLET_CLASS_HASH,
|
|
12455
|
-
constructorCalldata: ownerConstructorCalldata(ownerPubkey),
|
|
10752
|
+
classHash: chunkZFRHADHR_cjs.STARKNET_MEDIAWALLET_CLASS_HASH,
|
|
10753
|
+
constructorCalldata: chunkZFRHADHR_cjs.ownerConstructorCalldata(ownerPubkey),
|
|
12456
10754
|
addressSalt: starknet.num.toHex(salt),
|
|
12457
|
-
contractAddress: computeAccountAddress(ownerPubkey, salt)
|
|
10755
|
+
contractAddress: chunkZFRHADHR_cjs.computeAccountAddress(ownerPubkey, salt)
|
|
12458
10756
|
};
|
|
12459
10757
|
}
|
|
12460
|
-
var norm = (address) => normalizeAddress("STARKNET", address);
|
|
10758
|
+
var norm = (address) => chunkZFRHADHR_cjs.normalizeAddress("STARKNET", address);
|
|
12461
10759
|
var SIGNER_TYPE_NAMES = ["Starknet", "Secp256k1", "Secp256r1"];
|
|
12462
10760
|
function encodeFeltArray(items) {
|
|
12463
10761
|
return [starknet.num.toHex(items.length), ...items];
|
|
@@ -12543,53 +10841,6 @@ async function getEscapeSecurityPeriod(provider, address) {
|
|
|
12543
10841
|
});
|
|
12544
10842
|
return Number(res[0]);
|
|
12545
10843
|
}
|
|
12546
|
-
async function deriveAesKey(prfSecret, hkdfInfo) {
|
|
12547
|
-
const hkdf = await crypto.subtle.importKey("raw", prfSecret, "HKDF", false, ["deriveKey"]);
|
|
12548
|
-
return crypto.subtle.deriveKey(
|
|
12549
|
-
{ name: "HKDF", hash: "SHA-256", salt: new Uint8Array(0), info: hkdfInfo },
|
|
12550
|
-
hkdf,
|
|
12551
|
-
{ name: "AES-GCM", length: 256 },
|
|
12552
|
-
false,
|
|
12553
|
-
["encrypt", "decrypt"]
|
|
12554
|
-
);
|
|
12555
|
-
}
|
|
12556
|
-
function generateStarkKeyPair() {
|
|
12557
|
-
const privateKeyHex = "0x" + Array.from(starknet.ec.starkCurve.utils.randomPrivateKey()).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
12558
|
-
return { privateKeyHex, publicKeyHex: starknet.ec.starkCurve.getStarkKey(privateKeyHex) };
|
|
12559
|
-
}
|
|
12560
|
-
var InvalidStarkPrivateKeyError = class extends Error {
|
|
12561
|
-
constructor(reason) {
|
|
12562
|
-
super(`Not a valid Starknet private key: ${reason}`);
|
|
12563
|
-
this.name = "InvalidStarkPrivateKeyError";
|
|
12564
|
-
}
|
|
12565
|
-
};
|
|
12566
|
-
function starkKeyPairFromPrivateKey(input) {
|
|
12567
|
-
const trimmed = input.trim().replace(/\s+/g, "");
|
|
12568
|
-
const body = trimmed.startsWith("0x") || trimmed.startsWith("0X") ? trimmed.slice(2) : trimmed;
|
|
12569
|
-
if (body.length === 0) throw new InvalidStarkPrivateKeyError("it is empty");
|
|
12570
|
-
if (!/^[0-9a-fA-F]+$/.test(body)) throw new InvalidStarkPrivateKeyError("it is not hexadecimal");
|
|
12571
|
-
if (body.length > 64) throw new InvalidStarkPrivateKeyError("it is too long");
|
|
12572
|
-
const value = BigInt("0x" + body);
|
|
12573
|
-
if (value === 0n) throw new InvalidStarkPrivateKeyError("it is zero");
|
|
12574
|
-
if (value >= starknet.ec.starkCurve.CURVE.n) throw new InvalidStarkPrivateKeyError("it is outside the curve order");
|
|
12575
|
-
const privateKeyHex = "0x" + value.toString(16).padStart(64, "0");
|
|
12576
|
-
return { privateKeyHex, publicKeyHex: starknet.ec.starkCurve.getStarkKey(privateKeyHex) };
|
|
12577
|
-
}
|
|
12578
|
-
async function sealPrivateKey(aesKey, iv, privateKeyHex) {
|
|
12579
|
-
return crypto.subtle.encrypt(
|
|
12580
|
-
{ name: "AES-GCM", iv },
|
|
12581
|
-
aesKey,
|
|
12582
|
-
new TextEncoder().encode(privateKeyHex)
|
|
12583
|
-
);
|
|
12584
|
-
}
|
|
12585
|
-
async function unsealPrivateKey(aesKey, iv, ciphertext) {
|
|
12586
|
-
const buf = await crypto.subtle.decrypt({ name: "AES-GCM", iv }, aesKey, ciphertext);
|
|
12587
|
-
return new TextDecoder().decode(buf);
|
|
12588
|
-
}
|
|
12589
|
-
function signWithPrivateKey(privateKeyHex, msgHash) {
|
|
12590
|
-
const sig = starknet.ec.starkCurve.sign(msgHash, privateKeyHex);
|
|
12591
|
-
return [starknet.num.toHex(sig.r), starknet.num.toHex(sig.s)];
|
|
12592
|
-
}
|
|
12593
10844
|
|
|
12594
10845
|
// src/wallet/store.ts
|
|
12595
10846
|
function createOwnerStore(config) {
|
|
@@ -12697,7 +10948,7 @@ var InvalidRecoveryKeyError = class extends Error {
|
|
|
12697
10948
|
var canonicalAddress = (address) => `0x${BigInt(address).toString(16).padStart(64, "0")}`;
|
|
12698
10949
|
function keyPair(privateKey) {
|
|
12699
10950
|
try {
|
|
12700
|
-
return starkKeyPairFromPrivateKey(privateKey);
|
|
10951
|
+
return chunkZFRHADHR_cjs.starkKeyPairFromPrivateKey(privateKey);
|
|
12701
10952
|
} catch {
|
|
12702
10953
|
throw new InvalidRecoveryKeyError();
|
|
12703
10954
|
}
|
|
@@ -12710,7 +10961,7 @@ function parseRecoveryKey(input) {
|
|
|
12710
10961
|
const trimmed = input.trim();
|
|
12711
10962
|
if (!trimmed.startsWith(PREFIX)) {
|
|
12712
10963
|
const { privateKeyHex, publicKeyHex } = keyPair(trimmed);
|
|
12713
|
-
return { walletAddress: computeAccountAddress(publicKeyHex, 0), privateKey: privateKeyHex };
|
|
10964
|
+
return { walletAddress: chunkZFRHADHR_cjs.computeAccountAddress(publicKeyHex, 0), privateKey: privateKeyHex };
|
|
12714
10965
|
}
|
|
12715
10966
|
const parts = trimmed.slice(PREFIX.length).split(":");
|
|
12716
10967
|
const [walletAddress, privateKey] = parts;
|
|
@@ -12732,7 +10983,7 @@ function describeRecoveryAction(escape) {
|
|
|
12732
10983
|
return "none";
|
|
12733
10984
|
}
|
|
12734
10985
|
function normalizeWalletAddress(address) {
|
|
12735
|
-
return normalizeAddress("STARKNET", address);
|
|
10986
|
+
return chunkZFRHADHR_cjs.normalizeAddress("STARKNET", address);
|
|
12736
10987
|
}
|
|
12737
10988
|
function isValidStarknetAddress(address) {
|
|
12738
10989
|
try {
|
|
@@ -12767,150 +11018,6 @@ function createSelfFundConsent(estimateFee) {
|
|
|
12767
11018
|
}
|
|
12768
11019
|
};
|
|
12769
11020
|
}
|
|
12770
|
-
|
|
12771
|
-
// src/wallet/passkey.ts
|
|
12772
|
-
var PasskeyCancelledError = class extends Error {
|
|
12773
|
-
constructor(message = "Passkey prompt was cancelled.") {
|
|
12774
|
-
super(message);
|
|
12775
|
-
this.name = "PasskeyCancelledError";
|
|
12776
|
-
}
|
|
12777
|
-
};
|
|
12778
|
-
var encodeBase64 = (buf) => {
|
|
12779
|
-
const bytes = buf instanceof Uint8Array ? buf : new Uint8Array(buf);
|
|
12780
|
-
let binary = "";
|
|
12781
|
-
for (const byte of bytes) binary += String.fromCharCode(byte);
|
|
12782
|
-
return btoa(binary);
|
|
12783
|
-
};
|
|
12784
|
-
var decodeBase64 = (value) => {
|
|
12785
|
-
const binary = atob(value);
|
|
12786
|
-
const bytes = new Uint8Array(binary.length);
|
|
12787
|
-
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
12788
|
-
return bytes;
|
|
12789
|
-
};
|
|
12790
|
-
function isPasskeyCancellation(err) {
|
|
12791
|
-
const name = err?.name;
|
|
12792
|
-
return name === "NotAllowedError" || name === "AbortError";
|
|
12793
|
-
}
|
|
12794
|
-
function createPasskeyOwner(config) {
|
|
12795
|
-
const randomBytes = config.randomBytes ?? ((length) => crypto.getRandomValues(new Uint8Array(length)));
|
|
12796
|
-
const credentialsApi = () => {
|
|
12797
|
-
const api = config.credentials ?? (typeof navigator === "undefined" ? void 0 : navigator.credentials);
|
|
12798
|
-
if (!api) throw new Error("Passkeys are only available in a browser.");
|
|
12799
|
-
return api;
|
|
12800
|
-
};
|
|
12801
|
-
const prfUnsupportedMessage = () => {
|
|
12802
|
-
const isBrave = typeof navigator !== "undefined" && "brave" in navigator;
|
|
12803
|
-
const cause = isBrave ? "Brave doesn't currently support the WebAuthn PRF extension." : "This browser didn't return a passkey PRF secret.";
|
|
12804
|
-
return `${cause} ${config.appName} needs it to seal your key. Your device passkey (Touch ID) is fine, the limitation is the browser. Please open this in Safari or Chrome on an up-to-date OS.`;
|
|
12805
|
-
};
|
|
12806
|
-
async function registerPasskey() {
|
|
12807
|
-
let credential;
|
|
12808
|
-
try {
|
|
12809
|
-
credential = await credentialsApi().create({
|
|
12810
|
-
publicKey: {
|
|
12811
|
-
challenge: randomBytes(32),
|
|
12812
|
-
rp: { name: config.relyingPartyName, id: config.relyingPartyId() },
|
|
12813
|
-
user: await config.passkeyUser(),
|
|
12814
|
-
excludeCredentials: config.knownCredentials(),
|
|
12815
|
-
pubKeyCredParams: [
|
|
12816
|
-
{ type: "public-key", alg: -7 },
|
|
12817
|
-
{ type: "public-key", alg: -257 }
|
|
12818
|
-
],
|
|
12819
|
-
authenticatorSelection: {
|
|
12820
|
-
residentKey: "required",
|
|
12821
|
-
userVerification: "required",
|
|
12822
|
-
authenticatorAttachment: "platform"
|
|
12823
|
-
},
|
|
12824
|
-
extensions: { prf: { eval: { first: config.prfSalt } } }
|
|
12825
|
-
}
|
|
12826
|
-
});
|
|
12827
|
-
} catch (err) {
|
|
12828
|
-
if (isPasskeyCancellation(err)) throw new PasskeyCancelledError();
|
|
12829
|
-
throw err;
|
|
12830
|
-
}
|
|
12831
|
-
const prf = credential.getClientExtensionResults().prf;
|
|
12832
|
-
return { credentialId: encodeBase64(credential.rawId), prfFirst: prf?.results?.first ?? null };
|
|
12833
|
-
}
|
|
12834
|
-
async function prfSecret(credentialId) {
|
|
12835
|
-
let assertion;
|
|
12836
|
-
try {
|
|
12837
|
-
assertion = await credentialsApi().get({
|
|
12838
|
-
publicKey: {
|
|
12839
|
-
challenge: randomBytes(32),
|
|
12840
|
-
rpId: config.relyingPartyId(),
|
|
12841
|
-
allowCredentials: [{ type: "public-key", id: decodeBase64(credentialId) }],
|
|
12842
|
-
userVerification: "required",
|
|
12843
|
-
extensions: { prf: { eval: { first: config.prfSalt } } }
|
|
12844
|
-
}
|
|
12845
|
-
});
|
|
12846
|
-
} catch (err) {
|
|
12847
|
-
if (isPasskeyCancellation(err)) throw new PasskeyCancelledError();
|
|
12848
|
-
throw err;
|
|
12849
|
-
}
|
|
12850
|
-
const result = assertion.getClientExtensionResults().prf?.results?.first;
|
|
12851
|
-
if (!result) throw new Error("Passkey PRF unavailable on this device/browser.");
|
|
12852
|
-
return new Uint8Array(result);
|
|
12853
|
-
}
|
|
12854
|
-
async function secretFromRegistration(registration) {
|
|
12855
|
-
if (registration.prfFirst) return new Uint8Array(registration.prfFirst);
|
|
12856
|
-
try {
|
|
12857
|
-
return await prfSecret(registration.credentialId);
|
|
12858
|
-
} catch {
|
|
12859
|
-
throw new Error(prfUnsupportedMessage());
|
|
12860
|
-
}
|
|
12861
|
-
}
|
|
12862
|
-
async function seal(secret, privateKeyHex) {
|
|
12863
|
-
const aes = await deriveAesKey(secret, config.hkdfInfo);
|
|
12864
|
-
const iv = randomBytes(12);
|
|
12865
|
-
const ciphertext = await sealPrivateKey(aes, iv, privateKeyHex);
|
|
12866
|
-
return { iv: encodeBase64(iv), ciphertext: encodeBase64(ciphertext) };
|
|
12867
|
-
}
|
|
12868
|
-
return {
|
|
12869
|
-
async createOwnerKey() {
|
|
12870
|
-
const registration = await registerPasskey();
|
|
12871
|
-
const secret = await secretFromRegistration(registration);
|
|
12872
|
-
const { privateKeyHex, publicKeyHex } = generateStarkKeyPair();
|
|
12873
|
-
const { iv, ciphertext } = await seal(secret, privateKeyHex);
|
|
12874
|
-
return {
|
|
12875
|
-
sealed: {
|
|
12876
|
-
credentialId: registration.credentialId,
|
|
12877
|
-
ownerPubKey: publicKeyHex,
|
|
12878
|
-
address: computeAccountAddress(publicKeyHex, 0),
|
|
12879
|
-
iv,
|
|
12880
|
-
ciphertext
|
|
12881
|
-
},
|
|
12882
|
-
privateKeyHex
|
|
12883
|
-
};
|
|
12884
|
-
},
|
|
12885
|
-
async unlockOwnerKey(sealed) {
|
|
12886
|
-
const secret = await prfSecret(sealed.credentialId);
|
|
12887
|
-
const aes = await deriveAesKey(secret, config.hkdfInfo);
|
|
12888
|
-
return unsealPrivateKey(aes, decodeBase64(sealed.iv), decodeBase64(sealed.ciphertext));
|
|
12889
|
-
},
|
|
12890
|
-
async sealImportedOwnerKey(recovery) {
|
|
12891
|
-
const { privateKeyHex, publicKeyHex } = starkKeyPairFromPrivateKey(recovery.privateKey);
|
|
12892
|
-
const registration = await registerPasskey();
|
|
12893
|
-
const secret = await secretFromRegistration(registration);
|
|
12894
|
-
const { iv, ciphertext } = await seal(secret, privateKeyHex);
|
|
12895
|
-
return {
|
|
12896
|
-
credentialId: registration.credentialId,
|
|
12897
|
-
ownerPubKey: publicKeyHex,
|
|
12898
|
-
address: recovery.walletAddress,
|
|
12899
|
-
iv,
|
|
12900
|
-
ciphertext
|
|
12901
|
-
};
|
|
12902
|
-
}
|
|
12903
|
-
};
|
|
12904
|
-
}
|
|
12905
|
-
|
|
12906
|
-
// src/utils/token.ts
|
|
12907
|
-
function getTokenBySymbol(symbol) {
|
|
12908
|
-
if (typeof symbol !== "string") return void 0;
|
|
12909
|
-
const upper = symbol.toUpperCase();
|
|
12910
|
-
return SUPPORTED_TOKENS.find((t) => t.symbol === upper);
|
|
12911
|
-
}
|
|
12912
|
-
|
|
12913
|
-
// src/wallet/executors.ts
|
|
12914
11021
|
function accountFor(provider, address, privateKeyHex) {
|
|
12915
11022
|
return new starknet.Account({ provider, address, signer: privateKeyHex, cairoVersion: "1" });
|
|
12916
11023
|
}
|
|
@@ -12921,7 +11028,7 @@ async function estimateSelfFundedFee(provider, address, calls) {
|
|
|
12921
11028
|
return { feeRaw: estimate.overall_fee, unit: estimate.unit, balanceRaw };
|
|
12922
11029
|
}
|
|
12923
11030
|
async function feeTokenBalance(provider, address, unit) {
|
|
12924
|
-
const token = getTokenBySymbol(unit === "FRI" ? "STRK" : "ETH");
|
|
11031
|
+
const token = chunkZFRHADHR_cjs.getTokenBySymbol(unit === "FRI" ? "STRK" : "ETH");
|
|
12925
11032
|
if (!token) throw new Error(`No fee token for unit ${unit}`);
|
|
12926
11033
|
const [low = "0x0", high = "0x0"] = await provider.callContract({
|
|
12927
11034
|
contractAddress: token.address,
|
|
@@ -12948,7 +11055,7 @@ function sponsoredExecutor(deps) {
|
|
|
12948
11055
|
{ proxyUrl: deps.proxyUrl, fetchImpl: deps.fetchImpl },
|
|
12949
11056
|
{
|
|
12950
11057
|
address: userAddress,
|
|
12951
|
-
signTypedData: async (data) => signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(data, userAddress))
|
|
11058
|
+
signTypedData: async (data) => chunkZFRHADHR_cjs.signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(data, userAddress))
|
|
12952
11059
|
},
|
|
12953
11060
|
calls
|
|
12954
11061
|
);
|
|
@@ -12998,7 +11105,7 @@ async function deploySponsored(input) {
|
|
|
12998
11105
|
return { transactionHash };
|
|
12999
11106
|
}
|
|
13000
11107
|
async function deploySelfFunded(input) {
|
|
13001
|
-
const classHash = getCoordinates("STARKNET").mediaWalletClassHash;
|
|
11108
|
+
const classHash = chunkOUPVVMLK_cjs.getCoordinates("STARKNET").mediaWalletClassHash;
|
|
13002
11109
|
if (!classHash) throw new Error("Media Wallet class hash is not configured");
|
|
13003
11110
|
const account = new starknet.Account({
|
|
13004
11111
|
provider: input.provider,
|
|
@@ -13008,13 +11115,13 @@ async function deploySelfFunded(input) {
|
|
|
13008
11115
|
});
|
|
13009
11116
|
const { transaction_hash } = await account.deployAccount({
|
|
13010
11117
|
classHash,
|
|
13011
|
-
constructorCalldata: ownerConstructorCalldata(input.ownerPubKey),
|
|
11118
|
+
constructorCalldata: chunkZFRHADHR_cjs.ownerConstructorCalldata(input.ownerPubKey),
|
|
13012
11119
|
addressSalt: 0,
|
|
13013
11120
|
contractAddress: input.ownerAddress
|
|
13014
11121
|
});
|
|
13015
11122
|
return { transactionHash: transaction_hash };
|
|
13016
11123
|
}
|
|
13017
|
-
async function waitUntilDeployed(provider, address, timeoutMs = 9e4,
|
|
11124
|
+
async function waitUntilDeployed(provider, address, timeoutMs = 9e4, sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))) {
|
|
13018
11125
|
const deadline = Date.now() + timeoutMs;
|
|
13019
11126
|
let wait = 1e3;
|
|
13020
11127
|
for (; ; ) {
|
|
@@ -13024,7 +11131,7 @@ async function waitUntilDeployed(provider, address, timeoutMs = 9e4, sleep2 = (m
|
|
|
13024
11131
|
"Your wallet was submitted but has not appeared on Starknet yet. Please try again in a moment."
|
|
13025
11132
|
);
|
|
13026
11133
|
}
|
|
13027
|
-
await
|
|
11134
|
+
await sleep(wait);
|
|
13028
11135
|
wait = Math.min(Math.round(wait * 1.5), 5e3);
|
|
13029
11136
|
}
|
|
13030
11137
|
}
|
|
@@ -13071,7 +11178,7 @@ async function completeDeployment(deps, onStep, options = {}) {
|
|
|
13071
11178
|
backendUrl: deps.backendUrl,
|
|
13072
11179
|
walletAddress: address,
|
|
13073
11180
|
signer: {
|
|
13074
|
-
signMessage: async (td) => signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(td, address))
|
|
11181
|
+
signMessage: async (td) => chunkZFRHADHR_cjs.signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(td, address))
|
|
13075
11182
|
}
|
|
13076
11183
|
});
|
|
13077
11184
|
deps.store.notifyChange();
|
|
@@ -13176,7 +11283,7 @@ function createMediaWallet(config) {
|
|
|
13176
11283
|
address: sealed.address,
|
|
13177
11284
|
signTypedData: async (data) => {
|
|
13178
11285
|
const privateKeyHex = await unlockOnce(sealed);
|
|
13179
|
-
return signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(data, sealed.address));
|
|
11286
|
+
return chunkZFRHADHR_cjs.signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(data, sealed.address));
|
|
13180
11287
|
},
|
|
13181
11288
|
execute: async (calls) => {
|
|
13182
11289
|
const { transactionHash } = await run(sealed, calls);
|
|
@@ -13246,8 +11353,54 @@ async function claimSessionWallet(api, walletAddress, deps) {
|
|
|
13246
11353
|
if (removeOwnerGuid) await deps.removeOwner(sealed, removeOwnerGuid);
|
|
13247
11354
|
}
|
|
13248
11355
|
|
|
13249
|
-
exports
|
|
13250
|
-
|
|
11356
|
+
Object.defineProperty(exports, "InvalidStarkPrivateKeyError", {
|
|
11357
|
+
enumerable: true,
|
|
11358
|
+
get: function () { return chunkZFRHADHR_cjs.InvalidStarkPrivateKeyError; }
|
|
11359
|
+
});
|
|
11360
|
+
Object.defineProperty(exports, "PasskeyCancelledError", {
|
|
11361
|
+
enumerable: true,
|
|
11362
|
+
get: function () { return chunkZFRHADHR_cjs.PasskeyCancelledError; }
|
|
11363
|
+
});
|
|
11364
|
+
Object.defineProperty(exports, "UserFacingError", {
|
|
11365
|
+
enumerable: true,
|
|
11366
|
+
get: function () { return chunkZFRHADHR_cjs.UserFacingError; }
|
|
11367
|
+
});
|
|
11368
|
+
Object.defineProperty(exports, "computeAccountAddress", {
|
|
11369
|
+
enumerable: true,
|
|
11370
|
+
get: function () { return chunkZFRHADHR_cjs.computeAccountAddress; }
|
|
11371
|
+
});
|
|
11372
|
+
Object.defineProperty(exports, "createPasskeyOwner", {
|
|
11373
|
+
enumerable: true,
|
|
11374
|
+
get: function () { return chunkZFRHADHR_cjs.createPasskeyOwner; }
|
|
11375
|
+
});
|
|
11376
|
+
Object.defineProperty(exports, "deriveAesKey", {
|
|
11377
|
+
enumerable: true,
|
|
11378
|
+
get: function () { return chunkZFRHADHR_cjs.deriveAesKey; }
|
|
11379
|
+
});
|
|
11380
|
+
Object.defineProperty(exports, "generateStarkKeyPair", {
|
|
11381
|
+
enumerable: true,
|
|
11382
|
+
get: function () { return chunkZFRHADHR_cjs.generateStarkKeyPair; }
|
|
11383
|
+
});
|
|
11384
|
+
Object.defineProperty(exports, "ownerConstructorCalldata", {
|
|
11385
|
+
enumerable: true,
|
|
11386
|
+
get: function () { return chunkZFRHADHR_cjs.ownerConstructorCalldata; }
|
|
11387
|
+
});
|
|
11388
|
+
Object.defineProperty(exports, "sealPrivateKey", {
|
|
11389
|
+
enumerable: true,
|
|
11390
|
+
get: function () { return chunkZFRHADHR_cjs.sealPrivateKey; }
|
|
11391
|
+
});
|
|
11392
|
+
Object.defineProperty(exports, "signWithPrivateKey", {
|
|
11393
|
+
enumerable: true,
|
|
11394
|
+
get: function () { return chunkZFRHADHR_cjs.signWithPrivateKey; }
|
|
11395
|
+
});
|
|
11396
|
+
Object.defineProperty(exports, "starkKeyPairFromPrivateKey", {
|
|
11397
|
+
enumerable: true,
|
|
11398
|
+
get: function () { return chunkZFRHADHR_cjs.starkKeyPairFromPrivateKey; }
|
|
11399
|
+
});
|
|
11400
|
+
Object.defineProperty(exports, "unsealPrivateKey", {
|
|
11401
|
+
enumerable: true,
|
|
11402
|
+
get: function () { return chunkZFRHADHR_cjs.unsealPrivateKey; }
|
|
11403
|
+
});
|
|
13251
11404
|
exports.COIN_MAX_SUPPLY = MAX_SUPPLY;
|
|
13252
11405
|
exports.COIN_MIN_SUPPLY = MIN_SUPPLY;
|
|
13253
11406
|
exports.ClubService = ClubService;
|
|
@@ -13271,7 +11424,6 @@ exports.IPTicketCollectionABI = IPTicketCollectionABI;
|
|
|
13271
11424
|
exports.IPTicketCollectionFactoryABI = IPTicketCollectionFactoryABI;
|
|
13272
11425
|
exports.InvalidPairingPayloadError = InvalidPairingPayloadError;
|
|
13273
11426
|
exports.InvalidRecoveryKeyError = InvalidRecoveryKeyError;
|
|
13274
|
-
exports.InvalidStarkPrivateKeyError = InvalidStarkPrivateKeyError;
|
|
13275
11427
|
exports.MAX_HOLDERS_AT_LAUNCH = MAX_HOLDERS_AT_LAUNCH;
|
|
13276
11428
|
exports.MAX_TEAM_ALLOCATION_PERCENT = MAX_TEAM_ALLOCATION_PERCENT;
|
|
13277
11429
|
exports.Medialane1155ABI = Medialane1155ABI;
|
|
@@ -13279,24 +11431,20 @@ exports.MedialaneClient = MedialaneClient;
|
|
|
13279
11431
|
exports.MedialaneError = MedialaneError;
|
|
13280
11432
|
exports.POPCollectionABI = POPCollectionABI;
|
|
13281
11433
|
exports.POPFactoryABI = POPFactoryABI;
|
|
13282
|
-
exports.PasskeyCancelledError = PasskeyCancelledError;
|
|
13283
11434
|
exports.PopService = PopService;
|
|
13284
11435
|
exports.SUGGESTED_DEFAULT_PRICE = SUGGESTED_DEFAULT_PRICE;
|
|
13285
11436
|
exports.SponsoredCallRejectedError = SponsoredCallRejectedError;
|
|
13286
11437
|
exports.SponsorshipService = SponsorshipService;
|
|
13287
11438
|
exports.StarknetVenue = StarknetVenue;
|
|
13288
11439
|
exports.TicketService = TicketService;
|
|
13289
|
-
exports.UserFacingError = UserFacingError;
|
|
13290
11440
|
exports.VALIDATED_EKUBO_PARAMS = VALIDATED_EKUBO_PARAMS;
|
|
13291
11441
|
exports.accountFor = accountFor;
|
|
13292
|
-
exports.adminRequestDigest = adminRequestDigest;
|
|
13293
11442
|
exports.adoptSessionWallet = adoptSessionWallet;
|
|
13294
11443
|
exports.allowsFallbackFunding = allowsFallbackFunding;
|
|
13295
11444
|
exports.assertTransactionSucceeded = assertTransactionSucceeded;
|
|
13296
11445
|
exports.build1155CancellationTypedData = build1155CancellationTypedData;
|
|
13297
11446
|
exports.build1155OrderTypedData = build1155OrderTypedData;
|
|
13298
11447
|
exports.buildAddOwnerCall = buildAddOwnerCall;
|
|
13299
|
-
exports.buildAdminSessionTypedData = buildAdminSessionTypedData;
|
|
13300
11448
|
exports.buildCancelEscapeCall = buildCancelEscapeCall;
|
|
13301
11449
|
exports.buildCancellationTypedData = buildCancellationTypedData;
|
|
13302
11450
|
exports.buildCompleteEscapeOwnerCall = buildCompleteEscapeOwnerCall;
|
|
@@ -13315,26 +11463,21 @@ exports.canRemoveDevice = canRemoveDevice;
|
|
|
13315
11463
|
exports.claimSessionWallet = claimSessionWallet;
|
|
13316
11464
|
exports.coinToRaw = toRaw;
|
|
13317
11465
|
exports.completeDeployment = completeDeployment;
|
|
13318
|
-
exports.computeAccountAddress = computeAccountAddress;
|
|
13319
11466
|
exports.computeOwnerGuid = computeOwnerGuid;
|
|
13320
11467
|
exports.confirmIntentBestEffort = confirmIntentBestEffort;
|
|
13321
|
-
exports.createAdminSessionGrant = createAdminSessionGrant;
|
|
13322
11468
|
exports.createDeploymentCoordinator = createDeploymentCoordinator;
|
|
13323
11469
|
exports.createMediaWallet = createMediaWallet;
|
|
13324
11470
|
exports.createOwnerStore = createOwnerStore;
|
|
13325
|
-
exports.createPasskeyOwner = createPasskeyOwner;
|
|
13326
11471
|
exports.createSelfFundConsent = createSelfFundConsent;
|
|
13327
11472
|
exports.decodeEscapeAndStatus = decodeEscapeAndStatus;
|
|
13328
11473
|
exports.decodeGuardiansInfo = decodeGuardiansInfo;
|
|
13329
11474
|
exports.deploySelfFunded = deploySelfFunded;
|
|
13330
11475
|
exports.deploySponsored = deploySponsored;
|
|
13331
11476
|
exports.deployedCollectionFromReceipt = deployedCollectionFromReceipt;
|
|
13332
|
-
exports.deriveAesKey = deriveAesKey;
|
|
13333
11477
|
exports.deriveOwnerKeyPair = deriveOwnerKeyPair;
|
|
13334
11478
|
exports.describeDevices = describeDevices;
|
|
13335
11479
|
exports.describeGuardianStatus = describeGuardianStatus;
|
|
13336
11480
|
exports.describeRecoveryAction = describeRecoveryAction;
|
|
13337
|
-
exports.encodeAdminHeaders = encodeAdminHeaders;
|
|
13338
11481
|
exports.encodeByteArray = encodeByteArray;
|
|
13339
11482
|
exports.encodePairingPayload = encodePairingPayload;
|
|
13340
11483
|
exports.encodeRecoveryKey = encodeRecoveryKey;
|
|
@@ -13345,7 +11488,6 @@ exports.executeSponsored = executeSponsored;
|
|
|
13345
11488
|
exports.fdvHuman = fdvHuman;
|
|
13346
11489
|
exports.fundWithChainTransfer = fundWithChainTransfer;
|
|
13347
11490
|
exports.fundingApiFor = fundingApiFor;
|
|
13348
|
-
exports.generateStarkKeyPair = generateStarkKeyPair;
|
|
13349
11491
|
exports.getCounter = getCounter;
|
|
13350
11492
|
exports.getCounter1155 = getCounter1155;
|
|
13351
11493
|
exports.getCreatorCoinGuarantees = getCreatorCoinGuarantees;
|
|
@@ -13363,32 +11505,22 @@ exports.isValidStarknetAddress = isValidStarknetAddress;
|
|
|
13363
11505
|
exports.mintedTokenIdFromReceipt = mintedTokenIdFromReceipt;
|
|
13364
11506
|
exports.normalizeSiwsSignature = normalizeSiwsSignature;
|
|
13365
11507
|
exports.normalizeWalletAddress = normalizeWalletAddress;
|
|
13366
|
-
exports.ownerConstructorCalldata = ownerConstructorCalldata;
|
|
13367
11508
|
exports.parseAccountAddress = parseAccountAddress;
|
|
13368
|
-
exports.parseAdminHeaders = parseAdminHeaders;
|
|
13369
11509
|
exports.parseCreatorCoinCreated = parseCreatorCoinCreated;
|
|
13370
11510
|
exports.parsePairingPayload = parsePairingPayload;
|
|
13371
11511
|
exports.parseRecoveryKey = parseRecoveryKey;
|
|
13372
11512
|
exports.priceToEkuboParams = priceToEkuboParams;
|
|
13373
|
-
exports.randomNonce = randomNonce;
|
|
13374
11513
|
exports.requestSiwsToken = requestSiwsToken;
|
|
13375
|
-
exports.sealPrivateKey = sealPrivateKey;
|
|
13376
11514
|
exports.selfFundedExecutor = selfFundedExecutor;
|
|
13377
|
-
exports.sessionKeyHashOf = sessionKeyHashOf;
|
|
13378
|
-
exports.signAdminRequest = signAdminRequest;
|
|
13379
|
-
exports.signWithPrivateKey = signWithPrivateKey;
|
|
13380
11515
|
exports.sponsoredExecutor = sponsoredExecutor;
|
|
13381
|
-
exports.starkKeyPairFromPrivateKey = starkKeyPairFromPrivateKey;
|
|
13382
11516
|
exports.storeSiwsToken = storeSiwsToken;
|
|
13383
11517
|
exports.syncTransactionBestEffort = syncTransactionBestEffort;
|
|
13384
11518
|
exports.teamCoinsRaw = teamCoinsRaw;
|
|
13385
11519
|
exports.toDropContractConditions = toContractConditions;
|
|
13386
|
-
exports.unsealPrivateKey = unsealPrivateKey;
|
|
13387
11520
|
exports.validateCoinName = validateName;
|
|
13388
11521
|
exports.validateCoinSupply = validateSupply;
|
|
13389
11522
|
exports.validateCoinSymbol = validateSymbol;
|
|
13390
11523
|
exports.validatePrice = validatePrice;
|
|
13391
|
-
exports.verifyAdminRequestSig = verifyAdminRequestSig;
|
|
13392
11524
|
exports.waitUntilDeployed = waitUntilDeployed;
|
|
13393
11525
|
//# sourceMappingURL=index.cjs.map
|
|
13394
11526
|
//# sourceMappingURL=index.cjs.map
|