@artu-ai/compliance-sdk 0.10.1 → 0.10.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.
@@ -48,9 +48,10 @@ export declare class Transaction extends BaseModel<TransactionData> {
48
48
  */
49
49
  get isPending(): boolean;
50
50
  /**
51
- * Transaction amount
51
+ * Transaction amount as a precision-safe string.
52
+ * Use `Number(transaction.amount)` if you need a numeric value.
52
53
  */
53
- get amount(): number;
54
+ get amount(): string;
54
55
  /**
55
56
  * Currency code (ISO 4217)
56
57
  */
@@ -94,9 +95,9 @@ export declare class Transaction extends BaseModel<TransactionData> {
94
95
  /**
95
96
  * Exchange rates for currency conversion.
96
97
  * Format: Record<targetCurrency, rate>
97
- * Example: { "MXN": 17.5 } means 1 unit of transaction currency = 17.5 MXN
98
+ * Example: { "MXN": "17.5" } means 1 unit of transaction currency = 17.5 MXN
98
99
  */
99
- get exchangeRates(): Record<string, number> | undefined;
100
+ get exchangeRates(): Record<string, string> | undefined;
100
101
  /**
101
102
  * When the transaction record was created
102
103
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Transaction.d.ts","sourceRoot":"","sources":["../../src/models/Transaction.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAMrE;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,eAAe,EAAE,WAAW,CAAC;IAC1E,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CAClB;AAMD;;;;;;;;;;;;GAYG;AACH,qBAAa,WAAY,SAAQ,SAAS,CAAC,eAAe,CAAC;IA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pB;IAMD;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAElD;IAED;;;;OAIG;IACH,IAAI,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAItD;IAMD;;OAEG;IACH,IAAI,SAAS,IAAI,IAAI,CAEpB;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,IAAI,CAEpB;IAMQ,QAAQ,IAAI,MAAM;CAG3B;AAMD;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE"}
@@ -54,7 +54,8 @@ export class Transaction extends BaseModel {
54
54
  // Amount
55
55
  // ─────────────────────────────────────────────────────────────────
56
56
  /**
57
- * Transaction amount
57
+ * Transaction amount as a precision-safe string.
58
+ * Use `Number(transaction.amount)` if you need a numeric value.
58
59
  */
59
60
  get amount() {
60
61
  return this._data.amount;
@@ -69,15 +70,16 @@ export class Transaction extends BaseModel {
69
70
  * Formats amount with currency
70
71
  */
71
72
  get formattedAmount() {
73
+ const numericAmount = Number(this.amount);
72
74
  try {
73
75
  return new Intl.NumberFormat("en-US", {
74
76
  style: "currency",
75
77
  currency: this.currency,
76
- }).format(this.amount);
78
+ }).format(numericAmount);
77
79
  }
78
80
  catch {
79
81
  // Fallback for unsupported currencies
80
- return `${this.currency} ${this.amount.toLocaleString()}`;
82
+ return `${this.currency} ${numericAmount.toLocaleString()}`;
81
83
  }
82
84
  }
83
85
  // ─────────────────────────────────────────────────────────────────
@@ -145,10 +147,10 @@ export class Transaction extends BaseModel {
145
147
  /**
146
148
  * Exchange rates for currency conversion.
147
149
  * Format: Record<targetCurrency, rate>
148
- * Example: { "MXN": 17.5 } means 1 unit of transaction currency = 17.5 MXN
150
+ * Example: { "MXN": "17.5" } means 1 unit of transaction currency = 17.5 MXN
149
151
  */
150
152
  get exchangeRates() {
151
- // Cast is safe: Zod guarantees all values are numbers at runtime.
153
+ // Cast is safe: Zod guarantees all values are strings at runtime.
152
154
  // The Partial wrapper is a type-level artifact of z.partialRecord().
153
155
  return this._data.exchangeRates;
154
156
  }
@@ -46,7 +46,7 @@ export declare class MexAVITransaction extends MexActividadVulnerableTransaction
46
46
  * For buy/sell: the amount of cryptocurrency.
47
47
  * For exchange: the received amount.
48
48
  */
49
- get cryptoAmount(): number | undefined;
49
+ get cryptoAmount(): string | undefined;
50
50
  toString(): string;
51
51
  }
52
52
  import type { TransactionModel } from "../../../types";
@@ -94,7 +94,7 @@ export class MexMJRTransaction extends MexActividadVulnerableTransaction {
94
94
  * Total payment amount across all payments
95
95
  */
96
96
  get totalPaymentAmount() {
97
- return this.payments.reduce((sum, p) => sum + p.amount, 0);
97
+ return this.payments.reduce((sum, p) => sum + Number(p.amount), 0);
98
98
  }
99
99
  // ─────────────────────────────────────────────────────────────────
100
100
  // Helpers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artu-ai/compliance-sdk",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "TypeScript SDK for the Artu Compliance API",
5
5
  "private": false,
6
6
  "type": "module",
@@ -64,7 +64,7 @@
64
64
  },
65
65
  "license": "UNLICENSED",
66
66
  "dependencies": {
67
- "@artu-ai/shared": "0.10.1",
67
+ "@artu-ai/shared": "0.10.2",
68
68
  "@trpc/client": "^11.7.2"
69
69
  },
70
70
  "devDependencies": {