@certen.io/cli 0.5.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 +407 -0
- package/README.md +232 -160
- package/dist/chains.d.ts +67 -0
- package/dist/chains.js +242 -0
- package/dist/chains.js.map +1 -0
- package/dist/commands/admin.js +49 -4
- package/dist/commands/admin.js.map +1 -1
- package/dist/commands/auth.js +145 -12
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/billing.js +648 -40
- package/dist/commands/billing.js.map +1 -1
- package/dist/commands/call.d.ts +2 -0
- package/dist/commands/call.js +168 -0
- package/dist/commands/call.js.map +1 -0
- package/dist/commands/chains.d.ts +2 -0
- package/dist/commands/chains.js +123 -0
- package/dist/commands/chains.js.map +1 -0
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.js +171 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/errors-catalogue.d.ts +2 -0
- package/dist/commands/errors-catalogue.js +83 -0
- package/dist/commands/errors-catalogue.js.map +1 -0
- package/dist/commands/identity.js +269 -19
- package/dist/commands/identity.js.map +1 -1
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +307 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/keys.js +2 -0
- package/dist/commands/keys.js.map +1 -1
- package/dist/commands/oauth-clients.d.ts +2 -0
- package/dist/commands/oauth-clients.js +131 -0
- package/dist/commands/oauth-clients.js.map +1 -0
- package/dist/commands/orgs.d.ts +2 -0
- package/dist/commands/orgs.js +117 -0
- package/dist/commands/orgs.js.map +1 -0
- package/dist/commands/pending.js +13 -1
- package/dist/commands/pending.js.map +1 -1
- package/dist/commands/portfolio.js +34 -1
- package/dist/commands/portfolio.js.map +1 -1
- package/dist/commands/proof.d.ts +2 -0
- package/dist/commands/proof.js +400 -0
- package/dist/commands/proof.js.map +1 -0
- package/dist/commands/signup.d.ts +14 -0
- package/dist/commands/signup.js +271 -0
- package/dist/commands/signup.js.map +1 -0
- package/dist/commands/transaction.js +139 -21
- package/dist/commands/transaction.js.map +1 -1
- package/dist/commands/webhooks.d.ts +2 -0
- package/dist/commands/webhooks.js +200 -0
- package/dist/commands/webhooks.js.map +1 -0
- package/dist/commands/whoami.d.ts +16 -0
- package/dist/commands/whoami.js +98 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/config.d.ts +56 -0
- package/dist/config.js +51 -0
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts +14 -1
- package/dist/errors.js +15 -1
- package/dist/errors.js.map +1 -1
- package/dist/funding-guard.d.ts +40 -0
- package/dist/funding-guard.js +120 -0
- package/dist/funding-guard.js.map +1 -0
- package/dist/help-root.d.ts +2 -0
- package/dist/help-root.js +94 -0
- package/dist/help-root.js.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -1
- package/dist/output.d.ts +23 -0
- package/dist/output.js +46 -0
- package/dist/output.js.map +1 -1
- package/dist/passphrase.d.ts +18 -0
- package/dist/passphrase.js +35 -3
- package/dist/passphrase.js.map +1 -1
- package/dist/payment-uri.d.ts +76 -0
- package/dist/payment-uri.js +135 -0
- package/dist/payment-uri.js.map +1 -0
- package/dist/signer.js +6 -3
- package/dist/signer.js.map +1 -1
- package/dist/solidity-args.d.ts +31 -0
- package/dist/solidity-args.js +111 -0
- package/dist/solidity-args.js.map +1 -0
- package/dist/wait.d.ts +79 -0
- package/dist/wait.js +168 -0
- package/dist/wait.js.map +1 -0
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -1,160 +1,232 @@
|
|
|
1
|
-
# `@certen.io/cli`
|
|
2
|
-
|
|
3
|
-
The `certen` command line for the [CERTEN Gateway](https://gateway.kompendium.co/reference) —
|
|
4
|
-
proof-gated cross-chain execution on Accumulate.
|
|
5
|
-
|
|
6
|
-
**Docs: <https://docs.kompendium.co>** · **
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
npm install -g @certen.io/cli
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
##
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
#
|
|
16
|
-
certen
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
#
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
certen
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
certen
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
certen
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
certen
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
certen
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
1
|
+
# `@certen.io/cli`
|
|
2
|
+
|
|
3
|
+
The `certen` command line for the [CERTEN Gateway](https://gateway.kompendium.co/reference) —
|
|
4
|
+
proof-gated cross-chain execution on Accumulate.
|
|
5
|
+
|
|
6
|
+
**Docs: <https://docs.kompendium.co>** · **Portal: <https://gateway.kompendium.co/portal>**
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install -g @certen.io/cli
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## From nothing to a proof
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
certen login # approve this machine once in the portal; the key arrives here
|
|
16
|
+
certen init # signing key, identity, funding — created and checked
|
|
17
|
+
|
|
18
|
+
certen call --identity <id> --chain base-sepolia --to 0xYourContract \
|
|
19
|
+
--fn 'confirm(bytes32)' --arg 0x… --sign-with dev --wait
|
|
20
|
+
|
|
21
|
+
certen proof get <intent-id> # the evidence, to hand to a counterparty
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**You never copy an API key.** `certen login` uses the device authorization grant: it prints a
|
|
25
|
+
short code, you approve that code in a portal session you already trust, and the CLI collects the
|
|
26
|
+
key over its own channel. The secret is never displayed here and never passes through your
|
|
27
|
+
clipboard or your shell history.
|
|
28
|
+
|
|
29
|
+
`certen init` is idempotent. It creates only what is missing, records the identity id so a later
|
|
30
|
+
run reuses it, waits until the identity can actually sign, and tells you if an abstract account
|
|
31
|
+
needs gas before it can execute anything.
|
|
32
|
+
|
|
33
|
+
Stuck at any point:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
certen doctor # names the one thing blocking you, and the command that fixes it
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### If your gateway predates device authorization
|
|
40
|
+
|
|
41
|
+
`certen login` will say so and point at the portal. Mint a key there and hand it over without
|
|
42
|
+
putting it in your shell history:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
certen auth login --api-key - # reads the key from stdin
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Your key never leaves this machine
|
|
49
|
+
|
|
50
|
+
`certen keys generate` creates an Ed25519 key, encrypts it with a passphrase (scrypt + AES-256-GCM),
|
|
51
|
+
and writes it to `~/.certen/keys/<name>.json` with `0600` permissions. The CLI sends **signatures**
|
|
52
|
+
to the gateway. It never sends a private key, and there is no code path that could.
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
certen keys generate --name dev # prompts for a passphrase (confirmed)
|
|
56
|
+
certen keys generate --name ci --no-passphrase # unencrypted; file permissions only
|
|
57
|
+
certen keys list # metadata only — never decrypts
|
|
58
|
+
certen keys show dev
|
|
59
|
+
certen keys verify dev # proves the key decrypts and signs correctly
|
|
60
|
+
certen keys sign --name dev --hash <hex> # print a signature, send nothing
|
|
61
|
+
certen keys delete dev --yes
|
|
62
|
+
certen keys path
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Set `CERTEN_KEY_PASSPHRASE` to skip the prompt in CI. When it is set and there is no TTY, the CLI
|
|
66
|
+
uses it; when neither is available it fails with an explanation rather than hanging on a prompt
|
|
67
|
+
nobody can see.
|
|
68
|
+
|
|
69
|
+
**`certen keys sign` sends nothing anywhere.** It is the air-gapped path: generate on one machine,
|
|
70
|
+
carry the hash to it, carry the signature back.
|
|
71
|
+
|
|
72
|
+
## Proof-gated contract calls
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
certen call --identity <uuid> --chain base-sepolia --to 0xTarget \
|
|
76
|
+
--fn 'confirm(bytes32)' --arg 0x… --sign-with dev --wait
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`--fn` takes a Solidity signature and `--arg` repeats positionally. Arguments are checked against
|
|
80
|
+
the signature **before** anything is sent — on a proof-gated call, a valid proof of the *wrong*
|
|
81
|
+
call is still a valid proof, so a mis-encoded argument is worse than an error.
|
|
82
|
+
|
|
83
|
+
The ADI URL, the abstract account (`msg.sender` on chain) and the numeric chain id are all derived
|
|
84
|
+
from the identity. You do not supply them, and you should not need to know that omitting them
|
|
85
|
+
produces a bodyless 502.
|
|
86
|
+
|
|
87
|
+
`--dry-run` prints the intent that would be sent without sending it — also the starting point if
|
|
88
|
+
you need a multi-leg intent, which you then pass to `tx create --intent @file.json`.
|
|
89
|
+
|
|
90
|
+
## Transfers
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
certen tx create --identity <uuid> --to-chain ethereum-sepolia \
|
|
94
|
+
--from 0xYourAbstractAccount --to 0xRecipient --amount 0.001 --sign-with dev --wait
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**`--amount` is in WHOLE UNITS.** `1` means one ETH, `0.5` means half. This is the field most
|
|
98
|
+
worth reading twice: the gateway documented it as wei until 2026-08-11, and someone sending `1`
|
|
99
|
+
meaning one wei moves a whole ETH — which on a funded account succeeds silently.
|
|
100
|
+
|
|
101
|
+
`--from` is the identity's abstract account on the source chain; `certen portfolio` shows it.
|
|
102
|
+
|
|
103
|
+
If that account has no gas, the CLI refuses before submitting. That refusal is worth having: an
|
|
104
|
+
intent from an empty abstract account is accepted, signed and submitted — every step reports
|
|
105
|
+
success — and then parks at `anchoring` forever, because the execution leg cannot run on chain.
|
|
106
|
+
`--force` overrides it.
|
|
107
|
+
|
|
108
|
+
Or drive the steps yourself — useful when the signer is an HSM, another machine, or your own
|
|
109
|
+
policy engine:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
certen tx create --identity <uuid> ... # returns signing_data.hash_to_sign
|
|
113
|
+
certen keys sign --name dev --hash <hash> # or your HSM
|
|
114
|
+
certen tx sign <intent-id> --signature <sig> --public-key <pub>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
`--signature`/`--public-key` remain first-class. `--sign-with` is a convenience, not a replacement.
|
|
118
|
+
|
|
119
|
+
## Proofs
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
certen proof get <intent-id> # also accepts a proof id or a transaction hash
|
|
123
|
+
certen proof bundle <proof-id> # the artifact to hand over
|
|
124
|
+
certen proof share <proof-id> # a link a counterparty opens without a key of yours
|
|
125
|
+
certen proof verify <intent-id> # what was, and was NOT, verified
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
`proof verify` reports three separate judgements — inclusion, authorization, outcome — and it can
|
|
129
|
+
establish only the first, and only as something the gateway asserted. It says so. Asking the
|
|
130
|
+
gateway is not independent verification; to verify without trusting CERTEN, query an Accumulate
|
|
131
|
+
node for the receipt and read the execution on the destination chain.
|
|
132
|
+
|
|
133
|
+
`proof get` falls back to the Accumulate merkle receipt when the proof-service is unavailable or
|
|
134
|
+
when an intent has no `proof_id` — the normal case for governance and authorization transactions.
|
|
135
|
+
A 5xx from the proof-service means that service is down, **not** that your proof is missing.
|
|
136
|
+
|
|
137
|
+
## Multi-party approvals
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
certen pending list
|
|
141
|
+
certen pending sign <id> --identity <adi> --vote approve
|
|
142
|
+
certen pending submit <request-id> --sign-with dev --hash <hash>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
`--vote` takes `approve`, `reject`, or `abstain` — lowercase strings. Not `accept`, and not a
|
|
146
|
+
number.
|
|
147
|
+
|
|
148
|
+
## Everything else
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
certen chains # what CERTEN is deployed on (no API key needed)
|
|
152
|
+
certen whoami # which key, which gateway, what standing
|
|
153
|
+
certen identity get <id> | list | link-chain <id> --chain <chain> | retire <id> --yes
|
|
154
|
+
certen portfolio # balances across every identity and chain
|
|
155
|
+
certen tx status <id> --wait | tx list
|
|
156
|
+
certen pricing # everything CERTEN charges for, in one call
|
|
157
|
+
certen balance | quote --chain <chain> [--sku <sku>] | fund <amount> --chain <chain>
|
|
158
|
+
certen governance add-delegate | set-threshold
|
|
159
|
+
certen admin api-keys list | create | rotate | revoke
|
|
160
|
+
certen admin audit-log | usage
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Run `certen <group> --help` for the flags on any of them, or `certen --help` for the whole tree
|
|
164
|
+
grouped by where you are in the journey.
|
|
165
|
+
|
|
166
|
+
## Chains
|
|
167
|
+
|
|
168
|
+
This CLI targets `ethereum-sepolia`, `base-sepolia` and `arbitrum-sepolia`. A chain outside that
|
|
169
|
+
set is refused with the reason — and if the gateway genuinely serves it, the refusal says so
|
|
170
|
+
rather than claiming it does not exist. `CERTEN_ALLOW_ANY_CHAIN=1` lifts the restriction.
|
|
171
|
+
|
|
172
|
+
## Scripting and AI agents: `--json`
|
|
173
|
+
|
|
174
|
+
`--json` turns the CLI into a machine interface. It is a contract, documented in full in
|
|
175
|
+
[docs/CLI-CONTRACT.md](../../docs/CLI-CONTRACT.md) and enforced by a conformance suite.
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
certen --json tx status <id>
|
|
179
|
+
# {"ok":true,"data":{"intent_id":"…","status":"completed"}}
|
|
180
|
+
|
|
181
|
+
certen --json portfolio
|
|
182
|
+
# {"ok":false,"error":{"code":"NETWORK_ERROR","message":"connect ECONNREFUSED","retryable":true,"status":0}}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
- **Exactly one JSON object on stdout**, nothing else. Every human-facing line goes to stderr.
|
|
186
|
+
- **Exit codes:** `0` ok · `1` operation failed · `2` usage error · `3` gateway unreachable. Branch on
|
|
187
|
+
these instead of parsing text. `3` guarantees nothing was submitted, so a retry cannot
|
|
188
|
+
double-execute.
|
|
189
|
+
- **`error.retryable`** comes from the SDK's own `CertenError.isRetryable`, so the CLI and the SDK
|
|
190
|
+
give an identical retry decision.
|
|
191
|
+
- **`certen --help --json`** returns the entire command tree — every command, flag and exit code — in
|
|
192
|
+
one call.
|
|
193
|
+
|
|
194
|
+
Without `--json`, output is the human table format as before. Do not parse it.
|
|
195
|
+
|
|
196
|
+
## Configuration
|
|
197
|
+
|
|
198
|
+
| | |
|
|
199
|
+
|---|---|
|
|
200
|
+
| `CERTEN_API_KEY` | API key. Always wins, so CI never touches the keyring or config file. |
|
|
201
|
+
| `CERTEN_API_URL` | Gateway base URL. Defaults to `https://gateway.kompendium.co`. |
|
|
202
|
+
| `CERTEN_KEY_PASSPHRASE` | Passphrase for local signing keys. |
|
|
203
|
+
|
|
204
|
+
`certen auth login` stores the API key in your OS keyring by default, or in
|
|
205
|
+
`~/.certen/config.json` at `0600` with `--no-keyring`.
|
|
206
|
+
|
|
207
|
+
## Things that will bite you
|
|
208
|
+
|
|
209
|
+
**Identity creation is asynchronous.** `identity create` returns `202` and provisioning continues.
|
|
210
|
+
Poll until the status is terminal, and check `can_sign` — it derives from the on-chain key page, so
|
|
211
|
+
it can read `true` while the status is still `creating`.
|
|
212
|
+
|
|
213
|
+
**A proof cycle takes 60–110 seconds.** Real validator work, not a tunable delay. Do not wrap it in
|
|
214
|
+
a 30-second timeout.
|
|
215
|
+
|
|
216
|
+
**Sign the bytes, not the text.** If you are producing signatures outside this CLI: sign the raw
|
|
217
|
+
bytes of the hash, do not hash it again, and do not sign the ASCII of the hex string. All three
|
|
218
|
+
mistakes produce a well-formed 128-hex signature the gateway rejects. `certen keys sign` handles
|
|
219
|
+
this for you.
|
|
220
|
+
|
|
221
|
+
## Documentation
|
|
222
|
+
|
|
223
|
+
**<https://docs.kompendium.co>** — getting started, authentication, errors, idempotency, and
|
|
224
|
+
task-shaped guides: onboarding an identity, external signing, proof-gating a contract call, M-of-N
|
|
225
|
+
panels, and verifying a proof.
|
|
226
|
+
|
|
227
|
+
The [live API reference](https://gateway.kompendium.co/reference) is generated from the running
|
|
228
|
+
gateway and is authoritative — when a guide and the spec disagree, the spec is right.
|
|
229
|
+
|
|
230
|
+
## License
|
|
231
|
+
|
|
232
|
+
MIT
|
package/dist/chains.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chain vocabulary.
|
|
3
|
+
*
|
|
4
|
+
* Every command that takes a chain validates it HERE, before the network call. A typo used to
|
|
5
|
+
* travel all the way to the gateway and come back as a rejection with no visible connection to
|
|
6
|
+
* the flag that caused it — and in `fund`'s case it came back only after a real payment intent
|
|
7
|
+
* had already been opened against the wrong chain.
|
|
8
|
+
*
|
|
9
|
+
* The suggestion matters as much as the rejection. `--chain base` is not a typo of nothing: `base`
|
|
10
|
+
* is a real mainnet, and silently mapping it to `base-sepolia` would be the CLI guessing about
|
|
11
|
+
* where money goes. So aliases SUGGEST and never substitute.
|
|
12
|
+
*
|
|
13
|
+
* This list is a constant today. Phase 2 replaces it with a cached read of `GET /v1/chains` and
|
|
14
|
+
* keeps this as the offline fallback — which is why the export is a function, not the array.
|
|
15
|
+
*/
|
|
16
|
+
/** The chains this product targets. Deliberately testnet-only. */
|
|
17
|
+
export declare const SUPPORTED_CHAINS: readonly ["ethereum-sepolia", "base-sepolia", "arbitrum-sepolia"];
|
|
18
|
+
export type SupportedChain = (typeof SUPPORTED_CHAINS)[number];
|
|
19
|
+
export declare function supportedChains(): readonly string[];
|
|
20
|
+
/**
|
|
21
|
+
* Registry slug → numeric EVM chain id.
|
|
22
|
+
*
|
|
23
|
+
* `execute.contractCall` passes `chainId` straight through to the intent leg. Leaving it undefined
|
|
24
|
+
* makes the caller supply a number they already told us by naming the chain, so it is derived —
|
|
25
|
+
* from the cached registry when there is one, and from this table otherwise.
|
|
26
|
+
*/
|
|
27
|
+
export declare function chainIdFor(chain: string): number | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Resolve whatever the gateway called a chain into one canonical name.
|
|
30
|
+
*
|
|
31
|
+
* Anything unrecognised is returned unchanged: a value we cannot map is still the best label we
|
|
32
|
+
* have for it, and inventing one would be worse than showing what arrived.
|
|
33
|
+
*/
|
|
34
|
+
export declare function normalizeChain(value: string | number | null | undefined): string;
|
|
35
|
+
interface ChainCache {
|
|
36
|
+
fetched_at: string;
|
|
37
|
+
/** Registry ids the gateway reported, e.g. ['ethereum-sepolia', 'solana-devnet', ...]. */
|
|
38
|
+
ids: string[];
|
|
39
|
+
/** Numeric EVM chain id → registry slug, so a numeric `chain_id` can be resolved live. */
|
|
40
|
+
numeric?: Record<string, string>;
|
|
41
|
+
}
|
|
42
|
+
export declare function readChainCache(): ChainCache | null;
|
|
43
|
+
export declare function chainCacheIsFresh(cache: ChainCache | null): boolean;
|
|
44
|
+
export declare function writeChainCache(entries: Array<{
|
|
45
|
+
id: string;
|
|
46
|
+
chainId: number | null;
|
|
47
|
+
}>): void;
|
|
48
|
+
export declare const CHAIN_CACHE_FILE: string;
|
|
49
|
+
export declare function isSupportedChain(value: string): boolean;
|
|
50
|
+
/** The closest supported chain to `value`, or undefined if nothing is close enough to suggest. */
|
|
51
|
+
export declare function nearestChain(value: string): string | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Validate one chain name, throwing a UsageError that names the alternatives.
|
|
54
|
+
*
|
|
55
|
+
* `flag` is the option the value arrived on, so the message points at what the caller typed rather
|
|
56
|
+
* than at an abstract notion of "chain".
|
|
57
|
+
*/
|
|
58
|
+
export declare function assertChain(value: string, flag?: string): string;
|
|
59
|
+
/**
|
|
60
|
+
* Validate a comma-separated list, as `--chains` takes.
|
|
61
|
+
*
|
|
62
|
+
* Empty entries are dropped rather than rejected — a trailing comma is a slip, not an instruction,
|
|
63
|
+
* and failing on it would be pedantry. An empty list after that is an error, because the caller
|
|
64
|
+
* clearly meant to name at least one.
|
|
65
|
+
*/
|
|
66
|
+
export declare function assertChains(value: string, flag?: string): string[];
|
|
67
|
+
export {};
|