@faremeter/payment-evm 0.4.0 → 0.6.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/{client.d.ts → exact/client.d.ts} +1 -1
- package/dist/src/exact/client.d.ts.map +1 -0
- package/dist/src/exact/constants.d.ts.map +1 -0
- package/dist/src/{facilitator.d.ts → exact/facilitator.d.ts} +1 -1
- package/dist/src/exact/facilitator.d.ts.map +1 -0
- package/dist/src/{facilitator.js → exact/facilitator.js} +11 -10
- package/dist/src/exact/index.d.ts +4 -0
- package/dist/src/exact/index.d.ts.map +1 -0
- package/dist/src/exact/index.js +3 -0
- package/dist/src/index.d.ts +1 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -4
- package/dist/src/client.d.ts.map +0 -1
- package/dist/src/constants.d.ts.map +0 -1
- package/dist/src/facilitator.d.ts.map +0 -1
- /package/dist/src/{client.js → exact/client.js} +0 -0
- /package/dist/src/{constants.d.ts → exact/constants.d.ts} +0 -0
- /package/dist/src/{constants.js → exact/constants.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/exact/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,yBAAyB,CAAC;AAOjC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAWhC,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,GAAG,CAAC;IACb,OAAO,EAAE;QACP,aAAa,EAAE,CAAC,MAAM,EAAE;YACtB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAC/B,WAAW,EAAE,MAAM,CAAC;YACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SAClC,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;KACpB,CAAC;CACH;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,gBAAgB,GAAG,cAAc,CA+G7E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/exact/constants.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,iBAAiB,UAAU,CAAC;AACzC,eAAO,MAAM,oBAAoB,iBAAiB,CAAC;AAEnD,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiDlC,CAAC;AAEX,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;CASf,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;;;;;;;MAU3B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAC,KAAK,CAAC;AAC7D,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,CAAC,eAAe,CAAC,CAAC;AAErE,eAAO,MAAM,YAAY;;;;;MAKvB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,KAAK,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type FacilitatorHandler } from "@faremeter/types";
|
|
1
|
+
import { type FacilitatorHandler } from "@faremeter/types/facilitator";
|
|
2
2
|
import type { PublicClient, WalletClient } from "viem";
|
|
3
3
|
export declare function createFacilitatorHandler(network: string, publicClient: PublicClient, walletClient: WalletClient, assetName: string): FacilitatorHandler;
|
|
4
4
|
//# sourceMappingURL=facilitator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"facilitator.d.ts","sourceRoot":"","sources":["../../../src/exact/facilitator.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAGvE,OAAO,KAAK,EAAE,YAAY,EAAO,YAAY,EAAW,MAAM,MAAM,CAAC;AAoCrE,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,MAAM,GAChB,kBAAkB,CAmQpB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { isValidationError, caseInsensitiveLiteral
|
|
1
|
+
import { isValidationError, caseInsensitiveLiteral } from "@faremeter/types";
|
|
2
|
+
import {} from "@faremeter/types/facilitator";
|
|
2
3
|
import { type } from "arktype";
|
|
3
4
|
import { verifyTypedData, encodeFunctionData, isAddress } from "viem";
|
|
4
5
|
import { baseSepolia } from "viem/chains";
|
|
@@ -111,7 +112,7 @@ export function createFacilitatorHandler(network, publicClient, walletClient, as
|
|
|
111
112
|
});
|
|
112
113
|
}
|
|
113
114
|
catch (error) {
|
|
114
|
-
|
|
115
|
+
throw new Error("Failed to check authorization status", { cause: error });
|
|
115
116
|
}
|
|
116
117
|
if (onChainUsed) {
|
|
117
118
|
return errorResponse("Authorization already used on-chain");
|
|
@@ -135,8 +136,8 @@ export function createFacilitatorHandler(network, publicClient, walletClient, as
|
|
|
135
136
|
publicClient.getChainId(),
|
|
136
137
|
]);
|
|
137
138
|
}
|
|
138
|
-
catch (
|
|
139
|
-
|
|
139
|
+
catch (cause) {
|
|
140
|
+
throw new Error("Failed to read contract parameters", { cause });
|
|
140
141
|
}
|
|
141
142
|
const domain = {
|
|
142
143
|
name: tokenName,
|
|
@@ -165,8 +166,8 @@ export function createFacilitatorHandler(network, publicClient, walletClient, as
|
|
|
165
166
|
signature: signature,
|
|
166
167
|
});
|
|
167
168
|
}
|
|
168
|
-
catch (
|
|
169
|
-
|
|
169
|
+
catch (cause) {
|
|
170
|
+
throw new Error("Signature verification failed", { cause });
|
|
170
171
|
}
|
|
171
172
|
if (!isValidSignature) {
|
|
172
173
|
return errorResponse("Invalid signature");
|
|
@@ -179,8 +180,8 @@ export function createFacilitatorHandler(network, publicClient, walletClient, as
|
|
|
179
180
|
functionName: "DOMAIN_SEPARATOR",
|
|
180
181
|
});
|
|
181
182
|
}
|
|
182
|
-
catch (
|
|
183
|
-
|
|
183
|
+
catch (cause) {
|
|
184
|
+
throw new Error("Contract does not support EIP-712", { cause });
|
|
184
185
|
}
|
|
185
186
|
const acct = walletClient.account;
|
|
186
187
|
if (!acct || acct.type !== "local") {
|
|
@@ -228,8 +229,8 @@ export function createFacilitatorHandler(network, publicClient, walletClient, as
|
|
|
228
229
|
networkId: networkInfo.chainId.toString(),
|
|
229
230
|
};
|
|
230
231
|
}
|
|
231
|
-
catch (
|
|
232
|
-
|
|
232
|
+
catch (cause) {
|
|
233
|
+
throw new Error("Transaction execution failed", { cause });
|
|
233
234
|
}
|
|
234
235
|
};
|
|
235
236
|
return {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createPaymentHandler } from "./client.js";
|
|
2
|
+
export { createFacilitatorHandler } from "./facilitator.js";
|
|
3
|
+
export { X402_EXACT_SCHEME, BASE_SEPOLIA_NETWORK, TRANSFER_WITH_AUTHORIZATION_ABI, EIP712_TYPES, x402ExactPayload, eip712Domain, } from "./constants.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exact/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,+BAA+B,EAC/B,YAAY,EACZ,gBAAgB,EAChB,YAAY,GACb,MAAM,gBAAgB,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { createFacilitatorHandler } from "./facilitator.js";
|
|
3
|
-
export { X402_EXACT_SCHEME, BASE_SEPOLIA_NETWORK, TRANSFER_WITH_AUTHORIZATION_ABI, EIP712_TYPES, x402ExactPayload, eip712Domain, } from "./constants.js";
|
|
1
|
+
export * as exact from "./exact/index.js";
|
|
4
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { createFacilitatorHandler } from "./facilitator.js";
|
|
3
|
-
export { X402_EXACT_SCHEME, BASE_SEPOLIA_NETWORK, TRANSFER_WITH_AUTHORIZATION_ABI, EIP712_TYPES, x402ExactPayload, eip712Domain, } from "./constants.js";
|
|
1
|
+
export * as exact from "./exact/index.js";
|