@medialane/sdk 0.182.0 → 0.184.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.
@@ -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 { bU as ResolvedConfig, b6 as CreatePopCollectionParams, b$ as TxResult, a_ as CreateDropParams, bd as CreateTicketParams, bE as MintTicketsParams, b2 as CreateMembershipParams, bD as MintMembershipsParams, ba as CreateSponsorshipOfferParams, bR as ProposeSponsorshipParams, k as ApiClient, c6 as CreatorCoinService, bB as MedialaneConfig, bC as MedialaneErrorCode, R as ResolvedFeeConfig, J as ApiFundingIntent, I as ApiFundingInstructions, M as ApiFundingSubmit, O as ApiIntentCreated, bk as DropTerms, c7 as SealedOwner, c8 as ReceiptProviderLike, c9 as WalletExecutor, ca as ExecutedTransaction, cb as PasskeyOwner, bi as CreateWalletManageIntentParams, cc as CreatedOwner } from '../errors-C3dgi8bK.cjs';
4
- export { cd as ApiKeyAction, ce as ApiKeyConfirmation, cf as ApiKeyConfirmationInput, cg as CreateCreatorCoinParams, ch as CreatorCoinGuarantees, ci as CreatorCoinReceiptLike, cj as DropMintState, ck as DropMintStateKind, cl as DropOnchain, cm as EkuboLaunchParams, cn as EkuboPoolParams, co as InvalidRecoveryKeyError, cp as MAX_HOLDERS_AT_LAUNCH, cq as MAX_TEAM_ALLOCATION_PERCENT, cr as OwnerSigner, bM as PasskeyCancelledError, cs as PasskeyConfig, bN as PasskeyUnsupportedError, bO as PasskeyUnsupportedReason, ct as PopAllowlist, cu as PopClaimInfo, cv as PopClaimLink, cw as PopClaimState, cx as RecoveryKey, c1 as UserFacingError, cy as VALIDATED_EKUBO_PARAMS, cz as apiKeyConfirmationTypedData, cA as buildCreateCreatorCoinCall, cB as buildLaunchOnEkuboCalls, cC as buildPopAllowlist, cD as createPasskeyOwner, cE as decodePopClaimFragment, cF as dropClaimLinks, cG as dropClaimedBy, cH as dropMintState, cI as encodePopClaimFragment, cJ as encodeRecoveryKey, cK as getCreatorCoinGuarantees, cL as parseCreatorCoinCreated, cM as parseRecoveryKey, cN as popCalls, cO as popClaimInfo, cP as popClaimLinks, cQ as popClaimLinksCsv, cR as popClaimState, cS as priceToEkuboParams, cT as readDrop, cU as validatePrice, cV as verifyPopProof } from '../errors-C3dgi8bK.cjs';
3
+ import { bU as ResolvedConfig, b6 as CreatePopCollectionParams, b$ as TxResult, a_ as CreateDropParams, bd as CreateTicketParams, bE as MintTicketsParams, b2 as CreateMembershipParams, bD as MintMembershipsParams, ba as CreateSponsorshipOfferParams, bR as ProposeSponsorshipParams, k as ApiClient, c6 as CreatorCoinService, bB as MedialaneConfig, bC as MedialaneErrorCode, R as ResolvedFeeConfig, J as ApiFundingIntent, I as ApiFundingInstructions, M as ApiFundingSubmit, O as ApiIntentCreated, bk as DropTerms, c7 as SealedOwner, c8 as ReceiptProviderLike, c9 as WalletExecutor, ca as ExecutedTransaction, cb as PasskeyOwner, bi as CreateWalletManageIntentParams, cc as CreatedOwner } from '../errors-CrBviXC8.cjs';
4
+ export { cd as ApiKeyAction, ce as ApiKeyConfirmation, cf as ApiKeyConfirmationInput, cg as CreateCreatorCoinParams, ch as CreatorCoinGuarantees, ci as CreatorCoinReceiptLike, cj as DropMintState, ck as DropMintStateKind, cl as DropOnchain, cm as EkuboLaunchParams, cn as EkuboPoolParams, co as InvalidRecoveryKeyError, cp as MAX_HOLDERS_AT_LAUNCH, cq as MAX_TEAM_ALLOCATION_PERCENT, cr as OwnerSigner, bM as PasskeyCancelledError, cs as PasskeyConfig, bN as PasskeyUnsupportedError, bO as PasskeyUnsupportedReason, ct as PopAllowlist, cu as PopClaimInfo, cv as PopClaimLink, cw as PopClaimState, cx as RecoveryKey, c1 as UserFacingError, cy as VALIDATED_EKUBO_PARAMS, cz as apiKeyConfirmationTypedData, cA as buildCreateCreatorCoinCall, cB as buildLaunchOnEkuboCalls, cC as buildPopAllowlist, cD as createPasskeyOwner, cE as decodePopClaimFragment, cF as dropClaimLinks, cG as dropClaimedBy, cH as dropMintState, cI as encodePopClaimFragment, cJ as encodeRecoveryKey, cK as getCreatorCoinGuarantees, cL as parseCreatorCoinCreated, cM as parseRecoveryKey, cN as popCalls, cO as popClaimInfo, cP as popClaimLinks, cQ as popClaimLinksCsv, cR as popClaimState, cS as priceToEkuboParams, cT as readDrop, cU as validatePrice, cV as verifyPopProof } from '../errors-CrBviXC8.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
 
@@ -8325,7 +8325,7 @@ interface ReceiptProvider {
8325
8325
  getTransactionReceipt(txHash: string): Promise<unknown>;
8326
8326
  }
8327
8327
  declare function confirmIntentBestEffort(client: MedialaneClient, intentId: string, txHash: string): Promise<void>;
8328
- declare function syncTransactionBestEffort(client: MedialaneClient, txHash: string, timeoutMs?: number): Promise<void>;
8328
+ declare function syncTransactionBestEffort(client: MedialaneClient, txHash: string, timeoutMs?: number, retryMs?: number): Promise<void>;
8329
8329
  declare function assertTransactionSucceeded(provider: ReceiptProvider, txHash: string, retryDelaysMs?: readonly number[]): Promise<ReceiptLike>;
8330
8330
  interface ExecuteIntentOpts {
8331
8331
  confirm?: boolean;
@@ -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 { bU as ResolvedConfig, b6 as CreatePopCollectionParams, b$ as TxResult, a_ as CreateDropParams, bd as CreateTicketParams, bE as MintTicketsParams, b2 as CreateMembershipParams, bD as MintMembershipsParams, ba as CreateSponsorshipOfferParams, bR as ProposeSponsorshipParams, k as ApiClient, c6 as CreatorCoinService, bB as MedialaneConfig, bC as MedialaneErrorCode, R as ResolvedFeeConfig, J as ApiFundingIntent, I as ApiFundingInstructions, M as ApiFundingSubmit, O as ApiIntentCreated, bk as DropTerms, c7 as SealedOwner, c8 as ReceiptProviderLike, c9 as WalletExecutor, ca as ExecutedTransaction, cb as PasskeyOwner, bi as CreateWalletManageIntentParams, cc as CreatedOwner } from '../errors-kFtjB-a3.js';
4
- export { cd as ApiKeyAction, ce as ApiKeyConfirmation, cf as ApiKeyConfirmationInput, cg as CreateCreatorCoinParams, ch as CreatorCoinGuarantees, ci as CreatorCoinReceiptLike, cj as DropMintState, ck as DropMintStateKind, cl as DropOnchain, cm as EkuboLaunchParams, cn as EkuboPoolParams, co as InvalidRecoveryKeyError, cp as MAX_HOLDERS_AT_LAUNCH, cq as MAX_TEAM_ALLOCATION_PERCENT, cr as OwnerSigner, bM as PasskeyCancelledError, cs as PasskeyConfig, bN as PasskeyUnsupportedError, bO as PasskeyUnsupportedReason, ct as PopAllowlist, cu as PopClaimInfo, cv as PopClaimLink, cw as PopClaimState, cx as RecoveryKey, c1 as UserFacingError, cy as VALIDATED_EKUBO_PARAMS, cz as apiKeyConfirmationTypedData, cA as buildCreateCreatorCoinCall, cB as buildLaunchOnEkuboCalls, cC as buildPopAllowlist, cD as createPasskeyOwner, cE as decodePopClaimFragment, cF as dropClaimLinks, cG as dropClaimedBy, cH as dropMintState, cI as encodePopClaimFragment, cJ as encodeRecoveryKey, cK as getCreatorCoinGuarantees, cL as parseCreatorCoinCreated, cM as parseRecoveryKey, cN as popCalls, cO as popClaimInfo, cP as popClaimLinks, cQ as popClaimLinksCsv, cR as popClaimState, cS as priceToEkuboParams, cT as readDrop, cU as validatePrice, cV as verifyPopProof } from '../errors-kFtjB-a3.js';
3
+ import { bU as ResolvedConfig, b6 as CreatePopCollectionParams, b$ as TxResult, a_ as CreateDropParams, bd as CreateTicketParams, bE as MintTicketsParams, b2 as CreateMembershipParams, bD as MintMembershipsParams, ba as CreateSponsorshipOfferParams, bR as ProposeSponsorshipParams, k as ApiClient, c6 as CreatorCoinService, bB as MedialaneConfig, bC as MedialaneErrorCode, R as ResolvedFeeConfig, J as ApiFundingIntent, I as ApiFundingInstructions, M as ApiFundingSubmit, O as ApiIntentCreated, bk as DropTerms, c7 as SealedOwner, c8 as ReceiptProviderLike, c9 as WalletExecutor, ca as ExecutedTransaction, cb as PasskeyOwner, bi as CreateWalletManageIntentParams, cc as CreatedOwner } from '../errors-kCrcWfrz.js';
4
+ export { cd as ApiKeyAction, ce as ApiKeyConfirmation, cf as ApiKeyConfirmationInput, cg as CreateCreatorCoinParams, ch as CreatorCoinGuarantees, ci as CreatorCoinReceiptLike, cj as DropMintState, ck as DropMintStateKind, cl as DropOnchain, cm as EkuboLaunchParams, cn as EkuboPoolParams, co as InvalidRecoveryKeyError, cp as MAX_HOLDERS_AT_LAUNCH, cq as MAX_TEAM_ALLOCATION_PERCENT, cr as OwnerSigner, bM as PasskeyCancelledError, cs as PasskeyConfig, bN as PasskeyUnsupportedError, bO as PasskeyUnsupportedReason, ct as PopAllowlist, cu as PopClaimInfo, cv as PopClaimLink, cw as PopClaimState, cx as RecoveryKey, c1 as UserFacingError, cy as VALIDATED_EKUBO_PARAMS, cz as apiKeyConfirmationTypedData, cA as buildCreateCreatorCoinCall, cB as buildLaunchOnEkuboCalls, cC as buildPopAllowlist, cD as createPasskeyOwner, cE as decodePopClaimFragment, cF as dropClaimLinks, cG as dropClaimedBy, cH as dropMintState, cI as encodePopClaimFragment, cJ as encodeRecoveryKey, cK as getCreatorCoinGuarantees, cL as parseCreatorCoinCreated, cM as parseRecoveryKey, cN as popCalls, cO as popClaimInfo, cP as popClaimLinks, cQ as popClaimLinksCsv, cR as popClaimState, cS as priceToEkuboParams, cT as readDrop, cU as validatePrice, cV as verifyPopProof } from '../errors-kCrcWfrz.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
 
@@ -8325,7 +8325,7 @@ interface ReceiptProvider {
8325
8325
  getTransactionReceipt(txHash: string): Promise<unknown>;
8326
8326
  }
8327
8327
  declare function confirmIntentBestEffort(client: MedialaneClient, intentId: string, txHash: string): Promise<void>;
8328
- declare function syncTransactionBestEffort(client: MedialaneClient, txHash: string, timeoutMs?: number): Promise<void>;
8328
+ declare function syncTransactionBestEffort(client: MedialaneClient, txHash: string, timeoutMs?: number, retryMs?: number): Promise<void>;
8329
8329
  declare function assertTransactionSucceeded(provider: ReceiptProvider, txHash: string, retryDelaysMs?: readonly number[]): Promise<ReceiptLike>;
8330
8330
  interface ExecuteIntentOpts {
8331
8331
  confirm?: boolean;
@@ -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 } from '../chunk-JZXIZGHW.js';
2
- export { InvalidStarkPrivateKeyError, PasskeyCancelledError, PasskeyUnsupportedError, UserFacingError, computeAccountAddress, createPasskeyOwner, deriveAesKey, generateStarkKeyPair, ownerConstructorCalldata, sealPrivateKey, signWithPrivateKey, starkKeyPairFromPrivateKey, unsealPrivateKey } from '../chunk-JZXIZGHW.js';
1
+ import { normalizeAddress, collectionHref, dropHref, resolveConfig, ApiClient, UserFacingError, getService, STARKNET_MEDIAWALLET_CLASS_HASH, computeAccountAddress, ownerConstructorCalldata, getTokenBySymbol, signWithPrivateKey, stringifyBigInts, SUPPORTED_TOKENS, MedialaneApiError, starkKeyPairFromPrivateKey } from '../chunk-6KFXIVA6.js';
2
+ export { InvalidStarkPrivateKeyError, PasskeyCancelledError, PasskeyUnsupportedError, UserFacingError, computeAccountAddress, createPasskeyOwner, deriveAesKey, generateStarkKeyPair, ownerConstructorCalldata, sealPrivateKey, signWithPrivateKey, starkKeyPairFromPrivateKey, unsealPrivateKey } from '../chunk-6KFXIVA6.js';
3
3
  import { getStarknetCoordinates, getCoordinates } from '../chunk-3ME5YKTW.js';
4
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';
@@ -11877,18 +11877,32 @@ async function confirmIntentBestEffort(client, intentId, txHash) {
11877
11877
  await client.api.confirmIntent(intentId, txHash).catch(() => {
11878
11878
  });
11879
11879
  }
11880
- var SYNC_TIMEOUT_MS = 6e3;
11881
- async function syncTransactionBestEffort(client, txHash, timeoutMs = SYNC_TIMEOUT_MS) {
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;
11882
11888
  let timer;
11883
11889
  const timeout = new Promise((resolve) => {
11884
11890
  timer = setTimeout(() => resolve(), timeoutMs);
11885
11891
  });
11886
- const sync = client.api.syncTransaction(txHash).then(() => {
11887
- }, () => {
11888
- });
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
+ })();
11889
11902
  try {
11890
11903
  await Promise.race([sync, timeout]);
11891
11904
  } finally {
11905
+ stopped = true;
11892
11906
  if (timer) clearTimeout(timer);
11893
11907
  }
11894
11908
  }