@odatano/core 2.0.0-rc.43 → 2.0.0-rc.45
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/@cds-models/CardanoAgentService/index.d.ts +0 -46
- package/@cds-models/CardanoBackendService/index.d.ts +0 -10
- package/@cds-models/CardanoIndexerService/index.d.ts +36 -20
- package/@cds-models/CardanoIndexerService/index.js +4 -0
- package/@cds-models/CardanoODataService/index.d.ts +19 -47
- package/@cds-models/CardanoSignService/index.d.ts +3 -18
- package/@cds-models/CardanoTransactionService/index.d.ts +9 -31
- package/@cds-models/CardanoWorkerService/index.d.ts +3 -19
- package/@cds-models/index.d.ts +17 -0
- package/@cds-models/index.js +2 -0
- package/@cds-models/odatano/cardano/index.d.ts +1 -34
- package/README.md +6 -6
- package/db/schema.cds +29 -44
- package/db/types.cds +22 -5
- package/package.json +3 -1
- package/scripts/migrate-slot-leader.mjs +3 -11
- package/scripts/migrate-txseq.mjs +3 -12
- package/src/index.d.ts +0 -4
- package/src/index.js +3 -5
- package/src/plugin.js +4 -8
- package/srv/blockchain/asset-decimals.d.ts +7 -0
- package/srv/blockchain/asset-decimals.js +91 -0
- package/srv/blockchain/backends/blockfrost-backend.d.ts +2 -10
- package/srv/blockchain/backends/blockfrost-backend.js +15 -21
- package/srv/blockchain/backends/cardano-backend.d.ts +12 -71
- package/srv/blockchain/backends/koios-backend.d.ts +14 -147
- package/srv/blockchain/backends/koios-backend.js +40 -164
- package/srv/blockchain/backends/odatano-backend.d.ts +1 -11
- package/srv/blockchain/backends/odatano-backend.js +11 -12
- package/srv/blockchain/backends/ogmios-backend.d.ts +13 -160
- package/srv/blockchain/backends/ogmios-backend.js +48 -175
- package/srv/blockchain/backends/ogmios-frame-guard.d.ts +2 -18
- package/srv/blockchain/backends/ogmios-frame-guard.js +8 -20
- package/srv/blockchain/cardano-client.d.ts +12 -80
- package/srv/blockchain/cardano-client.js +36 -88
- package/srv/blockchain/cardano-indexer.d.ts +12 -192
- package/srv/blockchain/cardano-indexer.js +132 -222
- package/srv/blockchain/cardano-tx-builder.d.ts +1 -28
- package/srv/blockchain/cardano-tx-builder.js +17 -34
- package/srv/blockchain/circuit-breaker.d.ts +1 -13
- package/srv/blockchain/circuit-breaker.js +5 -15
- package/srv/blockchain/crawler/asset-decimals-backfill.d.ts +15 -0
- package/srv/blockchain/crawler/asset-decimals-backfill.js +56 -0
- package/srv/blockchain/crawler/certificate-backfill.d.ts +0 -17
- package/srv/blockchain/crawler/certificate-backfill.js +8 -22
- package/srv/blockchain/crawler/crawler.d.ts +16 -93
- package/srv/blockchain/crawler/crawler.js +85 -160
- package/srv/blockchain/crawler/credential-backfill.d.ts +0 -9
- package/srv/blockchain/crawler/credential-backfill.js +6 -6
- package/srv/blockchain/crawler/hooks.d.ts +1 -5
- package/srv/blockchain/crawler/index.d.ts +0 -12
- package/srv/blockchain/crawler/index.js +6 -20
- package/srv/blockchain/crawler/sync-state.d.ts +6 -44
- package/srv/blockchain/crawler/sync-state.js +18 -53
- package/srv/blockchain/crawler/transaction-backfill.d.ts +0 -11
- package/srv/blockchain/crawler/transaction-backfill.js +11 -30
- package/srv/blockchain/crawler/utxo-set-import.d.ts +1 -30
- package/srv/blockchain/crawler/utxo-set-import.js +27 -53
- package/srv/blockchain/ledger-state.d.ts +10 -54
- package/srv/blockchain/ledger-state.js +11 -27
- package/srv/blockchain/pending-spends.d.ts +0 -12
- package/srv/blockchain/pending-spends.js +4 -12
- package/srv/blockchain/request-coalescer.d.ts +2 -16
- package/srv/blockchain/request-coalescer.js +2 -16
- package/srv/blockchain/signing/cose-verifier.d.ts +0 -9
- package/srv/blockchain/signing/cose-verifier.js +4 -10
- package/srv/blockchain/signing/external-signer.d.ts +1 -4
- package/srv/blockchain/signing/external-signer.js +2 -8
- package/srv/blockchain/signing/hsm-signer.d.ts +6 -18
- package/srv/blockchain/signing/hsm-signer.js +16 -28
- package/srv/blockchain/signing/signature-verifier.d.ts +1 -8
- package/srv/blockchain/signing/signature-verifier.js +9 -19
- package/srv/blockchain/signing/submission-finalizer.d.ts +10 -16
- package/srv/blockchain/signing/submission-finalizer.js +48 -19
- package/srv/blockchain/stored-chain.d.ts +1 -14
- package/srv/blockchain/stored-chain.js +3 -8
- package/srv/blockchain/transaction-building/buildooor-fee-patch.d.ts +0 -4
- package/srv/blockchain/transaction-building/buildooor-fee-patch.js +4 -9
- package/srv/blockchain/transaction-building/buildooor-tx.d.ts +7 -150
- package/srv/blockchain/transaction-building/buildooor-tx.js +91 -196
- package/srv/blockchain/transaction-building/caller-datums.d.ts +0 -14
- package/srv/blockchain/transaction-building/caller-datums.js +3 -9
- package/srv/blockchain/transaction-building/cardano-tx.d.ts +1 -4
- package/srv/blockchain/wallet-worker/build-request.d.ts +0 -5
- package/srv/blockchain/wallet-worker/build-request.js +6 -9
- package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +5 -23
- package/srv/blockchain/wallet-worker/confirmation-tracker.js +16 -20
- package/srv/blockchain/wallet-worker/index.d.ts +1 -1
- package/srv/blockchain/wallet-worker/index.js +3 -5
- package/srv/blockchain/wallet-worker/job-store.d.ts +15 -65
- package/srv/blockchain/wallet-worker/job-store.js +0 -0
- package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +2 -10
- package/srv/blockchain/wallet-worker/lease-heartbeat.js +6 -12
- package/srv/blockchain/wallet-worker/signers.d.ts +3 -11
- package/srv/blockchain/wallet-worker/signers.js +3 -6
- package/srv/blockchain/wallet-worker/wallet-worker.d.ts +3 -21
- package/srv/blockchain/wallet-worker/wallet-worker.js +47 -54
- package/srv/cardano-agent-service.cds +123 -146
- package/srv/cardano-agent-service.js +2 -5
- package/srv/cardano-backend-service.cds +10 -17
- package/srv/cardano-backend-service.js +7 -12
- package/srv/cardano-indexer-service.cds +35 -37
- package/srv/cardano-indexer-service.d.ts +5 -1
- package/srv/cardano-indexer-service.js +64 -33
- package/srv/cardano-service.cds +56 -40
- package/srv/cardano-service.js +42 -69
- package/srv/cardano-sign-service.cds +14 -23
- package/srv/cardano-sign-service.js +18 -24
- package/srv/cardano-tx-service.cds +27 -29
- package/srv/cardano-tx-service.js +60 -122
- package/srv/cardano-worker-service.cds +109 -125
- package/srv/cardano-worker-service.js +21 -31
- package/srv/cbor/cip68.d.ts +13 -0
- package/srv/cbor/cip68.js +56 -0
- package/srv/cbor/index.d.ts +1 -0
- package/srv/cbor/index.js +6 -1
- package/srv/cbor/parse.d.ts +3 -18
- package/srv/cbor/parse.js +2 -7
- package/srv/cbor/plutus-data-json.d.ts +0 -4
- package/srv/server.d.ts +5 -36
- package/srv/server.js +30 -51
- package/srv/utils/agent-grants-config.d.ts +0 -18
- package/srv/utils/agent-grants-config.js +6 -13
- package/srv/utils/agent-grants.d.ts +14 -68
- package/srv/utils/agent-grants.js +42 -60
- package/srv/utils/agent-token-auth.d.ts +0 -5
- package/srv/utils/agent-token-auth.js +2 -5
- package/srv/utils/backend-request-handler.d.ts +1 -1
- package/srv/utils/collections.d.ts +1 -4
- package/srv/utils/collections.js +1 -4
- package/srv/utils/const.d.ts +0 -18
- package/srv/utils/const.js +7 -18
- package/srv/utils/crypto.js +3 -5
- package/srv/utils/db-indexes.d.ts +2 -0
- package/srv/utils/db-indexes.js +22 -9
- package/srv/utils/db-sanitize.d.ts +1 -8
- package/srv/utils/db-sanitize.js +3 -8
- package/srv/utils/epoch-slots.d.ts +1 -8
- package/srv/utils/epoch-slots.js +3 -8
- package/srv/utils/error-codes.d.ts +0 -4
- package/srv/utils/error-codes.js +2 -4
- package/srv/utils/errors.d.ts +2 -22
- package/srv/utils/errors.js +13 -27
- package/srv/utils/liveness.d.ts +0 -4
- package/srv/utils/liveness.js +2 -4
- package/srv/utils/mappers.d.ts +0 -37
- package/srv/utils/mappers.js +22 -39
- package/srv/utils/network-context.js +2 -4
- package/srv/utils/paging.d.ts +31 -0
- package/srv/utils/paging.js +43 -0
- package/srv/utils/pg-inline-json.js +3 -7
- package/srv/utils/pg-order-nulls.js +2 -5
- package/srv/utils/plutus-placeholders.d.ts +0 -13
- package/srv/utils/plutus-placeholders.js +6 -13
- package/srv/utils/rate-limiter.d.ts +0 -8
- package/srv/utils/rate-limiter.js +2 -4
- package/srv/utils/reference-script.d.ts +0 -18
- package/srv/utils/reference-script.js +8 -19
- package/srv/utils/service-events.d.ts +0 -4
- package/srv/utils/service-events.js +2 -4
- package/srv/utils/signing-helper.d.ts +1 -8
- package/srv/utils/signing-helper.js +3 -8
- package/srv/utils/tx-build-helper.d.ts +2 -32
- package/srv/utils/tx-build-helper.js +26 -40
- package/srv/utils/tx-request-parsers.d.ts +1 -25
- package/srv/utils/tx-request-parsers.js +10 -25
- package/srv/utils/tx-utils.d.ts +0 -8
- package/srv/utils/tx-utils.js +10 -13
- package/srv/utils/types.d.ts +2 -37
- package/srv/utils/validators.d.ts +0 -4
- package/srv/utils/validators.js +2 -4
|
@@ -16,10 +16,8 @@ const validators_1 = require("./validators");
|
|
|
16
16
|
const cardano_ledger_ts_1 = require("@harmoniclabs/cardano-ledger-ts");
|
|
17
17
|
const plutus_data_1 = require("@harmoniclabs/plutus-data");
|
|
18
18
|
const const_1 = require("./const");
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* Result contract: `{ parsed }` on success (undefined for absent/empty input) or `{ error }` with a client message.
|
|
22
|
-
*/
|
|
19
|
+
// Parsers for the JSON fields of the Build actions, shared with the wallet worker.
|
|
20
|
+
// Each returns `{ parsed }`, undefined for empty input, or `{ error }` with a client message.
|
|
23
21
|
/** PlutusData as CBOR hex, checked to decode; `field` names it in the error. */
|
|
24
22
|
function parsePlutusCbor(value, field) {
|
|
25
23
|
if (typeof value !== 'string' || !(0, validators_1.isValidCbor)(value))
|
|
@@ -105,10 +103,7 @@ exports.MAX_EXTRA_OUTPUTS = 32;
|
|
|
105
103
|
function parseExtraOutputs(extraOutputsJson) {
|
|
106
104
|
return parseOutputList(extraOutputsJson, 'extraOutputsJson');
|
|
107
105
|
}
|
|
108
|
-
/**
|
|
109
|
-
* Parse an output list. `outputsJson` (BuildPlutusTransaction) additionally accepts `datumHash`;
|
|
110
|
-
* the entries keep their order, each is min-ADA checked by the builder.
|
|
111
|
-
*/
|
|
106
|
+
/** Entries keep their order. `outputsJson` also accepts `datumHash`. */
|
|
112
107
|
function parseOutputList(json, fieldName) {
|
|
113
108
|
if (!json)
|
|
114
109
|
return { parsed: undefined };
|
|
@@ -206,10 +201,8 @@ function parseOutputList(json, fieldName) {
|
|
|
206
201
|
}
|
|
207
202
|
return { parsed: out };
|
|
208
203
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
* applied as-is) and `redeemerJson` (JSON string). Absent fields fall back to the top-level script/redeemer.
|
|
212
|
-
*/
|
|
204
|
+
// Optional per-action `mintingPolicyScript` and `redeemerJson` of a mintActionsJson entry.
|
|
205
|
+
// Absent fields fall back to the request's script and redeemer.
|
|
213
206
|
function parseMintActionPolicyFields(entry, i, byReference = false) {
|
|
214
207
|
let script;
|
|
215
208
|
if (entry.mintingPolicyScript !== undefined && entry.mintingPolicyScript !== null) {
|
|
@@ -339,10 +332,8 @@ function parseScriptInputs(json) {
|
|
|
339
332
|
}
|
|
340
333
|
/** Upper bound on withdrawals per BuildPlutusTransaction. */
|
|
341
334
|
exports.MAX_WITHDRAWALS = 16;
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
* script (inline or by reference) with exactly one redeemer form; without a script no redeemer.
|
|
345
|
-
*/
|
|
335
|
+
// Distinct reward accounts and lovelace >= 0. A staking script needs exactly one redeemer form.
|
|
336
|
+
// Without a script no redeemer is allowed.
|
|
346
337
|
function parseWithdrawals(json) {
|
|
347
338
|
if (!json)
|
|
348
339
|
return { parsed: undefined };
|
|
@@ -448,10 +439,7 @@ function parseStakingScriptWitness(entry, at, kind) {
|
|
|
448
439
|
}
|
|
449
440
|
/** Upper bound on certificates per BuildPlutusTransaction. */
|
|
450
441
|
exports.MAX_CERTIFICATES = 16;
|
|
451
|
-
|
|
452
|
-
* Parse and validate certificatesJson: stake registrations and deregistrations, each with an
|
|
453
|
-
* optional staking script (inline or by reference) and exactly one redeemer form when scripted.
|
|
454
|
-
*/
|
|
442
|
+
// Stake registrations and deregistrations. A scripted one needs exactly one redeemer form.
|
|
455
443
|
function parseCertificates(json) {
|
|
456
444
|
if (!json)
|
|
457
445
|
return { parsed: undefined };
|
|
@@ -492,11 +480,8 @@ function parseCertificates(json) {
|
|
|
492
480
|
}
|
|
493
481
|
return { parsed: out };
|
|
494
482
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
* or `referenceScript` (no request-level default) and optional `redeemerJson`; `assetUnit` is
|
|
498
|
-
* policyId+assetName, or with an inline script a bare assetName prefixed with the script's policy id.
|
|
499
|
-
*/
|
|
483
|
+
// Every action carries its own `mintingPolicyScript` or `referenceScript`, with no request default.
|
|
484
|
+
// With an inline script, `assetUnit` may be a bare asset name, prefixed with the script's policy id.
|
|
500
485
|
function parsePolicyMintActions(json) {
|
|
501
486
|
if (!json)
|
|
502
487
|
return { parsed: undefined };
|
package/srv/utils/tx-utils.d.ts
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import cds from '@sap/cds';
|
|
2
2
|
/** Default acquire budget for detached bookkeeping transactions. */
|
|
3
3
|
export declare const DETACHED_TX_TIMEOUT_MS = 10000;
|
|
4
|
-
/**
|
|
5
|
-
* Run `fn` with `cds.context` cleared so inner `db.run` calls get short-lived transactions instead of
|
|
6
|
-
* joining a long-lived ambient one; keeps the single sqlite connection free during long awaits.
|
|
7
|
-
*/
|
|
8
4
|
export declare function runWithoutAmbientTx<T>(fn: () => Promise<T>): Promise<T>;
|
|
9
|
-
/**
|
|
10
|
-
* `cds.tx(fn)` as a new root transaction with a deadlock guard: throws BackendError 503
|
|
11
|
-
* `ODATANO_NESTED_TX_TIMEOUT` when no pooled connection arrives in time, and a late grant does no work.
|
|
12
|
-
*/
|
|
13
5
|
export declare function detachedTx<T>(label: string, fn: (db: cds.Transaction) => Promise<T>, timeoutMs?: number): Promise<T>;
|
|
14
6
|
//# sourceMappingURL=tx-utils.d.ts.map
|
package/srv/utils/tx-utils.js
CHANGED
|
@@ -9,10 +9,8 @@ exports.detachedTx = detachedTx;
|
|
|
9
9
|
const cds_1 = __importDefault(require("@sap/cds"));
|
|
10
10
|
const errors_1 = require("./errors");
|
|
11
11
|
const error_codes_1 = require("./error-codes");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* connection held by the request tx, so a new root tx awaited by that request would wait forever.
|
|
15
|
-
*/
|
|
12
|
+
// @cap-js/sqlite has a single pooled connection held by the request transaction.
|
|
13
|
+
// A new root transaction awaited by that request would wait forever.
|
|
16
14
|
const logger = cds_1.default.log('tx-utils');
|
|
17
15
|
/** Default acquire budget for detached bookkeeping transactions. */
|
|
18
16
|
exports.DETACHED_TX_TIMEOUT_MS = 10_000;
|
|
@@ -21,10 +19,8 @@ function effectiveTimeoutMs() {
|
|
|
21
19
|
const fromEnv = Number(process.env.ODATANO_DETACHED_TX_TIMEOUT_MS);
|
|
22
20
|
return Number.isFinite(fromEnv) && fromEnv > 0 ? fromEnv : exports.DETACHED_TX_TIMEOUT_MS;
|
|
23
21
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* joining a long-lived ambient one; keeps the single sqlite connection free during long awaits.
|
|
27
|
-
*/
|
|
22
|
+
// Clears cds.context so inner db.run calls use short transactions instead of joining an ambient one.
|
|
23
|
+
// This keeps the single SQLite connection free during long awaits.
|
|
28
24
|
function runWithoutAmbientTx(fn) {
|
|
29
25
|
return cds_1.default._with(undefined, fn);
|
|
30
26
|
}
|
|
@@ -35,10 +31,8 @@ class DetachedTxAbortedError extends Error {
|
|
|
35
31
|
this.name = 'DetachedTxAbortedError';
|
|
36
32
|
}
|
|
37
33
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
* `ODATANO_NESTED_TX_TIMEOUT` when no pooled connection arrives in time, and a late grant does no work.
|
|
41
|
-
*/
|
|
34
|
+
// New root transaction with a deadlock guard. Throws 503 ODATANO_NESTED_TX_TIMEOUT when no
|
|
35
|
+
// connection arrives in time. A connection granted after the timeout does no work.
|
|
42
36
|
async function detachedTx(label, fn, timeoutMs) {
|
|
43
37
|
const effectiveTimeout = timeoutMs ?? effectiveTimeoutMs();
|
|
44
38
|
let timedOut = false;
|
|
@@ -49,6 +43,9 @@ async function detachedTx(label, fn, timeoutMs) {
|
|
|
49
43
|
await db.begin();
|
|
50
44
|
if (timedOut)
|
|
51
45
|
throw new DetachedTxAbortedError(label);
|
|
46
|
+
// the timeout bounds the acquire only; once begun, the work runs to its own commit
|
|
47
|
+
if (timer)
|
|
48
|
+
clearTimeout(timer);
|
|
52
49
|
return fn(db);
|
|
53
50
|
});
|
|
54
51
|
const guard = new Promise((_, reject) => {
|
|
@@ -56,7 +53,7 @@ async function detachedTx(label, fn, timeoutMs) {
|
|
|
56
53
|
timedOut = true;
|
|
57
54
|
reject(new errors_1.BackendError(`${label}: could not begin a detached DB transaction within ${effectiveTimeout}ms. ` +
|
|
58
55
|
`Most likely the calling request still holds the pooled DB connection open ` +
|
|
59
|
-
`(in-process nested call
|
|
56
|
+
`(in-process nested call: do not await this action while your request ` +
|
|
60
57
|
`transaction is open; detach your reads into a committed cds.tx first). ` +
|
|
61
58
|
`Alternatively the connection pool is exhausted.`, 503, error_codes_1.ERROR_CODES.NESTED_TX_TIMEOUT));
|
|
62
59
|
}, effectiveTimeout);
|
package/srv/utils/types.d.ts
CHANGED
|
@@ -41,10 +41,6 @@ export interface TxOutputLine {
|
|
|
41
41
|
referenceScriptSize?: number | null;
|
|
42
42
|
referenceScriptType?: ReferenceScriptType | null;
|
|
43
43
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Normalized certificate kinds; unknown types pass through as the raw source string. A Conway
|
|
46
|
-
* stake+vote delegation is split into `pool_delegation` + `vote_delegation` sharing one `certIndex`.
|
|
47
|
-
*/
|
|
48
44
|
export type CertificateKind = 'stake_registration' | 'stake_deregistration' | 'pool_delegation' | 'vote_delegation' | 'pool_registration' | 'pool_retirement' | 'drep_registration' | 'drep_update' | 'drep_retirement' | 'committee_hot_auth' | 'committee_resign' | 'genesis_delegation' | 'treasury_mir' | 'reserve_mir' | 'pot_transfer' | 'param_proposal' | (string & {});
|
|
49
45
|
/** One certificate of a transaction (crawler ledger-state coverage). */
|
|
50
46
|
export interface TxCertificate {
|
|
@@ -101,20 +97,9 @@ export interface Transaction {
|
|
|
101
97
|
/** What the ledger charged: the declared fee, or on a phase-2 failure the collateral consumed. */
|
|
102
98
|
fee: Lovelace | string;
|
|
103
99
|
deposit: Lovelace | string;
|
|
104
|
-
/**
|
|
105
|
-
* True when phase-2 failed: inputs/outputs not applied, collateral consumed, only the collateral
|
|
106
|
-
* return produced. Ogmios (`spends`) and Blockfrost (`valid_contract`) report it; Koios leaves it undefined.
|
|
107
|
-
*/
|
|
100
|
+
/** True when phase 2 failed and only collateral was consumed. Undefined when the source does not report it. */
|
|
108
101
|
spendsCollaterals?: boolean;
|
|
109
|
-
/**
|
|
110
|
-
* `total_collateral` from the body when declared; equals the collateral consumed on a phase-2 failure.
|
|
111
|
-
* Null when omitted, the charge is then derived from the resolved collateral inputs minus the return.
|
|
112
|
-
*/
|
|
113
102
|
totalCollateral?: Lovelace | string | null;
|
|
114
|
-
/**
|
|
115
|
-
* Signed net mint/burn per unit (negative = burn), never `lovelace`. Ogmios and Koios report it;
|
|
116
|
-
* Blockfrost leaves it undefined and the indexer derives it from resolved input/output assets.
|
|
117
|
-
*/
|
|
118
103
|
mint?: Amount[];
|
|
119
104
|
/** Tx size in bytes; null when the source cannot provide it (Ogmios chain-sync). */
|
|
120
105
|
size: number | null;
|
|
@@ -337,20 +322,12 @@ export type MintAction = {
|
|
|
337
322
|
quantity: bigint;
|
|
338
323
|
/** Optional integer redeemer, default 0 */
|
|
339
324
|
redeemer?: number;
|
|
340
|
-
/**
|
|
341
|
-
* Per-action minting policy (CBOR hex, applied as-is) for multi-policy transactions; overrides the
|
|
342
|
-
* top-level mintingPolicyScript. The assetUnit must carry this script's policyId.
|
|
343
|
-
*/
|
|
344
325
|
mintingPolicyScript?: string;
|
|
345
326
|
/** BuildPlutusTransaction only: UTxO that carries the policy as reference script; exclusive with mintingPolicyScript. */
|
|
346
327
|
referenceScript?: {
|
|
347
328
|
txHash: string;
|
|
348
329
|
outputIndex: number;
|
|
349
330
|
};
|
|
350
|
-
/**
|
|
351
|
-
* Per-action redeemer (parsed PlutusData JSON), only with mintingPolicyScript or referenceScript; falls back to mintRedeemer.
|
|
352
|
-
* Actions on the same policy must agree (one redeemer per policy in the ledger).
|
|
353
|
-
*/
|
|
354
331
|
redeemerJson?: JSONValue;
|
|
355
332
|
};
|
|
356
333
|
/** Plutus script execution for spending from a script address */
|
|
@@ -399,10 +376,7 @@ export type TxBuildRequest = {
|
|
|
399
376
|
mintRedeemer?: JSONValue;
|
|
400
377
|
/** When true, route output to enterprise script address derived from applied script hash */
|
|
401
378
|
lockOnScript?: boolean;
|
|
402
|
-
/**
|
|
403
|
-
* UTxOs that must be consumed, added before coin selection (one-shot minting seeds);
|
|
404
|
-
* deduplicated against plutusScriptExecution.scriptUtxo.
|
|
405
|
-
*/
|
|
379
|
+
/** UTxOs that must be spent, such as one-shot minting seeds. Added before coin selection. */
|
|
406
380
|
forceInputs?: Array<{
|
|
407
381
|
txHash: string;
|
|
408
382
|
outputIndex: number;
|
|
@@ -471,10 +445,6 @@ export type PlutusTxOutput = NonNullable<TxBuildRequest['extraOutputs']>[number]
|
|
|
471
445
|
/** Inline datum as PlutusData CBOR hex, taken byte for byte; exclusive with inlineDatum. */
|
|
472
446
|
inlineDatumCbor?: string;
|
|
473
447
|
};
|
|
474
|
-
/**
|
|
475
|
-
* Reward-account withdrawal of a BuildPlutusTransaction. A staking script (inline or by reference)
|
|
476
|
-
* runs with the redeemer under the Reward purpose; without a script the stake key signs.
|
|
477
|
-
*/
|
|
478
448
|
export type WithdrawalInput = {
|
|
479
449
|
/** Bech32 reward account (stake address). */
|
|
480
450
|
rewardAddress: string;
|
|
@@ -492,11 +462,6 @@ export type WithdrawalInput = {
|
|
|
492
462
|
/** Redeemer as PlutusData CBOR hex; wins over `redeemer`, no placeholders. */
|
|
493
463
|
redeemerCbor?: string;
|
|
494
464
|
};
|
|
495
|
-
/**
|
|
496
|
-
* Stake-credential certificate of a BuildPlutusTransaction. A registration without a script is the
|
|
497
|
-
* witness-free legacy form (key or script credential); with a script the Conway deposit form, run
|
|
498
|
-
* under the Certifying purpose. A deregistration needs the key's witness or the script.
|
|
499
|
-
*/
|
|
500
465
|
export type CertificateInput = {
|
|
501
466
|
type: 'registerStake' | 'deregisterStake';
|
|
502
467
|
/** Bech32 stake address of the credential. */
|
|
@@ -32,10 +32,6 @@ export declare function isEpochNumber(s: unknown): s is number;
|
|
|
32
32
|
export declare function isValidCbor(cborRaw: unknown): cborRaw is string;
|
|
33
33
|
/** `isValidCbor` plus the MAX_TX_CBOR_HEX_LENGTH cap (ParseTransactionCbor memory bound). */
|
|
34
34
|
export declare function isValidTxCborHex(cborRaw: unknown): cborRaw is string;
|
|
35
|
-
/**
|
|
36
|
-
* Payment credential of a Shelley bech32 address: 28-byte hash (hex) plus whether it is a script
|
|
37
|
-
* credential (bit 0 of the header's high nibble); null for undecodable or stake addresses.
|
|
38
|
-
*/
|
|
39
35
|
export declare function extractPaymentCredential(address: string): {
|
|
40
36
|
hash: string;
|
|
41
37
|
isScript: boolean;
|
package/srv/utils/validators.js
CHANGED
|
@@ -207,10 +207,8 @@ function isValidTxCborHex(cborRaw) {
|
|
|
207
207
|
return false;
|
|
208
208
|
return cborRaw.trim().length <= const_1.MAX_TX_CBOR_HEX_LENGTH;
|
|
209
209
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
* credential (bit 0 of the header's high nibble); null for undecodable or stake addresses.
|
|
213
|
-
*/
|
|
210
|
+
// Payment credential hash of a Shelley address and whether it is a script credential.
|
|
211
|
+
// Null for undecodable or stake addresses.
|
|
214
212
|
function extractPaymentCredential(address) {
|
|
215
213
|
try {
|
|
216
214
|
const decoded = bech32_1.bech32.decode(address, const_1.BECH32_MAX_LENGTH);
|