@pafi-dev/issuer 0.5.27 → 0.5.29

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.d.cts CHANGED
@@ -1570,6 +1570,17 @@ declare class PafiBackendClient {
1570
1570
  private readonly config;
1571
1571
  constructor(config: PafiBackendConfig);
1572
1572
  requestSponsorship(request: SponsorshipRequest): Promise<SponsorshipResponse>;
1573
+ /**
1574
+ * Fetch ERC-4337 UserOp receipt via PAFI's authenticated bundler proxy.
1575
+ * Returns `null` when the bundler hasn't seen the userOp yet — caller
1576
+ * should keep polling. Used by status endpoints to short-circuit the
1577
+ * on-chain indexer when several PENDING locks share the same amount.
1578
+ */
1579
+ getUserOpReceipt(userOpHash: Hex): Promise<{
1580
+ success: boolean;
1581
+ txHash: Hex;
1582
+ blockNumber: string;
1583
+ } | null>;
1573
1584
  relayUserOperation(request: RelayUserOpRequest): Promise<RelayUserOpResponse>;
1574
1585
  private _doRequest;
1575
1586
  }
package/dist/index.d.ts CHANGED
@@ -1570,6 +1570,17 @@ declare class PafiBackendClient {
1570
1570
  private readonly config;
1571
1571
  constructor(config: PafiBackendConfig);
1572
1572
  requestSponsorship(request: SponsorshipRequest): Promise<SponsorshipResponse>;
1573
+ /**
1574
+ * Fetch ERC-4337 UserOp receipt via PAFI's authenticated bundler proxy.
1575
+ * Returns `null` when the bundler hasn't seen the userOp yet — caller
1576
+ * should keep polling. Used by status endpoints to short-circuit the
1577
+ * on-chain indexer when several PENDING locks share the same amount.
1578
+ */
1579
+ getUserOpReceipt(userOpHash: Hex): Promise<{
1580
+ success: boolean;
1581
+ txHash: Hex;
1582
+ blockNumber: string;
1583
+ } | null>;
1573
1584
  relayUserOperation(request: RelayUserOpRequest): Promise<RelayUserOpResponse>;
1574
1585
  private _doRequest;
1575
1586
  }
package/dist/index.js CHANGED
@@ -2028,6 +2028,51 @@ var PafiBackendClient = class {
2028
2028
  }
2029
2029
  throw lastError;
2030
2030
  }
2031
+ /**
2032
+ * Fetch ERC-4337 UserOp receipt via PAFI's authenticated bundler proxy.
2033
+ * Returns `null` when the bundler hasn't seen the userOp yet — caller
2034
+ * should keep polling. Used by status endpoints to short-circuit the
2035
+ * on-chain indexer when several PENDING locks share the same amount.
2036
+ */
2037
+ async getUserOpReceipt(userOpHash) {
2038
+ const fetchFn = this.config.fetchImpl ?? fetch;
2039
+ const url = `${this.config.url}/bundler/receipt`;
2040
+ let response;
2041
+ try {
2042
+ response = await fetchFn(url, {
2043
+ method: "POST",
2044
+ headers: {
2045
+ "Content-Type": "application/json",
2046
+ Authorization: `Bearer ${this.config.apiKey}`,
2047
+ "X-Issuer-Id": this.config.issuerId
2048
+ },
2049
+ body: JSON.stringify({ userOpHash })
2050
+ });
2051
+ } catch (err) {
2052
+ throw new PafiBackendError(
2053
+ "NETWORK_ERROR",
2054
+ `Network error: ${err instanceof Error ? err.message : String(err)}`,
2055
+ 0
2056
+ );
2057
+ }
2058
+ const text = await response.text();
2059
+ let json = {};
2060
+ try {
2061
+ json = JSON.parse(text);
2062
+ } catch {
2063
+ }
2064
+ if (!response.ok) {
2065
+ const code = json.code ?? "INTERNAL_ERROR";
2066
+ const message = json.message ?? `HTTP ${response.status}`;
2067
+ throw new PafiBackendError(code, message, response.status, json);
2068
+ }
2069
+ if (json.pending) return null;
2070
+ return {
2071
+ success: json.success,
2072
+ txHash: json.txHash,
2073
+ blockNumber: json.blockNumber
2074
+ };
2075
+ }
2031
2076
  async relayUserOperation(request) {
2032
2077
  const fetchFn = this.config.fetchImpl ?? fetch;
2033
2078
  const url = `${this.config.url}/bundler/relay`;