npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@kmy/aisa-solana-sdk

v1.0.3

Published

A TypeScript library for interacting with AISA (Automated Intelligent Spending Accounts) Solana smart contracts. This SDK provides a set of APIs that allow applications to create and manage main accounts and sub-accounts, set payment rules, handle authori

Readme

AISA Solana SDK

A TypeScript library for interacting with AISA (Automated Intelligent Spending Accounts) Solana smart contracts. This SDK provides a set of APIs that allow applications to create and manage main accounts and sub-accounts, set payment rules, handle authorized payments, and more.

中文文档

Features

  • Create and manage main accounts and sub-accounts
  • Payment recipient whitelist management
  • Token whitelist management
  • Configure payment frequency, amount, and intervals
  • Increase and decrease sub-account allowances
  • Support for SPL token payment requests

Installation

npm install aisa-solana-sdk
# or
yarn add aisa-solana-sdk

Environment Configuration

Create a .env file, referencing .env.sample to configure the following variables:

RPC_URL=<Your Solana RPC URL>
CONTRACT_ADDRESS=<AISA Contract Address>
PRIVATE_KEY=<Your Wallet Private Key>

Usage

Initialization

import { MainAccountTxHandler, SubAccountTxHandler } from "aisa-solana-sdk";

// Initialize the main account handler (used by account owner)
const mainAccountHandler = await MainAccountTxHandler.initialize();

// Initialize the sub-account handler (used by agent/user)
const subAccountHandler = await SubAccountTxHandler.initialize();

Main Account Operations

// Create a main account
const uuid = [1, 2, 3, 4]; // Unique identifier
const globalPayeeWhitelist = ["payee_pubkey1", "payee_pubkey2"]; // Global allowed payee list
const txId = await mainAccountHandler.createMainAccount(uuid, globalPayeeWhitelist);

// Query main account state
const [owner, whitelist] = await mainAccountHandler.getMainAccountState(uuid);

// Update main account rules
await mainAccountHandler.updateMainAccountRules(uuid, ["new_payee_pubkey1", "new_payee_pubkey2"]);

Sub-Account Operations

// Create a sub-account
import * as anchor from "@coral-xyz/anchor";
const uuid = [1, 2, 3, 4]; // Main account's unique identifier
const agent = "agent_pubkey"; // Sub-account's agent
const payeeWhitelist = ["payee_pubkey1"]; // Allowed payees for the sub-account
const tokenWhitelist = ["token_pubkey1", "token_pubkey2"]; // Allowed tokens for the sub-account
const maxPerPayment = new anchor.BN(1000000); // Maximum amount per payment
const paymentCount = 10; // Number of payments
const paymentInterval = new anchor.BN(86400); // Payment interval (seconds)
const allowanceAmount = new anchor.BN(10000000); // Initial allowance amount

await mainAccountHandler.createSubAccount(
  uuid,
  agent,
  payeeWhitelist,
  tokenWhitelist,
  maxPerPayment,
  paymentCount,
  paymentInterval,
  allowanceAmount,
  "token_pubkey" // Optional parameter
);

// Increase sub-account allowance
await mainAccountHandler.increaseAllowance(
  uuid,
  agent,
  new anchor.BN(5000000), // Amount to increase
  5, // Payment count
  "token_pubkey"
);

// Decrease sub-account allowance
await mainAccountHandler.decreaseAllowance(
  uuid,
  agent,
  new anchor.BN(2000000), // Amount to decrease
  2, // Payment count
  "token_pubkey"
);

Sub-Account Payment Requests (Initiated by Agent/User)

// Initiate a payment request
const uuid = [1, 2, 3, 4]; // Main account's unique identifier
const payee = "payee_pubkey"; // Payee public key
const amount = new anchor.BN(500000); // Payment amount
const tokenMint = "token_pubkey"; // Token public key

const txId = await subAccountHandler.paymentRequest(
  uuid,
  payee,
  amount,
  tokenMint
);

Main Components

MainAccountTxHandler

Main account transaction handler, used by the account owner, providing the following functions:

  • Create and manage main accounts
  • Create and manage sub-accounts
  • Set global payee whitelist
  • Set payment rules and limitations for sub-accounts
  • Manage sub-account allowances

SubAccountTxHandler

Sub-account transaction handler, used by sub-account agents/users, providing the following functions:

  • Query account state
  • Initiate payment requests that comply with rules

License

ISC