@medialane/sdk 0.142.0 → 0.144.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/{errors-DP-VnOWP.d.ts → errors-DUiebYFo.d.ts} +2 -3
- package/dist/{errors-BRCRmVep.d.cts → errors-SGwgtvtF.d.cts} +2 -3
- package/dist/index.cjs +1 -1
- 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 +28 -6
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +5 -2
- package/dist/starknet/index.d.ts +5 -2
- package/dist/starknet/index.js +28 -6
- package/dist/starknet/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { bG as ResolvedConfig, bO as TxResult, a$ as CreatePopCollectionParams, aM as ClaimConditions, aX as CreateDropParams, b4 as CreateTicketParams, bq as MintTicketsParams, aZ as CreateMembershipParams, bp as MintMembershipsParams, b2 as CreateSponsorshipOfferParams, bD as ProposeSponsorshipParams, k as ApiClient, bn as MedialaneConfig, bo as MedialaneErrorCode, bv as OrderDetails, R as ResolvedFeeConfig, I as ApiFundingIntent, H as ApiFundingInstructions, L as ApiFundingSubmit, N as ApiIntentCreated, bW as SealedOwner, bX as ReceiptProviderLike, bY as WalletExecutor, bZ as ExecutedTransaction, b_ as PasskeyOwner, b$ as CreatedOwner } from '../errors-
|
|
2
|
-
export { c0 as InvalidRecoveryKeyError, c1 as OwnerSigner, by as PasskeyCancelledError, c2 as PasskeyConfig, c3 as RecoveryKey, bQ as UserFacingError, c4 as createPasskeyOwner, c5 as encodeRecoveryKey, c6 as parseRecoveryKey } from '../errors-
|
|
1
|
+
import { bG as ResolvedConfig, bO as TxResult, a$ as CreatePopCollectionParams, aM as ClaimConditions, aX as CreateDropParams, b4 as CreateTicketParams, bq as MintTicketsParams, aZ as CreateMembershipParams, bp as MintMembershipsParams, b2 as CreateSponsorshipOfferParams, bD as ProposeSponsorshipParams, k as ApiClient, bn as MedialaneConfig, bo as MedialaneErrorCode, bv as OrderDetails, R as ResolvedFeeConfig, I as ApiFundingIntent, H as ApiFundingInstructions, L as ApiFundingSubmit, N as ApiIntentCreated, bW as SealedOwner, bX as ReceiptProviderLike, bY as WalletExecutor, bZ as ExecutedTransaction, b_ as PasskeyOwner, b$ as CreatedOwner } from '../errors-SGwgtvtF.cjs';
|
|
2
|
+
export { c0 as InvalidRecoveryKeyError, c1 as OwnerSigner, by as PasskeyCancelledError, c2 as PasskeyConfig, c3 as RecoveryKey, bQ as UserFacingError, c4 as createPasskeyOwner, c5 as encodeRecoveryKey, c6 as parseRecoveryKey } from '../errors-SGwgtvtF.cjs';
|
|
3
3
|
import { AccountInterface, Call, ProviderInterface, TypedData, constants, BigNumberish, DeployAccountContractPayload, Account } from 'starknet';
|
|
4
4
|
import { V as VenueAdapter, O as OrderRef, A as AdapterTxResult, R as RegisterOrderParams, j as VenueSigner } from '../types-CuSlc_YE.cjs';
|
|
5
5
|
import 'zod';
|
|
@@ -8059,11 +8059,14 @@ declare function describeRecoveryAction(escape: EscapeInfo): RecoveryAction;
|
|
|
8059
8059
|
|
|
8060
8060
|
declare function normalizeWalletAddress(address: string): string;
|
|
8061
8061
|
declare function isValidStarknetAddress(address: string): boolean;
|
|
8062
|
+
/** Whether a contract is deployed at the address. Throws when the read itself fails, so a failed read is never "not deployed". */
|
|
8062
8063
|
declare function isDeployed(provider: ReceiptProviderLike, address: string): Promise<boolean>;
|
|
8063
8064
|
|
|
8064
8065
|
interface SelfFundFeeEstimate {
|
|
8065
8066
|
feeRaw: bigint;
|
|
8066
8067
|
unit: string;
|
|
8068
|
+
/** The wallet's balance of the fee token; `null` when it could not be read. */
|
|
8069
|
+
balanceRaw: bigint | null;
|
|
8067
8070
|
}
|
|
8068
8071
|
type SelfFundConsentHandler = (feeEstimate: Promise<SelfFundFeeEstimate | null>) => Promise<boolean>;
|
|
8069
8072
|
interface SelfFundConsent {
|
package/dist/starknet/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { bG as ResolvedConfig, bO as TxResult, a$ as CreatePopCollectionParams, aM as ClaimConditions, aX as CreateDropParams, b4 as CreateTicketParams, bq as MintTicketsParams, aZ as CreateMembershipParams, bp as MintMembershipsParams, b2 as CreateSponsorshipOfferParams, bD as ProposeSponsorshipParams, k as ApiClient, bn as MedialaneConfig, bo as MedialaneErrorCode, bv as OrderDetails, R as ResolvedFeeConfig, I as ApiFundingIntent, H as ApiFundingInstructions, L as ApiFundingSubmit, N as ApiIntentCreated, bW as SealedOwner, bX as ReceiptProviderLike, bY as WalletExecutor, bZ as ExecutedTransaction, b_ as PasskeyOwner, b$ as CreatedOwner } from '../errors-
|
|
2
|
-
export { c0 as InvalidRecoveryKeyError, c1 as OwnerSigner, by as PasskeyCancelledError, c2 as PasskeyConfig, c3 as RecoveryKey, bQ as UserFacingError, c4 as createPasskeyOwner, c5 as encodeRecoveryKey, c6 as parseRecoveryKey } from '../errors-
|
|
1
|
+
import { bG as ResolvedConfig, bO as TxResult, a$ as CreatePopCollectionParams, aM as ClaimConditions, aX as CreateDropParams, b4 as CreateTicketParams, bq as MintTicketsParams, aZ as CreateMembershipParams, bp as MintMembershipsParams, b2 as CreateSponsorshipOfferParams, bD as ProposeSponsorshipParams, k as ApiClient, bn as MedialaneConfig, bo as MedialaneErrorCode, bv as OrderDetails, R as ResolvedFeeConfig, I as ApiFundingIntent, H as ApiFundingInstructions, L as ApiFundingSubmit, N as ApiIntentCreated, bW as SealedOwner, bX as ReceiptProviderLike, bY as WalletExecutor, bZ as ExecutedTransaction, b_ as PasskeyOwner, b$ as CreatedOwner } from '../errors-DUiebYFo.js';
|
|
2
|
+
export { c0 as InvalidRecoveryKeyError, c1 as OwnerSigner, by as PasskeyCancelledError, c2 as PasskeyConfig, c3 as RecoveryKey, bQ as UserFacingError, c4 as createPasskeyOwner, c5 as encodeRecoveryKey, c6 as parseRecoveryKey } from '../errors-DUiebYFo.js';
|
|
3
3
|
import { AccountInterface, Call, ProviderInterface, TypedData, constants, BigNumberish, DeployAccountContractPayload, Account } from 'starknet';
|
|
4
4
|
import { V as VenueAdapter, O as OrderRef, A as AdapterTxResult, R as RegisterOrderParams, j as VenueSigner } from '../types-CuSlc_YE.js';
|
|
5
5
|
import 'zod';
|
|
@@ -8059,11 +8059,14 @@ declare function describeRecoveryAction(escape: EscapeInfo): RecoveryAction;
|
|
|
8059
8059
|
|
|
8060
8060
|
declare function normalizeWalletAddress(address: string): string;
|
|
8061
8061
|
declare function isValidStarknetAddress(address: string): boolean;
|
|
8062
|
+
/** Whether a contract is deployed at the address. Throws when the read itself fails, so a failed read is never "not deployed". */
|
|
8062
8063
|
declare function isDeployed(provider: ReceiptProviderLike, address: string): Promise<boolean>;
|
|
8063
8064
|
|
|
8064
8065
|
interface SelfFundFeeEstimate {
|
|
8065
8066
|
feeRaw: bigint;
|
|
8066
8067
|
unit: string;
|
|
8068
|
+
/** The wallet's balance of the fee token; `null` when it could not be read. */
|
|
8069
|
+
balanceRaw: bigint | null;
|
|
8067
8070
|
}
|
|
8068
8071
|
type SelfFundConsentHandler = (feeEstimate: Promise<SelfFundFeeEstimate | null>) => Promise<boolean>;
|
|
8069
8072
|
interface SelfFundConsent {
|
package/dist/starknet/index.js
CHANGED
|
@@ -644,7 +644,7 @@ var ApiClient = class {
|
|
|
644
644
|
registerBusinessProvisioning(params) {
|
|
645
645
|
return this.post(
|
|
646
646
|
"/v1/business/provisioning",
|
|
647
|
-
{ chain: params.chain ?? "STARKNET",
|
|
647
|
+
{ chain: params.chain ?? "STARKNET", email: params.email }
|
|
648
648
|
);
|
|
649
649
|
}
|
|
650
650
|
getCollectionProfile(contractAddress) {
|
|
@@ -12463,7 +12463,7 @@ function ownerAliveCalldata(proof) {
|
|
|
12463
12463
|
function buildChangeOwnersCall(accountAddress, removeOwnerPubkey, addOwnerPubkey, ownerAlive) {
|
|
12464
12464
|
if (!ownerAlive) {
|
|
12465
12465
|
throw new Error(
|
|
12466
|
-
"
|
|
12466
|
+
"Replacing the signing owner requires an owner-alive proof from the new owner. Sign ownerAliveTypedData with the new owner key and pass it here."
|
|
12467
12467
|
);
|
|
12468
12468
|
}
|
|
12469
12469
|
return changeOwners(
|
|
@@ -12775,12 +12775,14 @@ function isValidStarknetAddress(address) {
|
|
|
12775
12775
|
return false;
|
|
12776
12776
|
}
|
|
12777
12777
|
}
|
|
12778
|
+
var CONTRACT_NOT_FOUND = 20;
|
|
12778
12779
|
async function isDeployed(provider, address) {
|
|
12779
12780
|
try {
|
|
12780
12781
|
await provider.getClassHashAt(normalizeWalletAddress(address));
|
|
12781
12782
|
return true;
|
|
12782
|
-
} catch {
|
|
12783
|
-
return false;
|
|
12783
|
+
} catch (err) {
|
|
12784
|
+
if (err?.code === CONTRACT_NOT_FOUND) return false;
|
|
12785
|
+
throw err;
|
|
12784
12786
|
}
|
|
12785
12787
|
}
|
|
12786
12788
|
|
|
@@ -12933,13 +12935,33 @@ function createPasskeyOwner(config) {
|
|
|
12933
12935
|
}
|
|
12934
12936
|
};
|
|
12935
12937
|
}
|
|
12938
|
+
|
|
12939
|
+
// src/utils/token.ts
|
|
12940
|
+
function getTokenBySymbol(symbol) {
|
|
12941
|
+
if (typeof symbol !== "string") return void 0;
|
|
12942
|
+
const upper = symbol.toUpperCase();
|
|
12943
|
+
return SUPPORTED_TOKENS.find((t) => t.symbol === upper);
|
|
12944
|
+
}
|
|
12945
|
+
|
|
12946
|
+
// src/wallet/executors.ts
|
|
12936
12947
|
function accountFor(provider, address, privateKeyHex) {
|
|
12937
12948
|
return new Account({ provider, address, signer: privateKeyHex, cairoVersion: "1" });
|
|
12938
12949
|
}
|
|
12939
12950
|
async function estimateSelfFundedFee(provider, address, calls) {
|
|
12940
12951
|
const account = new Account({ provider, address, signer: "0x1", cairoVersion: "1" });
|
|
12941
12952
|
const estimate = await account.estimateInvokeFee(calls);
|
|
12942
|
-
|
|
12953
|
+
const balanceRaw = await feeTokenBalance(provider, address, estimate.unit).catch(() => null);
|
|
12954
|
+
return { feeRaw: estimate.overall_fee, unit: estimate.unit, balanceRaw };
|
|
12955
|
+
}
|
|
12956
|
+
async function feeTokenBalance(provider, address, unit) {
|
|
12957
|
+
const token = getTokenBySymbol(unit === "FRI" ? "STRK" : "ETH");
|
|
12958
|
+
if (!token) throw new Error(`No fee token for unit ${unit}`);
|
|
12959
|
+
const [low = "0x0", high = "0x0"] = await provider.callContract({
|
|
12960
|
+
contractAddress: token.address,
|
|
12961
|
+
entrypoint: "balance_of",
|
|
12962
|
+
calldata: [address]
|
|
12963
|
+
});
|
|
12964
|
+
return BigInt(low) + (BigInt(high) << 128n);
|
|
12943
12965
|
}
|
|
12944
12966
|
function selfFundedExecutor(deps) {
|
|
12945
12967
|
return {
|
|
@@ -13029,7 +13051,7 @@ async function waitUntilDeployed(provider, address, timeoutMs = 9e4, sleep2 = (m
|
|
|
13029
13051
|
const deadline = Date.now() + timeoutMs;
|
|
13030
13052
|
let wait = 1e3;
|
|
13031
13053
|
for (; ; ) {
|
|
13032
|
-
if (await isDeployed(provider, address)) return;
|
|
13054
|
+
if (await isDeployed(provider, address).catch(() => false)) return;
|
|
13033
13055
|
if (Date.now() >= deadline) {
|
|
13034
13056
|
throw new Error(
|
|
13035
13057
|
"Your wallet was submitted but has not appeared on Starknet yet. Please try again in a moment."
|