@medialane/sdk 0.169.0 → 0.171.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 +1 -1
- package/dist/{chunk-4SZV7J2R.cjs → chunk-BC2L2H6A.cjs} +21 -16
- package/dist/chunk-BC2L2H6A.cjs.map +1 -0
- package/dist/{chunk-X5RNNPDU.js → chunk-DDZJFN65.js} +21 -16
- package/dist/chunk-DDZJFN65.js.map +1 -0
- package/dist/{errors-D6S2d0Oy.d.ts → errors-5C3YHsDE.d.ts} +49 -32
- package/dist/{errors-GfSlToOh.d.cts → errors-DvSfHOZu.d.cts} +49 -32
- package/dist/index.cjs +75 -75
- 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 +1 -1
- package/dist/index.js.map +1 -1
- package/dist/starknet/index.cjs +79 -76
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +7 -6
- package/dist/starknet/index.d.ts +7 -6
- package/dist/starknet/index.js +10 -7
- package/dist/starknet/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-4SZV7J2R.cjs.map +0 -1
- package/dist/chunk-X5RNNPDU.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { bS as ResolvedConfig,
|
|
2
|
-
export { ca as InvalidRecoveryKeyError, cb as OwnerSigner, bK as PasskeyCancelledError, cc as PasskeyConfig, bL as PasskeyUnsupportedError, bM as PasskeyUnsupportedReason, cd as RecoveryKey, b$ as UserFacingError, ce as createPasskeyOwner, cf as encodeRecoveryKey, cg as parseRecoveryKey } from '../errors-
|
|
1
|
+
import { bS as ResolvedConfig, b4 as CreatePopCollectionParams, bZ as TxResult, aY as CreateDropParams, bb as CreateTicketParams, bC as MintTicketsParams, b0 as CreateMembershipParams, bB as MintMembershipsParams, b8 as CreateSponsorshipOfferParams, bP as ProposeSponsorshipParams, k as ApiClient, bz as MedialaneConfig, bA as MedialaneErrorCode, bH as OrderDetails, R as ResolvedFeeConfig, J as ApiFundingIntent, I as ApiFundingInstructions, M as ApiFundingSubmit, O as ApiIntentCreated, bi as DropTerms, c4 as SealedOwner, c5 as ReceiptProviderLike, c6 as WalletExecutor, c7 as ExecutedTransaction, c8 as PasskeyOwner, bg as CreateWalletManageIntentParams, c9 as CreatedOwner } from '../errors-DvSfHOZu.cjs';
|
|
2
|
+
export { ca as InvalidRecoveryKeyError, cb as OwnerSigner, bK as PasskeyCancelledError, cc as PasskeyConfig, bL as PasskeyUnsupportedError, bM as PasskeyUnsupportedReason, cd as RecoveryKey, b$ as UserFacingError, ce as createPasskeyOwner, cf as encodeRecoveryKey, cg as parseRecoveryKey } from '../errors-DvSfHOZu.cjs';
|
|
3
3
|
import * as starknet from 'starknet';
|
|
4
4
|
import { AccountInterface, ProviderInterface, Call, TypedData, constants, BigNumberish, DeployAccountContractPayload, Account } from 'starknet';
|
|
5
5
|
import { V as VenueAdapter, O as OrderRef, A as AdapterTxResult, R as RegisterOrderParams, j as VenueSigner } from '../types-BTNjkUst.cjs';
|
|
@@ -8547,6 +8547,8 @@ declare const popCalls: {
|
|
|
8547
8547
|
setAllowlistRoot(collection: string, root: string): Call;
|
|
8548
8548
|
};
|
|
8549
8549
|
|
|
8550
|
+
/** Most tokens one claim transaction mints. */
|
|
8551
|
+
declare const DROP_MAX_CLAIM_QUANTITY = 50n;
|
|
8550
8552
|
/** Sale terms as the contract's `SaleTerms` struct. A free drop names no token. */
|
|
8551
8553
|
declare function toContractTerms(t: DropTerms): {
|
|
8552
8554
|
start_time: number;
|
|
@@ -8577,7 +8579,7 @@ interface DropMintCost {
|
|
|
8577
8579
|
fee: bigint;
|
|
8578
8580
|
total: bigint;
|
|
8579
8581
|
}
|
|
8580
|
-
declare function dropMintCost(price: bigint | string, quantity: bigint | string | number,
|
|
8582
|
+
declare function dropMintCost(price: bigint | string, quantity: bigint | string | number, feeBps: number): DropMintCost;
|
|
8581
8583
|
|
|
8582
8584
|
interface DropOnchain {
|
|
8583
8585
|
organizer: string;
|
|
@@ -8599,8 +8601,6 @@ interface DropOnchain {
|
|
|
8599
8601
|
declare function readDrop(provider: Pick<ProviderInterface, "callContract">, collection: string): Promise<DropOnchain>;
|
|
8600
8602
|
/** How many tokens `wallet` has claimed from this drop (gifts not included). */
|
|
8601
8603
|
declare function dropClaimedBy(provider: Pick<ProviderInterface, "callContract">, collection: string, wallet: string): Promise<bigint>;
|
|
8602
|
-
/** Most tokens one claim transaction mints. */
|
|
8603
|
-
declare const DROP_MAX_CLAIM_QUANTITY = 50n;
|
|
8604
8604
|
type DropMintStateKind = "loading" | "upcoming" | "ended" | "sold-out" | "no-wallet" | "no-link" | "not-on-list" | "limit-reached" | "insufficient-balance" | "ready";
|
|
8605
8605
|
interface DropMintState {
|
|
8606
8606
|
state: DropMintStateKind;
|
|
@@ -8617,7 +8617,8 @@ declare function dropMintState(input: {
|
|
|
8617
8617
|
proof: string[] | null;
|
|
8618
8618
|
/** Wallet balance of the payment token; null while loading (ignored for free drops). */
|
|
8619
8619
|
balance: bigint | null;
|
|
8620
|
-
|
|
8620
|
+
/** Platform fee added to a mint, in basis points. */
|
|
8621
|
+
feeBps: number;
|
|
8621
8622
|
/** Unix seconds. */
|
|
8622
8623
|
now: number;
|
|
8623
8624
|
}): DropMintState;
|
package/dist/starknet/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { bS as ResolvedConfig,
|
|
2
|
-
export { ca as InvalidRecoveryKeyError, cb as OwnerSigner, bK as PasskeyCancelledError, cc as PasskeyConfig, bL as PasskeyUnsupportedError, bM as PasskeyUnsupportedReason, cd as RecoveryKey, b$ as UserFacingError, ce as createPasskeyOwner, cf as encodeRecoveryKey, cg as parseRecoveryKey } from '../errors-
|
|
1
|
+
import { bS as ResolvedConfig, b4 as CreatePopCollectionParams, bZ as TxResult, aY as CreateDropParams, bb as CreateTicketParams, bC as MintTicketsParams, b0 as CreateMembershipParams, bB as MintMembershipsParams, b8 as CreateSponsorshipOfferParams, bP as ProposeSponsorshipParams, k as ApiClient, bz as MedialaneConfig, bA as MedialaneErrorCode, bH as OrderDetails, R as ResolvedFeeConfig, J as ApiFundingIntent, I as ApiFundingInstructions, M as ApiFundingSubmit, O as ApiIntentCreated, bi as DropTerms, c4 as SealedOwner, c5 as ReceiptProviderLike, c6 as WalletExecutor, c7 as ExecutedTransaction, c8 as PasskeyOwner, bg as CreateWalletManageIntentParams, c9 as CreatedOwner } from '../errors-5C3YHsDE.js';
|
|
2
|
+
export { ca as InvalidRecoveryKeyError, cb as OwnerSigner, bK as PasskeyCancelledError, cc as PasskeyConfig, bL as PasskeyUnsupportedError, bM as PasskeyUnsupportedReason, cd as RecoveryKey, b$ as UserFacingError, ce as createPasskeyOwner, cf as encodeRecoveryKey, cg as parseRecoveryKey } from '../errors-5C3YHsDE.js';
|
|
3
3
|
import * as starknet from 'starknet';
|
|
4
4
|
import { AccountInterface, ProviderInterface, Call, TypedData, constants, BigNumberish, DeployAccountContractPayload, Account } from 'starknet';
|
|
5
5
|
import { V as VenueAdapter, O as OrderRef, A as AdapterTxResult, R as RegisterOrderParams, j as VenueSigner } from '../types-BTNjkUst.js';
|
|
@@ -8547,6 +8547,8 @@ declare const popCalls: {
|
|
|
8547
8547
|
setAllowlistRoot(collection: string, root: string): Call;
|
|
8548
8548
|
};
|
|
8549
8549
|
|
|
8550
|
+
/** Most tokens one claim transaction mints. */
|
|
8551
|
+
declare const DROP_MAX_CLAIM_QUANTITY = 50n;
|
|
8550
8552
|
/** Sale terms as the contract's `SaleTerms` struct. A free drop names no token. */
|
|
8551
8553
|
declare function toContractTerms(t: DropTerms): {
|
|
8552
8554
|
start_time: number;
|
|
@@ -8577,7 +8579,7 @@ interface DropMintCost {
|
|
|
8577
8579
|
fee: bigint;
|
|
8578
8580
|
total: bigint;
|
|
8579
8581
|
}
|
|
8580
|
-
declare function dropMintCost(price: bigint | string, quantity: bigint | string | number,
|
|
8582
|
+
declare function dropMintCost(price: bigint | string, quantity: bigint | string | number, feeBps: number): DropMintCost;
|
|
8581
8583
|
|
|
8582
8584
|
interface DropOnchain {
|
|
8583
8585
|
organizer: string;
|
|
@@ -8599,8 +8601,6 @@ interface DropOnchain {
|
|
|
8599
8601
|
declare function readDrop(provider: Pick<ProviderInterface, "callContract">, collection: string): Promise<DropOnchain>;
|
|
8600
8602
|
/** How many tokens `wallet` has claimed from this drop (gifts not included). */
|
|
8601
8603
|
declare function dropClaimedBy(provider: Pick<ProviderInterface, "callContract">, collection: string, wallet: string): Promise<bigint>;
|
|
8602
|
-
/** Most tokens one claim transaction mints. */
|
|
8603
|
-
declare const DROP_MAX_CLAIM_QUANTITY = 50n;
|
|
8604
8604
|
type DropMintStateKind = "loading" | "upcoming" | "ended" | "sold-out" | "no-wallet" | "no-link" | "not-on-list" | "limit-reached" | "insufficient-balance" | "ready";
|
|
8605
8605
|
interface DropMintState {
|
|
8606
8606
|
state: DropMintStateKind;
|
|
@@ -8617,7 +8617,8 @@ declare function dropMintState(input: {
|
|
|
8617
8617
|
proof: string[] | null;
|
|
8618
8618
|
/** Wallet balance of the payment token; null while loading (ignored for free drops). */
|
|
8619
8619
|
balance: bigint | null;
|
|
8620
|
-
|
|
8620
|
+
/** Platform fee added to a mint, in basis points. */
|
|
8621
|
+
feeBps: number;
|
|
8621
8622
|
/** Unix seconds. */
|
|
8622
8623
|
now: number;
|
|
8623
8624
|
}): DropMintState;
|
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, starkKeyPairFromPrivateKey, createFailoverFetch } 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, starkKeyPairFromPrivateKey, createFailoverFetch } from '../chunk-DDZJFN65.js';
|
|
2
|
+
export { InvalidStarkPrivateKeyError, PasskeyCancelledError, PasskeyUnsupportedError, UserFacingError, computeAccountAddress, createPasskeyOwner, deriveAesKey, generateStarkKeyPair, ownerConstructorCalldata, sealPrivateKey, signWithPrivateKey, starkKeyPairFromPrivateKey, unsealPrivateKey } from '../chunk-DDZJFN65.js';
|
|
3
3
|
import { getStarknetCoordinates, getCoordinates } from '../chunk-WYKCGQPN.js';
|
|
4
4
|
import { CallData, hash, cairo, RpcProvider, uint256, CairoOption, CairoOptionVariant, num, ec, validateAndParseAddress, Account, typedData, stark, byteArray, Contract, TypedDataRevision, constants, shortString } from 'starknet';
|
|
5
5
|
import { extract, expand } from '@noble/hashes/hkdf.js';
|
|
@@ -10545,6 +10545,7 @@ function buildFeeCall(p, cfg) {
|
|
|
10545
10545
|
calldata: [cfg.fundAddress, u.low.toString(), u.high.toString()]
|
|
10546
10546
|
};
|
|
10547
10547
|
}
|
|
10548
|
+
var DROP_MAX_CLAIM_QUANTITY = 50n;
|
|
10548
10549
|
var addr2 = (a) => normalizeAddress("STARKNET", a);
|
|
10549
10550
|
var factoryData = new CallData(DropFactoryABI);
|
|
10550
10551
|
var collectionData = new CallData(DropCollectionABI);
|
|
@@ -10576,6 +10577,7 @@ var dropCalls = {
|
|
|
10576
10577
|
/** Approve (paid drops) and claim. The platform fee call is added by the caller. */
|
|
10577
10578
|
claim(collection, p) {
|
|
10578
10579
|
const quantity = BigInt(p.quantity);
|
|
10580
|
+
if (quantity < 1n || quantity > DROP_MAX_CLAIM_QUANTITY) throw new RangeError(`quantity must be 1 to ${DROP_MAX_CLAIM_QUANTITY}`);
|
|
10579
10581
|
const total = BigInt(p.price) * quantity;
|
|
10580
10582
|
const calls = [];
|
|
10581
10583
|
if (total > 0n) {
|
|
@@ -10594,10 +10596,12 @@ var dropCalls = {
|
|
|
10594
10596
|
},
|
|
10595
10597
|
/** Organizer only: free mint within the supply cap. */
|
|
10596
10598
|
issue(collection, recipient, quantity) {
|
|
10599
|
+
const q = BigInt(quantity);
|
|
10600
|
+
if (q < 1n) throw new RangeError("quantity must be at least 1");
|
|
10597
10601
|
return {
|
|
10598
10602
|
contractAddress: addr2(collection),
|
|
10599
10603
|
entrypoint: "issue",
|
|
10600
|
-
calldata: collectionData.compile("issue", { recipient: addr2(recipient), quantity: cairo.uint256(
|
|
10604
|
+
calldata: collectionData.compile("issue", { recipient: addr2(recipient), quantity: cairo.uint256(q) })
|
|
10601
10605
|
};
|
|
10602
10606
|
},
|
|
10603
10607
|
/** Organizer only. 0 opens the drop to everyone. */
|
|
@@ -10605,9 +10609,9 @@ var dropCalls = {
|
|
|
10605
10609
|
return { contractAddress: addr2(collection), entrypoint: "set_allowlist_root", calldata: collectionData.compile("set_allowlist_root", { root }) };
|
|
10606
10610
|
}
|
|
10607
10611
|
};
|
|
10608
|
-
function dropMintCost(price, quantity,
|
|
10612
|
+
function dropMintCost(price, quantity, feeBps2) {
|
|
10609
10613
|
const subtotal = BigInt(price) * BigInt(quantity);
|
|
10610
|
-
const fee = feeAmount(subtotal,
|
|
10614
|
+
const fee = feeAmount(subtotal, feeBps2);
|
|
10611
10615
|
return { subtotal, fee, total: subtotal + fee };
|
|
10612
10616
|
}
|
|
10613
10617
|
|
|
@@ -10640,7 +10644,6 @@ async function dropClaimedBy(provider, collection, wallet) {
|
|
|
10640
10644
|
const res = await provider.callContract({ contractAddress: hex(collection), entrypoint: "claimed_by", calldata: [hex(wallet)] });
|
|
10641
10645
|
return u256(res[0], res[1]);
|
|
10642
10646
|
}
|
|
10643
|
-
var DROP_MAX_CLAIM_QUANTITY = 50n;
|
|
10644
10647
|
function dropMintState(input) {
|
|
10645
10648
|
const none = (state) => ({ state, maxQuantity: 0n });
|
|
10646
10649
|
const { drop, wallet, claimed, proof, balance, now } = input;
|
|
@@ -10662,7 +10665,7 @@ function dropMintState(input) {
|
|
|
10662
10665
|
if (walletLeft !== null && walletLeft < max) max = walletLeft;
|
|
10663
10666
|
if (drop.price > 0n) {
|
|
10664
10667
|
if (balance === null) return none("loading");
|
|
10665
|
-
while (max > 0n && dropMintCost(drop.price, max, input.
|
|
10668
|
+
while (max > 0n && dropMintCost(drop.price, max, input.feeBps).total > balance) max--;
|
|
10666
10669
|
if (max === 0n) return none("insufficient-balance");
|
|
10667
10670
|
}
|
|
10668
10671
|
return { state: "ready", maxQuantity: max };
|