@medialane/sdk 0.181.0 → 0.183.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/README.md +2 -4
- package/dist/{chunk-WYKCGQPN.js → chunk-3ME5YKTW.js} +2 -3
- package/dist/chunk-3ME5YKTW.js.map +1 -0
- package/dist/{chunk-VJVBWHAD.cjs → chunk-7EYJC5CB.cjs} +2 -3
- package/dist/chunk-7EYJC5CB.cjs.map +1 -0
- package/dist/{chunk-EWDU2XV3.cjs → chunk-F5USCCM4.cjs} +7 -78
- package/dist/chunk-F5USCCM4.cjs.map +1 -0
- package/dist/{chunk-BTSTG6SP.js → chunk-JZXIZGHW.js} +4 -71
- package/dist/chunk-JZXIZGHW.js.map +1 -0
- package/dist/{errors-Bsah998f.d.cts → errors-C3dgi8bK.d.cts} +1 -7
- package/dist/{errors-DQyz1fFP.d.ts → errors-kFtjB-a3.d.ts} +1 -7
- package/dist/evm/index.cjs +3 -3
- package/dist/evm/index.d.cts +1 -1
- package/dist/evm/index.d.ts +1 -1
- package/dist/evm/index.js +1 -1
- package/dist/index.cjs +131 -92
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -23
- package/dist/index.d.ts +16 -23
- package/dist/index.js +55 -3
- package/dist/index.js.map +1 -1
- package/dist/solana/index.cjs +2 -2
- package/dist/solana/index.d.cts +1 -1
- package/dist/solana/index.d.ts +1 -1
- package/dist/solana/index.js +1 -1
- package/dist/starknet/index.cjs +126 -289
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +15 -120
- package/dist/starknet/index.d.ts +15 -120
- package/dist/starknet/index.js +52 -213
- package/dist/starknet/index.js.map +1 -1
- package/dist/stellar/index.cjs +2 -2
- package/dist/stellar/index.d.cts +1 -1
- package/dist/stellar/index.d.ts +1 -1
- package/dist/stellar/index.js +1 -1
- package/dist/{types-BTNjkUst.d.cts → types-DC4jNPAF.d.cts} +0 -4
- package/dist/{types-BTNjkUst.d.ts → types-DC4jNPAF.d.ts} +0 -4
- package/package.json +1 -1
- package/dist/chunk-BTSTG6SP.js.map +0 -1
- package/dist/chunk-EWDU2XV3.cjs.map +0 -1
- package/dist/chunk-VJVBWHAD.cjs.map +0 -1
- package/dist/chunk-WYKCGQPN.js.map +0 -1
package/dist/starknet/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { normalizeAddress, collectionHref, dropHref, resolveConfig, ApiClient, UserFacingError, getService, STARKNET_MEDIAWALLET_CLASS_HASH, computeAccountAddress, ownerConstructorCalldata, getTokenBySymbol, signWithPrivateKey, stringifyBigInts, SUPPORTED_TOKENS,
|
|
2
|
-
export { InvalidStarkPrivateKeyError, PasskeyCancelledError, PasskeyUnsupportedError, UserFacingError, computeAccountAddress, createPasskeyOwner, deriveAesKey, generateStarkKeyPair, ownerConstructorCalldata, sealPrivateKey, signWithPrivateKey, starkKeyPairFromPrivateKey, unsealPrivateKey } from '../chunk-
|
|
3
|
-
import { getStarknetCoordinates, getCoordinates } from '../chunk-
|
|
4
|
-
import { CallData, hash, cairo,
|
|
1
|
+
import { normalizeAddress, collectionHref, dropHref, resolveConfig, ApiClient, UserFacingError, getService, STARKNET_MEDIAWALLET_CLASS_HASH, computeAccountAddress, ownerConstructorCalldata, getTokenBySymbol, signWithPrivateKey, stringifyBigInts, SUPPORTED_TOKENS, MedialaneApiError, starkKeyPairFromPrivateKey } from '../chunk-JZXIZGHW.js';
|
|
2
|
+
export { InvalidStarkPrivateKeyError, PasskeyCancelledError, PasskeyUnsupportedError, UserFacingError, computeAccountAddress, createPasskeyOwner, deriveAesKey, generateStarkKeyPair, ownerConstructorCalldata, sealPrivateKey, signWithPrivateKey, starkKeyPairFromPrivateKey, unsealPrivateKey } from '../chunk-JZXIZGHW.js';
|
|
3
|
+
import { getStarknetCoordinates, getCoordinates } from '../chunk-3ME5YKTW.js';
|
|
4
|
+
import { CallData, hash, cairo, uint256, CairoOption, CairoOptionVariant, RpcProvider, num, ec, validateAndParseAddress, Account, typedData, stark, byteArray, Contract, TypedDataRevision, constants, shortString } from 'starknet';
|
|
5
5
|
import { extract, expand } from '@noble/hashes/hkdf.js';
|
|
6
6
|
import { sha256 } from '@noble/hashes/sha2.js';
|
|
7
7
|
|
|
@@ -38,16 +38,6 @@ function resolveToken(currency) {
|
|
|
38
38
|
if (!token) throw new MedialaneError(`Unsupported currency: ${currency}`, "INVALID_PARAMS");
|
|
39
39
|
return token;
|
|
40
40
|
}
|
|
41
|
-
var _providerCache = /* @__PURE__ */ new WeakMap();
|
|
42
|
-
function getProvider(config) {
|
|
43
|
-
let p = _providerCache.get(config);
|
|
44
|
-
if (!p) {
|
|
45
|
-
const urls = [config.rpcUrl];
|
|
46
|
-
p = new RpcProvider({ nodeUrl: urls[0], baseFetch: createFailoverFetch(urls) });
|
|
47
|
-
_providerCache.set(config, p);
|
|
48
|
-
}
|
|
49
|
-
return p;
|
|
50
|
-
}
|
|
51
41
|
|
|
52
42
|
// src/starknet/abis/ipMarketplace.ts
|
|
53
43
|
var IPMarketplaceABI = [
|
|
@@ -10680,10 +10670,9 @@ function dropClaimLinks(origin, collection, list) {
|
|
|
10680
10670
|
|
|
10681
10671
|
// src/starknet/services/drop.ts
|
|
10682
10672
|
var DropService = class {
|
|
10683
|
-
constructor(config
|
|
10673
|
+
constructor(config) {
|
|
10684
10674
|
this.factoryAddress = getStarknetCoordinates(config.chain).dropFactory;
|
|
10685
10675
|
this.config = config;
|
|
10686
|
-
this.reader = reader ?? new RpcProvider({ nodeUrl: config.rpcUrl });
|
|
10687
10676
|
}
|
|
10688
10677
|
async createDrop(account, params) {
|
|
10689
10678
|
const res = await account.execute([dropCalls.create(this.factoryAddress, params)]);
|
|
@@ -10691,7 +10680,7 @@ var DropService = class {
|
|
|
10691
10680
|
}
|
|
10692
10681
|
/** Mints `quantity` to the account, paying the drop's price and the platform fee. */
|
|
10693
10682
|
async claim(account, params) {
|
|
10694
|
-
const drop = await readDrop(
|
|
10683
|
+
const drop = await readDrop(account.provider, params.collection);
|
|
10695
10684
|
const calls = dropCalls.claim(params.collection, {
|
|
10696
10685
|
quantity: params.quantity,
|
|
10697
10686
|
proof: params.proof,
|
|
@@ -10978,7 +10967,6 @@ function parseCreatorCoinCreated(receipt) {
|
|
|
10978
10967
|
var CreatorCoinService = class {
|
|
10979
10968
|
constructor(config) {
|
|
10980
10969
|
this.factoryAddress = getStarknetCoordinates(config.chain).creatorCoinFactory;
|
|
10981
|
-
this.config = config;
|
|
10982
10970
|
}
|
|
10983
10971
|
_factory(account) {
|
|
10984
10972
|
return newContract(CreatorCoinFactoryABI, this.factoryAddress, account);
|
|
@@ -10995,13 +10983,9 @@ var CreatorCoinService = class {
|
|
|
10995
10983
|
const r = await this._factory(account).is_creator_coin(address);
|
|
10996
10984
|
return BigInt(r) === 1n;
|
|
10997
10985
|
}
|
|
10998
|
-
async getGuarantees(coinAddress) {
|
|
10999
|
-
return getCreatorCoinGuarantees(coinAddress, new RpcProvider({ nodeUrl: this.config.rpcUrl }));
|
|
11000
|
-
}
|
|
11001
10986
|
};
|
|
11002
10987
|
var TicketService = class {
|
|
11003
10988
|
constructor(config) {
|
|
11004
|
-
this.config = config;
|
|
11005
10989
|
this.factoryAddress = getStarknetCoordinates(config.chain).ipTicketsFactory;
|
|
11006
10990
|
}
|
|
11007
10991
|
_factory(account, factoryAddress) {
|
|
@@ -11012,10 +10996,6 @@ var TicketService = class {
|
|
|
11012
10996
|
_collection(address, account) {
|
|
11013
10997
|
return newContract(IPTicketCollectionABI, normalizeAddress("STARKNET", address), account);
|
|
11014
10998
|
}
|
|
11015
|
-
_collectionRead(address) {
|
|
11016
|
-
const provider = new RpcProvider({ nodeUrl: this.config.rpcUrl });
|
|
11017
|
-
return newContract(IPTicketCollectionABI, normalizeAddress("STARKNET", address), provider);
|
|
11018
|
-
}
|
|
11019
10999
|
async deployCollection(account, params) {
|
|
11020
11000
|
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
11021
11001
|
params.name,
|
|
@@ -11047,34 +11027,9 @@ var TicketService = class {
|
|
|
11047
11027
|
const res = await account.execute([call]);
|
|
11048
11028
|
return { txHash: res.transaction_hash };
|
|
11049
11029
|
}
|
|
11050
|
-
async isValid(params) {
|
|
11051
|
-
const result = await this._collectionRead(params.collection).call("is_valid", [
|
|
11052
|
-
cairo.uint256(params.tokenId),
|
|
11053
|
-
params.holder
|
|
11054
|
-
]);
|
|
11055
|
-
return Boolean(result);
|
|
11056
|
-
}
|
|
11057
|
-
async getTicketCount(params) {
|
|
11058
|
-
const result = await this._collectionRead(params.collection).call("ticket_count", []);
|
|
11059
|
-
return BigInt(result);
|
|
11060
|
-
}
|
|
11061
|
-
async getTicket(params) {
|
|
11062
|
-
const t = await this._collectionRead(params.collection).call("get_ticket", [
|
|
11063
|
-
cairo.uint256(params.tokenId)
|
|
11064
|
-
]);
|
|
11065
|
-
return {
|
|
11066
|
-
maxSupply: BigInt(t.max_supply),
|
|
11067
|
-
minted: BigInt(t.minted),
|
|
11068
|
-
startTime: t.start_time?.variant === "Some" ? Number(t.start_time.values[0] ?? t.start_time.value) : null,
|
|
11069
|
-
endTime: t.end_time?.variant === "Some" ? Number(t.end_time.values[0] ?? t.end_time.value) : null,
|
|
11070
|
-
royaltyBps: Number(t.royalty_bps),
|
|
11071
|
-
metadataUri: t.metadata_uri
|
|
11072
|
-
};
|
|
11073
|
-
}
|
|
11074
11030
|
};
|
|
11075
11031
|
var ClubService = class {
|
|
11076
11032
|
constructor(config) {
|
|
11077
|
-
this.config = config;
|
|
11078
11033
|
this.factoryAddress = getStarknetCoordinates(config.chain).ipClubFactory;
|
|
11079
11034
|
}
|
|
11080
11035
|
_factory(account, factoryAddress) {
|
|
@@ -11085,10 +11040,6 @@ var ClubService = class {
|
|
|
11085
11040
|
_collection(address, account) {
|
|
11086
11041
|
return newContract(IPClubCollectionABI, normalizeAddress("STARKNET", address), account);
|
|
11087
11042
|
}
|
|
11088
|
-
_collectionRead(address) {
|
|
11089
|
-
const provider = new RpcProvider({ nodeUrl: this.config.rpcUrl });
|
|
11090
|
-
return newContract(IPClubCollectionABI, normalizeAddress("STARKNET", address), provider);
|
|
11091
|
-
}
|
|
11092
11043
|
async deployCollection(account, params) {
|
|
11093
11044
|
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
11094
11045
|
params.name,
|
|
@@ -11120,36 +11071,9 @@ var ClubService = class {
|
|
|
11120
11071
|
const res = await account.execute([call]);
|
|
11121
11072
|
return { txHash: res.transaction_hash };
|
|
11122
11073
|
}
|
|
11123
|
-
async isMember(params) {
|
|
11124
|
-
const result = await this._collectionRead(params.collection).call("is_member", [
|
|
11125
|
-
params.holder
|
|
11126
|
-
]);
|
|
11127
|
-
return Boolean(result);
|
|
11128
|
-
}
|
|
11129
|
-
async isMemberOf(params) {
|
|
11130
|
-
const result = await this._collectionRead(params.collection).call("is_member_of", [
|
|
11131
|
-
cairo.uint256(params.tokenId),
|
|
11132
|
-
params.holder
|
|
11133
|
-
]);
|
|
11134
|
-
return Boolean(result);
|
|
11135
|
-
}
|
|
11136
|
-
async getMembership(params) {
|
|
11137
|
-
const m = await this._collectionRead(params.collection).call("get_membership", [
|
|
11138
|
-
cairo.uint256(params.tokenId)
|
|
11139
|
-
]);
|
|
11140
|
-
return {
|
|
11141
|
-
maxSupply: BigInt(m.max_supply),
|
|
11142
|
-
minted: BigInt(m.minted),
|
|
11143
|
-
startTime: m.start_time?.variant === "Some" ? Number(m.start_time.values[0] ?? m.start_time.value) : null,
|
|
11144
|
-
endTime: m.end_time?.variant === "Some" ? Number(m.end_time.values[0] ?? m.end_time.value) : null,
|
|
11145
|
-
royaltyBps: Number(m.royalty_bps),
|
|
11146
|
-
metadataUri: m.metadata_uri
|
|
11147
|
-
};
|
|
11148
|
-
}
|
|
11149
11074
|
};
|
|
11150
11075
|
var SponsorshipService = class {
|
|
11151
11076
|
constructor(config) {
|
|
11152
|
-
this.config = config;
|
|
11153
11077
|
this.sponsorshipAddress = getStarknetCoordinates(config.chain).ipSponsorship;
|
|
11154
11078
|
}
|
|
11155
11079
|
_contract(account, address) {
|
|
@@ -11159,14 +11083,6 @@ var SponsorshipService = class {
|
|
|
11159
11083
|
}
|
|
11160
11084
|
return newContract(IPSponsorshipABI, normalizeAddress("STARKNET", resolved), account);
|
|
11161
11085
|
}
|
|
11162
|
-
_contractRead(address) {
|
|
11163
|
-
const resolved = address ?? this.sponsorshipAddress;
|
|
11164
|
-
if (!resolved) {
|
|
11165
|
-
throw new Error("IP-Sponsorship address not configured for this chain");
|
|
11166
|
-
}
|
|
11167
|
-
const provider = new RpcProvider({ nodeUrl: this.config.rpcUrl });
|
|
11168
|
-
return newContract(IPSponsorshipABI, normalizeAddress("STARKNET", resolved), provider);
|
|
11169
|
-
}
|
|
11170
11086
|
async createOffer(account, params) {
|
|
11171
11087
|
const specificSponsor = params.specificSponsor ? new CairoOption(CairoOptionVariant.Some, params.specificSponsor) : new CairoOption(CairoOptionVariant.None);
|
|
11172
11088
|
const call = this._contract(account, params.sponsorshipAddress).populate("create_offer", [
|
|
@@ -11260,69 +11176,14 @@ var SponsorshipService = class {
|
|
|
11260
11176
|
const res = await account.execute([call]);
|
|
11261
11177
|
return { txHash: res.transaction_hash };
|
|
11262
11178
|
}
|
|
11263
|
-
async getOffer(params) {
|
|
11264
|
-
const o = await this._contractRead(params.sponsorshipAddress).call("get_offer", [
|
|
11265
|
-
cairo.uint256(params.offerId)
|
|
11266
|
-
]);
|
|
11267
|
-
return {
|
|
11268
|
-
author: o.author,
|
|
11269
|
-
nftContract: o.nft_contract,
|
|
11270
|
-
tokenId: BigInt(o.token_id),
|
|
11271
|
-
minAmount: BigInt(o.min_amount),
|
|
11272
|
-
duration: Number(o.duration),
|
|
11273
|
-
paymentToken: o.payment_token,
|
|
11274
|
-
licenseTermsUri: o.license_terms_uri,
|
|
11275
|
-
transferable: Boolean(o.transferable),
|
|
11276
|
-
specificSponsor: o.specific_sponsor?.variant === "Some" ? o.specific_sponsor.values?.[0] ?? o.specific_sponsor.value : null,
|
|
11277
|
-
open: Boolean(o.open),
|
|
11278
|
-
royaltyBps: BigInt(o.royalty_bps)
|
|
11279
|
-
};
|
|
11280
|
-
}
|
|
11281
|
-
async getBid(params) {
|
|
11282
|
-
const result = await this._contractRead(params.sponsorshipAddress).call("get_bid", [
|
|
11283
|
-
cairo.uint256(params.offerId),
|
|
11284
|
-
params.sponsor
|
|
11285
|
-
]);
|
|
11286
|
-
return BigInt(result);
|
|
11287
|
-
}
|
|
11288
|
-
async getProposal(params) {
|
|
11289
|
-
const p = await this._contractRead(params.sponsorshipAddress).call("get_proposal", [
|
|
11290
|
-
cairo.uint256(params.proposalId)
|
|
11291
|
-
]);
|
|
11292
|
-
return {
|
|
11293
|
-
proposer: p.proposer,
|
|
11294
|
-
nftContract: p.nft_contract,
|
|
11295
|
-
tokenId: BigInt(p.token_id),
|
|
11296
|
-
amount: BigInt(p.amount),
|
|
11297
|
-
duration: Number(p.duration),
|
|
11298
|
-
validUntil: Number(p.valid_until),
|
|
11299
|
-
paymentToken: p.payment_token,
|
|
11300
|
-
licenseTermsUri: p.license_terms_uri,
|
|
11301
|
-
transferable: Boolean(p.transferable),
|
|
11302
|
-
open: Boolean(p.open),
|
|
11303
|
-
royaltyBps: BigInt(p.royalty_bps)
|
|
11304
|
-
};
|
|
11305
|
-
}
|
|
11306
|
-
async getLastOfferId(params) {
|
|
11307
|
-
const result = await this._contractRead(params?.sponsorshipAddress).call("get_last_offer_id", []);
|
|
11308
|
-
return BigInt(result);
|
|
11309
|
-
}
|
|
11310
|
-
async getLastProposalId(params) {
|
|
11311
|
-
const result = await this._contractRead(params?.sponsorshipAddress).call("get_last_proposal_id", []);
|
|
11312
|
-
return BigInt(result);
|
|
11313
|
-
}
|
|
11314
|
-
async getLastLicenseId(params) {
|
|
11315
|
-
const result = await this._contractRead(params?.sponsorshipAddress).call("get_last_license_id", []);
|
|
11316
|
-
return BigInt(result);
|
|
11317
|
-
}
|
|
11318
|
-
async royaltyInfo(params) {
|
|
11319
|
-
const [recipient, amount] = await this._contractRead(params.sponsorshipAddress).call("royalty_info", [
|
|
11320
|
-
cairo.uint256(params.licenseId),
|
|
11321
|
-
cairo.uint256(params.salePrice)
|
|
11322
|
-
]);
|
|
11323
|
-
return { recipient, amount: BigInt(amount) };
|
|
11324
|
-
}
|
|
11325
11179
|
};
|
|
11180
|
+
function createChainProvider(backendUrl, apiKey) {
|
|
11181
|
+
return new RpcProvider({
|
|
11182
|
+
nodeUrl: `${backendUrl.replace(/\/$/, "")}/v1/rpc`,
|
|
11183
|
+
headers: apiKey ? { "x-api-key": apiKey } : {},
|
|
11184
|
+
blockIdentifier: "latest"
|
|
11185
|
+
});
|
|
11186
|
+
}
|
|
11326
11187
|
|
|
11327
11188
|
// src/starknet/client.ts
|
|
11328
11189
|
var MedialaneClient = class {
|
|
@@ -11363,54 +11224,22 @@ var MedialaneClient = class {
|
|
|
11363
11224
|
get chain() {
|
|
11364
11225
|
return this.config.chain;
|
|
11365
11226
|
}
|
|
11366
|
-
get
|
|
11367
|
-
|
|
11227
|
+
get provider() {
|
|
11228
|
+
if (!this.config.backendUrl) {
|
|
11229
|
+
throw new Error("backendUrl not configured. Pass backendUrl to MedialaneClient to use .provider");
|
|
11230
|
+
}
|
|
11231
|
+
return this._provider ?? (this._provider = createChainProvider(this.config.backendUrl, this.config.apiKey));
|
|
11368
11232
|
}
|
|
11369
11233
|
get marketplaceContract() {
|
|
11370
11234
|
return this.config.marketplaceContract;
|
|
11371
11235
|
}
|
|
11372
11236
|
};
|
|
11373
11237
|
|
|
11374
|
-
// src/starknet/
|
|
11375
|
-
|
|
11376
|
-
|
|
11377
|
-
const
|
|
11378
|
-
|
|
11379
|
-
const contract = newContract(
|
|
11380
|
-
IPMarketplaceABI,
|
|
11381
|
-
config.marketplaceContract,
|
|
11382
|
-
getProvider(config)
|
|
11383
|
-
);
|
|
11384
|
-
const entry = { contract };
|
|
11385
|
-
_contractCache.set(config, entry);
|
|
11386
|
-
return entry;
|
|
11387
|
-
}
|
|
11388
|
-
async function getOrderDetails(orderHash, config) {
|
|
11389
|
-
const { contract } = makeContract(config);
|
|
11390
|
-
return contract.get_order_details(orderHash);
|
|
11391
|
-
}
|
|
11392
|
-
async function getCounter(address, config) {
|
|
11393
|
-
const { contract } = makeContract(config);
|
|
11394
|
-
return BigInt((await contract.get_counter(address)).toString());
|
|
11395
|
-
}
|
|
11396
|
-
|
|
11397
|
-
// src/starknet/marketplace1155/orders.ts
|
|
11398
|
-
var _contractCache2 = /* @__PURE__ */ new WeakMap();
|
|
11399
|
-
function getContract(config) {
|
|
11400
|
-
let c = _contractCache2.get(config);
|
|
11401
|
-
if (!c) {
|
|
11402
|
-
c = newContract(Medialane1155ABI, config.marketplace1155Contract, getProvider(config));
|
|
11403
|
-
_contractCache2.set(config, c);
|
|
11404
|
-
}
|
|
11405
|
-
return c;
|
|
11406
|
-
}
|
|
11407
|
-
async function getOrderDetails1155(orderHash, config) {
|
|
11408
|
-
const contract = getContract(config);
|
|
11409
|
-
return contract.get_order_details(orderHash);
|
|
11410
|
-
}
|
|
11411
|
-
async function getCounter1155(address, config) {
|
|
11412
|
-
const contract = getContract(config);
|
|
11413
|
-
return BigInt((await contract.get_counter(address)).toString());
|
|
11238
|
+
// src/starknet/erc20.ts
|
|
11239
|
+
async function erc20Balance(provider, token, holder) {
|
|
11240
|
+
const read = (entrypoint) => provider.callContract({ contractAddress: token, entrypoint, calldata: [holder] }, "latest");
|
|
11241
|
+
const [low = "0x0", high = "0x0"] = await read("balanceOf").catch(() => read("balance_of"));
|
|
11242
|
+
return BigInt(low) + (BigInt(high) << 128n);
|
|
11414
11243
|
}
|
|
11415
11244
|
var STARKNET_DOMAIN = [
|
|
11416
11245
|
{ name: "name", type: "shortstring" },
|
|
@@ -11509,7 +11338,7 @@ function build1155CancellationTypedData(message, chainId) {
|
|
|
11509
11338
|
|
|
11510
11339
|
// src/starknet/marketplace/build.ts
|
|
11511
11340
|
function contractFor(cfg) {
|
|
11512
|
-
return newContract(IPMarketplaceABI, cfg.marketplaceContract
|
|
11341
|
+
return newContract(IPMarketplaceABI, cfg.marketplaceContract);
|
|
11513
11342
|
}
|
|
11514
11343
|
function buildListingOrder(i, cfg) {
|
|
11515
11344
|
const orderParams = {
|
|
@@ -11595,7 +11424,7 @@ function buildCancelTypedData(orderHash, offerer, cfg) {
|
|
|
11595
11424
|
return stringifyBigInts(buildCancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg)));
|
|
11596
11425
|
}
|
|
11597
11426
|
function contractFor2(cfg) {
|
|
11598
|
-
return newContract(Medialane1155ABI, cfg.marketplace1155Contract
|
|
11427
|
+
return newContract(Medialane1155ABI, cfg.marketplace1155Contract);
|
|
11599
11428
|
}
|
|
11600
11429
|
function buildListing1155Order(i, cfg) {
|
|
11601
11430
|
const orderParams = {
|
|
@@ -11700,7 +11529,8 @@ var StarknetVenue = class {
|
|
|
11700
11529
|
]);
|
|
11701
11530
|
}
|
|
11702
11531
|
getOrderDetails(orderRef) {
|
|
11703
|
-
|
|
11532
|
+
const marketplace = newContract(IPMarketplaceABI, this.deps.config.marketplaceContract, this.deps.provider);
|
|
11533
|
+
return marketplace.get_order_details(orderRef);
|
|
11704
11534
|
}
|
|
11705
11535
|
async getCounter(address) {
|
|
11706
11536
|
return this.readCounter(this.deps.config.marketplaceContract, address);
|
|
@@ -12047,18 +11877,32 @@ async function confirmIntentBestEffort(client, intentId, txHash) {
|
|
|
12047
11877
|
await client.api.confirmIntent(intentId, txHash).catch(() => {
|
|
12048
11878
|
});
|
|
12049
11879
|
}
|
|
12050
|
-
var SYNC_TIMEOUT_MS =
|
|
12051
|
-
|
|
11880
|
+
var SYNC_TIMEOUT_MS = 2e4;
|
|
11881
|
+
var SYNC_RETRY_MS = 2e3;
|
|
11882
|
+
function readableLater(err) {
|
|
11883
|
+
return err instanceof MedialaneApiError && err.status === 404;
|
|
11884
|
+
}
|
|
11885
|
+
async function syncTransactionBestEffort(client, txHash, timeoutMs = SYNC_TIMEOUT_MS, retryMs = SYNC_RETRY_MS) {
|
|
11886
|
+
const deadline = Date.now() + timeoutMs;
|
|
11887
|
+
let stopped = false;
|
|
12052
11888
|
let timer;
|
|
12053
11889
|
const timeout = new Promise((resolve) => {
|
|
12054
11890
|
timer = setTimeout(() => resolve(), timeoutMs);
|
|
12055
11891
|
});
|
|
12056
|
-
const sync =
|
|
12057
|
-
|
|
12058
|
-
|
|
11892
|
+
const sync = (async () => {
|
|
11893
|
+
while (!stopped) {
|
|
11894
|
+
const again = await client.api.syncTransaction(txHash).then(
|
|
11895
|
+
(res) => res.data?.pending === true,
|
|
11896
|
+
readableLater
|
|
11897
|
+
);
|
|
11898
|
+
if (!again || Date.now() + retryMs >= deadline) return;
|
|
11899
|
+
await new Promise((resolve) => setTimeout(resolve, retryMs));
|
|
11900
|
+
}
|
|
11901
|
+
})();
|
|
12059
11902
|
try {
|
|
12060
11903
|
await Promise.race([sync, timeout]);
|
|
12061
11904
|
} finally {
|
|
11905
|
+
stopped = true;
|
|
12062
11906
|
if (timer) clearTimeout(timer);
|
|
12063
11907
|
}
|
|
12064
11908
|
}
|
|
@@ -12080,7 +11924,7 @@ async function assertTransactionSucceeded(provider, txHash, retryDelaysMs = RECE
|
|
|
12080
11924
|
}
|
|
12081
11925
|
throw new UserFacingError("Verification timed out. Check your account for the transaction status.");
|
|
12082
11926
|
}
|
|
12083
|
-
async function executeIntent(
|
|
11927
|
+
async function executeIntent(signer, client, intent, opts = {}) {
|
|
12084
11928
|
let calls;
|
|
12085
11929
|
if (intent.requiresSignature) {
|
|
12086
11930
|
const signature = await signer.signTypedData(intent.typedData);
|
|
@@ -12090,20 +11934,20 @@ async function executeIntent(provider, signer, client, intent, opts = {}) {
|
|
|
12090
11934
|
calls = intent.calls;
|
|
12091
11935
|
}
|
|
12092
11936
|
const { txHash } = await signer.execute(calls, { intentIds: [intent.id] });
|
|
12093
|
-
const receipt = await assertTransactionSucceeded(provider, txHash);
|
|
11937
|
+
const receipt = await assertTransactionSucceeded(client.provider, txHash);
|
|
12094
11938
|
await Promise.all([
|
|
12095
11939
|
syncTransactionBestEffort(client, txHash),
|
|
12096
11940
|
opts.confirm !== false ? confirmIntentBestEffort(client, intent.id, txHash) : void 0
|
|
12097
11941
|
]);
|
|
12098
11942
|
return { txHash, receipt };
|
|
12099
11943
|
}
|
|
12100
|
-
async function executeIntents(
|
|
11944
|
+
async function executeIntents(signer, client, intents, opts = {}) {
|
|
12101
11945
|
if (intents.some((i) => i.requiresSignature)) {
|
|
12102
11946
|
throw new Error("Expected prebuilt intents (requiresSignature=false)");
|
|
12103
11947
|
}
|
|
12104
11948
|
const calls = intents.flatMap((i) => i.calls);
|
|
12105
11949
|
const { txHash } = await signer.execute(calls, { intentIds: intents.map((i) => i.id) });
|
|
12106
|
-
const receipt = await assertTransactionSucceeded(provider, txHash);
|
|
11950
|
+
const receipt = await assertTransactionSucceeded(client.provider, txHash);
|
|
12107
11951
|
await Promise.all([
|
|
12108
11952
|
syncTransactionBestEffort(client, txHash),
|
|
12109
11953
|
...opts.confirm !== false ? intents.map((i) => confirmIntentBestEffort(client, i.id, txHash)) : []
|
|
@@ -12544,12 +12388,7 @@ async function estimateSelfFundedFee(provider, address, calls) {
|
|
|
12544
12388
|
async function feeTokenBalance(provider, address, unit) {
|
|
12545
12389
|
const token = getTokenBySymbol(unit === "FRI" ? "STRK" : "ETH");
|
|
12546
12390
|
if (!token) throw new Error(`No fee token for unit ${unit}`);
|
|
12547
|
-
|
|
12548
|
-
contractAddress: token.address,
|
|
12549
|
-
entrypoint: "balance_of",
|
|
12550
|
-
calldata: [address]
|
|
12551
|
-
});
|
|
12552
|
-
return BigInt(low) + (BigInt(high) << 128n);
|
|
12391
|
+
return erc20Balance(provider, token.address, address);
|
|
12553
12392
|
}
|
|
12554
12393
|
function selfFundedExecutor(deps) {
|
|
12555
12394
|
return {
|
|
@@ -12846,6 +12685,6 @@ async function claimSessionWallet(api, walletAddress, deps) {
|
|
|
12846
12685
|
if (removeOwnerGuid) await deps.removeOwner(sealed, removeOwnerGuid);
|
|
12847
12686
|
}
|
|
12848
12687
|
|
|
12849
|
-
export { MAX_SUPPLY as COIN_MAX_SUPPLY, MIN_SUPPLY as COIN_MIN_SUPPLY, ClubService, CreatorCoinFactoryABI, CreatorCoinService, DROP_MAX_CLAIM_QUANTITY, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, FundingTransferNotSentError, IPClubCollectionABI, IPClubFactoryABI, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPGenesisABI, IPMarketplaceABI, IPNftABI, IPSponsorshipABI, IPTicketCollectionABI, IPTicketCollectionFactoryABI, InvalidPairingPayloadError, InvalidRecoveryKeyError, MAX_HOLDERS_AT_LAUNCH, MAX_TEAM_ALLOCATION_PERCENT, Medialane1155ABI, MedialaneClient, MedialaneError, POPCollectionABI, POPFactoryABI, PopService, SUGGESTED_DEFAULT_PRICE, SponsoredCallRejectedError, SponsorshipService, StarknetVenue, TicketService, VALIDATED_EKUBO_PARAMS, accountFor, allowsFallbackFunding, apiKeyConfirmationTypedData, assertTransactionSucceeded, build1155CancellationTypedData, build1155OrderTypedData, buildAddOwnerCall, buildCancelEscapeCall, buildCancellationTypedData, buildCompleteEscapeOwnerCall, buildCreateCreatorCoinCall, buildDeployAccountParams, buildFeeCall, buildFundingTransferCall, buildLaunchOnEkuboCalls, buildOrderTypedData, buildPopAllowlist, buildRemoveOwnerByGuidCall, buildRemoveOwnerCall, buildSetFirstGuardianCall, buildTriggerEscapeOwnerCall, buybackQuoteRaw, canRemoveDevice, claimSessionWallet, toRaw as coinToRaw, completeDeployment, computeOwnerGuid, confirmIntentBestEffort, createDeploymentCoordinator, createMediaWallet, createOwnerStore, createSelfFundConsent, decodeEscapeAndStatus, decodeGuardiansInfo, decodePopClaimFragment, deploySelfFunded, deploySponsored, deployedCollectionFromReceipt, deriveOwnerKeyPair, describeDevices, describeGuardianStatus, describeRecoveryAction, dropCalls, dropClaimLinks, dropClaimedBy, dropMintCost, dropMintState, encodeByteArray, encodePairingPayload, encodePopClaimFragment, encodeRecoveryKey, estimateSelfFundedFee, executeIntent, executeIntents, executeSponsored, fdvHuman, feeAmount, feeBps, fundWithChainTransfer, fundingApiFor,
|
|
12688
|
+
export { MAX_SUPPLY as COIN_MAX_SUPPLY, MIN_SUPPLY as COIN_MIN_SUPPLY, ClubService, CreatorCoinFactoryABI, CreatorCoinService, DROP_MAX_CLAIM_QUANTITY, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, FundingTransferNotSentError, IPClubCollectionABI, IPClubFactoryABI, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPGenesisABI, IPMarketplaceABI, IPNftABI, IPSponsorshipABI, IPTicketCollectionABI, IPTicketCollectionFactoryABI, InvalidPairingPayloadError, InvalidRecoveryKeyError, MAX_HOLDERS_AT_LAUNCH, MAX_TEAM_ALLOCATION_PERCENT, Medialane1155ABI, MedialaneClient, MedialaneError, POPCollectionABI, POPFactoryABI, PopService, SUGGESTED_DEFAULT_PRICE, SponsoredCallRejectedError, SponsorshipService, StarknetVenue, TicketService, VALIDATED_EKUBO_PARAMS, accountFor, allowsFallbackFunding, apiKeyConfirmationTypedData, assertTransactionSucceeded, build1155CancellationTypedData, build1155OrderTypedData, buildAddOwnerCall, buildCancelEscapeCall, buildCancellationTypedData, buildCompleteEscapeOwnerCall, buildCreateCreatorCoinCall, buildDeployAccountParams, buildFeeCall, buildFundingTransferCall, buildLaunchOnEkuboCalls, buildOrderTypedData, buildPopAllowlist, buildRemoveOwnerByGuidCall, buildRemoveOwnerCall, buildSetFirstGuardianCall, buildTriggerEscapeOwnerCall, buybackQuoteRaw, canRemoveDevice, claimSessionWallet, toRaw as coinToRaw, completeDeployment, computeOwnerGuid, confirmIntentBestEffort, createChainProvider, createDeploymentCoordinator, createMediaWallet, createOwnerStore, createSelfFundConsent, decodeEscapeAndStatus, decodeGuardiansInfo, decodePopClaimFragment, deploySelfFunded, deploySponsored, deployedCollectionFromReceipt, deriveOwnerKeyPair, describeDevices, describeGuardianStatus, describeRecoveryAction, dropCalls, dropClaimLinks, dropClaimedBy, dropMintCost, dropMintState, encodeByteArray, encodePairingPayload, encodePopClaimFragment, encodeRecoveryKey, erc20Balance, estimateSelfFundedFee, executeIntent, executeIntents, executeSponsored, fdvHuman, feeAmount, feeBps, fundWithChainTransfer, fundingApiFor, getCreatorCoinGuarantees, getEscape, getEscapeSecurityPeriod, getGuardians, getOwners, getSiwsStorageKey, getStoredSiwsToken, isDeployed, isSiwsTokenValid, isValidStarknetAddress, mintedTokenIdFromReceipt, normalizeSiwsSignature, normalizeWalletAddress, parseAccountAddress, parseCreatorCoinCreated, parsePairingPayload, parseRecoveryKey, popCalls, popClaimInfo, popClaimLinks, popClaimLinksCsv, popClaimState, popHasClaimed, priceToEkuboParams, readDrop, requestSiwsToken, selfFundedExecutor, signInWithWallet, sponsoredExecutor, storeSiwsToken, syncTransactionBestEffort, teamCoinsRaw, toContractTerms as toDropContractTerms, validateName as validateCoinName, validateSupply as validateCoinSupply, validateSymbol as validateCoinSymbol, validatePrice, verifyPopProof, waitUntilDeployed };
|
|
12850
12689
|
//# sourceMappingURL=index.js.map
|
|
12851
12690
|
//# sourceMappingURL=index.js.map
|