facinet 2.0.1 → 2.0.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 +17 -12
- package/dist/browser.js.map +2 -2
- package/dist/commands/pay.d.ts.map +1 -1
- package/dist/commands/pay.js +17 -3
- package/dist/commands/pay.js.map +1 -1
- package/dist/sdk/Facinet.d.ts.map +1 -1
- package/dist/sdk/Facinet.js +19 -13
- package/dist/sdk/Facinet.js.map +1 -1
- package/dist/sdk.mjs +17 -12
- package/dist/sdk.mjs.map +2 -2
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -22657,17 +22657,24 @@ var Facinet = class _Facinet {
|
|
|
22657
22657
|
if (this.wallet) {
|
|
22658
22658
|
signature = await this.wallet.signTypedData(domain, types, value);
|
|
22659
22659
|
} else if (typeof window !== "undefined" && window.ethereum) {
|
|
22660
|
+
const messageForBrowser = {
|
|
22661
|
+
from: payerAddress,
|
|
22662
|
+
to: params.recipient,
|
|
22663
|
+
value: "0x" + amount.toString(16),
|
|
22664
|
+
// BigInt to hex string
|
|
22665
|
+
validAfter,
|
|
22666
|
+
validBefore,
|
|
22667
|
+
nonce
|
|
22668
|
+
};
|
|
22669
|
+
const jsonMessage = JSON.stringify({
|
|
22670
|
+
domain,
|
|
22671
|
+
types,
|
|
22672
|
+
primaryType: "TransferWithAuthorization",
|
|
22673
|
+
message: messageForBrowser
|
|
22674
|
+
});
|
|
22660
22675
|
signature = await window.ethereum.request({
|
|
22661
22676
|
method: "eth_signTypedData_v4",
|
|
22662
|
-
params: [
|
|
22663
|
-
payerAddress,
|
|
22664
|
-
JSON.stringify({
|
|
22665
|
-
domain,
|
|
22666
|
-
types,
|
|
22667
|
-
primaryType: "TransferWithAuthorization",
|
|
22668
|
-
message: value
|
|
22669
|
-
})
|
|
22670
|
-
]
|
|
22677
|
+
params: [payerAddress, jsonMessage]
|
|
22671
22678
|
});
|
|
22672
22679
|
} else {
|
|
22673
22680
|
throw new Error("No signing method available");
|
|
@@ -22687,9 +22694,7 @@ var Facinet = class _Facinet {
|
|
|
22687
22694
|
`${this.config.apiUrl}/api/x402/settle-custom`,
|
|
22688
22695
|
{
|
|
22689
22696
|
facilitatorId: facilitator.id,
|
|
22690
|
-
paymentPayload
|
|
22691
|
-
payload: paymentPayload
|
|
22692
|
-
}
|
|
22697
|
+
paymentPayload
|
|
22693
22698
|
}
|
|
22694
22699
|
);
|
|
22695
22700
|
if (!response.data.success) {
|