@medialane/sdk 0.195.0 → 0.198.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-7G7YIGXJ.cjs → chunk-2R7XBA34.cjs} +81 -49
- package/dist/chunk-2R7XBA34.cjs.map +1 -0
- package/dist/{chunk-ZCHP5D7S.js → chunk-6WVUUBFI.js} +80 -50
- package/dist/chunk-6WVUUBFI.js.map +1 -0
- package/dist/{errors-C39AqEX6.d.cts → errors-CZm-NZK0.d.cts} +12 -6
- package/dist/{errors-Cc9W7FFi.d.ts → errors-h6H6cj3Q.d.ts} +12 -6
- package/dist/index.cjs +79 -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 +4 -3
- package/dist/index.js.map +1 -1
- package/dist/starknet/index.cjs +75 -67
- 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-7G7YIGXJ.cjs.map +0 -1
- package/dist/chunk-ZCHP5D7S.js.map +0 -1
package/dist/starknet/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk2R7XBA34_cjs = require('../chunk-2R7XBA34.cjs');
|
|
4
4
|
var chunk7EYJC5CB_cjs = require('../chunk-7EYJC5CB.cjs');
|
|
5
5
|
require('../chunk-Q7SFCCGT.cjs');
|
|
6
6
|
var starknet = require('starknet');
|
|
@@ -34,7 +34,7 @@ function getChainId(config) {
|
|
|
34
34
|
return starknet.constants.StarknetChainId.SN_MAIN;
|
|
35
35
|
}
|
|
36
36
|
function resolveToken(currency) {
|
|
37
|
-
const token =
|
|
37
|
+
const token = chunk2R7XBA34_cjs.SUPPORTED_TOKENS.find(
|
|
38
38
|
(t) => t.symbol === currency.toUpperCase() || t.address.toLowerCase() === currency.toLowerCase()
|
|
39
39
|
);
|
|
40
40
|
if (!token) throw new MedialaneError(`Unsupported currency: ${currency}`, "INVALID_PARAMS");
|
|
@@ -10406,7 +10406,7 @@ function merkleTree(leafHashes) {
|
|
|
10406
10406
|
};
|
|
10407
10407
|
}
|
|
10408
10408
|
function buildPopAllowlist(addresses) {
|
|
10409
|
-
const unique = [...new Set(addresses.map((a) =>
|
|
10409
|
+
const unique = [...new Set(addresses.map((a) => chunk2R7XBA34_cjs.normalizeAddress("STARKNET", a)))];
|
|
10410
10410
|
if (unique.length === 0) throw new Error("An allowlist needs at least one address");
|
|
10411
10411
|
const leaves = unique.map((address) => ({ address, leaf: popLeafHash(address) }));
|
|
10412
10412
|
const tree = merkleTree(leaves.map((l) => l.leaf));
|
|
@@ -10432,7 +10432,7 @@ function decodePopClaimFragment(fragment) {
|
|
|
10432
10432
|
|
|
10433
10433
|
// src/starknet/pop-claim.ts
|
|
10434
10434
|
function popClaimLinks(origin, collection, list) {
|
|
10435
|
-
const base = `${origin}${
|
|
10435
|
+
const base = `${origin}${chunk2R7XBA34_cjs.collectionHref("STARKNET", collection)}`;
|
|
10436
10436
|
return Object.entries(list.proofs).map(([address, proof]) => ({
|
|
10437
10437
|
address,
|
|
10438
10438
|
url: `${base}${encodePopClaimFragment(proof)}`
|
|
@@ -10442,7 +10442,7 @@ function popClaimLinksCsv(links) {
|
|
|
10442
10442
|
return ["address,claim_link", ...links.map((l) => `${l.address},${l.url}`)].join("\n");
|
|
10443
10443
|
}
|
|
10444
10444
|
async function popClaimInfo(provider, collection) {
|
|
10445
|
-
const contractAddress =
|
|
10445
|
+
const contractAddress = chunk2R7XBA34_cjs.normalizeAddress("STARKNET", collection);
|
|
10446
10446
|
const [root, end] = await Promise.all([
|
|
10447
10447
|
provider.callContract({ contractAddress, entrypoint: "allowlist_root", calldata: [] }),
|
|
10448
10448
|
provider.callContract({ contractAddress, entrypoint: "claim_end_time", calldata: [] })
|
|
@@ -10459,7 +10459,7 @@ function popClaimState(input) {
|
|
|
10459
10459
|
if (!wallet || !verifyPopProof(info.root, wallet, proof)) return "wrong-wallet";
|
|
10460
10460
|
return "ready";
|
|
10461
10461
|
}
|
|
10462
|
-
var addr = (a) =>
|
|
10462
|
+
var addr = (a) => chunk2R7XBA34_cjs.normalizeAddress("STARKNET", a);
|
|
10463
10463
|
var byteArrayFelts = (s) => starknet.CallData.compile([starknet.byteArray.byteArrayFromString(s)]);
|
|
10464
10464
|
var popCalls = {
|
|
10465
10465
|
claim(collection, proof) {
|
|
@@ -10514,9 +10514,9 @@ var PopService = class {
|
|
|
10514
10514
|
};
|
|
10515
10515
|
async function popHasClaimed(provider, collection, address) {
|
|
10516
10516
|
const res = await provider.callContract({
|
|
10517
|
-
contractAddress:
|
|
10517
|
+
contractAddress: chunk2R7XBA34_cjs.normalizeAddress("STARKNET", collection),
|
|
10518
10518
|
entrypoint: "has_claimed",
|
|
10519
|
-
calldata: [
|
|
10519
|
+
calldata: [chunk2R7XBA34_cjs.normalizeAddress("STARKNET", address)]
|
|
10520
10520
|
});
|
|
10521
10521
|
return BigInt(res[0] ?? "0x0") !== 0n;
|
|
10522
10522
|
}
|
|
@@ -10538,7 +10538,7 @@ function buildFeeCall(p, cfg) {
|
|
|
10538
10538
|
};
|
|
10539
10539
|
}
|
|
10540
10540
|
var DROP_MAX_CLAIM_QUANTITY = 50n;
|
|
10541
|
-
var addr2 = (a) =>
|
|
10541
|
+
var addr2 = (a) => chunk2R7XBA34_cjs.normalizeAddress("STARKNET", a);
|
|
10542
10542
|
var factoryData = new starknet.CallData(DropFactoryABI);
|
|
10543
10543
|
var collectionData = new starknet.CallData(DropCollectionABI);
|
|
10544
10544
|
function toContractTerms(t) {
|
|
@@ -10608,7 +10608,7 @@ function dropMintCost(price, quantity, feeBps2) {
|
|
|
10608
10608
|
}
|
|
10609
10609
|
|
|
10610
10610
|
// src/starknet/drop-state.ts
|
|
10611
|
-
var hex = (v) =>
|
|
10611
|
+
var hex = (v) => chunk2R7XBA34_cjs.normalizeAddress("STARKNET", v ?? "0x0");
|
|
10612
10612
|
var u256 = (low, high) => BigInt(low ?? "0x0") + (BigInt(high ?? "0x0") << 128n);
|
|
10613
10613
|
async function readDrop(provider, collection) {
|
|
10614
10614
|
const contractAddress = hex(collection);
|
|
@@ -10663,7 +10663,7 @@ function dropMintState(input) {
|
|
|
10663
10663
|
return { state: "ready", maxQuantity: max };
|
|
10664
10664
|
}
|
|
10665
10665
|
function dropClaimLinks(origin, collection, list) {
|
|
10666
|
-
const base = `${origin}${
|
|
10666
|
+
const base = `${origin}${chunk2R7XBA34_cjs.dropHref(collection)}`;
|
|
10667
10667
|
return Object.entries(list.proofs).map(([address, proof]) => ({
|
|
10668
10668
|
address,
|
|
10669
10669
|
url: `${base}${encodePopClaimFragment(proof)}`
|
|
@@ -10714,14 +10714,14 @@ var ERC1155CollectionService = class {
|
|
|
10714
10714
|
_factory(account) {
|
|
10715
10715
|
return newContract(
|
|
10716
10716
|
IPCollection1155FactoryABI,
|
|
10717
|
-
|
|
10717
|
+
chunk2R7XBA34_cjs.normalizeAddress("STARKNET", this.factoryAddress),
|
|
10718
10718
|
account
|
|
10719
10719
|
);
|
|
10720
10720
|
}
|
|
10721
10721
|
_collection(address, account) {
|
|
10722
10722
|
return newContract(
|
|
10723
10723
|
IPCollection1155ABI,
|
|
10724
|
-
|
|
10724
|
+
chunk2R7XBA34_cjs.normalizeAddress("STARKNET", address),
|
|
10725
10725
|
account
|
|
10726
10726
|
);
|
|
10727
10727
|
}
|
|
@@ -10949,20 +10949,20 @@ function buildLaunchOnEkuboCalls(params) {
|
|
|
10949
10949
|
}
|
|
10950
10950
|
var CREATOR_COIN_CREATED_SELECTOR = starknet.hash.getSelectorFromName("CreatorCoinCreated");
|
|
10951
10951
|
function parseCreatorCoinCreated(receipt) {
|
|
10952
|
-
const factory =
|
|
10952
|
+
const factory = chunk2R7XBA34_cjs.normalizeAddress("STARKNET", chunk7EYJC5CB_cjs.getStarknetCoordinates("STARKNET").creatorCoinFactory);
|
|
10953
10953
|
for (const ev of receipt?.events ?? []) {
|
|
10954
10954
|
let from;
|
|
10955
10955
|
try {
|
|
10956
|
-
from =
|
|
10956
|
+
from = chunk2R7XBA34_cjs.normalizeAddress("STARKNET", ev.from_address ?? "");
|
|
10957
10957
|
} catch {
|
|
10958
10958
|
continue;
|
|
10959
10959
|
}
|
|
10960
10960
|
if (from !== factory) continue;
|
|
10961
10961
|
const k0 = ev.keys?.[0];
|
|
10962
|
-
if (!k0 ||
|
|
10962
|
+
if (!k0 || chunk2R7XBA34_cjs.normalizeAddress("STARKNET", k0) !== chunk2R7XBA34_cjs.normalizeAddress("STARKNET", CREATOR_COIN_CREATED_SELECTOR)) continue;
|
|
10963
10963
|
const data = ev.data ?? [];
|
|
10964
10964
|
if (data.length < 1) continue;
|
|
10965
|
-
return
|
|
10965
|
+
return chunk2R7XBA34_cjs.normalizeAddress("STARKNET", data[data.length - 1]);
|
|
10966
10966
|
}
|
|
10967
10967
|
throw new Error("Coin deployed but the coin address could not be read from the receipt");
|
|
10968
10968
|
}
|
|
@@ -10993,10 +10993,10 @@ var TicketService = class {
|
|
|
10993
10993
|
_factory(account, factoryAddress) {
|
|
10994
10994
|
const address = factoryAddress ?? this.factoryAddress;
|
|
10995
10995
|
if (!address) throw new Error("IP-Tickets factory address not configured for this chain");
|
|
10996
|
-
return newContract(IPTicketCollectionFactoryABI,
|
|
10996
|
+
return newContract(IPTicketCollectionFactoryABI, chunk2R7XBA34_cjs.normalizeAddress("STARKNET", address), account);
|
|
10997
10997
|
}
|
|
10998
10998
|
_collection(address, account) {
|
|
10999
|
-
return newContract(IPTicketCollectionABI,
|
|
10999
|
+
return newContract(IPTicketCollectionABI, chunk2R7XBA34_cjs.normalizeAddress("STARKNET", address), account);
|
|
11000
11000
|
}
|
|
11001
11001
|
async deployCollection(account, params) {
|
|
11002
11002
|
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
@@ -11037,10 +11037,10 @@ var ClubService = class {
|
|
|
11037
11037
|
_factory(account, factoryAddress) {
|
|
11038
11038
|
const address = factoryAddress ?? this.factoryAddress;
|
|
11039
11039
|
if (!address) throw new Error("IP-Club factory address not configured for this chain");
|
|
11040
|
-
return newContract(IPClubFactoryABI,
|
|
11040
|
+
return newContract(IPClubFactoryABI, chunk2R7XBA34_cjs.normalizeAddress("STARKNET", address), account);
|
|
11041
11041
|
}
|
|
11042
11042
|
_collection(address, account) {
|
|
11043
|
-
return newContract(IPClubCollectionABI,
|
|
11043
|
+
return newContract(IPClubCollectionABI, chunk2R7XBA34_cjs.normalizeAddress("STARKNET", address), account);
|
|
11044
11044
|
}
|
|
11045
11045
|
async deployCollection(account, params) {
|
|
11046
11046
|
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
@@ -11083,7 +11083,7 @@ var SponsorshipService = class {
|
|
|
11083
11083
|
if (!resolved) {
|
|
11084
11084
|
throw new Error("IP-Sponsorship address not configured for this chain");
|
|
11085
11085
|
}
|
|
11086
|
-
return newContract(IPSponsorshipABI,
|
|
11086
|
+
return newContract(IPSponsorshipABI, chunk2R7XBA34_cjs.normalizeAddress("STARKNET", resolved), account);
|
|
11087
11087
|
}
|
|
11088
11088
|
async createOffer(account, params) {
|
|
11089
11089
|
const specificSponsor = params.specificSponsor ? new starknet.CairoOption(starknet.CairoOptionVariant.Some, params.specificSponsor) : new starknet.CairoOption(starknet.CairoOptionVariant.None);
|
|
@@ -11118,7 +11118,7 @@ var SponsorshipService = class {
|
|
|
11118
11118
|
const approveCall = {
|
|
11119
11119
|
contractAddress: params.paymentToken,
|
|
11120
11120
|
entrypoint: "approve",
|
|
11121
|
-
calldata: [
|
|
11121
|
+
calldata: [chunk2R7XBA34_cjs.normalizeAddress("STARKNET", sponsorshipAddress), amount.low.toString(), amount.high.toString()]
|
|
11122
11122
|
};
|
|
11123
11123
|
const bidCall = this._contract(account, sponsorshipAddress).populate("place_bid", [
|
|
11124
11124
|
starknet.cairo.uint256(params.offerId),
|
|
@@ -11190,7 +11190,7 @@ function createChainProvider(backendUrl, apiKey) {
|
|
|
11190
11190
|
// src/starknet/client.ts
|
|
11191
11191
|
var MedialaneClient = class {
|
|
11192
11192
|
constructor(rawConfig = {}) {
|
|
11193
|
-
this.config =
|
|
11193
|
+
this.config = chunk2R7XBA34_cjs.resolveConfig(rawConfig);
|
|
11194
11194
|
this.services = {
|
|
11195
11195
|
pop: new PopService(this.config),
|
|
11196
11196
|
drop: new DropService(this.config),
|
|
@@ -11201,9 +11201,9 @@ var MedialaneClient = class {
|
|
|
11201
11201
|
sponsorship: new SponsorshipService(this.config)
|
|
11202
11202
|
};
|
|
11203
11203
|
if (!this.config.backendUrl) {
|
|
11204
|
-
const sentinel = new
|
|
11204
|
+
const sentinel = new chunk2R7XBA34_cjs.ApiClient("https://medialane-sdk-no-backend.invalid", this.config.apiKey);
|
|
11205
11205
|
const apiMethodNames = new Set(
|
|
11206
|
-
Object.getOwnPropertyNames(
|
|
11206
|
+
Object.getOwnPropertyNames(chunk2R7XBA34_cjs.ApiClient.prototype).filter(
|
|
11207
11207
|
(k) => k !== "constructor" && typeof sentinel[k] === "function"
|
|
11208
11208
|
)
|
|
11209
11209
|
);
|
|
@@ -11220,7 +11220,7 @@ var MedialaneClient = class {
|
|
|
11220
11220
|
}
|
|
11221
11221
|
});
|
|
11222
11222
|
} else {
|
|
11223
|
-
this.api = new
|
|
11223
|
+
this.api = new chunk2R7XBA34_cjs.ApiClient(this.config.backendUrl, this.config.apiKey, this.config.retryOptions, this.config.chain);
|
|
11224
11224
|
}
|
|
11225
11225
|
}
|
|
11226
11226
|
get chain() {
|
|
@@ -11360,7 +11360,7 @@ function buildListingOrder(i, cfg) {
|
|
|
11360
11360
|
salt: i.salt,
|
|
11361
11361
|
counter: i.counter
|
|
11362
11362
|
};
|
|
11363
|
-
const typedData =
|
|
11363
|
+
const typedData = chunk2R7XBA34_cjs.stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
|
|
11364
11364
|
return { orderParams, typedData };
|
|
11365
11365
|
}
|
|
11366
11366
|
function buildOfferOrder(i, cfg) {
|
|
@@ -11381,11 +11381,11 @@ function buildOfferOrder(i, cfg) {
|
|
|
11381
11381
|
salt: i.salt,
|
|
11382
11382
|
counter: i.counter
|
|
11383
11383
|
};
|
|
11384
|
-
const typedData =
|
|
11384
|
+
const typedData = chunk2R7XBA34_cjs.stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
|
|
11385
11385
|
return { orderParams, typedData };
|
|
11386
11386
|
}
|
|
11387
11387
|
function registerPayload(orderParams, signature) {
|
|
11388
|
-
return
|
|
11388
|
+
return chunk2R7XBA34_cjs.stringifyBigInts({
|
|
11389
11389
|
parameters: {
|
|
11390
11390
|
...orderParams,
|
|
11391
11391
|
offer: { ...orderParams.offer, item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type) },
|
|
@@ -11416,14 +11416,14 @@ function buildFulfillCalls(a, cfg) {
|
|
|
11416
11416
|
return fee ? [approve, fulfill, fee] : [approve, fulfill];
|
|
11417
11417
|
}
|
|
11418
11418
|
function buildCancelCalls(a, cfg) {
|
|
11419
|
-
const cancelRequest =
|
|
11419
|
+
const cancelRequest = chunk2R7XBA34_cjs.stringifyBigInts({
|
|
11420
11420
|
cancelation: { order_hash: a.orderHash, offerer: a.offerer },
|
|
11421
11421
|
signature: a.signature
|
|
11422
11422
|
});
|
|
11423
11423
|
return [contractFor(cfg).populate("cancel_order", [cancelRequest])];
|
|
11424
11424
|
}
|
|
11425
11425
|
function buildCancelTypedData(orderHash, offerer, cfg) {
|
|
11426
|
-
return
|
|
11426
|
+
return chunk2R7XBA34_cjs.stringifyBigInts(buildCancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg)));
|
|
11427
11427
|
}
|
|
11428
11428
|
function contractFor2(cfg) {
|
|
11429
11429
|
return newContract(Medialane1155ABI, cfg.marketplace1155Contract);
|
|
@@ -11446,7 +11446,7 @@ function buildListing1155Order(i, cfg) {
|
|
|
11446
11446
|
salt: i.salt,
|
|
11447
11447
|
counter: i.counter
|
|
11448
11448
|
};
|
|
11449
|
-
const typedData =
|
|
11449
|
+
const typedData = chunk2R7XBA34_cjs.stringifyBigInts(
|
|
11450
11450
|
build1155OrderTypedData(orderParams, getChainId(cfg))
|
|
11451
11451
|
);
|
|
11452
11452
|
return { orderParams, typedData };
|
|
@@ -11469,13 +11469,13 @@ function buildOffer1155Order(i, cfg) {
|
|
|
11469
11469
|
salt: i.salt,
|
|
11470
11470
|
counter: i.counter
|
|
11471
11471
|
};
|
|
11472
|
-
const typedData =
|
|
11472
|
+
const typedData = chunk2R7XBA34_cjs.stringifyBigInts(
|
|
11473
11473
|
build1155OrderTypedData(orderParams, getChainId(cfg))
|
|
11474
11474
|
);
|
|
11475
11475
|
return { orderParams, typedData };
|
|
11476
11476
|
}
|
|
11477
11477
|
function registerPayload2(orderParams, signature) {
|
|
11478
|
-
return
|
|
11478
|
+
return chunk2R7XBA34_cjs.stringifyBigInts({
|
|
11479
11479
|
parameters: {
|
|
11480
11480
|
...orderParams,
|
|
11481
11481
|
offer: { ...orderParams.offer, item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type) },
|
|
@@ -11506,14 +11506,14 @@ function buildFulfill1155Calls(a, cfg) {
|
|
|
11506
11506
|
return fee ? [approve, fulfill, fee] : [approve, fulfill];
|
|
11507
11507
|
}
|
|
11508
11508
|
function buildCancel1155Calls(a, cfg) {
|
|
11509
|
-
const cancelPayload =
|
|
11509
|
+
const cancelPayload = chunk2R7XBA34_cjs.stringifyBigInts({
|
|
11510
11510
|
cancelation: { order_hash: a.orderHash, offerer: a.offerer },
|
|
11511
11511
|
signature: a.signature
|
|
11512
11512
|
});
|
|
11513
11513
|
return [contractFor2(cfg).populate("cancel_order", [cancelPayload])];
|
|
11514
11514
|
}
|
|
11515
11515
|
function buildCancel1155TypedData(orderHash, offerer, cfg) {
|
|
11516
|
-
return
|
|
11516
|
+
return chunk2R7XBA34_cjs.stringifyBigInts(
|
|
11517
11517
|
build1155CancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg))
|
|
11518
11518
|
);
|
|
11519
11519
|
}
|
|
@@ -11882,7 +11882,7 @@ async function confirmIntentBestEffort(client, intentId, txHash) {
|
|
|
11882
11882
|
var SYNC_TIMEOUT_MS = 2e4;
|
|
11883
11883
|
var SYNC_RETRY_MS = 2e3;
|
|
11884
11884
|
function readableLater(err) {
|
|
11885
|
-
return err instanceof
|
|
11885
|
+
return err instanceof chunk2R7XBA34_cjs.MedialaneApiError && err.status === 404;
|
|
11886
11886
|
}
|
|
11887
11887
|
async function syncTransactionBestEffort(client, txHash, timeoutMs = SYNC_TIMEOUT_MS, retryMs = SYNC_RETRY_MS) {
|
|
11888
11888
|
const deadline = Date.now() + timeoutMs;
|
|
@@ -11917,14 +11917,14 @@ async function assertTransactionSucceeded(provider, txHash, retryDelaysMs = RECE
|
|
|
11917
11917
|
const receipt = await provider.getTransactionReceipt(txHash);
|
|
11918
11918
|
const status = receipt.execution_status ?? receipt.status;
|
|
11919
11919
|
if (status === "REVERTED" || status === "REJECTED") {
|
|
11920
|
-
throw new
|
|
11920
|
+
throw new chunk2R7XBA34_cjs.UserFacingError("Transaction was submitted but reverted onchain. Please check your balance and try again.");
|
|
11921
11921
|
}
|
|
11922
11922
|
if (status) return receipt;
|
|
11923
11923
|
} catch (err) {
|
|
11924
11924
|
if (err instanceof Error && err.message.includes("reverted onchain")) throw err;
|
|
11925
11925
|
}
|
|
11926
11926
|
}
|
|
11927
|
-
throw new
|
|
11927
|
+
throw new chunk2R7XBA34_cjs.UserFacingError("Verification timed out. Check your account for the transaction status.");
|
|
11928
11928
|
}
|
|
11929
11929
|
async function executeIntent(signer, client, intent, opts = {}) {
|
|
11930
11930
|
let calls;
|
|
@@ -11977,14 +11977,14 @@ function u2563(low, high) {
|
|
|
11977
11977
|
return (BigInt(low ?? 0) + (BigInt(high ?? 0) << 128n)).toString();
|
|
11978
11978
|
}
|
|
11979
11979
|
function deployedCollectionFromReceipt(receipt, service) {
|
|
11980
|
-
const factory =
|
|
11980
|
+
const factory = chunk2R7XBA34_cjs.getService(service)?.onchain?.STARKNET?.factoryAddress;
|
|
11981
11981
|
const { event, address } = DEPLOY_EVENTS[service];
|
|
11982
11982
|
const selector = BigInt(starknet.hash.getSelectorFromName(event));
|
|
11983
11983
|
for (const e of receipt.events ?? []) {
|
|
11984
11984
|
if (factory && !sameFelt(e.from_address, factory)) continue;
|
|
11985
11985
|
if (!sameFelt(e.keys?.[0], selector)) continue;
|
|
11986
11986
|
const value = address(e);
|
|
11987
|
-
if (value) return
|
|
11987
|
+
if (value) return chunk2R7XBA34_cjs.normalizeAddress("STARKNET", value);
|
|
11988
11988
|
}
|
|
11989
11989
|
return null;
|
|
11990
11990
|
}
|
|
@@ -12105,13 +12105,13 @@ function buildRemoveOwnerByGuidCall(accountAddress, ownerGuid) {
|
|
|
12105
12105
|
}
|
|
12106
12106
|
function buildDeployAccountParams(ownerPubkey, salt = 0) {
|
|
12107
12107
|
return {
|
|
12108
|
-
classHash:
|
|
12109
|
-
constructorCalldata:
|
|
12108
|
+
classHash: chunk2R7XBA34_cjs.STARKNET_MEDIAWALLET_CLASS_HASH,
|
|
12109
|
+
constructorCalldata: chunk2R7XBA34_cjs.ownerConstructorCalldata(ownerPubkey),
|
|
12110
12110
|
addressSalt: starknet.num.toHex(salt),
|
|
12111
|
-
contractAddress:
|
|
12111
|
+
contractAddress: chunk2R7XBA34_cjs.computeAccountAddress(ownerPubkey, salt)
|
|
12112
12112
|
};
|
|
12113
12113
|
}
|
|
12114
|
-
var norm = (address) =>
|
|
12114
|
+
var norm = (address) => chunk2R7XBA34_cjs.normalizeAddress("STARKNET", address);
|
|
12115
12115
|
var SIGNER_TYPE_NAMES = ["Starknet", "Secp256k1", "Secp256r1"];
|
|
12116
12116
|
function encodeFeltArray(items) {
|
|
12117
12117
|
return [starknet.num.toHex(items.length), ...items];
|
|
@@ -12308,7 +12308,7 @@ var InvalidRecoveryKeyError = class extends Error {
|
|
|
12308
12308
|
var canonicalAddress = (address) => `0x${BigInt(address).toString(16).padStart(64, "0")}`;
|
|
12309
12309
|
function keyPair(privateKey) {
|
|
12310
12310
|
try {
|
|
12311
|
-
return
|
|
12311
|
+
return chunk2R7XBA34_cjs.starkKeyPairFromPrivateKey(privateKey);
|
|
12312
12312
|
} catch {
|
|
12313
12313
|
throw new InvalidRecoveryKeyError();
|
|
12314
12314
|
}
|
|
@@ -12321,7 +12321,7 @@ function parseRecoveryKey(input) {
|
|
|
12321
12321
|
const trimmed = input.trim();
|
|
12322
12322
|
if (!trimmed.startsWith(PREFIX)) {
|
|
12323
12323
|
const { privateKeyHex, publicKeyHex } = keyPair(trimmed);
|
|
12324
|
-
return { walletAddress:
|
|
12324
|
+
return { walletAddress: chunk2R7XBA34_cjs.computeAccountAddress(publicKeyHex, 0), privateKey: privateKeyHex };
|
|
12325
12325
|
}
|
|
12326
12326
|
const parts = trimmed.slice(PREFIX.length).split(":");
|
|
12327
12327
|
const [walletAddress, privateKey] = parts;
|
|
@@ -12343,7 +12343,7 @@ function describeRecoveryAction(escape) {
|
|
|
12343
12343
|
return "none";
|
|
12344
12344
|
}
|
|
12345
12345
|
function normalizeWalletAddress(address) {
|
|
12346
|
-
return
|
|
12346
|
+
return chunk2R7XBA34_cjs.normalizeAddress("STARKNET", address);
|
|
12347
12347
|
}
|
|
12348
12348
|
function isValidStarknetAddress(address) {
|
|
12349
12349
|
try {
|
|
@@ -12388,7 +12388,7 @@ async function estimateSelfFundedFee(provider, address, calls) {
|
|
|
12388
12388
|
return { feeRaw: estimate.overall_fee, unit: estimate.unit, balanceRaw };
|
|
12389
12389
|
}
|
|
12390
12390
|
async function feeTokenBalance(provider, address, unit) {
|
|
12391
|
-
const token =
|
|
12391
|
+
const token = chunk2R7XBA34_cjs.getTokenBySymbol(unit === "FRI" ? "STRK" : "ETH");
|
|
12392
12392
|
if (!token) throw new Error(`No fee token for unit ${unit}`);
|
|
12393
12393
|
return erc20Balance(provider, token.address, address);
|
|
12394
12394
|
}
|
|
@@ -12415,7 +12415,7 @@ function sponsoredExecutor(deps) {
|
|
|
12415
12415
|
{ proxyUrl: deps.proxyUrl, fetchImpl: deps.fetchImpl },
|
|
12416
12416
|
{
|
|
12417
12417
|
address: userAddress,
|
|
12418
|
-
signTypedData: async (data) =>
|
|
12418
|
+
signTypedData: async (data) => chunk2R7XBA34_cjs.signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(data, userAddress))
|
|
12419
12419
|
},
|
|
12420
12420
|
{ intentIds }
|
|
12421
12421
|
);
|
|
@@ -12475,7 +12475,7 @@ async function deploySelfFunded(input) {
|
|
|
12475
12475
|
});
|
|
12476
12476
|
const { transaction_hash } = await account.deployAccount({
|
|
12477
12477
|
classHash,
|
|
12478
|
-
constructorCalldata:
|
|
12478
|
+
constructorCalldata: chunk2R7XBA34_cjs.ownerConstructorCalldata(input.ownerPubKey),
|
|
12479
12479
|
addressSalt: 0,
|
|
12480
12480
|
contractAddress: input.ownerAddress
|
|
12481
12481
|
});
|
|
@@ -12631,7 +12631,7 @@ function createMediaWallet(config) {
|
|
|
12631
12631
|
};
|
|
12632
12632
|
const walletIntents = config.walletIntents ?? (async (params) => {
|
|
12633
12633
|
if (!config.backendUrl) throw new Error("This wallet has no backend url configured");
|
|
12634
|
-
const created = await new
|
|
12634
|
+
const created = await new chunk2R7XBA34_cjs.ApiClient(config.backendUrl).createWalletManageIntent(params);
|
|
12635
12635
|
return created.data;
|
|
12636
12636
|
});
|
|
12637
12637
|
const manage = async (sealed, params) => {
|
|
@@ -12648,7 +12648,7 @@ function createMediaWallet(config) {
|
|
|
12648
12648
|
address: sealed.address,
|
|
12649
12649
|
signTypedData: async (data) => {
|
|
12650
12650
|
const privateKeyHex = await unlockOnce(sealed);
|
|
12651
|
-
return
|
|
12651
|
+
return chunk2R7XBA34_cjs.signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(data, sealed.address));
|
|
12652
12652
|
},
|
|
12653
12653
|
execute: async (calls, opts) => {
|
|
12654
12654
|
const { transactionHash } = await run(sealed, calls, void 0, opts?.intentIds);
|
|
@@ -12687,57 +12687,65 @@ async function claimSessionWallet(api, walletAddress, deps) {
|
|
|
12687
12687
|
if (removeOwnerGuid) await deps.removeOwner(sealed, removeOwnerGuid);
|
|
12688
12688
|
}
|
|
12689
12689
|
|
|
12690
|
+
Object.defineProperty(exports, "DeviceKeyMissingError", {
|
|
12691
|
+
enumerable: true,
|
|
12692
|
+
get: function () { return chunk2R7XBA34_cjs.DeviceKeyMissingError; }
|
|
12693
|
+
});
|
|
12690
12694
|
Object.defineProperty(exports, "InvalidStarkPrivateKeyError", {
|
|
12691
12695
|
enumerable: true,
|
|
12692
|
-
get: function () { return
|
|
12696
|
+
get: function () { return chunk2R7XBA34_cjs.InvalidStarkPrivateKeyError; }
|
|
12693
12697
|
});
|
|
12694
12698
|
Object.defineProperty(exports, "PasskeyCancelledError", {
|
|
12695
12699
|
enumerable: true,
|
|
12696
|
-
get: function () { return
|
|
12700
|
+
get: function () { return chunk2R7XBA34_cjs.PasskeyCancelledError; }
|
|
12697
12701
|
});
|
|
12698
12702
|
Object.defineProperty(exports, "PasskeyUnsupportedError", {
|
|
12699
12703
|
enumerable: true,
|
|
12700
|
-
get: function () { return
|
|
12704
|
+
get: function () { return chunk2R7XBA34_cjs.PasskeyUnsupportedError; }
|
|
12701
12705
|
});
|
|
12702
12706
|
Object.defineProperty(exports, "UserFacingError", {
|
|
12703
12707
|
enumerable: true,
|
|
12704
|
-
get: function () { return
|
|
12708
|
+
get: function () { return chunk2R7XBA34_cjs.UserFacingError; }
|
|
12705
12709
|
});
|
|
12706
12710
|
Object.defineProperty(exports, "computeAccountAddress", {
|
|
12707
12711
|
enumerable: true,
|
|
12708
|
-
get: function () { return
|
|
12712
|
+
get: function () { return chunk2R7XBA34_cjs.computeAccountAddress; }
|
|
12709
12713
|
});
|
|
12710
12714
|
Object.defineProperty(exports, "createPasskeyOwner", {
|
|
12711
12715
|
enumerable: true,
|
|
12712
|
-
get: function () { return
|
|
12716
|
+
get: function () { return chunk2R7XBA34_cjs.createPasskeyOwner; }
|
|
12713
12717
|
});
|
|
12714
12718
|
Object.defineProperty(exports, "deriveAesKey", {
|
|
12715
12719
|
enumerable: true,
|
|
12716
|
-
get: function () { return
|
|
12720
|
+
get: function () { return chunk2R7XBA34_cjs.deriveAesKey; }
|
|
12717
12721
|
});
|
|
12718
12722
|
Object.defineProperty(exports, "generateStarkKeyPair", {
|
|
12719
12723
|
enumerable: true,
|
|
12720
|
-
get: function () { return
|
|
12724
|
+
get: function () { return chunk2R7XBA34_cjs.generateStarkKeyPair; }
|
|
12725
|
+
});
|
|
12726
|
+
Object.defineProperty(exports, "indexedDbDeviceKeys", {
|
|
12727
|
+
enumerable: true,
|
|
12728
|
+
get: function () { return chunk2R7XBA34_cjs.indexedDbDeviceKeys; }
|
|
12721
12729
|
});
|
|
12722
12730
|
Object.defineProperty(exports, "ownerConstructorCalldata", {
|
|
12723
12731
|
enumerable: true,
|
|
12724
|
-
get: function () { return
|
|
12732
|
+
get: function () { return chunk2R7XBA34_cjs.ownerConstructorCalldata; }
|
|
12725
12733
|
});
|
|
12726
12734
|
Object.defineProperty(exports, "sealPrivateKey", {
|
|
12727
12735
|
enumerable: true,
|
|
12728
|
-
get: function () { return
|
|
12736
|
+
get: function () { return chunk2R7XBA34_cjs.sealPrivateKey; }
|
|
12729
12737
|
});
|
|
12730
12738
|
Object.defineProperty(exports, "signWithPrivateKey", {
|
|
12731
12739
|
enumerable: true,
|
|
12732
|
-
get: function () { return
|
|
12740
|
+
get: function () { return chunk2R7XBA34_cjs.signWithPrivateKey; }
|
|
12733
12741
|
});
|
|
12734
12742
|
Object.defineProperty(exports, "starkKeyPairFromPrivateKey", {
|
|
12735
12743
|
enumerable: true,
|
|
12736
|
-
get: function () { return
|
|
12744
|
+
get: function () { return chunk2R7XBA34_cjs.starkKeyPairFromPrivateKey; }
|
|
12737
12745
|
});
|
|
12738
12746
|
Object.defineProperty(exports, "unsealPrivateKey", {
|
|
12739
12747
|
enumerable: true,
|
|
12740
|
-
get: function () { return
|
|
12748
|
+
get: function () { return chunk2R7XBA34_cjs.unsealPrivateKey; }
|
|
12741
12749
|
});
|
|
12742
12750
|
exports.COIN_MAX_SUPPLY = MAX_SUPPLY;
|
|
12743
12751
|
exports.COIN_MIN_SUPPLY = MIN_SUPPLY;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as starknet from 'starknet';
|
|
2
2
|
import { AccountInterface, ProviderInterface, RpcProvider, Call, TypedData, constants, BigNumberish, DeployAccountContractPayload, Account } from 'starknet';
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
3
|
+
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, c7 as CreatorCoinService, bC as MedialaneConfig, bD as MedialaneErrorCode, R as ResolvedFeeConfig, J as ApiFundingIntent, I as ApiFundingInstructions, M as ApiFundingSubmit, O as ApiIntentCreated, bl as DropTerms, c8 as SealedOwner, c9 as ReceiptProviderLike, ca as WalletExecutor, cb as ExecutedTransaction, cc as PasskeyOwner, bi as CreateWalletManageIntentParams, cd as CreatedOwner } from '../errors-CZm-NZK0.cjs';
|
|
4
|
+
export { ce as ApiKeyAction, cf as ApiKeyConfirmation, cg as ApiKeyConfirmationInput, ch as CreateCreatorCoinParams, ci as CreatorCoinGuarantees, cj as CreatorCoinReceiptLike, bj as DeviceKeyMissingError, ck as DeviceKeyStore, cl as DropMintState, cm as DropMintStateKind, cn as DropOnchain, co as EkuboLaunchParams, cp as EkuboPoolParams, cq as InvalidRecoveryKeyError, cr as MAX_HOLDERS_AT_LAUNCH, cs as MAX_TEAM_ALLOCATION_PERCENT, ct as OwnerSigner, bN as PasskeyCancelledError, cu as PasskeyConfig, bO as PasskeyUnsupportedError, bP as PasskeyUnsupportedReason, cv as PopAllowlist, cw as PopClaimInfo, cx as PopClaimLink, cy as PopClaimState, cz as RecoveryKey, c2 as UserFacingError, cA as VALIDATED_EKUBO_PARAMS, cB as apiKeyConfirmationTypedData, cC as buildCreateCreatorCoinCall, cD as buildLaunchOnEkuboCalls, cE as buildPopAllowlist, cF as createPasskeyOwner, cG as decodePopClaimFragment, cH as dropClaimLinks, cI as dropClaimedBy, cJ as dropMintState, cK as encodePopClaimFragment, cL as encodeRecoveryKey, cM as getCreatorCoinGuarantees, cN as indexedDbDeviceKeys, cO as parseCreatorCoinCreated, cP as parseRecoveryKey, cQ as popCalls, cR as popClaimInfo, cS as popClaimLinks, cT as popClaimLinksCsv, cU as popClaimState, cV as priceToEkuboParams, cW as readDrop, cX as validatePrice, cY as verifyPopProof } from '../errors-CZm-NZK0.cjs';
|
|
5
5
|
import { V as VenueAdapter, O as OrderRef, A as AdapterTxResult, R as RegisterOrderParams, j as VenueSigner } from '../types-DC4jNPAF.cjs';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import '../provisioning-BUYiU8Tr.cjs';
|
package/dist/starknet/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as starknet from 'starknet';
|
|
2
2
|
import { AccountInterface, ProviderInterface, RpcProvider, Call, TypedData, constants, BigNumberish, DeployAccountContractPayload, Account } from 'starknet';
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
3
|
+
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, c7 as CreatorCoinService, bC as MedialaneConfig, bD as MedialaneErrorCode, R as ResolvedFeeConfig, J as ApiFundingIntent, I as ApiFundingInstructions, M as ApiFundingSubmit, O as ApiIntentCreated, bl as DropTerms, c8 as SealedOwner, c9 as ReceiptProviderLike, ca as WalletExecutor, cb as ExecutedTransaction, cc as PasskeyOwner, bi as CreateWalletManageIntentParams, cd as CreatedOwner } from '../errors-h6H6cj3Q.js';
|
|
4
|
+
export { ce as ApiKeyAction, cf as ApiKeyConfirmation, cg as ApiKeyConfirmationInput, ch as CreateCreatorCoinParams, ci as CreatorCoinGuarantees, cj as CreatorCoinReceiptLike, bj as DeviceKeyMissingError, ck as DeviceKeyStore, cl as DropMintState, cm as DropMintStateKind, cn as DropOnchain, co as EkuboLaunchParams, cp as EkuboPoolParams, cq as InvalidRecoveryKeyError, cr as MAX_HOLDERS_AT_LAUNCH, cs as MAX_TEAM_ALLOCATION_PERCENT, ct as OwnerSigner, bN as PasskeyCancelledError, cu as PasskeyConfig, bO as PasskeyUnsupportedError, bP as PasskeyUnsupportedReason, cv as PopAllowlist, cw as PopClaimInfo, cx as PopClaimLink, cy as PopClaimState, cz as RecoveryKey, c2 as UserFacingError, cA as VALIDATED_EKUBO_PARAMS, cB as apiKeyConfirmationTypedData, cC as buildCreateCreatorCoinCall, cD as buildLaunchOnEkuboCalls, cE as buildPopAllowlist, cF as createPasskeyOwner, cG as decodePopClaimFragment, cH as dropClaimLinks, cI as dropClaimedBy, cJ as dropMintState, cK as encodePopClaimFragment, cL as encodeRecoveryKey, cM as getCreatorCoinGuarantees, cN as indexedDbDeviceKeys, cO as parseCreatorCoinCreated, cP as parseRecoveryKey, cQ as popCalls, cR as popClaimInfo, cS as popClaimLinks, cT as popClaimLinksCsv, cU as popClaimState, cV as priceToEkuboParams, cW as readDrop, cX as validatePrice, cY as verifyPopProof } from '../errors-h6H6cj3Q.js';
|
|
5
5
|
import { V as VenueAdapter, O as OrderRef, A as AdapterTxResult, R as RegisterOrderParams, j as VenueSigner } from '../types-DC4jNPAF.js';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import '../provisioning-BUYiU8Tr.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, MedialaneApiError, starkKeyPairFromPrivateKey } 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, MedialaneApiError, starkKeyPairFromPrivateKey } from '../chunk-6WVUUBFI.js';
|
|
2
|
+
export { DeviceKeyMissingError, InvalidStarkPrivateKeyError, PasskeyCancelledError, PasskeyUnsupportedError, UserFacingError, computeAccountAddress, createPasskeyOwner, deriveAesKey, generateStarkKeyPair, indexedDbDeviceKeys, ownerConstructorCalldata, sealPrivateKey, signWithPrivateKey, starkKeyPairFromPrivateKey, unsealPrivateKey } from '../chunk-6WVUUBFI.js';
|
|
3
3
|
import { getStarknetCoordinates, getCoordinates } from '../chunk-3ME5YKTW.js';
|
|
4
4
|
import '../chunk-PZ5AY32C.js';
|
|
5
5
|
import { CallData, hash, cairo, uint256, CairoOption, CairoOptionVariant, RpcProvider, num, ec, validateAndParseAddress, Account, typedData, stark, byteArray, Contract, TypedDataRevision, constants, shortString } from 'starknet';
|