@certen.io/sdk 0.7.1 → 0.8.1

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 CHANGED
@@ -1,5 +1,62 @@
1
1
  # Changelog — @certen.io/sdk
2
2
 
3
+ ## 0.8.1 — the owner governs the key book too
4
+
5
+ ### Added — `requireSigner(book, { account })` and `releaseSigner(book, { account })`
6
+
7
+ Accumulate authorizes each account by ITS OWN authority set, and a key book's default authority is
8
+ itself. So a policy signer named on the identity gates every spend but not `addSeat` /
9
+ `setThreshold` on the agent's page: an agent could reseat itself without its owner noticing.
10
+ `{ account: 'book' }` names the same book on the agent's key book (`acc://<adi>/book`), so who
11
+ may act for the agent is also the owner's decision, and the agent cannot undo it with its own key.
12
+ A full account URL under the identity is accepted too. Needs api-gateway with `account_url` on
13
+ authority operations (PR #34, deployed 2026-09-05).
14
+
15
+ ```ts
16
+ await agent.governance.requireSigner('acc://owner-policy.acme/book'); // every spend
17
+ await agent.governance.requireSigner('acc://owner-policy.acme/book', { account: 'book' }); // every seat and threshold
18
+ ```
19
+
20
+ ## 0.8.0 — an agent is one object
21
+
22
+ ### Added — `CertenAgent`: one identity, any chain, every verb an autonomous agent needs
23
+
24
+ ```ts
25
+ import { CertenClient, CertenAgent, ed25519Signer } from '@certen.io/sdk';
26
+
27
+ const signer = ed25519Signer(process.env.AGENT_SEED); // or ed25519Signer() and persist .seedHex
28
+ const agent = new CertenAgent(new CertenClient({ apiKey }), signer);
29
+ await agent.provision({ name: 'seller-bot', chains: ['base-sepolia'] });
30
+ await agent.linkChain('arbitrum-sepolia'); // same ADI, same key book, no new identity
31
+ const intent = await agent.call({ chain: 'base-sepolia', call: { target, functionSignature: 'ship(bytes32,string)', args } });
32
+ await agent.wait(intent.intentId);
33
+ const link = await agent.share(intent.intentId); // a URL a stranger verifies with no account
34
+ await agent.governance.requireSigner('acc://owner-policy.acme/book'); // the owner's policy signer gates every spend
35
+ ```
36
+
37
+ Every integration composed the resources by hand and made the same mistakes — the ASCII of a hash
38
+ signed instead of its bytes, a transfer with no ADI, a token amount in whole units, a governance
39
+ operation created and never signed, a share link minted before the proof existed. `CertenAgent`
40
+ is that composition written once and tested for each of those. It is escrow-free: an escrow ABI
41
+ is one partner's contract, and it belongs on top of `call()`, not inside the core.
42
+
43
+ `ed25519Signer(seedHex?)` makes a signer from a 32-byte seed, or a fresh key when called without
44
+ one. The agent holds a signer and hands the gateway signatures; the key never leaves.
45
+
46
+ `token()` moves an ERC-20 as a proof-gated `transfer(to, amount)` on the token contract, gated on
47
+ the `Transfer` event, with the amount in the token's base units. `governance.requireSigner(book)`
48
+ names a key book as a required authority, which is how the headless policy signer regulates an
49
+ agent without changing how the agent builds transactions.
50
+
51
+ ### Fixed — `execute.transfer()` documented `amount` as wei; the wire takes WHOLE units
52
+
53
+ The bridge multiplies `amount` by the chain's decimals. This SDK said "base units (wei)" — the exact
54
+ inverse — so a caller following the doc would move 10^18 times what they meant, and `"1"` for one wei
55
+ would move a whole ETH, silently, on a funded account. The doc now says whole units, and
56
+ `transfer()` refuses locally, before any request: an integer of ten or more digits (that is wei in
57
+ every real case), a non-decimal string, and a missing `adiUrl` (which the bridge turned into a
58
+ bodyless 502). `ContractCall.value` is unchanged and IS wei, because it is forwarded verbatim.
59
+
3
60
  ## 0.7.1 — share links honour the TTL you asked for
4
61
 
5
62
  ### Fixed — `proof.share()` sent a field the gateway does not read
package/README.md CHANGED
@@ -94,6 +94,36 @@ try {
94
94
 
95
95
  **Pagination helpers.** `paginate` and `paginateWithTotal` iterate a paged endpoint as an async generator.
96
96
 
97
+ ## An agent, as one object
98
+
99
+ `CertenAgent` is the composition an autonomous agent needs: one identity, accounts on any chain,
100
+ and every proof-gated verb, with the key held by a signer that never leaves the process.
101
+
102
+ ```ts
103
+ import { CertenClient, CertenAgent, ed25519Signer } from '@certen.io/sdk';
104
+
105
+ const signer = ed25519Signer(process.env.AGENT_SEED); // 64 hex; or ed25519Signer() and persist .seedHex
106
+ const agent = new CertenAgent(new CertenClient({ apiKey }), signer);
107
+
108
+ await agent.provision({ name: 'seller-bot', chains: ['base-sepolia'] });
109
+ await agent.linkChain('arbitrum-sepolia'); // same ADI, no new identity, no new key
110
+
111
+ const intent = await agent.call({
112
+ chain: 'base-sepolia',
113
+ call: { target: escrobot, functionSignature: 'ship(bytes32,string)', args: [orderId, 'TRACK-1'],
114
+ expectedEvents: [{ contract: escrobot, topic0: shippedTopic }] },
115
+ });
116
+ await agent.wait(intent.intentId);
117
+ const link = await agent.share(intent.intentId); // verifiable by a stranger, no account needed
118
+
119
+ await agent.token({ chain: 'base-sepolia', token: usdc, to, amount: '1000000' }); // 1 USDC, proof-gated
120
+ await agent.governance.requireSigner('acc://owner-policy.acme/book'); // the owner's rules gate every spend
121
+ await agent.governance.requireSigner('acc://owner-policy.acme/book', { account: 'book' }); // ...and who may act for the agent
122
+ ```
123
+
124
+ Resume an existing agent by passing its saved `state` (identity id, ADI, accounts) as the third
125
+ constructor argument. An escrow or any other contract ABI belongs on top of `call()`, not inside.
126
+
97
127
  ## Resources
98
128
 
99
129
  | | |
@@ -0,0 +1,209 @@
1
+ import type { CertenClient } from './client.js';
2
+ import type { SignFn, OpenedIntent } from './resources/execute.js';
3
+ import type { ContractCall, CreateGovernanceResponse, Identity, ProofClass, ProofShare, TransactionResponse } from './types.js';
4
+ /**
5
+ * CertenAgent — one identity, any chain, every verb an autonomous agent needs.
6
+ *
7
+ * The gateway's resources mirror its endpoints: identities, transactions, governance, signing,
8
+ * proofs. An agent that wants to *be* something on CERTEN has to compose them in the right order
9
+ * with the right key at every step, and every integration that did so by hand made the same
10
+ * mistakes — signing the ASCII of a hash, forgetting the ADI on a transfer, wiring an escrow ABI
11
+ * into the core. This is that composition, written once, escrow-free.
12
+ *
13
+ * What an agent is here: an Accumulate ADI (its identity), a key book (who may sign for it), and
14
+ * one abstract account per chain (its `msg.sender` there, derived from the ADI). The verbs:
15
+ *
16
+ * provision() create the ADI and its first chain account(s), wait until active
17
+ * linkChain() reach another chain with the same ADI — no new identity, no new key
18
+ * transfer() move native value from the agent's account, proof-gated
19
+ * token() move an ERC-20 from the agent's account, proof-gated (a `transfer` call)
20
+ * call() any contract call from the agent's account, proof-gated
21
+ * cosign() add this agent's signature to a pending action on a shared page
22
+ * pending() the inbox of things waiting on this agent
23
+ * proof() / share() the proof of what happened, and a link a stranger verifies with no account
24
+ * governance.* add a seat, set a threshold, name a policy signer as a required authority
25
+ *
26
+ * YOUR KEY NEVER REACHES THE GATEWAY. The agent holds a `signer` — a public key and a function that
27
+ * signs 32 raw bytes — and hands the gateway signatures, never the key. `ed25519Signer()` makes one
28
+ * from a seed for the common case; anything that can sign Ed25519 (an HSM, a policy signer, a
29
+ * hardware key) fits the same shape.
30
+ */
31
+ /** Signs raw bytes for one Ed25519 key. `sign` receives the hex of the bytes to sign and returns 128 hex. */
32
+ export interface AgentSigner {
33
+ /** 64 hex — the raw 32-byte Ed25519 public key. */
34
+ publicKey: string;
35
+ /** 64 hex — sha256 of the raw public key bytes, which is how a key page names a key. */
36
+ publicKeyHash: string;
37
+ sign: SignFn;
38
+ }
39
+ /**
40
+ * An Ed25519 signer from a 32-byte seed (64 hex). The seed is the private half; keep it where the
41
+ * agent alone can read it. Omit the seed to generate a fresh key — and persist `seedHex` yourself,
42
+ * because a key that only ever lived in memory cannot sign for the identity it created.
43
+ */
44
+ export declare function ed25519Signer(seedHex?: string): AgentSigner & {
45
+ seedHex: string;
46
+ };
47
+ export interface CertenAgentState {
48
+ identityId: string;
49
+ adiUrl: string;
50
+ keyPageUrl: string | null;
51
+ /** chain id → abstract account address on that chain. */
52
+ accounts: Record<string, string>;
53
+ }
54
+ export interface ProvisionParams {
55
+ /** ADI name, e.g. `seller-bot-7`. Becomes `acc://<name>.acme`. */
56
+ name: string;
57
+ /** Chains to open an account on now. More can be linked later. */
58
+ chains: string[];
59
+ /** Accumulate credits for the key page. The gateway default (500) covers thousands of write-backs. */
60
+ credits?: number;
61
+ timeoutMs?: number;
62
+ /** Poll cadence while waiting for accounts. Leave unset outside tests. */
63
+ pollIntervalMs?: number;
64
+ onPoll?: (identity: Identity) => void;
65
+ }
66
+ /** Common knobs on every proof-gated action. */
67
+ interface ActionOpts {
68
+ proofClass?: ProofClass;
69
+ idempotencyKey?: string;
70
+ /** Sign with a different page of the book, e.g. a priority page — the seat still has to be on it. */
71
+ signerKeyPage?: string;
72
+ /** Submit even if the account is known to hold no gas. */
73
+ skipFundingCheck?: boolean;
74
+ }
75
+ export declare class CertenAgent {
76
+ private readonly client;
77
+ readonly signer: AgentSigner;
78
+ readonly state: CertenAgentState;
79
+ /**
80
+ * @param client A configured client. The API key on it is the organization's; the agent's own
81
+ * authority is the signer, which is what the key book knows.
82
+ * @param signer The agent's Ed25519 key, as a signer — see `ed25519Signer`.
83
+ * @param state An already-provisioned identity, to resume. Omit to `provision()` a new one.
84
+ */
85
+ constructor(client: CertenClient, signer: AgentSigner, state?: CertenAgentState);
86
+ /** The agent's abstract account on a chain, or a clear error if it has none there yet. */
87
+ account(chain: string): string;
88
+ private requireIdentity;
89
+ /**
90
+ * Create the agent's identity: an ADI bound to this signer's key, with an abstract account on each
91
+ * chain in `chains`. Waits until the identity is active and every requested account has an address.
92
+ */
93
+ provision(p: ProvisionParams): Promise<CertenAgentState>;
94
+ /**
95
+ * Reach another chain with the same identity. One PATCH and an account deploy; the ADI, the key
96
+ * book and every policy on it are unchanged. Resolves to the new account's address.
97
+ */
98
+ linkChain(chain: string, { timeoutMs, pollIntervalMs }?: {
99
+ timeoutMs?: number;
100
+ pollIntervalMs?: number;
101
+ }): Promise<string>;
102
+ /** Re-read the identity from the gateway and refresh the account map. */
103
+ refresh(): Promise<CertenAgentState>;
104
+ private absorbAccounts;
105
+ private waitForAccounts;
106
+ /** Move native value from the agent's account on `chain`. `amount` is WHOLE units, e.g. "0.001". */
107
+ transfer(p: {
108
+ chain: string;
109
+ to: string;
110
+ amount: string;
111
+ } & ActionOpts): Promise<OpenedIntent>;
112
+ /**
113
+ * Any contract call from the agent's account, proof-gated: the validators execute exactly this
114
+ * (target, value, calldata) or nothing. `value` is wei. Name the events the call must emit so
115
+ * the proof is of the effect, not merely of non-revert.
116
+ */
117
+ call(p: {
118
+ chain: string;
119
+ call: ContractCall;
120
+ chainId?: number;
121
+ } & ActionOpts): Promise<OpenedIntent>;
122
+ /**
123
+ * Move an ERC-20 from the agent's account: a proof-gated `transfer(to, amount)` on the token
124
+ * contract. `amount` is in the token's base units as a string (USDC has 6 decimals: "1000000" is
125
+ * one USDC). The policy signer decodes this calldata and gates on the token amount.
126
+ */
127
+ token(p: {
128
+ chain: string;
129
+ token: string;
130
+ to: string;
131
+ amount: string;
132
+ chainId?: number;
133
+ } & ActionOpts): Promise<OpenedIntent>;
134
+ /** Add this agent's vote to a pending action on a page it holds a seat on. */
135
+ cosign(p: {
136
+ accumTxHash: string;
137
+ signerUrl?: string;
138
+ vote?: 'approve' | 'reject' | 'abstain';
139
+ }): Promise<Record<string, unknown>>;
140
+ /** Things waiting on this agent's signature. */
141
+ pending(params?: Parameters<CertenClient['pending']['list']>[0]): Promise<import("./types.js").PendingActionsResponse>;
142
+ /** Wait for an intent to reach a terminal state. */
143
+ wait(intentId: string, opts?: Parameters<CertenClient['execute']['wait']>[1]): Promise<TransactionResponse>;
144
+ /** The proof of an intent — a CERTEN proof artifact, or the anchored Accumulate receipt if none exists yet. */
145
+ proof(intentId: string, opts?: Parameters<CertenClient['execute']['proof']>[1]): Promise<{
146
+ kind: "certen-proof";
147
+ proofId: string;
148
+ proof: unknown;
149
+ intent: TransactionResponse;
150
+ } | {
151
+ kind: "accumulate-receipt";
152
+ txHash: string;
153
+ receipt: unknown;
154
+ intent: TransactionResponse;
155
+ }>;
156
+ /**
157
+ * A link a counterparty verifies against CERTEN with no account of its own. Resolves the intent's
158
+ * proof first; throws NO_PROOF_YET if only the Accumulate receipt exists (proofs anchor 60–120 s
159
+ * after the leg completes — wait and retry).
160
+ */
161
+ share(intentId: string, params?: {
162
+ label?: string;
163
+ expiresInHours?: number;
164
+ maxViews?: number;
165
+ }): Promise<ProofShare>;
166
+ /**
167
+ * Who may sign for this agent, and under what rules. Every operation here is itself signed by the
168
+ * agent's key and lands on its key page; nothing about how the agent builds transactions changes.
169
+ */
170
+ readonly governance: {
171
+ /** Seat another key on the agent's page — a co-signer, a human, a second agent. */
172
+ addSeat: (publicKeyHash: string, opts?: {
173
+ signerKeyPage?: string;
174
+ }) => Promise<CreateGovernanceResponse>;
175
+ /** Remove a seat. */
176
+ removeSeat: (publicKeyHash: string, opts?: {
177
+ signerKeyPage?: string;
178
+ }) => Promise<CreateGovernanceResponse>;
179
+ /** How many seats must sign: M of N. */
180
+ setThreshold: (threshold: number, opts?: {
181
+ signerKeyPage?: string;
182
+ }) => Promise<CreateGovernanceResponse>;
183
+ /**
184
+ * Name a key book as a REQUIRED AUTHORITY on the agent's identity. From then on every transaction
185
+ * the agent submits sits pending until that book signs too — which is how the headless policy
186
+ * signer regulates an agent: the owner's rules gate every spend, and the agent cannot opt out.
187
+ *
188
+ * Accumulate authorizes each account by ITS OWN authority set, and a key book's default authority
189
+ * is itself. So an authority on the identity governs its data and token accounts but not
190
+ * `addSeat` / `setThreshold` on the agent's page. Pass `{ account: 'book' }` (or a full account
191
+ * URL under the identity) to name the book on the key book too: then who may act for the agent
192
+ * is also the owner's decision, and the agent cannot undo it with its own key.
193
+ */
194
+ requireSigner: (bookUrl: string, opts?: {
195
+ signerKeyPage?: string;
196
+ account?: "identity" | "book" | string;
197
+ }) => Promise<CreateGovernanceResponse>;
198
+ /** Remove a required authority (from the identity, or from the account named by `account`). */
199
+ releaseSigner: (bookUrl: string, opts?: {
200
+ signerKeyPage?: string;
201
+ account?: "identity" | "book" | string;
202
+ }) => Promise<CreateGovernanceResponse>;
203
+ };
204
+ /** The `account_url` for an authority operation: nothing for the identity, the key book for 'book', a URL as given. */
205
+ private authorityTarget;
206
+ private governanceOp;
207
+ }
208
+ export {};
209
+ //# sourceMapp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,OAAO,CAAC,UAAU,CAAC;IAU/H;;;OAGG;IACH,QAAQ,CAAC,UAAU;QACjB,mFAAmF;iCAC1D,MAAM,SAAQ;YAAE,aAAa,CAAC,EAAE,MAAM,CAAA;SAAE;QAGjE,qBAAqB;oCACO,MAAM,SAAQ;YAAE,aAAa,CAAC,EAAE,MAAM,CAAA;SAAE;QAGpE,wCAAwC;kCACd,MAAM,SAAQ;YAAE,aAAa,CAAC,EAAE,MAAM,CAAA;SAAE;QAGlE;;;;;;;;;;WAUG;iCACsB,MAAM,SAAQ;YAAE,aAAa,CAAC,EAAE,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;SAAE;QAGzG,+FAA+F;iCACtE,MAAM,SAAQ;YAAE,aAAa,CAAC,EAAE,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;SAAE;MAEzG;IAEF,uHAAuH;IACvH,OAAO,CAAC,eAAe;YAUT,YAAY;CAc3B"}
package/dist/agent.js ADDED
@@ -0,0 +1,283 @@
1
+ import { createHash, createPrivateKey, createPublicKey, sign as nodeSign, generateKeyPairSync } from 'node:crypto';
2
+ import { CertenError } from './errors.js';
3
+ /**
4
+ * An Ed25519 signer from a 32-byte seed (64 hex). The seed is the private half; keep it where the
5
+ * agent alone can read it. Omit the seed to generate a fresh key — and persist `seedHex` yourself,
6
+ * because a key that only ever lived in memory cannot sign for the identity it created.
7
+ */
8
+ export function ed25519Signer(seedHex) {
9
+ let seed;
10
+ if (seedHex) {
11
+ seed = Buffer.from(seedHex.replace(/^0x/, ''), 'hex');
12
+ if (seed.length !== 32)
13
+ throw new CertenError('ed25519Signer: seed must be 32 bytes (64 hex)', 0, 'BAD_SEED');
14
+ }
15
+ else {
16
+ const { privateKey } = generateKeyPairSync('ed25519');
17
+ const der = privateKey.export({ format: 'der', type: 'pkcs8' });
18
+ seed = der.subarray(der.length - 32);
19
+ }
20
+ // PKCS#8 wrapper for a raw Ed25519 seed: fixed 16-byte prefix + the 32-byte seed.
21
+ const pkcs8 = Buffer.concat([Buffer.from('302e020100300506032b657004220420', 'hex'), seed]);
22
+ const privateKey = createPrivateKey({ key: pkcs8, format: 'der', type: 'pkcs8' });
23
+ const spki = createPublicKey(privateKey).export({ format: 'der', type: 'spki' });
24
+ const publicKeyBytes = spki.subarray(spki.length - 32);
25
+ const publicKey = publicKeyBytes.toString('hex');
26
+ const publicKeyHash = createHash('sha256').update(publicKeyBytes).digest('hex');
27
+ return {
28
+ publicKey,
29
+ publicKeyHash,
30
+ seedHex: seed.toString('hex'),
31
+ // Sign the RAW BYTES of the hex — never the ASCII of the hex.
32
+ sign: (hashHex) => nodeSign(null, Buffer.from(hashHex.replace(/^0x/, ''), 'hex'), privateKey).toString('hex'),
33
+ };
34
+ }
35
+ export class CertenAgent {
36
+ client;
37
+ signer;
38
+ state;
39
+ /**
40
+ * @param client A configured client. The API key on it is the organization's; the agent's own
41
+ * authority is the signer, which is what the key book knows.
42
+ * @param signer The agent's Ed25519 key, as a signer — see `ed25519Signer`.
43
+ * @param state An already-provisioned identity, to resume. Omit to `provision()` a new one.
44
+ */
45
+ constructor(client, signer, state) {
46
+ this.client = client;
47
+ this.signer = signer;
48
+ this.state = state ?? { identityId: '', adiUrl: '', keyPageUrl: null, accounts: {} };
49
+ }
50
+ /** The agent's abstract account on a chain, or a clear error if it has none there yet. */
51
+ account(chain) {
52
+ const addr = this.state.accounts[chain];
53
+ if (!addr) {
54
+ throw new CertenError(`agent ${this.state.adiUrl || '(unprovisioned)'} has no account on ${chain} — call linkChain('${chain}') first`, 0, 'NO_ACCOUNT_ON_CHAIN');
55
+ }
56
+ return addr;
57
+ }
58
+ requireIdentity() {
59
+ if (!this.state.identityId) {
60
+ throw new CertenError('agent is not provisioned — call provision() or pass state to the constructor', 0, 'NOT_PROVISIONED');
61
+ }
62
+ }
63
+ // ---- identity -------------------------------------------------------------------------------
64
+ /**
65
+ * Create the agent's identity: an ADI bound to this signer's key, with an abstract account on each
66
+ * chain in `chains`. Waits until the identity is active and every requested account has an address.
67
+ */
68
+ async provision(p) {
69
+ if (this.state.identityId) {
70
+ throw new CertenError(`agent is already provisioned as ${this.state.adiUrl}`, 0, 'ALREADY_PROVISIONED');
71
+ }
72
+ const identity = await this.client.identity.createAndWait({
73
+ name: p.name,
74
+ publicKey: this.signer.publicKey,
75
+ publicKeyHash: this.signer.publicKeyHash,
76
+ chains: p.chains,
77
+ credits: p.credits,
78
+ }, { timeoutMs: p.timeoutMs, intervalMs: p.pollIntervalMs, onPoll: p.onPoll });
79
+ this.state.identityId = identity.id;
80
+ this.state.adiUrl = identity.adi_url;
81
+ this.state.keyPageUrl = identity.key_page_url;
82
+ this.absorbAccounts(identity.chain_accounts);
83
+ await this.waitForAccounts(p.chains, p.timeoutMs, p.pollIntervalMs);
84
+ return this.state;
85
+ }
86
+ /**
87
+ * Reach another chain with the same identity. One PATCH and an account deploy; the ADI, the key
88
+ * book and every policy on it are unchanged. Resolves to the new account's address.
89
+ */
90
+ async linkChain(chain, { timeoutMs, pollIntervalMs } = {}) {
91
+ this.requireIdentity();
92
+ if (this.state.accounts[chain])
93
+ return this.state.accounts[chain];
94
+ const updated = await this.client.identity.update(this.state.identityId, { linkChains: [chain] });
95
+ this.absorbAccounts(updated.chain_accounts);
96
+ await this.waitForAccounts([chain], timeoutMs, pollIntervalMs);
97
+ return this.state.accounts[chain];
98
+ }
99
+ /** Re-read the identity from the gateway and refresh the account map. */
100
+ async refresh() {
101
+ this.requireIdentity();
102
+ const identity = await this.client.identity.get(this.state.identityId);
103
+ this.state.adiUrl = identity.adi_url ?? this.state.adiUrl;
104
+ this.state.keyPageUrl = identity.key_page_url ?? this.state.keyPageUrl;
105
+ this.absorbAccounts(identity.chain_accounts);
106
+ return this.state;
107
+ }
108
+ absorbAccounts(accounts) {
109
+ for (const a of accounts ?? []) {
110
+ const chain = String(a.chain_id ?? a.chain ?? '');
111
+ const address = a.address;
112
+ if (chain && address)
113
+ this.state.accounts[chain] = address;
114
+ }
115
+ }
116
+ async waitForAccounts(chains, timeoutMs = 300_000, intervalMs = 8_000) {
117
+ const deadline = Date.now() + timeoutMs;
118
+ while (chains.some((c) => !this.state.accounts[c])) {
119
+ if (Date.now() > deadline) {
120
+ const missing = chains.filter((c) => !this.state.accounts[c]);
121
+ throw new CertenError(`identity ${this.state.adiUrl} is saved but has no account yet on ${missing.join(', ')} — provisioning is slower than usual, not lost; call refresh() later`, 0, 'ACCOUNT_PENDING');
122
+ }
123
+ await new Promise((r) => setTimeout(r, intervalMs));
124
+ await this.refresh();
125
+ }
126
+ }
127
+ // ---- proof-gated actions --------------------------------------------------------------------
128
+ /** Move native value from the agent's account on `chain`. `amount` is WHOLE units, e.g. "0.001". */
129
+ async transfer(p) {
130
+ this.requireIdentity();
131
+ return this.client.execute.transfer({
132
+ identityId: this.state.identityId,
133
+ adiUrl: this.state.adiUrl,
134
+ fromChain: p.chain,
135
+ toChain: p.chain,
136
+ fromAddress: this.account(p.chain),
137
+ toAddress: p.to,
138
+ amount: p.amount,
139
+ sign: this.signer.sign,
140
+ publicKey: this.signer.publicKey,
141
+ signerKeyPage: p.signerKeyPage,
142
+ proofClass: p.proofClass,
143
+ idempotencyKey: p.idempotencyKey,
144
+ skipFundingCheck: p.skipFundingCheck,
145
+ });
146
+ }
147
+ /**
148
+ * Any contract call from the agent's account, proof-gated: the validators execute exactly this
149
+ * (target, value, calldata) or nothing. `value` is wei. Name the events the call must emit so
150
+ * the proof is of the effect, not merely of non-revert.
151
+ */
152
+ async call(p) {
153
+ this.requireIdentity();
154
+ return this.client.execute.contractCall({
155
+ identityId: this.state.identityId,
156
+ adiUrl: this.state.adiUrl,
157
+ fromAddress: this.account(p.chain),
158
+ chain: p.chain,
159
+ chainId: p.chainId,
160
+ contractCall: p.call,
161
+ sign: this.signer.sign,
162
+ publicKey: this.signer.publicKey,
163
+ signerKeyPage: p.signerKeyPage,
164
+ proofClass: p.proofClass,
165
+ idempotencyKey: p.idempotencyKey,
166
+ skipFundingCheck: p.skipFundingCheck,
167
+ });
168
+ }
169
+ /**
170
+ * Move an ERC-20 from the agent's account: a proof-gated `transfer(to, amount)` on the token
171
+ * contract. `amount` is in the token's base units as a string (USDC has 6 decimals: "1000000" is
172
+ * one USDC). The policy signer decodes this calldata and gates on the token amount.
173
+ */
174
+ async token(p) {
175
+ if (!/^\d+$/.test(p.amount)) {
176
+ throw new CertenError(`token: amount must be an integer in the token's base units, got ${JSON.stringify(p.amount)}`, 0, 'BAD_AMOUNT');
177
+ }
178
+ return this.call({
179
+ ...p,
180
+ call: {
181
+ target: p.token,
182
+ functionSignature: 'transfer(address,uint256)',
183
+ args: [p.to, p.amount],
184
+ value: '0',
185
+ // Transfer(address indexed from, address indexed to, uint256 value)
186
+ expectedEvents: [{ contract: p.token, topic0: '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' }],
187
+ },
188
+ });
189
+ }
190
+ /** Add this agent's vote to a pending action on a page it holds a seat on. */
191
+ async cosign(p) {
192
+ this.requireIdentity();
193
+ const signerUrl = p.signerUrl ?? this.state.keyPageUrl;
194
+ if (!signerUrl)
195
+ throw new CertenError('cosign: no key page known for this agent — pass signerUrl', 0, 'NO_KEY_PAGE');
196
+ return this.client.execute.cosign({
197
+ accumTxHash: p.accumTxHash,
198
+ identity: this.state.adiUrl,
199
+ signerUrl,
200
+ publicKey: this.signer.publicKey,
201
+ sign: this.signer.sign,
202
+ vote: p.vote,
203
+ });
204
+ }
205
+ /** Things waiting on this agent's signature. */
206
+ pending(params) {
207
+ return this.client.pending.list(params);
208
+ }
209
+ /** Wait for an intent to reach a terminal state. */
210
+ wait(intentId, opts) {
211
+ return this.client.execute.wait(intentId, opts);
212
+ }
213
+ /** The proof of an intent — a CERTEN proof artifact, or the anchored Accumulate receipt if none exists yet. */
214
+ proof(intentId, opts) {
215
+ return this.client.execute.proof(intentId, opts);
216
+ }
217
+ /**
218
+ * A link a counterparty verifies against CERTEN with no account of its own. Resolves the intent's
219
+ * proof first; throws NO_PROOF_YET if only the Accumulate receipt exists (proofs anchor 60–120 s
220
+ * after the leg completes — wait and retry).
221
+ */
222
+ async share(intentId, params = {}) {
223
+ const p = await this.proof(intentId);
224
+ if (p.kind !== 'certen-proof') {
225
+ throw new CertenError(`intent ${intentId} has no proof artifact yet — it anchors after the leg completes; retry shortly`, 0, 'NO_PROOF_YET');
226
+ }
227
+ return this.client.proof.share(p.proofId, { expiresInHours: params.expiresInHours ?? 72, label: params.label, maxViews: params.maxViews });
228
+ }
229
+ // ---- governance -----------------------------------------------------------------------------
230
+ /**
231
+ * Who may sign for this agent, and under what rules. Every operation here is itself signed by the
232
+ * agent's key and lands on its key page; nothing about how the agent builds transactions changes.
233
+ */
234
+ governance = {
235
+ /** Seat another key on the agent's page — a co-signer, a human, a second agent. */
236
+ addSeat: (publicKeyHash, opts = {}) => this.governanceOp({ type: 'add_key', public_key_hash: publicKeyHash }, opts),
237
+ /** Remove a seat. */
238
+ removeSeat: (publicKeyHash, opts = {}) => this.governanceOp({ type: 'remove_key', public_key_hash: publicKeyHash }, opts),
239
+ /** How many seats must sign: M of N. */
240
+ setThreshold: (threshold, opts = {}) => this.governanceOp({ type: 'set_threshold', threshold }, opts),
241
+ /**
242
+ * Name a key book as a REQUIRED AUTHORITY on the agent's identity. From then on every transaction
243
+ * the agent submits sits pending until that book signs too — which is how the headless policy
244
+ * signer regulates an agent: the owner's rules gate every spend, and the agent cannot opt out.
245
+ *
246
+ * Accumulate authorizes each account by ITS OWN authority set, and a key book's default authority
247
+ * is itself. So an authority on the identity governs its data and token accounts but not
248
+ * `addSeat` / `setThreshold` on the agent's page. Pass `{ account: 'book' }` (or a full account
249
+ * URL under the identity) to name the book on the key book too: then who may act for the agent
250
+ * is also the owner's decision, and the agent cannot undo it with its own key.
251
+ */
252
+ requireSigner: (bookUrl, opts = {}) => this.governanceOp({ type: 'add_authority', authority_url: bookUrl, ...this.authorityTarget(opts.account) }, opts),
253
+ /** Remove a required authority (from the identity, or from the account named by `account`). */
254
+ releaseSigner: (bookUrl, opts = {}) => this.governanceOp({ type: 'remove_authority', authority_url: bookUrl, ...this.authorityTarget(opts.account) }, opts),
255
+ };
256
+ /** The `account_url` for an authority operation: nothing for the identity, the key book for 'book', a URL as given. */
257
+ authorityTarget(account) {
258
+ if (!account || account === 'identity')
259
+ return {};
260
+ if (account === 'book') {
261
+ this.requireIdentity();
262
+ const book = this.state.keyPageUrl ? this.state.keyPageUrl.replace(/\/\d+$/, '') : `${this.state.adiUrl}/book`;
263
+ return { account_url: book };
264
+ }
265
+ return { account_url: account };
266
+ }
267
+ async governanceOp(operation, opts) {
268
+ this.requireIdentity();
269
+ const created = await this.client.governance.create({
270
+ identity: this.state.adiUrl,
271
+ operations: [operation],
272
+ signerKeyPage: opts.signerKeyPage,
273
+ signerPublicKey: this.signer.publicKey,
274
+ });
275
+ const hash = created.signing_data?.hash_to_sign;
276
+ if (!hash)
277
+ return created; // provider-signed, or nothing to sign
278
+ const signature = await this.signer.sign(hash);
279
+ await this.client.governance.submitSignature(created.governance_op_id, { signature, publicKey: this.signer.publicKey });
280
+ return created;
281
+ }
282
+ }
283
+ //# sourceMappingURL=agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,IAAI,IAAI,QAAQ,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAYnH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAuC1C;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,IAAI,IAAY,CAAC;IACjB,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CA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KAAK,CAAC,YAAY,CAAC,SAAkC,EAAE,IAAgC;QAC7F,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC;YAClD,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;YAC3B,UAAU,EAAE,CAAC,SAAS,CAAC;YACvB,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS;SACvC,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,OAAO,CAAC,YAAY,EAAE,YAAY,CAAC;QAChD,IAAI,CAAC,IAAI;YAAE,OAAO,OAAO,CAAC,CAAC,sCAAsC;QACjE,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/C,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;QACxH,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -11,6 +11,8 @@ export { redeemRegistrationToken } from './registration.js';
11
11
  export { selfSignup, requestSignupChallenge, completeSignup } from './self-signup.js';
12
12
  export { CertenUnfundedAccountError, movesValue, normalizeChainId } from './funding.js';
13
13
  export { resolveSignTarget } from './sign-target.js';
14
+ export { CertenAgent, ed25519Signer } from './agent.js';
15
+ export type { AgentSigner, CertenAgentState, ProvisionParams } from './agent.js';
14
16
  export type { SignTarget } from './sign-target.js';
15
17
  export type { DoctorReport, DoctorCheck, CheckStatus } from './doctor.js';
16
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO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EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACzG,OAAO,EACL,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAG9D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGvE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGlF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAG5D,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,0BAA0B,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAExF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACxD,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACjF,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -20,4 +20,6 @@ export { selfSignup, requestSignupChallenge, completeSignup } from './self-signu
20
20
  export { CertenUnfundedAccountError, movesValue, normalizeChainId } from './funding.js';
21
21
  // One resolver, shared by the CLI and MCP. Two copies of this would drift — see sign-target.ts.
22
22
  export { resolveSignTarget } from './sign-target.js';
23
+ // An autonomous agent's identity and every proof-gated verb it needs, composed once. See agent.ts.
24
+ export { CertenAgent, ed25519Signer } from './agent.js';
23
25
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC1F,cAAc,YAAY,CAAC;AAE3B,OAAO,EACL,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC9D,8FAA8F;AAC9F,mBAAmB;AACnB,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACvE,gGAAgG;AAChG,iEAAiE;AACjE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAClF,iGAAiG;AACjG,wFAAwF;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,6FAA6F;AAC7F,sEAAsE;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,iGAAiG;AACjG,iEAAiE;AACjE,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,0BAA0B,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACxF,gGAAgG;AAChG,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC1F,cAAc,YAAY,CAAC;AAE3B,OAAO,EACL,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC9D,8FAA8F;AAC9F,mBAAmB;AACnB,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACvE,gGAAgG;AAChG,iEAAiE;AACjE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAClF,iGAAiG;AACjG,wFAAwF;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,6FAA6F;AAC7F,sEAAsE;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,iGAAiG;AACjG,iEAAiE;AACjE,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,0BAA0B,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACxF,gGAAgG;AAChG,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,mGAAmG;AACnG,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
@@ -72,7 +72,19 @@ export interface TransferParams {
72
72
  toChain: string;
73
73
  fromAddress: string;
74
74
  toAddress: string;
75
- /** Base units (wei) as a STRING — a JSON number silently loses precision past 2^53. */
75
+ /**
76
+ * WHOLE UNITS as a decimal STRING: `"0.001"` is a thousandth of an ETH, `"1"` is one ETH.
77
+ *
78
+ * Not wei. The bridge multiplies this by the chain's decimals (`convertToBaseUnits`), so a caller
79
+ * who sends wei here moves 10^18 times what they meant — and "1" for one wei moves a whole ETH,
80
+ * which succeeds silently on a funded account. This comment said "base units (wei)" until
81
+ * 2026-09-03, the exact inverse of what the wire does; the gateway's own schema had documented the
82
+ * same inversion on the multi-leg shape since 2026-08-11. `transfer()` now refuses an integer of
83
+ * ten or more digits, because no one means 10^9 whole ETH and everyone who writes it meant wei.
84
+ *
85
+ * A string, never a number: JSON numbers lose precision past 2^53 and "0.1" is not exactly 0.1.
86
+ * Contrast `ContractCall.value`, which IS wei, because it is forwarded verbatim into the call.
87
+ */
76
88
  amount: string;
77
89
  tokenSymbol?: string;
78
90
  sign: SignFn;
@@ -88,6 +100,18 @@ export interface TransferParams {
88
100
  /** Submit even if the abstract account is known to hold no gas. See ProofGatedCallParams. */
89
101
  skipFundingCheck?: boolean;
90
102
  }
103
+ /**
104
+ * Refuse locally what the gateway would either reject as a bodyless 502 or, worse, accept.
105
+ *
106
+ * - `adiUrl` missing: the upstream path dereferences it with no null check. TypeScript makes it
107
+ * required, but a JavaScript caller or a spread from a partial object still reaches here.
108
+ * - `amount` not a decimal string: the bridge's converter splits on "." and pads; anything else is
109
+ * garbage in, and garbage here is money.
110
+ * - `amount` an integer of ten or more digits: that is wei written into a whole-unit field. The
111
+ * largest native supply on any supported chain is under 10^9 whole units, so no genuine transfer
112
+ * trips this and every mistaken one does.
113
+ */
114
+ export declare function assertTransferParams(p: TransferParams): void;
91
115
  export interface OpenedIntent {
92
116
  intentId: string;
93
117
  accumTxHash?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/resources/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAKtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,UAAU,EAAqB,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvH;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,MAAM;IACrB,2GAA2G;IAC3G,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,OA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MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;KACzC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAwBpC;;;;;OAKG;IACG,IAAI,CACR,QAAQ,EAAE,MAAM,EAChB,EAAE,SAAmB,EAAE,UAAkB,EAAE,MAAM,EAAE,GAAE;QACnD,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,mBAAmB,KAAK,IAAI,CAAC;KACvC,GACL,OAAO,CAAC,mBAAmB,CAAC;IAoB/B;;;;;;OAMG;IACG,KAAK,CACT,QAAQ,EAAE,MAAM,EAChB,EAAE,SAA4B,EAAE,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO,GAC5D,OAAO,CACN;QAAE,IAAI,EAAE,cAAc,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,mBAAmB,CAAA;KAAE,GACtF;QAAE,IAAI,EAAE,oBAAoB,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,mBAAmB,CAAA;KAAE,CAChG;YAiBa,IAAI;CAmCnB"}
@@ -2,6 +2,30 @@ import { randomUUID } from 'crypto';
2
2
  import { omitUndefined } from '../internal.js';
3
3
  import { assertFundedForValue } from '../funding.js';
4
4
  import { SignResource } from './sign.js';
5
+ /**
6
+ * Refuse locally what the gateway would either reject as a bodyless 502 or, worse, accept.
7
+ *
8
+ * - `adiUrl` missing: the upstream path dereferences it with no null check. TypeScript makes it
9
+ * required, but a JavaScript caller or a spread from a partial object still reaches here.
10
+ * - `amount` not a decimal string: the bridge's converter splits on "." and pads; anything else is
11
+ * garbage in, and garbage here is money.
12
+ * - `amount` an integer of ten or more digits: that is wei written into a whole-unit field. The
13
+ * largest native supply on any supported chain is under 10^9 whole units, so no genuine transfer
14
+ * trips this and every mistaken one does.
15
+ */
16
+ export function assertTransferParams(p) {
17
+ if (!p.adiUrl || !p.adiUrl.startsWith('acc://')) {
18
+ throw new Error('transfer: adiUrl is required (the signing identity\'s ADI, e.g. acc://your-org.acme)');
19
+ }
20
+ const amount = String(p.amount ?? '');
21
+ if (!/^\d+(\.\d+)?$/.test(amount)) {
22
+ throw new Error(`transfer: amount must be a decimal string in WHOLE units, e.g. "0.001" — got ${JSON.stringify(p.amount)}`);
23
+ }
24
+ if (/^\d{10,}$/.test(amount)) {
25
+ throw new Error(`transfer: amount "${amount}" looks like wei. This field is WHOLE units — "0.001" for a thousandth of an ETH. `
26
+ + 'The bridge multiplies by the chain decimals, so wei here moves 10^18 times what you meant.');
27
+ }
28
+ }
5
29
  /** Terminal states. `wait()` stops on these rather than polling forever. */
6
30
  const DONE = ['completed', 'delivered', 'proven'];
7
31
  const FAILED = ['failed', 'error'];
@@ -76,6 +100,7 @@ export class ExecuteResource {
76
100
  amount: p.amount,
77
101
  });
78
102
  }
103
+ assertTransferParams(p);
79
104
  return this.open({
80
105
  identity_id: p.identityId,
81
106
  intent: {
@@ -1 +1 @@
1
- {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../src/resources/execute.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAqGzC,4EAA4E;AAC5E,MAAM,IAAI,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;AAClD,MAAM,MAAM,GAAG,CAAC,QAAQ,EA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CAAC,CAAC;QAC9C,MAAM,SAAS,GAAI,IAAgC,CAAC,UAAU;eACzD,mBAAoB,IAA+B,CAAC,SAAS,YAAY,CAAC;QAC/E,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC;QAEtE,OAAO;YACL,QAAQ,EAAG,IAA8B,CAAC,SAAS;YACnD,WAAW,EAAE,EAAE,CAAC,gBAAgB;YAChC,WAAW,EAAG,IAAkC,CAAC,YAAY;SAC9D,CAAC;IACJ,CAAC;CACF;AAED,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC"}
@@ -61,6 +61,8 @@ export declare class ProofResource {
61
61
  */
62
62
  shared(tokenOrUrl: string): Promise<SharedProof>;
63
63
  /**
64
+ * Create a shareable link for a proof — a URL a counterparty verifies with no CERTEN account.
65
+ *
64
66
  * @param params.expiresInHours How long the link stays valid. Defaults to 168h (7 days),
65
67
  * capped at 2160h (90 days). `expiresIn` is accepted as a deprecated alias.
66
68
  * @param params.maxViews Redemption ceiling. Omit for unlimited until expiry.
@@ -1 +1 @@
1
- {"version":3,"file":"proof.d.ts","sourceRoot":"","sources":["../../src/resources/proof.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,KAAK,EACV,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAC1E,WAAW,EACZ,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,aAAa;IACZ,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEvC,iGAAiG;IAC3F,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa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a shareable link for a proof — a URL a counterparty verifies with no CERTEN account.
87
+ *
86
88
  * @param params.expiresInHours How long the link stays valid. Defaults to 168h (7 days),
87
89
  * capped at 2160h (90 days). `expiresIn` is accepted as a deprecated alias.
88
90
  * @param params.maxViews Redemption ceiling. Omit for unlimited until expiry.
@@ -1 +1 @@
1
- {"version":3,"file":"proof.js","sourceRoot":"","sources":["../../src/resources/proof.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,aAAa;IACJ;IAApB,YAAoB,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAE3C,iGAAiG;IACjG,KAAK,CAAC,GAAG,CAAC,OAAe;QACvB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,OAAO,EAAE,CAAC,CAAC;QAC7D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,sFAAsF;IACtF,KAAK,CAAC,QAAQ,CAAC,MAAc;QAC3B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,MAAM,EAAE,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,OAAO,CAAC,MAAc;QAC1B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,MAAM,UAAU,CAAC,CAAC;QACvE,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CAAC,OAAe;QAC1B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,OAAO,SAAS,EAAE;YAClE,YAAY,EAAE,aAAa;SAC5B,CAAC,CAAC;QACH,OAA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M,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,qFAAqF;IACrF,KAAK,CAAC,WAAW,CAAC,OAAe;QAC/B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;QACvE,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@certen.io/sdk",
3
- "version": "0.7.1",
3
+ "version": "0.8.1",
4
4
  "description": "TypeScript client for the CERTEN Gateway API — proof-gated cross-chain execution on Accumulate",
5
5
  "license": "MIT",
6
6
  "type": "module",