Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @bankofai/sun-kit
# @sun-protocol/sun-kit

TypeScript SDK for [SUN.IO](https://sun.io) / SUNSWAP on the TRON blockchain.

Expand All @@ -7,12 +7,12 @@ Provides two entry points:
- **`SunAPI`** — typed HTTP client for all SUN.IO read-only endpoints (pools, tokens, prices, positions, farms, etc.). Zero dependencies beyond `fetch`.
- **`SunKit`** — wallet-dependent on-chain operations (swap, liquidity, positions, contract calls). Requires `tronweb`.

Built as a shared library for [@bankofai/sun-mcp-server](https://github.com/AnotherOneNewCoder/sun-mcp-server) and the upcoming `sun-cli`.
Built as a shared library for [@sun-protocol/sun-mcp-server](https://github.com/sun-protocol/sun-mcp-server) and the upcoming `sun-cli`.

## Install

```bash
npm install @bankofai/sun-kit
npm install @sun-protocol/sun-kit
# tronweb is an optional peer dep — install it if you use SunKit (on-chain ops)
npm install tronweb
```
Expand All @@ -22,7 +22,7 @@ npm install tronweb
### Read-only: SunAPI

```typescript
import { SunAPI } from '@bankofai/sun-kit'
import { SunAPI } from '@sun-protocol/sun-kit'

const api = new SunAPI()

Expand All @@ -42,7 +42,7 @@ No wallet, no tronweb — just HTTP.
### On-chain: SunKit

```typescript
import { SunKit, type Wallet } from '@bankofai/sun-kit'
import { SunKit, type Wallet } from '@sun-protocol/sun-kit'

// You provide a Wallet implementation (see below)
const kit = new SunKit({
Expand Down Expand Up @@ -102,7 +102,7 @@ const balances = await kit.getBalances({
sun-kit does **not** ship a wallet implementation. You bring your own:

```typescript
import type { Wallet } from '@bankofai/sun-kit'
import type { Wallet } from '@sun-protocol/sun-kit'

class MyWallet implements Wallet {
readonly type = 'my-wallet'
Expand All @@ -119,8 +119,8 @@ class MyWallet implements Wallet {
```

Reference implementations:
- `LocalWallet` (raw private key) — see [sun-mcp-server/src/wallet/local-wallet.ts](https://github.com/AnotherOneNewCoder/sun-mcp-server)
- `AgentWalletAdapter` (encrypted agent-wallet) — see [sun-mcp-server/src/wallet/agent-wallet-adapter.ts](https://github.com/AnotherOneNewCoder/sun-mcp-server)
- `LocalWallet` (raw private key) — see [sun-mcp-server/src/wallet/local-wallet.ts](https://github.com/sun-protocol/sun-mcp-server)
- `AgentWalletAdapter` (encrypted agent-wallet) — see [sun-mcp-server/src/wallet/agent-wallet-adapter.ts](https://github.com/sun-protocol/sun-mcp-server)

## API Reference

Expand Down Expand Up @@ -178,7 +178,7 @@ All methods return `Promise<ApiResponse<T>>`.
## Networks

```typescript
import { TronNetwork, getNetworkConfig, NETWORKS } from '@bankofai/sun-kit'
import { TronNetwork, getNetworkConfig, NETWORKS } from '@sun-protocol/sun-kit'

getNetworkConfig('mainnet') // or 'tron', 'trx'
getNetworkConfig('nile') // or 'testnet'
Expand All @@ -199,15 +199,15 @@ import {
SUNSWAP_V3_MAINNET_FACTORY,
SUNSWAP_V3_MAINNET_POSITION_MANAGER,
// ...
} from '@bankofai/sun-kit'
} from '@sun-protocol/sun-kit'
```

## Error Handling

All errors thrown by SunKit are instances of `SunKitError`:

```typescript
import { SunKitError } from '@bankofai/sun-kit'
import { SunKitError } from '@sun-protocol/sun-kit'

try {
await kit.swap({ ... })
Expand Down Expand Up @@ -235,7 +235,7 @@ Error codes:
## Architecture

```
@bankofai/sun-kit
@sun-protocol/sun-kit
├── SunAPI (read-only HTTP, zero deps)
│ └── 23 typed methods -> SUN.IO open API
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bankofai/sun-kit",
"version": "1.1.0",
"name": "@sun-protocol/sun-kit",
"version": "1.2.0",
"description": "SUNSWAP SDK — typed client for SUN.IO read APIs and wallet-dependent on-chain operations (swap, liquidity, positions)",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down Expand Up @@ -37,15 +37,15 @@
"defi",
"sdk"
],
"author": "BankOfAI <[email protected]>",
"author": "SUN Protocol",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/BofAI/sun-kit.git"
"url": "https://github.com/sun-protocol/sun-kit.git"
},
"homepage": "https://github.com/BofAI/sun-kit#readme",
"homepage": "https://github.com/sun-protocol/sun-kit#readme",
"bugs": {
"url": "https://github.com/BofAI/sun-kit/issues"
"url": "https://github.com/sun-protocol/sun-kit/issues"
},
"engines": {
"node": ">=18.0.0"
Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const WTRX_NILE = 'TYsbWxNnyTgsZaTFaue9hqpxkU3Fkco94a'
// ---------------------------------------------------------------------------

export const SUNSWAP_V2_MAINNET_FACTORY = 'TKWJdrQkqHisa1X8HUdHEfREvTzw4pMAaY'
export const SUNSWAP_V2_MAINNET_ROUTER = 'TKzxdSv2FZKQrEqkKVgp5DcwEXBEKMg2Ax'
export const SUNSWAP_V2_MAINNET_ROUTER = 'TNJVzGqKBWkJxJB5XYSqGAwUTV15U24pPq'

export const SUNSWAP_V2_NILE_FACTORY = 'THomLGMLhAjMecQf9FQjbZ8a1RtwsZLrGE'
export const SUNSWAP_V2_NILE_ROUTER = 'TMn1qrmYUMSTXo9babrJLzepKZoPC7M6Sy'
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// @bankofai/sun-kit — public API
// @sun-protocol/sun-kit — public API
// ---------------------------------------------------------------------------

// SunAPI: read-only HTTP client for SUN.IO open API
Expand Down
Loading