@medialane/sdk 0.169.0 → 0.170.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-4SZV7J2R.cjs → chunk-DOIIAXHD.cjs} +22 -2
- package/dist/chunk-DOIIAXHD.cjs.map +1 -0
- package/dist/{chunk-X5RNNPDU.js → chunk-HUTEU22Y.js} +22 -2
- package/dist/chunk-HUTEU22Y.js.map +1 -0
- package/dist/{errors-GfSlToOh.d.cts → errors-CZlv-DJJ.d.cts} +44 -1
- package/dist/{errors-D6S2d0Oy.d.ts → errors-PGCoVYdU.d.ts} +44 -1
- package/dist/index.cjs +75 -75
- 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 +71 -71
- 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-4SZV7J2R.cjs.map +0 -1
- package/dist/chunk-X5RNNPDU.js.map +0 -1
package/dist/starknet/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkDOIIAXHD_cjs = require('../chunk-DOIIAXHD.cjs');
|
|
4
4
|
var chunkVJVBWHAD_cjs = require('../chunk-VJVBWHAD.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 = chunkDOIIAXHD_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: chunkDOIIAXHD_cjs.createFailoverFetch(urls) });
|
|
48
48
|
_providerCache.set(config, p);
|
|
49
49
|
}
|
|
50
50
|
return p;
|
|
@@ -10415,7 +10415,7 @@ function merkleTree(leafHashes) {
|
|
|
10415
10415
|
};
|
|
10416
10416
|
}
|
|
10417
10417
|
function buildPopAllowlist(addresses) {
|
|
10418
|
-
const unique = [...new Set(addresses.map((a) =>
|
|
10418
|
+
const unique = [...new Set(addresses.map((a) => chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", a)))];
|
|
10419
10419
|
if (unique.length === 0) throw new Error("An allowlist needs at least one address");
|
|
10420
10420
|
const leaves = unique.map((address) => ({ address, leaf: popLeafHash(address) }));
|
|
10421
10421
|
const tree = merkleTree(leaves.map((l) => l.leaf));
|
|
@@ -10441,7 +10441,7 @@ function decodePopClaimFragment(fragment) {
|
|
|
10441
10441
|
|
|
10442
10442
|
// src/starknet/pop-claim.ts
|
|
10443
10443
|
function popClaimLinks(origin, collection, list) {
|
|
10444
|
-
const base = `${origin}${
|
|
10444
|
+
const base = `${origin}${chunkDOIIAXHD_cjs.collectionHref("STARKNET", collection)}`;
|
|
10445
10445
|
return Object.entries(list.proofs).map(([address, proof]) => ({
|
|
10446
10446
|
address,
|
|
10447
10447
|
url: `${base}${encodePopClaimFragment(proof)}`
|
|
@@ -10451,7 +10451,7 @@ function popClaimLinksCsv(links) {
|
|
|
10451
10451
|
return ["address,claim_link", ...links.map((l) => `${l.address},${l.url}`)].join("\n");
|
|
10452
10452
|
}
|
|
10453
10453
|
async function popClaimInfo(provider, collection) {
|
|
10454
|
-
const contractAddress =
|
|
10454
|
+
const contractAddress = chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", collection);
|
|
10455
10455
|
const [root, end] = await Promise.all([
|
|
10456
10456
|
provider.callContract({ contractAddress, entrypoint: "allowlist_root", calldata: [] }),
|
|
10457
10457
|
provider.callContract({ contractAddress, entrypoint: "claim_end_time", calldata: [] })
|
|
@@ -10468,7 +10468,7 @@ function popClaimState(input) {
|
|
|
10468
10468
|
if (!wallet || !verifyPopProof(info.root, wallet, proof)) return "wrong-wallet";
|
|
10469
10469
|
return "ready";
|
|
10470
10470
|
}
|
|
10471
|
-
var addr = (a) =>
|
|
10471
|
+
var addr = (a) => chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", a);
|
|
10472
10472
|
var byteArrayFelts = (s) => starknet.CallData.compile([starknet.byteArray.byteArrayFromString(s)]);
|
|
10473
10473
|
var popCalls = {
|
|
10474
10474
|
claim(collection, proof) {
|
|
@@ -10523,9 +10523,9 @@ var PopService = class {
|
|
|
10523
10523
|
};
|
|
10524
10524
|
async function popHasClaimed(provider, collection, address) {
|
|
10525
10525
|
const res = await provider.callContract({
|
|
10526
|
-
contractAddress:
|
|
10526
|
+
contractAddress: chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", collection),
|
|
10527
10527
|
entrypoint: "has_claimed",
|
|
10528
|
-
calldata: [
|
|
10528
|
+
calldata: [chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", address)]
|
|
10529
10529
|
});
|
|
10530
10530
|
return BigInt(res[0] ?? "0x0") !== 0n;
|
|
10531
10531
|
}
|
|
@@ -10546,7 +10546,7 @@ function buildFeeCall(p, cfg) {
|
|
|
10546
10546
|
calldata: [cfg.fundAddress, u.low.toString(), u.high.toString()]
|
|
10547
10547
|
};
|
|
10548
10548
|
}
|
|
10549
|
-
var addr2 = (a) =>
|
|
10549
|
+
var addr2 = (a) => chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", a);
|
|
10550
10550
|
var factoryData = new starknet.CallData(DropFactoryABI);
|
|
10551
10551
|
var collectionData = new starknet.CallData(DropCollectionABI);
|
|
10552
10552
|
function toContractTerms(t) {
|
|
@@ -10613,7 +10613,7 @@ function dropMintCost(price, quantity, cfg) {
|
|
|
10613
10613
|
}
|
|
10614
10614
|
|
|
10615
10615
|
// src/starknet/drop-state.ts
|
|
10616
|
-
var hex = (v) =>
|
|
10616
|
+
var hex = (v) => chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", v ?? "0x0");
|
|
10617
10617
|
var u256 = (low, high) => BigInt(low ?? "0x0") + (BigInt(high ?? "0x0") << 128n);
|
|
10618
10618
|
async function readDrop(provider, collection) {
|
|
10619
10619
|
const contractAddress = hex(collection);
|
|
@@ -10669,7 +10669,7 @@ function dropMintState(input) {
|
|
|
10669
10669
|
return { state: "ready", maxQuantity: max };
|
|
10670
10670
|
}
|
|
10671
10671
|
function dropClaimLinks(origin, collection, list) {
|
|
10672
|
-
const base = `${origin}${
|
|
10672
|
+
const base = `${origin}${chunkDOIIAXHD_cjs.dropHref(collection)}`;
|
|
10673
10673
|
return Object.entries(list.proofs).map(([address, proof]) => ({
|
|
10674
10674
|
address,
|
|
10675
10675
|
url: `${base}${encodePopClaimFragment(proof)}`
|
|
@@ -10721,14 +10721,14 @@ var ERC1155CollectionService = class {
|
|
|
10721
10721
|
_factory(account) {
|
|
10722
10722
|
return newContract(
|
|
10723
10723
|
IPCollection1155FactoryABI,
|
|
10724
|
-
|
|
10724
|
+
chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", this.factoryAddress),
|
|
10725
10725
|
account
|
|
10726
10726
|
);
|
|
10727
10727
|
}
|
|
10728
10728
|
_collection(address, account) {
|
|
10729
10729
|
return newContract(
|
|
10730
10730
|
IPCollection1155ABI,
|
|
10731
|
-
|
|
10731
|
+
chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", address),
|
|
10732
10732
|
account
|
|
10733
10733
|
);
|
|
10734
10734
|
}
|
|
@@ -10956,20 +10956,20 @@ function buildLaunchOnEkuboCalls(params) {
|
|
|
10956
10956
|
}
|
|
10957
10957
|
var CREATOR_COIN_CREATED_SELECTOR = starknet.hash.getSelectorFromName("CreatorCoinCreated");
|
|
10958
10958
|
function parseCreatorCoinCreated(receipt) {
|
|
10959
|
-
const factory =
|
|
10959
|
+
const factory = chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", chunkVJVBWHAD_cjs.getStarknetCoordinates("STARKNET").creatorCoinFactory);
|
|
10960
10960
|
for (const ev of receipt?.events ?? []) {
|
|
10961
10961
|
let from;
|
|
10962
10962
|
try {
|
|
10963
|
-
from =
|
|
10963
|
+
from = chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", ev.from_address ?? "");
|
|
10964
10964
|
} catch {
|
|
10965
10965
|
continue;
|
|
10966
10966
|
}
|
|
10967
10967
|
if (from !== factory) continue;
|
|
10968
10968
|
const k0 = ev.keys?.[0];
|
|
10969
|
-
if (!k0 ||
|
|
10969
|
+
if (!k0 || chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", k0) !== chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", CREATOR_COIN_CREATED_SELECTOR)) continue;
|
|
10970
10970
|
const data = ev.data ?? [];
|
|
10971
10971
|
if (data.length < 1) continue;
|
|
10972
|
-
return
|
|
10972
|
+
return chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", data[data.length - 1]);
|
|
10973
10973
|
}
|
|
10974
10974
|
throw new Error("Coin deployed but the coin address could not be read from the receipt");
|
|
10975
10975
|
}
|
|
@@ -11005,14 +11005,14 @@ var TicketService = class {
|
|
|
11005
11005
|
_factory(account, factoryAddress) {
|
|
11006
11006
|
const address = factoryAddress ?? this.factoryAddress;
|
|
11007
11007
|
if (!address) throw new Error("IP-Tickets factory address not configured for this chain");
|
|
11008
|
-
return newContract(IPTicketCollectionFactoryABI,
|
|
11008
|
+
return newContract(IPTicketCollectionFactoryABI, chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", address), account);
|
|
11009
11009
|
}
|
|
11010
11010
|
_collection(address, account) {
|
|
11011
|
-
return newContract(IPTicketCollectionABI,
|
|
11011
|
+
return newContract(IPTicketCollectionABI, chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", address), account);
|
|
11012
11012
|
}
|
|
11013
11013
|
_collectionRead(address) {
|
|
11014
11014
|
const provider = new starknet.RpcProvider({ nodeUrl: this.config.rpcUrl });
|
|
11015
|
-
return newContract(IPTicketCollectionABI,
|
|
11015
|
+
return newContract(IPTicketCollectionABI, chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", address), provider);
|
|
11016
11016
|
}
|
|
11017
11017
|
async deployCollection(account, params) {
|
|
11018
11018
|
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
@@ -11078,14 +11078,14 @@ var ClubService = class {
|
|
|
11078
11078
|
_factory(account, factoryAddress) {
|
|
11079
11079
|
const address = factoryAddress ?? this.factoryAddress;
|
|
11080
11080
|
if (!address) throw new Error("IP-Club factory address not configured for this chain");
|
|
11081
|
-
return newContract(IPClubFactoryABI,
|
|
11081
|
+
return newContract(IPClubFactoryABI, chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", address), account);
|
|
11082
11082
|
}
|
|
11083
11083
|
_collection(address, account) {
|
|
11084
|
-
return newContract(IPClubCollectionABI,
|
|
11084
|
+
return newContract(IPClubCollectionABI, chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", address), account);
|
|
11085
11085
|
}
|
|
11086
11086
|
_collectionRead(address) {
|
|
11087
11087
|
const provider = new starknet.RpcProvider({ nodeUrl: this.config.rpcUrl });
|
|
11088
|
-
return newContract(IPClubCollectionABI,
|
|
11088
|
+
return newContract(IPClubCollectionABI, chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", address), provider);
|
|
11089
11089
|
}
|
|
11090
11090
|
async deployCollection(account, params) {
|
|
11091
11091
|
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
@@ -11155,7 +11155,7 @@ var SponsorshipService = class {
|
|
|
11155
11155
|
if (!resolved) {
|
|
11156
11156
|
throw new Error("IP-Sponsorship address not configured for this chain");
|
|
11157
11157
|
}
|
|
11158
|
-
return newContract(IPSponsorshipABI,
|
|
11158
|
+
return newContract(IPSponsorshipABI, chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", resolved), account);
|
|
11159
11159
|
}
|
|
11160
11160
|
_contractRead(address) {
|
|
11161
11161
|
const resolved = address ?? this.sponsorshipAddress;
|
|
@@ -11163,7 +11163,7 @@ var SponsorshipService = class {
|
|
|
11163
11163
|
throw new Error("IP-Sponsorship address not configured for this chain");
|
|
11164
11164
|
}
|
|
11165
11165
|
const provider = new starknet.RpcProvider({ nodeUrl: this.config.rpcUrl });
|
|
11166
|
-
return newContract(IPSponsorshipABI,
|
|
11166
|
+
return newContract(IPSponsorshipABI, chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", resolved), provider);
|
|
11167
11167
|
}
|
|
11168
11168
|
async createOffer(account, params) {
|
|
11169
11169
|
const specificSponsor = params.specificSponsor ? new starknet.CairoOption(starknet.CairoOptionVariant.Some, params.specificSponsor) : new starknet.CairoOption(starknet.CairoOptionVariant.None);
|
|
@@ -11198,7 +11198,7 @@ var SponsorshipService = class {
|
|
|
11198
11198
|
const approveCall = {
|
|
11199
11199
|
contractAddress: params.paymentToken,
|
|
11200
11200
|
entrypoint: "approve",
|
|
11201
|
-
calldata: [
|
|
11201
|
+
calldata: [chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", sponsorshipAddress), amount.low.toString(), amount.high.toString()]
|
|
11202
11202
|
};
|
|
11203
11203
|
const bidCall = this._contract(account, sponsorshipAddress).populate("place_bid", [
|
|
11204
11204
|
starknet.cairo.uint256(params.offerId),
|
|
@@ -11325,7 +11325,7 @@ var SponsorshipService = class {
|
|
|
11325
11325
|
// src/starknet/client.ts
|
|
11326
11326
|
var MedialaneClient = class {
|
|
11327
11327
|
constructor(rawConfig = {}) {
|
|
11328
|
-
this.config =
|
|
11328
|
+
this.config = chunkDOIIAXHD_cjs.resolveConfig(rawConfig);
|
|
11329
11329
|
this.services = {
|
|
11330
11330
|
pop: new PopService(this.config),
|
|
11331
11331
|
drop: new DropService(this.config),
|
|
@@ -11336,9 +11336,9 @@ var MedialaneClient = class {
|
|
|
11336
11336
|
sponsorship: new SponsorshipService(this.config)
|
|
11337
11337
|
};
|
|
11338
11338
|
if (!this.config.backendUrl) {
|
|
11339
|
-
const sentinel = new
|
|
11339
|
+
const sentinel = new chunkDOIIAXHD_cjs.ApiClient("https://medialane-sdk-no-backend.invalid", this.config.apiKey);
|
|
11340
11340
|
const apiMethodNames = new Set(
|
|
11341
|
-
Object.getOwnPropertyNames(
|
|
11341
|
+
Object.getOwnPropertyNames(chunkDOIIAXHD_cjs.ApiClient.prototype).filter(
|
|
11342
11342
|
(k) => k !== "constructor" && typeof sentinel[k] === "function"
|
|
11343
11343
|
)
|
|
11344
11344
|
);
|
|
@@ -11355,7 +11355,7 @@ var MedialaneClient = class {
|
|
|
11355
11355
|
}
|
|
11356
11356
|
});
|
|
11357
11357
|
} else {
|
|
11358
|
-
this.api = new
|
|
11358
|
+
this.api = new chunkDOIIAXHD_cjs.ApiClient(this.config.backendUrl, this.config.apiKey, this.config.retryOptions, this.config.chain);
|
|
11359
11359
|
}
|
|
11360
11360
|
}
|
|
11361
11361
|
get chain() {
|
|
@@ -11527,7 +11527,7 @@ function buildListingOrder(i, cfg) {
|
|
|
11527
11527
|
salt: i.salt,
|
|
11528
11528
|
counter: i.counter
|
|
11529
11529
|
};
|
|
11530
|
-
const typedData =
|
|
11530
|
+
const typedData = chunkDOIIAXHD_cjs.stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
|
|
11531
11531
|
return { orderParams, typedData };
|
|
11532
11532
|
}
|
|
11533
11533
|
function buildOfferOrder(i, cfg) {
|
|
@@ -11548,11 +11548,11 @@ function buildOfferOrder(i, cfg) {
|
|
|
11548
11548
|
salt: i.salt,
|
|
11549
11549
|
counter: i.counter
|
|
11550
11550
|
};
|
|
11551
|
-
const typedData =
|
|
11551
|
+
const typedData = chunkDOIIAXHD_cjs.stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
|
|
11552
11552
|
return { orderParams, typedData };
|
|
11553
11553
|
}
|
|
11554
11554
|
function registerPayload(orderParams, signature) {
|
|
11555
|
-
return
|
|
11555
|
+
return chunkDOIIAXHD_cjs.stringifyBigInts({
|
|
11556
11556
|
parameters: {
|
|
11557
11557
|
...orderParams,
|
|
11558
11558
|
offer: { ...orderParams.offer, item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type) },
|
|
@@ -11583,14 +11583,14 @@ function buildFulfillCalls(a, cfg) {
|
|
|
11583
11583
|
return fee ? [approve, fulfill, fee] : [approve, fulfill];
|
|
11584
11584
|
}
|
|
11585
11585
|
function buildCancelCalls(a, cfg) {
|
|
11586
|
-
const cancelRequest =
|
|
11586
|
+
const cancelRequest = chunkDOIIAXHD_cjs.stringifyBigInts({
|
|
11587
11587
|
cancelation: { order_hash: a.orderHash, offerer: a.offerer },
|
|
11588
11588
|
signature: a.signature
|
|
11589
11589
|
});
|
|
11590
11590
|
return [contractFor(cfg).populate("cancel_order", [cancelRequest])];
|
|
11591
11591
|
}
|
|
11592
11592
|
function buildCancelTypedData(orderHash, offerer, cfg) {
|
|
11593
|
-
return
|
|
11593
|
+
return chunkDOIIAXHD_cjs.stringifyBigInts(buildCancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg)));
|
|
11594
11594
|
}
|
|
11595
11595
|
function contractFor2(cfg) {
|
|
11596
11596
|
return newContract(Medialane1155ABI, cfg.marketplace1155Contract, getProvider(cfg));
|
|
@@ -11613,7 +11613,7 @@ function buildListing1155Order(i, cfg) {
|
|
|
11613
11613
|
salt: i.salt,
|
|
11614
11614
|
counter: i.counter
|
|
11615
11615
|
};
|
|
11616
|
-
const typedData =
|
|
11616
|
+
const typedData = chunkDOIIAXHD_cjs.stringifyBigInts(
|
|
11617
11617
|
build1155OrderTypedData(orderParams, getChainId(cfg))
|
|
11618
11618
|
);
|
|
11619
11619
|
return { orderParams, typedData };
|
|
@@ -11636,13 +11636,13 @@ function buildOffer1155Order(i, cfg) {
|
|
|
11636
11636
|
salt: i.salt,
|
|
11637
11637
|
counter: i.counter
|
|
11638
11638
|
};
|
|
11639
|
-
const typedData =
|
|
11639
|
+
const typedData = chunkDOIIAXHD_cjs.stringifyBigInts(
|
|
11640
11640
|
build1155OrderTypedData(orderParams, getChainId(cfg))
|
|
11641
11641
|
);
|
|
11642
11642
|
return { orderParams, typedData };
|
|
11643
11643
|
}
|
|
11644
11644
|
function registerPayload2(orderParams, signature) {
|
|
11645
|
-
return
|
|
11645
|
+
return chunkDOIIAXHD_cjs.stringifyBigInts({
|
|
11646
11646
|
parameters: {
|
|
11647
11647
|
...orderParams,
|
|
11648
11648
|
offer: { ...orderParams.offer, item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type) },
|
|
@@ -11673,14 +11673,14 @@ function buildFulfill1155Calls(a, cfg) {
|
|
|
11673
11673
|
return fee ? [approve, fulfill, fee] : [approve, fulfill];
|
|
11674
11674
|
}
|
|
11675
11675
|
function buildCancel1155Calls(a, cfg) {
|
|
11676
|
-
const cancelPayload =
|
|
11676
|
+
const cancelPayload = chunkDOIIAXHD_cjs.stringifyBigInts({
|
|
11677
11677
|
cancelation: { order_hash: a.orderHash, offerer: a.offerer },
|
|
11678
11678
|
signature: a.signature
|
|
11679
11679
|
});
|
|
11680
11680
|
return [contractFor2(cfg).populate("cancel_order", [cancelPayload])];
|
|
11681
11681
|
}
|
|
11682
11682
|
function buildCancel1155TypedData(orderHash, offerer, cfg) {
|
|
11683
|
-
return
|
|
11683
|
+
return chunkDOIIAXHD_cjs.stringifyBigInts(
|
|
11684
11684
|
build1155CancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg))
|
|
11685
11685
|
);
|
|
11686
11686
|
}
|
|
@@ -12024,14 +12024,14 @@ async function assertTransactionSucceeded(provider, txHash, retryDelaysMs = RECE
|
|
|
12024
12024
|
const receipt = await provider.getTransactionReceipt(txHash);
|
|
12025
12025
|
const status = receipt.execution_status ?? receipt.status;
|
|
12026
12026
|
if (status === "REVERTED" || status === "REJECTED") {
|
|
12027
|
-
throw new
|
|
12027
|
+
throw new chunkDOIIAXHD_cjs.UserFacingError("Transaction was submitted but reverted onchain. Please check your balance and try again.");
|
|
12028
12028
|
}
|
|
12029
12029
|
if (status) return receipt;
|
|
12030
12030
|
} catch (err) {
|
|
12031
12031
|
if (err instanceof Error && err.message.includes("reverted onchain")) throw err;
|
|
12032
12032
|
}
|
|
12033
12033
|
}
|
|
12034
|
-
throw new
|
|
12034
|
+
throw new chunkDOIIAXHD_cjs.UserFacingError("Verification timed out. Check your account for the transaction status.");
|
|
12035
12035
|
}
|
|
12036
12036
|
async function executeIntent(provider, signer, client, intent, opts = {}) {
|
|
12037
12037
|
let calls;
|
|
@@ -12084,14 +12084,14 @@ function u2563(low, high) {
|
|
|
12084
12084
|
return (BigInt(low ?? 0) + (BigInt(high ?? 0) << 128n)).toString();
|
|
12085
12085
|
}
|
|
12086
12086
|
function deployedCollectionFromReceipt(receipt, service) {
|
|
12087
|
-
const factory =
|
|
12087
|
+
const factory = chunkDOIIAXHD_cjs.getService(service)?.onchain?.STARKNET?.factoryAddress;
|
|
12088
12088
|
const { event, address } = DEPLOY_EVENTS[service];
|
|
12089
12089
|
const selector = BigInt(starknet.hash.getSelectorFromName(event));
|
|
12090
12090
|
for (const e of receipt.events ?? []) {
|
|
12091
12091
|
if (factory && !sameFelt(e.from_address, factory)) continue;
|
|
12092
12092
|
if (!sameFelt(e.keys?.[0], selector)) continue;
|
|
12093
12093
|
const value = address(e);
|
|
12094
|
-
if (value) return
|
|
12094
|
+
if (value) return chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", value);
|
|
12095
12095
|
}
|
|
12096
12096
|
return null;
|
|
12097
12097
|
}
|
|
@@ -12212,13 +12212,13 @@ function buildRemoveOwnerByGuidCall(accountAddress, ownerGuid) {
|
|
|
12212
12212
|
}
|
|
12213
12213
|
function buildDeployAccountParams(ownerPubkey, salt = 0) {
|
|
12214
12214
|
return {
|
|
12215
|
-
classHash:
|
|
12216
|
-
constructorCalldata:
|
|
12215
|
+
classHash: chunkDOIIAXHD_cjs.STARKNET_MEDIAWALLET_CLASS_HASH,
|
|
12216
|
+
constructorCalldata: chunkDOIIAXHD_cjs.ownerConstructorCalldata(ownerPubkey),
|
|
12217
12217
|
addressSalt: starknet.num.toHex(salt),
|
|
12218
|
-
contractAddress:
|
|
12218
|
+
contractAddress: chunkDOIIAXHD_cjs.computeAccountAddress(ownerPubkey, salt)
|
|
12219
12219
|
};
|
|
12220
12220
|
}
|
|
12221
|
-
var norm = (address) =>
|
|
12221
|
+
var norm = (address) => chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", address);
|
|
12222
12222
|
var SIGNER_TYPE_NAMES = ["Starknet", "Secp256k1", "Secp256r1"];
|
|
12223
12223
|
function encodeFeltArray(items) {
|
|
12224
12224
|
return [starknet.num.toHex(items.length), ...items];
|
|
@@ -12415,7 +12415,7 @@ var InvalidRecoveryKeyError = class extends Error {
|
|
|
12415
12415
|
var canonicalAddress = (address) => `0x${BigInt(address).toString(16).padStart(64, "0")}`;
|
|
12416
12416
|
function keyPair(privateKey) {
|
|
12417
12417
|
try {
|
|
12418
|
-
return
|
|
12418
|
+
return chunkDOIIAXHD_cjs.starkKeyPairFromPrivateKey(privateKey);
|
|
12419
12419
|
} catch {
|
|
12420
12420
|
throw new InvalidRecoveryKeyError();
|
|
12421
12421
|
}
|
|
@@ -12428,7 +12428,7 @@ function parseRecoveryKey(input) {
|
|
|
12428
12428
|
const trimmed = input.trim();
|
|
12429
12429
|
if (!trimmed.startsWith(PREFIX)) {
|
|
12430
12430
|
const { privateKeyHex, publicKeyHex } = keyPair(trimmed);
|
|
12431
|
-
return { walletAddress:
|
|
12431
|
+
return { walletAddress: chunkDOIIAXHD_cjs.computeAccountAddress(publicKeyHex, 0), privateKey: privateKeyHex };
|
|
12432
12432
|
}
|
|
12433
12433
|
const parts = trimmed.slice(PREFIX.length).split(":");
|
|
12434
12434
|
const [walletAddress, privateKey] = parts;
|
|
@@ -12450,7 +12450,7 @@ function describeRecoveryAction(escape) {
|
|
|
12450
12450
|
return "none";
|
|
12451
12451
|
}
|
|
12452
12452
|
function normalizeWalletAddress(address) {
|
|
12453
|
-
return
|
|
12453
|
+
return chunkDOIIAXHD_cjs.normalizeAddress("STARKNET", address);
|
|
12454
12454
|
}
|
|
12455
12455
|
function isValidStarknetAddress(address) {
|
|
12456
12456
|
try {
|
|
@@ -12495,7 +12495,7 @@ async function estimateSelfFundedFee(provider, address, calls) {
|
|
|
12495
12495
|
return { feeRaw: estimate.overall_fee, unit: estimate.unit, balanceRaw };
|
|
12496
12496
|
}
|
|
12497
12497
|
async function feeTokenBalance(provider, address, unit) {
|
|
12498
|
-
const token =
|
|
12498
|
+
const token = chunkDOIIAXHD_cjs.getTokenBySymbol(unit === "FRI" ? "STRK" : "ETH");
|
|
12499
12499
|
if (!token) throw new Error(`No fee token for unit ${unit}`);
|
|
12500
12500
|
const [low = "0x0", high = "0x0"] = await provider.callContract({
|
|
12501
12501
|
contractAddress: token.address,
|
|
@@ -12522,7 +12522,7 @@ function sponsoredExecutor(deps) {
|
|
|
12522
12522
|
{ proxyUrl: deps.proxyUrl, fetchImpl: deps.fetchImpl },
|
|
12523
12523
|
{
|
|
12524
12524
|
address: userAddress,
|
|
12525
|
-
signTypedData: async (data) =>
|
|
12525
|
+
signTypedData: async (data) => chunkDOIIAXHD_cjs.signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(data, userAddress))
|
|
12526
12526
|
},
|
|
12527
12527
|
calls,
|
|
12528
12528
|
intentIds
|
|
@@ -12583,7 +12583,7 @@ async function deploySelfFunded(input) {
|
|
|
12583
12583
|
});
|
|
12584
12584
|
const { transaction_hash } = await account.deployAccount({
|
|
12585
12585
|
classHash,
|
|
12586
|
-
constructorCalldata:
|
|
12586
|
+
constructorCalldata: chunkDOIIAXHD_cjs.ownerConstructorCalldata(input.ownerPubKey),
|
|
12587
12587
|
addressSalt: 0,
|
|
12588
12588
|
contractAddress: input.ownerAddress
|
|
12589
12589
|
});
|
|
@@ -12651,7 +12651,7 @@ async function completeDeployment(deps, onStep, options = {}) {
|
|
|
12651
12651
|
backendUrl: deps.backendUrl,
|
|
12652
12652
|
walletAddress: address,
|
|
12653
12653
|
signer: {
|
|
12654
|
-
signMessage: async (td) =>
|
|
12654
|
+
signMessage: async (td) => chunkDOIIAXHD_cjs.signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(td, address))
|
|
12655
12655
|
}
|
|
12656
12656
|
});
|
|
12657
12657
|
deps.store.notifyChange();
|
|
@@ -12750,7 +12750,7 @@ function createMediaWallet(config) {
|
|
|
12750
12750
|
};
|
|
12751
12751
|
const walletIntents = config.walletIntents ?? (async (params) => {
|
|
12752
12752
|
if (!config.backendUrl) throw new Error("This wallet has no backend url configured");
|
|
12753
|
-
const created = await new
|
|
12753
|
+
const created = await new chunkDOIIAXHD_cjs.ApiClient(config.backendUrl).createWalletManageIntent(params);
|
|
12754
12754
|
return created.data;
|
|
12755
12755
|
});
|
|
12756
12756
|
const manage = async (sealed, params) => {
|
|
@@ -12767,7 +12767,7 @@ function createMediaWallet(config) {
|
|
|
12767
12767
|
address: sealed.address,
|
|
12768
12768
|
signTypedData: async (data) => {
|
|
12769
12769
|
const privateKeyHex = await unlockOnce(sealed);
|
|
12770
|
-
return
|
|
12770
|
+
return chunkDOIIAXHD_cjs.signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(data, sealed.address));
|
|
12771
12771
|
},
|
|
12772
12772
|
execute: async (calls, opts) => {
|
|
12773
12773
|
const { transactionHash } = await run(sealed, calls, void 0, opts?.intentIds);
|
|
@@ -12808,55 +12808,55 @@ async function claimSessionWallet(api, walletAddress, deps) {
|
|
|
12808
12808
|
|
|
12809
12809
|
Object.defineProperty(exports, "InvalidStarkPrivateKeyError", {
|
|
12810
12810
|
enumerable: true,
|
|
12811
|
-
get: function () { return
|
|
12811
|
+
get: function () { return chunkDOIIAXHD_cjs.InvalidStarkPrivateKeyError; }
|
|
12812
12812
|
});
|
|
12813
12813
|
Object.defineProperty(exports, "PasskeyCancelledError", {
|
|
12814
12814
|
enumerable: true,
|
|
12815
|
-
get: function () { return
|
|
12815
|
+
get: function () { return chunkDOIIAXHD_cjs.PasskeyCancelledError; }
|
|
12816
12816
|
});
|
|
12817
12817
|
Object.defineProperty(exports, "PasskeyUnsupportedError", {
|
|
12818
12818
|
enumerable: true,
|
|
12819
|
-
get: function () { return
|
|
12819
|
+
get: function () { return chunkDOIIAXHD_cjs.PasskeyUnsupportedError; }
|
|
12820
12820
|
});
|
|
12821
12821
|
Object.defineProperty(exports, "UserFacingError", {
|
|
12822
12822
|
enumerable: true,
|
|
12823
|
-
get: function () { return
|
|
12823
|
+
get: function () { return chunkDOIIAXHD_cjs.UserFacingError; }
|
|
12824
12824
|
});
|
|
12825
12825
|
Object.defineProperty(exports, "computeAccountAddress", {
|
|
12826
12826
|
enumerable: true,
|
|
12827
|
-
get: function () { return
|
|
12827
|
+
get: function () { return chunkDOIIAXHD_cjs.computeAccountAddress; }
|
|
12828
12828
|
});
|
|
12829
12829
|
Object.defineProperty(exports, "createPasskeyOwner", {
|
|
12830
12830
|
enumerable: true,
|
|
12831
|
-
get: function () { return
|
|
12831
|
+
get: function () { return chunkDOIIAXHD_cjs.createPasskeyOwner; }
|
|
12832
12832
|
});
|
|
12833
12833
|
Object.defineProperty(exports, "deriveAesKey", {
|
|
12834
12834
|
enumerable: true,
|
|
12835
|
-
get: function () { return
|
|
12835
|
+
get: function () { return chunkDOIIAXHD_cjs.deriveAesKey; }
|
|
12836
12836
|
});
|
|
12837
12837
|
Object.defineProperty(exports, "generateStarkKeyPair", {
|
|
12838
12838
|
enumerable: true,
|
|
12839
|
-
get: function () { return
|
|
12839
|
+
get: function () { return chunkDOIIAXHD_cjs.generateStarkKeyPair; }
|
|
12840
12840
|
});
|
|
12841
12841
|
Object.defineProperty(exports, "ownerConstructorCalldata", {
|
|
12842
12842
|
enumerable: true,
|
|
12843
|
-
get: function () { return
|
|
12843
|
+
get: function () { return chunkDOIIAXHD_cjs.ownerConstructorCalldata; }
|
|
12844
12844
|
});
|
|
12845
12845
|
Object.defineProperty(exports, "sealPrivateKey", {
|
|
12846
12846
|
enumerable: true,
|
|
12847
|
-
get: function () { return
|
|
12847
|
+
get: function () { return chunkDOIIAXHD_cjs.sealPrivateKey; }
|
|
12848
12848
|
});
|
|
12849
12849
|
Object.defineProperty(exports, "signWithPrivateKey", {
|
|
12850
12850
|
enumerable: true,
|
|
12851
|
-
get: function () { return
|
|
12851
|
+
get: function () { return chunkDOIIAXHD_cjs.signWithPrivateKey; }
|
|
12852
12852
|
});
|
|
12853
12853
|
Object.defineProperty(exports, "starkKeyPairFromPrivateKey", {
|
|
12854
12854
|
enumerable: true,
|
|
12855
|
-
get: function () { return
|
|
12855
|
+
get: function () { return chunkDOIIAXHD_cjs.starkKeyPairFromPrivateKey; }
|
|
12856
12856
|
});
|
|
12857
12857
|
Object.defineProperty(exports, "unsealPrivateKey", {
|
|
12858
12858
|
enumerable: true,
|
|
12859
|
-
get: function () { return
|
|
12859
|
+
get: function () { return chunkDOIIAXHD_cjs.unsealPrivateKey; }
|
|
12860
12860
|
});
|
|
12861
12861
|
exports.COIN_MAX_SUPPLY = MAX_SUPPLY;
|
|
12862
12862
|
exports.COIN_MIN_SUPPLY = MIN_SUPPLY;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { bV as ResolvedConfig, b6 as CreatePopCollectionParams, c0 as TxResult, a_ as CreateDropParams, bd as CreateTicketParams, bF as MintTicketsParams, b2 as CreateMembershipParams, bE as MintMembershipsParams, ba as CreateSponsorshipOfferParams, bS as ProposeSponsorshipParams, k as ApiClient, bC as MedialaneConfig, bD as MedialaneErrorCode, bK as OrderDetails, R as ResolvedFeeConfig, L as ApiFundingIntent, K as ApiFundingInstructions, O as ApiFundingSubmit, Q as ApiIntentCreated, bl as DropTerms, c7 as SealedOwner, c8 as ReceiptProviderLike, c9 as WalletExecutor, ca as ExecutedTransaction, cb as PasskeyOwner, bi as CreateWalletManageIntentParams, cc as CreatedOwner } from '../errors-CZlv-DJJ.cjs';
|
|
2
|
+
export { cd as InvalidRecoveryKeyError, ce as OwnerSigner, bN as PasskeyCancelledError, cf as PasskeyConfig, bO as PasskeyUnsupportedError, bP as PasskeyUnsupportedReason, cg as RecoveryKey, c2 as UserFacingError, ch as createPasskeyOwner, ci as encodeRecoveryKey, cj as parseRecoveryKey } from '../errors-CZlv-DJJ.cjs';
|
|
3
3
|
import * as starknet from 'starknet';
|
|
4
4
|
import { AccountInterface, ProviderInterface, Call, TypedData, constants, BigNumberish, DeployAccountContractPayload, Account } from 'starknet';
|
|
5
5
|
import { V as VenueAdapter, O as OrderRef, A as AdapterTxResult, R as RegisterOrderParams, j as VenueSigner } from '../types-BTNjkUst.cjs';
|
package/dist/starknet/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { bV as ResolvedConfig, b6 as CreatePopCollectionParams, c0 as TxResult, a_ as CreateDropParams, bd as CreateTicketParams, bF as MintTicketsParams, b2 as CreateMembershipParams, bE as MintMembershipsParams, ba as CreateSponsorshipOfferParams, bS as ProposeSponsorshipParams, k as ApiClient, bC as MedialaneConfig, bD as MedialaneErrorCode, bK as OrderDetails, R as ResolvedFeeConfig, L as ApiFundingIntent, K as ApiFundingInstructions, O as ApiFundingSubmit, Q as ApiIntentCreated, bl as DropTerms, c7 as SealedOwner, c8 as ReceiptProviderLike, c9 as WalletExecutor, ca as ExecutedTransaction, cb as PasskeyOwner, bi as CreateWalletManageIntentParams, cc as CreatedOwner } from '../errors-PGCoVYdU.js';
|
|
2
|
+
export { cd as InvalidRecoveryKeyError, ce as OwnerSigner, bN as PasskeyCancelledError, cf as PasskeyConfig, bO as PasskeyUnsupportedError, bP as PasskeyUnsupportedReason, cg as RecoveryKey, c2 as UserFacingError, ch as createPasskeyOwner, ci as encodeRecoveryKey, cj as parseRecoveryKey } from '../errors-PGCoVYdU.js';
|
|
3
3
|
import * as starknet from 'starknet';
|
|
4
4
|
import { AccountInterface, ProviderInterface, Call, TypedData, constants, BigNumberish, DeployAccountContractPayload, Account } from 'starknet';
|
|
5
5
|
import { V as VenueAdapter, O as OrderRef, A as AdapterTxResult, R as RegisterOrderParams, j as VenueSigner } from '../types-BTNjkUst.js';
|
package/dist/starknet/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { normalizeAddress, collectionHref, dropHref, 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, dropHref, resolveConfig, ApiClient, UserFacingError, getService, STARKNET_MEDIAWALLET_CLASS_HASH, computeAccountAddress, ownerConstructorCalldata, getTokenBySymbol, signWithPrivateKey, stringifyBigInts, SUPPORTED_TOKENS, starkKeyPairFromPrivateKey, createFailoverFetch } from '../chunk-HUTEU22Y.js';
|
|
2
|
+
export { InvalidStarkPrivateKeyError, PasskeyCancelledError, PasskeyUnsupportedError, UserFacingError, computeAccountAddress, createPasskeyOwner, deriveAesKey, generateStarkKeyPair, ownerConstructorCalldata, sealPrivateKey, signWithPrivateKey, starkKeyPairFromPrivateKey, unsealPrivateKey } from '../chunk-HUTEU22Y.js';
|
|
3
3
|
import { getStarknetCoordinates, getCoordinates } from '../chunk-WYKCGQPN.js';
|
|
4
4
|
import { CallData, hash, cairo, RpcProvider, uint256, CairoOption, CairoOptionVariant, num, ec, validateAndParseAddress, Account, typedData, stark, byteArray, Contract, TypedDataRevision, constants, shortString } from 'starknet';
|
|
5
5
|
import { extract, expand } from '@noble/hashes/hkdf.js';
|