@certen.io/sdk 0.4.0 → 0.7.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 +874 -185
- package/README.md +133 -119
- package/dist/client.d.ts +99 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +269 -20
- package/dist/client.js.map +1 -1
- package/dist/doctor.d.ts +53 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +451 -0
- package/dist/doctor.js.map +1 -0
- package/dist/error-codes.d.ts +14 -0
- package/dist/error-codes.d.ts.map +1 -0
- package/dist/error-codes.js +55 -0
- package/dist/error-codes.js.map +1 -0
- package/dist/errors.d.ts +91 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +130 -1
- package/dist/errors.js.map +1 -1
- package/dist/funding.d.ts +43 -0
- package/dist/funding.d.ts.map +1 -0
- package/dist/funding.js +116 -0
- package/dist/funding.js.map +1 -0
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -1
- package/dist/index.js.map +1 -1
- package/dist/oauth.d.ts +56 -0
- package/dist/oauth.d.ts.map +1 -0
- package/dist/oauth.js +68 -0
- package/dist/oauth.js.map +1 -0
- package/dist/registration.d.ts +33 -0
- package/dist/registration.d.ts.map +1 -0
- package/dist/registration.js +49 -0
- package/dist/registration.js.map +1 -0
- package/dist/resources/admin.d.ts +52 -1
- package/dist/resources/admin.d.ts.map +1 -1
- package/dist/resources/admin.js +55 -0
- package/dist/resources/admin.js.map +1 -1
- package/dist/resources/billing.d.ts +242 -0
- package/dist/resources/billing.d.ts.map +1 -0
- package/dist/resources/billing.js +376 -0
- package/dist/resources/billing.js.map +1 -0
- package/dist/resources/chains.d.ts +38 -0
- package/dist/resources/chains.d.ts.map +1 -0
- package/dist/resources/chains.js +46 -0
- package/dist/resources/chains.js.map +1 -0
- package/dist/resources/device.d.ts +43 -0
- package/dist/resources/device.d.ts.map +1 -0
- package/dist/resources/device.js +49 -0
- package/dist/resources/device.js.map +1 -0
- package/dist/resources/execute.d.ts +39 -1
- package/dist/resources/execute.d.ts.map +1 -1
- package/dist/resources/execute.js +41 -1
- package/dist/resources/execute.js.map +1 -1
- package/dist/resources/health.d.ts +34 -0
- package/dist/resources/health.d.ts.map +1 -0
- package/dist/resources/health.js +43 -0
- package/dist/resources/health.js.map +1 -0
- package/dist/resources/identity.d.ts +83 -2
- package/dist/resources/identity.d.ts.map +1 -1
- package/dist/resources/identity.js +154 -2
- package/dist/resources/identity.js.map +1 -1
- package/dist/resources/oauth-clients.d.ts +71 -0
- package/dist/resources/oauth-clients.d.ts.map +1 -0
- package/dist/resources/oauth-clients.js +75 -0
- package/dist/resources/oauth-clients.js.map +1 -0
- package/dist/resources/pending.d.ts +13 -1
- package/dist/resources/pending.d.ts.map +1 -1
- package/dist/resources/pending.js +15 -0
- package/dist/resources/pending.js.map +1 -1
- package/dist/resources/proof.d.ts +75 -0
- package/dist/resources/proof.d.ts.map +1 -0
- package/dist/resources/proof.js +103 -0
- package/dist/resources/proof.js.map +1 -0
- package/dist/resources/registration-tokens.d.ts +51 -0
- package/dist/resources/registration-tokens.d.ts.map +1 -0
- package/dist/resources/registration-tokens.js +54 -0
- package/dist/resources/registration-tokens.js.map +1 -0
- package/dist/resources/transaction.d.ts +20 -0
- package/dist/resources/transaction.d.ts.map +1 -1
- package/dist/resources/transaction.js +28 -0
- package/dist/resources/transaction.js.map +1 -1
- package/dist/resources/transparency.d.ts +68 -0
- package/dist/resources/transparency.d.ts.map +1 -0
- package/dist/resources/transparency.js +83 -0
- package/dist/resources/transparency.js.map +1 -0
- package/dist/resources/webhooks.d.ts +97 -0
- package/dist/resources/webhooks.d.ts.map +1 -0
- package/dist/resources/webhooks.js +112 -0
- package/dist/resources/webhooks.js.map +1 -0
- package/dist/self-signup.d.ts +66 -0
- package/dist/self-signup.d.ts.map +1 -0
- package/dist/self-signup.js +76 -0
- package/dist/self-signup.js.map +1 -0
- package/dist/shared-proof.d.ts +34 -0
- package/dist/shared-proof.d.ts.map +1 -0
- package/dist/shared-proof.js +78 -0
- package/dist/shared-proof.js.map +1 -0
- package/dist/types.d.ts +901 -24
- package/dist/types.d.ts.map +1 -1
- package/dist/verify-receipt.d.ts +32 -0
- package/dist/verify-receipt.d.ts.map +1 -0
- package/dist/verify-receipt.js +176 -0
- package/dist/verify-receipt.js.map +1 -0
- package/package.json +6 -5
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How this client authenticates. Exactly one of these three is needed.
|
|
3
|
+
*
|
|
4
|
+
* An API key is minted by a human in a portal or by approving a device — correct for a developer at
|
|
5
|
+
* a terminal, and a dead end for anything unattended. OAuth client credentials are the machine
|
|
6
|
+
* path: a human creates the client ONCE, and every process holding its id and secret authenticates
|
|
7
|
+
* itself from then on, with no browser and nobody to wake up.
|
|
8
|
+
*/
|
|
1
9
|
export interface CertenClientOptions {
|
|
2
|
-
|
|
10
|
+
/** A key from the portal or `certen login`. */
|
|
11
|
+
apiKey?: string;
|
|
12
|
+
/**
|
|
13
|
+
* An OAuth2 access token you already hold. Sent as `Authorization: Bearer`.
|
|
14
|
+
*
|
|
15
|
+
* Expires in an hour and is NOT refreshed for you — pass `clientId`/`clientSecret` instead unless
|
|
16
|
+
* you are managing the lifecycle yourself.
|
|
17
|
+
*/
|
|
18
|
+
accessToken?: string;
|
|
19
|
+
/**
|
|
20
|
+
* OAuth2 client credentials. **The unattended path.**
|
|
21
|
+
*
|
|
22
|
+
* The client mints its own access token on first use and re-mints before expiry, so a long-lived
|
|
23
|
+
* process keeps working without anyone touching it. The secret never leaves this machine — only
|
|
24
|
+
* short-lived tokens go on the wire — and revoking the client kills every token it issued.
|
|
25
|
+
*
|
|
26
|
+
* Create one with `certen oauth-clients create --scopes …`, or `client.oauthClients.create()`.
|
|
27
|
+
*/
|
|
28
|
+
clientId?: string;
|
|
29
|
+
clientSecret?: string;
|
|
30
|
+
/** Narrow what the minted token may do, within what the client was granted. */
|
|
31
|
+
scope?: string;
|
|
3
32
|
baseUrl?: string;
|
|
4
33
|
/**
|
|
5
34
|
* Per-request timeout in ms. Default 30_000.
|
|
@@ -26,7 +55,14 @@ export interface CreateIdentityParams {
|
|
|
26
55
|
chains?: string[];
|
|
27
56
|
credits?: number;
|
|
28
57
|
signingMode?: 'external' | 'provider';
|
|
29
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Provider configuration — an OBJECT.
|
|
60
|
+
*
|
|
61
|
+
* This was declared `string` while the endpoint's schema is `{ type: 'object' }`, so passing a
|
|
62
|
+
* provider name rejected with a 400 pointing at a field the caller believed they had set
|
|
63
|
+
* correctly. Open-ended because the schema is `additionalProperties: true`.
|
|
64
|
+
*/
|
|
65
|
+
signingProvider?: Record<string, unknown>;
|
|
30
66
|
idempotencyKey?: string;
|
|
31
67
|
}
|
|
32
68
|
/**
|
|
@@ -55,17 +91,40 @@ export interface Identity {
|
|
|
55
91
|
key_page_url: string | null;
|
|
56
92
|
status: string;
|
|
57
93
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
94
|
+
* Is this identity's key actually on its on-chain key page?
|
|
95
|
+
*
|
|
96
|
+
* `null` means the key page could not be read — **unknown, not usable**. Never treat null as a
|
|
97
|
+
* soft yes; an Accumulate outage is exactly when a caller most needs to be told "I don't know".
|
|
98
|
+
*
|
|
99
|
+
* Before 0.5.0 the gateway derived this from a database column (whether a `public_key` had been
|
|
100
|
+
* supplied), so it read `true` from the moment the identity row existed — including for an
|
|
101
|
+
* identity whose provisioning had failed halfway and whose on-chain key page was held by the
|
|
102
|
+
* CERTEN sponsor key rather than the customer's. It reported the reassuring answer on the one
|
|
103
|
+
* failure where the distinction matters. It now reflects the chain.
|
|
60
104
|
*/
|
|
61
|
-
can_sign?: boolean;
|
|
105
|
+
can_sign?: boolean | null;
|
|
62
106
|
error_message?: string | null;
|
|
63
107
|
credit_balance: number;
|
|
64
108
|
chain_accounts: ChainAccount[];
|
|
65
109
|
created_at: string;
|
|
66
110
|
}
|
|
67
|
-
|
|
68
|
-
|
|
111
|
+
/**
|
|
112
|
+
* What the identity endpoints return: the identity's own fields, plus the joined sub-resources.
|
|
113
|
+
*
|
|
114
|
+
* `extends Identity` rather than `{ identity: Identity }`. The gateway used to nest the identity
|
|
115
|
+
* under an `identity` key on create, read and update, which made those the odd ones out —
|
|
116
|
+
* `GET /v1/transaction/{id}` returns its fields bare and nests only the joined `proof`, and most of
|
|
117
|
+
* the surface does the same. Two shapes for one idea meant a caller had to memorise which reads
|
|
118
|
+
* were wrapped and which were bare, with no rule available to learn.
|
|
119
|
+
*
|
|
120
|
+
* Flattened in the gateway's 2026-08 break, taken while there were no external integrators — the
|
|
121
|
+
* only moment it is cheap. `governance`, `balances` and `pending` stay nested, because that IS the
|
|
122
|
+
* convention: a response carries its own fields bare and names anything joined onto it.
|
|
123
|
+
*
|
|
124
|
+
* **Migrating:** `result.identity.id` becomes `result.id`. If you need the identity alone, it is
|
|
125
|
+
* structurally the same object — `const identity: Identity = result`.
|
|
126
|
+
*/
|
|
127
|
+
export interface IdentityResponse extends Identity {
|
|
69
128
|
signing_mode?: string;
|
|
70
129
|
signing_provider?: unknown;
|
|
71
130
|
/** Only on create, and only once — the URL stops working after it is read. */
|
|
@@ -73,6 +132,21 @@ export interface IdentityResponse {
|
|
|
73
132
|
url: string;
|
|
74
133
|
expires_in: number;
|
|
75
134
|
};
|
|
135
|
+
/** Where to poll. Only on create. */
|
|
136
|
+
status_url?: string;
|
|
137
|
+
/**
|
|
138
|
+
* How to wait, published by the gateway so no client has to invent a cadence. Only on create.
|
|
139
|
+
*
|
|
140
|
+
* `first_poll_after_seconds` is the one that matters: provisioning is a chain of Accumulate
|
|
141
|
+
* transactions that each wait for the previous to anchor, so polling before then only spends
|
|
142
|
+
* requests. `createAndWait()` honours this automatically.
|
|
143
|
+
*/
|
|
144
|
+
polling?: {
|
|
145
|
+
first_poll_after_seconds: number;
|
|
146
|
+
interval_seconds: number;
|
|
147
|
+
estimated_ready_in_seconds: number;
|
|
148
|
+
terminal_states: string[];
|
|
149
|
+
};
|
|
76
150
|
warning?: string;
|
|
77
151
|
/**
|
|
78
152
|
* Free-form: the gateway serializes this subtree with mixed casing (`key_books` holds
|
|
@@ -125,9 +199,35 @@ export interface ListIdentitiesParams {
|
|
|
125
199
|
* Left open (`[k: string]: unknown`) deliberately: the gateway's own schema is `additionalProperties: true`
|
|
126
200
|
* here, and a narrower type in the SDK than on the server would reject payloads the API accepts.
|
|
127
201
|
*/
|
|
202
|
+
/**
|
|
203
|
+
* How the proof cycle is scheduled. It changes WHEN the proof is produced, never what it proves.
|
|
204
|
+
*
|
|
205
|
+
* - `on_demand` (default) — starts immediately, completes in roughly 60–110 seconds. Use it for
|
|
206
|
+
* anything a user or counterparty is waiting on.
|
|
207
|
+
* - `on_cadence` — batched with other proofs by the validators. Cheaper per proof, higher latency.
|
|
208
|
+
* Use it for bulk settlement where nobody is watching the clock.
|
|
209
|
+
*
|
|
210
|
+
* A union rather than `string` because the two values are the whole vocabulary, and a typo previously
|
|
211
|
+
* passed the gateway's validation and failed downstream in the proof service, far from its cause.
|
|
212
|
+
*/
|
|
213
|
+
export type ProofClass = 'on_demand' | 'on_cadence';
|
|
128
214
|
export interface TransactionIntent {
|
|
129
215
|
[k: string]: unknown;
|
|
130
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* Per-deployment CERTEN contract addresses, keyed by role.
|
|
219
|
+
*
|
|
220
|
+
* Open-ended because the gateway's schema is `additionalProperties: true` — a narrower type here
|
|
221
|
+
* than on the server would reject payloads the API accepts.
|
|
222
|
+
*/
|
|
223
|
+
export interface ContractAddresses {
|
|
224
|
+
anchor?: string;
|
|
225
|
+
anchorV2?: string;
|
|
226
|
+
abstractAccount?: string;
|
|
227
|
+
entryPoint?: string;
|
|
228
|
+
factory?: string;
|
|
229
|
+
[k: string]: unknown;
|
|
230
|
+
}
|
|
131
231
|
export interface ContractCall {
|
|
132
232
|
target: string;
|
|
133
233
|
functionSignature: string;
|
|
@@ -155,8 +255,19 @@ export interface CreateTransactionParams {
|
|
|
155
255
|
identityId: string;
|
|
156
256
|
/** REQUIRED by the API. */
|
|
157
257
|
intent: TransactionIntent;
|
|
158
|
-
|
|
159
|
-
|
|
258
|
+
/**
|
|
259
|
+
* Per-deployment contract addresses. An OBJECT keyed by role, not a list.
|
|
260
|
+
*
|
|
261
|
+
* This was declared as `string[]`, and `execute.contractCall` sent `[target]`. The endpoint
|
|
262
|
+
* requires an object and rejects an array outright — `/contract_addresses must be object` — so
|
|
263
|
+
* every call carrying it failed with a 400 that named a field the caller never set by hand.
|
|
264
|
+
* The gateway applies sensible defaults when it is omitted, which is why omitting it works and
|
|
265
|
+
* is the right default.
|
|
266
|
+
*
|
|
267
|
+
* Only set this to point at a non-standard deployment of the CERTEN contracts.
|
|
268
|
+
*/
|
|
269
|
+
contractAddresses?: ContractAddresses;
|
|
270
|
+
proofClass?: ProofClass;
|
|
160
271
|
/** Which key PAGE signs, e.g. `acc://org.acme/book/2`. Must be in the same book. */
|
|
161
272
|
signerKeyPage?: string;
|
|
162
273
|
/** Which SEAT on the page signs, 64 hex. Defaults to the identity's bound key. */
|
|
@@ -205,28 +316,44 @@ export interface CreateTransactionResponse {
|
|
|
205
316
|
signing_mode?: 'external' | 'provider';
|
|
206
317
|
/** Absent in provider mode — there is nothing for you to sign. */
|
|
207
318
|
signing_data?: IntentSigningData;
|
|
208
|
-
submit_url?: string;
|
|
209
|
-
|
|
210
|
-
|
|
319
|
+
submit_url?: string | null;
|
|
320
|
+
/**
|
|
321
|
+
* Null on an idempotent replay of an intent that has not been submitted yet — the echo carries
|
|
322
|
+
* the stored row, and these columns are null until the transaction reaches Accumulate.
|
|
323
|
+
*/
|
|
324
|
+
tx_hash?: string | null;
|
|
325
|
+
proof_id?: string | null;
|
|
211
326
|
/** True when this is an idempotent replay echoing the original intent. */
|
|
212
327
|
idempotent?: boolean;
|
|
213
328
|
}
|
|
214
|
-
/**
|
|
329
|
+
/**
|
|
330
|
+
* Response to `GET /v1/transaction/{id}`.
|
|
331
|
+
*
|
|
332
|
+
* The `| null` on several fields is not defensive typing. The gateway declared them
|
|
333
|
+
* `type: 'string'` in its response schema, and fast-json-stringify coerces a null to `""` rather
|
|
334
|
+
* than rejecting it — so a transaction with no proof reported `proof_id: ""`, on all 205 intents in
|
|
335
|
+
* the production table. The gateway now declares those fields nullable and returns a real null, and
|
|
336
|
+
* these types say so. A caller writing `tx.proof_id != null` gets the right answer on both, which
|
|
337
|
+
* was not true of `""`.
|
|
338
|
+
*/
|
|
215
339
|
export interface TransactionResponse {
|
|
216
340
|
intent_id: string;
|
|
217
341
|
identity_id: string;
|
|
218
342
|
status: string;
|
|
219
343
|
intent_type?: string;
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
344
|
+
/** Null until the intent has been submitted to Accumulate. */
|
|
345
|
+
accum_tx_hash?: string | null;
|
|
346
|
+
/** Null until the proof cycle completes. Absent is the same as null here. */
|
|
347
|
+
proof_id?: string | null;
|
|
348
|
+
proof_bundle_url?: string | null;
|
|
223
349
|
error_message?: string | null;
|
|
224
350
|
created_at: string;
|
|
225
351
|
updated_at?: string;
|
|
226
|
-
|
|
352
|
+
/** Null while the transaction is still in flight — the gateway has always sent a real null here. */
|
|
353
|
+
completed_at?: string | null;
|
|
227
354
|
proof?: {
|
|
228
355
|
id: string;
|
|
229
|
-
bundle_url?: string;
|
|
356
|
+
bundle_url?: string | null;
|
|
230
357
|
layers?: unknown;
|
|
231
358
|
governance?: unknown;
|
|
232
359
|
attestations?: unknown;
|
|
@@ -236,6 +363,8 @@ export interface ListTransactionsResponse {
|
|
|
236
363
|
transactions: TransactionResponse[];
|
|
237
364
|
limit: number;
|
|
238
365
|
offset: number;
|
|
366
|
+
/** Loop until `has_more` is false. Absent on a gateway older than 2026-08. */
|
|
367
|
+
pagination?: Pagination;
|
|
239
368
|
}
|
|
240
369
|
/** Response to `POST /v1/transaction/{id}/signature`. */
|
|
241
370
|
export interface SubmitSignatureResponse {
|
|
@@ -389,6 +518,15 @@ export interface ChainBalance {
|
|
|
389
518
|
}[];
|
|
390
519
|
}
|
|
391
520
|
export interface PortfolioIdentity {
|
|
521
|
+
/**
|
|
522
|
+
* The UUID the other identity routes take.
|
|
523
|
+
*
|
|
524
|
+
* Added in the gateway's 2026-08 release. There is no identity collection endpoint, so
|
|
525
|
+
* `portfolio.get()` is the only way to enumerate an org's identities — and without the id it
|
|
526
|
+
* could not answer the question people actually reach for it with, since the UUID is shown once
|
|
527
|
+
* at create time and every other route is keyed by it. Absent when talking to an older gateway.
|
|
528
|
+
*/
|
|
529
|
+
id?: string;
|
|
392
530
|
adi_url: string;
|
|
393
531
|
status: string;
|
|
394
532
|
credit_balance: number;
|
|
@@ -404,13 +542,18 @@ export interface CreateOrgParams {
|
|
|
404
542
|
plan?: string;
|
|
405
543
|
webhookUrl?: string;
|
|
406
544
|
}
|
|
545
|
+
/**
|
|
546
|
+
* The organization's own fields, at the top level.
|
|
547
|
+
*
|
|
548
|
+
* Nested under `organization` until the gateway's 2026-08 break — one of four operations that
|
|
549
|
+
* wrapped their resource while the rest of the surface returned it bare. See the note on
|
|
550
|
+
* `IdentityResponse`.
|
|
551
|
+
*/
|
|
407
552
|
export interface OrgResponse {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
created_at: string;
|
|
413
|
-
};
|
|
553
|
+
id: string;
|
|
554
|
+
name: string;
|
|
555
|
+
plan: string;
|
|
556
|
+
created_at: string;
|
|
414
557
|
}
|
|
415
558
|
export interface CreateApiKeyParams {
|
|
416
559
|
name: string;
|
|
@@ -479,4 +622,738 @@ export interface UsageSummaryResponse {
|
|
|
479
622
|
count: number;
|
|
480
623
|
}[];
|
|
481
624
|
}
|
|
625
|
+
/** One priced operation, on one chain. */
|
|
626
|
+
export interface PricingItem {
|
|
627
|
+
/** e.g. `identity.provision`, `account.deploy`, `proof.execute`. */
|
|
628
|
+
sku: string;
|
|
629
|
+
/** The chain it applies to. `"*"` is the fallback for any chain without its own entry. */
|
|
630
|
+
chain: string;
|
|
631
|
+
/**
|
|
632
|
+
* `flat` — `platform_fee_usd` is the whole price.
|
|
633
|
+
* `quoted` — gas is measured at execution and added, so the total depends on chain conditions.
|
|
634
|
+
*/
|
|
635
|
+
mode: 'flat' | 'quoted';
|
|
636
|
+
platform_fee_usd: string;
|
|
637
|
+
gas_buffer_bps: number;
|
|
638
|
+
min_charge_usd: string;
|
|
639
|
+
/** null when uncapped. */
|
|
640
|
+
max_charge_usd: string | null;
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* Everything CERTEN charges for, and what it costs.
|
|
644
|
+
*
|
|
645
|
+
* Added in the gateway's 2026-08 release. Before it, prices could only be discovered one at a time
|
|
646
|
+
* through `quote()`, against sku names that are not guessable — it is `identity.provision`, not
|
|
647
|
+
* `identity.create` — so finding one meant guessing and reading the refusal.
|
|
648
|
+
*
|
|
649
|
+
* `price_book_version` and `price_book_hash` are the same values quotes and receipts carry, so a
|
|
650
|
+
* price seen here can be traced through to the charge.
|
|
651
|
+
*/
|
|
652
|
+
export interface PricingCatalog {
|
|
653
|
+
price_book_version: string;
|
|
654
|
+
price_book_hash: string;
|
|
655
|
+
currency: string;
|
|
656
|
+
items: PricingItem[];
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* One permission a key can be granted.
|
|
660
|
+
*
|
|
661
|
+
* `operations` is derived from the gateway's live route table, so it says what is actually
|
|
662
|
+
* enforced rather than what someone remembered to document.
|
|
663
|
+
*/
|
|
664
|
+
export interface ScopeInfo {
|
|
665
|
+
name: string;
|
|
666
|
+
description: string;
|
|
667
|
+
/** `operator` scopes are for the fee console and platform staff, not customer keys. */
|
|
668
|
+
audience: 'customer' | 'operator';
|
|
669
|
+
/** Operations requiring this scope, as `METHOD /path`. Empty for `*`, which satisfies all. */
|
|
670
|
+
operations: string[];
|
|
671
|
+
}
|
|
672
|
+
/** An OAuth2 client as any READ returns it — deliberately without a secret. */
|
|
673
|
+
export interface OAuthClient {
|
|
674
|
+
id: string;
|
|
675
|
+
client_id: string;
|
|
676
|
+
org_id: string;
|
|
677
|
+
/** What tokens minted by this client are allowed to do. */
|
|
678
|
+
scopes: string[];
|
|
679
|
+
is_active: boolean;
|
|
680
|
+
created_at: string;
|
|
681
|
+
last_rotated_at?: string | null;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* What `create()` and `rotateSecret()` return.
|
|
685
|
+
*
|
|
686
|
+
* `client_secret` is present here and NOWHERE else. There is no endpoint that will tell you again.
|
|
687
|
+
*/
|
|
688
|
+
export interface OAuthClientCredentials {
|
|
689
|
+
client_id: string;
|
|
690
|
+
client_secret: string;
|
|
691
|
+
org_id?: string;
|
|
692
|
+
scopes?: string[];
|
|
693
|
+
warning?: string;
|
|
694
|
+
}
|
|
695
|
+
/** A nonce to sign, from `requestSignupChallenge`. Single-use and short-lived. */
|
|
696
|
+
export interface SignupChallenge {
|
|
697
|
+
/** 32 bytes of hex. Sign the BYTES, not the hex text. */
|
|
698
|
+
nonce: string;
|
|
699
|
+
expires_in: number;
|
|
700
|
+
algorithm: string;
|
|
701
|
+
instructions: string;
|
|
702
|
+
}
|
|
703
|
+
/** A registration token as a READ returns it — state, never the token itself. */
|
|
704
|
+
export interface RegistrationToken {
|
|
705
|
+
id: string;
|
|
706
|
+
/** A recognisable fragment, so a list is readable without being redeemable. */
|
|
707
|
+
token_prefix: string;
|
|
708
|
+
state: 'active' | 'redeemed' | 'revoked' | 'expired';
|
|
709
|
+
org_name: string | null;
|
|
710
|
+
plan: string;
|
|
711
|
+
/** Scopes the redeemed org's first key receives. */
|
|
712
|
+
permissions: string[];
|
|
713
|
+
expires_at: string;
|
|
714
|
+
revoked_at: string | null;
|
|
715
|
+
redeemed_at: string | null;
|
|
716
|
+
/** The organization this became. Null until redeemed. */
|
|
717
|
+
redeemed_org_id: string | null;
|
|
718
|
+
note: string | null;
|
|
719
|
+
created_at: string;
|
|
720
|
+
}
|
|
721
|
+
/** What `mint()` returns. `token` appears here and nowhere else, ever. */
|
|
722
|
+
export interface MintedRegistrationToken extends RegistrationToken {
|
|
723
|
+
token: string;
|
|
724
|
+
warning?: string;
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* What redeeming produces: a new organization and its first API key.
|
|
728
|
+
*
|
|
729
|
+
* `api_key` is returned once. The token is single-use, so failing to store it cannot be fixed by
|
|
730
|
+
* redeeming again.
|
|
731
|
+
*/
|
|
732
|
+
export interface RedeemedRegistration {
|
|
733
|
+
org: {
|
|
734
|
+
id: string;
|
|
735
|
+
name: string;
|
|
736
|
+
plan: string;
|
|
737
|
+
};
|
|
738
|
+
api_key: string;
|
|
739
|
+
key_prefix: string;
|
|
740
|
+
permissions: string[];
|
|
741
|
+
warning?: string;
|
|
742
|
+
}
|
|
743
|
+
/** One entry in the published error catalogue. See `admin.errors()`. */
|
|
744
|
+
export interface ErrorCodeInfo {
|
|
745
|
+
code: string;
|
|
746
|
+
status: number;
|
|
747
|
+
meaning: string;
|
|
748
|
+
/** Will repeating this EXACT request eventually work? Not a statement about fault. */
|
|
749
|
+
retryable: boolean;
|
|
750
|
+
/** `platform` means there is nothing the caller can change. */
|
|
751
|
+
audience: 'caller' | 'platform';
|
|
752
|
+
/** What to do next, when there is something to do. */
|
|
753
|
+
action?: string;
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Who a credential is, and what it may do.
|
|
757
|
+
*
|
|
758
|
+
* One shape for both an API key and a portal session: `key` is populated for the former, `user` and
|
|
759
|
+
* `orgs` for the latter, and everything else is common so a single parser reads either.
|
|
760
|
+
*
|
|
761
|
+
* `scopes` is the field worth having. Before this existed, an API key could not learn its own
|
|
762
|
+
* permissions, so clients inferred them by making calls and seeing which ones came back 403 —
|
|
763
|
+
* `certen whoami` literally reported `scopes_observed` derived that way.
|
|
764
|
+
*/
|
|
765
|
+
export interface MeResponse {
|
|
766
|
+
auth_method: 'api_key' | 'oauth' | 'session';
|
|
767
|
+
org: {
|
|
768
|
+
id: string;
|
|
769
|
+
name: string | null;
|
|
770
|
+
};
|
|
771
|
+
/** What this credential may do. `*` is the wildcard. Enumerate them with `admin.scopes()`. */
|
|
772
|
+
scopes: string[];
|
|
773
|
+
key: {
|
|
774
|
+
id: string;
|
|
775
|
+
rate_limit_rpm: number | null;
|
|
776
|
+
} | null;
|
|
777
|
+
user: {
|
|
778
|
+
id: string;
|
|
779
|
+
email: string | null;
|
|
780
|
+
source: string;
|
|
781
|
+
} | null;
|
|
782
|
+
active_org_id: string | null;
|
|
783
|
+
role: string | null;
|
|
784
|
+
orgs: Array<{
|
|
785
|
+
org_id: string;
|
|
786
|
+
name: string | null;
|
|
787
|
+
role: string;
|
|
788
|
+
}>;
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* An OAuth2 token pair.
|
|
792
|
+
*
|
|
793
|
+
* `refresh_token` is single-use: exchanging it yields a new pair and spends the old one. Replaying a
|
|
794
|
+
* spent refresh token revokes the entire descendant chain — deliberate theft detection, so store
|
|
795
|
+
* the new pair before doing anything else with it.
|
|
796
|
+
*/
|
|
797
|
+
export interface OAuthTokens {
|
|
798
|
+
access_token: string;
|
|
799
|
+
token_type: string;
|
|
800
|
+
/** Seconds. Currently 3600. */
|
|
801
|
+
expires_in: number;
|
|
802
|
+
refresh_token?: string;
|
|
803
|
+
/** Seconds. Currently 30 days. */
|
|
804
|
+
refresh_expires_in?: number;
|
|
805
|
+
/** Space-delimited granted scopes. */
|
|
806
|
+
scope?: string;
|
|
807
|
+
[k: string]: unknown;
|
|
808
|
+
}
|
|
809
|
+
/** A registered webhook endpoint. The signing secret is returned only when it is created or rotated. */
|
|
810
|
+
export interface WebhookEndpoint {
|
|
811
|
+
id: string;
|
|
812
|
+
url: string;
|
|
813
|
+
/** Events this endpoint receives. Empty or absent means everything. */
|
|
814
|
+
event_types: string[];
|
|
815
|
+
description: string | null;
|
|
816
|
+
is_active: boolean;
|
|
817
|
+
/** Whether the verification ping succeeded. An unverified endpoint may still be delivered to. */
|
|
818
|
+
verified: boolean;
|
|
819
|
+
verification_error: string | null;
|
|
820
|
+
created_at: string;
|
|
821
|
+
[k: string]: unknown;
|
|
822
|
+
}
|
|
823
|
+
/**
|
|
824
|
+
* One delivery attempt.
|
|
825
|
+
*
|
|
826
|
+
* The field worth reading is whichever explains a failure — status code, error, attempt count.
|
|
827
|
+
* Without this a failed delivery is indistinguishable from an event that never fired.
|
|
828
|
+
*/
|
|
829
|
+
export interface WebhookDelivery {
|
|
830
|
+
id: string;
|
|
831
|
+
event_type?: string;
|
|
832
|
+
status?: string;
|
|
833
|
+
attempts?: number;
|
|
834
|
+
response_status?: number | null;
|
|
835
|
+
error?: string | null;
|
|
836
|
+
created_at?: string;
|
|
837
|
+
delivered_at?: string | null;
|
|
838
|
+
[k: string]: unknown;
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* Where a page sits in a list.
|
|
842
|
+
*
|
|
843
|
+
* **Loop until `has_more` is false.** Do not infer the end from a short page: a final page that
|
|
844
|
+
* lands exactly on the page size is indistinguishable from a full one, so that inference stops a
|
|
845
|
+
* page early and reports a partial result as complete — silently.
|
|
846
|
+
*
|
|
847
|
+
* Optional on responses because an older gateway does not send it; `paginate()` falls back then.
|
|
848
|
+
*/
|
|
849
|
+
export interface Pagination {
|
|
850
|
+
limit: number;
|
|
851
|
+
offset: number;
|
|
852
|
+
has_more: boolean;
|
|
853
|
+
returned: number;
|
|
854
|
+
}
|
|
855
|
+
/**
|
|
856
|
+
* One line of the append-only, double-entry ledger.
|
|
857
|
+
*
|
|
858
|
+
* Every balance change has an entry here, and corrections appear as new REVERSING groups rather
|
|
859
|
+
* than edits — so the history is what happened, not what it was later decided should have happened.
|
|
860
|
+
* This is the record that answers "where did my money go".
|
|
861
|
+
*/
|
|
862
|
+
export interface LedgerEntry {
|
|
863
|
+
id: string;
|
|
864
|
+
/** e.g. `available`, `held`, `revenue_platform_fee`, `recovery_gas`. */
|
|
865
|
+
account: string;
|
|
866
|
+
/** Signed. Negative leaves the account. */
|
|
867
|
+
amount_usd: string;
|
|
868
|
+
/** e.g. `capture`, `hold`, `release`, `deposit`, `reversal`. */
|
|
869
|
+
kind: string;
|
|
870
|
+
ref_type: string | null;
|
|
871
|
+
ref_id: string | null;
|
|
872
|
+
memo: string | null;
|
|
873
|
+
created_at: string;
|
|
874
|
+
}
|
|
875
|
+
/** A receipt as it appears in a list — enough to find the one you want. */
|
|
876
|
+
export interface ReceiptSummary {
|
|
877
|
+
id: string;
|
|
878
|
+
/** Monotonic per organization. A string because it can exceed 2^53. */
|
|
879
|
+
receipt_number: string;
|
|
880
|
+
/** `charge`, `payment`, `refund`, `adjustment`. */
|
|
881
|
+
type: string;
|
|
882
|
+
amount_usd: string;
|
|
883
|
+
currency: string;
|
|
884
|
+
ref_type: string | null;
|
|
885
|
+
ref_id: string | null;
|
|
886
|
+
digest: string;
|
|
887
|
+
/** Whether an ed25519 signature exists. Fetch the receipt to check it. */
|
|
888
|
+
signed: boolean;
|
|
889
|
+
/** Whether it has been written to the transparency log. Only then is a proof available. */
|
|
890
|
+
logged: boolean;
|
|
891
|
+
issued_at: string;
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* A receipt with its evidence.
|
|
895
|
+
*
|
|
896
|
+
* Three independent layers, and they answer different challenges:
|
|
897
|
+
* - `signature` — CERTEN issued this. Verify against `billing.verificationKeys()`.
|
|
898
|
+
* - the transparency log — CERTEN did not later hide or edit it. See `receiptProof()`.
|
|
899
|
+
* - `computation` — the amount is a consequence of measured on-chain gas, a hashed price book and
|
|
900
|
+
* a signed FX rate, not an assertion.
|
|
901
|
+
*
|
|
902
|
+
* `verification` is the gateway checking its own work, which is worth exactly nothing on its own;
|
|
903
|
+
* its value is that every check in it is reproducible by you from published data.
|
|
904
|
+
*/
|
|
905
|
+
export interface Receipt extends ReceiptSummary {
|
|
906
|
+
entry_group_id: string | null;
|
|
907
|
+
/** The canonical JSON that was signed and hashed. Reproduce `digest` from this. */
|
|
908
|
+
body: unknown;
|
|
909
|
+
signature: string | null;
|
|
910
|
+
key_id: string | null;
|
|
911
|
+
algorithm: 'ed25519' | null;
|
|
912
|
+
/** Ties the charge to a published price book. */
|
|
913
|
+
price_book_hash: string | null;
|
|
914
|
+
computation: unknown;
|
|
915
|
+
/** Position in the transparency log. Null until it has been logged. */
|
|
916
|
+
leaf_seq: number | null;
|
|
917
|
+
verification?: unknown;
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* A proof bundle received through a share link.
|
|
921
|
+
*
|
|
922
|
+
* `bundle` is fetched live rather than snapshotted when the link was made, so a share can never
|
|
923
|
+
* serve a superseded artifact.
|
|
924
|
+
*/
|
|
925
|
+
export interface SharedProof {
|
|
926
|
+
proof_id: string;
|
|
927
|
+
shared: boolean;
|
|
928
|
+
expires_at: string;
|
|
929
|
+
/** How many times the link has been redeemed, including this one. Some links are view-capped. */
|
|
930
|
+
view_count: number;
|
|
931
|
+
bundle: unknown;
|
|
932
|
+
}
|
|
933
|
+
/**
|
|
934
|
+
* Whether CERTEN can serve, and what is wrong when it cannot.
|
|
935
|
+
*
|
|
936
|
+
* `reasons` carries coarse tokens. The ones worth acting on differently:
|
|
937
|
+
*
|
|
938
|
+
* - `sponsor_below_floor` — identity creation will return 202 and then NEVER complete. Do not
|
|
939
|
+
* create identities until this clears; every signal you would normally trust says it worked.
|
|
940
|
+
* - `sponsor_low_warning` — appears alongside `ready: true`. A scheduling signal, not an outage.
|
|
941
|
+
* - `entitlement_unpublished` / `entitlement_expired` — validators are refusing EVERY intent on the
|
|
942
|
+
* fleet right now. Work will not execute until this clears; nothing is wrong with your request.
|
|
943
|
+
* - `database`, `api_bridge`, `proofs_service`, `accumulate` — a component is down. None of these
|
|
944
|
+
* are anything a caller can fix by changing their own setup.
|
|
945
|
+
*/
|
|
946
|
+
export interface ReadinessReport {
|
|
947
|
+
/** True only on a 200 whose status is `ready`. */
|
|
948
|
+
ready: boolean;
|
|
949
|
+
status: string;
|
|
950
|
+
reasons: string[];
|
|
951
|
+
sponsor_identities_remaining?: number | null;
|
|
952
|
+
degraded?: boolean;
|
|
953
|
+
[k: string]: unknown;
|
|
954
|
+
}
|
|
955
|
+
/** What the transparency log is and how far it has grown. */
|
|
956
|
+
export interface TransparencyLogInfo {
|
|
957
|
+
tree_size?: number;
|
|
958
|
+
latest_head?: TransparencyHead | null;
|
|
959
|
+
latest_anchored_head?: TransparencyHead | null;
|
|
960
|
+
[k: string]: unknown;
|
|
961
|
+
}
|
|
962
|
+
/** Proof that the log at `second` extends the log at `first` without rewriting it. */
|
|
963
|
+
export interface ConsistencyProof {
|
|
964
|
+
first: number;
|
|
965
|
+
second: number;
|
|
966
|
+
/** Fold per RFC 6962 section 2.1.2. */
|
|
967
|
+
proof: string[];
|
|
968
|
+
first_root?: string;
|
|
969
|
+
second_root?: string;
|
|
970
|
+
[k: string]: unknown;
|
|
971
|
+
}
|
|
972
|
+
/** A price book as published, with the window it was in force. */
|
|
973
|
+
export interface PublishedPriceBook {
|
|
974
|
+
version: string;
|
|
975
|
+
kind: string;
|
|
976
|
+
document_hash: string;
|
|
977
|
+
effective_from: string;
|
|
978
|
+
effective_to: string | null;
|
|
979
|
+
document?: unknown;
|
|
980
|
+
[k: string]: unknown;
|
|
981
|
+
}
|
|
982
|
+
/** A signed native-to-USD rate, observed at a moment. */
|
|
983
|
+
export interface FxObservation {
|
|
984
|
+
id: string;
|
|
985
|
+
native_symbol?: string;
|
|
986
|
+
usd_per_native_micro?: string;
|
|
987
|
+
observed_at?: string;
|
|
988
|
+
signature?: string | null;
|
|
989
|
+
[k: string]: unknown;
|
|
990
|
+
}
|
|
991
|
+
/** A signed tree head, and where it is anchored on Accumulate. */
|
|
992
|
+
export interface TransparencyHead {
|
|
993
|
+
tree_size: number;
|
|
994
|
+
root_hash: string;
|
|
995
|
+
signature: string | null;
|
|
996
|
+
key_id: string | null;
|
|
997
|
+
anchor_status: string;
|
|
998
|
+
anchor_tx_hash: string | null;
|
|
999
|
+
anchor_account_url: string | null;
|
|
1000
|
+
anchor_block_time: string | null;
|
|
1001
|
+
anchor_block_time_source?: string | null;
|
|
1002
|
+
/**
|
|
1003
|
+
* True only when `anchor_block_time` is the minor block's own timestamp. When false the time is a
|
|
1004
|
+
* loose upper bound; trusting it as exact would overstate what the anchor proves.
|
|
1005
|
+
*/
|
|
1006
|
+
timestamp_attested?: boolean;
|
|
1007
|
+
is_same_head?: boolean;
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* An RFC 6962 inclusion proof: this receipt is a leaf of the log at `tree_size`.
|
|
1011
|
+
*
|
|
1012
|
+
* **Keep it with the receipt.** It stays valid forever against that head, which is itself pinned on
|
|
1013
|
+
* Accumulate — so the evidence survives even if CERTEN does not.
|
|
1014
|
+
*
|
|
1015
|
+
* Read `covering_head`, not `head`, when asking whether it is anchored. `head` is the head at this
|
|
1016
|
+
* tree size, which may not itself have been anchored; `covering_head` is the head that carries the
|
|
1017
|
+
* on-chain anchor, and a later root still commits to this leaf. A verifier reading only
|
|
1018
|
+
* `head.anchor_status` concludes "unanchored" for every receipt between anchors.
|
|
1019
|
+
*/
|
|
1020
|
+
export interface ReceiptProof {
|
|
1021
|
+
receipt_id: string;
|
|
1022
|
+
leaf_hash: string;
|
|
1023
|
+
/** Yours alone. Leaves are salted so a published root discloses nothing. */
|
|
1024
|
+
leaf_salt: string;
|
|
1025
|
+
leaf_index: number;
|
|
1026
|
+
tree_size: number;
|
|
1027
|
+
root_hash: string;
|
|
1028
|
+
audit_path: string[];
|
|
1029
|
+
head: TransparencyHead | null;
|
|
1030
|
+
covering_head: TransparencyHead | null;
|
|
1031
|
+
/** How to check each layer yourself, in words. */
|
|
1032
|
+
verification?: Record<string, string>;
|
|
1033
|
+
}
|
|
1034
|
+
/** One check in a receipt verification. `skipped` is never a pass. */
|
|
1035
|
+
export interface ReceiptCheck {
|
|
1036
|
+
name: 'digest' | 'signature' | 'inclusion' | 'root' | 'anchor' | string;
|
|
1037
|
+
status: 'ok' | 'failed' | 'skipped';
|
|
1038
|
+
detail: string;
|
|
1039
|
+
}
|
|
1040
|
+
/**
|
|
1041
|
+
* The result of checking a receipt yourself.
|
|
1042
|
+
*
|
|
1043
|
+
* `verified` is true only when EVERY check passed. `complete` says whether any were skipped — an
|
|
1044
|
+
* unreachable transparency log skips the inclusion checks rather than passing them, because "I
|
|
1045
|
+
* could not check" and "it checks out" are the two answers a dispute must never confuse.
|
|
1046
|
+
*/
|
|
1047
|
+
export interface ReceiptVerification {
|
|
1048
|
+
receipt_id: string;
|
|
1049
|
+
verified: boolean;
|
|
1050
|
+
complete: boolean;
|
|
1051
|
+
checks: ReceiptCheck[];
|
|
1052
|
+
}
|
|
1053
|
+
/** The public keys receipts and tree heads are signed with. */
|
|
1054
|
+
export interface VerificationKeys {
|
|
1055
|
+
keys: Array<{
|
|
1056
|
+
key_id: string;
|
|
1057
|
+
algorithm: string;
|
|
1058
|
+
public_key: string;
|
|
1059
|
+
[k: string]: unknown;
|
|
1060
|
+
}>;
|
|
1061
|
+
[k: string]: unknown;
|
|
1062
|
+
}
|
|
1063
|
+
/**
|
|
1064
|
+
* A wallet you send from, registered so its deposits credit automatically.
|
|
1065
|
+
*
|
|
1066
|
+
* The alternative — a one-time payment matched on the exact amount — has to be opened before every
|
|
1067
|
+
* send and expires. Registering the sender once removes that step for good.
|
|
1068
|
+
*/
|
|
1069
|
+
export interface PayerAddress {
|
|
1070
|
+
id: string;
|
|
1071
|
+
chain: string;
|
|
1072
|
+
address: string;
|
|
1073
|
+
label: string | null;
|
|
1074
|
+
is_active: boolean;
|
|
1075
|
+
/** When ownership was confirmed, if it has been. */
|
|
1076
|
+
verified_at: string | null;
|
|
1077
|
+
created_at: string;
|
|
1078
|
+
}
|
|
1079
|
+
export interface BalanceResponse {
|
|
1080
|
+
currency: string;
|
|
1081
|
+
available_usd: string;
|
|
1082
|
+
held_usd: string;
|
|
1083
|
+
/** The credit line IN FORCE. Zero once an expiring grant has lapsed. */
|
|
1084
|
+
credit_limit_usd: string;
|
|
1085
|
+
/** available + credit line. NOT what may be committed — gate on `remaining_usd`. */
|
|
1086
|
+
spendable_usd: string;
|
|
1087
|
+
/**
|
|
1088
|
+
* **The number to gate on.** `spendable_usd` minus what pending intents will consume.
|
|
1089
|
+
*
|
|
1090
|
+
* CERTEN charges a multi-signature intent when quorum is reached, which can be weeks after it was
|
|
1091
|
+
* opened — so an account can show a healthy `spendable_usd` that is entirely committed and still
|
|
1092
|
+
* be refused on its next call. Reading this used to mean a second request to
|
|
1093
|
+
* `/v1/billing/obligations`; it now travels with the balance, so affordability costs one call.
|
|
1094
|
+
*
|
|
1095
|
+
* Goes NEGATIVE when commitments exceed capacity, rather than clamping: the size of the gap is
|
|
1096
|
+
* what says how much to add. Optional only because an older gateway does not send it.
|
|
1097
|
+
*/
|
|
1098
|
+
remaining_usd?: string;
|
|
1099
|
+
/** How many pending intents claimed it. `obligations()` says which. */
|
|
1100
|
+
pending_intents?: number;
|
|
1101
|
+
/** The part of those commitments not already covered by a hold. */
|
|
1102
|
+
uncovered_usd?: string;
|
|
1103
|
+
status: 'active' | 'suspended' | 'closed';
|
|
1104
|
+
/** Why service stopped. Without it `status: suspended` is unactionable. */
|
|
1105
|
+
suspended_reason?: string | null;
|
|
1106
|
+
/**
|
|
1107
|
+
* The credit line, and the points at which it changes what you can do.
|
|
1108
|
+
*
|
|
1109
|
+
* `suspends_at_usd` is the one an autonomous caller needs: it is the drawdown
|
|
1110
|
+
* at which work stops being accepted. Publishing it is what makes it possible
|
|
1111
|
+
* to top up BEFORE being cut off rather than after.
|
|
1112
|
+
*/
|
|
1113
|
+
credit?: {
|
|
1114
|
+
kind: 'none' | 'trial' | 'comp' | 'terms';
|
|
1115
|
+
label: string | null;
|
|
1116
|
+
/** The limit as granted, before expiry. Differs from credit_limit_usd only for a lapsed grant. */
|
|
1117
|
+
granted_limit_usd: string;
|
|
1118
|
+
expires_at: string | null;
|
|
1119
|
+
expired: boolean;
|
|
1120
|
+
warns_at_usd: string;
|
|
1121
|
+
suspends_at_usd: string;
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
/** A price, fixed at a moment, from published inputs. Free to ask for. */
|
|
1125
|
+
export interface QuoteResponse {
|
|
1126
|
+
/**
|
|
1127
|
+
* The id to pass back as `quote_id` to lock this price.
|
|
1128
|
+
*
|
|
1129
|
+
* The wire field is `quote_id`, not `id`. This type declared `id`, so every read of it was
|
|
1130
|
+
* `undefined` — `certen quote` printed an empty id and then advised passing it, which is the one
|
|
1131
|
+
* thing a quote exists to enable. `id` is kept as an optional alias so any caller that already
|
|
1132
|
+
* reads it keeps compiling, but `quote_id` is the field the gateway actually sends.
|
|
1133
|
+
*/
|
|
1134
|
+
quote_id: string;
|
|
1135
|
+
/** @deprecated The gateway sends `quote_id`. Always undefined in practice. */
|
|
1136
|
+
id?: string;
|
|
1137
|
+
sku: string;
|
|
1138
|
+
chain: string;
|
|
1139
|
+
chains?: string[] | null;
|
|
1140
|
+
leg_count: number;
|
|
1141
|
+
proof_class: 'on_demand' | 'on_cadence' | null;
|
|
1142
|
+
platform_fee_usd: string;
|
|
1143
|
+
gas_usd: string;
|
|
1144
|
+
total_usd: string;
|
|
1145
|
+
/** Ceiling CERTEN promises. Gas over this is absorbed, not passed on. */
|
|
1146
|
+
max_total_usd: string;
|
|
1147
|
+
expires_at: string;
|
|
1148
|
+
computation?: {
|
|
1149
|
+
/**
|
|
1150
|
+
* Which cost history priced the gas.
|
|
1151
|
+
*
|
|
1152
|
+
* `class_thin` means the proof class has its own history but too little of
|
|
1153
|
+
* it for the median to be stable — the price is indicative rather than firm.
|
|
1154
|
+
*/
|
|
1155
|
+
gas_estimate_basis?: 'class_specific' | 'class_thin' | 'unclassified_fallback';
|
|
1156
|
+
[k: string]: unknown;
|
|
1157
|
+
};
|
|
1158
|
+
/**
|
|
1159
|
+
* Where this quote stands. Only returned when reading one back with `quoteById()` — a quote you
|
|
1160
|
+
* just created is `active` by construction, so the create response does not repeat it.
|
|
1161
|
+
*
|
|
1162
|
+
* A quote is single-use: once it has priced a transaction it is spent, and passing it again is
|
|
1163
|
+
* refused. `expires_at` is the other way it stops being usable.
|
|
1164
|
+
*/
|
|
1165
|
+
status?: string;
|
|
1166
|
+
}
|
|
1167
|
+
export interface Obligation {
|
|
1168
|
+
intent_id: string;
|
|
1169
|
+
status: string;
|
|
1170
|
+
chain: string;
|
|
1171
|
+
estimated_usd: string;
|
|
1172
|
+
covered_by_hold: boolean;
|
|
1173
|
+
created_at: string;
|
|
1174
|
+
}
|
|
1175
|
+
export interface ObligationsResponse {
|
|
1176
|
+
pending_intents: number;
|
|
1177
|
+
estimated_total_usd: string;
|
|
1178
|
+
/** The part of the pending cost with no hold behind it yet. */
|
|
1179
|
+
uncovered_usd: string;
|
|
1180
|
+
spendable_usd: string;
|
|
1181
|
+
/** Spendable minus uncovered commitments. The number to gate new work on. */
|
|
1182
|
+
remaining_usd: string;
|
|
1183
|
+
shortfall_usd: string;
|
|
1184
|
+
enforcing: boolean;
|
|
1185
|
+
obligations: Obligation[];
|
|
1186
|
+
}
|
|
1187
|
+
export interface DepositIntent {
|
|
1188
|
+
reference: string;
|
|
1189
|
+
amount_usd: string;
|
|
1190
|
+
expires_at: string;
|
|
1191
|
+
}
|
|
1192
|
+
export interface DepositTarget {
|
|
1193
|
+
chain: string;
|
|
1194
|
+
chain_id: number;
|
|
1195
|
+
token_symbol: string;
|
|
1196
|
+
token_address: string;
|
|
1197
|
+
token_decimals: number;
|
|
1198
|
+
deposit_address: string;
|
|
1199
|
+
min_confirmations: number;
|
|
1200
|
+
/** Null when no amount was supplied — nothing was opened. */
|
|
1201
|
+
deposit_intent: DepositIntent | null;
|
|
1202
|
+
note: string;
|
|
1203
|
+
}
|
|
1204
|
+
/**
|
|
1205
|
+
* A payment the gateway has seen and, usually, credited.
|
|
1206
|
+
*
|
|
1207
|
+
* `attribution` says HOW it was credited: `registered_address` means the sending wallet is a
|
|
1208
|
+
* known payer for the organization, and the payment never needed a deposit intent at all.
|
|
1209
|
+
*/
|
|
1210
|
+
export interface PaymentRecord {
|
|
1211
|
+
id?: string;
|
|
1212
|
+
rail?: string;
|
|
1213
|
+
status?: string;
|
|
1214
|
+
amount_usd?: string;
|
|
1215
|
+
chain?: string;
|
|
1216
|
+
token_symbol?: string;
|
|
1217
|
+
from_address?: string;
|
|
1218
|
+
tx_hash?: string;
|
|
1219
|
+
confirmations?: number;
|
|
1220
|
+
attribution?: string;
|
|
1221
|
+
created_at?: string;
|
|
1222
|
+
[key: string]: unknown;
|
|
1223
|
+
}
|
|
1224
|
+
export interface DepositIntentStatus {
|
|
1225
|
+
reference: string;
|
|
1226
|
+
status: 'open' | 'matched' | 'expired' | 'cancelled';
|
|
1227
|
+
amount_usd: string;
|
|
1228
|
+
expires_at: string;
|
|
1229
|
+
matched_at: string | null;
|
|
1230
|
+
payment_id: string | null;
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* One deployed contract.
|
|
1234
|
+
*
|
|
1235
|
+
* `verified` means the address was confirmed to carry bytecode via `eth_getCode`. Non-EVM entries
|
|
1236
|
+
* are transcribed from validator configuration and are never independently verified — so `false`
|
|
1237
|
+
* there means "not checkable this way", not "suspect".
|
|
1238
|
+
*/
|
|
1239
|
+
export interface ContractEntry {
|
|
1240
|
+
address: string;
|
|
1241
|
+
verified?: boolean;
|
|
1242
|
+
/** Only present for EVM families; other explorers differ enough that a guessed path would 404. */
|
|
1243
|
+
explorer_url?: string;
|
|
1244
|
+
[key: string]: unknown;
|
|
1245
|
+
}
|
|
1246
|
+
/**
|
|
1247
|
+
* A network in the registry.
|
|
1248
|
+
*
|
|
1249
|
+
* The casing is mixed on the wire and that is not a mistake here: the gateway serialises its
|
|
1250
|
+
* static registry (`chainId`, `displayName`) and adds its own fields (`explorer_url`) around it.
|
|
1251
|
+
* Renaming either side in this type would describe a response the gateway does not send.
|
|
1252
|
+
*/
|
|
1253
|
+
export interface ChainEntry {
|
|
1254
|
+
id: string;
|
|
1255
|
+
chainId: number | null;
|
|
1256
|
+
family: string;
|
|
1257
|
+
displayName: string;
|
|
1258
|
+
environment: string;
|
|
1259
|
+
explorer: string;
|
|
1260
|
+
status: string;
|
|
1261
|
+
contracts: Record<string, ContractEntry>;
|
|
1262
|
+
[key: string]: unknown;
|
|
1263
|
+
}
|
|
1264
|
+
export interface ChainsListResponse {
|
|
1265
|
+
version: string;
|
|
1266
|
+
last_updated: string;
|
|
1267
|
+
accumulate: {
|
|
1268
|
+
network: string;
|
|
1269
|
+
environment: string;
|
|
1270
|
+
api: string;
|
|
1271
|
+
explorer: string;
|
|
1272
|
+
};
|
|
1273
|
+
count: number;
|
|
1274
|
+
chains: ChainEntry[];
|
|
1275
|
+
}
|
|
1276
|
+
export interface ChainDetailResponse {
|
|
1277
|
+
chain: ChainEntry;
|
|
1278
|
+
}
|
|
1279
|
+
/**
|
|
1280
|
+
* A proof artifact.
|
|
1281
|
+
*
|
|
1282
|
+
* Deliberately open: the shape is defined by the proof-service and the gateway documents it as
|
|
1283
|
+
* `additionalProperties: true`. Pinning fields here would encode one version of a downstream
|
|
1284
|
+
* contract this SDK does not own, and would start lying the first time it changed.
|
|
1285
|
+
*/
|
|
1286
|
+
export interface ProofArtifact {
|
|
1287
|
+
[key: string]: unknown;
|
|
1288
|
+
}
|
|
1289
|
+
export interface ProofCustody {
|
|
1290
|
+
[key: string]: unknown;
|
|
1291
|
+
}
|
|
1292
|
+
/**
|
|
1293
|
+
* An Accumulate merkle inclusion receipt, read live from the network.
|
|
1294
|
+
*
|
|
1295
|
+
* `anchored` is the field that matters: a transaction can be `delivered` and not yet anchored, and
|
|
1296
|
+
* only an anchored transaction has an inclusion proof a counterparty can check against a block
|
|
1297
|
+
* root they obtained themselves.
|
|
1298
|
+
*/
|
|
1299
|
+
export interface ChainReceipt {
|
|
1300
|
+
tx_hash: string;
|
|
1301
|
+
status: string;
|
|
1302
|
+
principal?: string | null;
|
|
1303
|
+
tx_type?: string | null;
|
|
1304
|
+
anchored: boolean;
|
|
1305
|
+
chain_index?: number | null;
|
|
1306
|
+
block_time?: string | null;
|
|
1307
|
+
found?: boolean;
|
|
1308
|
+
receipt?: {
|
|
1309
|
+
start?: string;
|
|
1310
|
+
end?: string;
|
|
1311
|
+
anchor?: string;
|
|
1312
|
+
entries?: unknown[];
|
|
1313
|
+
[key: string]: unknown;
|
|
1314
|
+
} | null;
|
|
1315
|
+
[key: string]: unknown;
|
|
1316
|
+
}
|
|
1317
|
+
export interface ProofShare {
|
|
1318
|
+
id?: string;
|
|
1319
|
+
proof_id?: string;
|
|
1320
|
+
/** Returned once, at creation. Later reads expose only `token_prefix`. */
|
|
1321
|
+
token?: string;
|
|
1322
|
+
token_prefix?: string;
|
|
1323
|
+
url?: string;
|
|
1324
|
+
label?: string | null;
|
|
1325
|
+
expires_at?: string | null;
|
|
1326
|
+
revoked_at?: string | null;
|
|
1327
|
+
view_count?: number;
|
|
1328
|
+
last_viewed_at?: string | null;
|
|
1329
|
+
[key: string]: unknown;
|
|
1330
|
+
}
|
|
1331
|
+
export interface ProofSharesResponse {
|
|
1332
|
+
shares: ProofShare[];
|
|
1333
|
+
[key: string]: unknown;
|
|
1334
|
+
}
|
|
1335
|
+
export interface DeviceAuthorization {
|
|
1336
|
+
/** Returned ONCE. The gateway stores only its HMAC. Possession of it is the authorization. */
|
|
1337
|
+
device_code: string;
|
|
1338
|
+
/** The short code a human reads off the terminal and types into the portal. */
|
|
1339
|
+
user_code: string;
|
|
1340
|
+
verification_uri: string;
|
|
1341
|
+
/** Prefills the portal field. Following it does NOT approve — approval is always a click. */
|
|
1342
|
+
verification_uri_complete?: string;
|
|
1343
|
+
expires_in: number;
|
|
1344
|
+
/** Seconds. Poll no faster than this. */
|
|
1345
|
+
interval: number;
|
|
1346
|
+
}
|
|
1347
|
+
export interface DeviceAuthorizationStatus {
|
|
1348
|
+
status: 'pending' | 'approved' | 'denied' | 'expired' | 'claimed';
|
|
1349
|
+
/** Present ONLY in the first response after approval, and never again. */
|
|
1350
|
+
api_key?: string;
|
|
1351
|
+
key_prefix?: string;
|
|
1352
|
+
key_id?: string;
|
|
1353
|
+
org_id?: string;
|
|
1354
|
+
permissions?: string[];
|
|
1355
|
+
interval?: number;
|
|
1356
|
+
note?: string;
|
|
1357
|
+
warning?: string;
|
|
1358
|
+
}
|
|
482
1359
|
//# sourceMappingURL=types.d.ts.map
|