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.