@faremeter/payment-evm 0.11.0 → 0.12.0
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/src/exact/client.js
CHANGED
|
@@ -11,7 +11,7 @@ export function createPaymentHandler(wallet, opts = {}) {
|
|
|
11
11
|
throw new Error(`Couldn't look up USDC information on network '${x402Network}'`);
|
|
12
12
|
}
|
|
13
13
|
const { isMatchingRequirement } = generateMatcher(x402Network, assetInfo.address);
|
|
14
|
-
return async function handlePayment(
|
|
14
|
+
return async function handlePayment(_context, accepts) {
|
|
15
15
|
const compatibleRequirements = accepts.filter(isMatchingRequirement);
|
|
16
16
|
return compatibleRequirements.map((requirements) => ({
|
|
17
17
|
requirements,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facilitator.d.ts","sourceRoot":"","sources":["../../../src/exact/facilitator.ts"],"names":[],"mappings":"AAOA,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAGvE,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,MAAM,CAAC;AAYpD,OAAO,EAEL,KAAK,gBAAgB,EAErB,KAAK,uBAAuB,EAC7B,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"facilitator.d.ts","sourceRoot":"","sources":["../../../src/exact/facilitator.ts"],"names":[],"mappings":"AAOA,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAGvE,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,MAAM,CAAC;AAYpD,OAAO,EAEL,KAAK,gBAAgB,EAErB,KAAK,uBAAuB,EAC7B,MAAM,qBAAqB,CAAC;AAgC7B,KAAK,4BAA4B,GAAG;IAClC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AACF,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,uBAAuB,EACxC,IAAI,GAAE,4BAAiC,GACtC,OAAO,CAAC,kBAAkB,CAAC,CA0R7B"}
|
|
@@ -14,7 +14,6 @@ function errorResponse(msg) {
|
|
|
14
14
|
networkId: null,
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
const usedNonces = new Set();
|
|
18
17
|
function parseSignature(signature) {
|
|
19
18
|
const sig = signature.slice(2); // Remove 0x
|
|
20
19
|
const r = `0x${sig.slice(0, 64)}`;
|
|
@@ -122,11 +121,6 @@ export async function createFacilitatorHandler(chain, privateKey, assetNameOrInf
|
|
|
122
121
|
if (!isAddress(authorization.from)) {
|
|
123
122
|
return errorResponse("Invalid from address");
|
|
124
123
|
}
|
|
125
|
-
// Check nonce hasn't been used (local check)
|
|
126
|
-
const nonceKey = `${authorization.from}-${authorization.nonce}`;
|
|
127
|
-
if (usedNonces.has(nonceKey)) {
|
|
128
|
-
return errorResponse("Nonce already used");
|
|
129
|
-
}
|
|
130
124
|
// Check on-chain nonce status
|
|
131
125
|
let onChainUsed;
|
|
132
126
|
try {
|
|
@@ -235,7 +229,6 @@ export async function createFacilitatorHandler(chain, privateKey, assetNameOrInf
|
|
|
235
229
|
if (receipt.status !== "success") {
|
|
236
230
|
return errorResponse("Transaction failed");
|
|
237
231
|
}
|
|
238
|
-
usedNonces.add(nonceKey);
|
|
239
232
|
return {
|
|
240
233
|
success: true,
|
|
241
234
|
error: null,
|