@cashu/coco-expo-sqlite 2.0.0-rc.1 → 2.0.0-rc.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.
Files changed (2) hide show
  1. package/dist/index.js +11 -7
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -1465,6 +1465,10 @@ function hexToBytes(hexString) {
1465
1465
  function bytesToHex(bytes) {
1466
1466
  return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
1467
1467
  }
1468
+ function assertFieldPresent(value, field, operationId) {
1469
+ if (value == null) throw new Error(`Invalid operation row ${operationId}: missing required field "${field}"`);
1470
+ return value;
1471
+ }
1468
1472
 
1469
1473
  //#endregion
1470
1474
  //#region ../sql-storage/src/repositories/KeysetRepository.ts
@@ -2490,8 +2494,8 @@ function rowToOperation$4(row) {
2490
2494
  };
2491
2495
  const preparedData = {
2492
2496
  needsSwap: row.needsSwap === 1,
2493
- fee: deserializeAmount(row.fee ?? 0),
2494
- inputAmount: deserializeAmount(row.inputAmount ?? 0),
2497
+ fee: deserializeAmount(assertFieldPresent(row.fee, "fee", row.id)),
2498
+ inputAmount: deserializeAmount(assertFieldPresent(row.inputAmount, "inputAmount", row.id)),
2495
2499
  inputProofSecrets: row.inputProofSecretsJson ? JSON.parse(row.inputProofSecretsJson) : [],
2496
2500
  outputData: row.outputDataJson ? JSON.parse(row.outputDataJson) : void 0
2497
2501
  };
@@ -2662,11 +2666,11 @@ const rowToOperation$3 = (row) => {
2662
2666
  };
2663
2667
  const preparedData = {
2664
2668
  quoteId: row.quoteId ?? "",
2665
- amount: deserializeAmount(row.amount ?? 0),
2666
- fee_reserve: deserializeAmount(row.fee_reserve ?? 0),
2667
- swap_fee: deserializeAmount(row.swap_fee ?? 0),
2669
+ amount: deserializeAmount(assertFieldPresent(row.amount, "amount", row.id)),
2670
+ fee_reserve: deserializeAmount(assertFieldPresent(row.fee_reserve, "fee_reserve", row.id)),
2671
+ swap_fee: deserializeAmount(assertFieldPresent(row.swap_fee, "swap_fee", row.id)),
2668
2672
  needsSwap: row.needsSwap === 1,
2669
- inputAmount: deserializeAmount(row.inputAmount ?? 0),
2673
+ inputAmount: deserializeAmount(assertFieldPresent(row.inputAmount, "inputAmount", row.id)),
2670
2674
  inputProofSecrets: row.inputProofSecretsJson ? JSON.parse(row.inputProofSecretsJson) : [],
2671
2675
  changeOutputData: row.changeOutputDataJson ? JSON.parse(row.changeOutputDataJson) : {
2672
2676
  keep: [],
@@ -3091,7 +3095,7 @@ function rowToOperation$1(row) {
3091
3095
  state: "init"
3092
3096
  };
3093
3097
  const preparedData = {
3094
- fee: deserializeAmount(row.fee ?? 0),
3098
+ fee: deserializeAmount(assertFieldPresent(row.fee, "fee", row.id)),
3095
3099
  outputData: row.outputDataJson ? JSON.parse(row.outputDataJson) : void 0
3096
3100
  };
3097
3101
  switch (row.state) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cashu/coco-expo-sqlite",
3
- "version": "2.0.0-rc.1",
3
+ "version": "2.0.0-rc.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,8 +15,8 @@
15
15
  "README.md"
16
16
  ],
17
17
  "devDependencies": {
18
- "@cashu/coco-adapter-tests": "2.0.0-rc.1",
19
- "@cashu/coco-sql-storage": "2.0.0-rc.1"
18
+ "@cashu/coco-adapter-tests": "2.0.0-rc.2",
19
+ "@cashu/coco-sql-storage": "2.0.0-rc.2"
20
20
  },
21
21
  "exports": {
22
22
  ".": {
@@ -34,6 +34,6 @@
34
34
  "@cashu/cashu-ts": "4.5",
35
35
  "typescript": "^5",
36
36
  "expo-sqlite": "*",
37
- "@cashu/coco-core": "2.0.0-rc.1"
37
+ "@cashu/coco-core": "2.0.0-rc.2"
38
38
  }
39
39
  }