@certen.io/sdk 0.10.0 → 0.12.0
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/CHANGELOG.md +100 -0
- package/README.md +57 -2
- package/dist/address.d.ts +12 -0
- package/dist/address.d.ts.map +1 -0
- package/dist/address.js +48 -0
- package/dist/address.js.map +1 -0
- package/dist/browser.d.ts +17 -4
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +14 -2
- package/dist/browser.js.map +1 -1
- package/dist/chains.d.ts +20 -0
- package/dist/chains.d.ts.map +1 -1
- package/dist/chains.js +34 -0
- package/dist/chains.js.map +1 -1
- package/dist/client.d.ts +15 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +17 -3
- package/dist/client.js.map +1 -1
- package/dist/doctor.d.ts +10 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +6 -4
- package/dist/doctor.js.map +1 -1
- package/dist/effect.d.ts +99 -0
- package/dist/effect.d.ts.map +1 -0
- package/dist/effect.js +139 -0
- package/dist/effect.js.map +1 -0
- package/dist/error-codes.d.ts.map +1 -1
- package/dist/error-codes.js +11 -0
- package/dist/error-codes.js.map +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +3 -0
- package/dist/errors.js.map +1 -1
- package/dist/evm-rpc.d.ts +55 -0
- package/dist/evm-rpc.d.ts.map +1 -0
- package/dist/evm-rpc.js +126 -0
- package/dist/evm-rpc.js.map +1 -0
- package/dist/funding.d.ts +171 -0
- package/dist/funding.d.ts.map +1 -1
- package/dist/funding.js +190 -8
- package/dist/funding.js.map +1 -1
- package/dist/key-page.d.ts +67 -0
- package/dist/key-page.d.ts.map +1 -0
- package/dist/key-page.js +154 -0
- package/dist/key-page.js.map +1 -0
- package/dist/readiness.d.ts +133 -0
- package/dist/readiness.d.ts.map +1 -0
- package/dist/readiness.js +467 -0
- package/dist/readiness.js.map +1 -0
- package/dist/receipt.d.ts +233 -0
- package/dist/receipt.d.ts.map +1 -0
- package/dist/receipt.js +318 -0
- package/dist/receipt.js.map +1 -0
- package/dist/resources/chains.d.ts +14 -1
- package/dist/resources/chains.d.ts.map +1 -1
- package/dist/resources/chains.js +21 -0
- package/dist/resources/chains.js.map +1 -1
- package/dist/resources/execute.d.ts +62 -1
- package/dist/resources/execute.d.ts.map +1 -1
- package/dist/resources/execute.js +102 -9
- package/dist/resources/execute.js.map +1 -1
- package/dist/resources/identity.d.ts +47 -2
- package/dist/resources/identity.d.ts.map +1 -1
- package/dist/resources/identity.js +63 -1
- package/dist/resources/identity.js.map +1 -1
- package/dist/resources/transaction.d.ts +12 -1
- package/dist/resources/transaction.d.ts.map +1 -1
- package/dist/resources/transaction.js +14 -0
- package/dist/resources/transaction.js.map +1 -1
- package/dist/shared-proof.d.ts.map +1 -1
- package/dist/shared-proof.js +21 -1
- package/dist/shared-proof.js.map +1 -1
- package/dist/types.d.ts +207 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/verify.d.ts +126 -2
- package/dist/verify.d.ts.map +1 -1
- package/dist/verify.js +191 -2
- package/dist/verify.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/funding.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CertenError } from './errors.js';
|
|
2
|
-
import { chainSlug, nativeSymbolFor, readNativeBalance, describeUnverifiable } from './chains.js';
|
|
2
|
+
import { chainInfo, chainSlug, nativeSymbolFor, readNativeBalance, describeUnverifiable, gasReserveFor, parseUnits, formatUnits, } from './chains.js';
|
|
3
3
|
/**
|
|
4
4
|
* The unfunded abstract account guard.
|
|
5
5
|
*
|
|
@@ -15,6 +15,9 @@ import { chainSlug, nativeSymbolFor, readNativeBalance, describeUnverifiable } f
|
|
|
15
15
|
* **What it refuses, and what it lets through.**
|
|
16
16
|
*
|
|
17
17
|
* - A positively observed zero gas balance is refused ({@link CertenUnfundedAccountError}).
|
|
18
|
+
* - A balance that is positive but cannot cover the amount being moved plus the gas to move it is
|
|
19
|
+
* refused ({@link CertenUnderfundedAccountError}). Zero is the extreme case of this and keeps its
|
|
20
|
+
* own error. The gas half is an ESTIMATE (see {@link assessGas}); the amount half is not.
|
|
18
21
|
* - A gas balance that cannot be IDENTIFIED is refused by name
|
|
19
22
|
* ({@link CertenFundingUnverifiableError}): the chain's gas token is unknown to the catalogue,
|
|
20
23
|
* the gateway reported balances none of which is that token, or it reported the gas row as
|
|
@@ -46,6 +49,74 @@ export class CertenUnfundedAccountError extends CertenError {
|
|
|
46
49
|
return false;
|
|
47
50
|
}
|
|
48
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Thrown instead of submitting a value-moving intent from an account that holds some gas, but not enough: either less than the amount
|
|
54
|
+
* being moved, or too little left over once it is.
|
|
55
|
+
*
|
|
56
|
+
* `kind: 'amount'` is a fact (the account holds less than it is about to send). `kind: 'gas'` is judged against an ESTIMATE of what one
|
|
57
|
+
* execution costs, which is why it is overridable and says so.
|
|
58
|
+
*/
|
|
59
|
+
export class CertenUnderfundedAccountError extends CertenError {
|
|
60
|
+
address;
|
|
61
|
+
chain;
|
|
62
|
+
kind;
|
|
63
|
+
/** Whole native units, as strings, so nothing here is a float. */
|
|
64
|
+
balance;
|
|
65
|
+
needed;
|
|
66
|
+
symbol;
|
|
67
|
+
constructor(address, chain, shortfall) {
|
|
68
|
+
super(shortfall.kind === 'amount'
|
|
69
|
+
? `The abstract account ${address} on ${chain} holds ${shortfall.balance} ${shortfall.symbol}, less than the ${shortfall.amount} ${shortfall.symbol} this intent moves. `
|
|
70
|
+
+ 'It would be accepted, signed and submitted, and then never execute. Fund it first, or pass skipFundingCheck: true to submit anyway.'
|
|
71
|
+
: `The abstract account ${address} on ${chain} holds ${shortfall.balance} ${shortfall.symbol}; moving ${shortfall.amount} ${shortfall.symbol} and paying for the execution needs about `
|
|
72
|
+
+ `${shortfall.needed} ${shortfall.symbol}${shortfall.reserve === '0' ? ' (nothing would be left over for gas)' : ` (the gas share, ${shortfall.reserve} ${shortfall.symbol}, is an estimate, not a quote)`}. `
|
|
73
|
+
+ 'Without gas the intent is accepted, signed and submitted, and then parks at "anchoring" forever. Fund it first, or pass skipFundingCheck: true to submit anyway.', 0, 'ABSTRACT_ACCOUNT_UNDERFUNDED');
|
|
74
|
+
this.name = 'CertenUnderfundedAccountError';
|
|
75
|
+
this.address = address;
|
|
76
|
+
this.chain = chain;
|
|
77
|
+
this.kind = shortfall.kind;
|
|
78
|
+
this.balance = shortfall.balance;
|
|
79
|
+
this.needed = shortfall.needed;
|
|
80
|
+
this.symbol = shortfall.symbol;
|
|
81
|
+
}
|
|
82
|
+
/** Never. Funding is a human act; retrying changes nothing. */
|
|
83
|
+
get isRetryable() {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export function assessGas(p) {
|
|
88
|
+
const reading = p.reading;
|
|
89
|
+
if (reading.state !== 'funded' && reading.state !== 'empty')
|
|
90
|
+
return { state: 'unknown', reading };
|
|
91
|
+
const decimals = chainInfo(p.chain)?.nativeDecimals;
|
|
92
|
+
if (decimals === undefined)
|
|
93
|
+
return { state: 'unknown', reading: { state: 'unknown-native', chain: chainSlug(p.chain) } };
|
|
94
|
+
const balance = parseUnits(reading.balance, decimals);
|
|
95
|
+
// A number that is not a plain decimal ("1e-7", "unavailable") is not something to do arithmetic on. Unreadable, not zero.
|
|
96
|
+
if (balance === undefined)
|
|
97
|
+
return { state: 'unknown', reading: { state: 'unreadable', symbol: reading.symbol, balance: reading.balance } };
|
|
98
|
+
// An amount that is not a decimal cannot be compared; the reserve is still judged.
|
|
99
|
+
const amount = p.amount === undefined ? 0n : parseUnits(p.amount, decimals) ?? 0n;
|
|
100
|
+
const reserveText = p.reserve === undefined ? gasReserveFor(p.chain) : p.reserve ?? undefined;
|
|
101
|
+
const reserve = reserveText === undefined ? 0n : parseUnits(reserveText, decimals) ?? 0n;
|
|
102
|
+
const needed = amount + reserve;
|
|
103
|
+
const out = {
|
|
104
|
+
symbol: reading.symbol,
|
|
105
|
+
balance: formatUnits(balance, decimals),
|
|
106
|
+
amount: formatUnits(amount, decimals),
|
|
107
|
+
reserve: formatUnits(reserve, decimals),
|
|
108
|
+
needed: formatUnits(needed, decimals),
|
|
109
|
+
};
|
|
110
|
+
if (balance === 0n)
|
|
111
|
+
return { state: 'empty', ...out };
|
|
112
|
+
const shortfall = needed > balance ? formatUnits(needed - balance, decimals) : null;
|
|
113
|
+
if (balance < amount)
|
|
114
|
+
return { state: 'short', kind: 'amount', ...out, shortfall };
|
|
115
|
+
// Moving the whole balance leaves nothing to pay gas with, estimate or no estimate.
|
|
116
|
+
if (balance < needed || (amount > 0n && balance === amount))
|
|
117
|
+
return { state: 'short', kind: 'gas', ...out, shortfall };
|
|
118
|
+
return { state: 'sufficient', ...out, estimated: reserve > 0n };
|
|
119
|
+
}
|
|
49
120
|
/**
|
|
50
121
|
* Thrown instead of submitting a value-moving intent whose gas balance could not be identified.
|
|
51
122
|
*
|
|
@@ -140,17 +211,128 @@ export async function assertFundedForValue(http, params) {
|
|
|
140
211
|
}
|
|
141
212
|
if (address === undefined || reading === undefined)
|
|
142
213
|
return;
|
|
143
|
-
|
|
144
|
-
|
|
214
|
+
const assessment = assessGas({
|
|
215
|
+
chain: want,
|
|
216
|
+
reading,
|
|
217
|
+
amount: nativeAmountOf(want, params),
|
|
218
|
+
reserve: params.gasReserve,
|
|
219
|
+
});
|
|
220
|
+
switch (assessment.state) {
|
|
221
|
+
case 'sufficient':
|
|
145
222
|
return;
|
|
146
223
|
case 'empty':
|
|
147
224
|
throw new CertenUnfundedAccountError(address, want);
|
|
148
|
-
case '
|
|
149
|
-
|
|
150
|
-
case '
|
|
151
|
-
|
|
152
|
-
|
|
225
|
+
case 'short':
|
|
226
|
+
throw new CertenUnderfundedAccountError(address, want, assessment);
|
|
227
|
+
case 'unknown': {
|
|
228
|
+
const r = assessment.reading;
|
|
229
|
+
if (r.state === 'unknown-native' || r.state === 'native-not-reported' || r.state === 'unreadable') {
|
|
230
|
+
throw new CertenFundingUnverifiableError(address, want, r.state, describeUnverifiable(want, r));
|
|
231
|
+
}
|
|
153
232
|
return;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* The part of an intent's amount that is paid in the chain's native token, in whole units, or undefined when none of it is.
|
|
238
|
+
*
|
|
239
|
+
* A token transfer's amount is in the token and does not draw down the gas balance; counting it would refuse an account that holds the
|
|
240
|
+
* token and plenty of gas. A base-unit (wei) value is converted so one comparison serves both spellings.
|
|
241
|
+
*/
|
|
242
|
+
export function nativeAmountOf(chain, p) {
|
|
243
|
+
const info = chainInfo(chain);
|
|
244
|
+
if (!info || p.amount === undefined || p.amount === null)
|
|
245
|
+
return undefined;
|
|
246
|
+
if (p.tokenSymbol && p.tokenSymbol.toUpperCase() !== info.nativeSymbol.toUpperCase())
|
|
247
|
+
return undefined;
|
|
248
|
+
const text = String(p.amount).trim();
|
|
249
|
+
if (p.amountUnit === 'base')
|
|
250
|
+
return /^\d+$/.test(text) ? formatUnits(BigInt(text), info.nativeDecimals) : undefined;
|
|
251
|
+
return text;
|
|
252
|
+
}
|
|
253
|
+
// ── telling someone how to fund an account ──────────────────────────────────────────────────────────
|
|
254
|
+
const ADDRESS_RE = /^0x[0-9a-fA-F]{40}$/;
|
|
255
|
+
/**
|
|
256
|
+
* An EIP-681 payment request for a NATIVE transfer: `ethereum:<address>@<chainId>?value=<wei>`.
|
|
257
|
+
*
|
|
258
|
+
* Opens a wallet with the recipient, the network and the amount already set, which is the only way to move a value from a terminal to a wallet
|
|
259
|
+
* without retyping it. A mistyped recipient is the one error in this product that loses money and cannot be undone, so this builds a link only
|
|
260
|
+
* when every part of it is certain, and says `undefined` otherwise:
|
|
261
|
+
*
|
|
262
|
+
* - the chain must be in the catalogue (a link for a guessed network sends value somewhere nobody chose);
|
|
263
|
+
* - the address must be 20 bytes of hex, and is used exactly as given (the gateway's checksum case is preserved, never re-derived);
|
|
264
|
+
* - the amount is whole units and becomes integer wei by BigInt arithmetic. More decimals than the token has is refused rather than rounded:
|
|
265
|
+
* rounding would change what is paid.
|
|
266
|
+
*
|
|
267
|
+
* The value is a plain integer. EIP-681 also allows `1e15`, but a plain integer is read by more wallets.
|
|
268
|
+
*/
|
|
269
|
+
export function nativeTransferUri(p) {
|
|
270
|
+
const info = chainInfo(p.chain);
|
|
271
|
+
if (!info || !ADDRESS_RE.test(p.address))
|
|
272
|
+
return undefined;
|
|
273
|
+
const base = `ethereum:${p.address}@${info.chainId}`;
|
|
274
|
+
if (p.amount === undefined)
|
|
275
|
+
return base;
|
|
276
|
+
const wei = parseUnits(p.amount, info.nativeDecimals);
|
|
277
|
+
return wei === undefined ? undefined : `${base}?value=${wei.toString()}`;
|
|
278
|
+
}
|
|
279
|
+
export function gasFundingPlan(p) {
|
|
280
|
+
const info = chainInfo(p.chain);
|
|
281
|
+
if (!info)
|
|
282
|
+
return undefined;
|
|
283
|
+
const decimals = info.nativeDecimals;
|
|
284
|
+
const symbol = info.nativeSymbol;
|
|
285
|
+
const slug = info.slug;
|
|
286
|
+
const held = p.balance === undefined || p.balance === null ? undefined : parseUnits(p.balance, decimals);
|
|
287
|
+
const reserveText = p.reserve === undefined ? gasReserveFor(slug) : p.reserve ?? undefined;
|
|
288
|
+
const reserve = reserveText === undefined ? undefined : parseUnits(reserveText, decimals);
|
|
289
|
+
const amount = p.amount === undefined ? 0n : parseUnits(p.amount, decimals) ?? 0n;
|
|
290
|
+
const minimumWei = reserve === undefined ? (amount > 0n ? amount : undefined) : reserve + amount;
|
|
291
|
+
const suggestedWei = minimumWei === undefined ? undefined : (reserve !== undefined && reserve * 10n > minimumWei ? reserve * 10n : minimumWei);
|
|
292
|
+
const sendWei = suggestedWei === undefined ? undefined : (held !== undefined && held < suggestedWei ? suggestedWei - held : (held === undefined ? suggestedWei : 0n));
|
|
293
|
+
const leastWei = minimumWei === undefined ? undefined : (held !== undefined && held < minimumWei ? minimumWei - held : (held === undefined ? minimumWei : 0n));
|
|
294
|
+
// With nothing estimated, any positive balance clears it: the readiness check then judges the amount alone.
|
|
295
|
+
const satisfied = held === undefined ? false : minimumWei === undefined ? held > 0n : held >= minimumWei;
|
|
296
|
+
const fmt = (v) => (v === undefined ? null : formatUnits(v, decimals));
|
|
297
|
+
const send = fmt(sendWei);
|
|
298
|
+
const faucet = info.faucet ?? null;
|
|
299
|
+
const paymentUri = nativeTransferUri({ chain: slug, address: p.address, amount: send && sendWei !== 0n ? send : undefined }) ?? null;
|
|
300
|
+
const where = `${p.address} on ${slug}`;
|
|
301
|
+
const estimated = reserve !== undefined;
|
|
302
|
+
const steps = [];
|
|
303
|
+
if (send && sendWei !== 0n && leastWei === 0n) {
|
|
304
|
+
// Already enough to act; this only tops it up.
|
|
305
|
+
steps.push(`${where} already holds ${fmt(held)} ${symbol}, enough to act. To top it up to ${fmt(suggestedWei)} ${symbol}, send ${send} ${symbol}.`);
|
|
306
|
+
}
|
|
307
|
+
else if (send && sendWei !== 0n) {
|
|
308
|
+
// The suggestion is more than the minimum: say both, and which is which. "At least" would contradict "the least that works".
|
|
309
|
+
const split = leastWei !== undefined && sendWei !== undefined && leastWei < sendWei;
|
|
310
|
+
steps.push(split
|
|
311
|
+
? `Send ${send} ${symbol} to ${where} (${fmt(leastWei)} ${symbol}${held !== undefined && held > 0n ? ' more' : ''} is the least that works; the rest saves a second trip).`
|
|
312
|
+
: `Send at least ${send} ${symbol} to ${where}.`);
|
|
313
|
+
}
|
|
314
|
+
else if (send === null) {
|
|
315
|
+
steps.push(`Send some ${symbol} to ${where}. There is no estimate of what one execution costs on ${slug}, so there is no figure to give: any positive amount lets the account act, and an amount too small will fail at execution.`);
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
steps.push(`${where} already holds ${fmt(held)} ${symbol}.`);
|
|
154
319
|
}
|
|
320
|
+
if (faucet)
|
|
321
|
+
steps.push(`Testnet gas is free from the faucet: ${faucet}`);
|
|
322
|
+
if (paymentUri)
|
|
323
|
+
steps.push(`A wallet link with the network, the address${send && sendWei !== 0n ? ' and the amount' : ''} already set: ${paymentUri}`);
|
|
324
|
+
if (estimated)
|
|
325
|
+
steps.push(`The amounts are planning figures, not a quote: the gas share of ${fmt(reserve)} ${symbol} is an estimate.`);
|
|
326
|
+
const twoStep = [
|
|
327
|
+
'Some faucets refuse a contract address, and this account is one. If yours does, send the gas to a wallet you control first.',
|
|
328
|
+
`Then, from that wallet, send ${send && sendWei !== 0n ? `${send} ${symbol}` : symbol} to ${p.address} on ${slug}${paymentUri ? ' (the wallet link opens that transfer pre-filled)' : ''}.`,
|
|
329
|
+
];
|
|
330
|
+
steps.push(...twoStep);
|
|
331
|
+
return {
|
|
332
|
+
chain: slug, symbol, address: p.address,
|
|
333
|
+
balance: fmt(held),
|
|
334
|
+
minimum: fmt(minimumWei), suggested: fmt(suggestedWei), send, least: fmt(leastWei),
|
|
335
|
+
satisfied, estimated, faucet, paymentUri, steps, twoStep,
|
|
336
|
+
};
|
|
155
337
|
}
|
|
156
338
|
//# sourceMappingURL=funding.js.map
|
package/dist/funding.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"funding.js","sourceRoot":"","sources":["../src/funding.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGlG;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,uEAAuE;AACvE,MAAM,OAAO,0BAA2B,SAAQ,WAAW;IAChD,OAAO,CAAS;IAChB,KAAK,CAAS;IAEvB,YAAY,OAAe,EAAE,KAAa;QACxC,KAAK,CACH,wBAAwB,OAAO,OAAO,KAAK,gDAAgD;cACzF,8FAA8F;cAC9F,sFAAsF;QACxF,0FAA0F;QAC1F,4DAA4D;QAC5D,CAAC,EACD,2BAA2B,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UAAU,EAAE,KAAK,EAAE,OAAO;KACzD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export interface KeyPageReading {
|
|
2
|
+
/** The key page that was read. */
|
|
3
|
+
url: string;
|
|
4
|
+
/** The Accumulate node that answered. */
|
|
5
|
+
rpc: string;
|
|
6
|
+
/** SHA-256 of each public key on the page, lower-case hex. */
|
|
7
|
+
keyHashes: string[];
|
|
8
|
+
/**
|
|
9
|
+
* The page's credit balance exactly as the node reports it. The spec does not pin whether that is whole credits or hundredths of one, so
|
|
10
|
+
* it is never converted here: zero is zero in either, and nothing else should be read as a quantity of credits without knowing which.
|
|
11
|
+
*/
|
|
12
|
+
creditBalance: number | null;
|
|
13
|
+
version: number | null;
|
|
14
|
+
/** How many of the page's keys must sign for a transaction to execute. */
|
|
15
|
+
acceptThreshold: number | null;
|
|
16
|
+
}
|
|
17
|
+
export type KeyPageHold =
|
|
18
|
+
/** The page was read and lists the key. */
|
|
19
|
+
{
|
|
20
|
+
state: 'holds';
|
|
21
|
+
reading: KeyPageReading;
|
|
22
|
+
}
|
|
23
|
+
/** The page was read and does not list the key. A fact about the page, not a failure to read it. */
|
|
24
|
+
| {
|
|
25
|
+
state: 'absent';
|
|
26
|
+
reading: KeyPageReading;
|
|
27
|
+
}
|
|
28
|
+
/** The page could not be read. `notFound` is the node saying it has no such account (a wrong node, or an identity not yet anchored). */
|
|
29
|
+
| {
|
|
30
|
+
state: 'unreadable';
|
|
31
|
+
rpc: string;
|
|
32
|
+
reason: string;
|
|
33
|
+
notFound: boolean;
|
|
34
|
+
};
|
|
35
|
+
export interface KeyPageReadOptions {
|
|
36
|
+
/** The Accumulate API endpoint, e.g. `https://kermit.accumulatenetwork.io/v3`. */
|
|
37
|
+
rpc: string;
|
|
38
|
+
/** Injectable for tests; defaults to the platform `fetch`. */
|
|
39
|
+
fetch?: typeof fetch;
|
|
40
|
+
/** Default 10 seconds. */
|
|
41
|
+
timeoutMs?: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The key hashes on a key page, lower-case hex.
|
|
45
|
+
*
|
|
46
|
+
* Accumulate v3 returns `publicKeyHash` in more than one shape - a hex string, or a serialised Node Buffer (`{type:'Buffer',data:[...]}`)
|
|
47
|
+
* that leaked out of a JSON serializer - and the gateway normalises both for the same reason: a comparison that silently failed to parse
|
|
48
|
+
* one of them would report "this key is not on the page" for a key that is.
|
|
49
|
+
*/
|
|
50
|
+
export declare function keyHashesOf(account: {
|
|
51
|
+
keys?: unknown;
|
|
52
|
+
} | null | undefined): string[];
|
|
53
|
+
/**
|
|
54
|
+
* Read one key page from an Accumulate node.
|
|
55
|
+
*
|
|
56
|
+
* @throws CertenError `ACCUMULATE_RPC_INVALID` (a bad endpoint, before any request), `KEY_PAGE_NOT_FOUND` (the node has no such account) or
|
|
57
|
+
* `KEY_PAGE_UNREADABLE` (anything else: no answer, a non-200, a malformed reply, an account that is not a key page).
|
|
58
|
+
*/
|
|
59
|
+
export declare function readKeyPage(keyPageUrl: string, options: KeyPageReadOptions): Promise<KeyPageReading>;
|
|
60
|
+
/**
|
|
61
|
+
* Does this key page list this key?
|
|
62
|
+
*
|
|
63
|
+
* `keyHash` is the SHA-256 of the raw public key, hex (what `identity.create` takes as `publicKeyHash`). A malformed hash is a programming
|
|
64
|
+
* error and throws; a page that cannot be read is a result.
|
|
65
|
+
*/
|
|
66
|
+
export declare function verifyKeyPageHolds(keyPageUrl: string, keyHash: string, options: KeyPageReadOptions): Promise<KeyPageHold>;
|
|
67
|
+
//# sourceMappingURL=key-page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-page.d.ts","sourceRoot":"","sources":["../src/key-page.ts"],"names":[],"mappings":"AAgCA,MAAM,WAAW,cAAc;IAC7B,kCAAkC;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,yCAAyC;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,8DAA8D;IAC9D,SAAS,EAAE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+
const DEFAULT_TIMEOUT_MS = 10_000;
|
|
3
|
+
/** A key page is a few kilobytes. Anything past this is not one, and is not read to the end. */
|
|
4
|
+
const MAX_RESPONSE_CHARS = 1_000_000;
|
|
5
|
+
const HEX = /^[0-9a-f]+$/;
|
|
6
|
+
const hex = (bytes) => bytes.map((b) => (b & 0xff).toString(16).padStart(2, '0')).join('');
|
|
7
|
+
/**
|
|
8
|
+
* The key hashes on a key page, lower-case hex.
|
|
9
|
+
*
|
|
10
|
+
* Accumulate v3 returns `publicKeyHash` in more than one shape - a hex string, or a serialised Node Buffer (`{type:'Buffer',data:[...]}`)
|
|
11
|
+
* that leaked out of a JSON serializer - and the gateway normalises both for the same reason: a comparison that silently failed to parse
|
|
12
|
+
* one of them would report "this key is not on the page" for a key that is.
|
|
13
|
+
*/
|
|
14
|
+
export function keyHashesOf(account) {
|
|
15
|
+
const keys = account?.keys;
|
|
16
|
+
if (!Array.isArray(keys))
|
|
17
|
+
return [];
|
|
18
|
+
const out = [];
|
|
19
|
+
for (const k of keys) {
|
|
20
|
+
const raw = k?.publicKeyHash;
|
|
21
|
+
let h;
|
|
22
|
+
if (typeof raw === 'string')
|
|
23
|
+
h = raw.trim().replace(/^0x/i, '').toLowerCase();
|
|
24
|
+
else if (Array.isArray(raw))
|
|
25
|
+
h = hex(raw);
|
|
26
|
+
else if (raw && typeof raw === 'object' && Array.isArray(raw.data))
|
|
27
|
+
h = hex(raw.data);
|
|
28
|
+
if (h && h.length % 2 === 0 && HEX.test(h))
|
|
29
|
+
out.push(h);
|
|
30
|
+
}
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
33
|
+
function fail(message, code) {
|
|
34
|
+
throw new CertenError(message, 0, code);
|
|
35
|
+
}
|
|
36
|
+
function checkEndpoint(rpc) {
|
|
37
|
+
let u;
|
|
38
|
+
try {
|
|
39
|
+
u = new URL(rpc);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return fail(`certen: "${rpc}" is not a URL, so it cannot be an Accumulate API endpoint.`, 'ACCUMULATE_RPC_INVALID');
|
|
43
|
+
}
|
|
44
|
+
if (u.protocol !== 'https:' && u.protocol !== 'http:') {
|
|
45
|
+
fail(`certen: the Accumulate API endpoint must be http or https, not ${u.protocol}`, 'ACCUMULATE_RPC_INVALID');
|
|
46
|
+
}
|
|
47
|
+
// A credential in the URL would be sent on to whoever answers; there is no reason for one on a public read.
|
|
48
|
+
if (u.username || u.password) {
|
|
49
|
+
fail('certen: the Accumulate API endpoint must not carry a username or password in the URL.', 'ACCUMULATE_RPC_INVALID');
|
|
50
|
+
}
|
|
51
|
+
return u.toString();
|
|
52
|
+
}
|
|
53
|
+
const asNumber = (v) => {
|
|
54
|
+
if (v === undefined || v === null || v === '')
|
|
55
|
+
return null;
|
|
56
|
+
const n = Number(v);
|
|
57
|
+
return Number.isFinite(n) ? n : null;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Read one key page from an Accumulate node.
|
|
61
|
+
*
|
|
62
|
+
* @throws CertenError `ACCUMULATE_RPC_INVALID` (a bad endpoint, before any request), `KEY_PAGE_NOT_FOUND` (the node has no such account) or
|
|
63
|
+
* `KEY_PAGE_UNREADABLE` (anything else: no answer, a non-200, a malformed reply, an account that is not a key page).
|
|
64
|
+
*/
|
|
65
|
+
export async function readKeyPage(keyPageUrl, options) {
|
|
66
|
+
if (!/^acc:\/\/\S+$/i.test(keyPageUrl)) {
|
|
67
|
+
fail(`certen: "${keyPageUrl}" is not an Accumulate URL (acc://...), so it cannot be a key page.`, 'KEY_PAGE_UNREADABLE');
|
|
68
|
+
}
|
|
69
|
+
const endpoint = checkEndpoint(options.rpc);
|
|
70
|
+
const doFetch = options.fetch ?? (typeof fetch === 'function' ? fetch : undefined);
|
|
71
|
+
if (!doFetch)
|
|
72
|
+
fail('certen: this environment has no fetch, so the Accumulate node cannot be asked.', 'KEY_PAGE_UNREADABLE');
|
|
73
|
+
const controller = new AbortController();
|
|
74
|
+
const timer = setTimeout(() => controller.abort(), options.timeoutMs ?? DEFAULT_TIMEOUT_MS);
|
|
75
|
+
let text;
|
|
76
|
+
try {
|
|
77
|
+
const res = await doFetch(endpoint, {
|
|
78
|
+
method: 'POST',
|
|
79
|
+
headers: { 'content-type': 'application/json' },
|
|
80
|
+
// The same request the gateway makes for the same page.
|
|
81
|
+
body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'query', params: { scope: keyPageUrl } }),
|
|
82
|
+
// A node that redirects is not the node that was named. Not followed.
|
|
83
|
+
redirect: 'error',
|
|
84
|
+
signal: controller.signal,
|
|
85
|
+
});
|
|
86
|
+
if (!res.ok)
|
|
87
|
+
fail(`certen: the Accumulate node at ${endpoint} answered HTTP ${res.status}.`, 'KEY_PAGE_UNREADABLE');
|
|
88
|
+
text = await res.text();
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
if (err instanceof CertenError)
|
|
92
|
+
throw err;
|
|
93
|
+
const why = controller.signal.aborted
|
|
94
|
+
? `did not answer within ${(options.timeoutMs ?? DEFAULT_TIMEOUT_MS) / 1000}s`
|
|
95
|
+
: err instanceof Error ? err.message : String(err);
|
|
96
|
+
return fail(`certen: the Accumulate node at ${endpoint} ${why}`, 'KEY_PAGE_UNREADABLE');
|
|
97
|
+
}
|
|
98
|
+
finally {
|
|
99
|
+
clearTimeout(timer);
|
|
100
|
+
}
|
|
101
|
+
if (text.length > MAX_RESPONSE_CHARS) {
|
|
102
|
+
fail(`certen: the Accumulate node at ${endpoint} sent a reply too large to be a key page.`, 'KEY_PAGE_UNREADABLE');
|
|
103
|
+
}
|
|
104
|
+
let body;
|
|
105
|
+
try {
|
|
106
|
+
body = JSON.parse(text);
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return fail(`certen: the Accumulate node at ${endpoint} did not answer with JSON.`, 'KEY_PAGE_UNREADABLE');
|
|
110
|
+
}
|
|
111
|
+
if (body?.error) {
|
|
112
|
+
const message = typeof body.error.message === 'string' ? body.error.message : JSON.stringify(body.error);
|
|
113
|
+
fail(`certen: the Accumulate node at ${endpoint} could not read ${keyPageUrl}: ${message}`, /not found|does not exist|no such/i.test(message) ? 'KEY_PAGE_NOT_FOUND' : 'KEY_PAGE_UNREADABLE');
|
|
114
|
+
}
|
|
115
|
+
const account = body?.result?.account;
|
|
116
|
+
if (!account || typeof account !== 'object') {
|
|
117
|
+
return fail(`certen: the Accumulate node at ${endpoint} returned no account record for ${keyPageUrl}.`, 'KEY_PAGE_UNREADABLE');
|
|
118
|
+
}
|
|
119
|
+
if (account.type !== undefined && account.type !== 'keyPage') {
|
|
120
|
+
fail(`certen: ${keyPageUrl} is a ${String(account.type)} on Accumulate, not a key page.`, 'KEY_PAGE_UNREADABLE');
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
url: keyPageUrl,
|
|
124
|
+
rpc: endpoint,
|
|
125
|
+
keyHashes: keyHashesOf(account),
|
|
126
|
+
creditBalance: asNumber(account.creditBalance),
|
|
127
|
+
version: asNumber(account.version),
|
|
128
|
+
acceptThreshold: asNumber(account.acceptThreshold),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Does this key page list this key?
|
|
133
|
+
*
|
|
134
|
+
* `keyHash` is the SHA-256 of the raw public key, hex (what `identity.create` takes as `publicKeyHash`). A malformed hash is a programming
|
|
135
|
+
* error and throws; a page that cannot be read is a result.
|
|
136
|
+
*/
|
|
137
|
+
export async function verifyKeyPageHolds(keyPageUrl, keyHash, options) {
|
|
138
|
+
const want = keyHash.trim().replace(/^0x/i, '').toLowerCase();
|
|
139
|
+
if (want.length !== 64 || !HEX.test(want)) {
|
|
140
|
+
throw new CertenError(`certen: "${keyHash}" is not a key hash. Expected 64 hex characters (SHA-256 of the public key).`, 0, 'INVALID_KEY_HASH');
|
|
141
|
+
}
|
|
142
|
+
let reading;
|
|
143
|
+
try {
|
|
144
|
+
reading = await readKeyPage(keyPageUrl, options);
|
|
145
|
+
}
|
|
146
|
+
catch (err) {
|
|
147
|
+
if (err instanceof CertenError && err.code !== 'ACCUMULATE_RPC_INVALID') {
|
|
148
|
+
return { state: 'unreadable', rpc: options.rpc, reason: err.message.replace(/^certen: /, ''), notFound: err.code === 'KEY_PAGE_NOT_FOUND' };
|
|
149
|
+
}
|
|
150
|
+
throw err;
|
|
151
|
+
}
|
|
152
|
+
return { state: reading.keyHashes.includes(want) ? 'holds' : 'absent', reading };
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=key-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-page.js","sourceRoot":"","sources":["../src/key-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAkE1C,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,gGAAgG;AAChG,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAErC,MAAM,GAAG,GAAG,aAAa,CAAC;AAE1B,MAAM,GAAG,GAAG,CAAC,KAAe,EAAU,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAE7G;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,OAA8C;IACxE,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,CAAC;IAC3B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IACpC,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACrB,MAAM,GAAG,GAAI,CAAwC,EAAE,aAAa,CAAC;QACrE,IAAI,CAAqB,CAAC;QAC1B,IAAI,OAAO,GAAG,KAAK,QAAQ;YAAE,CAAC,G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+
/**
|
|
4
|
+
* Is this identity, on this chain, able to act right now - and if not, what is the first thing in the way?
|
|
5
|
+
*
|
|
6
|
+
* Readiness used to be scattered. `doctor` answered org-wide questions ("some identity can sign", "every chain account has gas") and
|
|
7
|
+
* nothing answered the one a person has when they are about to send: *the identity and chain I am about to use*. The checks that
|
|
8
|
+
* decide whether an intent will execute were spread across three places that each saw a slice - the gateway's `can_sign` (one party's
|
|
9
|
+
* word on the key page), the funding guard (refuses only on a zero it has observed), and a hand-written `curl` in the docs. This is
|
|
10
|
+
* those, ordered by dependency, in one list a CLI card, an agent and the MCP server can all render.
|
|
11
|
+
*
|
|
12
|
+
* **Unknown is not OK.** A check that could not be answered is `unknown`, and the list is `ready` only when every check is `ok` or `warn`.
|
|
13
|
+
* That is deliberately stricter than the submit-time funding guard, which does not block on a balance it cannot read: a guard that
|
|
14
|
+
* blocked on a lagging view would refuse legitimate work, but a readiness card that said "ready" over a balance nobody read would be
|
|
15
|
+
* a lie. The two are different questions and are allowed to give different answers.
|
|
16
|
+
*
|
|
17
|
+
* **Ordered by dependency, and a failed prerequisite skips what it gates.** Nothing below an unreachable gateway or a rejected
|
|
18
|
+
* credential is meaningful, so it is reported as `skipped` rather than omitted: a list whose length depends on how far the run got is
|
|
19
|
+
* one a caller cannot index into.
|
|
20
|
+
*
|
|
21
|
+
* **Never throws for a failed check.** Like `doctor()`, a diagnosis that cannot report a broken setup is useless. It throws only for a
|
|
22
|
+
* malformed call (no identity, no chain).
|
|
23
|
+
*
|
|
24
|
+
* **Fixes are stated in plain words.** This module does not know it is being driven by a CLI and never names one; the CLI adds the command
|
|
25
|
+
* for a check's `code`, as `doctor` does. A `fix.url` is only ever one the SDK itself knows (a chain's faucet).
|
|
26
|
+
*/
|
|
27
|
+
export type ReadinessStatus = 'ok' | 'warn' | 'fail' | 'unknown' | 'skipped';
|
|
28
|
+
export interface ReadinessFix {
|
|
29
|
+
/** What resolves it, in words. */
|
|
30
|
+
text: string;
|
|
31
|
+
/** A command that performs it. Set by a CLI, never by the SDK. */
|
|
32
|
+
command?: string;
|
|
33
|
+
/** Somewhere to do it. */
|
|
34
|
+
url?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface ReadinessCheck {
|
|
37
|
+
name: string;
|
|
38
|
+
status: ReadinessStatus;
|
|
39
|
+
detail: string;
|
|
40
|
+
/** Machine-readable reason, on every check that is not `ok`. Stable: a caller may branch on it. */
|
|
41
|
+
code?: string;
|
|
42
|
+
/** Absent when the check passed. */
|
|
43
|
+
fix?: ReadinessFix;
|
|
44
|
+
/** The facts the verdict was drawn from, for a machine caller that would otherwise parse `detail`. Open: fields are only ever added. */
|
|
45
|
+
data?: Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
export type ReadinessState = 'ready' | 'blocked' | 'unconfirmed';
|
|
48
|
+
export interface ReadinessContext {
|
|
49
|
+
identity_id: string;
|
|
50
|
+
adi_url: string | null;
|
|
51
|
+
key_page_url: string | null;
|
|
52
|
+
chain: string;
|
|
53
|
+
/** The identity's abstract account on `chain`, once known. */
|
|
54
|
+
abstract_account: string | null;
|
|
55
|
+
/** The Accumulate node the independent key page read used, or null when none was made. */
|
|
56
|
+
accumulate_rpc: string | null;
|
|
57
|
+
key_hash: string | null;
|
|
58
|
+
}
|
|
59
|
+
export interface Readiness {
|
|
60
|
+
/** True only when `state` is `ready`: every check is `ok` or `warn`. */
|
|
61
|
+
ready: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* `blocked`: something failed. `unconfirmed`: nothing failed, but something could not be answered (`unknown`) or was not evaluated
|
|
64
|
+
* (`skipped`). Never `ready` over a gap.
|
|
65
|
+
*/
|
|
66
|
+
state: ReadinessState;
|
|
67
|
+
/** The first `fail`, else the first `unknown` / `skipped`; null when ready. */
|
|
68
|
+
first_blocker: ReadinessCheck | null;
|
|
69
|
+
/** Ordered by dependency; the same length however far the run got. */
|
|
70
|
+
checks: ReadinessCheck[];
|
|
71
|
+
context: ReadinessContext;
|
|
72
|
+
}
|
|
73
|
+
export interface ReadinessParams {
|
|
74
|
+
/** The identity's UUID. Resolving an ADI URL or a name is the caller's job: the gateway's identity routes take a UUID. */
|
|
75
|
+
identityId: string;
|
|
76
|
+
/** The chain about to be used, as a slug or a numeric id. */
|
|
77
|
+
chain: string;
|
|
78
|
+
/**
|
|
79
|
+
* SHA-256 of the signing key's raw public key, hex. Without it the key page can still be read but not compared with a key, and the check
|
|
80
|
+
* says so (`warn`) instead of claiming the page holds one.
|
|
81
|
+
*/
|
|
82
|
+
keyHash?: string;
|
|
83
|
+
/** The native amount about to be moved, in whole units. Judged together with the gas reserve. */
|
|
84
|
+
amount?: string;
|
|
85
|
+
/** The token being moved. When it is not the chain's native token, the amount is not counted against the gas balance. */
|
|
86
|
+
tokenSymbol?: string;
|
|
87
|
+
/** Override the catalogue's gas reserve (whole native units); `null` for none. An estimate either way. */
|
|
88
|
+
gasReserve?: string | null;
|
|
89
|
+
/** The Accumulate API endpoint for the independent key page read. Default: the `accumulate.api` the gateway's chain registry advertises. */
|
|
90
|
+
accumulateRpc?: string;
|
|
91
|
+
/** The chains this client may use. Default: every catalogue chain that is not retired. */
|
|
92
|
+
configuredChains?: readonly string[];
|
|
93
|
+
/**
|
|
94
|
+
* `full` (the default) also checks the gateway, the credential and the organization's balance. `context` runs only what depends on the
|
|
95
|
+
* identity and chain, for a caller (such as `doctor`) that has already made the org-wide checks.
|
|
96
|
+
*/
|
|
97
|
+
scope?: 'full' | 'context';
|
|
98
|
+
/**
|
|
99
|
+
* A chain registry the caller has already read (`doctor()` hands one back). The registry is a public document that changes rarely, and a caller
|
|
100
|
+
* that holds it should not pay for it again. Omitted, it is read. Used only with `scope: 'context'`: a `full` run's `gateway` check is the
|
|
101
|
+
* read of it, and a gateway reported reachable on the strength of an earlier read would be a claim nobody just checked.
|
|
102
|
+
*/
|
|
103
|
+
registry?: ChainsListResponse;
|
|
104
|
+
/** Injectable for tests; defaults to the platform `fetch`. Used only for the Accumulate read. */
|
|
105
|
+
fetch?: typeof fetch;
|
|
106
|
+
/** How long to wait for the Accumulate node (default 10s). */
|
|
107
|
+
accumulateTimeoutMs?: number;
|
|
108
|
+
}
|
|
109
|
+
/** Every name `runReadiness` can emit, in the order it emits them. */
|
|
110
|
+
export declare const READINESS_CHECKS: readonly ["gateway", "credential", "identity", "chain", "key page", "accumulate credits", "gateway balance", "gas"];
|
|
111
|
+
/** The checks that depend on the identity and chain, as opposed to the organization. What `scope: 'context'` returns. */
|
|
112
|
+
export declare const CONTEXT_CHECKS: readonly ["identity", "chain", "key page", "accumulate credits", "gas"];
|
|
113
|
+
export declare function runReadiness(client: CertenClient, params: ReadinessParams): Promise<Readiness>;
|
|
114
|
+
/**
|
|
115
|
+
* The gas check on its own: the same judgement `runReadiness` makes, for a caller that is waiting for one number to change.
|
|
116
|
+
*
|
|
117
|
+
* `setup --wait-for-funds` and `gas --wait` poll this, not the whole of `readiness()`: the rest of it (the registry, the Accumulate key page,
|
|
118
|
+
* the organization's balance) cannot change while someone is sending gas from a faucet, and asking again every few seconds would be noise
|
|
119
|
+
* on the gateway and on a public Accumulate node. It is the SAME function `runReadiness` calls, so the wait and `status` cannot disagree
|
|
120
|
+
* about when an account counts as funded.
|
|
121
|
+
*
|
|
122
|
+
* Never throws for a read that failed: that is an `unknown` check carrying the HTTP status in `data.status`, so a poller can tell a
|
|
123
|
+
* rejected credential (stop) from a gateway having a bad moment (carry on). It throws only for a malformed call.
|
|
124
|
+
*/
|
|
125
|
+
export declare function checkGas(client: CertenClient, params: Pick<ReadinessParams, 'identityId' | 'chain' | 'amount' | 'tokenSymbol' | 'gasReserve'>): Promise<ReadinessCheck>;
|
|
126
|
+
/**
|
|
127
|
+
* The verdict a list of checks adds up to.
|
|
128
|
+
*
|
|
129
|
+
* Exported because a caller that adds a check of its own - the CLI adds "is there a signing key on this machine", which the SDK cannot see -
|
|
130
|
+
* must get the verdict from the same rule rather than restate it.
|
|
131
|
+
*/
|
|
132
|
+
export declare function summarizeReadiness(checks: readonly ReadinessCheck[]): Pick<Readiness, 'ready' | 'state' | 'first_blocker'>;
|
|
133
|
+
//# sourceMappingURL=readiness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readiness.d.ts","sourceRoot":"","sources":["../src/readiness.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQhD,OAAO,KAAK,EAAmB,kBAAkB,EAAoB,MAAM,YAAY,CAAC;AAExF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;AAE7E,MAAM,WAAW,YAAY;IAC3B,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0BAA0B;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,mGAAmG;IACnG,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,GAAG,CAAC,EAAE,YAAY,CAAC;IACnB,wIAAwI;IACxI,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,aAAa,CAAC;AAEjE,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,0FAA0F;IAC1F,cAAc,EAAE,MAA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