Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

SDK Installation

The @inkd/sdk package provides a TypeScript client for the Inkd Protocol. It handles x402 payments automatically.


Install

npm install @inkd/sdk
# or
yarn add @inkd/sdk
# or
pnpm add @inkd/sdk

Requirements: Node.js 18 or later, TypeScript 5.0+ (if using TypeScript).


Quick setup

import { ProjectsClient } from "@inkd/sdk"
 
const client = new ProjectsClient({
  privateKey: process.env.INKD_PRIVATE_KEY,
})

That's it. The client connects to Base Mainnet and the production API by default.


Configuration

const client = new ProjectsClient({
  // Required: your wallet private key (never hardcode in source)
  privateKey: process.env.INKD_PRIVATE_KEY,
 
  // Optional: override API base URL
  apiUrl: "https://api.inkdprotocol.com",
 
  // Optional: override network ("mainnet" | "testnet")
  network: "mainnet",
})

Environment variables

VariableDescription
INKD_PRIVATE_KEYYour wallet private key (0x...)
INKD_NETWORKmainnet or testnet (default: mainnet)
INKD_API_URLOverride API base URL

Wallet requirements

Your wallet needs:

  • USDC on Base Mainnet — for paying fees (create project: $0.10+, push version: dynamic)
  • ETH on Base Mainnet — a small amount for gas on any direct contract calls

To check your balance:

const status = await client.getStatus()
console.log(status.usdcBalance) // e.g. "12.50"

Using in an AI agent

For autonomous agents, load the private key from a secure environment:

import { ProjectsClient } from "@inkd/sdk"
 
// From environment (recommended)
const client = new ProjectsClient({
  privateKey: process.env.INKD_PRIVATE_KEY,
})
 
// Or from AgentVault (encrypted credential storage)
import { AgentVault } from "@inkd/sdk"
const vault  = new AgentVault(walletClient)
const key    = await vault.get("inkd_private_key")
const client = new ProjectsClient({ privateKey: key })

Encryption utilities (v1.2.0+)

@inkd/sdk@1.2.0 exports encryptForWallet and decryptForWallet for AES-256-GCM encryption of private content. The key is derived from your wallet private key so only you can decrypt.

import { encryptForWallet, decryptForWallet } from "@inkd/sdk"
 
// Encrypt before upload
const encrypted = encryptForWallet(Buffer.from("my secret"), walletPrivateKey)
 
// Decrypt after download
const decrypted = decryptForWallet(encrypted, walletPrivateKey)
console.log(decrypted.toString()) // "my secret"

These are the same primitives used internally by pushPrivateVersion. You can use them directly for custom encryption workflows before passing content to Arweave.


Next steps

  • ProjectsClient — Create projects, push versions, read the registry
  • AgentVault — Encrypted credential storage for agents