@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.
@@ -646,7 +646,7 @@ var ApiClient = class {
646
646
  registerBusinessProvisioning(params) {
647
647
  return this.post(
648
648
  "/v1/business/provisioning",
649
- { chain: params.chain ?? "STARKNET", recipientScheme: params.recipientScheme, recipientValue: params.recipientValue }
649
+ { chain: params.chain ?? "STARKNET", email: params.email }
650
650
  );
651
651
  }
652
652
  getCollectionProfile(contractAddress) {
@@ -12465,7 +12465,7 @@ function ownerAliveCalldata(proof) {
12465
12465
  function buildChangeOwnersCall(accountAddress, removeOwnerPubkey, addOwnerPubkey, ownerAlive) {
12466
12466
  if (!ownerAlive) {
12467
12467
  throw new Error(
12468
- "Handing an account over removes the signing owner, so the account requires an owner-alive proof from the incoming owner. Sign ownerAliveTypedData with the new owner key and pass it here."
12468
+ "Replacing the signing owner requires an owner-alive proof from the new owner. Sign ownerAliveTypedData with the new owner key and pass it here."
12469
12469
  );
12470
12470
  }
12471
12471
  return changeOwners(
@@ -12777,12 +12777,14 @@ function isValidStarknetAddress(address) {
12777
12777
  return false;
12778
12778
  }
12779
12779
  }
12780
+ var CONTRACT_NOT_FOUND = 20;
12780
12781
  async function isDeployed(provider, address) {
12781
12782
  try {
12782
12783
  await provider.getClassHashAt(normalizeWalletAddress(address));
12783
12784
  return true;
12784
- } catch {
12785
- return false;
12785
+ } catch (err) {
12786
+ if (err?.code === CONTRACT_NOT_FOUND) return false;
12787
+ throw err;
12786
12788
  }
12787
12789
  }
12788
12790
 
@@ -12935,13 +12937,33 @@ function createPasskeyOwner(config) {
12935
12937
  }
12936
12938
  };
12937
12939
  }
12940
+
12941
+ // src/utils/token.ts
12942
+ function getTokenBySymbol(symbol) {
12943
+ if (typeof symbol !== "string") return void 0;
12944
+ const upper = symbol.toUpperCase();
12945
+ return SUPPORTED_TOKENS.find((t) => t.symbol === upper);
12946
+ }
12947
+
12948
+ // src/wallet/executors.ts
12938
12949
  function accountFor(provider, address, privateKeyHex) {
12939
12950
  return new starknet.Account({ provider, address, signer: privateKeyHex, cairoVersion: "1" });
12940
12951
  }
12941
12952
  async function estimateSelfFundedFee(provider, address, calls) {
12942
12953
  const account = new starknet.Account({ provider, address, signer: "0x1", cairoVersion: "1" });
12943
12954
  const estimate = await account.estimateInvokeFee(calls);
12944
- return { feeRaw: estimate.overall_fee, unit: estimate.unit };
12955
+ const balanceRaw = await feeTokenBalance(provider, address, estimate.unit).catch(() => null);
12956
+ return { feeRaw: estimate.overall_fee, unit: estimate.unit, balanceRaw };
12957
+ }
12958
+ async function feeTokenBalance(provider, address, unit) {
12959
+ const token = getTokenBySymbol(unit === "FRI" ? "STRK" : "ETH");
12960
+ if (!token) throw new Error(`No fee token for unit ${unit}`);
12961
+ const [low = "0x0", high = "0x0"] = await provider.callContract({
12962
+ contractAddress: token.address,
12963
+ entrypoint: "balance_of",
12964
+ calldata: [address]
12965
+ });
12966
+ return BigInt(low) + (BigInt(high) << 128n);
12945
12967
  }
12946
12968
  function selfFundedExecutor(deps) {
12947
12969
  return {
@@ -13031,7 +13053,7 @@ async function waitUntilDeployed(provider, address, timeoutMs = 9e4, sleep2 = (m
13031
13053
  const deadline = Date.now() + timeoutMs;
13032
13054
  let wait = 1e3;
13033
13055
  for (; ; ) {
13034
- if (await isDeployed(provider, address)) return;
13056
+ if (await isDeployed(provider, address).catch(() => false)) return;
13035
13057
  if (Date.now() >= deadline) {
13036
13058
  throw new Error(
13037
13059
  "Your wallet was submitted but has not appeared on Starknet yet. Please try again in a moment."