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