@odatano/core 2.0.0-rc.50 → 2.0.0-rc.52
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/CardanoBackendService/index.d.ts +14 -3
- package/@cds-models/CardanoBackendService/index.js +1 -0
- package/@cds-models/CardanoIndexerService/index.d.ts +98 -0
- package/@cds-models/CardanoIndexerService/index.js +10 -0
- package/@cds-models/CardanoODataService/index.d.ts +3 -0
- package/@cds-models/CardanoSignService/index.d.ts +13 -0
- package/@cds-models/CardanoSignService/index.js +1 -0
- package/@cds-models/CardanoTransactionService/index.d.ts +12 -0
- package/@cds-models/CardanoTransactionService/index.js +1 -0
- package/@cds-models/CardanoWorkerService/index.d.ts +28 -0
- package/@cds-models/CardanoWorkerService/index.js +2 -0
- package/@cds-models/index.d.ts +13 -3
- package/@cds-models/index.js +4 -3
- package/@cds-models/odatano/cardano/index.d.ts +14 -0
- package/README.md +45 -149
- package/db/schema.cds +63 -10
- package/db/types.cds +10 -0
- package/package.json +7 -44
- package/scripts/deploy-schema.mjs +113 -0
- package/scripts/migrate-schema.mjs +209 -15
- package/srv/blockchain/backends/blockfrost-backend.d.ts +2 -4
- package/srv/blockchain/backends/blockfrost-backend.js +61 -45
- package/srv/blockchain/backends/call-signal.d.ts +7 -0
- package/srv/blockchain/backends/call-signal.js +22 -0
- package/srv/blockchain/backends/cardano-backend.d.ts +6 -3
- package/srv/blockchain/backends/koios-backend.d.ts +9 -6
- package/srv/blockchain/backends/koios-backend.js +145 -207
- package/srv/blockchain/backends/odatano-backend.d.ts +2 -1
- package/srv/blockchain/backends/odatano-backend.js +51 -9
- package/srv/blockchain/backends/ogmios-backend.d.ts +1 -2
- package/srv/blockchain/backends/ogmios-backend.js +82 -48
- package/srv/blockchain/cardano-client.d.ts +15 -5
- package/srv/blockchain/cardano-client.js +143 -71
- package/srv/blockchain/cardano-indexer.d.ts +27 -16
- package/srv/blockchain/cardano-indexer.js +223 -102
- package/srv/blockchain/circuit-breaker.d.ts +1 -0
- package/srv/blockchain/circuit-breaker.js +6 -0
- package/srv/blockchain/crawler/account-snapshots.js +22 -2
- package/srv/blockchain/crawler/asset-decimals-backfill.d.ts +2 -0
- package/srv/blockchain/crawler/asset-decimals-backfill.js +29 -29
- package/srv/blockchain/crawler/asset-registry-backfill.d.ts +3 -0
- package/srv/blockchain/crawler/asset-registry-backfill.js +4 -0
- package/srv/blockchain/crawler/asset-slice-backfill.d.ts +35 -0
- package/srv/blockchain/crawler/asset-slice-backfill.js +149 -0
- package/srv/blockchain/crawler/certificate-backfill.d.ts +4 -0
- package/srv/blockchain/crawler/certificate-backfill.js +15 -3
- package/srv/blockchain/crawler/crawler.d.ts +22 -1
- package/srv/blockchain/crawler/crawler.js +223 -24
- package/srv/blockchain/crawler/credential-backfill.d.ts +2 -0
- package/srv/blockchain/crawler/credential-backfill.js +43 -66
- package/srv/blockchain/crawler/input-asset-copies.d.ts +4 -4
- package/srv/blockchain/crawler/input-asset-copies.js +17 -27
- package/srv/blockchain/crawler/key-pages.d.ts +12 -0
- package/srv/blockchain/crawler/key-pages.js +48 -0
- package/srv/blockchain/crawler/metadata-position-backfill.d.ts +6 -0
- package/srv/blockchain/crawler/metadata-position-backfill.js +23 -19
- package/srv/blockchain/crawler/output-datum-backfill.d.ts +3 -1
- package/srv/blockchain/crawler/output-datum-backfill.js +8 -18
- package/srv/blockchain/crawler/sync-state.d.ts +5 -1
- package/srv/blockchain/crawler/sync-state.js +63 -106
- package/srv/blockchain/crawler/transaction-backfill.d.ts +2 -0
- package/srv/blockchain/crawler/transaction-backfill.js +6 -13
- package/srv/blockchain/crawler/utxo-set-import.js +2 -2
- package/srv/blockchain/crawler/window-plan.d.ts +31 -0
- package/srv/blockchain/crawler/window-plan.js +59 -0
- package/srv/blockchain/ledger-state.d.ts +2 -2
- package/srv/blockchain/ledger-state.js +139 -37
- package/srv/blockchain/signing/external-signer.js +5 -5
- package/srv/blockchain/signing/failed-recheck.d.ts +17 -0
- package/srv/blockchain/signing/failed-recheck.js +135 -0
- package/srv/blockchain/signing/landing-proof.d.ts +60 -0
- package/srv/blockchain/signing/landing-proof.js +224 -0
- package/srv/blockchain/signing/signature-verifier.js +10 -13
- package/srv/blockchain/signing/submission-finalizer.d.ts +17 -3
- package/srv/blockchain/signing/submission-finalizer.js +90 -29
- package/srv/blockchain/stored-chain.d.ts +1 -2
- package/srv/blockchain/stored-chain.js +36 -15
- package/srv/blockchain/transaction-building/buildooor-tx.js +16 -10
- package/srv/blockchain/transaction-presence.d.ts +8 -1
- package/srv/blockchain/transaction-presence.js +12 -12
- package/srv/blockchain/wallet-worker/build-request.d.ts +6 -6
- package/srv/blockchain/wallet-worker/build-request.js +35 -365
- package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +23 -2
- package/srv/blockchain/wallet-worker/confirmation-tracker.js +140 -23
- package/srv/blockchain/wallet-worker/invalidation.d.ts +35 -0
- package/srv/blockchain/wallet-worker/invalidation.js +128 -0
- package/srv/blockchain/wallet-worker/job-store.d.ts +28 -2
- package/srv/blockchain/wallet-worker/job-store.js +107 -80
- package/srv/blockchain/wallet-worker/wallet-worker.d.ts +21 -2
- package/srv/blockchain/wallet-worker/wallet-worker.js +241 -57
- package/srv/cardano-agent-service.cds +1 -1
- package/srv/cardano-agent-service.js +8 -0
- package/srv/cardano-backend-service.cds +4 -1
- package/srv/cardano-backend-service.js +26 -9
- package/srv/cardano-indexer-service.cds +448 -387
- package/srv/cardano-indexer-service.js +226 -281
- package/srv/cardano-service.cds +7 -5
- package/srv/cardano-service.js +404 -69
- package/srv/cardano-sign-service.cds +11 -1
- package/srv/cardano-sign-service.js +161 -108
- package/srv/cardano-tx-service.cds +23 -12
- package/srv/cardano-tx-service.js +105 -604
- package/srv/cardano-worker-service.cds +25 -2
- package/srv/cardano-worker-service.js +56 -4
- package/srv/config.d.ts +4 -0
- package/srv/config.js +10 -0
- package/srv/server.js +5 -7
- package/srv/utils/agent-access.d.ts +4 -2
- package/srv/utils/agent-access.js +26 -7
- package/srv/utils/agent-grants.d.ts +1 -1
- package/srv/utils/agent-grants.js +7 -8
- package/srv/utils/agent-token-auth.js +45 -5
- package/srv/utils/build-request.d.ts +52 -0
- package/srv/utils/build-request.js +487 -0
- package/srv/utils/collections.d.ts +1 -0
- package/srv/utils/collections.js +11 -0
- package/srv/utils/const.d.ts +10 -2
- package/srv/utils/const.js +13 -6
- package/srv/utils/crypto.js +5 -4
- package/srv/utils/db-indexes.d.ts +5 -1
- package/srv/utils/db-indexes.js +79 -14
- package/srv/utils/db-kind.d.ts +23 -0
- package/srv/utils/db-kind.js +42 -0
- package/srv/utils/detached-run.d.ts +41 -0
- package/srv/utils/detached-run.js +101 -0
- package/srv/utils/epoch-slots.d.ts +1 -0
- package/srv/utils/epoch-slots.js +7 -0
- package/srv/utils/error-codes.d.ts +4 -0
- package/srv/utils/error-codes.js +4 -0
- package/srv/utils/errors.d.ts +10 -1
- package/srv/utils/errors.js +51 -9
- package/srv/utils/lease.d.ts +20 -0
- package/srv/utils/lease.js +62 -0
- package/srv/utils/mappers.d.ts +9 -0
- package/srv/utils/mappers.js +57 -67
- package/srv/utils/navigation.d.ts +17 -0
- package/srv/utils/navigation.js +52 -0
- package/srv/utils/network-context.d.ts +0 -1
- package/srv/utils/network-context.js +8 -3
- package/srv/utils/pg-inline-json.js +3 -3
- package/srv/utils/pg-order-nulls.js +3 -3
- package/srv/utils/resolution.d.ts +13 -0
- package/srv/utils/resolution.js +47 -0
- package/srv/utils/row-values.d.ts +7 -0
- package/srv/utils/row-values.js +27 -0
- package/srv/utils/tx-build-helper.d.ts +15 -0
- package/srv/utils/tx-build-helper.js +28 -13
- package/srv/utils/types.d.ts +36 -44
- package/srv/utils/types.js +1 -17
- package/srv/utils/validators.d.ts +2 -2
- package/srv/utils/validators.js +14 -25
|
@@ -15,6 +15,7 @@ const cds_1 = __importDefault(require("@sap/cds"));
|
|
|
15
15
|
const deep_json_1 = require("../utils/deep-json");
|
|
16
16
|
const cardano_1 = require("#cds-models/odatano/cardano");
|
|
17
17
|
const collections_1 = require("../utils/collections");
|
|
18
|
+
const errors_1 = require("../utils/errors");
|
|
18
19
|
const { SELECT } = cds_1.default.ql;
|
|
19
20
|
const num = (v) => Number(v ?? 0);
|
|
20
21
|
const numOrNull = (v) => (v == null ? null : Number(v));
|
|
@@ -32,6 +33,7 @@ function blockRowToData(row) {
|
|
|
32
33
|
size: num(row.size),
|
|
33
34
|
txCount: num(row.txCount),
|
|
34
35
|
fees: row.fees == null ? null : String(row.fees),
|
|
36
|
+
previousHash: row.previousHash == null ? null : String(row.previousHash),
|
|
35
37
|
};
|
|
36
38
|
}
|
|
37
39
|
/** A stored block by hash; null when not indexed. */
|
|
@@ -44,18 +46,41 @@ async function readBlockByHeight(db, height) {
|
|
|
44
46
|
const row = await db.run(SELECT.one.from(cardano_1.Blocks).where({ height }));
|
|
45
47
|
return row ? blockRowToData(row) : null;
|
|
46
48
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
// The one row of `candidates` that follows `parent`: its stored parent hash names it, or it is the
|
|
50
|
+
// only row at that height and its parent is unknown. Of two rows that both may follow, the one a
|
|
51
|
+
// stored block at the next height names wins. Null when no row follows or it stays ambiguous.
|
|
52
|
+
function successor(candidates, parent, next) {
|
|
53
|
+
const fits = candidates.filter((r) => r.previousHash == null || parent == null || r.previousHash === parent);
|
|
54
|
+
if (fits.length <= 1)
|
|
55
|
+
return fits[0] ?? null;
|
|
56
|
+
const named = fits.filter((r) => r.previousHash === parent && parent != null);
|
|
57
|
+
if (named.length === 1)
|
|
58
|
+
return named[0];
|
|
59
|
+
const continued = fits.filter((r) => next.some((n) => n.previousHash === r.hash));
|
|
60
|
+
return continued.length === 1 ? continued[0] : null;
|
|
61
|
+
}
|
|
62
|
+
// Up to `count` stored blocks after `afterHeight`, following the stored parent hashes from `afterHash`.
|
|
63
|
+
// Stops at a gap, at a block that names another parent, and where two rows at one height stay
|
|
64
|
+
// ambiguous; nothing is served past a point the store cannot decide. `previousHash` is the stored one.
|
|
65
|
+
async function readNextBlocks(db, afterHeight, count, afterHash = null) {
|
|
49
66
|
const rows = await db.run(
|
|
50
67
|
// one operator per column object: `{ '>': a, '<=': b }` renders as `height > a <= b`
|
|
51
|
-
SELECT.from(cardano_1.Blocks).where({ height: { between: afterHeight + 1, and: afterHeight + count } }).orderBy('height asc'));
|
|
68
|
+
SELECT.from(cardano_1.Blocks).where({ height: { between: afterHeight + 1, and: afterHeight + count + 1 } }).orderBy('height asc')) ?? [];
|
|
69
|
+
const byHeight = new Map();
|
|
70
|
+
for (const row of rows)
|
|
71
|
+
byHeight.set(num(row.height), [...(byHeight.get(num(row.height)) ?? []), row]);
|
|
52
72
|
const out = [];
|
|
53
|
-
let
|
|
54
|
-
for (
|
|
55
|
-
|
|
73
|
+
let parent = afterHash;
|
|
74
|
+
for (let height = afterHeight + 1; height <= afterHeight + count; height++) {
|
|
75
|
+
const row = successor(byHeight.get(height) ?? [], parent, byHeight.get(height + 1) ?? []);
|
|
76
|
+
if (!row) {
|
|
77
|
+
if (out.length === 0 && (byHeight.get(height)?.length ?? 0) > 1) {
|
|
78
|
+
throw new errors_1.ProviderUnavailableError(`two stored blocks at height ${height} may follow ${parent ?? 'the cursor'}; the stored chain cannot tell which one`, 'odatano');
|
|
79
|
+
}
|
|
56
80
|
break;
|
|
81
|
+
}
|
|
57
82
|
out.push(blockRowToData(row));
|
|
58
|
-
|
|
83
|
+
parent = str(row.hash);
|
|
59
84
|
}
|
|
60
85
|
return out;
|
|
61
86
|
}
|
|
@@ -128,7 +153,7 @@ async function assembleTransactions(db, rows) {
|
|
|
128
153
|
}
|
|
129
154
|
return out;
|
|
130
155
|
};
|
|
131
|
-
const [inputs, inputAssets, outputs, outputAssets, metadata, certificates, withdrawals,
|
|
156
|
+
const [inputs, inputAssets, outputs, outputAssets, metadata, certificates, withdrawals, redeemers, datums] = await Promise.all([
|
|
132
157
|
fetchIn(cardano_1.TransactionInputs, 'txSeq', seqs),
|
|
133
158
|
fetchIn(cardano_1.TransactionInputAssets, 'input_txSeq', seqs),
|
|
134
159
|
fetchIn(cardano_1.TransactionOutputs, 'txSeq', seqs),
|
|
@@ -136,7 +161,6 @@ async function assembleTransactions(db, rows) {
|
|
|
136
161
|
fetchIn(cardano_1.TransactionMetadata_, 'tx_hash', hashes),
|
|
137
162
|
fetchIn(cardano_1.TransactionCertificates, 'tx_hash', hashes),
|
|
138
163
|
fetchIn(cardano_1.TransactionWithdrawals, 'tx_hash', hashes),
|
|
139
|
-
fetchIn(cardano_1.AssetHistory_, 'txHash', hashes),
|
|
140
164
|
fetchIn(cardano_1.TransactionRedeemers, 'tx_hash', hashes),
|
|
141
165
|
fetchIn(cardano_1.TransactionDatums, 'tx_hash', hashes),
|
|
142
166
|
]);
|
|
@@ -147,7 +171,6 @@ async function assembleTransactions(db, rows) {
|
|
|
147
171
|
const metadataByHash = groupBy(metadata, r => str(r.tx_hash));
|
|
148
172
|
const certsByHash = groupBy(certificates, r => str(r.tx_hash));
|
|
149
173
|
const withdrawalsByHash = groupBy(withdrawals, r => str(r.tx_hash));
|
|
150
|
-
const mintsByHash = groupBy(mints, r => str(r.txHash));
|
|
151
174
|
const redeemersByHash = groupBy(redeemers, r => str(r.tx_hash));
|
|
152
175
|
const datumsByHash = groupBy(datums, r => str(r.tx_hash));
|
|
153
176
|
return rows.map((t) => {
|
|
@@ -187,7 +210,6 @@ async function assembleTransactions(db, rows) {
|
|
|
187
210
|
}));
|
|
188
211
|
const certs = certsByHash.get(hash);
|
|
189
212
|
const withdrawn = withdrawalsByHash.get(hash);
|
|
190
|
-
const minted = mintsByHash.get(hash);
|
|
191
213
|
const redeemed = redeemersByHash.get(hash);
|
|
192
214
|
const witnessDatums = datumsByHash.get(hash);
|
|
193
215
|
return {
|
|
@@ -201,10 +223,9 @@ async function assembleTransactions(db, rows) {
|
|
|
201
223
|
size: numOrNull(t.size),
|
|
202
224
|
blockTime: num(t.blockTime),
|
|
203
225
|
spendsCollaterals,
|
|
204
|
-
mint
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
})),
|
|
226
|
+
// AssetHistory may hold only some mint rows of a transaction, read on demand for single units.
|
|
227
|
+
// Without a complete mint the reader derives it from inputs and outputs.
|
|
228
|
+
mint: undefined,
|
|
208
229
|
inputs: txInputs,
|
|
209
230
|
outputs: txOutputs,
|
|
210
231
|
metadata: (metadataByHash.get(hash) ?? []).map(metadataRow),
|
|
@@ -741,6 +741,7 @@ class BuildooorTxBuilder {
|
|
|
741
741
|
unsignedTxCbor: txDetails.unsignedTxCbor,
|
|
742
742
|
txBodyHash: txDetails.txBodyHash,
|
|
743
743
|
senderAddress: req.senderAddress,
|
|
744
|
+
changeAddress: req.changeAddress ?? req.senderAddress,
|
|
744
745
|
network: this.cardanoClient.network,
|
|
745
746
|
builderEngine: this.name,
|
|
746
747
|
sizeBytes: txDetails.sizeBytes,
|
|
@@ -1259,10 +1260,10 @@ class BuildooorTxBuilder {
|
|
|
1259
1260
|
return undefined;
|
|
1260
1261
|
return ledgerScript(this._parsePlutusV3Script(hex, 'referenceScript'));
|
|
1261
1262
|
}
|
|
1262
|
-
// Uses `scriptRefCbor
|
|
1263
|
-
//
|
|
1263
|
+
// Uses `scriptRefCbor`. With hash and size only, a placeholder of that size stands in so the
|
|
1264
|
+
// fee counts its bytes.
|
|
1264
1265
|
_buildInputRefScript(utxo) {
|
|
1265
|
-
const cbor = utxo.scriptRefCbor ??
|
|
1266
|
+
const cbor = utxo.scriptRefCbor ?? undefined;
|
|
1266
1267
|
if (!cbor) {
|
|
1267
1268
|
if (utxo.scriptRef && utxo.scriptRefSize) {
|
|
1268
1269
|
logger.debug(`UTxO ${utxo.txHash}#${utxo.outputIndex} carries scriptRef hash and size only; fee counts ${utxo.scriptRefSize} bytes, local Plutus eval will not see the script`);
|
|
@@ -1333,22 +1334,27 @@ class BuildooorTxBuilder {
|
|
|
1333
1334
|
//---------------------------------------------------------------------------
|
|
1334
1335
|
// UTxO Mapping & Configuration Helpers
|
|
1335
1336
|
//---------------------------------------------------------------------------
|
|
1336
|
-
//
|
|
1337
|
-
//
|
|
1337
|
+
// Every build expires: without validityEndMs one hour ahead. Script builds also start two minutes
|
|
1338
|
+
// ago; plain transfers set a start only when the caller asks for one. The expiry is what lets a
|
|
1339
|
+
// submit that got no answer be called failed once the tip has passed it.
|
|
1338
1340
|
_resolveValiditySlots(req, mode) {
|
|
1339
1341
|
const hasStart = req.validityStartMs !== undefined && req.validityStartMs !== null && req.validityStartMs !== '';
|
|
1340
1342
|
const hasEnd = req.validityEndMs !== undefined && req.validityEndMs !== null && req.validityEndMs !== '';
|
|
1343
|
+
const nowMs = Date.now();
|
|
1344
|
+
// a start in the future moves the default expiry with it, so the range never inverts
|
|
1345
|
+
const endMs = hasEnd
|
|
1346
|
+
? Number(req.validityEndMs)
|
|
1347
|
+
: Math.max(nowMs, hasStart ? Number(req.validityStartMs) : nowMs) + const_1.DEFAULT_VALIDITY_END_OFFSET_MS;
|
|
1348
|
+
if (endMs > nowMs + const_1.MAX_VALIDITY_MS) {
|
|
1349
|
+
throw new errors_1.TransactionValidationError(`The transaction would expire more than ${const_1.MAX_VALIDITY_MS / 3_600_000} hours from now; choose an earlier validityEndMs or validityStartMs`);
|
|
1350
|
+
}
|
|
1341
1351
|
if (mode === 'passthrough') {
|
|
1342
|
-
const result = {};
|
|
1352
|
+
const result = { invalidAfter: BigInt(this.txBuilder.posixToSlot(endMs)) };
|
|
1343
1353
|
if (hasStart)
|
|
1344
1354
|
result.invalidBefore = BigInt(this.txBuilder.posixToSlot(Number(req.validityStartMs)));
|
|
1345
|
-
if (hasEnd)
|
|
1346
|
-
result.invalidAfter = BigInt(this.txBuilder.posixToSlot(Number(req.validityEndMs)));
|
|
1347
1355
|
return result;
|
|
1348
1356
|
}
|
|
1349
|
-
const nowMs = Date.now();
|
|
1350
1357
|
const startMs = hasStart ? Number(req.validityStartMs) : nowMs - const_1.DEFAULT_VALIDITY_START_OFFSET_MS;
|
|
1351
|
-
const endMs = hasEnd ? Number(req.validityEndMs) : nowMs + const_1.DEFAULT_VALIDITY_END_OFFSET_MS;
|
|
1352
1358
|
const startSlot = this.txBuilder.posixToSlot(startMs);
|
|
1353
1359
|
const endSlot = this.txBuilder.posixToSlot(endMs);
|
|
1354
1360
|
return {
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { CardanoIndexer } from './cardano-indexer';
|
|
2
2
|
import type { CardanoClient } from './cardano-client';
|
|
3
3
|
export type TransactionLookup = Pick<CardanoClient, 'getTransaction' | 'supports'>;
|
|
4
|
-
export
|
|
4
|
+
export type PresenceIndexer = Pick<CardanoIndexer, 'findCrawledTransaction'>;
|
|
5
|
+
export interface ChainPresence {
|
|
6
|
+
slot: number | null;
|
|
7
|
+
height: number | null;
|
|
8
|
+
scriptFailed: boolean;
|
|
9
|
+
validityKnown: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function findOnChain(indexer: PresenceIndexer, client: TransactionLookup, txHash: string): Promise<ChainPresence | null | undefined>;
|
|
5
12
|
//# sourceMappingURL=transaction-presence.d.ts.map
|
|
@@ -3,26 +3,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.findOnChain = findOnChain;
|
|
7
7
|
const cds_1 = __importDefault(require("@sap/cds"));
|
|
8
8
|
const errors_1 = require("../utils/errors");
|
|
9
9
|
const tx_utils_1 = require("../utils/tx-utils");
|
|
10
|
-
//
|
|
11
|
-
// no configured backend can look transactions up. Throws when the
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
return
|
|
10
|
+
// The transaction on chain, from the crawled chain first, then the backends. Null when every backend
|
|
11
|
+
// answers not found, undefined when no configured backend can look transactions up. Throws when the
|
|
12
|
+
// lookup itself fails. A row outside the crawled chain is not evidence: a rollback may have removed it.
|
|
13
|
+
async function findOnChain(indexer, client, txHash) {
|
|
14
|
+
const crawled = await (0, tx_utils_1.runWithoutAmbientTx)(() => cds_1.default.tx((t) => indexer.findCrawledTransaction(t, txHash)));
|
|
15
|
+
if (crawled)
|
|
16
|
+
return { slot: crawled.slot, height: crawled.blockHeight, scriptFailed: crawled.spendsCollaterals, validityKnown: crawled.validityKnown };
|
|
17
17
|
if (!client.supports('getTransaction'))
|
|
18
|
-
return
|
|
18
|
+
return undefined;
|
|
19
19
|
try {
|
|
20
|
-
await client.getTransaction(txHash);
|
|
21
|
-
return true;
|
|
20
|
+
const tx = await client.getTransaction(txHash);
|
|
21
|
+
return { slot: tx.slot ?? null, height: tx.blockHeight ?? null, scriptFailed: tx.spendsCollaterals === true, validityKnown: typeof tx.spendsCollaterals === 'boolean' };
|
|
22
22
|
}
|
|
23
23
|
catch (err) {
|
|
24
24
|
if ((0, errors_1.isNotFoundOnAllBackends)(err))
|
|
25
|
-
return
|
|
25
|
+
return null;
|
|
26
26
|
throw err;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { TxBuildPlutusRequest, TxBuildRequest } from '../../utils/types';
|
|
2
2
|
import type { Network } from '../cardano-client';
|
|
3
3
|
import type { WalletJobKindValue } from './job-store';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export declare function
|
|
4
|
+
export { MAX_PAYOUT_OUTPUTS } from '../../utils/build-request';
|
|
5
|
+
export declare function preparePayoutRequest(raw: Record<string, unknown>): TxBuildPlutusRequest;
|
|
6
|
+
/** A job's requestJson as an object, or null when it is not a JSON object. */
|
|
7
|
+
export declare function parseJobRequest(requestJson: string | null | undefined): Record<string, unknown> | null;
|
|
8
|
+
export declare function submitSignedProblem(raw: Record<string, unknown>, network: Network): string | null;
|
|
8
9
|
/** Raw job request → TxBuildRequest for the matching build method; malformed payloads throw 400 INVALID_INPUT. */
|
|
9
|
-
export declare function prepareWorkerBuildRequest(kind: WalletJobKindValue, raw:
|
|
10
|
-
export {};
|
|
10
|
+
export declare function prepareWorkerBuildRequest(kind: WalletJobKindValue, raw: Record<string, unknown>, network: Network): TxBuildRequest;
|
|
11
11
|
//# sourceMappingURL=build-request.d.ts.map
|