@medialane/sdk 0.73.0 → 0.75.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.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/{services-DcmHyoGW.d.ts → services-B7h1qh97.d.ts} +4 -5
- package/dist/{services-2P-La7Ws.d.cts → services-CDpAVNqQ.d.cts} +4 -5
- package/dist/starknet/index.cjs +57 -42
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +32 -2
- package/dist/starknet/index.d.ts +32 -2
- package/dist/starknet/index.js +57 -43
- package/dist/starknet/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { aT as ResolvedConfig, aZ as TxResult, al as CreatePopCollectionParams, a9 as ClaimConditions, ah as CreateDropParams, ao as CreateTicketParams, aG as MintTicketsParams, aj as CreateMembershipParams, aF as MintMembershipsParams, an as CreateSponsorshipOfferParams, aR as ProposeSponsorshipParams, h as ApiClient, aD as MedialaneConfig, aE as MedialaneErrorCode, aL as OrderDetails, aU as ResolvedFeeConfig } from '../services-
|
|
1
|
+
import { aT as ResolvedConfig, aZ as TxResult, al as CreatePopCollectionParams, a9 as ClaimConditions, ah as CreateDropParams, ao as CreateTicketParams, aG as MintTicketsParams, aj as CreateMembershipParams, aF as MintMembershipsParams, an as CreateSponsorshipOfferParams, aR as ProposeSponsorshipParams, h as ApiClient, aD as MedialaneConfig, aE as MedialaneErrorCode, aL as OrderDetails, aU as ResolvedFeeConfig } from '../services-CDpAVNqQ.cjs';
|
|
2
2
|
import { AccountInterface, Call, ProviderInterface, TypedData, constants } from 'starknet';
|
|
3
3
|
import { V as VenueAdapter, O as OrderRef, A as AdapterTxResult, R as RegisterOrderParams, j as VenueSigner } from '../types-Cdwb6lXp.cjs';
|
|
4
4
|
import 'zod';
|
|
@@ -234,6 +234,36 @@ interface EkuboLaunchParams {
|
|
|
234
234
|
* unrug's `ekubo/helpers.cairo` tick math) so callers can pick an arbitrary price.
|
|
235
235
|
*/
|
|
236
236
|
declare const VALIDATED_EKUBO_PARAMS: EkuboPoolParams;
|
|
237
|
+
/**
|
|
238
|
+
* Compute the Ekubo `EkuboPoolParams` for launching a coin at `price`
|
|
239
|
+
* (default: the fixed 0.01 quote/coin every launch already uses) against a
|
|
240
|
+
* quote token of any decimals — not just the 18-decimal case
|
|
241
|
+
* `VALIDATED_EKUBO_PARAMS` was smoke-tested for.
|
|
242
|
+
*
|
|
243
|
+
* No address/ordering parameters: the contract itself determines
|
|
244
|
+
* `is_token1_quote` on-chain (`launcher.cairo`) and flips the tick's SIGN
|
|
245
|
+
* accordingly — magnitude never changes with ordering. This function
|
|
246
|
+
* always computes the tick as if quote were token1; the contract
|
|
247
|
+
* compensates sign itself if that assumption doesn't hold for the real
|
|
248
|
+
* deployed addresses (this is exactly what "sign: true yields 0.01
|
|
249
|
+
* quote/coin regardless of token0/1 ordering" already meant).
|
|
250
|
+
*
|
|
251
|
+
* `fee`/`tickSpacing`/`bound` are decimal-independent (bound is a pure
|
|
252
|
+
* tick-count offset, not a price) and reused from `VALIDATED_EKUBO_PARAMS`
|
|
253
|
+
* as-is. Only `startingPrice` is computed:
|
|
254
|
+
* decAdj = 10^(coinDecimals − quoteDecimals)
|
|
255
|
+
* rawRatio = price / decAdj
|
|
256
|
+
* tick = trunc(log(rawRatio) / log(1.000001) / tickSpacing) × tickSpacing
|
|
257
|
+
* (rounds toward zero, not nearest — confirmed against the
|
|
258
|
+
* known-good on-chain constant, which is 769×tickSpacing,
|
|
259
|
+
* not the nearer 770×tickSpacing)
|
|
260
|
+
* sign = tick < 0
|
|
261
|
+
*
|
|
262
|
+
* Cross-verified against the real on-chain constant: for an 18-decimal
|
|
263
|
+
* quote this reproduces `VALIDATED_EKUBO_PARAMS.startingPrice` exactly
|
|
264
|
+
* (mag 4600158 = 769 × tickSpacing 5982).
|
|
265
|
+
*/
|
|
266
|
+
declare function priceToEkuboParams(quoteDecimals: number, price?: number): EkuboPoolParams;
|
|
237
267
|
/** A Creator Coin's live spot price, read from its Ekubo pool. */
|
|
238
268
|
interface CreatorCoinPrice {
|
|
239
269
|
/** Quote tokens per 1 coin, human units (e.g. 0.0101 = 0.0101 STRK/coin). */
|
|
@@ -8096,4 +8126,4 @@ declare function build1155CancellationTypedData(message: Record<string, unknown>
|
|
|
8096
8126
|
|
|
8097
8127
|
type StarknetVenueSigner = VenueSigner<TypedData, Call>;
|
|
8098
8128
|
|
|
8099
|
-
export { ADMIN_HEADERS, ADMIN_SCOPE, type AddSupplyParams, type AdminGrant, type AdminRequest, type AdminRequestSig, type AdminSession, type AdminSessionTypedDataInput, type BatchMintEditionParams, type BuildFeeCallParams, MAX_SUPPLY as COIN_MAX_SUPPLY, MIN_SUPPLY as COIN_MIN_SUPPLY, ClubService, type CreateCreatorCoinParams, type CreateGrantOpts, CreatorCoinFactoryABI, type CreatorCoinPrice, type CreatorCoinReceiptLike, CreatorCoinService, type DeployCollectionParams, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, type EkuboLaunchParams, type EkuboPoolParams, type FeeSurface, IPClubCollectionABI, IPClubFactoryABI, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPGenesisABI, IPMarketplaceABI, IPNftABI, IPSponsorshipABI, IPTicketCollectionABI, IPTicketCollectionFactoryABI, LAUNCH_PRICE_QUOTE_PER_COIN, Medialane1155ABI, MedialaneClient, MedialaneError, type MintEditionParams, POPCollectionABI, POPFactoryABI, type ParsedAdminHeaders, PopService, type RequestSiwsTokenArgs, type ResolvedOrder, type SiwsSigner, SponsorshipService, StarknetVenue, type StarknetVenueDeps, type StarknetVenueSigner, TicketService, VALIDATED_EKUBO_PARAMS, VenueSigner, adminRequestDigest, build1155CancellationTypedData, build1155OrderTypedData, buildAdminSessionTypedData, buildCancellationTypedData, buildCreateCreatorCoinCall, buildFeeCall, buildLaunchOnEkuboCalls, buildOrderTypedData, buybackQuoteRaw, toRaw as coinToRaw, createAdminSessionGrant, encodeAdminHeaders, encodeByteArray, fdvHuman, getCounter, getCounter1155, getCreatorCoinPrice, getOrderDetails, getOrderDetails1155, getSiwsStorageKey, getStoredSiwsToken, isSiwsTokenValid, normalizeSiwsSignature, parseAdminHeaders, parseCreatorCoinCreated, randomNonce, requestSiwsToken, sessionKeyHashOf, signAdminRequest, storeSiwsToken, teamCoinsRaw, validateName as validateCoinName, validateSupply as validateCoinSupply, validateSymbol as validateCoinSymbol, verifyAdminRequestSig };
|
|
8129
|
+
export { ADMIN_HEADERS, ADMIN_SCOPE, type AddSupplyParams, type AdminGrant, type AdminRequest, type AdminRequestSig, type AdminSession, type AdminSessionTypedDataInput, type BatchMintEditionParams, type BuildFeeCallParams, MAX_SUPPLY as COIN_MAX_SUPPLY, MIN_SUPPLY as COIN_MIN_SUPPLY, ClubService, type CreateCreatorCoinParams, type CreateGrantOpts, CreatorCoinFactoryABI, type CreatorCoinPrice, type CreatorCoinReceiptLike, CreatorCoinService, type DeployCollectionParams, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, type EkuboLaunchParams, type EkuboPoolParams, type FeeSurface, IPClubCollectionABI, IPClubFactoryABI, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPGenesisABI, IPMarketplaceABI, IPNftABI, IPSponsorshipABI, IPTicketCollectionABI, IPTicketCollectionFactoryABI, LAUNCH_PRICE_QUOTE_PER_COIN, Medialane1155ABI, MedialaneClient, MedialaneError, type MintEditionParams, POPCollectionABI, POPFactoryABI, type ParsedAdminHeaders, PopService, type RequestSiwsTokenArgs, type ResolvedOrder, type SiwsSigner, SponsorshipService, StarknetVenue, type StarknetVenueDeps, type StarknetVenueSigner, TicketService, VALIDATED_EKUBO_PARAMS, VenueSigner, adminRequestDigest, build1155CancellationTypedData, build1155OrderTypedData, buildAdminSessionTypedData, buildCancellationTypedData, buildCreateCreatorCoinCall, buildFeeCall, buildLaunchOnEkuboCalls, buildOrderTypedData, buybackQuoteRaw, toRaw as coinToRaw, createAdminSessionGrant, encodeAdminHeaders, encodeByteArray, fdvHuman, getCounter, getCounter1155, getCreatorCoinPrice, getOrderDetails, getOrderDetails1155, getSiwsStorageKey, getStoredSiwsToken, isSiwsTokenValid, normalizeSiwsSignature, parseAdminHeaders, parseCreatorCoinCreated, priceToEkuboParams, randomNonce, requestSiwsToken, sessionKeyHashOf, signAdminRequest, storeSiwsToken, teamCoinsRaw, validateName as validateCoinName, validateSupply as validateCoinSupply, validateSymbol as validateCoinSymbol, verifyAdminRequestSig };
|
package/dist/starknet/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { aT as ResolvedConfig, aZ as TxResult, al as CreatePopCollectionParams, a9 as ClaimConditions, ah as CreateDropParams, ao as CreateTicketParams, aG as MintTicketsParams, aj as CreateMembershipParams, aF as MintMembershipsParams, an as CreateSponsorshipOfferParams, aR as ProposeSponsorshipParams, h as ApiClient, aD as MedialaneConfig, aE as MedialaneErrorCode, aL as OrderDetails, aU as ResolvedFeeConfig } from '../services-
|
|
1
|
+
import { aT as ResolvedConfig, aZ as TxResult, al as CreatePopCollectionParams, a9 as ClaimConditions, ah as CreateDropParams, ao as CreateTicketParams, aG as MintTicketsParams, aj as CreateMembershipParams, aF as MintMembershipsParams, an as CreateSponsorshipOfferParams, aR as ProposeSponsorshipParams, h as ApiClient, aD as MedialaneConfig, aE as MedialaneErrorCode, aL as OrderDetails, aU as ResolvedFeeConfig } from '../services-B7h1qh97.js';
|
|
2
2
|
import { AccountInterface, Call, ProviderInterface, TypedData, constants } from 'starknet';
|
|
3
3
|
import { V as VenueAdapter, O as OrderRef, A as AdapterTxResult, R as RegisterOrderParams, j as VenueSigner } from '../types-Cdwb6lXp.js';
|
|
4
4
|
import 'zod';
|
|
@@ -234,6 +234,36 @@ interface EkuboLaunchParams {
|
|
|
234
234
|
* unrug's `ekubo/helpers.cairo` tick math) so callers can pick an arbitrary price.
|
|
235
235
|
*/
|
|
236
236
|
declare const VALIDATED_EKUBO_PARAMS: EkuboPoolParams;
|
|
237
|
+
/**
|
|
238
|
+
* Compute the Ekubo `EkuboPoolParams` for launching a coin at `price`
|
|
239
|
+
* (default: the fixed 0.01 quote/coin every launch already uses) against a
|
|
240
|
+
* quote token of any decimals — not just the 18-decimal case
|
|
241
|
+
* `VALIDATED_EKUBO_PARAMS` was smoke-tested for.
|
|
242
|
+
*
|
|
243
|
+
* No address/ordering parameters: the contract itself determines
|
|
244
|
+
* `is_token1_quote` on-chain (`launcher.cairo`) and flips the tick's SIGN
|
|
245
|
+
* accordingly — magnitude never changes with ordering. This function
|
|
246
|
+
* always computes the tick as if quote were token1; the contract
|
|
247
|
+
* compensates sign itself if that assumption doesn't hold for the real
|
|
248
|
+
* deployed addresses (this is exactly what "sign: true yields 0.01
|
|
249
|
+
* quote/coin regardless of token0/1 ordering" already meant).
|
|
250
|
+
*
|
|
251
|
+
* `fee`/`tickSpacing`/`bound` are decimal-independent (bound is a pure
|
|
252
|
+
* tick-count offset, not a price) and reused from `VALIDATED_EKUBO_PARAMS`
|
|
253
|
+
* as-is. Only `startingPrice` is computed:
|
|
254
|
+
* decAdj = 10^(coinDecimals − quoteDecimals)
|
|
255
|
+
* rawRatio = price / decAdj
|
|
256
|
+
* tick = trunc(log(rawRatio) / log(1.000001) / tickSpacing) × tickSpacing
|
|
257
|
+
* (rounds toward zero, not nearest — confirmed against the
|
|
258
|
+
* known-good on-chain constant, which is 769×tickSpacing,
|
|
259
|
+
* not the nearer 770×tickSpacing)
|
|
260
|
+
* sign = tick < 0
|
|
261
|
+
*
|
|
262
|
+
* Cross-verified against the real on-chain constant: for an 18-decimal
|
|
263
|
+
* quote this reproduces `VALIDATED_EKUBO_PARAMS.startingPrice` exactly
|
|
264
|
+
* (mag 4600158 = 769 × tickSpacing 5982).
|
|
265
|
+
*/
|
|
266
|
+
declare function priceToEkuboParams(quoteDecimals: number, price?: number): EkuboPoolParams;
|
|
237
267
|
/** A Creator Coin's live spot price, read from its Ekubo pool. */
|
|
238
268
|
interface CreatorCoinPrice {
|
|
239
269
|
/** Quote tokens per 1 coin, human units (e.g. 0.0101 = 0.0101 STRK/coin). */
|
|
@@ -8096,4 +8126,4 @@ declare function build1155CancellationTypedData(message: Record<string, unknown>
|
|
|
8096
8126
|
|
|
8097
8127
|
type StarknetVenueSigner = VenueSigner<TypedData, Call>;
|
|
8098
8128
|
|
|
8099
|
-
export { ADMIN_HEADERS, ADMIN_SCOPE, type AddSupplyParams, type AdminGrant, type AdminRequest, type AdminRequestSig, type AdminSession, type AdminSessionTypedDataInput, type BatchMintEditionParams, type BuildFeeCallParams, MAX_SUPPLY as COIN_MAX_SUPPLY, MIN_SUPPLY as COIN_MIN_SUPPLY, ClubService, type CreateCreatorCoinParams, type CreateGrantOpts, CreatorCoinFactoryABI, type CreatorCoinPrice, type CreatorCoinReceiptLike, CreatorCoinService, type DeployCollectionParams, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, type EkuboLaunchParams, type EkuboPoolParams, type FeeSurface, IPClubCollectionABI, IPClubFactoryABI, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPGenesisABI, IPMarketplaceABI, IPNftABI, IPSponsorshipABI, IPTicketCollectionABI, IPTicketCollectionFactoryABI, LAUNCH_PRICE_QUOTE_PER_COIN, Medialane1155ABI, MedialaneClient, MedialaneError, type MintEditionParams, POPCollectionABI, POPFactoryABI, type ParsedAdminHeaders, PopService, type RequestSiwsTokenArgs, type ResolvedOrder, type SiwsSigner, SponsorshipService, StarknetVenue, type StarknetVenueDeps, type StarknetVenueSigner, TicketService, VALIDATED_EKUBO_PARAMS, VenueSigner, adminRequestDigest, build1155CancellationTypedData, build1155OrderTypedData, buildAdminSessionTypedData, buildCancellationTypedData, buildCreateCreatorCoinCall, buildFeeCall, buildLaunchOnEkuboCalls, buildOrderTypedData, buybackQuoteRaw, toRaw as coinToRaw, createAdminSessionGrant, encodeAdminHeaders, encodeByteArray, fdvHuman, getCounter, getCounter1155, getCreatorCoinPrice, getOrderDetails, getOrderDetails1155, getSiwsStorageKey, getStoredSiwsToken, isSiwsTokenValid, normalizeSiwsSignature, parseAdminHeaders, parseCreatorCoinCreated, randomNonce, requestSiwsToken, sessionKeyHashOf, signAdminRequest, storeSiwsToken, teamCoinsRaw, validateName as validateCoinName, validateSupply as validateCoinSupply, validateSymbol as validateCoinSymbol, verifyAdminRequestSig };
|
|
8129
|
+
export { ADMIN_HEADERS, ADMIN_SCOPE, type AddSupplyParams, type AdminGrant, type AdminRequest, type AdminRequestSig, type AdminSession, type AdminSessionTypedDataInput, type BatchMintEditionParams, type BuildFeeCallParams, MAX_SUPPLY as COIN_MAX_SUPPLY, MIN_SUPPLY as COIN_MIN_SUPPLY, ClubService, type CreateCreatorCoinParams, type CreateGrantOpts, CreatorCoinFactoryABI, type CreatorCoinPrice, type CreatorCoinReceiptLike, CreatorCoinService, type DeployCollectionParams, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, type EkuboLaunchParams, type EkuboPoolParams, type FeeSurface, IPClubCollectionABI, IPClubFactoryABI, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPGenesisABI, IPMarketplaceABI, IPNftABI, IPSponsorshipABI, IPTicketCollectionABI, IPTicketCollectionFactoryABI, LAUNCH_PRICE_QUOTE_PER_COIN, Medialane1155ABI, MedialaneClient, MedialaneError, type MintEditionParams, POPCollectionABI, POPFactoryABI, type ParsedAdminHeaders, PopService, type RequestSiwsTokenArgs, type ResolvedOrder, type SiwsSigner, SponsorshipService, StarknetVenue, type StarknetVenueDeps, type StarknetVenueSigner, TicketService, VALIDATED_EKUBO_PARAMS, VenueSigner, adminRequestDigest, build1155CancellationTypedData, build1155OrderTypedData, buildAdminSessionTypedData, buildCancellationTypedData, buildCreateCreatorCoinCall, buildFeeCall, buildLaunchOnEkuboCalls, buildOrderTypedData, buybackQuoteRaw, toRaw as coinToRaw, createAdminSessionGrant, encodeAdminHeaders, encodeByteArray, fdvHuman, getCounter, getCounter1155, getCreatorCoinPrice, getOrderDetails, getOrderDetails1155, getSiwsStorageKey, getStoredSiwsToken, isSiwsTokenValid, normalizeSiwsSignature, parseAdminHeaders, parseCreatorCoinCreated, priceToEkuboParams, randomNonce, requestSiwsToken, sessionKeyHashOf, signAdminRequest, storeSiwsToken, teamCoinsRaw, validateName as validateCoinName, validateSupply as validateCoinSupply, validateSymbol as validateCoinSymbol, verifyAdminRequestSig };
|
package/dist/starknet/index.js
CHANGED
|
@@ -10340,6 +10340,46 @@ function getTokenByAddress(address) {
|
|
|
10340
10340
|
});
|
|
10341
10341
|
}
|
|
10342
10342
|
|
|
10343
|
+
// src/starknet/services/coinLaunchMath.ts
|
|
10344
|
+
var COIN_DECIMALS = 18;
|
|
10345
|
+
var LAUNCH_PRICE_QUOTE_PER_COIN = 0.01;
|
|
10346
|
+
var MIN_SUPPLY = 1000n;
|
|
10347
|
+
var MAX_SUPPLY = 1000000000000n;
|
|
10348
|
+
var MAX_FELT_BYTES = 31;
|
|
10349
|
+
function byteLen(s) {
|
|
10350
|
+
return new TextEncoder().encode(s).length;
|
|
10351
|
+
}
|
|
10352
|
+
function validateName(s) {
|
|
10353
|
+
if (!s.trim()) return "Name is required";
|
|
10354
|
+
if (byteLen(s) > MAX_FELT_BYTES) return `Name must be at most ${MAX_FELT_BYTES} bytes`;
|
|
10355
|
+
return null;
|
|
10356
|
+
}
|
|
10357
|
+
function validateSymbol(s) {
|
|
10358
|
+
if (!s.trim()) return "Symbol is required";
|
|
10359
|
+
if (byteLen(s) > MAX_FELT_BYTES) return `Symbol must be at most ${MAX_FELT_BYTES} bytes`;
|
|
10360
|
+
return null;
|
|
10361
|
+
}
|
|
10362
|
+
function validateSupply(human) {
|
|
10363
|
+
if (!/^\d+$/.test(human.trim())) return "Supply must be a whole number";
|
|
10364
|
+
const v = BigInt(human.trim());
|
|
10365
|
+
if (v < MIN_SUPPLY) return `Supply must be at least ${MIN_SUPPLY.toString()}`;
|
|
10366
|
+
if (v > MAX_SUPPLY) return `Supply must be at most ${MAX_SUPPLY.toString()}`;
|
|
10367
|
+
return null;
|
|
10368
|
+
}
|
|
10369
|
+
function toRaw(human, decimals = COIN_DECIMALS) {
|
|
10370
|
+
return human * 10n ** BigInt(decimals);
|
|
10371
|
+
}
|
|
10372
|
+
function teamCoinsRaw(supplyRaw, pct) {
|
|
10373
|
+
const bps = BigInt(Math.round(pct * 100));
|
|
10374
|
+
return supplyRaw * bps / 10000n;
|
|
10375
|
+
}
|
|
10376
|
+
function buybackQuoteRaw(teamCoinsRawValue, quoteDecimals) {
|
|
10377
|
+
return teamCoinsRawValue * 10n ** BigInt(quoteDecimals) / (100n * 10n ** BigInt(COIN_DECIMALS));
|
|
10378
|
+
}
|
|
10379
|
+
function fdvHuman(supplyHuman) {
|
|
10380
|
+
return supplyHuman * LAUNCH_PRICE_QUOTE_PER_COIN;
|
|
10381
|
+
}
|
|
10382
|
+
|
|
10343
10383
|
// src/starknet/services/creatorCoin.ts
|
|
10344
10384
|
var VALIDATED_EKUBO_PARAMS = {
|
|
10345
10385
|
fee: "0xc49ba5e353f7d00000000000000000",
|
|
@@ -10347,7 +10387,21 @@ var VALIDATED_EKUBO_PARAMS = {
|
|
|
10347
10387
|
startingPrice: { mag: 4600158n, sign: true },
|
|
10348
10388
|
bound: 88719042n
|
|
10349
10389
|
};
|
|
10350
|
-
var
|
|
10390
|
+
var TICK_BASE = 1.000001;
|
|
10391
|
+
function priceToEkuboParams(quoteDecimals, price = LAUNCH_PRICE_QUOTE_PER_COIN) {
|
|
10392
|
+
const decAdj = 10 ** (COIN_DECIMALS2 - quoteDecimals);
|
|
10393
|
+
const rawRatio = price / decAdj;
|
|
10394
|
+
const tickSpacing = Number(VALIDATED_EKUBO_PARAMS.tickSpacing);
|
|
10395
|
+
const rawTick = Math.log(rawRatio) / Math.log(TICK_BASE);
|
|
10396
|
+
const roundedTick = Math.trunc(rawTick / tickSpacing) * tickSpacing;
|
|
10397
|
+
return {
|
|
10398
|
+
fee: VALIDATED_EKUBO_PARAMS.fee,
|
|
10399
|
+
tickSpacing: VALIDATED_EKUBO_PARAMS.tickSpacing,
|
|
10400
|
+
startingPrice: { mag: BigInt(Math.abs(roundedTick)), sign: roundedTick < 0 },
|
|
10401
|
+
bound: VALIDATED_EKUBO_PARAMS.bound
|
|
10402
|
+
};
|
|
10403
|
+
}
|
|
10404
|
+
var COIN_DECIMALS2 = 18;
|
|
10351
10405
|
async function getCreatorCoinPrice(coinAddress, provider) {
|
|
10352
10406
|
const r = await provider.callContract({
|
|
10353
10407
|
contractAddress: coinAddress,
|
|
@@ -10371,7 +10425,7 @@ async function getCreatorCoinPrice(coinAddress, provider) {
|
|
|
10371
10425
|
});
|
|
10372
10426
|
const sqrt = BigInt(pp[0]) + (BigInt(pp[1] ?? "0x0") << 128n);
|
|
10373
10427
|
const priceT1perT0 = (Number(sqrt) / 2 ** 128) ** 2;
|
|
10374
|
-
const decAdj = 10 ** (
|
|
10428
|
+
const decAdj = 10 ** (COIN_DECIMALS2 - quoteDecimals);
|
|
10375
10429
|
const quotePerCoin = (quoteIsToken0 ? 1 / priceT1perT0 : priceT1perT0) * decAdj;
|
|
10376
10430
|
return { quotePerCoin, quoteToken, quoteSymbol: token?.symbol ?? null, quoteDecimals };
|
|
10377
10431
|
}
|
|
@@ -11609,46 +11663,6 @@ async function requestSiwsToken({
|
|
|
11609
11663
|
storeSiwsToken(walletAddress, token);
|
|
11610
11664
|
return token;
|
|
11611
11665
|
}
|
|
11612
|
-
|
|
11613
|
-
// src/starknet/services/coinLaunchMath.ts
|
|
11614
|
-
var COIN_DECIMALS2 = 18;
|
|
11615
|
-
var LAUNCH_PRICE_QUOTE_PER_COIN = 0.01;
|
|
11616
|
-
var MIN_SUPPLY = 1000n;
|
|
11617
|
-
var MAX_SUPPLY = 1000000000000n;
|
|
11618
|
-
var MAX_FELT_BYTES = 31;
|
|
11619
|
-
function byteLen(s) {
|
|
11620
|
-
return new TextEncoder().encode(s).length;
|
|
11621
|
-
}
|
|
11622
|
-
function validateName(s) {
|
|
11623
|
-
if (!s.trim()) return "Name is required";
|
|
11624
|
-
if (byteLen(s) > MAX_FELT_BYTES) return `Name must be at most ${MAX_FELT_BYTES} bytes`;
|
|
11625
|
-
return null;
|
|
11626
|
-
}
|
|
11627
|
-
function validateSymbol(s) {
|
|
11628
|
-
if (!s.trim()) return "Symbol is required";
|
|
11629
|
-
if (byteLen(s) > MAX_FELT_BYTES) return `Symbol must be at most ${MAX_FELT_BYTES} bytes`;
|
|
11630
|
-
return null;
|
|
11631
|
-
}
|
|
11632
|
-
function validateSupply(human) {
|
|
11633
|
-
if (!/^\d+$/.test(human.trim())) return "Supply must be a whole number";
|
|
11634
|
-
const v = BigInt(human.trim());
|
|
11635
|
-
if (v < MIN_SUPPLY) return `Supply must be at least ${MIN_SUPPLY.toString()}`;
|
|
11636
|
-
if (v > MAX_SUPPLY) return `Supply must be at most ${MAX_SUPPLY.toString()}`;
|
|
11637
|
-
return null;
|
|
11638
|
-
}
|
|
11639
|
-
function toRaw(human, decimals = COIN_DECIMALS2) {
|
|
11640
|
-
return human * 10n ** BigInt(decimals);
|
|
11641
|
-
}
|
|
11642
|
-
function teamCoinsRaw(supplyRaw, pct) {
|
|
11643
|
-
const bps = BigInt(Math.round(pct * 100));
|
|
11644
|
-
return supplyRaw * bps / 10000n;
|
|
11645
|
-
}
|
|
11646
|
-
function buybackQuoteRaw(teamCoinsRawValue, quoteDecimals) {
|
|
11647
|
-
return teamCoinsRawValue * 10n ** BigInt(quoteDecimals) / (100n * 10n ** BigInt(COIN_DECIMALS2));
|
|
11648
|
-
}
|
|
11649
|
-
function fdvHuman(supplyHuman) {
|
|
11650
|
-
return supplyHuman * LAUNCH_PRICE_QUOTE_PER_COIN;
|
|
11651
|
-
}
|
|
11652
11666
|
function encodeByteArray(str) {
|
|
11653
11667
|
const bytes = new TextEncoder().encode(str);
|
|
11654
11668
|
const fullChunks = [];
|
|
@@ -11674,6 +11688,6 @@ function encodeByteArray(str) {
|
|
|
11674
11688
|
];
|
|
11675
11689
|
}
|
|
11676
11690
|
|
|
11677
|
-
export { ADMIN_HEADERS, ADMIN_SCOPE, MAX_SUPPLY as COIN_MAX_SUPPLY, MIN_SUPPLY as COIN_MIN_SUPPLY, ClubService, CreatorCoinFactoryABI, CreatorCoinService, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, IPClubCollectionABI, IPClubFactoryABI, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPGenesisABI, IPMarketplaceABI, IPNftABI, IPSponsorshipABI, IPTicketCollectionABI, IPTicketCollectionFactoryABI, LAUNCH_PRICE_QUOTE_PER_COIN, Medialane1155ABI, MedialaneClient, MedialaneError, POPCollectionABI, POPFactoryABI, PopService, SponsorshipService, StarknetVenue, TicketService, VALIDATED_EKUBO_PARAMS, adminRequestDigest, build1155CancellationTypedData, build1155OrderTypedData, buildAdminSessionTypedData, buildCancellationTypedData, buildCreateCreatorCoinCall, buildFeeCall, buildLaunchOnEkuboCalls, buildOrderTypedData, buybackQuoteRaw, toRaw as coinToRaw, createAdminSessionGrant, encodeAdminHeaders, encodeByteArray, fdvHuman, getCounter, getCounter1155, getCreatorCoinPrice, getOrderDetails, getOrderDetails1155, getSiwsStorageKey, getStoredSiwsToken, isSiwsTokenValid, normalizeSiwsSignature, parseAdminHeaders, parseCreatorCoinCreated, randomNonce, requestSiwsToken, sessionKeyHashOf, signAdminRequest, storeSiwsToken, teamCoinsRaw, validateName as validateCoinName, validateSupply as validateCoinSupply, validateSymbol as validateCoinSymbol, verifyAdminRequestSig };
|
|
11691
|
+
export { ADMIN_HEADERS, ADMIN_SCOPE, MAX_SUPPLY as COIN_MAX_SUPPLY, MIN_SUPPLY as COIN_MIN_SUPPLY, ClubService, CreatorCoinFactoryABI, CreatorCoinService, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, IPClubCollectionABI, IPClubFactoryABI, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPGenesisABI, IPMarketplaceABI, IPNftABI, IPSponsorshipABI, IPTicketCollectionABI, IPTicketCollectionFactoryABI, LAUNCH_PRICE_QUOTE_PER_COIN, Medialane1155ABI, MedialaneClient, MedialaneError, POPCollectionABI, POPFactoryABI, PopService, SponsorshipService, StarknetVenue, TicketService, VALIDATED_EKUBO_PARAMS, adminRequestDigest, build1155CancellationTypedData, build1155OrderTypedData, buildAdminSessionTypedData, buildCancellationTypedData, buildCreateCreatorCoinCall, buildFeeCall, buildLaunchOnEkuboCalls, buildOrderTypedData, buybackQuoteRaw, toRaw as coinToRaw, createAdminSessionGrant, encodeAdminHeaders, encodeByteArray, fdvHuman, getCounter, getCounter1155, getCreatorCoinPrice, getOrderDetails, getOrderDetails1155, getSiwsStorageKey, getStoredSiwsToken, isSiwsTokenValid, normalizeSiwsSignature, parseAdminHeaders, parseCreatorCoinCreated, priceToEkuboParams, randomNonce, requestSiwsToken, sessionKeyHashOf, signAdminRequest, storeSiwsToken, teamCoinsRaw, validateName as validateCoinName, validateSupply as validateCoinSupply, validateSymbol as validateCoinSymbol, verifyAdminRequestSig };
|
|
11678
11692
|
//# sourceMappingURL=index.js.map
|
|
11679
11693
|
//# sourceMappingURL=index.js.map
|