@zkproofport-ai/sdk 0.3.0 → 0.4.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/README.md +52 -134
- package/dist/action.js +1 -1
- package/dist/action.js.map +1 -1
- package/dist/actionApproval.js +1 -1
- package/dist/actionApproval.js.map +1 -1
- package/dist/attestation.d.ts +6 -1
- package/dist/attestation.d.ts.map +1 -1
- package/dist/attestation.js +41 -4
- package/dist/attestation.js.map +1 -1
- package/dist/cdp.d.ts +3 -3
- package/dist/circuits.d.ts +26 -105
- package/dist/circuits.d.ts.map +1 -1
- package/dist/circuits.js +18 -114
- package/dist/circuits.js.map +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +0 -10
- package/dist/constants.js.map +1 -1
- package/dist/extract.d.ts +6 -3
- package/dist/extract.d.ts.map +1 -1
- package/dist/extract.js +11 -10
- package/dist/extract.js.map +1 -1
- package/dist/flow.d.ts.map +1 -1
- package/dist/flow.js +13 -14
- package/dist/flow.js.map +1 -1
- package/dist/index.d.ts +2 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -16
- package/dist/index.js.map +1 -1
- package/dist/inputs.d.ts +4 -3
- package/dist/inputs.d.ts.map +1 -1
- package/dist/inputs.js +4 -7
- package/dist/inputs.js.map +1 -1
- package/dist/payment.d.ts +7 -9
- package/dist/payment.d.ts.map +1 -1
- package/dist/payment.js +20 -43
- package/dist/payment.js.map +1 -1
- package/dist/types.d.ts +9 -28
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +1 -1
- package/dist/usdc.d.ts +6 -10
- package/dist/usdc.d.ts.map +1 -1
- package/dist/usdc.js +6 -11
- package/dist/usdc.js.map +1 -1
- package/dist/verify.d.ts +5 -1
- package/dist/verify.d.ts.map +1 -1
- package/dist/verify.js +15 -13
- package/dist/verify.js.map +1 -1
- package/dist/wallets.d.ts +8 -34
- package/dist/wallets.d.ts.map +1 -1
- package/dist/wallets.js +10 -87
- package/dist/wallets.js.map +1 -1
- package/package.json +3 -12
- package/dist/arcWallet.d.ts +0 -50
- package/dist/arcWallet.d.ts.map +0 -1
- package/dist/arcWallet.js +0 -161
- package/dist/arcWallet.js.map +0 -1
- package/dist/delegation.d.ts +0 -107
- package/dist/delegation.d.ts.map +0 -1
- package/dist/delegation.js +0 -126
- package/dist/delegation.js.map +0 -1
- package/dist/nanopayment.d.ts +0 -71
- package/dist/nanopayment.d.ts.map +0 -1
- package/dist/nanopayment.js +0 -77
- package/dist/nanopayment.js.map +0 -1
- package/dist/typedAction.d.ts +0 -3
- package/dist/typedAction.d.ts.map +0 -1
- package/dist/typedAction.js +0 -50
- package/dist/typedAction.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @zkproofport-ai/sdk
|
|
2
2
|
|
|
3
|
-
Client SDK for ZKProofport zero-knowledge proofs, including experimental exact-action authorization on
|
|
3
|
+
Client SDK for ZKProofport zero-knowledge proofs, including experimental exact-action authorization with `giwa_attestation` on GIWA Sepolia.
|
|
4
4
|
|
|
5
|
-
The shared `hashTypedAction` helper is available from **SDK 0.2.12**.
|
|
5
|
+
The shared `hashTypedAction` helper is available from **SDK 0.2.12**. GIWA optional actions require **SDK 0.2.14 or later**; MCP stepwise input preparation requires **MCP 0.2.15 or later**. Release Please owns the versions. Confirm the resolved npm versions before using this path.
|
|
6
6
|
|
|
7
7
|
Human action approval requires SDK **0.3.0 or later** and a compatible AI service with the approval API enabled. For the CLI/MCP flow, use MCP **0.3.0 or later** as well. Earlier releases that support action hashing do not implement this approval lifecycle. Action requests now pause for human approval; handle `ActionApprovalRequiredError` and resume as shown below.
|
|
8
8
|
|
|
@@ -17,7 +17,7 @@ ZKProofport has a TEE-based proving architecture. Enclave encryption and hardwar
|
|
|
17
17
|
A service tells you what it charges. Ask for a proof and the answer is either
|
|
18
18
|
the proof or a `402` listing the chains it takes USDC on — you pick one.
|
|
19
19
|
|
|
20
|
-
For supported x402 offers, the payer signs an authorization and the payment rail settles it.
|
|
20
|
+
For supported x402 offers, the payer signs an authorization and the payment rail settles it. Wallet, chain and signing-domain compatibility must match the actual offer.
|
|
21
21
|
|
|
22
22
|
Supported payment-wallet adapters:
|
|
23
23
|
|
|
@@ -26,9 +26,7 @@ import {
|
|
|
26
26
|
generateProof,
|
|
27
27
|
walletFromPrivateKey, // a raw key
|
|
28
28
|
walletFromCdp, // a Coinbase CDP server wallet
|
|
29
|
-
|
|
30
|
-
walletFromArcAgent, // an existing Circle Agent Wallet through Circle CLI
|
|
31
|
-
walletFor, // walletFor('arc') selects the same adapter from environment
|
|
29
|
+
walletFor, // walletFor('key' | 'cdp') builds one from environment
|
|
32
30
|
} from '@zkproofport-ai/sdk';
|
|
33
31
|
|
|
34
32
|
const proof = await generateProof(
|
|
@@ -64,14 +62,13 @@ never quietly pays on a different one.
|
|
|
64
62
|
From the command line:
|
|
65
63
|
|
|
66
64
|
```bash
|
|
67
|
-
zkproofport-prove coinbase_kyc --pay-with
|
|
65
|
+
zkproofport-prove coinbase_kyc --pay-with key --pay-on <chain>
|
|
68
66
|
zkproofport-prove coinbase_kyc --pay-with cdp
|
|
69
67
|
```
|
|
70
68
|
|
|
71
69
|
`--pay-with cdp` needs `CDP_API_KEY_ID`, `CDP_API_KEY_SECRET` and
|
|
72
|
-
`CDP_WALLET_SECRET`; `--pay-with
|
|
73
|
-
|
|
74
|
-
`PAYMENT_PRIVATE_KEY`. For the existing Circle Agent Wallet, explicitly select `--pay-with arc`; Circle CLI owns the login, and `ARC_AGENT_WALLET` selects its wallet. With exactly one key/CDP/developer-controlled wallet configured you can omit
|
|
70
|
+
`CDP_WALLET_SECRET`; `--pay-with key` needs `PAYMENT_PRIVATE_KEY`. These are
|
|
71
|
+
the only two payment wallets. With exactly one of them configured you can omit
|
|
75
72
|
the flag. With more than one, naming it is required — a wallet is money, and
|
|
76
73
|
guessing which account it leaves is not a default worth having.
|
|
77
74
|
|
|
@@ -79,7 +76,7 @@ guessing which account it leaves is not a default worth having.
|
|
|
79
76
|
|
|
80
77
|
When the selected endpoint supplies a supported attested `teePublicKey`, the SDK encrypts inputs with X25519 ECDH + AES-256-GCM. The host relays ciphertext to the enclave; Nitro mode rejects plaintext inputs. Validate the returned attestation against the required trust policy.
|
|
81
78
|
|
|
82
|
-
An endpoint without that key receives readable circuit inputs over HTTPS and provides no hardware-attestation guarantee. The current
|
|
79
|
+
An endpoint without that key receives readable circuit inputs over HTTPS and provides no hardware-attestation guarantee. The current GCP Cloud Run deployments use that mode. HTTPS transport encryption does not make the prover a blind relay. A valid public proof can hide the credential-holder address from the relying dApp without establishing enclave execution. Only claim hardware-attested proving when the actual attestation supports it.
|
|
83
80
|
|
|
84
81
|
## Installation
|
|
85
82
|
|
|
@@ -87,7 +84,7 @@ An endpoint without that key receives readable circuit inputs over HTTPS and pro
|
|
|
87
84
|
npm install @zkproofport-ai/sdk@latest ethers
|
|
88
85
|
```
|
|
89
86
|
|
|
90
|
-
Use **SDK 0.2.14 or later** and **MCP 0.2.15 or later** for both
|
|
87
|
+
Use **SDK 0.2.14 or later** and **MCP 0.2.15 or later** for both GIWA signature modes, including stepwise preparation. Install from npm and check the resolved version. Release Please manages package versions and the release workflow publishes them; repository source changes alone do not update `@latest`.
|
|
91
88
|
|
|
92
89
|
## Prerequisites
|
|
93
90
|
|
|
@@ -95,15 +92,15 @@ Use **SDK 0.2.14 or later** and **MCP 0.2.15 or later** for both Arc/GIWA signat
|
|
|
95
92
|
|
|
96
93
|
1. **Coinbase account with KYC verification** — Complete identity verification on [Coinbase](https://www.coinbase.com/)
|
|
97
94
|
2. **Coinbase KYC EAS attestation on Base** — Obtain an attestation via [Coinbase Verifications](https://www.coinbase.com/onchain-verify). This creates an on-chain EAS attestation on Base linked to your wallet address.
|
|
98
|
-
3. **Credential signer for proofs without an action** — A local signer for the wallet holding the EAS attestation. The CLI uses `ATTESTATION_KEY`; programmatic callers can supply a compatible `ProofportSigner`.
|
|
95
|
+
3. **Credential signer for proofs without an action** — A local signer for the wallet holding the EAS attestation. The CLI uses `ATTESTATION_KEY`; programmatic callers can supply a compatible `ProofportSigner`. A GIWA action instead requires the credential holder to connect a wallet and sign through the approval page. Keep key material outside model context.
|
|
99
96
|
|
|
100
97
|
**For OIDC circuits** (`oidc_domain`): No wallet or attestation needed — just a JWT `id_token` from your OIDC provider.
|
|
101
98
|
|
|
102
99
|
**For GIWA** (`giwa_attestation`): an attestation from GIWA's attester on **GIWA Sepolia**, and control of that wallet. Without an action, supply its local signer; with an action, the person connects that wallet on the approval page. The attestation must belong to the wallet signing the proof request on the chain the circuit reads.
|
|
103
100
|
|
|
104
|
-
**For the
|
|
101
|
+
**For the circuit that can bind an action** (`giwa_attestation`): the GIWA attestation above. What differs is what the wallet signs, and the action is **optional** — see below.
|
|
105
102
|
|
|
106
|
-
**One wallet has a different nullifier per circuit, and for
|
|
103
|
+
**One wallet has a different nullifier per circuit, and for `giwa_attestation` it does not depend on what you signed.** `giwa_attestation` derives it from your address, the circuit's own identifier and the scope, so the same wallet in the same scope gives the same nullifier whether or not you bind an action. The Coinbase circuits derive theirs from the signed challenge instead. Nothing to configure — the SDK picks the rule the circuit expects, and refuses a circuit it has no rule for rather than guessing one. Requires **0.2.14 or later**; earlier versions sent the Coinbase rule for every circuit, which a GIWA proof rejects as a nullifier mismatch.
|
|
107
104
|
|
|
108
105
|
## Quick Start
|
|
109
106
|
|
|
@@ -128,16 +125,15 @@ console.log('Valid:', verification.valid);
|
|
|
128
125
|
|
|
129
126
|
> **Experimental. Testnet only.**
|
|
130
127
|
>
|
|
131
|
-
>
|
|
128
|
+
> One circuit can bind an action, on a testnet and not generally available:
|
|
132
129
|
>
|
|
133
130
|
> | Circuit | Chain | Verifier |
|
|
134
131
|
> |---|---|---|
|
|
135
|
-
> | `arc_eligibility` | Arc Testnet, 5042002 | `0x2aEB66292f631ceb6225ffA2439B1f2b4b15e44a` |
|
|
136
132
|
> | `giwa_attestation` | GIWA Sepolia, 91342 | `0x5Da234546874304F8c51BBEed00fC632938211c1` |
|
|
137
133
|
>
|
|
138
|
-
>
|
|
134
|
+
> Public-input layouts and deployments may change; do not put it in front of real funds. Generally available: `coinbase_kyc`, `coinbase_country`, `oidc_domain`.
|
|
139
135
|
>
|
|
140
|
-
> **The action is optional
|
|
136
|
+
> **The action is optional.** Send one and the SDK pauses for a human to connect a wallet and sign the exact typed data. Send none and the supplied credential signer signs the request's signal hash as before. Supplying `ATTESTATION_KEY` does not bypass action approval.
|
|
141
137
|
|
|
142
138
|
### The problem it solves
|
|
143
139
|
|
|
@@ -168,13 +164,13 @@ import {
|
|
|
168
164
|
} from '@zkproofport-ai/sdk';
|
|
169
165
|
|
|
170
166
|
const params: ProofParams = {
|
|
171
|
-
circuit: '
|
|
167
|
+
circuit: 'giwa_attestation',
|
|
172
168
|
scope: 'my-app',
|
|
173
169
|
action: {
|
|
174
170
|
domain: {
|
|
175
171
|
name: 'MyVault',
|
|
176
172
|
version: '1',
|
|
177
|
-
chainId:
|
|
173
|
+
chainId: 91342,
|
|
178
174
|
verifyingContract: vaultAddress, // binds the signature to ONE contract
|
|
179
175
|
},
|
|
180
176
|
types: {
|
|
@@ -231,14 +227,14 @@ not expire the EIP-712 signature on chain. The relying contract must enforce
|
|
|
231
227
|
the action's own nonce and deadline. This flow supports EOA credential wallets;
|
|
232
228
|
contract-wallet signature verification is outside the current circuit.
|
|
233
229
|
|
|
234
|
-
|
|
235
|
-
|
|
230
|
+
`giwa_attestation` uses the credential wallet's GIWA Sepolia attestation. The
|
|
231
|
+
action domain names the relying contract's execution chain;
|
|
236
232
|
it is independent of the chain used for attestation lookup or proof payment.
|
|
237
233
|
The approval page asks the wallet to use the action's declared chain.
|
|
238
234
|
|
|
239
235
|
The wallet renders `amount`, `nonce` and `expiry` by name for the person to
|
|
240
236
|
read. Two 32-byte hashes reach the circuit — the EIP-712 domain separator and
|
|
241
|
-
the hash of the action — and the circuit proves the
|
|
237
|
+
the hash of the action — and the circuit proves the attested key signed them. It
|
|
242
238
|
never learns what the action was, so nothing about vaults or USDC is baked into
|
|
243
239
|
it: a grant of authority or an agreement in prose works the same way.
|
|
244
240
|
|
|
@@ -278,63 +274,29 @@ one byte each:
|
|
|
278
274
|
| `scope` | 128–159 |
|
|
279
275
|
| `nullifier` | 160–191 |
|
|
280
276
|
|
|
281
|
-
`signal_hash` is
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
277
|
+
`signal_hash` is zero when an action is bound. The nullifier derives from the
|
|
278
|
+
wallet, the circuit id and the scope, not from the signed action: deriving it
|
|
279
|
+
from the action would give a different nullifier per action and destroy the
|
|
280
|
+
one-per-person property it exists for.
|
|
285
281
|
|
|
286
282
|
### Omitting `action`
|
|
287
283
|
|
|
288
|
-
|
|
284
|
+
`giwa_attestation` accepts an omitted action and retains its local `personal_sign` path. Coinbase circuits reject `action` and retain their existing signing path; OIDC rejects `action` and uses its JWT flow without wallet signing. For action proofs, the application must verify the exact target, actor, amount, nonce and deadline as well as the proof.
|
|
289
285
|
|
|
290
|
-
|
|
286
|
+
### Approving the exact payment
|
|
291
287
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
```bash
|
|
295
|
-
npm install -g @circle-fin/cli
|
|
296
|
-
circle wallet list --chain ARC-TESTNET --type agent
|
|
297
|
-
# Set ARC_AGENT_WALLET to the user's existing, approved wallet B address.
|
|
298
|
-
circle gateway balance --address "$ARC_AGENT_WALLET" --chain ARC-TESTNET --output json
|
|
299
|
-
# Only when the user has approved this funding amount:
|
|
300
|
-
circle gateway deposit --amount 0.1 --address "$ARC_AGENT_WALLET" --chain ARC-TESTNET --method direct
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
For the live Gateway batched offer, SDK `signPayment` uses `@circle-fin/x402-batching` and the Circle CLI wallet adapter. It signs the Gateway authorization against the offer’s Gateway signing domain and spends the existing funded Gateway balance. The payment adapter uses the agent smart-wallet address for direct USDC payments (`arc-testnet`, verified through ERC-1271) and Circle's backing EOA for Gateway authorization (`arc-testnet-nano`). `wallet.address` is the on-chain owner; `wallet.gatewayAddress` identifies the separate Gateway depositor, and `signPayment` selects the correct owner for the chosen offer. The operational smart-wallet address remains Wallet B for the action and stake; do not substitute the backing EOA into the action's `delegate` field. `walletFromArcAgent({address: process.env.ARC_AGENT_WALLET, chain: 'ARC-TESTNET'})` and `walletFor('arc')` provide the same payment path.
|
|
304
|
-
|
|
305
|
-
After the user reviews the action and the live x402 offer, save those exact approved objects locally as `approved-action.json` and `approved-payment.json`:
|
|
306
|
-
|
|
307
|
-
```typescript
|
|
308
|
-
import { readFile } from 'node:fs/promises';
|
|
309
|
-
import {
|
|
310
|
-
createConfig, verifyProof, walletFor,
|
|
311
|
-
type ProofParams, type ApprovedPayment,
|
|
312
|
-
} from '@zkproofport-ai/sdk';
|
|
313
|
-
|
|
314
|
-
const config = createConfig({baseUrl: 'https://stg-ai.zkproofport.app'});
|
|
315
|
-
const action: NonNullable<ProofParams['action']> = JSON.parse(await readFile('approved-action.json', 'utf8'));
|
|
316
|
-
const approvedPayment: ApprovedPayment = JSON.parse(await readFile('approved-payment.json', 'utf8'));
|
|
317
|
-
// generateWithHumanApproval is the bounded catch/poll/resume helper above.
|
|
318
|
-
const result = await generateWithHumanApproval(config, await walletFor('arc'), {
|
|
319
|
-
circuit: 'arc_eligibility', scope: 'ledger-house', action,
|
|
320
|
-
payOn: 'arc-testnet-nano', maxPayment: '0.001', approvedPayment,
|
|
321
|
-
});
|
|
322
|
-
const verification = await verifyProof(result);
|
|
323
|
-
if (!verification.valid) throw new Error('Arc verifier rejected the proof');
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
`approvedPayment` pins the selected live offer's `network`, `scheme`, `amount`, `asset`, `payTo`, and signing domain `extra: {name, version, verifyingContract}`. For direct `exact` EIP-3009 payments (Base, Ethereum and Arc), set the approved `extra.verifyingContract` to the offer's `asset`: the standard offer may omit `extra.verifyingContract` because the token is the signing contract. For Circle Gateway (`GatewayWalletBatched`, version `1`), copy the required `extra.verifyingContract` from the offer; never substitute the token address. Missing or conflicting domain information and unsupported transfer methods such as Permit2 are rejected. `amount` is an integer string in USDC base units (`"1000"` is 0.001 USDC); `maxPayment` is a decimal USDC string (`"0.001"`). A changed fee, recipient, asset, network or signing domain is rejected before payment signing. Approve the actual offer; do not manufacture its recipient or domain from a documentation example.
|
|
288
|
+
Pass `maxPayment` and `approvedPayment` in `ProofParams`. `approvedPayment` pins the selected live offer's `network`, `scheme`, `amount`, `asset`, `payTo`, and signing domain `extra: {name, version, verifyingContract}`. For `exact` EIP-3009 payments (Base and Ethereum), set the approved `extra.verifyingContract` to the offer's `asset`: the standard offer may omit `extra.verifyingContract` because the token is the signing contract. Missing or conflicting domain information, Circle Gateway batched domains and unsupported transfer methods such as Permit2 are rejected. `amount` is an integer string in USDC base units (`"1000"` is 0.001 USDC); `maxPayment` is a decimal USDC string (`"0.001"`). A changed fee, recipient, asset, network or signing domain is rejected before payment signing. Approve the actual offer; do not manufacture its recipient or domain from a documentation example.
|
|
327
289
|
|
|
328
290
|
### Action object: caller-owned types, keys and values
|
|
329
291
|
|
|
330
|
-
Both `generateProof`/`generate_proof` and
|
|
292
|
+
Both `generateProof`/`generate_proof` and stepwise input preparation use this complete `TypedAction` shape:
|
|
331
293
|
|
|
332
294
|
| Field | Type | Meaning |
|
|
333
295
|
|---|---|---|
|
|
334
296
|
| `domain` | object | EIP-712 signing context; all four fields below are required. |
|
|
335
297
|
| `domain.name` | non-empty string | Application/domain name agreed with the verifier. |
|
|
336
298
|
| `domain.version` | non-empty string | Signing-domain version. |
|
|
337
|
-
| `domain.chainId` | integer number | Target chain ID, such as `
|
|
299
|
+
| `domain.chainId` | integer number | Target chain ID, such as `91342`. |
|
|
338
300
|
| `domain.verifyingContract` | string | 20-byte `0x` contract address bound by the signature. |
|
|
339
301
|
| `types` | object | Map from caller-chosen struct names to arrays of field declarations. Omit `EIP712Domain`; ethers derives it from `domain`. |
|
|
340
302
|
| `types[structName]` | array of objects | Ordered fields; each declaration has `name` and `type`. Include referenced nested structs. |
|
|
@@ -347,47 +309,6 @@ No SDK action registry restricts business-specific struct names, field names or
|
|
|
347
309
|
|
|
348
310
|
Use decimal **integer strings** for JSON integer message values, especially `uint256` (for example `"10000000"`); JSON cannot represent `bigint`, and large JavaScript numbers can lose precision. Addresses/bytes are `0x` strings, booleans remain JSON booleans, and nested values follow their declared types. `domain.chainId` remains an integer JSON number.
|
|
349
311
|
|
|
350
|
-
### Full 10-USDC Ledger House Gate action
|
|
351
|
-
|
|
352
|
-
This valid JSON shows the Gate's exact five-field schema. The example delegate is a public placeholder for Wallet B: replace it with the approved operational smart-wallet address, choose a future approved Unix-seconds deadline and a fresh nonce, then review the whole object. Never include the private credential-holder A's address or key in it.
|
|
353
|
-
|
|
354
|
-
```json
|
|
355
|
-
{
|
|
356
|
-
"domain": {
|
|
357
|
-
"name": "Ledger House Staking",
|
|
358
|
-
"version": "1",
|
|
359
|
-
"chainId": 5042002,
|
|
360
|
-
"verifyingContract": "0xD0F3eE648386B59B484157332E736388Fcc41F47"
|
|
361
|
-
},
|
|
362
|
-
"types": {
|
|
363
|
-
"CredentialDelegation": [
|
|
364
|
-
{ "name": "delegate", "type": "address" },
|
|
365
|
-
{ "name": "action", "type": "string" },
|
|
366
|
-
{ "name": "amount", "type": "uint256" },
|
|
367
|
-
{ "name": "expiresAt", "type": "uint256" },
|
|
368
|
-
{ "name": "nonce", "type": "string" }
|
|
369
|
-
]
|
|
370
|
-
},
|
|
371
|
-
"primaryType": "CredentialDelegation",
|
|
372
|
-
"message": {
|
|
373
|
-
"delegate": "0x0000000000000000000000000000000000000001",
|
|
374
|
-
"action": "stake",
|
|
375
|
-
"amount": "10000000",
|
|
376
|
-
"expiresAt": "2000000000",
|
|
377
|
-
"nonce": "replace-with-fresh-user-approved-nonce"
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
`"10000000"` means **10 USDC** (6 decimals). The proof fee is separate: **0.001 USDC**, or `"1000"` base units. `delegate` and `CredentialDelegation` are established wire names for exact-action authorization: A authorizes this operation by B; B does not inherit A's identity or KYC credential. User approval covers the exact action and live proof-payment terms, followed by separate approval of the actual stake transaction.
|
|
383
|
-
|
|
384
|
-
The exported SDK `buildDelegationAction` helper is a legacy generic four-field schema (`delegate`, `action`, `expiresAt`, `nonce`). It **does not include `amount` and is not compatible with this staking Gate**. Its existing wire hash remains unchanged. Build the explicit five-field `TypedAction` above for the Gate; arbitrary custom actions remain valid SDK inputs but require a verifier that understands them.
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
Generating and verifying a proof does not submit a stake. After a separate stake approval, the operational wallet calls the dApp gate, which verifies the proof and enforces its policy, exact action, unused nonce and deadline atomically. Check the receipt before reporting a position change.
|
|
388
|
-
|
|
389
|
-
The MCP `gateway_balance` and `deposit_to_gateway` helpers currently require `PAYMENT_PRIVATE_KEY`; they do not operate the Circle Agent Wallet. Use the Circle CLI commands above for that wallet. SDK `gatewayBalance` / `ensureGatewayBalance` likewise accept the private-key `NanopaymentWallet` shape. This path documents the supported Arc Testnet offer, not a guarantee for every wallet on every chain.
|
|
390
|
-
|
|
391
312
|
## Configuration
|
|
392
313
|
|
|
393
314
|
```typescript
|
|
@@ -485,7 +406,7 @@ if (verification.valid) {
|
|
|
485
406
|
|
|
486
407
|
## Step-by-Step API
|
|
487
408
|
|
|
488
|
-
For
|
|
409
|
+
For GIWA actions, obtain human approval before preparing inputs. `prepareInputs` needs the camelCase hashes to recover A's public key from the approved EIP-712 digest; it does not add those hashes to its returned object. Attach the snake_case fields for submission. `signal_hash` is still computed internally for nullifier derivation and is not the action signing message. Low-level witness APIs accept signatures but cannot establish who operated the signing wallet.
|
|
489
410
|
|
|
490
411
|
Prepared inputs are **private witness data**: they include A's public key, signature and attestation data. Keep them inside trusted local code and send them only to the chosen prover (encrypted when a supported TEE key is provided). Do not forward them to the dApp, model, UI or logs. The `generateProof` public result is the boundary for sharing a proof; step callbacks and `proofport://config` can contain sensitive signer data and must not be forwarded wholesale.
|
|
491
412
|
|
|
@@ -494,18 +415,18 @@ import { readFile } from 'node:fs/promises';
|
|
|
494
415
|
import {
|
|
495
416
|
createConfig, createActionApproval, resolveActionApproval, hashTypedAction, prepareInputs,
|
|
496
417
|
requestChallenge, signPayment, submitProof, submitEncryptedProof,
|
|
497
|
-
encryptForTee,
|
|
418
|
+
encryptForTee, walletFromEnv, CIRCUIT_IDS,
|
|
498
419
|
type TypedAction, type ApprovedPayment,
|
|
499
420
|
} from '@zkproofport-ai/sdk';
|
|
500
421
|
|
|
501
422
|
const config = createConfig({ baseUrl: 'https://stg-ai.zkproofport.app' });
|
|
502
423
|
const action: TypedAction = JSON.parse(await readFile('approved-action.json', 'utf8'));
|
|
503
424
|
const approvedPayment: ApprovedPayment = JSON.parse(await readFile('approved-payment.json', 'utf8'));
|
|
504
|
-
const scope = '
|
|
425
|
+
const scope = 'myapp:membership';
|
|
505
426
|
|
|
506
427
|
// 1. Create an immutable request, then let the person connect and sign.
|
|
507
428
|
const { domainSeparator, actionHash } = hashTypedAction(action);
|
|
508
|
-
const request = { circuit: '
|
|
429
|
+
const request = { circuit: 'giwa_attestation' as const, scope, action };
|
|
509
430
|
const approval = await createActionApproval(config, request);
|
|
510
431
|
console.error('Review and sign:', approval.approvalUrl);
|
|
511
432
|
await waitForHumanApproval(config, approval); // bounded helper from the example above
|
|
@@ -513,33 +434,34 @@ const approved = await resolveActionApproval(config, request, approval);
|
|
|
513
434
|
|
|
514
435
|
// 2. The signature has been verified and consumed. Build the private witness.
|
|
515
436
|
const prepared = await prepareInputs(config, {
|
|
516
|
-
circuitId: CIRCUIT_IDS.
|
|
437
|
+
circuitId: CIRCUIT_IDS.GIWA_ATTESTATION,
|
|
517
438
|
userAddress: approved.address, userSignature: approved.signature, scope,
|
|
518
439
|
domainSeparator, actionHash,
|
|
519
440
|
});
|
|
520
441
|
const inputs = { ...prepared, domain_separator: domainSeparator, action_hash: actionHash };
|
|
521
442
|
|
|
522
443
|
// 3. Fetch a fresh nonce/offer/TEE key without sending the witness yet.
|
|
523
|
-
const challenge = await requestChallenge(config, '
|
|
444
|
+
const challenge = await requestChallenge(config, 'giwa_attestation');
|
|
524
445
|
const paymentHeaders = challenge.requiresPayment
|
|
525
|
-
? (await signPayment(challenge, await
|
|
526
|
-
network:
|
|
446
|
+
? (await signPayment(challenge, await walletFromEnv(), {
|
|
447
|
+
network: approvedPayment.network, maxPayment: '0.001', approvedPayment,
|
|
527
448
|
})).headers
|
|
528
449
|
: undefined;
|
|
529
450
|
|
|
530
451
|
// 4. Submit with the same nonce and approved payment; preserve TEE encryption.
|
|
531
452
|
const result = challenge.teePublicKey
|
|
532
453
|
? await submitEncryptedProof(config, {
|
|
533
|
-
circuit: '
|
|
454
|
+
circuit: 'giwa_attestation', nonce: challenge.nonce, paymentHeaders,
|
|
534
455
|
encryptedPayload: encryptForTee(
|
|
535
|
-
JSON.stringify({ circuitId: CIRCUIT_IDS.
|
|
456
|
+
JSON.stringify({ circuitId: CIRCUIT_IDS.GIWA_ATTESTATION, inputs }),
|
|
536
457
|
challenge.teePublicKey.publicKey,
|
|
537
458
|
),
|
|
538
459
|
})
|
|
539
460
|
: await submitProof(config, {
|
|
540
|
-
circuit: '
|
|
461
|
+
circuit: 'giwa_attestation', inputs, nonce: challenge.nonce, paymentHeaders,
|
|
541
462
|
});
|
|
542
|
-
// Share only the public result
|
|
463
|
+
// Share only the public result and verify it. Any application transaction
|
|
464
|
+
// that relies on the proof needs its own approval.
|
|
543
465
|
```
|
|
544
466
|
|
|
545
467
|
`hashTypedAction(action)` returns `{domainSeparator: string, actionHash: string}` as 32-byte `0x` hashes. For Coinbase KYC/country, sign `computeSignalHash(address, scope, circuitId)` with `signMessage`, call `prepareInputs` without action hashes, then use the same challenge/payment/submission sequence. OIDC uses `prepareOidcPayload` and no attestation-wallet signature. The all-in-one `generateProof` already handles these distinctions.
|
|
@@ -663,8 +585,8 @@ The proof contains 148 public input fields (32 bytes each):
|
|
|
663
585
|
**Circuit Types:**
|
|
664
586
|
|
|
665
587
|
```typescript
|
|
666
|
-
type CircuitName = 'coinbase_kyc' | 'coinbase_country' | 'oidc_domain' | '
|
|
667
|
-
type CircuitId = 'coinbase_attestation' | 'coinbase_country_attestation' | 'oidc_domain_attestation' | '
|
|
588
|
+
type CircuitName = 'coinbase_kyc' | 'coinbase_country' | 'oidc_domain' | 'giwa_attestation';
|
|
589
|
+
type CircuitId = 'coinbase_attestation' | 'coinbase_country_attestation' | 'oidc_domain_attestation' | 'giwa_attestation';
|
|
668
590
|
```
|
|
669
591
|
|
|
670
592
|
**Configuration:**
|
|
@@ -697,7 +619,7 @@ function fromSigner(signer: ethers.Signer): ProofportSigner;
|
|
|
697
619
|
```typescript
|
|
698
620
|
interface ProofParams {
|
|
699
621
|
circuit: CircuitName;
|
|
700
|
-
action?: { domain: { name: string; version: string; chainId: number; verifyingContract: string }; types: Record<string, Array<{name: string; type: string}>>; primaryType: string; message: Record<string, unknown> }; // optional for
|
|
622
|
+
action?: { domain: { name: string; version: string; chainId: number; verifyingContract: string }; types: Record<string, Array<{name: string; type: string}>>; primaryType: string; message: Record<string, unknown> }; // optional for giwa_attestation
|
|
701
623
|
actionApproval?: ActionApproval; // private handle; resume the original action after human approval
|
|
702
624
|
payOn?: string;
|
|
703
625
|
maxPayment?: string; // decimal USDC
|
|
@@ -808,21 +730,17 @@ npm run test:e2e:published -- --sdk-version 0.2.16 --mcp-version 0.2.16
|
|
|
808
730
|
```
|
|
809
731
|
|
|
810
732
|
It installs those exact npm versions outside the workspace, resolves SDK imports
|
|
811
|
-
and the MCP process to that installation, and removes it afterwards.
|
|
812
|
-
|
|
813
|
-
subprocess PATH without changing the global installation. Optional CDP/x402 and
|
|
814
|
-
Circle developer wallet dependencies are installed at tested exact versions,
|
|
733
|
+
and the MCP process to that installation, and removes it afterwards. Optional CDP/x402
|
|
734
|
+
wallet dependencies are installed at tested exact versions,
|
|
815
735
|
and their imports are verified before paid tests start. A normal
|
|
816
736
|
workspace test run exercises local packages and is not published-package evidence.
|
|
817
737
|
The full suite creates paid testnet proofs. It requires the attestation and payer
|
|
818
738
|
credentials loaded by `tests/setup.ts`; GIWA uses `GIWA_ATTESTATION_KEY`, and OIDC
|
|
819
739
|
uses `E2E_OIDC_JWT` or an authenticated gcloud account. The payment matrix checks
|
|
820
|
-
Base Sepolia
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
existing Circle Agent Wallet for both Arc cases; the supported Circle CLI,
|
|
825
|
-
on-chain USDC for immediate settlement, and Gateway USDC for nano are required. The runner never deposits or transfers funds.
|
|
740
|
+
Base Sepolia and Ethereum Sepolia separately, so each needs a funded payer on its
|
|
741
|
+
selected network. Optional `E2E_PAYER_KEY_<NETWORK>` overrides use uppercase names
|
|
742
|
+
with underscores, for example `E2E_PAYER_KEY_ETHEREUM_SEPOLIA`. The runner never
|
|
743
|
+
transfers funds.
|
|
826
744
|
|
|
827
745
|
For a non-paying package/discovery check, append
|
|
828
|
-
`-t 'should list all
|
|
746
|
+
`-t 'should list all 4 circuits'`. This checks discovery only, not proof generation.
|
package/dist/action.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ethers } from 'ethers';
|
|
2
|
-
import { validateTypedAction } from '
|
|
2
|
+
import { validateTypedAction } from '@zkproofport-app/core/typedAction';
|
|
3
3
|
/**
|
|
4
4
|
* Validate and hash a caller-owned EIP-712 action before asking a wallet to sign.
|
|
5
5
|
* `types` must omit EIP712Domain and have one root matching `primaryType`.
|
package/dist/action.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sourceRoot":"","sources":["../src/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../src/action.ts"],"names":[],"mappings":"AA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AI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC;oBAAE,MAAM,IAAI,KAAK,CAAC,GAAG,SAAS,eAAe,CAAC,CAAC;gBACpF,aAAa,CAAC,KAAK,CAAC,IAAI,EAAG,KAAiC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;YACvF,CAAC;QACH,CAAC;aAAM,IAAI,IAAI,KAAK,MAAM,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;YACzD,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,qBAAqB,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IACD,aAAa,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IAEpE,OAAO;QACL,eAAe,EAAE,MAAM,CAAC,gBAAgB,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC;QAClE,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;KACzC,CAAC;AACJ,CAAC"}
|
package/dist/actionApproval.js
CHANGED
|
@@ -54,7 +54,7 @@ function address(value) {
|
|
|
54
54
|
function snapshotRequest(request) {
|
|
55
55
|
try {
|
|
56
56
|
const copy = structuredClone(request);
|
|
57
|
-
if (copy.circuit !== 'giwa_attestation'
|
|
57
|
+
if (copy.circuit !== 'giwa_attestation')
|
|
58
58
|
throw invalid();
|
|
59
59
|
if (typeof copy.scope !== 'string' || !copy.scope.trim())
|
|
60
60
|
throw invalid();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actionApproval.js","sourceRoot":"","sources":["../src/actionApproval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAkC9C,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACh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AM,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACjG,MAAM,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC1C,UAAU,CAAC,MAAM,CAAC,CAAC;IACnB,MAAM,MAAM,GAAG,MAAM,uBAAuB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7D,UAAU,CAAC,MAAM,CAAC,CAAC;IACnB,aAAa,CAAC,MAA4C,EAAE,MAAM,CAAC,CAAC;IACpE,IAAI,MAAM,CAAC,cAAc,IAAI,MAAM,CAAC,cAAc,KAAK,MAAM,CAAC,cAAc;QAAE,MAAM,OAAO,EAAE,CAAC;IAC9F,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;QACtB,KAAK,SAAS,CAAC,CAAC,MAAM,IAAI,2BAA2B,CAAC,MAAM,CAAC,CAAC;QAC9D,KAAK,UAAU,CAAC,CAAC,MAAM,IAAI,mBAAmB,CAAC,0BAA0B,EAAE,2CAA2C,CAAC,CAAC;QACxH,KAAK,SAAS,CAAC,CAAC,MAAM,OAAO,EAAE,CAAC;QAChC,KAAK,UAAU,CAAC,CAAC,MAAM,IAAI,mBAAmB,CAAC,0BAA0B,EAAE,uHAAuH,CAAC,CAAC;QACpM,KAAK,UAAU,CAAC,CAAC,OAAO,qBAAqB,CAAC,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,cAAc,EAAE,MAAM,CAAC,OAAQ,EAAE,EAAE,MAAM,CAAC,CAAC;QAC9G,OAAO,CAAC,CAAC,MAAM,OAAO,EAAE,CAAC;IAC3B,CAAC;AACH,CAAC"}
|
package/dist/attestation.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { CircuitId, EASAttestation, AttestationData, ClientConfig } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* GET a URL, retrying a transient network failure or a 429/5xx answer.
|
|
4
|
+
* Any other answer, including a 4xx, is returned to the caller on the first try.
|
|
5
|
+
*/
|
|
6
|
+
export declare function fetchWithTransientRetry(url: string): Promise<Response>;
|
|
2
7
|
/**
|
|
3
8
|
* Query EAS GraphQL for the latest attestation matching schemaId + recipient.
|
|
4
9
|
*/
|
|
@@ -7,7 +12,7 @@ export declare function fetchAttestationFromEAS(easGraphqlUrl: string, circuitId
|
|
|
7
12
|
* Fetch raw transaction via eth_getTransactionByHash from an RPC endpoint.
|
|
8
13
|
*
|
|
9
14
|
* Retry policy:
|
|
10
|
-
* - HTTP 429/5xx
|
|
15
|
+
* - HTTP 429/5xx or a TRANSIENT_NETWORK_CODES failure: MAX_RETRIES (3) attempts, 1s base delay.
|
|
11
16
|
* - data.result === null (tx not yet indexed): TX_INDEX_MAX_RETRIES (15) attempts, 2s delay.
|
|
12
17
|
* Public RPCs (base.org, base-sepolia) need 5-30s to index a freshly submitted attestation tx.
|
|
13
18
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attestation.d.ts","sourceRoot":"","sources":["../src/attestation.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"attestation.d.ts","sourceRoot":"","sources":["../src/attestation.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAiD3F;;;GAGG;AACH,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAe5E;AAWD;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,cAAc,CAAC,CAkCzB;AAID;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,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= 1000;
|
|
28
28
|
const RETRYABLE_STATUS = new Set([429, 500, 502, 503, 504]);
|
|
29
|
+
/**
|
|
30
|
+
* Network failures worth another attempt. `UND_ERR_CONNECT_TIMEOUT` is what
|
|
31
|
+
* Node's fetch reports when a TCP connect never completes; it was missing, so a
|
|
32
|
+
* single slow handshake to the GIWA explorer failed a whole proof.
|
|
33
|
+
*/
|
|
34
|
+
const TRANSIENT_NETWORK_CODES = new Set([
|
|
35
|
+
'ECONNRESET',
|
|
36
|
+
'ETIMEDOUT',
|
|
37
|
+
'EAI_AGAIN',
|
|
38
|
+
'UND_ERR_CONNECT_TIMEOUT',
|
|
39
|
+
'UND_ERR_SOCKET',
|
|
40
|
+
]);
|
|
41
|
+
function isTransientNetworkError(err) {
|
|
42
|
+
const code = err?.cause?.code;
|
|
43
|
+
return typeof code === 'string' && TRANSIENT_NETWORK_CODES.has(code);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* GET a URL, retrying a transient network failure or a 429/5xx answer.
|
|
47
|
+
* Any other answer, including a 4xx, is returned to the caller on the first try.
|
|
48
|
+
*/
|
|
49
|
+
export async function fetchWithTransientRetry(url) {
|
|
50
|
+
for (let attempt = 0;; attempt++) {
|
|
51
|
+
const last = attempt === MAX_RETRIES - 1;
|
|
52
|
+
try {
|
|
53
|
+
const response = await fetch(url);
|
|
54
|
+
if (!last && RETRYABLE_STATUS.has(response.status)) {
|
|
55
|
+
await new Promise(r => setTimeout(r, RETRY_DELAY_MS * (attempt + 1)));
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
return response;
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
if (last || !isTransientNetworkError(err))
|
|
62
|
+
throw err;
|
|
63
|
+
await new Promise(r => setTimeout(r, RETRY_DELAY_MS * (attempt + 1)));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
29
67
|
// Public RPCs (e.g. base.org, base-sepolia) can take 5-30s to index a freshly
|
|
30
68
|
// submitted attestation tx. Retry the "result is null" case separately with a
|
|
31
69
|
// larger budget so generateProof doesn't fail immediately after the customer
|
|
@@ -68,7 +106,7 @@ export async function fetchAttestationFromEAS(easGraphqlUrl, circuitId, recipien
|
|
|
68
106
|
* Fetch raw transaction via eth_getTransactionByHash from an RPC endpoint.
|
|
69
107
|
*
|
|
70
108
|
* Retry policy:
|
|
71
|
-
* - HTTP 429/5xx
|
|
109
|
+
* - HTTP 429/5xx or a TRANSIENT_NETWORK_CODES failure: MAX_RETRIES (3) attempts, 1s base delay.
|
|
72
110
|
* - data.result === null (tx not yet indexed): TX_INDEX_MAX_RETRIES (15) attempts, 2s delay.
|
|
73
111
|
* Public RPCs (base.org, base-sepolia) need 5-30s to index a freshly submitted attestation tx.
|
|
74
112
|
*/
|
|
@@ -114,8 +152,7 @@ export async function fetchRawTransaction(rpcUrl, txHash) {
|
|
|
114
152
|
}
|
|
115
153
|
catch (err) {
|
|
116
154
|
lastError = err;
|
|
117
|
-
|
|
118
|
-
if (attempt < MAX_RETRIES - 1 && (cause === 'ECONNRESET' || cause === 'ETIMEDOUT')) {
|
|
155
|
+
if (attempt < MAX_RETRIES - 1 && isTransientNetworkError(err)) {
|
|
119
156
|
await new Promise(r => setTimeout(r, RETRY_DELAY_MS * (attempt + 1)));
|
|
120
157
|
continue;
|
|
121
158
|
}
|
|
@@ -234,7 +271,7 @@ async function fetchGiwaAttestation(source, recipientAddress) {
|
|
|
234
271
|
const wanted = ethers.getAddress(recipientAddress);
|
|
235
272
|
const listUrl = `${source.explorer}/api?module=account&action=txlist` +
|
|
236
273
|
`&address=${attester}&sort=desc&page=1&offset=100`;
|
|
237
|
-
const listResponse = await
|
|
274
|
+
const listResponse = await fetchWithTransientRetry(listUrl);
|
|
238
275
|
if (!listResponse.ok) {
|
|
239
276
|
throw new Error(`GIWA explorer request failed: HTTP ${listResponse.status}`);
|
|
240
277
|
}
|