SDK
Installation
Install @attestinfra/sdk 0.2.0 and create a client.
Install #
@attestinfra/sdk version 0.2.0 is a server-side JavaScript client for Node.js 18 or later. It has no runtime dependencies and uses the built-in fetch. It works with both import and require and ships TypeScript definitions.
npm install @attestinfra/sdk@0.2.0Create a client #
| Option | Type | Required | Description |
|---|---|---|---|
apiKey | string | Required | An environment API key. The key decides Sandbox or Production. |
baseUrl | string | Optional | Defaults to https://attestinfra.com. |
timeout | number | Optional | Per-request timeout in milliseconds. Defaults to 10000. |
The constructor throws AttestValidationError if apiKey is empty, baseUrl is not a URL, or timeout is not a positive number. It makes no network call.
import { Attest } from "@attestinfra/sdk";
const attest = new Attest({ apiKey: process.env.ATTEST_API_KEY });
console.log(attest.baseUrl, attest.timeout);const { Attest } = require("@attestinfra/sdk");
const attest = new Attest({ apiKey: process.env.ATTEST_API_KEY });
console.log(attest.baseUrl, attest.timeout);https://attestinfra.com 10000Methods #
| Method | Calls | Page |
|---|---|---|
verify(event) | POST /v1/events | verify() |
prepareWitness(event) | None until execute | prepareWitness() |
finalizeWitness(pairId) | POST /v1/witness/{pairId}/finalize | finalizeWitness() |
resumeWitness(pairId, options) | GET, then optionally POST and finalize | Recovery and helpers |
getWitness(pairId) | GET /v1/witness/{pairId} | Recovery and helpers |
witnessAssembly(event, options), witnessDelivery(event, options) | POST /v1/witness | Recovery and helpers |
witness(event, operation) | Same as prepareWitness(event).execute(operation) | Recovery and helpers |