@perkos/scheme-deferred 1.1.1 → 1.1.2
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.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -6
- package/dist/index.mjs +2 -5
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, Hex, DeferredPayload, PaymentRequirements, VerifyResponse, Voucher } from '@perkos/types-x402';
|
|
2
|
-
export { Address, DeferredPayload, Hex, PaymentRequirements, VerifyResponse, Voucher
|
|
2
|
+
export { Address, DeferredPayload, Hex, PaymentRequirements, VerifyResponse, Voucher } from '@perkos/types-x402';
|
|
3
3
|
import { SupportedNetwork } from '@perkos/util-chains';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, Hex, DeferredPayload, PaymentRequirements, VerifyResponse, Voucher } from '@perkos/types-x402';
|
|
2
|
-
export { Address, DeferredPayload, Hex, PaymentRequirements, VerifyResponse, Voucher
|
|
2
|
+
export { Address, DeferredPayload, Hex, PaymentRequirements, VerifyResponse, Voucher } from '@perkos/types-x402';
|
|
3
3
|
import { SupportedNetwork } from '@perkos/util-chains';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.js
CHANGED
|
@@ -32,14 +32,11 @@ __export(index_exports, {
|
|
|
32
32
|
createVoucherMessage: () => createVoucherMessage,
|
|
33
33
|
createVoucherTuple: () => createVoucherTuple,
|
|
34
34
|
generateVoucherId: () => generateVoucherId,
|
|
35
|
-
getPaymentAmount: () => import_types_x4022.getPaymentAmount,
|
|
36
35
|
parseSignature: () => parseSignature
|
|
37
36
|
});
|
|
38
37
|
module.exports = __toCommonJS(index_exports);
|
|
39
38
|
var import_viem = require("viem");
|
|
40
|
-
var import_types_x402 = require("@perkos/types-x402");
|
|
41
39
|
var import_util_chains = require("@perkos/util-chains");
|
|
42
|
-
var import_types_x4022 = require("@perkos/types-x402");
|
|
43
40
|
var VOUCHER_TYPE_DEF = [
|
|
44
41
|
{ name: "id", type: "bytes32" },
|
|
45
42
|
{ name: "buyer", type: "address" },
|
|
@@ -215,7 +212,7 @@ var DeferredSchemeVerifier = class {
|
|
|
215
212
|
return false;
|
|
216
213
|
}
|
|
217
214
|
const valueAggregate = BigInt(voucher.valueAggregate);
|
|
218
|
-
const maxAmount = BigInt(
|
|
215
|
+
const maxAmount = BigInt(requirements.maxAmountRequired || "0");
|
|
219
216
|
if (valueAggregate > maxAmount) {
|
|
220
217
|
return false;
|
|
221
218
|
}
|
|
@@ -332,7 +329,7 @@ function createEIP712Domain(chainId, escrowAddress, domainName, domainVersion) {
|
|
|
332
329
|
}
|
|
333
330
|
function generateVoucherId() {
|
|
334
331
|
const bytes = new Uint8Array(32);
|
|
335
|
-
crypto.getRandomValues(bytes);
|
|
332
|
+
globalThis.crypto.getRandomValues(bytes);
|
|
336
333
|
return `0x${Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("")}`;
|
|
337
334
|
}
|
|
338
335
|
function createVoucherMessage(id, buyer, seller, valueAggregate, asset, timestamp, nonce, escrow, chainId) {
|
|
@@ -375,6 +372,5 @@ function createVoucherTuple(voucher) {
|
|
|
375
372
|
createVoucherMessage,
|
|
376
373
|
createVoucherTuple,
|
|
377
374
|
generateVoucherId,
|
|
378
|
-
getPaymentAmount,
|
|
379
375
|
parseSignature
|
|
380
376
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -4,13 +4,11 @@ import {
|
|
|
4
4
|
http,
|
|
5
5
|
recoverTypedDataAddress
|
|
6
6
|
} from "viem";
|
|
7
|
-
import { getPaymentAmount } from "@perkos/types-x402";
|
|
8
7
|
import {
|
|
9
8
|
getChainById,
|
|
10
9
|
getChainIdFromNetwork,
|
|
11
10
|
getRpcUrl
|
|
12
11
|
} from "@perkos/util-chains";
|
|
13
|
-
import { getPaymentAmount as getPaymentAmount2 } from "@perkos/types-x402";
|
|
14
12
|
var VOUCHER_TYPE_DEF = [
|
|
15
13
|
{ name: "id", type: "bytes32" },
|
|
16
14
|
{ name: "buyer", type: "address" },
|
|
@@ -186,7 +184,7 @@ var DeferredSchemeVerifier = class {
|
|
|
186
184
|
return false;
|
|
187
185
|
}
|
|
188
186
|
const valueAggregate = BigInt(voucher.valueAggregate);
|
|
189
|
-
const maxAmount = BigInt(
|
|
187
|
+
const maxAmount = BigInt(requirements.maxAmountRequired || "0");
|
|
190
188
|
if (valueAggregate > maxAmount) {
|
|
191
189
|
return false;
|
|
192
190
|
}
|
|
@@ -303,7 +301,7 @@ function createEIP712Domain(chainId, escrowAddress, domainName, domainVersion) {
|
|
|
303
301
|
}
|
|
304
302
|
function generateVoucherId() {
|
|
305
303
|
const bytes = new Uint8Array(32);
|
|
306
|
-
crypto.getRandomValues(bytes);
|
|
304
|
+
globalThis.crypto.getRandomValues(bytes);
|
|
307
305
|
return `0x${Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("")}`;
|
|
308
306
|
}
|
|
309
307
|
function createVoucherMessage(id, buyer, seller, valueAggregate, asset, timestamp, nonce, escrow, chainId) {
|
|
@@ -345,6 +343,5 @@ export {
|
|
|
345
343
|
createVoucherMessage,
|
|
346
344
|
createVoucherTuple,
|
|
347
345
|
generateVoucherId,
|
|
348
|
-
getPaymentAmount2 as getPaymentAmount,
|
|
349
346
|
parseSignature
|
|
350
347
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perkos/scheme-deferred",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "EIP-712 Voucher-based deferred payment verification utilities for x402 deferred scheme",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@perkos/types-x402": "^1.1.0",
|
|
41
|
-
"@perkos/util-chains": "^1.
|
|
41
|
+
"@perkos/util-chains": "^1.1.0",
|
|
42
42
|
"viem": "^2.28.2"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|