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

@dexter_agent/smart-accounts-sdk

v0.2.51

Published

TypeScript SDK for Dexter Smart Accounts

Downloads

260

Readme

Dexter Smart Accounts SDK

A TypeScript SDK for interacting with Dexter Smart Accounts on Sui.

Installation

npm install @dexter/smart-accounts-sdk

Quick Start

import { Transaction } from "@mysten/sui/transactions";
import { SuiClient } from "@mysten/sui/client";
import { DexterSdk } from "@dexter/smart-accounts-sdk";

// Initialize the Sui client and SDK
const client = new SuiClient({ url: "https://fullnode.mainnet.sui.io:443" });
const dexter = new DexterSdk(client);

// Create a transaction
const txb = new Transaction();

// Create a smart account
const { ownerCap } = dexter.account.create(txb, {
    activationFee: "coinObjectId",
});

// Add a strategy
dexter.account.addStrategy(txb, {
    account: "accountId",
    ownerCap,
    strategyName: "myStrategy",
    clock: "0x6",
});

// Deposit assets with automatic rebalance to highest APR protocol
await dexter.account.deposit(txb, {
    account: "accountId",
    ownerCap,
    coin: "coinObjectId",
    strategyName: "myStrategy",
    assetType: "0x2::sui::SUI",
});

// Execute the transaction
const result = await client.signAndExecuteTransaction({
    signer: keypair,
    transaction: txb,
});

Auto-Rebalance Feature

The SDK now includes automatic rebalancing to the protocol with the highest APR when depositing assets:

import { STRATEGY_API_URL } from "@dexter/smart-accounts-sdk";

// Deposit with auto-rebalance (uses default strategy API)
await dexter.account.deposit(txb, {
    account: "accountId",
    ownerCap,
    coin: "coinObjectId",
    strategyName: "wal-multi-lend",
    assetType:
        "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL",
});

// Deposit with custom strategy API
await dexter.account.deposit(
    txb,
    {
        account: "accountId",
        ownerCap,
        coin: "coinObjectId",
        strategyName: "wal-multi-lend",
        assetType:
            "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL",
    },
    "https://custom-api.example.com/strategy/latest"
);

// Fetch strategy data manually
const strategyData = await dexter.account.getLatestStrategy(
    STRATEGY_API_URL,
    "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL"
);
console.log(
    `Best protocol: ${strategyData.rankings[0].protocol} (${strategyData.rankings[0].apy}% APR)`
);

Agent Operations

// Comprehensive rebalance between protocols
await dexter.agent.rebalance(
    txb,
    {
        account: "accountId",
        strategyName: "wal-multi-lend",
        fromAdapter: "scallop",
        toAdapter: "suilend",
        assetType:
            "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL",
    },
    ownerCap
);

Data Fetching

import { SuiClient } from "@mysten/sui/client";

const client = new SuiClient({ url: "https://fullnode.mainnet.sui.io:443" });
const dexter = new DexterSdk(client);

// Fetch user's accounts
const ownerCaps = await dexter.account.fetchOwnerCaps("0xuser_address");
for (const ownerCap of ownerCaps) {
    const accountData = await dexter.account.fetchAccount(ownerCap);
    console.log("Account:", accountData?.objectId);
}

API Reference

Account Methods

  • create(txb, args) - Create smart account
  • addStrategy(txb, args) - Add strategy to account
  • deposit(txb, args, strategyApiUrl?) - Deposit assets with auto-rebalance
  • withdraw(txb, args) - Withdraw assets
  • getLatestStrategy(strategyApiUrl, assetType) - Fetch latest protocol rankings
  • fetchOwnerCaps(userAddress) - Fetch user's accounts
  • fetchAccount(ownerCap) - Fetch account data

Agent Methods

  • rebalance(txb, args, ownerCap?) - Comprehensive rebalance between protocols
  • issueTicket(txb, args) - Issue transfer ticket
  • addAssetToTicket(txb, args) - Add assets to ticket
  • consumeTicketAssets(txb, args) - Consume ticket assets
  • finalizeTicketConsumption(txb, args) - Finalize ticket

Config Methods (Admin only)

  • addPolicy(txb, args) - Add policy
  • addStrategy(txb, args) - Add strategy
  • addAgent(txb, args) - Add agent to whitelist

License

MIT