vet-sdk-core-ts 0.4.18 → 0.4.19

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/payment.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { type EvmPaymentNetworkId, type UsdcEvmNetwork, type UsdcPaymentQuote } from 'vet-data-utils-ts/payment';
2
- export { EvmPaymentNetworkIds, PaymentAssetIds, PaymentCurrencyCodes, PaymentProviderIds, USDC_BASE_NETWORKS, USDC_DECIMALS, VET_PAYMENT_TEST_DATA, type EvmPaymentNetworkId, type PaymentProviderId, type UsdcEvmNetwork, type UsdcPaymentQuote, usdOfferToUsdcMinor, } from 'vet-data-utils-ts/payment';
3
- export type UsdcPaymentQuotePolicy = Readonly<{
1
+ import { type EvmPaymentNetworkId, type EvmTransferNetwork, type EvmTransferPaymentQuote } from 'vet-data-utils-ts/payment';
2
+ export { EvmPaymentNetworkIds, PaymentAssetIds, PaymentCurrencyCodes, PaymentProviderIds, USDC_BASE_NETWORKS, USDC_DECIMALS, VET_PAYMENT_TEST_DATA, type EvmPaymentNetworkId, type PaymentProviderId, type EvmTransferNetwork, type EvmTransferPaymentConfirmation, type EvmTransferPaymentQuote, usdOfferToUsdcMinor, } from 'vet-data-utils-ts/payment';
3
+ export type EvmTransferPaymentQuotePolicy = Readonly<{
4
4
  now: Date;
5
5
  recipient: `0x${string}`;
6
6
  allowMainnet: boolean;
7
- networks?: Readonly<Partial<Record<EvmPaymentNetworkId, UsdcEvmNetwork>>>;
7
+ networks?: Readonly<Partial<Record<EvmPaymentNetworkId, EvmTransferNetwork>>>;
8
8
  }>;
9
9
  /** Validates a server-authored quote without trusting browser network fields. */
10
- export declare function validateUsdcPaymentQuote(value: unknown, policy: UsdcPaymentQuotePolicy): UsdcPaymentQuote;
10
+ export declare function validateEvmTransferPaymentQuote(value: unknown, policy: EvmTransferPaymentQuotePolicy): EvmTransferPaymentQuote;
package/dist/payment.js CHANGED
@@ -1,4 +1,4 @@
1
- import { PaymentProviderIds, USDC_DECIMALS, USDC_BASE_NETWORKS, } from 'vet-data-utils-ts/payment';
1
+ import { PaymentProviderIds, PaymentAssetIds, USDC_DECIMALS, USDC_BASE_NETWORKS, } from 'vet-data-utils-ts/payment';
2
2
  export { EvmPaymentNetworkIds, PaymentAssetIds, PaymentCurrencyCodes, PaymentProviderIds, USDC_BASE_NETWORKS, USDC_DECIMALS, VET_PAYMENT_TEST_DATA, usdOfferToUsdcMinor, } from 'vet-data-utils-ts/payment';
3
3
  const EVM_ADDRESS_PATTERN = /^0x[0-9a-fA-F]{40}$/;
4
4
  const POSITIVE_INTEGER_PATTERN = /^[1-9][0-9]*$/;
@@ -6,11 +6,13 @@ function paymentContractError(code) {
6
6
  throw new Error(code);
7
7
  }
8
8
  /** Validates a server-authored quote without trusting browser network fields. */
9
- export function validateUsdcPaymentQuote(value, policy) {
9
+ export function validateEvmTransferPaymentQuote(value, policy) {
10
10
  if (!value || typeof value !== "object")
11
11
  paymentContractError("payment_quote_invalid");
12
12
  const quote = value;
13
- if (quote.version !== 1 || quote.provider !== PaymentProviderIds.UsdcEvm) {
13
+ if (quote.version !== 1
14
+ || quote.provider !== PaymentProviderIds.EvmTransfer
15
+ || quote.asset !== PaymentAssetIds.Usdc) {
14
16
  paymentContractError("payment_quote_invalid");
15
17
  }
16
18
  const networks = policy.networks || USDC_BASE_NETWORKS;
@@ -20,7 +22,8 @@ export function validateUsdcPaymentQuote(value, policy) {
20
22
  if (network.mainnet && !policy.allowMainnet)
21
23
  paymentContractError("payment_mainnet_not_enabled");
22
24
  if (!EVM_ADDRESS_PATTERN.test(String(quote.tokenContract || ""))
23
- || quote.tokenContract?.toLowerCase() !== network.usdcContract.toLowerCase()) {
25
+ || quote.asset !== network.asset
26
+ || quote.tokenContract?.toLowerCase() !== network.tokenContract.toLowerCase()) {
24
27
  paymentContractError("payment_token_contract_not_allowed");
25
28
  }
26
29
  if (!EVM_ADDRESS_PATTERN.test(String(quote.recipient || ""))
@@ -30,12 +33,16 @@ export function validateUsdcPaymentQuote(value, policy) {
30
33
  if (!POSITIVE_INTEGER_PATTERN.test(String(quote.amountMinor || "")) || quote.decimals !== USDC_DECIMALS) {
31
34
  paymentContractError("payment_amount_invalid");
32
35
  }
33
- if (!String(quote.paymentReference || "").trim() || !String(quote.invoiceId || "").trim()) {
36
+ if (!String(quote.paymentReference || "").trim()
37
+ || !String(quote.invoiceId || "").trim()
38
+ || !String(quote.offerId || "").trim()) {
34
39
  paymentContractError("payment_reference_invalid");
35
40
  }
36
41
  const expiresAt = Date.parse(String(quote.expiresAt || ""));
37
- if (!Number.isFinite(expiresAt))
42
+ const createdAt = Date.parse(String(quote.createdAt || ""));
43
+ if (!Number.isFinite(createdAt) || !Number.isFinite(expiresAt) || createdAt >= expiresAt) {
38
44
  paymentContractError("payment_quote_invalid");
45
+ }
39
46
  if (expiresAt <= policy.now.getTime())
40
47
  paymentContractError("payment_quote_expired");
41
48
  return quote;
@@ -55,6 +55,14 @@ Keep all participating repositories on pushed but unmerged branches while the
55
55
  local matrix is still being corrected. Build an immutable tarball with
56
56
  `npm pack` and install it in downstream branches with `--no-save`.
57
57
 
58
+ Start every downstream proof from its committed lockfile with `npm ci`. If a
59
+ normal `npm install --no-save <tarball>` would re-resolve unrelated dependency
60
+ ranges, do not use that resolver path: overlay the exact packed contents in the
61
+ matching `node_modules` package directory, or use an equivalent isolated
62
+ installation that leaves `package.json` and the lockfile unchanged. Before
63
+ testing, verify the exact local package versions and any runtime-sensitive
64
+ baseline dependencies. A later `npm ci` must remove the temporary overlay.
65
+
58
66
  The tarball is temporary test input. Never commit a `file:`, Git, workspace or
59
67
  vendored tarball dependency or its generated lockfile state. An npm
60
68
  authorization or publication failure must never stop the local `test` stage.
@@ -78,7 +86,8 @@ After all local gates are green:
78
86
  versions installed, then build immutable GW images and run `local-network`.
79
87
  6. Portal consumers remain on pushed, unmerged branches with the immutable
80
88
  tarball during `local-network`; do not reinstall or repeat their already-green
81
- local matrix.
89
+ local matrix. The gateway image and Fabric gate do not require changing a
90
+ portal that already proved the same package tarball locally.
82
91
  7. After `local-network` is green, install the exact registry version in each
83
92
  affected portal, commit its registry dependency and lockfile, and run only
84
93
  the minimal artifact smoke.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vet-sdk-core-ts",
3
- "version": "0.4.18",
3
+ "version": "0.4.19",
4
4
  "description": "Browser-safe VetChain core contracts and governed animal species identifiers",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Connecting Solution & Applications Ltd",
@@ -68,6 +68,6 @@
68
68
  "dependencies": {
69
69
  "@noble/hashes": "^2.2.0",
70
70
  "gdc-common-utils-ts": "2.9.4",
71
- "vet-data-utils-ts": "0.5.4"
71
+ "vet-data-utils-ts": "0.5.5"
72
72
  }
73
73
  }