facinet 2.4.2 → 2.4.4
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/browser.js +37 -4
- package/dist/browser.js.map +2 -2
- package/dist/commands/pay.d.ts.map +1 -1
- package/dist/commands/pay.js +37 -5
- package/dist/commands/pay.js.map +1 -1
- package/dist/index.js +36 -9
- package/dist/index.js.map +2 -2
- package/dist/sdk/Facinet.d.ts.map +1 -1
- package/dist/sdk/Facinet.js +38 -5
- package/dist/sdk/Facinet.js.map +1 -1
- package/dist/sdk.js +37 -4
- package/dist/sdk.js.map +2 -2
- package/dist/sdk.mjs +37 -4
- package/dist/sdk.mjs.map +2 -2
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -2805,6 +2805,16 @@ var FacinetSDK = (() => {
|
|
|
2805
2805
|
payerAddress = payerAddress.toLowerCase();
|
|
2806
2806
|
const recipientAddress = params.recipient.toLowerCase();
|
|
2807
2807
|
const facilitator = await this.selectRandomFacilitator();
|
|
2808
|
+
if (facilitator.network && facilitator.network !== this.config.network) {
|
|
2809
|
+
throw new Error(
|
|
2810
|
+
`Facilitator ${facilitator.id} is registered for network ${facilitator.network}, but payment is for ${this.config.network}. Please ensure facilitators are registered for the correct network.`
|
|
2811
|
+
);
|
|
2812
|
+
}
|
|
2813
|
+
if (facilitator.chainId !== void 0 && facilitator.chainId !== this.chain.chainId) {
|
|
2814
|
+
throw new Error(
|
|
2815
|
+
`Facilitator ${facilitator.id} is registered for chain ID ${facilitator.chainId}, but payment is for chain ID ${this.chain.chainId}. Please ensure facilitators are registered for the correct chain.`
|
|
2816
|
+
);
|
|
2817
|
+
}
|
|
2808
2818
|
const amount = BigInt(parseFloat(params.amount) * 1e6);
|
|
2809
2819
|
const validAfter = Math.floor(Date.now() / 1e3) - 60;
|
|
2810
2820
|
const validBefore = validAfter + 3600;
|
|
@@ -2879,15 +2889,38 @@ var FacinetSDK = (() => {
|
|
|
2879
2889
|
validAfter: validAfter.toString(),
|
|
2880
2890
|
validBefore: validBefore.toString(),
|
|
2881
2891
|
nonce
|
|
2892
|
+
},
|
|
2893
|
+
// Include domain info so backend can verify signature
|
|
2894
|
+
domain: {
|
|
2895
|
+
name: this.chain.erc3009DomainName,
|
|
2896
|
+
version: this.chain.erc3009DomainVersion,
|
|
2897
|
+
chainId: this.chain.chainId,
|
|
2898
|
+
verifyingContract: this.chain.usdcAddress
|
|
2882
2899
|
}
|
|
2883
2900
|
};
|
|
2884
2901
|
try {
|
|
2902
|
+
const payload = {
|
|
2903
|
+
facilitatorId: facilitator.id,
|
|
2904
|
+
paymentPayload,
|
|
2905
|
+
network: this.config.network,
|
|
2906
|
+
chainId: this.chain.chainId,
|
|
2907
|
+
usdcAddress: this.chain.usdcAddress,
|
|
2908
|
+
// Explicitly include domain info at top level for backend
|
|
2909
|
+
domainName: this.chain.erc3009DomainName,
|
|
2910
|
+
domainVersion: this.chain.erc3009DomainVersion
|
|
2911
|
+
};
|
|
2912
|
+
if (process.env.DEBUG) {
|
|
2913
|
+
console.log("[Facinet SDK] Payment payload:", {
|
|
2914
|
+
network: payload.network,
|
|
2915
|
+
chainId: payload.chainId,
|
|
2916
|
+
usdcAddress: payload.usdcAddress,
|
|
2917
|
+
domainName: payload.domainName,
|
|
2918
|
+
facilitatorId: payload.facilitatorId
|
|
2919
|
+
});
|
|
2920
|
+
}
|
|
2885
2921
|
const response = await axios_default.post(
|
|
2886
2922
|
`${this.config.apiUrl}/api/x402/settle-custom`,
|
|
2887
|
-
|
|
2888
|
-
facilitatorId: facilitator.id,
|
|
2889
|
-
paymentPayload
|
|
2890
|
-
}
|
|
2923
|
+
payload
|
|
2891
2924
|
);
|
|
2892
2925
|
if (!response.data.success) {
|
|
2893
2926
|
throw new Error(
|