@koralabs/kora-labs-common 6.13.0 → 6.13.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koralabs/kora-labs-common",
3
- "version": "6.13.0",
3
+ "version": "6.13.2",
4
4
  "description": "Kora Labs Common Utilities",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -40,7 +40,7 @@
40
40
  "@aiken-lang/merkle-patricia-forestry": "^1.2.0",
41
41
  "@aws-sdk/client-dynamodb": "^3.549.0",
42
42
  "@aws-sdk/lib-dynamodb": "^3.549.0",
43
- "@cardano-sdk/core": "^0.46.15",
43
+ "@cardano-sdk/core": "^0.47.0",
44
44
  "@cardano-sdk/crypto": "^0.4.7",
45
45
  "@emurgo/cardano-message-signing-nodejs": "^1.1.0",
46
46
  "@types/jest": "^30.0.0",
@@ -72,7 +72,7 @@
72
72
  },
73
73
  "peerDependencies": {
74
74
  "@aiken-lang/merkle-patricia-forestry": "^1.2.0",
75
- "@cardano-sdk/core": "^0.46.12",
75
+ "@cardano-sdk/core": "^0.46.12 || ^0.47.0",
76
76
  "@cardano-sdk/crypto": "^0.4.5",
77
77
  "bip39": "^3.1.0",
78
78
  "@emurgo/cardano-message-signing-nodejs": "^1.1.0"
@@ -12,7 +12,9 @@ export declare const READ_ONLY_GUARD_ERROR = "E2E_READONLY_GUARD";
12
12
  export interface SignRequest {
13
13
  method: (typeof FUND_MOVING_METHODS)[number];
14
14
  at: number;
15
- /** The exact tx CBOR the app asked to sign (first tx for signTxs). Decode it to assert what would have been signed. */
15
+ /** Every exact tx CBOR presented (one for signTx/submitTx, all of a CIP-103 signTxs batch). */
16
+ txCbors: string[];
17
+ /** The first of `txCbors` — the common single-tx case. */
16
18
  txCbor: string;
17
19
  }
18
20
  export interface ReadOnlyWallet {
@@ -3,21 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.makeReadOnlyWallet = exports.READ_ONLY_GUARD_ERROR = exports.FUND_MOVING_METHODS = void 0;
4
4
  exports.FUND_MOVING_METHODS = ['signTx', 'signTxs', 'submitTx'];
5
5
  exports.READ_ONLY_GUARD_ERROR = 'E2E_READONLY_GUARD';
6
- const firstTxCbor = (params) => {
7
- var _a, _b;
6
+ const presentedTxCbors = (params) => {
8
7
  if (typeof params === 'string')
9
- return params;
10
- if (Array.isArray(params)) {
11
- const first = params[0];
12
- return typeof first === 'string' ? first : ((_b = (_a = first === null || first === void 0 ? void 0 : first.cbor) !== null && _a !== void 0 ? _a : first === null || first === void 0 ? void 0 : first.tx) !== null && _b !== void 0 ? _b : '');
13
- }
14
- return '';
8
+ return [params];
9
+ if (!Array.isArray(params))
10
+ return [];
11
+ return params.flatMap((entry) => {
12
+ var _a;
13
+ const cbor = typeof entry === 'string' ? entry : ((_a = entry === null || entry === void 0 ? void 0 : entry.cbor) !== null && _a !== void 0 ? _a : entry === null || entry === void 0 ? void 0 : entry.tx);
14
+ return typeof cbor === 'string' ? [cbor] : [];
15
+ });
15
16
  };
16
17
  const makeReadOnlyWallet = (inner) => {
17
18
  const signRequests = [];
18
19
  const guardedCall = async (method, params) => {
20
+ var _a;
19
21
  if (exports.FUND_MOVING_METHODS.includes(method)) {
20
- signRequests.push({ method: method, at: Date.now(), txCbor: firstTxCbor(params) });
22
+ const txCbors = presentedTxCbors(params);
23
+ signRequests.push({ method: method, at: Date.now(), txCbors, txCbor: (_a = txCbors[0]) !== null && _a !== void 0 ? _a : '' });
21
24
  throw new Error(`${exports.READ_ONLY_GUARD_ERROR}: '${method}' is blocked — this suite reaches the transaction and stops; it never signs or submits.`);
22
25
  }
23
26
  return inner.call(method, params);