@medialane/sdk 0.182.0 → 0.184.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-JZXIZGHW.js → chunk-6KFXIVA6.js} +7 -2
- package/dist/chunk-6KFXIVA6.js.map +1 -0
- package/dist/{chunk-F5USCCM4.cjs → chunk-RJH2Y53L.cjs} +7 -2
- package/dist/chunk-RJH2Y53L.cjs.map +1 -0
- package/dist/{errors-C3dgi8bK.d.cts → errors-CrBviXC8.d.cts} +3 -0
- package/dist/{errors-kFtjB-a3.d.ts → errors-kCrcWfrz.d.ts} +3 -0
- package/dist/index.cjs +127 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +55 -2
- package/dist/index.js.map +1 -1
- package/dist/starknet/index.cjs +85 -71
- 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 +21 -7
- package/dist/starknet/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-F5USCCM4.cjs.map +0 -1
- package/dist/chunk-JZXIZGHW.js.map +0 -1
package/dist/starknet/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkRJH2Y53L_cjs = require('../chunk-RJH2Y53L.cjs');
|
|
4
4
|
var chunk7EYJC5CB_cjs = require('../chunk-7EYJC5CB.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 = chunkRJH2Y53L_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");
|
|
@@ -10405,7 +10405,7 @@ function merkleTree(leafHashes) {
|
|
|
10405
10405
|
};
|
|
10406
10406
|
}
|
|
10407
10407
|
function buildPopAllowlist(addresses) {
|
|
10408
|
-
const unique = [...new Set(addresses.map((a) =>
|
|
10408
|
+
const unique = [...new Set(addresses.map((a) => chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", a)))];
|
|
10409
10409
|
if (unique.length === 0) throw new Error("An allowlist needs at least one address");
|
|
10410
10410
|
const leaves = unique.map((address) => ({ address, leaf: popLeafHash(address) }));
|
|
10411
10411
|
const tree = merkleTree(leaves.map((l) => l.leaf));
|
|
@@ -10431,7 +10431,7 @@ function decodePopClaimFragment(fragment) {
|
|
|
10431
10431
|
|
|
10432
10432
|
// src/starknet/pop-claim.ts
|
|
10433
10433
|
function popClaimLinks(origin, collection, list) {
|
|
10434
|
-
const base = `${origin}${
|
|
10434
|
+
const base = `${origin}${chunkRJH2Y53L_cjs.collectionHref("STARKNET", collection)}`;
|
|
10435
10435
|
return Object.entries(list.proofs).map(([address, proof]) => ({
|
|
10436
10436
|
address,
|
|
10437
10437
|
url: `${base}${encodePopClaimFragment(proof)}`
|
|
@@ -10441,7 +10441,7 @@ function popClaimLinksCsv(links) {
|
|
|
10441
10441
|
return ["address,claim_link", ...links.map((l) => `${l.address},${l.url}`)].join("\n");
|
|
10442
10442
|
}
|
|
10443
10443
|
async function popClaimInfo(provider, collection) {
|
|
10444
|
-
const contractAddress =
|
|
10444
|
+
const contractAddress = chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", collection);
|
|
10445
10445
|
const [root, end] = await Promise.all([
|
|
10446
10446
|
provider.callContract({ contractAddress, entrypoint: "allowlist_root", calldata: [] }),
|
|
10447
10447
|
provider.callContract({ contractAddress, entrypoint: "claim_end_time", calldata: [] })
|
|
@@ -10458,7 +10458,7 @@ function popClaimState(input) {
|
|
|
10458
10458
|
if (!wallet || !verifyPopProof(info.root, wallet, proof)) return "wrong-wallet";
|
|
10459
10459
|
return "ready";
|
|
10460
10460
|
}
|
|
10461
|
-
var addr = (a) =>
|
|
10461
|
+
var addr = (a) => chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", a);
|
|
10462
10462
|
var byteArrayFelts = (s) => starknet.CallData.compile([starknet.byteArray.byteArrayFromString(s)]);
|
|
10463
10463
|
var popCalls = {
|
|
10464
10464
|
claim(collection, proof) {
|
|
@@ -10513,9 +10513,9 @@ var PopService = class {
|
|
|
10513
10513
|
};
|
|
10514
10514
|
async function popHasClaimed(provider, collection, address) {
|
|
10515
10515
|
const res = await provider.callContract({
|
|
10516
|
-
contractAddress:
|
|
10516
|
+
contractAddress: chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", collection),
|
|
10517
10517
|
entrypoint: "has_claimed",
|
|
10518
|
-
calldata: [
|
|
10518
|
+
calldata: [chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", address)]
|
|
10519
10519
|
});
|
|
10520
10520
|
return BigInt(res[0] ?? "0x0") !== 0n;
|
|
10521
10521
|
}
|
|
@@ -10537,7 +10537,7 @@ function buildFeeCall(p, cfg) {
|
|
|
10537
10537
|
};
|
|
10538
10538
|
}
|
|
10539
10539
|
var DROP_MAX_CLAIM_QUANTITY = 50n;
|
|
10540
|
-
var addr2 = (a) =>
|
|
10540
|
+
var addr2 = (a) => chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", a);
|
|
10541
10541
|
var factoryData = new starknet.CallData(DropFactoryABI);
|
|
10542
10542
|
var collectionData = new starknet.CallData(DropCollectionABI);
|
|
10543
10543
|
function toContractTerms(t) {
|
|
@@ -10607,7 +10607,7 @@ function dropMintCost(price, quantity, feeBps2) {
|
|
|
10607
10607
|
}
|
|
10608
10608
|
|
|
10609
10609
|
// src/starknet/drop-state.ts
|
|
10610
|
-
var hex = (v) =>
|
|
10610
|
+
var hex = (v) => chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", v ?? "0x0");
|
|
10611
10611
|
var u256 = (low, high) => BigInt(low ?? "0x0") + (BigInt(high ?? "0x0") << 128n);
|
|
10612
10612
|
async function readDrop(provider, collection) {
|
|
10613
10613
|
const contractAddress = hex(collection);
|
|
@@ -10662,7 +10662,7 @@ function dropMintState(input) {
|
|
|
10662
10662
|
return { state: "ready", maxQuantity: max };
|
|
10663
10663
|
}
|
|
10664
10664
|
function dropClaimLinks(origin, collection, list) {
|
|
10665
|
-
const base = `${origin}${
|
|
10665
|
+
const base = `${origin}${chunkRJH2Y53L_cjs.dropHref(collection)}`;
|
|
10666
10666
|
return Object.entries(list.proofs).map(([address, proof]) => ({
|
|
10667
10667
|
address,
|
|
10668
10668
|
url: `${base}${encodePopClaimFragment(proof)}`
|
|
@@ -10713,14 +10713,14 @@ var ERC1155CollectionService = class {
|
|
|
10713
10713
|
_factory(account) {
|
|
10714
10714
|
return newContract(
|
|
10715
10715
|
IPCollection1155FactoryABI,
|
|
10716
|
-
|
|
10716
|
+
chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", this.factoryAddress),
|
|
10717
10717
|
account
|
|
10718
10718
|
);
|
|
10719
10719
|
}
|
|
10720
10720
|
_collection(address, account) {
|
|
10721
10721
|
return newContract(
|
|
10722
10722
|
IPCollection1155ABI,
|
|
10723
|
-
|
|
10723
|
+
chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", address),
|
|
10724
10724
|
account
|
|
10725
10725
|
);
|
|
10726
10726
|
}
|
|
@@ -10948,20 +10948,20 @@ function buildLaunchOnEkuboCalls(params) {
|
|
|
10948
10948
|
}
|
|
10949
10949
|
var CREATOR_COIN_CREATED_SELECTOR = starknet.hash.getSelectorFromName("CreatorCoinCreated");
|
|
10950
10950
|
function parseCreatorCoinCreated(receipt) {
|
|
10951
|
-
const factory =
|
|
10951
|
+
const factory = chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", chunk7EYJC5CB_cjs.getStarknetCoordinates("STARKNET").creatorCoinFactory);
|
|
10952
10952
|
for (const ev of receipt?.events ?? []) {
|
|
10953
10953
|
let from;
|
|
10954
10954
|
try {
|
|
10955
|
-
from =
|
|
10955
|
+
from = chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", ev.from_address ?? "");
|
|
10956
10956
|
} catch {
|
|
10957
10957
|
continue;
|
|
10958
10958
|
}
|
|
10959
10959
|
if (from !== factory) continue;
|
|
10960
10960
|
const k0 = ev.keys?.[0];
|
|
10961
|
-
if (!k0 ||
|
|
10961
|
+
if (!k0 || chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", k0) !== chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", CREATOR_COIN_CREATED_SELECTOR)) continue;
|
|
10962
10962
|
const data = ev.data ?? [];
|
|
10963
10963
|
if (data.length < 1) continue;
|
|
10964
|
-
return
|
|
10964
|
+
return chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", data[data.length - 1]);
|
|
10965
10965
|
}
|
|
10966
10966
|
throw new Error("Coin deployed but the coin address could not be read from the receipt");
|
|
10967
10967
|
}
|
|
@@ -10992,10 +10992,10 @@ var TicketService = class {
|
|
|
10992
10992
|
_factory(account, factoryAddress) {
|
|
10993
10993
|
const address = factoryAddress ?? this.factoryAddress;
|
|
10994
10994
|
if (!address) throw new Error("IP-Tickets factory address not configured for this chain");
|
|
10995
|
-
return newContract(IPTicketCollectionFactoryABI,
|
|
10995
|
+
return newContract(IPTicketCollectionFactoryABI, chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", address), account);
|
|
10996
10996
|
}
|
|
10997
10997
|
_collection(address, account) {
|
|
10998
|
-
return newContract(IPTicketCollectionABI,
|
|
10998
|
+
return newContract(IPTicketCollectionABI, chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", address), account);
|
|
10999
10999
|
}
|
|
11000
11000
|
async deployCollection(account, params) {
|
|
11001
11001
|
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
@@ -11036,10 +11036,10 @@ var ClubService = class {
|
|
|
11036
11036
|
_factory(account, factoryAddress) {
|
|
11037
11037
|
const address = factoryAddress ?? this.factoryAddress;
|
|
11038
11038
|
if (!address) throw new Error("IP-Club factory address not configured for this chain");
|
|
11039
|
-
return newContract(IPClubFactoryABI,
|
|
11039
|
+
return newContract(IPClubFactoryABI, chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", address), account);
|
|
11040
11040
|
}
|
|
11041
11041
|
_collection(address, account) {
|
|
11042
|
-
return newContract(IPClubCollectionABI,
|
|
11042
|
+
return newContract(IPClubCollectionABI, chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", address), account);
|
|
11043
11043
|
}
|
|
11044
11044
|
async deployCollection(account, params) {
|
|
11045
11045
|
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
@@ -11082,7 +11082,7 @@ var SponsorshipService = class {
|
|
|
11082
11082
|
if (!resolved) {
|
|
11083
11083
|
throw new Error("IP-Sponsorship address not configured for this chain");
|
|
11084
11084
|
}
|
|
11085
|
-
return newContract(IPSponsorshipABI,
|
|
11085
|
+
return newContract(IPSponsorshipABI, chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", resolved), account);
|
|
11086
11086
|
}
|
|
11087
11087
|
async createOffer(account, params) {
|
|
11088
11088
|
const specificSponsor = params.specificSponsor ? new starknet.CairoOption(starknet.CairoOptionVariant.Some, params.specificSponsor) : new starknet.CairoOption(starknet.CairoOptionVariant.None);
|
|
@@ -11117,7 +11117,7 @@ var SponsorshipService = class {
|
|
|
11117
11117
|
const approveCall = {
|
|
11118
11118
|
contractAddress: params.paymentToken,
|
|
11119
11119
|
entrypoint: "approve",
|
|
11120
|
-
calldata: [
|
|
11120
|
+
calldata: [chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", sponsorshipAddress), amount.low.toString(), amount.high.toString()]
|
|
11121
11121
|
};
|
|
11122
11122
|
const bidCall = this._contract(account, sponsorshipAddress).populate("place_bid", [
|
|
11123
11123
|
starknet.cairo.uint256(params.offerId),
|
|
@@ -11189,7 +11189,7 @@ function createChainProvider(backendUrl, apiKey) {
|
|
|
11189
11189
|
// src/starknet/client.ts
|
|
11190
11190
|
var MedialaneClient = class {
|
|
11191
11191
|
constructor(rawConfig = {}) {
|
|
11192
|
-
this.config =
|
|
11192
|
+
this.config = chunkRJH2Y53L_cjs.resolveConfig(rawConfig);
|
|
11193
11193
|
this.services = {
|
|
11194
11194
|
pop: new PopService(this.config),
|
|
11195
11195
|
drop: new DropService(this.config),
|
|
@@ -11200,9 +11200,9 @@ var MedialaneClient = class {
|
|
|
11200
11200
|
sponsorship: new SponsorshipService(this.config)
|
|
11201
11201
|
};
|
|
11202
11202
|
if (!this.config.backendUrl) {
|
|
11203
|
-
const sentinel = new
|
|
11203
|
+
const sentinel = new chunkRJH2Y53L_cjs.ApiClient("https://medialane-sdk-no-backend.invalid", this.config.apiKey);
|
|
11204
11204
|
const apiMethodNames = new Set(
|
|
11205
|
-
Object.getOwnPropertyNames(
|
|
11205
|
+
Object.getOwnPropertyNames(chunkRJH2Y53L_cjs.ApiClient.prototype).filter(
|
|
11206
11206
|
(k) => k !== "constructor" && typeof sentinel[k] === "function"
|
|
11207
11207
|
)
|
|
11208
11208
|
);
|
|
@@ -11219,7 +11219,7 @@ var MedialaneClient = class {
|
|
|
11219
11219
|
}
|
|
11220
11220
|
});
|
|
11221
11221
|
} else {
|
|
11222
|
-
this.api = new
|
|
11222
|
+
this.api = new chunkRJH2Y53L_cjs.ApiClient(this.config.backendUrl, this.config.apiKey, this.config.retryOptions, this.config.chain);
|
|
11223
11223
|
}
|
|
11224
11224
|
}
|
|
11225
11225
|
get chain() {
|
|
@@ -11359,7 +11359,7 @@ function buildListingOrder(i, cfg) {
|
|
|
11359
11359
|
salt: i.salt,
|
|
11360
11360
|
counter: i.counter
|
|
11361
11361
|
};
|
|
11362
|
-
const typedData =
|
|
11362
|
+
const typedData = chunkRJH2Y53L_cjs.stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
|
|
11363
11363
|
return { orderParams, typedData };
|
|
11364
11364
|
}
|
|
11365
11365
|
function buildOfferOrder(i, cfg) {
|
|
@@ -11380,11 +11380,11 @@ function buildOfferOrder(i, cfg) {
|
|
|
11380
11380
|
salt: i.salt,
|
|
11381
11381
|
counter: i.counter
|
|
11382
11382
|
};
|
|
11383
|
-
const typedData =
|
|
11383
|
+
const typedData = chunkRJH2Y53L_cjs.stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
|
|
11384
11384
|
return { orderParams, typedData };
|
|
11385
11385
|
}
|
|
11386
11386
|
function registerPayload(orderParams, signature) {
|
|
11387
|
-
return
|
|
11387
|
+
return chunkRJH2Y53L_cjs.stringifyBigInts({
|
|
11388
11388
|
parameters: {
|
|
11389
11389
|
...orderParams,
|
|
11390
11390
|
offer: { ...orderParams.offer, item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type) },
|
|
@@ -11415,14 +11415,14 @@ function buildFulfillCalls(a, cfg) {
|
|
|
11415
11415
|
return fee ? [approve, fulfill, fee] : [approve, fulfill];
|
|
11416
11416
|
}
|
|
11417
11417
|
function buildCancelCalls(a, cfg) {
|
|
11418
|
-
const cancelRequest =
|
|
11418
|
+
const cancelRequest = chunkRJH2Y53L_cjs.stringifyBigInts({
|
|
11419
11419
|
cancelation: { order_hash: a.orderHash, offerer: a.offerer },
|
|
11420
11420
|
signature: a.signature
|
|
11421
11421
|
});
|
|
11422
11422
|
return [contractFor(cfg).populate("cancel_order", [cancelRequest])];
|
|
11423
11423
|
}
|
|
11424
11424
|
function buildCancelTypedData(orderHash, offerer, cfg) {
|
|
11425
|
-
return
|
|
11425
|
+
return chunkRJH2Y53L_cjs.stringifyBigInts(buildCancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg)));
|
|
11426
11426
|
}
|
|
11427
11427
|
function contractFor2(cfg) {
|
|
11428
11428
|
return newContract(Medialane1155ABI, cfg.marketplace1155Contract);
|
|
@@ -11445,7 +11445,7 @@ function buildListing1155Order(i, cfg) {
|
|
|
11445
11445
|
salt: i.salt,
|
|
11446
11446
|
counter: i.counter
|
|
11447
11447
|
};
|
|
11448
|
-
const typedData =
|
|
11448
|
+
const typedData = chunkRJH2Y53L_cjs.stringifyBigInts(
|
|
11449
11449
|
build1155OrderTypedData(orderParams, getChainId(cfg))
|
|
11450
11450
|
);
|
|
11451
11451
|
return { orderParams, typedData };
|
|
@@ -11468,13 +11468,13 @@ function buildOffer1155Order(i, cfg) {
|
|
|
11468
11468
|
salt: i.salt,
|
|
11469
11469
|
counter: i.counter
|
|
11470
11470
|
};
|
|
11471
|
-
const typedData =
|
|
11471
|
+
const typedData = chunkRJH2Y53L_cjs.stringifyBigInts(
|
|
11472
11472
|
build1155OrderTypedData(orderParams, getChainId(cfg))
|
|
11473
11473
|
);
|
|
11474
11474
|
return { orderParams, typedData };
|
|
11475
11475
|
}
|
|
11476
11476
|
function registerPayload2(orderParams, signature) {
|
|
11477
|
-
return
|
|
11477
|
+
return chunkRJH2Y53L_cjs.stringifyBigInts({
|
|
11478
11478
|
parameters: {
|
|
11479
11479
|
...orderParams,
|
|
11480
11480
|
offer: { ...orderParams.offer, item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type) },
|
|
@@ -11505,14 +11505,14 @@ function buildFulfill1155Calls(a, cfg) {
|
|
|
11505
11505
|
return fee ? [approve, fulfill, fee] : [approve, fulfill];
|
|
11506
11506
|
}
|
|
11507
11507
|
function buildCancel1155Calls(a, cfg) {
|
|
11508
|
-
const cancelPayload =
|
|
11508
|
+
const cancelPayload = chunkRJH2Y53L_cjs.stringifyBigInts({
|
|
11509
11509
|
cancelation: { order_hash: a.orderHash, offerer: a.offerer },
|
|
11510
11510
|
signature: a.signature
|
|
11511
11511
|
});
|
|
11512
11512
|
return [contractFor2(cfg).populate("cancel_order", [cancelPayload])];
|
|
11513
11513
|
}
|
|
11514
11514
|
function buildCancel1155TypedData(orderHash, offerer, cfg) {
|
|
11515
|
-
return
|
|
11515
|
+
return chunkRJH2Y53L_cjs.stringifyBigInts(
|
|
11516
11516
|
build1155CancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg))
|
|
11517
11517
|
);
|
|
11518
11518
|
}
|
|
@@ -11878,18 +11878,32 @@ async function confirmIntentBestEffort(client, intentId, txHash) {
|
|
|
11878
11878
|
await client.api.confirmIntent(intentId, txHash).catch(() => {
|
|
11879
11879
|
});
|
|
11880
11880
|
}
|
|
11881
|
-
var SYNC_TIMEOUT_MS =
|
|
11882
|
-
|
|
11881
|
+
var SYNC_TIMEOUT_MS = 2e4;
|
|
11882
|
+
var SYNC_RETRY_MS = 2e3;
|
|
11883
|
+
function readableLater(err) {
|
|
11884
|
+
return err instanceof chunkRJH2Y53L_cjs.MedialaneApiError && err.status === 404;
|
|
11885
|
+
}
|
|
11886
|
+
async function syncTransactionBestEffort(client, txHash, timeoutMs = SYNC_TIMEOUT_MS, retryMs = SYNC_RETRY_MS) {
|
|
11887
|
+
const deadline = Date.now() + timeoutMs;
|
|
11888
|
+
let stopped = false;
|
|
11883
11889
|
let timer;
|
|
11884
11890
|
const timeout = new Promise((resolve) => {
|
|
11885
11891
|
timer = setTimeout(() => resolve(), timeoutMs);
|
|
11886
11892
|
});
|
|
11887
|
-
const sync =
|
|
11888
|
-
|
|
11889
|
-
|
|
11893
|
+
const sync = (async () => {
|
|
11894
|
+
while (!stopped) {
|
|
11895
|
+
const again = await client.api.syncTransaction(txHash).then(
|
|
11896
|
+
(res) => res.data?.pending === true,
|
|
11897
|
+
readableLater
|
|
11898
|
+
);
|
|
11899
|
+
if (!again || Date.now() + retryMs >= deadline) return;
|
|
11900
|
+
await new Promise((resolve) => setTimeout(resolve, retryMs));
|
|
11901
|
+
}
|
|
11902
|
+
})();
|
|
11890
11903
|
try {
|
|
11891
11904
|
await Promise.race([sync, timeout]);
|
|
11892
11905
|
} finally {
|
|
11906
|
+
stopped = true;
|
|
11893
11907
|
if (timer) clearTimeout(timer);
|
|
11894
11908
|
}
|
|
11895
11909
|
}
|
|
@@ -11902,14 +11916,14 @@ async function assertTransactionSucceeded(provider, txHash, retryDelaysMs = RECE
|
|
|
11902
11916
|
const receipt = await provider.getTransactionReceipt(txHash);
|
|
11903
11917
|
const status = receipt.execution_status ?? receipt.status;
|
|
11904
11918
|
if (status === "REVERTED" || status === "REJECTED") {
|
|
11905
|
-
throw new
|
|
11919
|
+
throw new chunkRJH2Y53L_cjs.UserFacingError("Transaction was submitted but reverted onchain. Please check your balance and try again.");
|
|
11906
11920
|
}
|
|
11907
11921
|
if (status) return receipt;
|
|
11908
11922
|
} catch (err) {
|
|
11909
11923
|
if (err instanceof Error && err.message.includes("reverted onchain")) throw err;
|
|
11910
11924
|
}
|
|
11911
11925
|
}
|
|
11912
|
-
throw new
|
|
11926
|
+
throw new chunkRJH2Y53L_cjs.UserFacingError("Verification timed out. Check your account for the transaction status.");
|
|
11913
11927
|
}
|
|
11914
11928
|
async function executeIntent(signer, client, intent, opts = {}) {
|
|
11915
11929
|
let calls;
|
|
@@ -11962,14 +11976,14 @@ function u2563(low, high) {
|
|
|
11962
11976
|
return (BigInt(low ?? 0) + (BigInt(high ?? 0) << 128n)).toString();
|
|
11963
11977
|
}
|
|
11964
11978
|
function deployedCollectionFromReceipt(receipt, service) {
|
|
11965
|
-
const factory =
|
|
11979
|
+
const factory = chunkRJH2Y53L_cjs.getService(service)?.onchain?.STARKNET?.factoryAddress;
|
|
11966
11980
|
const { event, address } = DEPLOY_EVENTS[service];
|
|
11967
11981
|
const selector = BigInt(starknet.hash.getSelectorFromName(event));
|
|
11968
11982
|
for (const e of receipt.events ?? []) {
|
|
11969
11983
|
if (factory && !sameFelt(e.from_address, factory)) continue;
|
|
11970
11984
|
if (!sameFelt(e.keys?.[0], selector)) continue;
|
|
11971
11985
|
const value = address(e);
|
|
11972
|
-
if (value) return
|
|
11986
|
+
if (value) return chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", value);
|
|
11973
11987
|
}
|
|
11974
11988
|
return null;
|
|
11975
11989
|
}
|
|
@@ -12090,13 +12104,13 @@ function buildRemoveOwnerByGuidCall(accountAddress, ownerGuid) {
|
|
|
12090
12104
|
}
|
|
12091
12105
|
function buildDeployAccountParams(ownerPubkey, salt = 0) {
|
|
12092
12106
|
return {
|
|
12093
|
-
classHash:
|
|
12094
|
-
constructorCalldata:
|
|
12107
|
+
classHash: chunkRJH2Y53L_cjs.STARKNET_MEDIAWALLET_CLASS_HASH,
|
|
12108
|
+
constructorCalldata: chunkRJH2Y53L_cjs.ownerConstructorCalldata(ownerPubkey),
|
|
12095
12109
|
addressSalt: starknet.num.toHex(salt),
|
|
12096
|
-
contractAddress:
|
|
12110
|
+
contractAddress: chunkRJH2Y53L_cjs.computeAccountAddress(ownerPubkey, salt)
|
|
12097
12111
|
};
|
|
12098
12112
|
}
|
|
12099
|
-
var norm = (address) =>
|
|
12113
|
+
var norm = (address) => chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", address);
|
|
12100
12114
|
var SIGNER_TYPE_NAMES = ["Starknet", "Secp256k1", "Secp256r1"];
|
|
12101
12115
|
function encodeFeltArray(items) {
|
|
12102
12116
|
return [starknet.num.toHex(items.length), ...items];
|
|
@@ -12293,7 +12307,7 @@ var InvalidRecoveryKeyError = class extends Error {
|
|
|
12293
12307
|
var canonicalAddress = (address) => `0x${BigInt(address).toString(16).padStart(64, "0")}`;
|
|
12294
12308
|
function keyPair(privateKey) {
|
|
12295
12309
|
try {
|
|
12296
|
-
return
|
|
12310
|
+
return chunkRJH2Y53L_cjs.starkKeyPairFromPrivateKey(privateKey);
|
|
12297
12311
|
} catch {
|
|
12298
12312
|
throw new InvalidRecoveryKeyError();
|
|
12299
12313
|
}
|
|
@@ -12306,7 +12320,7 @@ function parseRecoveryKey(input) {
|
|
|
12306
12320
|
const trimmed = input.trim();
|
|
12307
12321
|
if (!trimmed.startsWith(PREFIX)) {
|
|
12308
12322
|
const { privateKeyHex, publicKeyHex } = keyPair(trimmed);
|
|
12309
|
-
return { walletAddress:
|
|
12323
|
+
return { walletAddress: chunkRJH2Y53L_cjs.computeAccountAddress(publicKeyHex, 0), privateKey: privateKeyHex };
|
|
12310
12324
|
}
|
|
12311
12325
|
const parts = trimmed.slice(PREFIX.length).split(":");
|
|
12312
12326
|
const [walletAddress, privateKey] = parts;
|
|
@@ -12328,7 +12342,7 @@ function describeRecoveryAction(escape) {
|
|
|
12328
12342
|
return "none";
|
|
12329
12343
|
}
|
|
12330
12344
|
function normalizeWalletAddress(address) {
|
|
12331
|
-
return
|
|
12345
|
+
return chunkRJH2Y53L_cjs.normalizeAddress("STARKNET", address);
|
|
12332
12346
|
}
|
|
12333
12347
|
function isValidStarknetAddress(address) {
|
|
12334
12348
|
try {
|
|
@@ -12373,7 +12387,7 @@ async function estimateSelfFundedFee(provider, address, calls) {
|
|
|
12373
12387
|
return { feeRaw: estimate.overall_fee, unit: estimate.unit, balanceRaw };
|
|
12374
12388
|
}
|
|
12375
12389
|
async function feeTokenBalance(provider, address, unit) {
|
|
12376
|
-
const token =
|
|
12390
|
+
const token = chunkRJH2Y53L_cjs.getTokenBySymbol(unit === "FRI" ? "STRK" : "ETH");
|
|
12377
12391
|
if (!token) throw new Error(`No fee token for unit ${unit}`);
|
|
12378
12392
|
return erc20Balance(provider, token.address, address);
|
|
12379
12393
|
}
|
|
@@ -12400,7 +12414,7 @@ function sponsoredExecutor(deps) {
|
|
|
12400
12414
|
{ proxyUrl: deps.proxyUrl, fetchImpl: deps.fetchImpl },
|
|
12401
12415
|
{
|
|
12402
12416
|
address: userAddress,
|
|
12403
|
-
signTypedData: async (data) =>
|
|
12417
|
+
signTypedData: async (data) => chunkRJH2Y53L_cjs.signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(data, userAddress))
|
|
12404
12418
|
},
|
|
12405
12419
|
{ intentIds }
|
|
12406
12420
|
);
|
|
@@ -12460,7 +12474,7 @@ async function deploySelfFunded(input) {
|
|
|
12460
12474
|
});
|
|
12461
12475
|
const { transaction_hash } = await account.deployAccount({
|
|
12462
12476
|
classHash,
|
|
12463
|
-
constructorCalldata:
|
|
12477
|
+
constructorCalldata: chunkRJH2Y53L_cjs.ownerConstructorCalldata(input.ownerPubKey),
|
|
12464
12478
|
addressSalt: 0,
|
|
12465
12479
|
contractAddress: input.ownerAddress
|
|
12466
12480
|
});
|
|
@@ -12616,7 +12630,7 @@ function createMediaWallet(config) {
|
|
|
12616
12630
|
};
|
|
12617
12631
|
const walletIntents = config.walletIntents ?? (async (params) => {
|
|
12618
12632
|
if (!config.backendUrl) throw new Error("This wallet has no backend url configured");
|
|
12619
|
-
const created = await new
|
|
12633
|
+
const created = await new chunkRJH2Y53L_cjs.ApiClient(config.backendUrl).createWalletManageIntent(params);
|
|
12620
12634
|
return created.data;
|
|
12621
12635
|
});
|
|
12622
12636
|
const manage = async (sealed, params) => {
|
|
@@ -12633,7 +12647,7 @@ function createMediaWallet(config) {
|
|
|
12633
12647
|
address: sealed.address,
|
|
12634
12648
|
signTypedData: async (data) => {
|
|
12635
12649
|
const privateKeyHex = await unlockOnce(sealed);
|
|
12636
|
-
return
|
|
12650
|
+
return chunkRJH2Y53L_cjs.signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(data, sealed.address));
|
|
12637
12651
|
},
|
|
12638
12652
|
execute: async (calls, opts) => {
|
|
12639
12653
|
const { transactionHash } = await run(sealed, calls, void 0, opts?.intentIds);
|
|
@@ -12674,55 +12688,55 @@ async function claimSessionWallet(api, walletAddress, deps) {
|
|
|
12674
12688
|
|
|
12675
12689
|
Object.defineProperty(exports, "InvalidStarkPrivateKeyError", {
|
|
12676
12690
|
enumerable: true,
|
|
12677
|
-
get: function () { return
|
|
12691
|
+
get: function () { return chunkRJH2Y53L_cjs.InvalidStarkPrivateKeyError; }
|
|
12678
12692
|
});
|
|
12679
12693
|
Object.defineProperty(exports, "PasskeyCancelledError", {
|
|
12680
12694
|
enumerable: true,
|
|
12681
|
-
get: function () { return
|
|
12695
|
+
get: function () { return chunkRJH2Y53L_cjs.PasskeyCancelledError; }
|
|
12682
12696
|
});
|
|
12683
12697
|
Object.defineProperty(exports, "PasskeyUnsupportedError", {
|
|
12684
12698
|
enumerable: true,
|
|
12685
|
-
get: function () { return
|
|
12699
|
+
get: function () { return chunkRJH2Y53L_cjs.PasskeyUnsupportedError; }
|
|
12686
12700
|
});
|
|
12687
12701
|
Object.defineProperty(exports, "UserFacingError", {
|
|
12688
12702
|
enumerable: true,
|
|
12689
|
-
get: function () { return
|
|
12703
|
+
get: function () { return chunkRJH2Y53L_cjs.UserFacingError; }
|
|
12690
12704
|
});
|
|
12691
12705
|
Object.defineProperty(exports, "computeAccountAddress", {
|
|
12692
12706
|
enumerable: true,
|
|
12693
|
-
get: function () { return
|
|
12707
|
+
get: function () { return chunkRJH2Y53L_cjs.computeAccountAddress; }
|
|
12694
12708
|
});
|
|
12695
12709
|
Object.defineProperty(exports, "createPasskeyOwner", {
|
|
12696
12710
|
enumerable: true,
|
|
12697
|
-
get: function () { return
|
|
12711
|
+
get: function () { return chunkRJH2Y53L_cjs.createPasskeyOwner; }
|
|
12698
12712
|
});
|
|
12699
12713
|
Object.defineProperty(exports, "deriveAesKey", {
|
|
12700
12714
|
enumerable: true,
|
|
12701
|
-
get: function () { return
|
|
12715
|
+
get: function () { return chunkRJH2Y53L_cjs.deriveAesKey; }
|
|
12702
12716
|
});
|
|
12703
12717
|
Object.defineProperty(exports, "generateStarkKeyPair", {
|
|
12704
12718
|
enumerable: true,
|
|
12705
|
-
get: function () { return
|
|
12719
|
+
get: function () { return chunkRJH2Y53L_cjs.generateStarkKeyPair; }
|
|
12706
12720
|
});
|
|
12707
12721
|
Object.defineProperty(exports, "ownerConstructorCalldata", {
|
|
12708
12722
|
enumerable: true,
|
|
12709
|
-
get: function () { return
|
|
12723
|
+
get: function () { return chunkRJH2Y53L_cjs.ownerConstructorCalldata; }
|
|
12710
12724
|
});
|
|
12711
12725
|
Object.defineProperty(exports, "sealPrivateKey", {
|
|
12712
12726
|
enumerable: true,
|
|
12713
|
-
get: function () { return
|
|
12727
|
+
get: function () { return chunkRJH2Y53L_cjs.sealPrivateKey; }
|
|
12714
12728
|
});
|
|
12715
12729
|
Object.defineProperty(exports, "signWithPrivateKey", {
|
|
12716
12730
|
enumerable: true,
|
|
12717
|
-
get: function () { return
|
|
12731
|
+
get: function () { return chunkRJH2Y53L_cjs.signWithPrivateKey; }
|
|
12718
12732
|
});
|
|
12719
12733
|
Object.defineProperty(exports, "starkKeyPairFromPrivateKey", {
|
|
12720
12734
|
enumerable: true,
|
|
12721
|
-
get: function () { return
|
|
12735
|
+
get: function () { return chunkRJH2Y53L_cjs.starkKeyPairFromPrivateKey; }
|
|
12722
12736
|
});
|
|
12723
12737
|
Object.defineProperty(exports, "unsealPrivateKey", {
|
|
12724
12738
|
enumerable: true,
|
|
12725
|
-
get: function () { return
|
|
12739
|
+
get: function () { return chunkRJH2Y53L_cjs.unsealPrivateKey; }
|
|
12726
12740
|
});
|
|
12727
12741
|
exports.COIN_MAX_SUPPLY = MAX_SUPPLY;
|
|
12728
12742
|
exports.COIN_MIN_SUPPLY = MIN_SUPPLY;
|