@odatano/core 2.0.0-rc.36 → 2.0.0-rc.37

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": "@odatano/core",
3
- "version": "2.0.0-rc.36",
3
+ "version": "2.0.0-rc.37",
4
4
  "description": "SAP CAP plugin for Cardano blockchain OData V4 integration",
5
5
  "imports": {
6
6
  "#cds-models/*": "./@cds-models/*/index.js"
@@ -77,6 +77,18 @@
77
77
  "vitest": "^4.1.10"
78
78
  },
79
79
  "cds": {
80
+ "log": {
81
+ "mask_headers": [
82
+ "/authorization/i",
83
+ "/cookie/i",
84
+ "/cert/i",
85
+ "/ssl/i",
86
+ "/token/i",
87
+ "/key/i",
88
+ "/secret/i",
89
+ "/project_id/i"
90
+ ]
91
+ },
80
92
  "typer": {
81
93
  "ieee754compatible": true
82
94
  },
@@ -108,6 +108,11 @@ export declare class CardanoClient {
108
108
  getPool(poolId: string): Promise<PoolData>;
109
109
  getDrep(drepId: string): Promise<DrepData>;
110
110
  getAccount(stakeAddress: string): Promise<AccountData>;
111
+ /**
112
+ * Whether the reward account is registered in the ledger. Node first; the first backend that
113
+ * answers decides, its "not found" means not registered. Only a backend failure falls through.
114
+ */
115
+ isRewardAccountRegistered(stakeAddress: string): Promise<boolean>;
111
116
  /** Asset info (supply, mint history, CIP-25/CIP-26 metadata); Blockfrost and Koios only. */
112
117
  getAssetInfo(unit: string): Promise<AssetInfo>;
113
118
  /**
@@ -358,6 +358,22 @@ class CardanoClient {
358
358
  getAccount(stakeAddress) {
359
359
  return this.route('getAccount', b => b.getAccount(stakeAddress));
360
360
  }
361
+ /**
362
+ * Whether the reward account is registered in the ledger. Node first; the first backend that
363
+ * answers decides, its "not found" means not registered. Only a backend failure falls through.
364
+ */
365
+ isRewardAccountRegistered(stakeAddress) {
366
+ return this.executeWithPriority(async (b) => {
367
+ try {
368
+ return (await b.getAccount(stakeAddress)).active;
369
+ }
370
+ catch (err) {
371
+ if (err instanceof errors_1.NotFoundError)
372
+ return false;
373
+ throw err;
374
+ }
375
+ }, true, 'getAccount');
376
+ }
361
377
  /** Asset info (supply, mint history, CIP-25/CIP-26 metadata); Blockfrost and Koios only. */
362
378
  getAssetInfo(unit) {
363
379
  return this.route('getAssetInfo', b => b.getAssetInfo(unit));
@@ -216,16 +216,7 @@ class CardanoTransactionBuilder {
216
216
  for (const [i, w] of withdrawals.entries()) {
217
217
  if (registeredHere.has(w.rewardAddress.toLowerCase()))
218
218
  continue;
219
- let active;
220
- try {
221
- active = (await this.client.getAccount(w.rewardAddress)).active;
222
- }
223
- catch (err) {
224
- if (!(err instanceof errors_1.NotFoundError))
225
- throw err;
226
- active = false;
227
- }
228
- if (!active) {
219
+ if (!(await this.client.isRewardAccountRegistered(w.rewardAddress))) {
229
220
  throw new errors_1.TransactionValidationError(`withdrawals[${i}] reward account ${w.rewardAddress} is not registered on chain; register the stake credential first`);
230
221
  }
231
222
  }