@medialane/sdk 0.94.0 → 0.96.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/index.cjs +15 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/dist/{services-DTkc0lLx.d.ts → services-CRrl4KPp.d.ts} +16 -1
- package/dist/{services-D3M9dJZg.d.cts → services-DoPHyfG_.d.cts} +16 -1
- package/dist/starknet/index.cjs +17 -52
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +3 -16
- package/dist/starknet/index.d.ts +3 -16
- package/dist/starknet/index.js +18 -52
- package/dist/starknet/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -363,11 +363,23 @@ interface ApiCoin {
|
|
|
363
363
|
description: string | null;
|
|
364
364
|
image: string | null;
|
|
365
365
|
creator: string | null;
|
|
366
|
+
isLaunched?: boolean | null;
|
|
366
367
|
startBlock: string;
|
|
367
368
|
isHidden: boolean;
|
|
368
369
|
createdAt: string;
|
|
369
370
|
updatedAt: string;
|
|
370
371
|
}
|
|
372
|
+
interface ApiCoinPrice {
|
|
373
|
+
usdc: number;
|
|
374
|
+
}
|
|
375
|
+
type ApiCoinPrices = Record<string, ApiCoinPrice | null>;
|
|
376
|
+
type ApiCoinClaimResult = {
|
|
377
|
+
verified: true;
|
|
378
|
+
coin: ApiCoin | null;
|
|
379
|
+
} | {
|
|
380
|
+
verified: false;
|
|
381
|
+
reason: "owner_mismatch" | "owner_check_failed" | "not_erc20" | "no_total_supply";
|
|
382
|
+
};
|
|
371
383
|
interface ApiCoinsQuery {
|
|
372
384
|
chain?: ChainFilter;
|
|
373
385
|
page?: number;
|
|
@@ -1157,6 +1169,9 @@ declare class ApiClient {
|
|
|
1157
1169
|
getCoin(contract: string): Promise<{
|
|
1158
1170
|
data: ApiCoin;
|
|
1159
1171
|
}>;
|
|
1172
|
+
getCoinPrices(): Promise<ApiResponse<ApiCoinPrices>>;
|
|
1173
|
+
claimCoin(coinAddress: string, siwsToken: string): Promise<ApiCoinClaimResult>;
|
|
1174
|
+
getCoinClaims(status?: string): Promise<ApiResponse<ApiCollectionClaim[]>>;
|
|
1160
1175
|
updateCoinProfile(contract: string, data: {
|
|
1161
1176
|
image?: string;
|
|
1162
1177
|
description?: string;
|
|
@@ -1285,4 +1300,4 @@ interface ProposeSponsorshipParams {
|
|
|
1285
1300
|
royaltyBps: bigint | string;
|
|
1286
1301
|
}
|
|
1287
1302
|
|
|
1288
|
-
export { type
|
|
1303
|
+
export { type ApiRewardsConfig as $, type AcceptSponsorshipBidIntentParams as A, type ApiIntent as B, type ApiIntentCreated as C, type ApiKeyStatus as D, type ApiMeta as E, type ApiMetadataSignedUrl as F, type ApiMetadataUpload as G, type ApiOrder as H, type ApiOrderConsideration as I, type ApiOrderOffer as J, type ApiOrderPrice as K, type ApiOrderTokenMeta as L, type ApiOrderTxHash as M, type ApiOrdersQuery as N, type ApiPointEvent as O, type ApiPortalKey as P, type ApiPortalKeyCreated as Q, type ResolvedFeeConfig as R, type ServiceDefinition as S, type ApiPortalMe as T, type ApiPublicRemix as U, type ApiRemixOffer as V, type ApiRemixOfferPrice as W, type ApiRemixOffersQuery as X, type ApiResponse as Y, type ApiRewardsBadge as Z, type ApiRewardsBatchEntry as _, type ServiceCapability as a, type OpenLicense as a$, type ApiRewardsLeaderboardEntry as a0, type ApiRewardsLevel as a1, type ApiSearchCollectionResult as a2, type ApiSearchCreatorResult as a3, type ApiSearchResult as a4, type ApiSearchTokenResult as a5, type ApiToken as a6, type ApiTokenBalance as a7, type ApiTokenMetadata as a8, type ApiUsageDay as a9, type CreateSponsorshipOfferIntentParams as aA, type CreateSponsorshipOfferParams as aB, type CreateSponsorshipProposalIntentParams as aC, type CreateTicketParams as aD, type CreateTierIntentParams as aE, type CreateWebhookParams as aF, type DropMintStatus as aG, type EnforcementDeclaration as aH, type FactoryFamilyServiceId as aI, type FeeConfig as aJ, FeeConfigSchema as aK, type FulfillOrderIntentParams as aL, type IPType as aM, type IntentCall as aN, type IntentStatus as aO, type IntentType as aP, type IpAttribute as aQ, type IpNftMetadata as aR, type LaunchCoinIntentParams as aS, type MakeOfferIntentParams as aT, MedialaneApiError as aU, type MedialaneConfig as aV, type MedialaneErrorCode as aW, type MintMembershipsParams as aX, type MintTicketsParams as aY, OPEN_LICENSES as aZ, type OfferItem as a_, type ApiUserRewards as aa, type ApiUserWallet as ab, type ApiWalletActivity as ac, type ApiWebhookCreated as ad, type ApiWebhookEndpoint as ae, type AutoRemixOfferParams as af, type CancelOrderIntentParams as ag, type ChainFilter as ah, type CheckoutIntentItem as ai, type ClaimConditions as aj, type CollectionServiceId as ak, type CollectionSort as al, type CollectionTokensSort as am, type ConfirmRemixOfferParams as an, type ConfirmSelfRemixParams as ao, type ConsiderationItem as ap, type CreateCheckoutIntentParams as aq, type CreateCoinIntentParams as ar, type CreateCollectionIntentParams as as, type CreateCounterOfferIntentParams as at, type CreateDropParams as au, type CreateListingIntentParams as av, type CreateMembershipParams as aw, type CreateMintIntentParams as ax, type CreatePopCollectionParams as ay, type CreateRemixOfferParams as az, type AcceptSponsorshipProposalIntentParams as b, type Order as b0, type OrderDetails as b1, type OrderParameters as b2, type OrderStatus as b3, type PlaceSponsorshipBidIntentParams as b4, type PopBatchEligibilityItem as b5, type PopClaimStatus as b6, type PopEventType as b7, type ProposeSponsorshipParams as b8, type RejectSponsorshipProposalIntentParams as b9, type RemixOfferStatus as ba, type ResolvedConfig as bb, type RetractSponsorshipBidIntentParams as bc, type RetryOptions as bd, type ServiceEventDeclaration as be, type SetSponsorshipOfferOpenIntentParams as bf, type SortOrder as bg, type TenantPlan as bh, type TierServiceId as bi, type TxResult as bj, type WebhookEventType as bk, type WebhookStatus as bl, type WithdrawSponsorshipProposalIntentParams as bm, resolveConfig as bn, resolveFeeConfig as bo, type ActivityType as c, type ApiActivitiesQuery as d, type ApiActivity as e, type ApiActivityPrice as f, type ApiAdminCollectionClaim as g, type ApiAppSource as h, type ApiBusinessProvisioning as i, type ApiChain as j, type ApiCheckoutIntentResult as k, ApiClient as l, type ApiCoin as m, type ApiCoinClaimResult as n, type ApiCoinPrice as o, type ApiCoinPrices as p, type ApiCoinsQuery as q, type ApiCollection as r, type ApiCollectionClaim as s, type ApiCollectionProfile as t, type ApiCollectionSlugClaim as u, type ApiCollectionsQuery as v, type ApiComment as w, type ApiCounterOffersQuery as x, type ApiCreatorListResult as y, type ApiCreatorProfile as z };
|
|
@@ -363,11 +363,23 @@ interface ApiCoin {
|
|
|
363
363
|
description: string | null;
|
|
364
364
|
image: string | null;
|
|
365
365
|
creator: string | null;
|
|
366
|
+
isLaunched?: boolean | null;
|
|
366
367
|
startBlock: string;
|
|
367
368
|
isHidden: boolean;
|
|
368
369
|
createdAt: string;
|
|
369
370
|
updatedAt: string;
|
|
370
371
|
}
|
|
372
|
+
interface ApiCoinPrice {
|
|
373
|
+
usdc: number;
|
|
374
|
+
}
|
|
375
|
+
type ApiCoinPrices = Record<string, ApiCoinPrice | null>;
|
|
376
|
+
type ApiCoinClaimResult = {
|
|
377
|
+
verified: true;
|
|
378
|
+
coin: ApiCoin | null;
|
|
379
|
+
} | {
|
|
380
|
+
verified: false;
|
|
381
|
+
reason: "owner_mismatch" | "owner_check_failed" | "not_erc20" | "no_total_supply";
|
|
382
|
+
};
|
|
371
383
|
interface ApiCoinsQuery {
|
|
372
384
|
chain?: ChainFilter;
|
|
373
385
|
page?: number;
|
|
@@ -1157,6 +1169,9 @@ declare class ApiClient {
|
|
|
1157
1169
|
getCoin(contract: string): Promise<{
|
|
1158
1170
|
data: ApiCoin;
|
|
1159
1171
|
}>;
|
|
1172
|
+
getCoinPrices(): Promise<ApiResponse<ApiCoinPrices>>;
|
|
1173
|
+
claimCoin(coinAddress: string, siwsToken: string): Promise<ApiCoinClaimResult>;
|
|
1174
|
+
getCoinClaims(status?: string): Promise<ApiResponse<ApiCollectionClaim[]>>;
|
|
1160
1175
|
updateCoinProfile(contract: string, data: {
|
|
1161
1176
|
image?: string;
|
|
1162
1177
|
description?: string;
|
|
@@ -1285,4 +1300,4 @@ interface ProposeSponsorshipParams {
|
|
|
1285
1300
|
royaltyBps: bigint | string;
|
|
1286
1301
|
}
|
|
1287
1302
|
|
|
1288
|
-
export { type
|
|
1303
|
+
export { type ApiRewardsConfig as $, type AcceptSponsorshipBidIntentParams as A, type ApiIntent as B, type ApiIntentCreated as C, type ApiKeyStatus as D, type ApiMeta as E, type ApiMetadataSignedUrl as F, type ApiMetadataUpload as G, type ApiOrder as H, type ApiOrderConsideration as I, type ApiOrderOffer as J, type ApiOrderPrice as K, type ApiOrderTokenMeta as L, type ApiOrderTxHash as M, type ApiOrdersQuery as N, type ApiPointEvent as O, type ApiPortalKey as P, type ApiPortalKeyCreated as Q, type ResolvedFeeConfig as R, type ServiceDefinition as S, type ApiPortalMe as T, type ApiPublicRemix as U, type ApiRemixOffer as V, type ApiRemixOfferPrice as W, type ApiRemixOffersQuery as X, type ApiResponse as Y, type ApiRewardsBadge as Z, type ApiRewardsBatchEntry as _, type ServiceCapability as a, type OpenLicense as a$, type ApiRewardsLeaderboardEntry as a0, type ApiRewardsLevel as a1, type ApiSearchCollectionResult as a2, type ApiSearchCreatorResult as a3, type ApiSearchResult as a4, type ApiSearchTokenResult as a5, type ApiToken as a6, type ApiTokenBalance as a7, type ApiTokenMetadata as a8, type ApiUsageDay as a9, type CreateSponsorshipOfferIntentParams as aA, type CreateSponsorshipOfferParams as aB, type CreateSponsorshipProposalIntentParams as aC, type CreateTicketParams as aD, type CreateTierIntentParams as aE, type CreateWebhookParams as aF, type DropMintStatus as aG, type EnforcementDeclaration as aH, type FactoryFamilyServiceId as aI, type FeeConfig as aJ, FeeConfigSchema as aK, type FulfillOrderIntentParams as aL, type IPType as aM, type IntentCall as aN, type IntentStatus as aO, type IntentType as aP, type IpAttribute as aQ, type IpNftMetadata as aR, type LaunchCoinIntentParams as aS, type MakeOfferIntentParams as aT, MedialaneApiError as aU, type MedialaneConfig as aV, type MedialaneErrorCode as aW, type MintMembershipsParams as aX, type MintTicketsParams as aY, OPEN_LICENSES as aZ, type OfferItem as a_, type ApiUserRewards as aa, type ApiUserWallet as ab, type ApiWalletActivity as ac, type ApiWebhookCreated as ad, type ApiWebhookEndpoint as ae, type AutoRemixOfferParams as af, type CancelOrderIntentParams as ag, type ChainFilter as ah, type CheckoutIntentItem as ai, type ClaimConditions as aj, type CollectionServiceId as ak, type CollectionSort as al, type CollectionTokensSort as am, type ConfirmRemixOfferParams as an, type ConfirmSelfRemixParams as ao, type ConsiderationItem as ap, type CreateCheckoutIntentParams as aq, type CreateCoinIntentParams as ar, type CreateCollectionIntentParams as as, type CreateCounterOfferIntentParams as at, type CreateDropParams as au, type CreateListingIntentParams as av, type CreateMembershipParams as aw, type CreateMintIntentParams as ax, type CreatePopCollectionParams as ay, type CreateRemixOfferParams as az, type AcceptSponsorshipProposalIntentParams as b, type Order as b0, type OrderDetails as b1, type OrderParameters as b2, type OrderStatus as b3, type PlaceSponsorshipBidIntentParams as b4, type PopBatchEligibilityItem as b5, type PopClaimStatus as b6, type PopEventType as b7, type ProposeSponsorshipParams as b8, type RejectSponsorshipProposalIntentParams as b9, type RemixOfferStatus as ba, type ResolvedConfig as bb, type RetractSponsorshipBidIntentParams as bc, type RetryOptions as bd, type ServiceEventDeclaration as be, type SetSponsorshipOfferOpenIntentParams as bf, type SortOrder as bg, type TenantPlan as bh, type TierServiceId as bi, type TxResult as bj, type WebhookEventType as bk, type WebhookStatus as bl, type WithdrawSponsorshipProposalIntentParams as bm, resolveConfig as bn, resolveFeeConfig as bo, type ActivityType as c, type ApiActivitiesQuery as d, type ApiActivity as e, type ApiActivityPrice as f, type ApiAdminCollectionClaim as g, type ApiAppSource as h, type ApiBusinessProvisioning as i, type ApiChain as j, type ApiCheckoutIntentResult as k, ApiClient as l, type ApiCoin as m, type ApiCoinClaimResult as n, type ApiCoinPrice as o, type ApiCoinPrices as p, type ApiCoinsQuery as q, type ApiCollection as r, type ApiCollectionClaim as s, type ApiCollectionProfile as t, type ApiCollectionSlugClaim as u, type ApiCollectionsQuery as v, type ApiComment as w, type ApiCounterOffersQuery as x, type ApiCreatorListResult as y, type ApiCreatorProfile as z };
|
package/dist/starknet/index.cjs
CHANGED
|
@@ -760,6 +760,21 @@ var ApiClient = class {
|
|
|
760
760
|
getCoin(contract) {
|
|
761
761
|
return this.get(`/v1/coins/${this.addr(contract)}`);
|
|
762
762
|
}
|
|
763
|
+
getCoinPrices() {
|
|
764
|
+
return this.get("/v1/coins/prices");
|
|
765
|
+
}
|
|
766
|
+
claimCoin(coinAddress, siwsToken) {
|
|
767
|
+
return this.request("/v1/coins/claim", {
|
|
768
|
+
method: "POST",
|
|
769
|
+
headers: { Authorization: `Bearer ${siwsToken}` },
|
|
770
|
+
body: JSON.stringify({ coinAddress })
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
getCoinClaims(status = "PENDING") {
|
|
774
|
+
return this.get(
|
|
775
|
+
`/v1/coins/claims?status=${encodeURIComponent(status)}`
|
|
776
|
+
);
|
|
777
|
+
}
|
|
763
778
|
updateCoinProfile(contract, data, siwsToken) {
|
|
764
779
|
return this.request(`/v1/coins/${this.addr(contract)}`, {
|
|
765
780
|
method: "PATCH",
|
|
@@ -10252,25 +10267,6 @@ var ERC1155CollectionService = class {
|
|
|
10252
10267
|
}
|
|
10253
10268
|
};
|
|
10254
10269
|
|
|
10255
|
-
// src/utils/token.ts
|
|
10256
|
-
function getTokenByAddress(address) {
|
|
10257
|
-
let target = null;
|
|
10258
|
-
try {
|
|
10259
|
-
target = BigInt(address);
|
|
10260
|
-
} catch {
|
|
10261
|
-
target = null;
|
|
10262
|
-
}
|
|
10263
|
-
return SUPPORTED_TOKENS.find((t) => {
|
|
10264
|
-
if (target !== null) {
|
|
10265
|
-
try {
|
|
10266
|
-
return BigInt(t.address) === target;
|
|
10267
|
-
} catch {
|
|
10268
|
-
}
|
|
10269
|
-
}
|
|
10270
|
-
return t.address.toLowerCase() === address.toLowerCase();
|
|
10271
|
-
});
|
|
10272
|
-
}
|
|
10273
|
-
|
|
10274
10270
|
// src/starknet/services/coinLaunchMath.ts
|
|
10275
10271
|
var COIN_DECIMALS = 18;
|
|
10276
10272
|
var LAUNCH_PRICE_QUOTE_PER_COIN = 0.01;
|
|
@@ -10365,36 +10361,6 @@ async function getCreatorCoinGuarantees(coinAddress, provider) {
|
|
|
10365
10361
|
};
|
|
10366
10362
|
}
|
|
10367
10363
|
var COIN_DECIMALS2 = 18;
|
|
10368
|
-
async function getCreatorCoinMarket(coinAddress, provider) {
|
|
10369
|
-
const r = await provider.callContract({
|
|
10370
|
-
contractAddress: coinAddress,
|
|
10371
|
-
entrypoint: "launched_with_liquidity_parameters",
|
|
10372
|
-
calldata: []
|
|
10373
|
-
});
|
|
10374
|
-
if (BigInt(r[0]) !== 0n || BigInt(r[1]) !== 0n) return { status: "pre-launch" };
|
|
10375
|
-
const fee = r[2];
|
|
10376
|
-
const tickSpacing = r[3];
|
|
10377
|
-
const quoteToken = normalizeAddress("STARKNET", "0x" + BigInt(r[7]).toString(16));
|
|
10378
|
-
const token = getTokenByAddress(quoteToken);
|
|
10379
|
-
const quoteDecimals = token?.decimals ?? 18;
|
|
10380
|
-
const ci = BigInt(coinAddress);
|
|
10381
|
-
const qi = BigInt(quoteToken);
|
|
10382
|
-
const [t0, t1] = ci < qi ? [coinAddress, quoteToken] : [quoteToken, coinAddress];
|
|
10383
|
-
const quoteIsToken0 = qi === BigInt(t0);
|
|
10384
|
-
const pp = await provider.callContract({
|
|
10385
|
-
contractAddress: getStarknetCoordinates("STARKNET").ekuboCore,
|
|
10386
|
-
entrypoint: "get_pool_price",
|
|
10387
|
-
calldata: [t0, t1, fee, tickSpacing, "0x0"]
|
|
10388
|
-
});
|
|
10389
|
-
const sqrt = BigInt(pp[0]) + (BigInt(pp[1] ?? "0x0") << 128n);
|
|
10390
|
-
const priceT1perT0 = (Number(sqrt) / 2 ** 128) ** 2;
|
|
10391
|
-
const decAdj = 10 ** (COIN_DECIMALS2 - quoteDecimals);
|
|
10392
|
-
const quotePerCoin = (quoteIsToken0 ? 1 / priceT1perT0 : priceT1perT0) * decAdj;
|
|
10393
|
-
return {
|
|
10394
|
-
status: "live",
|
|
10395
|
-
price: { quotePerCoin, quoteToken, quoteSymbol: token?.symbol ?? null, quoteDecimals }
|
|
10396
|
-
};
|
|
10397
|
-
}
|
|
10398
10364
|
var _factoryContract = null;
|
|
10399
10365
|
function factoryContract() {
|
|
10400
10366
|
if (!_factoryContract) {
|
|
@@ -10482,8 +10448,8 @@ var CreatorCoinService = class {
|
|
|
10482
10448
|
const r = await this._factory(account).is_creator_coin(address);
|
|
10483
10449
|
return BigInt(r) === 1n;
|
|
10484
10450
|
}
|
|
10485
|
-
async
|
|
10486
|
-
return
|
|
10451
|
+
async getGuarantees(coinAddress) {
|
|
10452
|
+
return getCreatorCoinGuarantees(coinAddress, new starknet.RpcProvider({ nodeUrl: this.config.rpcUrl }));
|
|
10487
10453
|
}
|
|
10488
10454
|
};
|
|
10489
10455
|
var TicketService = class {
|
|
@@ -11805,7 +11771,6 @@ exports.generateStarkKeyPair = generateStarkKeyPair;
|
|
|
11805
11771
|
exports.getCounter = getCounter;
|
|
11806
11772
|
exports.getCounter1155 = getCounter1155;
|
|
11807
11773
|
exports.getCreatorCoinGuarantees = getCreatorCoinGuarantees;
|
|
11808
|
-
exports.getCreatorCoinMarket = getCreatorCoinMarket;
|
|
11809
11774
|
exports.getEscape = getEscape;
|
|
11810
11775
|
exports.getEscapeSecurityPeriod = getEscapeSecurityPeriod;
|
|
11811
11776
|
exports.getGuardians = getGuardians;
|