Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@atoshi/chain-sdk

TypeScript SDK for the Atoshi L1 chain (atoshi-chain — Cosmos SDK + EVM).

For privacy / shielded operations on L2, use the companion package @atoshi/privacy-sdk.

Quick start

npm install @atoshi/chain-sdk ethers
import { AtoshiClient, PrivateKeySigner } from '@atoshi/chain-sdk';

// Read-only client
const client = new AtoshiClient({
  rpcUrl: 'https://rpc.atoshi.xyz',         // L1 EVM RPC (:8545)
  restUrl: 'https://api.atoshi.xyz',        // L1 Cosmos REST (:1317)
  evmChainId: 88288,
  cosmosChainId: 'atoshi_88288-1',
  l1BridgeAddress: '0xC241A13b93b3969e15303c194520Fc2f950F7F4b',
  l2RpcUrl: 'https://l2-rpc.atoshi.xyz',
  l2ChainId: 67890,
});

// L1 queries
const price = await client.oracle.currentPrice();
const release = await client.tokenomics.releaseStatus();
const energy = await client.energy.balance('atoshi1abc...');

// Write — needs a signer
const wallet = new AtoshiClient({
  ...cfg,
  signer: { type: 'privateKey', privateKey: '0xYOUR_KEY' },
});

// L1 → L2 bridge
const dep = await wallet.bridge.deposit({
  to: '0xL2_ADDRESS',
  amount: '10',         // 10 ATOS
  token: 'native',
});
await wallet.bridge.waitForClaim(dep.depositCount);
console.log('done — 10 ATOS now on L2');

Modules

Module What it does
client.oracle Read ATOS price, TWAP, feeders
client.tokenomics Release tier, circulating supply, block reward
client.energy Energy balance + delegations + fee estimation
client.bridge L1→L2 deposit / L2→L1 claim

Scope

MVP P0 + P1 features shipped:

  • ✅ Oracle / tokenomics / energy read APIs (via Cosmos REST)
  • ✅ L1 → L2 bridge deposit() + waitForClaim() + depositStatus()
  • ✅ L1 → L2 bridge.claim() (computes merkle proof locally; see Known Limitations below)
  • energy.delegate() / energy.undelegate() write tx
  • bank.balance() / bank.send() standard cosmos transfer
  • PrivateKeySigner (scripts & server-side EVM)
  • MetaMaskSigner (browser EVM)
  • KeplrSigner (browser Cosmos)

P2 (later iterations):

  • L2 → L1 reverse bridge.claim() (needs bridge proof service integration)
  • MnemonicSigner for ethermint-style Cosmos signing (atoshi chain uses EVM keys, requires EIP-712 path)
  • Indexer / batch historical queries

Known limitations

  • L1 → L2 bridge claim: on testnets running in mock L1InfoTree mode (SkipVerifyL1InfoRoot=true), bridge.claim() will refuse to submit with a clear "L2 has not imported GER" error. Production CDK setups (real L1 sync, bridge-service) work normally.
  • PrivateKeySigner.broadcastCosmosTx(): not implemented — atoshi-chain is ethermint-based (EVM keys), the standard cosmjs Direct signer produces wrong addresses. Use KeplrSigner in browser for Cosmos txs.

Development

npm install
npm run build
npm run test
npm run typecheck

# Run an example against a live chain
L1_RPC_URL=http://...:8545 L1_REST_URL=http://...:1317 \
  npx ts-node examples/01-query-oracle.ts

Architecture

  • EVM ops (bridge contract, ERC20): ethers v6
  • Cosmos module queries: plain fetch to REST gateway (no @cosmjs dependency for read APIs)
  • Cosmos module writes (P1): @cosmjs/stargate + custom msg codecs

License

MIT

About

TypeScript SDK for Atoshi L1 chain (Cosmos+EVM): oracle/tokenomics/energy queries, L1↔L2 bridge, wallet signers (MetaMask + Keplr).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages