@volr/react 0.1.3 → 0.1.5

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/index.cjs CHANGED
@@ -354,6 +354,10 @@ var SessionSync = class {
354
354
  var DEFAULT_API_BASE_URL = "https://api.volr.io";
355
355
  function resolveApiBaseUrl(config) {
356
356
  const anyConfig = config;
357
+ const devOverride = anyConfig.__devApiBaseUrl;
358
+ if (devOverride && typeof devOverride === "string") {
359
+ return devOverride.replace(/\/+$/, "");
360
+ }
357
361
  const override = anyConfig.apiBaseUrl;
358
362
  if (override && typeof override === "string") {
359
363
  return override.replace(/\/+$/, "");
@@ -1645,26 +1649,29 @@ async function sendCalls(args) {
1645
1649
  let currentUser = deps.user;
1646
1650
  if (deps.user?.keyStorageType === "passkey" && !deps.provider) {
1647
1651
  try {
1648
- const refreshResponse = await deps.client.post("/auth/refresh", {});
1652
+ const refreshResponse = await deps.client.post(
1653
+ "/auth/refresh",
1654
+ {}
1655
+ );
1649
1656
  if (refreshResponse.user) {
1650
1657
  currentUser = refreshResponse.user;
1651
1658
  }
1652
1659
  } catch (error) {
1653
- console.warn("[sendCalls] Failed to refresh user data before transaction:", error);
1660
+ console.warn(
1661
+ "[sendCalls] Failed to refresh user data before transaction:",
1662
+ error
1663
+ );
1654
1664
  }
1655
1665
  }
1656
1666
  if (opts.preflight !== false) {
1657
1667
  const tolerateFundingErrors = (opts.mode ?? "sponsored") !== "self";
1658
- await preflightEstimate(deps.publicClient, normalizedFrom, normalizedCalls, { tolerateFundingErrors });
1668
+ await preflightEstimate(
1669
+ deps.publicClient,
1670
+ normalizedFrom,
1671
+ normalizedCalls,
1672
+ { tolerateFundingErrors }
1673
+ );
1659
1674
  }
1660
- const { signer, activeProvider } = await resolveSigner({
1661
- explicitSigner: opts.signer,
1662
- provider: deps.provider,
1663
- chainId,
1664
- client: deps.client,
1665
- user: currentUser,
1666
- setProvider: deps.setProvider
1667
- });
1668
1675
  let projectPolicyId;
1669
1676
  if (!effectivePolicyId) {
1670
1677
  const tempAuthForPrecheck = buildTempAuth({
@@ -1676,9 +1683,12 @@ async function sendCalls(args) {
1676
1683
  });
1677
1684
  let precheckQuote;
1678
1685
  try {
1679
- precheckQuote = await deps.precheck({ auth: tempAuthForPrecheck, calls: normalizedCalls });
1686
+ precheckQuote = await deps.precheck({
1687
+ auth: tempAuthForPrecheck,
1688
+ calls: normalizedCalls
1689
+ });
1680
1690
  } catch (err) {
1681
- throw new Error(`Precheck failed: ${err instanceof Error ? err.message : String(err)}`);
1691
+ throw err instanceof Error ? err : new Error(String(err));
1682
1692
  }
1683
1693
  const quotePolicyId = precheckQuote.policyId;
1684
1694
  if (!quotePolicyId) {
@@ -1703,13 +1713,27 @@ async function sendCalls(args) {
1703
1713
  }
1704
1714
  const auth = finalizeAuthWithNonce(tempAuth, quote);
1705
1715
  const idempotencyKey = opts.idempotencyKey ?? defaultIdempotencyKey();
1716
+ let signer;
1717
+ let activeProvider = null;
1706
1718
  try {
1719
+ const resolved = await resolveSigner({
1720
+ explicitSigner: opts.signer,
1721
+ provider: deps.provider,
1722
+ chainId,
1723
+ client: deps.client,
1724
+ user: currentUser,
1725
+ setProvider: deps.setProvider
1726
+ });
1727
+ signer = resolved.signer;
1728
+ activeProvider = resolved.activeProvider;
1707
1729
  const result = await deps.relay(
1708
1730
  { chainId, from: normalizedFrom, auth, calls: normalizedCalls },
1709
1731
  { signer, rpcClient: deps.rpcClient, idempotencyKey }
1710
1732
  );
1711
1733
  if (result.status === "QUEUED" || result.status === "PENDING") {
1712
- console.log(`[useVolrWallet] Transaction ${result.txId} is ${result.status}, starting polling...`);
1734
+ console.log(
1735
+ `[useVolrWallet] Transaction ${result.txId} is ${result.status}, starting polling...`
1736
+ );
1713
1737
  return await pollTransactionStatus(result.txId, deps.client);
1714
1738
  }
1715
1739
  return result;