@medialane/sdk 0.122.0 → 0.123.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.
@@ -951,9 +951,6 @@ var MedialaneError = class extends Error {
951
951
  };
952
952
 
953
953
  // src/utils/rpc.ts
954
- var PUBLIC_RPC_FALLBACKS = [
955
- "https://rpc.starknet.lava.build"
956
- ];
957
954
  var TRANSIENT_BODY_RE = /"code"\s*:\s*-32001|"code"\s*:\s*-32603|unable to complete|rate.?limit|too many|throttl|exceed.*quota|temporarily unavailable|service unavailable|overload|gateway.*time|upstream.*time|backend.*error/i;
958
955
  var POLICY_REFUSAL_CODES = [-32003, -32005, -32600];
959
956
  function isPolicyRefusal(input) {
@@ -1045,7 +1042,7 @@ var _providerCache = /* @__PURE__ */ new WeakMap();
1045
1042
  function getProvider(config) {
1046
1043
  let p = _providerCache.get(config);
1047
1044
  if (!p) {
1048
- const urls = Array.from(/* @__PURE__ */ new Set([config.rpcUrl, ...PUBLIC_RPC_FALLBACKS]));
1045
+ const urls = [config.rpcUrl];
1049
1046
  p = new starknet.RpcProvider({ nodeUrl: urls[0], baseFetch: createFailoverFetch(urls) });
1050
1047
  _providerCache.set(config, p);
1051
1048
  }
@@ -12707,6 +12704,20 @@ async function deploySelfFunded(input) {
12707
12704
  });
12708
12705
  return { transactionHash: transaction_hash };
12709
12706
  }
12707
+ async function waitUntilDeployed(provider, address, timeoutMs = 9e4, sleep2 = (ms) => new Promise((resolve) => setTimeout(resolve, ms))) {
12708
+ const deadline = Date.now() + timeoutMs;
12709
+ let wait = 1e3;
12710
+ for (; ; ) {
12711
+ if (await isDeployed(provider, address)) return;
12712
+ if (Date.now() >= deadline) {
12713
+ throw new Error(
12714
+ "Your wallet was submitted but has not appeared on Starknet yet. Please try again in a moment."
12715
+ );
12716
+ }
12717
+ await sleep2(wait);
12718
+ wait = Math.min(Math.round(wait * 1.5), 5e3);
12719
+ }
12720
+ }
12710
12721
  async function completeDeployment(deps, onStep, options = {}) {
12711
12722
  let sealed = options.forceNew ? null : deps.store.load();
12712
12723
  let privateKeyHex;
@@ -12743,6 +12754,7 @@ async function completeDeployment(deps, onStep, options = {}) {
12743
12754
  } else {
12744
12755
  await selfFunded({ provider: deps.provider(), ...wallet });
12745
12756
  }
12757
+ await (deps.waitUntilDeployedImpl ?? waitUntilDeployed)(deps.provider(), sealed.address);
12746
12758
  onStep("signing-in");
12747
12759
  const address = sealed.address;
12748
12760
  const siwsToken = await (deps.requestSiwsTokenImpl ?? requestSiwsToken)({
@@ -13006,5 +13018,6 @@ exports.validateCoinSupply = validateSupply;
13006
13018
  exports.validateCoinSymbol = validateSymbol;
13007
13019
  exports.validatePrice = validatePrice;
13008
13020
  exports.verifyAdminRequestSig = verifyAdminRequestSig;
13021
+ exports.waitUntilDeployed = waitUntilDeployed;
13009
13022
  //# sourceMappingURL=index.cjs.map
13010
13023
  //# sourceMappingURL=index.cjs.map