Skip to main content

@agirails/sdk v2.0 Released: New API Layers, DID Support & Mock Mode

ยท 3 min read
AGIRAILS Core Team

The AGIRAILS TypeScript SDK v2.0 is now live on npm with a completely redesigned API, full DID support, and a new mock mode for offline development.

Installationโ€‹

npm install @agirails/sdk

npm: @agirails/sdk GitHub: agirails/sdk-js


What's New in v2.0โ€‹

Three API Layersโ€‹

The SDK now offers three levels of abstraction to match your needs:

LayerUse CaseComplexity
BasicQuick integrations, demosMinimal
StandardProduction applicationsBalanced
AdvancedCustom implementationsFull control
import { ACTPClient } from '@agirails/sdk';

const client = await ACTPClient.create({
network: 'base-sepolia',
privateKey: process.env.PRIVATE_KEY
});

// Basic: One-liner payment
const result = await client.basic.pay({
provider: '0x...',
amount: '10.00',
service: 'echo'
});

// Standard: Full control
const txId = await client.standard.createTransaction({
provider: '0x...',
amount: '10.00',
deadline: '+1h',
disputeWindow: 3600
});
await client.standard.linkEscrow(txId);

Mock Modeโ€‹

Develop and test without blockchain access:

const client = await ACTPClient.create({
mode: 'mock' // No private key needed!
});

// Full ACTP flow works identically
const result = await client.basic.pay({
provider: '0x1234...',
amount: '5.00',
service: 'test'
});

Mock mode features:

  • No gas fees
  • Instant transactions
  • Persistent state (survives restarts)
  • Perfect for CI/CD pipelines

DID Support (AIP-7)โ€‹

Full Decentralized Identifier support with ERC-1056 compatibility:

import { DIDResolver, DIDManager } from '@agirails/sdk';

// Resolve DID to document
const resolver = await DIDResolver.create({ network: 'base-sepolia' });
const doc = await resolver.resolve('did:ethr:84532:0x742d35cc...');

// Manage identity (delegates, attributes)
const manager = new DIDManager(registryAddress, signer);
await manager.addDelegate(identity, DelegateType.SIGNING, delegate, validity);
await manager.setAttribute(identity, 'serviceEndpoint', 'https://api.example.com', validity);

Delivery Proofs with EASโ€‹

Create verifiable delivery proofs using Ethereum Attestation Service:

import { DeliveryProofBuilder } from '@agirails/sdk';

const builder = new DeliveryProofBuilder(signer, { network: 'base-sepolia' });

const proof = await builder.build({
txId: '0x...',
resultCID: 'ipfs://Qm...',
resultHash: '0x...'
});

// Creates on-chain attestation
const attestationUID = await builder.attest(proof);

CLI Toolโ€‹

New command-line interface for quick operations:

# Install globally
npm install -g @agirails/sdk

# Initialize config
actp init

# Create transaction
actp tx create --provider 0x... --amount 10

# Check status
actp tx status <txId>

# Simulate full flow
actp simulate --amount 5

Breaking Changes from v1.xโ€‹

v1.xv2.x
client.kernel.createTransaction()client.standard.createTransaction()
client.kernel.transitionState()client.standard.transitionState()
client.fundTransaction()client.standard.linkEscrow()
client.releaseEscrowWithVerification()client.standard.releaseEscrow()

The v2 API is more intuitive with clear separation between basic and standard use cases.


Network Supportโ€‹

NetworkChain IDStatus
Base Sepolia84532Active (Testnet)
Base Mainnet8453Not Deployed

Contract addresses are automatically resolved from network config - no manual configuration needed.


What's Nextโ€‹

  • Python SDK: 1:1 feature parity (coming soon)
  • n8n Node v2: Already released (n8n-nodes-actp)
  • Documentation: Updated guides for v2 API

Resourcesโ€‹


Feedbackโ€‹

Found an issue? Open a GitHub issue or reach out on Discord.