@medialane/sdk 0.192.0 → 0.194.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-V4UXHC53.cjs → chunk-BLEFV7GP.cjs} +2 -2
- package/dist/{chunk-V4UXHC53.cjs.map → chunk-BLEFV7GP.cjs.map} +1 -1
- package/dist/{chunk-2B4PVFOS.js → chunk-MOIM2AAQ.js} +2 -2
- package/dist/{chunk-2B4PVFOS.js.map → chunk-MOIM2AAQ.js.map} +1 -1
- package/dist/chunk-PZ5AY32C.js +9 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-Q7SFCCGT.cjs +11 -0
- package/dist/chunk-Q7SFCCGT.cjs.map +1 -0
- package/dist/contract/index.cjs +509 -0
- package/dist/contract/index.cjs.map +1 -0
- package/dist/contract/index.d.cts +104 -0
- package/dist/contract/index.d.ts +104 -0
- package/dist/contract/index.js +493 -0
- package/dist/contract/index.js.map +1 -0
- package/dist/{errors-CrBviXC8.d.cts → errors-C39AqEX6.d.cts} +46 -309
- package/dist/{errors-kCrcWfrz.d.ts → errors-Cc9W7FFi.d.ts} +46 -309
- package/dist/evm/index.cjs +1 -0
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.js +1 -0
- package/dist/evm/index.js.map +1 -1
- package/dist/index.cjs +78 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/provisioning-BUYiU8Tr.d.cts +1720 -0
- package/dist/provisioning-BUYiU8Tr.d.ts +1720 -0
- package/dist/solana/index.cjs +1 -0
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.js +1 -0
- package/dist/solana/index.js.map +1 -1
- package/dist/starknet/index.cjs +68 -67
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +3 -2
- package/dist/starknet/index.d.ts +3 -2
- package/dist/starknet/index.js +3 -2
- package/dist/starknet/index.js.map +1 -1
- package/dist/stellar/index.cjs +1 -0
- package/dist/stellar/index.cjs.map +1 -1
- package/dist/stellar/index.js +1 -0
- package/dist/stellar/index.js.map +1 -1
- package/package.json +6 -1
package/dist/starknet/index.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkBLEFV7GP_cjs = require('../chunk-BLEFV7GP.cjs');
|
|
4
4
|
var chunk7EYJC5CB_cjs = require('../chunk-7EYJC5CB.cjs');
|
|
5
|
+
require('../chunk-Q7SFCCGT.cjs');
|
|
5
6
|
var starknet = require('starknet');
|
|
6
7
|
var hkdf_js = require('@noble/hashes/hkdf.js');
|
|
7
8
|
var sha2_js = require('@noble/hashes/sha2.js');
|
|
@@ -33,7 +34,7 @@ function getChainId(config) {
|
|
|
33
34
|
return starknet.constants.StarknetChainId.SN_MAIN;
|
|
34
35
|
}
|
|
35
36
|
function resolveToken(currency) {
|
|
36
|
-
const token =
|
|
37
|
+
const token = chunkBLEFV7GP_cjs.SUPPORTED_TOKENS.find(
|
|
37
38
|
(t) => t.symbol === currency.toUpperCase() || t.address.toLowerCase() === currency.toLowerCase()
|
|
38
39
|
);
|
|
39
40
|
if (!token) throw new MedialaneError(`Unsupported currency: ${currency}`, "INVALID_PARAMS");
|
|
@@ -10405,7 +10406,7 @@ function merkleTree(leafHashes) {
|
|
|
10405
10406
|
};
|
|
10406
10407
|
}
|
|
10407
10408
|
function buildPopAllowlist(addresses) {
|
|
10408
|
-
const unique = [...new Set(addresses.map((a) =>
|
|
10409
|
+
const unique = [...new Set(addresses.map((a) => chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", a)))];
|
|
10409
10410
|
if (unique.length === 0) throw new Error("An allowlist needs at least one address");
|
|
10410
10411
|
const leaves = unique.map((address) => ({ address, leaf: popLeafHash(address) }));
|
|
10411
10412
|
const tree = merkleTree(leaves.map((l) => l.leaf));
|
|
@@ -10431,7 +10432,7 @@ function decodePopClaimFragment(fragment) {
|
|
|
10431
10432
|
|
|
10432
10433
|
// src/starknet/pop-claim.ts
|
|
10433
10434
|
function popClaimLinks(origin, collection, list) {
|
|
10434
|
-
const base = `${origin}${
|
|
10435
|
+
const base = `${origin}${chunkBLEFV7GP_cjs.collectionHref("STARKNET", collection)}`;
|
|
10435
10436
|
return Object.entries(list.proofs).map(([address, proof]) => ({
|
|
10436
10437
|
address,
|
|
10437
10438
|
url: `${base}${encodePopClaimFragment(proof)}`
|
|
@@ -10441,7 +10442,7 @@ function popClaimLinksCsv(links) {
|
|
|
10441
10442
|
return ["address,claim_link", ...links.map((l) => `${l.address},${l.url}`)].join("\n");
|
|
10442
10443
|
}
|
|
10443
10444
|
async function popClaimInfo(provider, collection) {
|
|
10444
|
-
const contractAddress =
|
|
10445
|
+
const contractAddress = chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", collection);
|
|
10445
10446
|
const [root, end] = await Promise.all([
|
|
10446
10447
|
provider.callContract({ contractAddress, entrypoint: "allowlist_root", calldata: [] }),
|
|
10447
10448
|
provider.callContract({ contractAddress, entrypoint: "claim_end_time", calldata: [] })
|
|
@@ -10458,7 +10459,7 @@ function popClaimState(input) {
|
|
|
10458
10459
|
if (!wallet || !verifyPopProof(info.root, wallet, proof)) return "wrong-wallet";
|
|
10459
10460
|
return "ready";
|
|
10460
10461
|
}
|
|
10461
|
-
var addr = (a) =>
|
|
10462
|
+
var addr = (a) => chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", a);
|
|
10462
10463
|
var byteArrayFelts = (s) => starknet.CallData.compile([starknet.byteArray.byteArrayFromString(s)]);
|
|
10463
10464
|
var popCalls = {
|
|
10464
10465
|
claim(collection, proof) {
|
|
@@ -10513,9 +10514,9 @@ var PopService = class {
|
|
|
10513
10514
|
};
|
|
10514
10515
|
async function popHasClaimed(provider, collection, address) {
|
|
10515
10516
|
const res = await provider.callContract({
|
|
10516
|
-
contractAddress:
|
|
10517
|
+
contractAddress: chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", collection),
|
|
10517
10518
|
entrypoint: "has_claimed",
|
|
10518
|
-
calldata: [
|
|
10519
|
+
calldata: [chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", address)]
|
|
10519
10520
|
});
|
|
10520
10521
|
return BigInt(res[0] ?? "0x0") !== 0n;
|
|
10521
10522
|
}
|
|
@@ -10537,7 +10538,7 @@ function buildFeeCall(p, cfg) {
|
|
|
10537
10538
|
};
|
|
10538
10539
|
}
|
|
10539
10540
|
var DROP_MAX_CLAIM_QUANTITY = 50n;
|
|
10540
|
-
var addr2 = (a) =>
|
|
10541
|
+
var addr2 = (a) => chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", a);
|
|
10541
10542
|
var factoryData = new starknet.CallData(DropFactoryABI);
|
|
10542
10543
|
var collectionData = new starknet.CallData(DropCollectionABI);
|
|
10543
10544
|
function toContractTerms(t) {
|
|
@@ -10607,7 +10608,7 @@ function dropMintCost(price, quantity, feeBps2) {
|
|
|
10607
10608
|
}
|
|
10608
10609
|
|
|
10609
10610
|
// src/starknet/drop-state.ts
|
|
10610
|
-
var hex = (v) =>
|
|
10611
|
+
var hex = (v) => chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", v ?? "0x0");
|
|
10611
10612
|
var u256 = (low, high) => BigInt(low ?? "0x0") + (BigInt(high ?? "0x0") << 128n);
|
|
10612
10613
|
async function readDrop(provider, collection) {
|
|
10613
10614
|
const contractAddress = hex(collection);
|
|
@@ -10662,7 +10663,7 @@ function dropMintState(input) {
|
|
|
10662
10663
|
return { state: "ready", maxQuantity: max };
|
|
10663
10664
|
}
|
|
10664
10665
|
function dropClaimLinks(origin, collection, list) {
|
|
10665
|
-
const base = `${origin}${
|
|
10666
|
+
const base = `${origin}${chunkBLEFV7GP_cjs.dropHref(collection)}`;
|
|
10666
10667
|
return Object.entries(list.proofs).map(([address, proof]) => ({
|
|
10667
10668
|
address,
|
|
10668
10669
|
url: `${base}${encodePopClaimFragment(proof)}`
|
|
@@ -10713,14 +10714,14 @@ var ERC1155CollectionService = class {
|
|
|
10713
10714
|
_factory(account) {
|
|
10714
10715
|
return newContract(
|
|
10715
10716
|
IPCollection1155FactoryABI,
|
|
10716
|
-
|
|
10717
|
+
chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", this.factoryAddress),
|
|
10717
10718
|
account
|
|
10718
10719
|
);
|
|
10719
10720
|
}
|
|
10720
10721
|
_collection(address, account) {
|
|
10721
10722
|
return newContract(
|
|
10722
10723
|
IPCollection1155ABI,
|
|
10723
|
-
|
|
10724
|
+
chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", address),
|
|
10724
10725
|
account
|
|
10725
10726
|
);
|
|
10726
10727
|
}
|
|
@@ -10948,20 +10949,20 @@ function buildLaunchOnEkuboCalls(params) {
|
|
|
10948
10949
|
}
|
|
10949
10950
|
var CREATOR_COIN_CREATED_SELECTOR = starknet.hash.getSelectorFromName("CreatorCoinCreated");
|
|
10950
10951
|
function parseCreatorCoinCreated(receipt) {
|
|
10951
|
-
const factory =
|
|
10952
|
+
const factory = chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", chunk7EYJC5CB_cjs.getStarknetCoordinates("STARKNET").creatorCoinFactory);
|
|
10952
10953
|
for (const ev of receipt?.events ?? []) {
|
|
10953
10954
|
let from;
|
|
10954
10955
|
try {
|
|
10955
|
-
from =
|
|
10956
|
+
from = chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", ev.from_address ?? "");
|
|
10956
10957
|
} catch {
|
|
10957
10958
|
continue;
|
|
10958
10959
|
}
|
|
10959
10960
|
if (from !== factory) continue;
|
|
10960
10961
|
const k0 = ev.keys?.[0];
|
|
10961
|
-
if (!k0 ||
|
|
10962
|
+
if (!k0 || chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", k0) !== chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", CREATOR_COIN_CREATED_SELECTOR)) continue;
|
|
10962
10963
|
const data = ev.data ?? [];
|
|
10963
10964
|
if (data.length < 1) continue;
|
|
10964
|
-
return
|
|
10965
|
+
return chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", data[data.length - 1]);
|
|
10965
10966
|
}
|
|
10966
10967
|
throw new Error("Coin deployed but the coin address could not be read from the receipt");
|
|
10967
10968
|
}
|
|
@@ -10992,10 +10993,10 @@ var TicketService = class {
|
|
|
10992
10993
|
_factory(account, factoryAddress) {
|
|
10993
10994
|
const address = factoryAddress ?? this.factoryAddress;
|
|
10994
10995
|
if (!address) throw new Error("IP-Tickets factory address not configured for this chain");
|
|
10995
|
-
return newContract(IPTicketCollectionFactoryABI,
|
|
10996
|
+
return newContract(IPTicketCollectionFactoryABI, chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", address), account);
|
|
10996
10997
|
}
|
|
10997
10998
|
_collection(address, account) {
|
|
10998
|
-
return newContract(IPTicketCollectionABI,
|
|
10999
|
+
return newContract(IPTicketCollectionABI, chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", address), account);
|
|
10999
11000
|
}
|
|
11000
11001
|
async deployCollection(account, params) {
|
|
11001
11002
|
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
@@ -11036,10 +11037,10 @@ var ClubService = class {
|
|
|
11036
11037
|
_factory(account, factoryAddress) {
|
|
11037
11038
|
const address = factoryAddress ?? this.factoryAddress;
|
|
11038
11039
|
if (!address) throw new Error("IP-Club factory address not configured for this chain");
|
|
11039
|
-
return newContract(IPClubFactoryABI,
|
|
11040
|
+
return newContract(IPClubFactoryABI, chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", address), account);
|
|
11040
11041
|
}
|
|
11041
11042
|
_collection(address, account) {
|
|
11042
|
-
return newContract(IPClubCollectionABI,
|
|
11043
|
+
return newContract(IPClubCollectionABI, chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", address), account);
|
|
11043
11044
|
}
|
|
11044
11045
|
async deployCollection(account, params) {
|
|
11045
11046
|
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
@@ -11082,7 +11083,7 @@ var SponsorshipService = class {
|
|
|
11082
11083
|
if (!resolved) {
|
|
11083
11084
|
throw new Error("IP-Sponsorship address not configured for this chain");
|
|
11084
11085
|
}
|
|
11085
|
-
return newContract(IPSponsorshipABI,
|
|
11086
|
+
return newContract(IPSponsorshipABI, chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", resolved), account);
|
|
11086
11087
|
}
|
|
11087
11088
|
async createOffer(account, params) {
|
|
11088
11089
|
const specificSponsor = params.specificSponsor ? new starknet.CairoOption(starknet.CairoOptionVariant.Some, params.specificSponsor) : new starknet.CairoOption(starknet.CairoOptionVariant.None);
|
|
@@ -11117,7 +11118,7 @@ var SponsorshipService = class {
|
|
|
11117
11118
|
const approveCall = {
|
|
11118
11119
|
contractAddress: params.paymentToken,
|
|
11119
11120
|
entrypoint: "approve",
|
|
11120
|
-
calldata: [
|
|
11121
|
+
calldata: [chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", sponsorshipAddress), amount.low.toString(), amount.high.toString()]
|
|
11121
11122
|
};
|
|
11122
11123
|
const bidCall = this._contract(account, sponsorshipAddress).populate("place_bid", [
|
|
11123
11124
|
starknet.cairo.uint256(params.offerId),
|
|
@@ -11189,7 +11190,7 @@ function createChainProvider(backendUrl, apiKey) {
|
|
|
11189
11190
|
// src/starknet/client.ts
|
|
11190
11191
|
var MedialaneClient = class {
|
|
11191
11192
|
constructor(rawConfig = {}) {
|
|
11192
|
-
this.config =
|
|
11193
|
+
this.config = chunkBLEFV7GP_cjs.resolveConfig(rawConfig);
|
|
11193
11194
|
this.services = {
|
|
11194
11195
|
pop: new PopService(this.config),
|
|
11195
11196
|
drop: new DropService(this.config),
|
|
@@ -11200,9 +11201,9 @@ var MedialaneClient = class {
|
|
|
11200
11201
|
sponsorship: new SponsorshipService(this.config)
|
|
11201
11202
|
};
|
|
11202
11203
|
if (!this.config.backendUrl) {
|
|
11203
|
-
const sentinel = new
|
|
11204
|
+
const sentinel = new chunkBLEFV7GP_cjs.ApiClient("https://medialane-sdk-no-backend.invalid", this.config.apiKey);
|
|
11204
11205
|
const apiMethodNames = new Set(
|
|
11205
|
-
Object.getOwnPropertyNames(
|
|
11206
|
+
Object.getOwnPropertyNames(chunkBLEFV7GP_cjs.ApiClient.prototype).filter(
|
|
11206
11207
|
(k) => k !== "constructor" && typeof sentinel[k] === "function"
|
|
11207
11208
|
)
|
|
11208
11209
|
);
|
|
@@ -11219,7 +11220,7 @@ var MedialaneClient = class {
|
|
|
11219
11220
|
}
|
|
11220
11221
|
});
|
|
11221
11222
|
} else {
|
|
11222
|
-
this.api = new
|
|
11223
|
+
this.api = new chunkBLEFV7GP_cjs.ApiClient(this.config.backendUrl, this.config.apiKey, this.config.retryOptions, this.config.chain);
|
|
11223
11224
|
}
|
|
11224
11225
|
}
|
|
11225
11226
|
get chain() {
|
|
@@ -11359,7 +11360,7 @@ function buildListingOrder(i, cfg) {
|
|
|
11359
11360
|
salt: i.salt,
|
|
11360
11361
|
counter: i.counter
|
|
11361
11362
|
};
|
|
11362
|
-
const typedData =
|
|
11363
|
+
const typedData = chunkBLEFV7GP_cjs.stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
|
|
11363
11364
|
return { orderParams, typedData };
|
|
11364
11365
|
}
|
|
11365
11366
|
function buildOfferOrder(i, cfg) {
|
|
@@ -11380,11 +11381,11 @@ function buildOfferOrder(i, cfg) {
|
|
|
11380
11381
|
salt: i.salt,
|
|
11381
11382
|
counter: i.counter
|
|
11382
11383
|
};
|
|
11383
|
-
const typedData =
|
|
11384
|
+
const typedData = chunkBLEFV7GP_cjs.stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
|
|
11384
11385
|
return { orderParams, typedData };
|
|
11385
11386
|
}
|
|
11386
11387
|
function registerPayload(orderParams, signature) {
|
|
11387
|
-
return
|
|
11388
|
+
return chunkBLEFV7GP_cjs.stringifyBigInts({
|
|
11388
11389
|
parameters: {
|
|
11389
11390
|
...orderParams,
|
|
11390
11391
|
offer: { ...orderParams.offer, item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type) },
|
|
@@ -11415,14 +11416,14 @@ function buildFulfillCalls(a, cfg) {
|
|
|
11415
11416
|
return fee ? [approve, fulfill, fee] : [approve, fulfill];
|
|
11416
11417
|
}
|
|
11417
11418
|
function buildCancelCalls(a, cfg) {
|
|
11418
|
-
const cancelRequest =
|
|
11419
|
+
const cancelRequest = chunkBLEFV7GP_cjs.stringifyBigInts({
|
|
11419
11420
|
cancelation: { order_hash: a.orderHash, offerer: a.offerer },
|
|
11420
11421
|
signature: a.signature
|
|
11421
11422
|
});
|
|
11422
11423
|
return [contractFor(cfg).populate("cancel_order", [cancelRequest])];
|
|
11423
11424
|
}
|
|
11424
11425
|
function buildCancelTypedData(orderHash, offerer, cfg) {
|
|
11425
|
-
return
|
|
11426
|
+
return chunkBLEFV7GP_cjs.stringifyBigInts(buildCancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg)));
|
|
11426
11427
|
}
|
|
11427
11428
|
function contractFor2(cfg) {
|
|
11428
11429
|
return newContract(Medialane1155ABI, cfg.marketplace1155Contract);
|
|
@@ -11445,7 +11446,7 @@ function buildListing1155Order(i, cfg) {
|
|
|
11445
11446
|
salt: i.salt,
|
|
11446
11447
|
counter: i.counter
|
|
11447
11448
|
};
|
|
11448
|
-
const typedData =
|
|
11449
|
+
const typedData = chunkBLEFV7GP_cjs.stringifyBigInts(
|
|
11449
11450
|
build1155OrderTypedData(orderParams, getChainId(cfg))
|
|
11450
11451
|
);
|
|
11451
11452
|
return { orderParams, typedData };
|
|
@@ -11468,13 +11469,13 @@ function buildOffer1155Order(i, cfg) {
|
|
|
11468
11469
|
salt: i.salt,
|
|
11469
11470
|
counter: i.counter
|
|
11470
11471
|
};
|
|
11471
|
-
const typedData =
|
|
11472
|
+
const typedData = chunkBLEFV7GP_cjs.stringifyBigInts(
|
|
11472
11473
|
build1155OrderTypedData(orderParams, getChainId(cfg))
|
|
11473
11474
|
);
|
|
11474
11475
|
return { orderParams, typedData };
|
|
11475
11476
|
}
|
|
11476
11477
|
function registerPayload2(orderParams, signature) {
|
|
11477
|
-
return
|
|
11478
|
+
return chunkBLEFV7GP_cjs.stringifyBigInts({
|
|
11478
11479
|
parameters: {
|
|
11479
11480
|
...orderParams,
|
|
11480
11481
|
offer: { ...orderParams.offer, item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type) },
|
|
@@ -11505,14 +11506,14 @@ function buildFulfill1155Calls(a, cfg) {
|
|
|
11505
11506
|
return fee ? [approve, fulfill, fee] : [approve, fulfill];
|
|
11506
11507
|
}
|
|
11507
11508
|
function buildCancel1155Calls(a, cfg) {
|
|
11508
|
-
const cancelPayload =
|
|
11509
|
+
const cancelPayload = chunkBLEFV7GP_cjs.stringifyBigInts({
|
|
11509
11510
|
cancelation: { order_hash: a.orderHash, offerer: a.offerer },
|
|
11510
11511
|
signature: a.signature
|
|
11511
11512
|
});
|
|
11512
11513
|
return [contractFor2(cfg).populate("cancel_order", [cancelPayload])];
|
|
11513
11514
|
}
|
|
11514
11515
|
function buildCancel1155TypedData(orderHash, offerer, cfg) {
|
|
11515
|
-
return
|
|
11516
|
+
return chunkBLEFV7GP_cjs.stringifyBigInts(
|
|
11516
11517
|
build1155CancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg))
|
|
11517
11518
|
);
|
|
11518
11519
|
}
|
|
@@ -11881,7 +11882,7 @@ async function confirmIntentBestEffort(client, intentId, txHash) {
|
|
|
11881
11882
|
var SYNC_TIMEOUT_MS = 2e4;
|
|
11882
11883
|
var SYNC_RETRY_MS = 2e3;
|
|
11883
11884
|
function readableLater(err) {
|
|
11884
|
-
return err instanceof
|
|
11885
|
+
return err instanceof chunkBLEFV7GP_cjs.MedialaneApiError && err.status === 404;
|
|
11885
11886
|
}
|
|
11886
11887
|
async function syncTransactionBestEffort(client, txHash, timeoutMs = SYNC_TIMEOUT_MS, retryMs = SYNC_RETRY_MS) {
|
|
11887
11888
|
const deadline = Date.now() + timeoutMs;
|
|
@@ -11916,14 +11917,14 @@ async function assertTransactionSucceeded(provider, txHash, retryDelaysMs = RECE
|
|
|
11916
11917
|
const receipt = await provider.getTransactionReceipt(txHash);
|
|
11917
11918
|
const status = receipt.execution_status ?? receipt.status;
|
|
11918
11919
|
if (status === "REVERTED" || status === "REJECTED") {
|
|
11919
|
-
throw new
|
|
11920
|
+
throw new chunkBLEFV7GP_cjs.UserFacingError("Transaction was submitted but reverted onchain. Please check your balance and try again.");
|
|
11920
11921
|
}
|
|
11921
11922
|
if (status) return receipt;
|
|
11922
11923
|
} catch (err) {
|
|
11923
11924
|
if (err instanceof Error && err.message.includes("reverted onchain")) throw err;
|
|
11924
11925
|
}
|
|
11925
11926
|
}
|
|
11926
|
-
throw new
|
|
11927
|
+
throw new chunkBLEFV7GP_cjs.UserFacingError("Verification timed out. Check your account for the transaction status.");
|
|
11927
11928
|
}
|
|
11928
11929
|
async function executeIntent(signer, client, intent, opts = {}) {
|
|
11929
11930
|
let calls;
|
|
@@ -11976,14 +11977,14 @@ function u2563(low, high) {
|
|
|
11976
11977
|
return (BigInt(low ?? 0) + (BigInt(high ?? 0) << 128n)).toString();
|
|
11977
11978
|
}
|
|
11978
11979
|
function deployedCollectionFromReceipt(receipt, service) {
|
|
11979
|
-
const factory =
|
|
11980
|
+
const factory = chunkBLEFV7GP_cjs.getService(service)?.onchain?.STARKNET?.factoryAddress;
|
|
11980
11981
|
const { event, address } = DEPLOY_EVENTS[service];
|
|
11981
11982
|
const selector = BigInt(starknet.hash.getSelectorFromName(event));
|
|
11982
11983
|
for (const e of receipt.events ?? []) {
|
|
11983
11984
|
if (factory && !sameFelt(e.from_address, factory)) continue;
|
|
11984
11985
|
if (!sameFelt(e.keys?.[0], selector)) continue;
|
|
11985
11986
|
const value = address(e);
|
|
11986
|
-
if (value) return
|
|
11987
|
+
if (value) return chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", value);
|
|
11987
11988
|
}
|
|
11988
11989
|
return null;
|
|
11989
11990
|
}
|
|
@@ -12104,13 +12105,13 @@ function buildRemoveOwnerByGuidCall(accountAddress, ownerGuid) {
|
|
|
12104
12105
|
}
|
|
12105
12106
|
function buildDeployAccountParams(ownerPubkey, salt = 0) {
|
|
12106
12107
|
return {
|
|
12107
|
-
classHash:
|
|
12108
|
-
constructorCalldata:
|
|
12108
|
+
classHash: chunkBLEFV7GP_cjs.STARKNET_MEDIAWALLET_CLASS_HASH,
|
|
12109
|
+
constructorCalldata: chunkBLEFV7GP_cjs.ownerConstructorCalldata(ownerPubkey),
|
|
12109
12110
|
addressSalt: starknet.num.toHex(salt),
|
|
12110
|
-
contractAddress:
|
|
12111
|
+
contractAddress: chunkBLEFV7GP_cjs.computeAccountAddress(ownerPubkey, salt)
|
|
12111
12112
|
};
|
|
12112
12113
|
}
|
|
12113
|
-
var norm = (address) =>
|
|
12114
|
+
var norm = (address) => chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", address);
|
|
12114
12115
|
var SIGNER_TYPE_NAMES = ["Starknet", "Secp256k1", "Secp256r1"];
|
|
12115
12116
|
function encodeFeltArray(items) {
|
|
12116
12117
|
return [starknet.num.toHex(items.length), ...items];
|
|
@@ -12307,7 +12308,7 @@ var InvalidRecoveryKeyError = class extends Error {
|
|
|
12307
12308
|
var canonicalAddress = (address) => `0x${BigInt(address).toString(16).padStart(64, "0")}`;
|
|
12308
12309
|
function keyPair(privateKey) {
|
|
12309
12310
|
try {
|
|
12310
|
-
return
|
|
12311
|
+
return chunkBLEFV7GP_cjs.starkKeyPairFromPrivateKey(privateKey);
|
|
12311
12312
|
} catch {
|
|
12312
12313
|
throw new InvalidRecoveryKeyError();
|
|
12313
12314
|
}
|
|
@@ -12320,7 +12321,7 @@ function parseRecoveryKey(input) {
|
|
|
12320
12321
|
const trimmed = input.trim();
|
|
12321
12322
|
if (!trimmed.startsWith(PREFIX)) {
|
|
12322
12323
|
const { privateKeyHex, publicKeyHex } = keyPair(trimmed);
|
|
12323
|
-
return { walletAddress:
|
|
12324
|
+
return { walletAddress: chunkBLEFV7GP_cjs.computeAccountAddress(publicKeyHex, 0), privateKey: privateKeyHex };
|
|
12324
12325
|
}
|
|
12325
12326
|
const parts = trimmed.slice(PREFIX.length).split(":");
|
|
12326
12327
|
const [walletAddress, privateKey] = parts;
|
|
@@ -12342,7 +12343,7 @@ function describeRecoveryAction(escape) {
|
|
|
12342
12343
|
return "none";
|
|
12343
12344
|
}
|
|
12344
12345
|
function normalizeWalletAddress(address) {
|
|
12345
|
-
return
|
|
12346
|
+
return chunkBLEFV7GP_cjs.normalizeAddress("STARKNET", address);
|
|
12346
12347
|
}
|
|
12347
12348
|
function isValidStarknetAddress(address) {
|
|
12348
12349
|
try {
|
|
@@ -12387,7 +12388,7 @@ async function estimateSelfFundedFee(provider, address, calls) {
|
|
|
12387
12388
|
return { feeRaw: estimate.overall_fee, unit: estimate.unit, balanceRaw };
|
|
12388
12389
|
}
|
|
12389
12390
|
async function feeTokenBalance(provider, address, unit) {
|
|
12390
|
-
const token =
|
|
12391
|
+
const token = chunkBLEFV7GP_cjs.getTokenBySymbol(unit === "FRI" ? "STRK" : "ETH");
|
|
12391
12392
|
if (!token) throw new Error(`No fee token for unit ${unit}`);
|
|
12392
12393
|
return erc20Balance(provider, token.address, address);
|
|
12393
12394
|
}
|
|
@@ -12414,7 +12415,7 @@ function sponsoredExecutor(deps) {
|
|
|
12414
12415
|
{ proxyUrl: deps.proxyUrl, fetchImpl: deps.fetchImpl },
|
|
12415
12416
|
{
|
|
12416
12417
|
address: userAddress,
|
|
12417
|
-
signTypedData: async (data) =>
|
|
12418
|
+
signTypedData: async (data) => chunkBLEFV7GP_cjs.signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(data, userAddress))
|
|
12418
12419
|
},
|
|
12419
12420
|
{ intentIds }
|
|
12420
12421
|
);
|
|
@@ -12474,7 +12475,7 @@ async function deploySelfFunded(input) {
|
|
|
12474
12475
|
});
|
|
12475
12476
|
const { transaction_hash } = await account.deployAccount({
|
|
12476
12477
|
classHash,
|
|
12477
|
-
constructorCalldata:
|
|
12478
|
+
constructorCalldata: chunkBLEFV7GP_cjs.ownerConstructorCalldata(input.ownerPubKey),
|
|
12478
12479
|
addressSalt: 0,
|
|
12479
12480
|
contractAddress: input.ownerAddress
|
|
12480
12481
|
});
|
|
@@ -12630,7 +12631,7 @@ function createMediaWallet(config) {
|
|
|
12630
12631
|
};
|
|
12631
12632
|
const walletIntents = config.walletIntents ?? (async (params) => {
|
|
12632
12633
|
if (!config.backendUrl) throw new Error("This wallet has no backend url configured");
|
|
12633
|
-
const created = await new
|
|
12634
|
+
const created = await new chunkBLEFV7GP_cjs.ApiClient(config.backendUrl).createWalletManageIntent(params);
|
|
12634
12635
|
return created.data;
|
|
12635
12636
|
});
|
|
12636
12637
|
const manage = async (sealed, params) => {
|
|
@@ -12647,7 +12648,7 @@ function createMediaWallet(config) {
|
|
|
12647
12648
|
address: sealed.address,
|
|
12648
12649
|
signTypedData: async (data) => {
|
|
12649
12650
|
const privateKeyHex = await unlockOnce(sealed);
|
|
12650
|
-
return
|
|
12651
|
+
return chunkBLEFV7GP_cjs.signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(data, sealed.address));
|
|
12651
12652
|
},
|
|
12652
12653
|
execute: async (calls, opts) => {
|
|
12653
12654
|
const { transactionHash } = await run(sealed, calls, void 0, opts?.intentIds);
|
|
@@ -12688,55 +12689,55 @@ async function claimSessionWallet(api, walletAddress, deps) {
|
|
|
12688
12689
|
|
|
12689
12690
|
Object.defineProperty(exports, "InvalidStarkPrivateKeyError", {
|
|
12690
12691
|
enumerable: true,
|
|
12691
|
-
get: function () { return
|
|
12692
|
+
get: function () { return chunkBLEFV7GP_cjs.InvalidStarkPrivateKeyError; }
|
|
12692
12693
|
});
|
|
12693
12694
|
Object.defineProperty(exports, "PasskeyCancelledError", {
|
|
12694
12695
|
enumerable: true,
|
|
12695
|
-
get: function () { return
|
|
12696
|
+
get: function () { return chunkBLEFV7GP_cjs.PasskeyCancelledError; }
|
|
12696
12697
|
});
|
|
12697
12698
|
Object.defineProperty(exports, "PasskeyUnsupportedError", {
|
|
12698
12699
|
enumerable: true,
|
|
12699
|
-
get: function () { return
|
|
12700
|
+
get: function () { return chunkBLEFV7GP_cjs.PasskeyUnsupportedError; }
|
|
12700
12701
|
});
|
|
12701
12702
|
Object.defineProperty(exports, "UserFacingError", {
|
|
12702
12703
|
enumerable: true,
|
|
12703
|
-
get: function () { return
|
|
12704
|
+
get: function () { return chunkBLEFV7GP_cjs.UserFacingError; }
|
|
12704
12705
|
});
|
|
12705
12706
|
Object.defineProperty(exports, "computeAccountAddress", {
|
|
12706
12707
|
enumerable: true,
|
|
12707
|
-
get: function () { return
|
|
12708
|
+
get: function () { return chunkBLEFV7GP_cjs.computeAccountAddress; }
|
|
12708
12709
|
});
|
|
12709
12710
|
Object.defineProperty(exports, "createPasskeyOwner", {
|
|
12710
12711
|
enumerable: true,
|
|
12711
|
-
get: function () { return
|
|
12712
|
+
get: function () { return chunkBLEFV7GP_cjs.createPasskeyOwner; }
|
|
12712
12713
|
});
|
|
12713
12714
|
Object.defineProperty(exports, "deriveAesKey", {
|
|
12714
12715
|
enumerable: true,
|
|
12715
|
-
get: function () { return
|
|
12716
|
+
get: function () { return chunkBLEFV7GP_cjs.deriveAesKey; }
|
|
12716
12717
|
});
|
|
12717
12718
|
Object.defineProperty(exports, "generateStarkKeyPair", {
|
|
12718
12719
|
enumerable: true,
|
|
12719
|
-
get: function () { return
|
|
12720
|
+
get: function () { return chunkBLEFV7GP_cjs.generateStarkKeyPair; }
|
|
12720
12721
|
});
|
|
12721
12722
|
Object.defineProperty(exports, "ownerConstructorCalldata", {
|
|
12722
12723
|
enumerable: true,
|
|
12723
|
-
get: function () { return
|
|
12724
|
+
get: function () { return chunkBLEFV7GP_cjs.ownerConstructorCalldata; }
|
|
12724
12725
|
});
|
|
12725
12726
|
Object.defineProperty(exports, "sealPrivateKey", {
|
|
12726
12727
|
enumerable: true,
|
|
12727
|
-
get: function () { return
|
|
12728
|
+
get: function () { return chunkBLEFV7GP_cjs.sealPrivateKey; }
|
|
12728
12729
|
});
|
|
12729
12730
|
Object.defineProperty(exports, "signWithPrivateKey", {
|
|
12730
12731
|
enumerable: true,
|
|
12731
|
-
get: function () { return
|
|
12732
|
+
get: function () { return chunkBLEFV7GP_cjs.signWithPrivateKey; }
|
|
12732
12733
|
});
|
|
12733
12734
|
Object.defineProperty(exports, "starkKeyPairFromPrivateKey", {
|
|
12734
12735
|
enumerable: true,
|
|
12735
|
-
get: function () { return
|
|
12736
|
+
get: function () { return chunkBLEFV7GP_cjs.starkKeyPairFromPrivateKey; }
|
|
12736
12737
|
});
|
|
12737
12738
|
Object.defineProperty(exports, "unsealPrivateKey", {
|
|
12738
12739
|
enumerable: true,
|
|
12739
|
-
get: function () { return
|
|
12740
|
+
get: function () { return chunkBLEFV7GP_cjs.unsealPrivateKey; }
|
|
12740
12741
|
});
|
|
12741
12742
|
exports.COIN_MAX_SUPPLY = MAX_SUPPLY;
|
|
12742
12743
|
exports.COIN_MIN_SUPPLY = MIN_SUPPLY;
|