@medialane/sdk 0.179.0 → 0.181.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-BGURLH5G.js → chunk-BTSTG6SP.js} +32 -45
- package/dist/chunk-BTSTG6SP.js.map +1 -0
- package/dist/{chunk-46LSYJEM.cjs → chunk-EWDU2XV3.cjs} +32 -45
- package/dist/chunk-EWDU2XV3.cjs.map +1 -0
- package/dist/{errors-Bf4s_b14.d.cts → errors-Bsah998f.d.cts} +35 -17
- package/dist/{errors-D3wtOrcq.d.ts → errors-DQyz1fFP.d.ts} +35 -17
- package/dist/index.cjs +82 -87
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -7
- package/dist/index.d.ts +5 -7
- package/dist/index.js +8 -13
- package/dist/index.js.map +1 -1
- package/dist/starknet/index.cjs +100 -76
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +3 -3
- package/dist/starknet/index.d.ts +3 -3
- package/dist/starknet/index.js +32 -9
- package/dist/starknet/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-46LSYJEM.cjs.map +0 -1
- package/dist/chunk-BGURLH5G.js.map +0 -1
package/dist/starknet/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkEWDU2XV3_cjs = require('../chunk-EWDU2XV3.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 = chunkEWDU2XV3_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: chunkEWDU2XV3_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) => chunkEWDU2XV3_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}${chunkEWDU2XV3_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 = chunkEWDU2XV3_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) => chunkEWDU2XV3_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: chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", collection),
|
|
10527
10527
|
entrypoint: "has_claimed",
|
|
10528
|
-
calldata: [
|
|
10528
|
+
calldata: [chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", address)]
|
|
10529
10529
|
});
|
|
10530
10530
|
return BigInt(res[0] ?? "0x0") !== 0n;
|
|
10531
10531
|
}
|
|
@@ -10547,7 +10547,7 @@ function buildFeeCall(p, cfg) {
|
|
|
10547
10547
|
};
|
|
10548
10548
|
}
|
|
10549
10549
|
var DROP_MAX_CLAIM_QUANTITY = 50n;
|
|
10550
|
-
var addr2 = (a) =>
|
|
10550
|
+
var addr2 = (a) => chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", a);
|
|
10551
10551
|
var factoryData = new starknet.CallData(DropFactoryABI);
|
|
10552
10552
|
var collectionData = new starknet.CallData(DropCollectionABI);
|
|
10553
10553
|
function toContractTerms(t) {
|
|
@@ -10617,7 +10617,7 @@ function dropMintCost(price, quantity, feeBps2) {
|
|
|
10617
10617
|
}
|
|
10618
10618
|
|
|
10619
10619
|
// src/starknet/drop-state.ts
|
|
10620
|
-
var hex = (v) =>
|
|
10620
|
+
var hex = (v) => chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", v ?? "0x0");
|
|
10621
10621
|
var u256 = (low, high) => BigInt(low ?? "0x0") + (BigInt(high ?? "0x0") << 128n);
|
|
10622
10622
|
async function readDrop(provider, collection) {
|
|
10623
10623
|
const contractAddress = hex(collection);
|
|
@@ -10672,7 +10672,7 @@ function dropMintState(input) {
|
|
|
10672
10672
|
return { state: "ready", maxQuantity: max };
|
|
10673
10673
|
}
|
|
10674
10674
|
function dropClaimLinks(origin, collection, list) {
|
|
10675
|
-
const base = `${origin}${
|
|
10675
|
+
const base = `${origin}${chunkEWDU2XV3_cjs.dropHref(collection)}`;
|
|
10676
10676
|
return Object.entries(list.proofs).map(([address, proof]) => ({
|
|
10677
10677
|
address,
|
|
10678
10678
|
url: `${base}${encodePopClaimFragment(proof)}`
|
|
@@ -10724,14 +10724,14 @@ var ERC1155CollectionService = class {
|
|
|
10724
10724
|
_factory(account) {
|
|
10725
10725
|
return newContract(
|
|
10726
10726
|
IPCollection1155FactoryABI,
|
|
10727
|
-
|
|
10727
|
+
chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", this.factoryAddress),
|
|
10728
10728
|
account
|
|
10729
10729
|
);
|
|
10730
10730
|
}
|
|
10731
10731
|
_collection(address, account) {
|
|
10732
10732
|
return newContract(
|
|
10733
10733
|
IPCollection1155ABI,
|
|
10734
|
-
|
|
10734
|
+
chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", address),
|
|
10735
10735
|
account
|
|
10736
10736
|
);
|
|
10737
10737
|
}
|
|
@@ -10959,20 +10959,20 @@ function buildLaunchOnEkuboCalls(params) {
|
|
|
10959
10959
|
}
|
|
10960
10960
|
var CREATOR_COIN_CREATED_SELECTOR = starknet.hash.getSelectorFromName("CreatorCoinCreated");
|
|
10961
10961
|
function parseCreatorCoinCreated(receipt) {
|
|
10962
|
-
const factory =
|
|
10962
|
+
const factory = chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", chunkVJVBWHAD_cjs.getStarknetCoordinates("STARKNET").creatorCoinFactory);
|
|
10963
10963
|
for (const ev of receipt?.events ?? []) {
|
|
10964
10964
|
let from;
|
|
10965
10965
|
try {
|
|
10966
|
-
from =
|
|
10966
|
+
from = chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", ev.from_address ?? "");
|
|
10967
10967
|
} catch {
|
|
10968
10968
|
continue;
|
|
10969
10969
|
}
|
|
10970
10970
|
if (from !== factory) continue;
|
|
10971
10971
|
const k0 = ev.keys?.[0];
|
|
10972
|
-
if (!k0 ||
|
|
10972
|
+
if (!k0 || chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", k0) !== chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", CREATOR_COIN_CREATED_SELECTOR)) continue;
|
|
10973
10973
|
const data = ev.data ?? [];
|
|
10974
10974
|
if (data.length < 1) continue;
|
|
10975
|
-
return
|
|
10975
|
+
return chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", data[data.length - 1]);
|
|
10976
10976
|
}
|
|
10977
10977
|
throw new Error("Coin deployed but the coin address could not be read from the receipt");
|
|
10978
10978
|
}
|
|
@@ -11008,14 +11008,14 @@ var TicketService = class {
|
|
|
11008
11008
|
_factory(account, factoryAddress) {
|
|
11009
11009
|
const address = factoryAddress ?? this.factoryAddress;
|
|
11010
11010
|
if (!address) throw new Error("IP-Tickets factory address not configured for this chain");
|
|
11011
|
-
return newContract(IPTicketCollectionFactoryABI,
|
|
11011
|
+
return newContract(IPTicketCollectionFactoryABI, chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", address), account);
|
|
11012
11012
|
}
|
|
11013
11013
|
_collection(address, account) {
|
|
11014
|
-
return newContract(IPTicketCollectionABI,
|
|
11014
|
+
return newContract(IPTicketCollectionABI, chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", address), account);
|
|
11015
11015
|
}
|
|
11016
11016
|
_collectionRead(address) {
|
|
11017
11017
|
const provider = new starknet.RpcProvider({ nodeUrl: this.config.rpcUrl });
|
|
11018
|
-
return newContract(IPTicketCollectionABI,
|
|
11018
|
+
return newContract(IPTicketCollectionABI, chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", address), provider);
|
|
11019
11019
|
}
|
|
11020
11020
|
async deployCollection(account, params) {
|
|
11021
11021
|
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
@@ -11081,14 +11081,14 @@ var ClubService = class {
|
|
|
11081
11081
|
_factory(account, factoryAddress) {
|
|
11082
11082
|
const address = factoryAddress ?? this.factoryAddress;
|
|
11083
11083
|
if (!address) throw new Error("IP-Club factory address not configured for this chain");
|
|
11084
|
-
return newContract(IPClubFactoryABI,
|
|
11084
|
+
return newContract(IPClubFactoryABI, chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", address), account);
|
|
11085
11085
|
}
|
|
11086
11086
|
_collection(address, account) {
|
|
11087
|
-
return newContract(IPClubCollectionABI,
|
|
11087
|
+
return newContract(IPClubCollectionABI, chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", address), account);
|
|
11088
11088
|
}
|
|
11089
11089
|
_collectionRead(address) {
|
|
11090
11090
|
const provider = new starknet.RpcProvider({ nodeUrl: this.config.rpcUrl });
|
|
11091
|
-
return newContract(IPClubCollectionABI,
|
|
11091
|
+
return newContract(IPClubCollectionABI, chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", address), provider);
|
|
11092
11092
|
}
|
|
11093
11093
|
async deployCollection(account, params) {
|
|
11094
11094
|
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
@@ -11158,7 +11158,7 @@ var SponsorshipService = class {
|
|
|
11158
11158
|
if (!resolved) {
|
|
11159
11159
|
throw new Error("IP-Sponsorship address not configured for this chain");
|
|
11160
11160
|
}
|
|
11161
|
-
return newContract(IPSponsorshipABI,
|
|
11161
|
+
return newContract(IPSponsorshipABI, chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", resolved), account);
|
|
11162
11162
|
}
|
|
11163
11163
|
_contractRead(address) {
|
|
11164
11164
|
const resolved = address ?? this.sponsorshipAddress;
|
|
@@ -11166,7 +11166,7 @@ var SponsorshipService = class {
|
|
|
11166
11166
|
throw new Error("IP-Sponsorship address not configured for this chain");
|
|
11167
11167
|
}
|
|
11168
11168
|
const provider = new starknet.RpcProvider({ nodeUrl: this.config.rpcUrl });
|
|
11169
|
-
return newContract(IPSponsorshipABI,
|
|
11169
|
+
return newContract(IPSponsorshipABI, chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", resolved), provider);
|
|
11170
11170
|
}
|
|
11171
11171
|
async createOffer(account, params) {
|
|
11172
11172
|
const specificSponsor = params.specificSponsor ? new starknet.CairoOption(starknet.CairoOptionVariant.Some, params.specificSponsor) : new starknet.CairoOption(starknet.CairoOptionVariant.None);
|
|
@@ -11201,7 +11201,7 @@ var SponsorshipService = class {
|
|
|
11201
11201
|
const approveCall = {
|
|
11202
11202
|
contractAddress: params.paymentToken,
|
|
11203
11203
|
entrypoint: "approve",
|
|
11204
|
-
calldata: [
|
|
11204
|
+
calldata: [chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", sponsorshipAddress), amount.low.toString(), amount.high.toString()]
|
|
11205
11205
|
};
|
|
11206
11206
|
const bidCall = this._contract(account, sponsorshipAddress).populate("place_bid", [
|
|
11207
11207
|
starknet.cairo.uint256(params.offerId),
|
|
@@ -11328,7 +11328,7 @@ var SponsorshipService = class {
|
|
|
11328
11328
|
// src/starknet/client.ts
|
|
11329
11329
|
var MedialaneClient = class {
|
|
11330
11330
|
constructor(rawConfig = {}) {
|
|
11331
|
-
this.config =
|
|
11331
|
+
this.config = chunkEWDU2XV3_cjs.resolveConfig(rawConfig);
|
|
11332
11332
|
this.services = {
|
|
11333
11333
|
pop: new PopService(this.config),
|
|
11334
11334
|
drop: new DropService(this.config),
|
|
@@ -11339,9 +11339,9 @@ var MedialaneClient = class {
|
|
|
11339
11339
|
sponsorship: new SponsorshipService(this.config)
|
|
11340
11340
|
};
|
|
11341
11341
|
if (!this.config.backendUrl) {
|
|
11342
|
-
const sentinel = new
|
|
11342
|
+
const sentinel = new chunkEWDU2XV3_cjs.ApiClient("https://medialane-sdk-no-backend.invalid", this.config.apiKey);
|
|
11343
11343
|
const apiMethodNames = new Set(
|
|
11344
|
-
Object.getOwnPropertyNames(
|
|
11344
|
+
Object.getOwnPropertyNames(chunkEWDU2XV3_cjs.ApiClient.prototype).filter(
|
|
11345
11345
|
(k) => k !== "constructor" && typeof sentinel[k] === "function"
|
|
11346
11346
|
)
|
|
11347
11347
|
);
|
|
@@ -11358,7 +11358,7 @@ var MedialaneClient = class {
|
|
|
11358
11358
|
}
|
|
11359
11359
|
});
|
|
11360
11360
|
} else {
|
|
11361
|
-
this.api = new
|
|
11361
|
+
this.api = new chunkEWDU2XV3_cjs.ApiClient(this.config.backendUrl, this.config.apiKey, this.config.retryOptions, this.config.chain);
|
|
11362
11362
|
}
|
|
11363
11363
|
}
|
|
11364
11364
|
get chain() {
|
|
@@ -11530,7 +11530,7 @@ function buildListingOrder(i, cfg) {
|
|
|
11530
11530
|
salt: i.salt,
|
|
11531
11531
|
counter: i.counter
|
|
11532
11532
|
};
|
|
11533
|
-
const typedData =
|
|
11533
|
+
const typedData = chunkEWDU2XV3_cjs.stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
|
|
11534
11534
|
return { orderParams, typedData };
|
|
11535
11535
|
}
|
|
11536
11536
|
function buildOfferOrder(i, cfg) {
|
|
@@ -11551,11 +11551,11 @@ function buildOfferOrder(i, cfg) {
|
|
|
11551
11551
|
salt: i.salt,
|
|
11552
11552
|
counter: i.counter
|
|
11553
11553
|
};
|
|
11554
|
-
const typedData =
|
|
11554
|
+
const typedData = chunkEWDU2XV3_cjs.stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
|
|
11555
11555
|
return { orderParams, typedData };
|
|
11556
11556
|
}
|
|
11557
11557
|
function registerPayload(orderParams, signature) {
|
|
11558
|
-
return
|
|
11558
|
+
return chunkEWDU2XV3_cjs.stringifyBigInts({
|
|
11559
11559
|
parameters: {
|
|
11560
11560
|
...orderParams,
|
|
11561
11561
|
offer: { ...orderParams.offer, item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type) },
|
|
@@ -11586,14 +11586,14 @@ function buildFulfillCalls(a, cfg) {
|
|
|
11586
11586
|
return fee ? [approve, fulfill, fee] : [approve, fulfill];
|
|
11587
11587
|
}
|
|
11588
11588
|
function buildCancelCalls(a, cfg) {
|
|
11589
|
-
const cancelRequest =
|
|
11589
|
+
const cancelRequest = chunkEWDU2XV3_cjs.stringifyBigInts({
|
|
11590
11590
|
cancelation: { order_hash: a.orderHash, offerer: a.offerer },
|
|
11591
11591
|
signature: a.signature
|
|
11592
11592
|
});
|
|
11593
11593
|
return [contractFor(cfg).populate("cancel_order", [cancelRequest])];
|
|
11594
11594
|
}
|
|
11595
11595
|
function buildCancelTypedData(orderHash, offerer, cfg) {
|
|
11596
|
-
return
|
|
11596
|
+
return chunkEWDU2XV3_cjs.stringifyBigInts(buildCancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg)));
|
|
11597
11597
|
}
|
|
11598
11598
|
function contractFor2(cfg) {
|
|
11599
11599
|
return newContract(Medialane1155ABI, cfg.marketplace1155Contract, getProvider(cfg));
|
|
@@ -11616,7 +11616,7 @@ function buildListing1155Order(i, cfg) {
|
|
|
11616
11616
|
salt: i.salt,
|
|
11617
11617
|
counter: i.counter
|
|
11618
11618
|
};
|
|
11619
|
-
const typedData =
|
|
11619
|
+
const typedData = chunkEWDU2XV3_cjs.stringifyBigInts(
|
|
11620
11620
|
build1155OrderTypedData(orderParams, getChainId(cfg))
|
|
11621
11621
|
);
|
|
11622
11622
|
return { orderParams, typedData };
|
|
@@ -11639,13 +11639,13 @@ function buildOffer1155Order(i, cfg) {
|
|
|
11639
11639
|
salt: i.salt,
|
|
11640
11640
|
counter: i.counter
|
|
11641
11641
|
};
|
|
11642
|
-
const typedData =
|
|
11642
|
+
const typedData = chunkEWDU2XV3_cjs.stringifyBigInts(
|
|
11643
11643
|
build1155OrderTypedData(orderParams, getChainId(cfg))
|
|
11644
11644
|
);
|
|
11645
11645
|
return { orderParams, typedData };
|
|
11646
11646
|
}
|
|
11647
11647
|
function registerPayload2(orderParams, signature) {
|
|
11648
|
-
return
|
|
11648
|
+
return chunkEWDU2XV3_cjs.stringifyBigInts({
|
|
11649
11649
|
parameters: {
|
|
11650
11650
|
...orderParams,
|
|
11651
11651
|
offer: { ...orderParams.offer, item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type) },
|
|
@@ -11676,14 +11676,14 @@ function buildFulfill1155Calls(a, cfg) {
|
|
|
11676
11676
|
return fee ? [approve, fulfill, fee] : [approve, fulfill];
|
|
11677
11677
|
}
|
|
11678
11678
|
function buildCancel1155Calls(a, cfg) {
|
|
11679
|
-
const cancelPayload =
|
|
11679
|
+
const cancelPayload = chunkEWDU2XV3_cjs.stringifyBigInts({
|
|
11680
11680
|
cancelation: { order_hash: a.orderHash, offerer: a.offerer },
|
|
11681
11681
|
signature: a.signature
|
|
11682
11682
|
});
|
|
11683
11683
|
return [contractFor2(cfg).populate("cancel_order", [cancelPayload])];
|
|
11684
11684
|
}
|
|
11685
11685
|
function buildCancel1155TypedData(orderHash, offerer, cfg) {
|
|
11686
|
-
return
|
|
11686
|
+
return chunkEWDU2XV3_cjs.stringifyBigInts(
|
|
11687
11687
|
build1155CancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg))
|
|
11688
11688
|
);
|
|
11689
11689
|
}
|
|
@@ -11956,6 +11956,29 @@ async function signInWithWallet(args) {
|
|
|
11956
11956
|
}
|
|
11957
11957
|
}
|
|
11958
11958
|
|
|
11959
|
+
// src/starknet/api-key-confirmation.ts
|
|
11960
|
+
function apiKeyConfirmationTypedData(input) {
|
|
11961
|
+
return {
|
|
11962
|
+
domain: { name: "Medialane", version: "1", chainId: "SN_MAIN", revision: "1" },
|
|
11963
|
+
primaryType: "ApiKeyConfirmation",
|
|
11964
|
+
types: {
|
|
11965
|
+
StarknetDomain: [
|
|
11966
|
+
{ name: "name", type: "shortstring" },
|
|
11967
|
+
{ name: "version", type: "shortstring" },
|
|
11968
|
+
{ name: "chainId", type: "shortstring" },
|
|
11969
|
+
{ name: "revision", type: "shortstring" }
|
|
11970
|
+
],
|
|
11971
|
+
ApiKeyConfirmation: [
|
|
11972
|
+
{ name: "action", type: "shortstring" },
|
|
11973
|
+
{ name: "key", type: "string" },
|
|
11974
|
+
{ name: "account", type: "string" },
|
|
11975
|
+
{ name: "expiresAt", type: "timestamp" }
|
|
11976
|
+
]
|
|
11977
|
+
},
|
|
11978
|
+
message: { action: input.action, key: input.key, account: input.account, expiresAt: input.expiresAt }
|
|
11979
|
+
};
|
|
11980
|
+
}
|
|
11981
|
+
|
|
11959
11982
|
// src/starknet/funding/chain-transfer.ts
|
|
11960
11983
|
var FundingTransferNotSentError = class extends Error {
|
|
11961
11984
|
constructor(message = "The transfer was not sent.") {
|
|
@@ -11963,13 +11986,13 @@ var FundingTransferNotSentError = class extends Error {
|
|
|
11963
11986
|
this.name = "FundingTransferNotSentError";
|
|
11964
11987
|
}
|
|
11965
11988
|
};
|
|
11966
|
-
function fundingApiFor(client
|
|
11989
|
+
function fundingApiFor(client) {
|
|
11967
11990
|
return {
|
|
11968
|
-
createFunding: (input) => client.createFunding(input
|
|
11969
|
-
getFundingChallenge: (id, payer) => client.getFundingChallenge(id, payer
|
|
11970
|
-
authorizeFunding: (id, input) => client.authorizeFunding(id, input
|
|
11971
|
-
submitFunding: (id, txHash) => client.submitFunding(id, txHash
|
|
11972
|
-
cancelFunding: (id) => client.cancelFunding(id
|
|
11991
|
+
createFunding: (input) => client.createFunding(input),
|
|
11992
|
+
getFundingChallenge: (id, payer) => client.getFundingChallenge(id, payer),
|
|
11993
|
+
authorizeFunding: (id, input) => client.authorizeFunding(id, input),
|
|
11994
|
+
submitFunding: (id, txHash) => client.submitFunding(id, txHash),
|
|
11995
|
+
cancelFunding: (id) => client.cancelFunding(id)
|
|
11973
11996
|
};
|
|
11974
11997
|
}
|
|
11975
11998
|
function buildFundingTransferCall(instructions) {
|
|
@@ -12049,14 +12072,14 @@ async function assertTransactionSucceeded(provider, txHash, retryDelaysMs = RECE
|
|
|
12049
12072
|
const receipt = await provider.getTransactionReceipt(txHash);
|
|
12050
12073
|
const status = receipt.execution_status ?? receipt.status;
|
|
12051
12074
|
if (status === "REVERTED" || status === "REJECTED") {
|
|
12052
|
-
throw new
|
|
12075
|
+
throw new chunkEWDU2XV3_cjs.UserFacingError("Transaction was submitted but reverted onchain. Please check your balance and try again.");
|
|
12053
12076
|
}
|
|
12054
12077
|
if (status) return receipt;
|
|
12055
12078
|
} catch (err) {
|
|
12056
12079
|
if (err instanceof Error && err.message.includes("reverted onchain")) throw err;
|
|
12057
12080
|
}
|
|
12058
12081
|
}
|
|
12059
|
-
throw new
|
|
12082
|
+
throw new chunkEWDU2XV3_cjs.UserFacingError("Verification timed out. Check your account for the transaction status.");
|
|
12060
12083
|
}
|
|
12061
12084
|
async function executeIntent(provider, signer, client, intent, opts = {}) {
|
|
12062
12085
|
let calls;
|
|
@@ -12109,14 +12132,14 @@ function u2563(low, high) {
|
|
|
12109
12132
|
return (BigInt(low ?? 0) + (BigInt(high ?? 0) << 128n)).toString();
|
|
12110
12133
|
}
|
|
12111
12134
|
function deployedCollectionFromReceipt(receipt, service) {
|
|
12112
|
-
const factory =
|
|
12135
|
+
const factory = chunkEWDU2XV3_cjs.getService(service)?.onchain?.STARKNET?.factoryAddress;
|
|
12113
12136
|
const { event, address } = DEPLOY_EVENTS[service];
|
|
12114
12137
|
const selector = BigInt(starknet.hash.getSelectorFromName(event));
|
|
12115
12138
|
for (const e of receipt.events ?? []) {
|
|
12116
12139
|
if (factory && !sameFelt(e.from_address, factory)) continue;
|
|
12117
12140
|
if (!sameFelt(e.keys?.[0], selector)) continue;
|
|
12118
12141
|
const value = address(e);
|
|
12119
|
-
if (value) return
|
|
12142
|
+
if (value) return chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", value);
|
|
12120
12143
|
}
|
|
12121
12144
|
return null;
|
|
12122
12145
|
}
|
|
@@ -12237,13 +12260,13 @@ function buildRemoveOwnerByGuidCall(accountAddress, ownerGuid) {
|
|
|
12237
12260
|
}
|
|
12238
12261
|
function buildDeployAccountParams(ownerPubkey, salt = 0) {
|
|
12239
12262
|
return {
|
|
12240
|
-
classHash:
|
|
12241
|
-
constructorCalldata:
|
|
12263
|
+
classHash: chunkEWDU2XV3_cjs.STARKNET_MEDIAWALLET_CLASS_HASH,
|
|
12264
|
+
constructorCalldata: chunkEWDU2XV3_cjs.ownerConstructorCalldata(ownerPubkey),
|
|
12242
12265
|
addressSalt: starknet.num.toHex(salt),
|
|
12243
|
-
contractAddress:
|
|
12266
|
+
contractAddress: chunkEWDU2XV3_cjs.computeAccountAddress(ownerPubkey, salt)
|
|
12244
12267
|
};
|
|
12245
12268
|
}
|
|
12246
|
-
var norm = (address) =>
|
|
12269
|
+
var norm = (address) => chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", address);
|
|
12247
12270
|
var SIGNER_TYPE_NAMES = ["Starknet", "Secp256k1", "Secp256r1"];
|
|
12248
12271
|
function encodeFeltArray(items) {
|
|
12249
12272
|
return [starknet.num.toHex(items.length), ...items];
|
|
@@ -12440,7 +12463,7 @@ var InvalidRecoveryKeyError = class extends Error {
|
|
|
12440
12463
|
var canonicalAddress = (address) => `0x${BigInt(address).toString(16).padStart(64, "0")}`;
|
|
12441
12464
|
function keyPair(privateKey) {
|
|
12442
12465
|
try {
|
|
12443
|
-
return
|
|
12466
|
+
return chunkEWDU2XV3_cjs.starkKeyPairFromPrivateKey(privateKey);
|
|
12444
12467
|
} catch {
|
|
12445
12468
|
throw new InvalidRecoveryKeyError();
|
|
12446
12469
|
}
|
|
@@ -12453,7 +12476,7 @@ function parseRecoveryKey(input) {
|
|
|
12453
12476
|
const trimmed = input.trim();
|
|
12454
12477
|
if (!trimmed.startsWith(PREFIX)) {
|
|
12455
12478
|
const { privateKeyHex, publicKeyHex } = keyPair(trimmed);
|
|
12456
|
-
return { walletAddress:
|
|
12479
|
+
return { walletAddress: chunkEWDU2XV3_cjs.computeAccountAddress(publicKeyHex, 0), privateKey: privateKeyHex };
|
|
12457
12480
|
}
|
|
12458
12481
|
const parts = trimmed.slice(PREFIX.length).split(":");
|
|
12459
12482
|
const [walletAddress, privateKey] = parts;
|
|
@@ -12475,7 +12498,7 @@ function describeRecoveryAction(escape) {
|
|
|
12475
12498
|
return "none";
|
|
12476
12499
|
}
|
|
12477
12500
|
function normalizeWalletAddress(address) {
|
|
12478
|
-
return
|
|
12501
|
+
return chunkEWDU2XV3_cjs.normalizeAddress("STARKNET", address);
|
|
12479
12502
|
}
|
|
12480
12503
|
function isValidStarknetAddress(address) {
|
|
12481
12504
|
try {
|
|
@@ -12520,7 +12543,7 @@ async function estimateSelfFundedFee(provider, address, calls) {
|
|
|
12520
12543
|
return { feeRaw: estimate.overall_fee, unit: estimate.unit, balanceRaw };
|
|
12521
12544
|
}
|
|
12522
12545
|
async function feeTokenBalance(provider, address, unit) {
|
|
12523
|
-
const token =
|
|
12546
|
+
const token = chunkEWDU2XV3_cjs.getTokenBySymbol(unit === "FRI" ? "STRK" : "ETH");
|
|
12524
12547
|
if (!token) throw new Error(`No fee token for unit ${unit}`);
|
|
12525
12548
|
const [low = "0x0", high = "0x0"] = await provider.callContract({
|
|
12526
12549
|
contractAddress: token.address,
|
|
@@ -12552,7 +12575,7 @@ function sponsoredExecutor(deps) {
|
|
|
12552
12575
|
{ proxyUrl: deps.proxyUrl, fetchImpl: deps.fetchImpl },
|
|
12553
12576
|
{
|
|
12554
12577
|
address: userAddress,
|
|
12555
|
-
signTypedData: async (data) =>
|
|
12578
|
+
signTypedData: async (data) => chunkEWDU2XV3_cjs.signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(data, userAddress))
|
|
12556
12579
|
},
|
|
12557
12580
|
{ intentIds }
|
|
12558
12581
|
);
|
|
@@ -12612,7 +12635,7 @@ async function deploySelfFunded(input) {
|
|
|
12612
12635
|
});
|
|
12613
12636
|
const { transaction_hash } = await account.deployAccount({
|
|
12614
12637
|
classHash,
|
|
12615
|
-
constructorCalldata:
|
|
12638
|
+
constructorCalldata: chunkEWDU2XV3_cjs.ownerConstructorCalldata(input.ownerPubKey),
|
|
12616
12639
|
addressSalt: 0,
|
|
12617
12640
|
contractAddress: input.ownerAddress
|
|
12618
12641
|
});
|
|
@@ -12768,7 +12791,7 @@ function createMediaWallet(config) {
|
|
|
12768
12791
|
};
|
|
12769
12792
|
const walletIntents = config.walletIntents ?? (async (params) => {
|
|
12770
12793
|
if (!config.backendUrl) throw new Error("This wallet has no backend url configured");
|
|
12771
|
-
const created = await new
|
|
12794
|
+
const created = await new chunkEWDU2XV3_cjs.ApiClient(config.backendUrl).createWalletManageIntent(params);
|
|
12772
12795
|
return created.data;
|
|
12773
12796
|
});
|
|
12774
12797
|
const manage = async (sealed, params) => {
|
|
@@ -12785,7 +12808,7 @@ function createMediaWallet(config) {
|
|
|
12785
12808
|
address: sealed.address,
|
|
12786
12809
|
signTypedData: async (data) => {
|
|
12787
12810
|
const privateKeyHex = await unlockOnce(sealed);
|
|
12788
|
-
return
|
|
12811
|
+
return chunkEWDU2XV3_cjs.signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(data, sealed.address));
|
|
12789
12812
|
},
|
|
12790
12813
|
execute: async (calls, opts) => {
|
|
12791
12814
|
const { transactionHash } = await run(sealed, calls, void 0, opts?.intentIds);
|
|
@@ -12826,55 +12849,55 @@ async function claimSessionWallet(api, walletAddress, deps) {
|
|
|
12826
12849
|
|
|
12827
12850
|
Object.defineProperty(exports, "InvalidStarkPrivateKeyError", {
|
|
12828
12851
|
enumerable: true,
|
|
12829
|
-
get: function () { return
|
|
12852
|
+
get: function () { return chunkEWDU2XV3_cjs.InvalidStarkPrivateKeyError; }
|
|
12830
12853
|
});
|
|
12831
12854
|
Object.defineProperty(exports, "PasskeyCancelledError", {
|
|
12832
12855
|
enumerable: true,
|
|
12833
|
-
get: function () { return
|
|
12856
|
+
get: function () { return chunkEWDU2XV3_cjs.PasskeyCancelledError; }
|
|
12834
12857
|
});
|
|
12835
12858
|
Object.defineProperty(exports, "PasskeyUnsupportedError", {
|
|
12836
12859
|
enumerable: true,
|
|
12837
|
-
get: function () { return
|
|
12860
|
+
get: function () { return chunkEWDU2XV3_cjs.PasskeyUnsupportedError; }
|
|
12838
12861
|
});
|
|
12839
12862
|
Object.defineProperty(exports, "UserFacingError", {
|
|
12840
12863
|
enumerable: true,
|
|
12841
|
-
get: function () { return
|
|
12864
|
+
get: function () { return chunkEWDU2XV3_cjs.UserFacingError; }
|
|
12842
12865
|
});
|
|
12843
12866
|
Object.defineProperty(exports, "computeAccountAddress", {
|
|
12844
12867
|
enumerable: true,
|
|
12845
|
-
get: function () { return
|
|
12868
|
+
get: function () { return chunkEWDU2XV3_cjs.computeAccountAddress; }
|
|
12846
12869
|
});
|
|
12847
12870
|
Object.defineProperty(exports, "createPasskeyOwner", {
|
|
12848
12871
|
enumerable: true,
|
|
12849
|
-
get: function () { return
|
|
12872
|
+
get: function () { return chunkEWDU2XV3_cjs.createPasskeyOwner; }
|
|
12850
12873
|
});
|
|
12851
12874
|
Object.defineProperty(exports, "deriveAesKey", {
|
|
12852
12875
|
enumerable: true,
|
|
12853
|
-
get: function () { return
|
|
12876
|
+
get: function () { return chunkEWDU2XV3_cjs.deriveAesKey; }
|
|
12854
12877
|
});
|
|
12855
12878
|
Object.defineProperty(exports, "generateStarkKeyPair", {
|
|
12856
12879
|
enumerable: true,
|
|
12857
|
-
get: function () { return
|
|
12880
|
+
get: function () { return chunkEWDU2XV3_cjs.generateStarkKeyPair; }
|
|
12858
12881
|
});
|
|
12859
12882
|
Object.defineProperty(exports, "ownerConstructorCalldata", {
|
|
12860
12883
|
enumerable: true,
|
|
12861
|
-
get: function () { return
|
|
12884
|
+
get: function () { return chunkEWDU2XV3_cjs.ownerConstructorCalldata; }
|
|
12862
12885
|
});
|
|
12863
12886
|
Object.defineProperty(exports, "sealPrivateKey", {
|
|
12864
12887
|
enumerable: true,
|
|
12865
|
-
get: function () { return
|
|
12888
|
+
get: function () { return chunkEWDU2XV3_cjs.sealPrivateKey; }
|
|
12866
12889
|
});
|
|
12867
12890
|
Object.defineProperty(exports, "signWithPrivateKey", {
|
|
12868
12891
|
enumerable: true,
|
|
12869
|
-
get: function () { return
|
|
12892
|
+
get: function () { return chunkEWDU2XV3_cjs.signWithPrivateKey; }
|
|
12870
12893
|
});
|
|
12871
12894
|
Object.defineProperty(exports, "starkKeyPairFromPrivateKey", {
|
|
12872
12895
|
enumerable: true,
|
|
12873
|
-
get: function () { return
|
|
12896
|
+
get: function () { return chunkEWDU2XV3_cjs.starkKeyPairFromPrivateKey; }
|
|
12874
12897
|
});
|
|
12875
12898
|
Object.defineProperty(exports, "unsealPrivateKey", {
|
|
12876
12899
|
enumerable: true,
|
|
12877
|
-
get: function () { return
|
|
12900
|
+
get: function () { return chunkEWDU2XV3_cjs.unsealPrivateKey; }
|
|
12878
12901
|
});
|
|
12879
12902
|
exports.COIN_MAX_SUPPLY = MAX_SUPPLY;
|
|
12880
12903
|
exports.COIN_MIN_SUPPLY = MIN_SUPPLY;
|
|
@@ -12916,6 +12939,7 @@ exports.TicketService = TicketService;
|
|
|
12916
12939
|
exports.VALIDATED_EKUBO_PARAMS = VALIDATED_EKUBO_PARAMS;
|
|
12917
12940
|
exports.accountFor = accountFor;
|
|
12918
12941
|
exports.allowsFallbackFunding = allowsFallbackFunding;
|
|
12942
|
+
exports.apiKeyConfirmationTypedData = apiKeyConfirmationTypedData;
|
|
12919
12943
|
exports.assertTransactionSucceeded = assertTransactionSucceeded;
|
|
12920
12944
|
exports.build1155CancellationTypedData = build1155CancellationTypedData;
|
|
12921
12945
|
exports.build1155OrderTypedData = build1155OrderTypedData;
|