@medialane/sdk 0.163.0 → 0.164.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/dist/{chunk-TNMG2744.cjs → chunk-HYHQH5SP.cjs} +18 -10
- package/dist/chunk-HYHQH5SP.cjs.map +1 -0
- package/dist/{chunk-3WJPE76T.js → chunk-RLBOUTCQ.js} +18 -10
- package/dist/chunk-RLBOUTCQ.js.map +1 -0
- package/dist/{errors-DM_aST08.d.ts → errors-D_dnks1i.d.ts} +31 -23
- package/dist/{errors-BqEIRoRE.d.cts → errors-nZw63PCE.d.cts} +31 -23
- package/dist/index.cjs +73 -73
- 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 +1 -1
- package/dist/index.js.map +1 -1
- package/dist/starknet/index.cjs +68 -68
- package/dist/starknet/index.d.cts +2 -2
- package/dist/starknet/index.d.ts +2 -2
- package/dist/starknet/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-3WJPE76T.js.map +0 -1
- package/dist/chunk-TNMG2744.cjs.map +0 -1
package/dist/starknet/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkHYHQH5SP_cjs = require('../chunk-HYHQH5SP.cjs');
|
|
4
4
|
var chunkH7I6TEOA_cjs = require('../chunk-H7I6TEOA.cjs');
|
|
5
5
|
var starknet = require('starknet');
|
|
6
6
|
var hkdf_js = require('@noble/hashes/hkdf.js');
|
|
@@ -33,7 +33,7 @@ function getChainId(config) {
|
|
|
33
33
|
return starknet.constants.StarknetChainId.SN_MAIN;
|
|
34
34
|
}
|
|
35
35
|
function resolveToken(currency) {
|
|
36
|
-
const token =
|
|
36
|
+
const token = chunkHYHQH5SP_cjs.SUPPORTED_TOKENS.find(
|
|
37
37
|
(t) => t.symbol === currency.toUpperCase() || t.address.toLowerCase() === currency.toLowerCase()
|
|
38
38
|
);
|
|
39
39
|
if (!token) throw new MedialaneError(`Unsupported currency: ${currency}`, "INVALID_PARAMS");
|
|
@@ -44,7 +44,7 @@ function getProvider(config) {
|
|
|
44
44
|
let p = _providerCache.get(config);
|
|
45
45
|
if (!p) {
|
|
46
46
|
const urls = [config.rpcUrl];
|
|
47
|
-
p = new starknet.RpcProvider({ nodeUrl: urls[0], baseFetch:
|
|
47
|
+
p = new starknet.RpcProvider({ nodeUrl: urls[0], baseFetch: chunkHYHQH5SP_cjs.createFailoverFetch(urls) });
|
|
48
48
|
_providerCache.set(config, p);
|
|
49
49
|
}
|
|
50
50
|
return p;
|
|
@@ -9768,7 +9768,7 @@ function merkleTree(leafHashes) {
|
|
|
9768
9768
|
};
|
|
9769
9769
|
}
|
|
9770
9770
|
function buildPopAllowlist(addresses) {
|
|
9771
|
-
const unique = [...new Set(addresses.map((a) =>
|
|
9771
|
+
const unique = [...new Set(addresses.map((a) => chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", a)))];
|
|
9772
9772
|
if (unique.length === 0) throw new Error("An allowlist needs at least one address");
|
|
9773
9773
|
const leaves = unique.map((address) => ({ address, leaf: popLeafHash(address) }));
|
|
9774
9774
|
const tree = merkleTree(leaves.map((l) => l.leaf));
|
|
@@ -9794,7 +9794,7 @@ function decodePopClaimFragment(fragment) {
|
|
|
9794
9794
|
|
|
9795
9795
|
// src/starknet/pop-claim.ts
|
|
9796
9796
|
function popClaimLinks(origin, collection, list) {
|
|
9797
|
-
const base = `${origin}${
|
|
9797
|
+
const base = `${origin}${chunkHYHQH5SP_cjs.collectionHref("STARKNET", collection)}`;
|
|
9798
9798
|
return Object.entries(list.proofs).map(([address, proof]) => ({
|
|
9799
9799
|
address,
|
|
9800
9800
|
url: `${base}${encodePopClaimFragment(proof)}`
|
|
@@ -9804,7 +9804,7 @@ function popClaimLinksCsv(links) {
|
|
|
9804
9804
|
return ["address,claim_link", ...links.map((l) => `${l.address},${l.url}`)].join("\n");
|
|
9805
9805
|
}
|
|
9806
9806
|
async function popClaimInfo(provider, collection) {
|
|
9807
|
-
const contractAddress =
|
|
9807
|
+
const contractAddress = chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", collection);
|
|
9808
9808
|
const [root, end] = await Promise.all([
|
|
9809
9809
|
provider.callContract({ contractAddress, entrypoint: "allowlist_root", calldata: [] }),
|
|
9810
9810
|
provider.callContract({ contractAddress, entrypoint: "claim_end_time", calldata: [] })
|
|
@@ -9821,7 +9821,7 @@ function popClaimState(input) {
|
|
|
9821
9821
|
if (!wallet || !verifyPopProof(info.root, wallet, proof)) return "wrong-wallet";
|
|
9822
9822
|
return "ready";
|
|
9823
9823
|
}
|
|
9824
|
-
var addr = (a) =>
|
|
9824
|
+
var addr = (a) => chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", a);
|
|
9825
9825
|
var byteArrayFelts = (s) => starknet.CallData.compile([starknet.byteArray.byteArrayFromString(s)]);
|
|
9826
9826
|
var popCalls = {
|
|
9827
9827
|
claim(collection, proof) {
|
|
@@ -9876,9 +9876,9 @@ var PopService = class {
|
|
|
9876
9876
|
};
|
|
9877
9877
|
async function popHasClaimed(provider, collection, address) {
|
|
9878
9878
|
const res = await provider.callContract({
|
|
9879
|
-
contractAddress:
|
|
9879
|
+
contractAddress: chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", collection),
|
|
9880
9880
|
entrypoint: "has_claimed",
|
|
9881
|
-
calldata: [
|
|
9881
|
+
calldata: [chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", address)]
|
|
9882
9882
|
});
|
|
9883
9883
|
return BigInt(res[0] ?? "0x0") !== 0n;
|
|
9884
9884
|
}
|
|
@@ -9912,7 +9912,7 @@ var DropService = class {
|
|
|
9912
9912
|
this.config = config;
|
|
9913
9913
|
}
|
|
9914
9914
|
_collection(address, account) {
|
|
9915
|
-
return newContract(DropCollectionABI,
|
|
9915
|
+
return newContract(DropCollectionABI, chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", address), account);
|
|
9916
9916
|
}
|
|
9917
9917
|
async claim(account, collectionAddress, quantity = 1) {
|
|
9918
9918
|
const collection = this._collection(collectionAddress, account);
|
|
@@ -9997,14 +9997,14 @@ var ERC1155CollectionService = class {
|
|
|
9997
9997
|
_factory(account) {
|
|
9998
9998
|
return newContract(
|
|
9999
9999
|
IPCollection1155FactoryABI,
|
|
10000
|
-
|
|
10000
|
+
chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", this.factoryAddress),
|
|
10001
10001
|
account
|
|
10002
10002
|
);
|
|
10003
10003
|
}
|
|
10004
10004
|
_collection(address, account) {
|
|
10005
10005
|
return newContract(
|
|
10006
10006
|
IPCollection1155ABI,
|
|
10007
|
-
|
|
10007
|
+
chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", address),
|
|
10008
10008
|
account
|
|
10009
10009
|
);
|
|
10010
10010
|
}
|
|
@@ -10232,20 +10232,20 @@ function buildLaunchOnEkuboCalls(params) {
|
|
|
10232
10232
|
}
|
|
10233
10233
|
var CREATOR_COIN_CREATED_SELECTOR = starknet.hash.getSelectorFromName("CreatorCoinCreated");
|
|
10234
10234
|
function parseCreatorCoinCreated(receipt) {
|
|
10235
|
-
const factory =
|
|
10235
|
+
const factory = chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", chunkH7I6TEOA_cjs.getStarknetCoordinates("STARKNET").creatorCoinFactory);
|
|
10236
10236
|
for (const ev of receipt?.events ?? []) {
|
|
10237
10237
|
let from;
|
|
10238
10238
|
try {
|
|
10239
|
-
from =
|
|
10239
|
+
from = chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", ev.from_address ?? "");
|
|
10240
10240
|
} catch {
|
|
10241
10241
|
continue;
|
|
10242
10242
|
}
|
|
10243
10243
|
if (from !== factory) continue;
|
|
10244
10244
|
const k0 = ev.keys?.[0];
|
|
10245
|
-
if (!k0 ||
|
|
10245
|
+
if (!k0 || chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", k0) !== chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", CREATOR_COIN_CREATED_SELECTOR)) continue;
|
|
10246
10246
|
const data = ev.data ?? [];
|
|
10247
10247
|
if (data.length < 1) continue;
|
|
10248
|
-
return
|
|
10248
|
+
return chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", data[data.length - 1]);
|
|
10249
10249
|
}
|
|
10250
10250
|
throw new Error("Coin deployed but the coin address could not be read from the receipt");
|
|
10251
10251
|
}
|
|
@@ -10281,14 +10281,14 @@ var TicketService = class {
|
|
|
10281
10281
|
_factory(account, factoryAddress) {
|
|
10282
10282
|
const address = factoryAddress ?? this.factoryAddress;
|
|
10283
10283
|
if (!address) throw new Error("IP-Tickets factory address not configured for this chain");
|
|
10284
|
-
return newContract(IPTicketCollectionFactoryABI,
|
|
10284
|
+
return newContract(IPTicketCollectionFactoryABI, chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", address), account);
|
|
10285
10285
|
}
|
|
10286
10286
|
_collection(address, account) {
|
|
10287
|
-
return newContract(IPTicketCollectionABI,
|
|
10287
|
+
return newContract(IPTicketCollectionABI, chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", address), account);
|
|
10288
10288
|
}
|
|
10289
10289
|
_collectionRead(address) {
|
|
10290
10290
|
const provider = new starknet.RpcProvider({ nodeUrl: this.config.rpcUrl });
|
|
10291
|
-
return newContract(IPTicketCollectionABI,
|
|
10291
|
+
return newContract(IPTicketCollectionABI, chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", address), provider);
|
|
10292
10292
|
}
|
|
10293
10293
|
async deployCollection(account, params) {
|
|
10294
10294
|
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
@@ -10354,14 +10354,14 @@ var ClubService = class {
|
|
|
10354
10354
|
_factory(account, factoryAddress) {
|
|
10355
10355
|
const address = factoryAddress ?? this.factoryAddress;
|
|
10356
10356
|
if (!address) throw new Error("IP-Club factory address not configured for this chain");
|
|
10357
|
-
return newContract(IPClubFactoryABI,
|
|
10357
|
+
return newContract(IPClubFactoryABI, chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", address), account);
|
|
10358
10358
|
}
|
|
10359
10359
|
_collection(address, account) {
|
|
10360
|
-
return newContract(IPClubCollectionABI,
|
|
10360
|
+
return newContract(IPClubCollectionABI, chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", address), account);
|
|
10361
10361
|
}
|
|
10362
10362
|
_collectionRead(address) {
|
|
10363
10363
|
const provider = new starknet.RpcProvider({ nodeUrl: this.config.rpcUrl });
|
|
10364
|
-
return newContract(IPClubCollectionABI,
|
|
10364
|
+
return newContract(IPClubCollectionABI, chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", address), provider);
|
|
10365
10365
|
}
|
|
10366
10366
|
async deployCollection(account, params) {
|
|
10367
10367
|
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
@@ -10431,7 +10431,7 @@ var SponsorshipService = class {
|
|
|
10431
10431
|
if (!resolved) {
|
|
10432
10432
|
throw new Error("IP-Sponsorship address not configured for this chain");
|
|
10433
10433
|
}
|
|
10434
|
-
return newContract(IPSponsorshipABI,
|
|
10434
|
+
return newContract(IPSponsorshipABI, chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", resolved), account);
|
|
10435
10435
|
}
|
|
10436
10436
|
_contractRead(address) {
|
|
10437
10437
|
const resolved = address ?? this.sponsorshipAddress;
|
|
@@ -10439,7 +10439,7 @@ var SponsorshipService = class {
|
|
|
10439
10439
|
throw new Error("IP-Sponsorship address not configured for this chain");
|
|
10440
10440
|
}
|
|
10441
10441
|
const provider = new starknet.RpcProvider({ nodeUrl: this.config.rpcUrl });
|
|
10442
|
-
return newContract(IPSponsorshipABI,
|
|
10442
|
+
return newContract(IPSponsorshipABI, chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", resolved), provider);
|
|
10443
10443
|
}
|
|
10444
10444
|
async createOffer(account, params) {
|
|
10445
10445
|
const specificSponsor = params.specificSponsor ? new starknet.CairoOption(starknet.CairoOptionVariant.Some, params.specificSponsor) : new starknet.CairoOption(starknet.CairoOptionVariant.None);
|
|
@@ -10474,7 +10474,7 @@ var SponsorshipService = class {
|
|
|
10474
10474
|
const approveCall = {
|
|
10475
10475
|
contractAddress: params.paymentToken,
|
|
10476
10476
|
entrypoint: "approve",
|
|
10477
|
-
calldata: [
|
|
10477
|
+
calldata: [chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", sponsorshipAddress), amount.low.toString(), amount.high.toString()]
|
|
10478
10478
|
};
|
|
10479
10479
|
const bidCall = this._contract(account, sponsorshipAddress).populate("place_bid", [
|
|
10480
10480
|
starknet.cairo.uint256(params.offerId),
|
|
@@ -10601,7 +10601,7 @@ var SponsorshipService = class {
|
|
|
10601
10601
|
// src/starknet/client.ts
|
|
10602
10602
|
var MedialaneClient = class {
|
|
10603
10603
|
constructor(rawConfig = {}) {
|
|
10604
|
-
this.config =
|
|
10604
|
+
this.config = chunkHYHQH5SP_cjs.resolveConfig(rawConfig);
|
|
10605
10605
|
this.services = {
|
|
10606
10606
|
pop: new PopService(this.config),
|
|
10607
10607
|
drop: new DropService(this.config),
|
|
@@ -10612,9 +10612,9 @@ var MedialaneClient = class {
|
|
|
10612
10612
|
sponsorship: new SponsorshipService(this.config)
|
|
10613
10613
|
};
|
|
10614
10614
|
if (!this.config.backendUrl) {
|
|
10615
|
-
const sentinel = new
|
|
10615
|
+
const sentinel = new chunkHYHQH5SP_cjs.ApiClient("https://medialane-sdk-no-backend.invalid", this.config.apiKey);
|
|
10616
10616
|
const apiMethodNames = new Set(
|
|
10617
|
-
Object.getOwnPropertyNames(
|
|
10617
|
+
Object.getOwnPropertyNames(chunkHYHQH5SP_cjs.ApiClient.prototype).filter(
|
|
10618
10618
|
(k) => k !== "constructor" && typeof sentinel[k] === "function"
|
|
10619
10619
|
)
|
|
10620
10620
|
);
|
|
@@ -10631,7 +10631,7 @@ var MedialaneClient = class {
|
|
|
10631
10631
|
}
|
|
10632
10632
|
});
|
|
10633
10633
|
} else {
|
|
10634
|
-
this.api = new
|
|
10634
|
+
this.api = new chunkHYHQH5SP_cjs.ApiClient(this.config.backendUrl, this.config.apiKey, this.config.retryOptions, this.config.chain);
|
|
10635
10635
|
}
|
|
10636
10636
|
}
|
|
10637
10637
|
get chain() {
|
|
@@ -10803,7 +10803,7 @@ function buildListingOrder(i, cfg) {
|
|
|
10803
10803
|
salt: i.salt,
|
|
10804
10804
|
counter: i.counter
|
|
10805
10805
|
};
|
|
10806
|
-
const typedData =
|
|
10806
|
+
const typedData = chunkHYHQH5SP_cjs.stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
|
|
10807
10807
|
return { orderParams, typedData };
|
|
10808
10808
|
}
|
|
10809
10809
|
function buildOfferOrder(i, cfg) {
|
|
@@ -10824,11 +10824,11 @@ function buildOfferOrder(i, cfg) {
|
|
|
10824
10824
|
salt: i.salt,
|
|
10825
10825
|
counter: i.counter
|
|
10826
10826
|
};
|
|
10827
|
-
const typedData =
|
|
10827
|
+
const typedData = chunkHYHQH5SP_cjs.stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
|
|
10828
10828
|
return { orderParams, typedData };
|
|
10829
10829
|
}
|
|
10830
10830
|
function registerPayload(orderParams, signature) {
|
|
10831
|
-
return
|
|
10831
|
+
return chunkHYHQH5SP_cjs.stringifyBigInts({
|
|
10832
10832
|
parameters: {
|
|
10833
10833
|
...orderParams,
|
|
10834
10834
|
offer: { ...orderParams.offer, item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type) },
|
|
@@ -10859,14 +10859,14 @@ function buildFulfillCalls(a, cfg) {
|
|
|
10859
10859
|
return fee ? [approve, fulfill, fee] : [approve, fulfill];
|
|
10860
10860
|
}
|
|
10861
10861
|
function buildCancelCalls(a, cfg) {
|
|
10862
|
-
const cancelRequest =
|
|
10862
|
+
const cancelRequest = chunkHYHQH5SP_cjs.stringifyBigInts({
|
|
10863
10863
|
cancelation: { order_hash: a.orderHash, offerer: a.offerer },
|
|
10864
10864
|
signature: a.signature
|
|
10865
10865
|
});
|
|
10866
10866
|
return [contractFor(cfg).populate("cancel_order", [cancelRequest])];
|
|
10867
10867
|
}
|
|
10868
10868
|
function buildCancelTypedData(orderHash, offerer, cfg) {
|
|
10869
|
-
return
|
|
10869
|
+
return chunkHYHQH5SP_cjs.stringifyBigInts(buildCancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg)));
|
|
10870
10870
|
}
|
|
10871
10871
|
function contractFor2(cfg) {
|
|
10872
10872
|
return newContract(Medialane1155ABI, cfg.marketplace1155Contract, getProvider(cfg));
|
|
@@ -10889,7 +10889,7 @@ function buildListing1155Order(i, cfg) {
|
|
|
10889
10889
|
salt: i.salt,
|
|
10890
10890
|
counter: i.counter
|
|
10891
10891
|
};
|
|
10892
|
-
const typedData =
|
|
10892
|
+
const typedData = chunkHYHQH5SP_cjs.stringifyBigInts(
|
|
10893
10893
|
build1155OrderTypedData(orderParams, getChainId(cfg))
|
|
10894
10894
|
);
|
|
10895
10895
|
return { orderParams, typedData };
|
|
@@ -10912,13 +10912,13 @@ function buildOffer1155Order(i, cfg) {
|
|
|
10912
10912
|
salt: i.salt,
|
|
10913
10913
|
counter: i.counter
|
|
10914
10914
|
};
|
|
10915
|
-
const typedData =
|
|
10915
|
+
const typedData = chunkHYHQH5SP_cjs.stringifyBigInts(
|
|
10916
10916
|
build1155OrderTypedData(orderParams, getChainId(cfg))
|
|
10917
10917
|
);
|
|
10918
10918
|
return { orderParams, typedData };
|
|
10919
10919
|
}
|
|
10920
10920
|
function registerPayload2(orderParams, signature) {
|
|
10921
|
-
return
|
|
10921
|
+
return chunkHYHQH5SP_cjs.stringifyBigInts({
|
|
10922
10922
|
parameters: {
|
|
10923
10923
|
...orderParams,
|
|
10924
10924
|
offer: { ...orderParams.offer, item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type) },
|
|
@@ -10949,14 +10949,14 @@ function buildFulfill1155Calls(a, cfg) {
|
|
|
10949
10949
|
return fee ? [approve, fulfill, fee] : [approve, fulfill];
|
|
10950
10950
|
}
|
|
10951
10951
|
function buildCancel1155Calls(a, cfg) {
|
|
10952
|
-
const cancelPayload =
|
|
10952
|
+
const cancelPayload = chunkHYHQH5SP_cjs.stringifyBigInts({
|
|
10953
10953
|
cancelation: { order_hash: a.orderHash, offerer: a.offerer },
|
|
10954
10954
|
signature: a.signature
|
|
10955
10955
|
});
|
|
10956
10956
|
return [contractFor2(cfg).populate("cancel_order", [cancelPayload])];
|
|
10957
10957
|
}
|
|
10958
10958
|
function buildCancel1155TypedData(orderHash, offerer, cfg) {
|
|
10959
|
-
return
|
|
10959
|
+
return chunkHYHQH5SP_cjs.stringifyBigInts(
|
|
10960
10960
|
build1155CancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg))
|
|
10961
10961
|
);
|
|
10962
10962
|
}
|
|
@@ -11299,14 +11299,14 @@ async function assertTransactionSucceeded(provider, txHash, retryDelaysMs = RECE
|
|
|
11299
11299
|
const receipt = await provider.getTransactionReceipt(txHash);
|
|
11300
11300
|
const status = receipt.execution_status ?? receipt.status;
|
|
11301
11301
|
if (status === "REVERTED" || status === "REJECTED") {
|
|
11302
|
-
throw new
|
|
11302
|
+
throw new chunkHYHQH5SP_cjs.UserFacingError("Transaction was submitted but reverted onchain. Please check your balance and try again.");
|
|
11303
11303
|
}
|
|
11304
11304
|
if (status) return receipt;
|
|
11305
11305
|
} catch (err) {
|
|
11306
11306
|
if (err instanceof Error && err.message.includes("reverted onchain")) throw err;
|
|
11307
11307
|
}
|
|
11308
11308
|
}
|
|
11309
|
-
throw new
|
|
11309
|
+
throw new chunkHYHQH5SP_cjs.UserFacingError("Verification timed out. Check your account for the transaction status.");
|
|
11310
11310
|
}
|
|
11311
11311
|
async function executeIntent(provider, signer, client, intent, opts = {}) {
|
|
11312
11312
|
let calls;
|
|
@@ -11359,14 +11359,14 @@ function u2562(low, high) {
|
|
|
11359
11359
|
return (BigInt(low ?? 0) + (BigInt(high ?? 0) << 128n)).toString();
|
|
11360
11360
|
}
|
|
11361
11361
|
function deployedCollectionFromReceipt(receipt, service) {
|
|
11362
|
-
const factory =
|
|
11362
|
+
const factory = chunkHYHQH5SP_cjs.getService(service)?.onchain?.STARKNET?.factoryAddress;
|
|
11363
11363
|
const { event, address } = DEPLOY_EVENTS[service];
|
|
11364
11364
|
const selector = BigInt(starknet.hash.getSelectorFromName(event));
|
|
11365
11365
|
for (const e of receipt.events ?? []) {
|
|
11366
11366
|
if (factory && !sameFelt(e.from_address, factory)) continue;
|
|
11367
11367
|
if (!sameFelt(e.keys?.[0], selector)) continue;
|
|
11368
11368
|
const value = address(e);
|
|
11369
|
-
if (value) return
|
|
11369
|
+
if (value) return chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", value);
|
|
11370
11370
|
}
|
|
11371
11371
|
return null;
|
|
11372
11372
|
}
|
|
@@ -11487,13 +11487,13 @@ function buildRemoveOwnerByGuidCall(accountAddress, ownerGuid) {
|
|
|
11487
11487
|
}
|
|
11488
11488
|
function buildDeployAccountParams(ownerPubkey, salt = 0) {
|
|
11489
11489
|
return {
|
|
11490
|
-
classHash:
|
|
11491
|
-
constructorCalldata:
|
|
11490
|
+
classHash: chunkHYHQH5SP_cjs.STARKNET_MEDIAWALLET_CLASS_HASH,
|
|
11491
|
+
constructorCalldata: chunkHYHQH5SP_cjs.ownerConstructorCalldata(ownerPubkey),
|
|
11492
11492
|
addressSalt: starknet.num.toHex(salt),
|
|
11493
|
-
contractAddress:
|
|
11493
|
+
contractAddress: chunkHYHQH5SP_cjs.computeAccountAddress(ownerPubkey, salt)
|
|
11494
11494
|
};
|
|
11495
11495
|
}
|
|
11496
|
-
var norm = (address) =>
|
|
11496
|
+
var norm = (address) => chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", address);
|
|
11497
11497
|
var SIGNER_TYPE_NAMES = ["Starknet", "Secp256k1", "Secp256r1"];
|
|
11498
11498
|
function encodeFeltArray(items) {
|
|
11499
11499
|
return [starknet.num.toHex(items.length), ...items];
|
|
@@ -11690,7 +11690,7 @@ var InvalidRecoveryKeyError = class extends Error {
|
|
|
11690
11690
|
var canonicalAddress = (address) => `0x${BigInt(address).toString(16).padStart(64, "0")}`;
|
|
11691
11691
|
function keyPair(privateKey) {
|
|
11692
11692
|
try {
|
|
11693
|
-
return
|
|
11693
|
+
return chunkHYHQH5SP_cjs.starkKeyPairFromPrivateKey(privateKey);
|
|
11694
11694
|
} catch {
|
|
11695
11695
|
throw new InvalidRecoveryKeyError();
|
|
11696
11696
|
}
|
|
@@ -11703,7 +11703,7 @@ function parseRecoveryKey(input) {
|
|
|
11703
11703
|
const trimmed = input.trim();
|
|
11704
11704
|
if (!trimmed.startsWith(PREFIX)) {
|
|
11705
11705
|
const { privateKeyHex, publicKeyHex } = keyPair(trimmed);
|
|
11706
|
-
return { walletAddress:
|
|
11706
|
+
return { walletAddress: chunkHYHQH5SP_cjs.computeAccountAddress(publicKeyHex, 0), privateKey: privateKeyHex };
|
|
11707
11707
|
}
|
|
11708
11708
|
const parts = trimmed.slice(PREFIX.length).split(":");
|
|
11709
11709
|
const [walletAddress, privateKey] = parts;
|
|
@@ -11725,7 +11725,7 @@ function describeRecoveryAction(escape) {
|
|
|
11725
11725
|
return "none";
|
|
11726
11726
|
}
|
|
11727
11727
|
function normalizeWalletAddress(address) {
|
|
11728
|
-
return
|
|
11728
|
+
return chunkHYHQH5SP_cjs.normalizeAddress("STARKNET", address);
|
|
11729
11729
|
}
|
|
11730
11730
|
function isValidStarknetAddress(address) {
|
|
11731
11731
|
try {
|
|
@@ -11770,7 +11770,7 @@ async function estimateSelfFundedFee(provider, address, calls) {
|
|
|
11770
11770
|
return { feeRaw: estimate.overall_fee, unit: estimate.unit, balanceRaw };
|
|
11771
11771
|
}
|
|
11772
11772
|
async function feeTokenBalance(provider, address, unit) {
|
|
11773
|
-
const token =
|
|
11773
|
+
const token = chunkHYHQH5SP_cjs.getTokenBySymbol(unit === "FRI" ? "STRK" : "ETH");
|
|
11774
11774
|
if (!token) throw new Error(`No fee token for unit ${unit}`);
|
|
11775
11775
|
const [low = "0x0", high = "0x0"] = await provider.callContract({
|
|
11776
11776
|
contractAddress: token.address,
|
|
@@ -11797,7 +11797,7 @@ function sponsoredExecutor(deps) {
|
|
|
11797
11797
|
{ proxyUrl: deps.proxyUrl, fetchImpl: deps.fetchImpl },
|
|
11798
11798
|
{
|
|
11799
11799
|
address: userAddress,
|
|
11800
|
-
signTypedData: async (data) =>
|
|
11800
|
+
signTypedData: async (data) => chunkHYHQH5SP_cjs.signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(data, userAddress))
|
|
11801
11801
|
},
|
|
11802
11802
|
calls
|
|
11803
11803
|
);
|
|
@@ -11857,7 +11857,7 @@ async function deploySelfFunded(input) {
|
|
|
11857
11857
|
});
|
|
11858
11858
|
const { transaction_hash } = await account.deployAccount({
|
|
11859
11859
|
classHash,
|
|
11860
|
-
constructorCalldata:
|
|
11860
|
+
constructorCalldata: chunkHYHQH5SP_cjs.ownerConstructorCalldata(input.ownerPubKey),
|
|
11861
11861
|
addressSalt: 0,
|
|
11862
11862
|
contractAddress: input.ownerAddress
|
|
11863
11863
|
});
|
|
@@ -11925,7 +11925,7 @@ async function completeDeployment(deps, onStep, options = {}) {
|
|
|
11925
11925
|
backendUrl: deps.backendUrl,
|
|
11926
11926
|
walletAddress: address,
|
|
11927
11927
|
signer: {
|
|
11928
|
-
signMessage: async (td) =>
|
|
11928
|
+
signMessage: async (td) => chunkHYHQH5SP_cjs.signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(td, address))
|
|
11929
11929
|
}
|
|
11930
11930
|
});
|
|
11931
11931
|
deps.store.notifyChange();
|
|
@@ -12030,7 +12030,7 @@ function createMediaWallet(config) {
|
|
|
12030
12030
|
address: sealed.address,
|
|
12031
12031
|
signTypedData: async (data) => {
|
|
12032
12032
|
const privateKeyHex = await unlockOnce(sealed);
|
|
12033
|
-
return
|
|
12033
|
+
return chunkHYHQH5SP_cjs.signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(data, sealed.address));
|
|
12034
12034
|
},
|
|
12035
12035
|
execute: async (calls) => {
|
|
12036
12036
|
const { transactionHash } = await run(sealed, calls);
|
|
@@ -12102,55 +12102,55 @@ async function claimSessionWallet(api, walletAddress, deps) {
|
|
|
12102
12102
|
|
|
12103
12103
|
Object.defineProperty(exports, "InvalidStarkPrivateKeyError", {
|
|
12104
12104
|
enumerable: true,
|
|
12105
|
-
get: function () { return
|
|
12105
|
+
get: function () { return chunkHYHQH5SP_cjs.InvalidStarkPrivateKeyError; }
|
|
12106
12106
|
});
|
|
12107
12107
|
Object.defineProperty(exports, "PasskeyCancelledError", {
|
|
12108
12108
|
enumerable: true,
|
|
12109
|
-
get: function () { return
|
|
12109
|
+
get: function () { return chunkHYHQH5SP_cjs.PasskeyCancelledError; }
|
|
12110
12110
|
});
|
|
12111
12111
|
Object.defineProperty(exports, "PasskeyUnsupportedError", {
|
|
12112
12112
|
enumerable: true,
|
|
12113
|
-
get: function () { return
|
|
12113
|
+
get: function () { return chunkHYHQH5SP_cjs.PasskeyUnsupportedError; }
|
|
12114
12114
|
});
|
|
12115
12115
|
Object.defineProperty(exports, "UserFacingError", {
|
|
12116
12116
|
enumerable: true,
|
|
12117
|
-
get: function () { return
|
|
12117
|
+
get: function () { return chunkHYHQH5SP_cjs.UserFacingError; }
|
|
12118
12118
|
});
|
|
12119
12119
|
Object.defineProperty(exports, "computeAccountAddress", {
|
|
12120
12120
|
enumerable: true,
|
|
12121
|
-
get: function () { return
|
|
12121
|
+
get: function () { return chunkHYHQH5SP_cjs.computeAccountAddress; }
|
|
12122
12122
|
});
|
|
12123
12123
|
Object.defineProperty(exports, "createPasskeyOwner", {
|
|
12124
12124
|
enumerable: true,
|
|
12125
|
-
get: function () { return
|
|
12125
|
+
get: function () { return chunkHYHQH5SP_cjs.createPasskeyOwner; }
|
|
12126
12126
|
});
|
|
12127
12127
|
Object.defineProperty(exports, "deriveAesKey", {
|
|
12128
12128
|
enumerable: true,
|
|
12129
|
-
get: function () { return
|
|
12129
|
+
get: function () { return chunkHYHQH5SP_cjs.deriveAesKey; }
|
|
12130
12130
|
});
|
|
12131
12131
|
Object.defineProperty(exports, "generateStarkKeyPair", {
|
|
12132
12132
|
enumerable: true,
|
|
12133
|
-
get: function () { return
|
|
12133
|
+
get: function () { return chunkHYHQH5SP_cjs.generateStarkKeyPair; }
|
|
12134
12134
|
});
|
|
12135
12135
|
Object.defineProperty(exports, "ownerConstructorCalldata", {
|
|
12136
12136
|
enumerable: true,
|
|
12137
|
-
get: function () { return
|
|
12137
|
+
get: function () { return chunkHYHQH5SP_cjs.ownerConstructorCalldata; }
|
|
12138
12138
|
});
|
|
12139
12139
|
Object.defineProperty(exports, "sealPrivateKey", {
|
|
12140
12140
|
enumerable: true,
|
|
12141
|
-
get: function () { return
|
|
12141
|
+
get: function () { return chunkHYHQH5SP_cjs.sealPrivateKey; }
|
|
12142
12142
|
});
|
|
12143
12143
|
Object.defineProperty(exports, "signWithPrivateKey", {
|
|
12144
12144
|
enumerable: true,
|
|
12145
|
-
get: function () { return
|
|
12145
|
+
get: function () { return chunkHYHQH5SP_cjs.signWithPrivateKey; }
|
|
12146
12146
|
});
|
|
12147
12147
|
Object.defineProperty(exports, "starkKeyPairFromPrivateKey", {
|
|
12148
12148
|
enumerable: true,
|
|
12149
|
-
get: function () { return
|
|
12149
|
+
get: function () { return chunkHYHQH5SP_cjs.starkKeyPairFromPrivateKey; }
|
|
12150
12150
|
});
|
|
12151
12151
|
Object.defineProperty(exports, "unsealPrivateKey", {
|
|
12152
12152
|
enumerable: true,
|
|
12153
|
-
get: function () { return
|
|
12153
|
+
get: function () { return chunkHYHQH5SP_cjs.unsealPrivateKey; }
|
|
12154
12154
|
});
|
|
12155
12155
|
exports.COIN_MAX_SUPPLY = MAX_SUPPLY;
|
|
12156
12156
|
exports.COIN_MIN_SUPPLY = MIN_SUPPLY;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { bC as ResolvedConfig, aZ as CreatePopCollectionParams, bJ as TxResult, aK as ClaimConditions, aV as CreateDropParams, b2 as CreateTicketParams, bn as MintTicketsParams, aX as CreateMembershipParams, bm as MintMembershipsParams, b0 as CreateSponsorshipOfferParams, bz as ProposeSponsorshipParams, k as ApiClient, bk as MedialaneConfig, bl as MedialaneErrorCode, bs as OrderDetails, R as ResolvedFeeConfig, I as ApiFundingIntent, H as ApiFundingInstructions, L as ApiFundingSubmit, N as ApiIntentCreated, bP as SealedOwner, bQ as ReceiptProviderLike, bR as WalletExecutor, bS as ExecutedTransaction, bT as PasskeyOwner, bU as CreatedOwner } from '../errors-nZw63PCE.cjs';
|
|
2
|
+
export { bV as InvalidRecoveryKeyError, bW as OwnerSigner, bv as PasskeyCancelledError, bX as PasskeyConfig, bw as PasskeyUnsupportedError, bx as PasskeyUnsupportedReason, bY as RecoveryKey, bL as UserFacingError, bZ as createPasskeyOwner, b_ as encodeRecoveryKey, b$ as parseRecoveryKey } from '../errors-nZw63PCE.cjs';
|
|
3
3
|
import { AccountInterface, ProviderInterface, Call, TypedData, constants, BigNumberish, DeployAccountContractPayload, Account } from 'starknet';
|
|
4
4
|
import { V as VenueAdapter, O as OrderRef, A as AdapterTxResult, R as RegisterOrderParams, j as VenueSigner } from '../types-PPshMWr7.cjs';
|
|
5
5
|
import 'zod';
|
package/dist/starknet/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { bC as ResolvedConfig, aZ as CreatePopCollectionParams, bJ as TxResult, aK as ClaimConditions, aV as CreateDropParams, b2 as CreateTicketParams, bn as MintTicketsParams, aX as CreateMembershipParams, bm as MintMembershipsParams, b0 as CreateSponsorshipOfferParams, bz as ProposeSponsorshipParams, k as ApiClient, bk as MedialaneConfig, bl as MedialaneErrorCode, bs as OrderDetails, R as ResolvedFeeConfig, I as ApiFundingIntent, H as ApiFundingInstructions, L as ApiFundingSubmit, N as ApiIntentCreated, bP as SealedOwner, bQ as ReceiptProviderLike, bR as WalletExecutor, bS as ExecutedTransaction, bT as PasskeyOwner, bU as CreatedOwner } from '../errors-D_dnks1i.js';
|
|
2
|
+
export { bV as InvalidRecoveryKeyError, bW as OwnerSigner, bv as PasskeyCancelledError, bX as PasskeyConfig, bw as PasskeyUnsupportedError, bx as PasskeyUnsupportedReason, bY as RecoveryKey, bL as UserFacingError, bZ as createPasskeyOwner, b_ as encodeRecoveryKey, b$ as parseRecoveryKey } from '../errors-D_dnks1i.js';
|
|
3
3
|
import { AccountInterface, ProviderInterface, Call, TypedData, constants, BigNumberish, DeployAccountContractPayload, Account } from 'starknet';
|
|
4
4
|
import { V as VenueAdapter, O as OrderRef, A as AdapterTxResult, R as RegisterOrderParams, j as VenueSigner } from '../types-PPshMWr7.js';
|
|
5
5
|
import 'zod';
|
package/dist/starknet/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { normalizeAddress, collectionHref, resolveConfig, ApiClient, UserFacingError, getService, STARKNET_MEDIAWALLET_CLASS_HASH, computeAccountAddress, ownerConstructorCalldata, getTokenBySymbol, signWithPrivateKey, stringifyBigInts, SUPPORTED_TOKENS, starkKeyPairFromPrivateKey, createFailoverFetch } from '../chunk-
|
|
2
|
-
export { InvalidStarkPrivateKeyError, PasskeyCancelledError, PasskeyUnsupportedError, UserFacingError, computeAccountAddress, createPasskeyOwner, deriveAesKey, generateStarkKeyPair, ownerConstructorCalldata, sealPrivateKey, signWithPrivateKey, starkKeyPairFromPrivateKey, unsealPrivateKey } from '../chunk-
|
|
1
|
+
import { normalizeAddress, collectionHref, resolveConfig, ApiClient, UserFacingError, getService, STARKNET_MEDIAWALLET_CLASS_HASH, computeAccountAddress, ownerConstructorCalldata, getTokenBySymbol, signWithPrivateKey, stringifyBigInts, SUPPORTED_TOKENS, starkKeyPairFromPrivateKey, createFailoverFetch } from '../chunk-RLBOUTCQ.js';
|
|
2
|
+
export { InvalidStarkPrivateKeyError, PasskeyCancelledError, PasskeyUnsupportedError, UserFacingError, computeAccountAddress, createPasskeyOwner, deriveAesKey, generateStarkKeyPair, ownerConstructorCalldata, sealPrivateKey, signWithPrivateKey, starkKeyPairFromPrivateKey, unsealPrivateKey } from '../chunk-RLBOUTCQ.js';
|
|
3
3
|
import { getStarknetCoordinates, getCoordinates } from '../chunk-PBJLHXDB.js';
|
|
4
4
|
import { hash, cairo, uint256, RpcProvider, CairoOption, CairoOptionVariant, num, ec, validateAndParseAddress, Account, typedData, stark, CallData, byteArray, Contract, TypedDataRevision, constants, shortString } from 'starknet';
|
|
5
5
|
import { extract, expand } from '@noble/hashes/hkdf.js';
|