@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.js
CHANGED
|
@@ -1644,26 +1644,29 @@ async function sendCalls(args) {
|
|
|
1644
1644
|
let currentUser = deps.user;
|
|
1645
1645
|
if (deps.user?.keyStorageType === "passkey" && !deps.provider) {
|
|
1646
1646
|
try {
|
|
1647
|
-
const refreshResponse = await deps.client.post(
|
|
1647
|
+
const refreshResponse = await deps.client.post(
|
|
1648
|
+
"/auth/refresh",
|
|
1649
|
+
{}
|
|
1650
|
+
);
|
|
1648
1651
|
if (refreshResponse.user) {
|
|
1649
1652
|
currentUser = refreshResponse.user;
|
|
1650
1653
|
}
|
|
1651
1654
|
} catch (error) {
|
|
1652
|
-
console.warn(
|
|
1655
|
+
console.warn(
|
|
1656
|
+
"[sendCalls] Failed to refresh user data before transaction:",
|
|
1657
|
+
error
|
|
1658
|
+
);
|
|
1653
1659
|
}
|
|
1654
1660
|
}
|
|
1655
1661
|
if (opts.preflight !== false) {
|
|
1656
1662
|
const tolerateFundingErrors = (opts.mode ?? "sponsored") !== "self";
|
|
1657
|
-
await preflightEstimate(
|
|
1663
|
+
await preflightEstimate(
|
|
1664
|
+
deps.publicClient,
|
|
1665
|
+
normalizedFrom,
|
|
1666
|
+
normalizedCalls,
|
|
1667
|
+
{ tolerateFundingErrors }
|
|
1668
|
+
);
|
|
1658
1669
|
}
|
|
1659
|
-
const { signer, activeProvider } = await resolveSigner({
|
|
1660
|
-
explicitSigner: opts.signer,
|
|
1661
|
-
provider: deps.provider,
|
|
1662
|
-
chainId,
|
|
1663
|
-
client: deps.client,
|
|
1664
|
-
user: currentUser,
|
|
1665
|
-
setProvider: deps.setProvider
|
|
1666
|
-
});
|
|
1667
1670
|
let projectPolicyId;
|
|
1668
1671
|
if (!effectivePolicyId) {
|
|
1669
1672
|
const tempAuthForPrecheck = buildTempAuth({
|
|
@@ -1675,9 +1678,12 @@ async function sendCalls(args) {
|
|
|
1675
1678
|
});
|
|
1676
1679
|
let precheckQuote;
|
|
1677
1680
|
try {
|
|
1678
|
-
precheckQuote = await deps.precheck({
|
|
1681
|
+
precheckQuote = await deps.precheck({
|
|
1682
|
+
auth: tempAuthForPrecheck,
|
|
1683
|
+
calls: normalizedCalls
|
|
1684
|
+
});
|
|
1679
1685
|
} catch (err) {
|
|
1680
|
-
throw
|
|
1686
|
+
throw err instanceof Error ? err : new Error(String(err));
|
|
1681
1687
|
}
|
|
1682
1688
|
const quotePolicyId = precheckQuote.policyId;
|
|
1683
1689
|
if (!quotePolicyId) {
|
|
@@ -1702,13 +1708,27 @@ async function sendCalls(args) {
|
|
|
1702
1708
|
}
|
|
1703
1709
|
const auth = finalizeAuthWithNonce(tempAuth, quote);
|
|
1704
1710
|
const idempotencyKey = opts.idempotencyKey ?? defaultIdempotencyKey();
|
|
1711
|
+
let signer;
|
|
1712
|
+
let activeProvider = null;
|
|
1705
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;
|
|
1706
1724
|
const result = await deps.relay(
|
|
1707
1725
|
{ chainId, from: normalizedFrom, auth, calls: normalizedCalls },
|
|
1708
1726
|
{ signer, rpcClient: deps.rpcClient, idempotencyKey }
|
|
1709
1727
|
);
|
|
1710
1728
|
if (result.status === "QUEUED" || result.status === "PENDING") {
|
|
1711
|
-
console.log(
|
|
1729
|
+
console.log(
|
|
1730
|
+
`[useVolrWallet] Transaction ${result.txId} is ${result.status}, starting polling...`
|
|
1731
|
+
);
|
|
1712
1732
|
return await pollTransactionStatus(result.txId, deps.client);
|
|
1713
1733
|
}
|
|
1714
1734
|
return result;
|