@pafi-dev/issuer 0.5.27 → 0.5.28
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 +45 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2069,6 +2069,51 @@ var PafiBackendClient = class {
|
|
|
2069
2069
|
}
|
|
2070
2070
|
throw lastError;
|
|
2071
2071
|
}
|
|
2072
|
+
/**
|
|
2073
|
+
* Fetch ERC-4337 UserOp receipt via PAFI's authenticated bundler proxy.
|
|
2074
|
+
* Returns `null` when the bundler hasn't seen the userOp yet — caller
|
|
2075
|
+
* should keep polling. Used by status endpoints to short-circuit the
|
|
2076
|
+
* on-chain indexer when several PENDING locks share the same amount.
|
|
2077
|
+
*/
|
|
2078
|
+
async getUserOpReceipt(userOpHash) {
|
|
2079
|
+
const fetchFn = this.config.fetchImpl ?? fetch;
|
|
2080
|
+
const url = `${this.config.url}/bundler/receipt`;
|
|
2081
|
+
let response;
|
|
2082
|
+
try {
|
|
2083
|
+
response = await fetchFn(url, {
|
|
2084
|
+
method: "POST",
|
|
2085
|
+
headers: {
|
|
2086
|
+
"Content-Type": "application/json",
|
|
2087
|
+
Authorization: `Bearer ${this.config.apiKey}`,
|
|
2088
|
+
"X-Issuer-Id": this.config.issuerId
|
|
2089
|
+
},
|
|
2090
|
+
body: JSON.stringify({ userOpHash })
|
|
2091
|
+
});
|
|
2092
|
+
} catch (err) {
|
|
2093
|
+
throw new PafiBackendError(
|
|
2094
|
+
"NETWORK_ERROR",
|
|
2095
|
+
`Network error: ${err instanceof Error ? err.message : String(err)}`,
|
|
2096
|
+
0
|
|
2097
|
+
);
|
|
2098
|
+
}
|
|
2099
|
+
const text = await response.text();
|
|
2100
|
+
let json = {};
|
|
2101
|
+
try {
|
|
2102
|
+
json = JSON.parse(text);
|
|
2103
|
+
} catch {
|
|
2104
|
+
}
|
|
2105
|
+
if (!response.ok) {
|
|
2106
|
+
const code = json.code ?? "INTERNAL_ERROR";
|
|
2107
|
+
const message = json.message ?? `HTTP ${response.status}`;
|
|
2108
|
+
throw new PafiBackendError(code, message, response.status, json);
|
|
2109
|
+
}
|
|
2110
|
+
if (json.pending) return null;
|
|
2111
|
+
return {
|
|
2112
|
+
success: json.success,
|
|
2113
|
+
txHash: json.txHash,
|
|
2114
|
+
blockNumber: json.blockNumber
|
|
2115
|
+
};
|
|
2116
|
+
}
|
|
2072
2117
|
async relayUserOperation(request) {
|
|
2073
2118
|
const fetchFn = this.config.fetchImpl ?? fetch;
|
|
2074
2119
|
const url = `${this.config.url}/bundler/relay`;
|