@volr/react 0.1.4 → 0.1.6
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 +34 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +34 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1649,26 +1649,29 @@ async function sendCalls(args) {
|
|
|
1649
1649
|
let currentUser = deps.user;
|
|
1650
1650
|
if (deps.user?.keyStorageType === "passkey" && !deps.provider) {
|
|
1651
1651
|
try {
|
|
1652
|
-
const refreshResponse = await deps.client.post(
|
|
1652
|
+
const refreshResponse = await deps.client.post(
|
|
1653
|
+
"/auth/refresh",
|
|
1654
|
+
{}
|
|
1655
|
+
);
|
|
1653
1656
|
if (refreshResponse.user) {
|
|
1654
1657
|
currentUser = refreshResponse.user;
|
|
1655
1658
|
}
|
|
1656
1659
|
} catch (error) {
|
|
1657
|
-
console.warn(
|
|
1660
|
+
console.warn(
|
|
1661
|
+
"[sendCalls] Failed to refresh user data before transaction:",
|
|
1662
|
+
error
|
|
1663
|
+
);
|
|
1658
1664
|
}
|
|
1659
1665
|
}
|
|
1660
1666
|
if (opts.preflight !== false) {
|
|
1661
1667
|
const tolerateFundingErrors = (opts.mode ?? "sponsored") !== "self";
|
|
1662
|
-
await preflightEstimate(
|
|
1668
|
+
await preflightEstimate(
|
|
1669
|
+
deps.publicClient,
|
|
1670
|
+
normalizedFrom,
|
|
1671
|
+
normalizedCalls,
|
|
1672
|
+
{ tolerateFundingErrors }
|
|
1673
|
+
);
|
|
1663
1674
|
}
|
|
1664
|
-
const { signer, activeProvider } = await resolveSigner({
|
|
1665
|
-
explicitSigner: opts.signer,
|
|
1666
|
-
provider: deps.provider,
|
|
1667
|
-
chainId,
|
|
1668
|
-
client: deps.client,
|
|
1669
|
-
user: currentUser,
|
|
1670
|
-
setProvider: deps.setProvider
|
|
1671
|
-
});
|
|
1672
1675
|
let projectPolicyId;
|
|
1673
1676
|
if (!effectivePolicyId) {
|
|
1674
1677
|
const tempAuthForPrecheck = buildTempAuth({
|
|
@@ -1680,9 +1683,12 @@ async function sendCalls(args) {
|
|
|
1680
1683
|
});
|
|
1681
1684
|
let precheckQuote;
|
|
1682
1685
|
try {
|
|
1683
|
-
precheckQuote = await deps.precheck({
|
|
1686
|
+
precheckQuote = await deps.precheck({
|
|
1687
|
+
auth: tempAuthForPrecheck,
|
|
1688
|
+
calls: normalizedCalls
|
|
1689
|
+
});
|
|
1684
1690
|
} catch (err) {
|
|
1685
|
-
throw
|
|
1691
|
+
throw err instanceof Error ? err : new Error(String(err));
|
|
1686
1692
|
}
|
|
1687
1693
|
const quotePolicyId = precheckQuote.policyId;
|
|
1688
1694
|
if (!quotePolicyId) {
|
|
@@ -1707,13 +1713,27 @@ async function sendCalls(args) {
|
|
|
1707
1713
|
}
|
|
1708
1714
|
const auth = finalizeAuthWithNonce(tempAuth, quote);
|
|
1709
1715
|
const idempotencyKey = opts.idempotencyKey ?? defaultIdempotencyKey();
|
|
1716
|
+
let signer;
|
|
1717
|
+
let activeProvider = null;
|
|
1710
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;
|
|
1711
1729
|
const result = await deps.relay(
|
|
1712
1730
|
{ chainId, from: normalizedFrom, auth, calls: normalizedCalls },
|
|
1713
1731
|
{ signer, rpcClient: deps.rpcClient, idempotencyKey }
|
|
1714
1732
|
);
|
|
1715
1733
|
if (result.status === "QUEUED" || result.status === "PENDING") {
|
|
1716
|
-
console.log(
|
|
1734
|
+
console.log(
|
|
1735
|
+
`[useVolrWallet] Transaction ${result.txId} is ${result.status}, starting polling...`
|
|
1736
|
+
);
|
|
1717
1737
|
return await pollTransactionStatus(result.txId, deps.client);
|
|
1718
1738
|
}
|
|
1719
1739
|
return result;
|