1. Introduction
@amadeus-protocol/sdk is the official TypeScript/JavaScript SDK for the Amadeus blockchain. It talks to Amadeus nodes over HTTP, builds and signs transactions, manages keys and recovery phrases, and encodes data the way the node expects. These pages document version 1.8.0.
If you are connecting a dApp to a user's wallet (browser extension or mobile app) rather than holding keys yourself, start with the Wallet SDK, which builds on this package.
What the SDK does
- Node API client: typed access to the node's HTTP API for chain data, balances, transactions, contract state, epochs, peers, proofs and staking. Requests use the native
fetch; there is no HTTP library dependency. - Transaction building:
TransactionBuilderbuilds and signs transfers, contract calls, NFT operations and Lockup/LockupPrime calls, either directly or from a contract ABI. TheNft,LockupandLockupPrimecontracts run on testnet only. - Keys and recovery phrases: BLS12-381 key generation and signing, BIP39 recovery phrases, and both account derivations a phrase can open (EIP-2333 standard and legacy).
- Network-aware signing: mainnet and testnet sign under different domains, so a transaction signed for one network cannot be replayed on the other.
- Canonical serialization: VecPak encoding and decoding (
encode/decode), the deterministic format transactions are hashed and signed in. - Contract state: helpers that read paged
get_prefixresults and decode stored values. - Password-based encryption: AES-GCM with a PBKDF2-derived key, for storing seeds at rest.
- Formatting and validation: amount conversion (9 decimals), address and seed validation, display formatters and explorer links.
- TypeScript types for every request and response.
Modules
An AmadeusSDK instance exposes one API module per area of the node API:
| Module | What it covers |
|---|---|
sdk.chain | Tip, stats, KPIs, entries by hash or height, transactions, transaction events by account, filtered transaction queries |
sdk.wallet | Balance of one token, or all token balances of an address |
sdk.transaction | Submit a transaction, submit and wait (confirmed or finalized), get a transaction, list the transactions of an entry |
sdk.contract | Contract state reads (single key, prefix), read-only view calls, richlist |
sdk.epoch | Validator scores, emission addresses, whether a solution is in an epoch |
sdk.peer | Nodes, trainers (validators), removed trainers, ANRs |
sdk.proof | Contract state proofs, validator record proofs, block inclusion proofs |
sdk.staking | LockupVault staking positions, vaults, validator commissions, current epoch |
Three methods call routes that the current node release (1.6.5) does not serve: contract.validateBytecode, proof.getValidators and chain.getMetricsBlock. Since 1.8.0 they are deprecated and throw a deprecation AmadeusSDKError with status 404 instead of a plain 404 from the node: validateBytecode and getValidators without sending a request, getMetricsBlock when the node answers 404. proof.getContractStateProof(key, value) also throws a deprecation error; call it with the key only.
MetricsAPI is a separate client for the public activity-metrics service. That service is deployed apart from the node, so you create MetricsAPI with its own baseUrl; the SDK has no default URL for it.
The package also exports standalone modules:
| Area | Main exports |
|---|---|
| Keys and crypto | generateKeypair, derivePublicKeyFromSeedBase58, getPublicKey, secretKeyToSeedBase58 |
| Recovery phrases (mnemonic) | generateMnemonic, validateMnemonic, mnemonicToSeedBase58, mnemonicToCandidateKeypairs, resolveMnemonicImport, resolveCandidateForAddress, derivationForSeed |
| Networks | NetworkType, NETWORK_URLS, NETWORK_CONFIGS, TESTNET_FAUCET_URL |
| Signing | signContractCall, buildAndSignRaw, signUnsigned, txDstForNetwork |
| Transaction building | TransactionBuilder, buildCoinTransfer |
| Contract ABIs | createContract, buildContractCall, LOCKUP_ABI, LOCKUP_PRIME_ABI, NFT_ABI |
| NFT | buildNftTransfer, buildNftMint, buildNftCreateCollection |
| Staking (LockupVault) | summarizeLockupVaults, parseLockupVaultEntries, flatToAma, epochFromHeight |
| Contract state | readAllPrefixPages, prefixPagePath, decodeContractStatePage, decodeContractState, parseStateNumber, parseStateString |
| Serialization | encode, decode |
| Encoding | toBase58, fromBase58, uint8ArrayToBase64, base64ToUint8Array |
| Amounts | toAtomicAma, fromAtomicAma, AMA_TOKEN_DECIMALS, AMA_TRANSFER_FEE |
| Encryption | encryptWithPassword, decryptWithPassword |
| Validation | isValidAddress, validateAddress, isValidSeed, validateAmount, validatePassword |
| Formatters | formatBalance, formatAMAAmount, formatShortAddress |
| Explorer links | makeTransactionUrl, makeAddressUrl, makeExplorerUrl |
| Errors | AmadeusSDKError, getTransactionErrorMessage |
Quick start
npm install @amadeus-protocol/sdk
import { AmadeusSDK, TransactionBuilder } from '@amadeus-protocol/sdk'
// No config: mainnet, https://mainnet-rpc.ama.one/api
const sdk = new AmadeusSDK()
const tip = await sdk.chain.getTip()
console.log('Height:', tip.entry.header.height)
const address = '6969GaCysicYUFd6JQhxG1QPwRvXdTGtWVCCAEgM6Kq1jcSMX7RySrSFU9WRHWbJyE'
const { balance } = await sdk.wallet.getBalance(address, 'AMA')
console.log('Balance:', balance.float, balance.symbol)
// Signing needs a Base58 seed; keep it out of front-end code
const privateKey = '<your Base58 seed>'
const builder = new TransactionBuilder(privateKey)
const { txHash, txPacked } = builder.transfer({
recipient: '<recipient address>',
amount: 1.5,
symbol: 'AMA'
})
const { metadata, receipt } = await sdk.transaction.submitAndWait(txPacked)
console.log(txHash, metadata.entry_height, receipt.success)
TransactionBuilder signs for mainnet unless you create it with a network: new TransactionBuilder(privateKey, { network: NetworkType.TESTNET }). See Networks and testnet.
Documentation map
| Page | Read it for |
|---|---|
| 2. Getting Started | Installation, ESM setup, first query, first transaction |
| 3. Core Concepts | Keys, addresses, transactions, finality, amounts, serialization, errors |
| 4. Transaction Building | Every way to build and sign a transaction |
| 5. API Modules | Reference for each sdk.* module |
| 6. Utilities | Encoding, conversion, validation, formatting and explorer helpers |
| Recovery phrases | Mnemonics, the two derivations a phrase can open, importing a phrase into a wallet |
| Networks and testnet | NetworkType, network-bound signing, testnet RPC and faucet |
| Contracts and NFTs | ABIs, createContract, NFT collections, minting and transfers |
| Contract state | Paged prefix reads, decoders, view calls and state proofs |
| Staking | LockupVault positions with sdk.staking |
| 7. Examples | End-to-end samples |
| 8. Best Practices | Key handling, error handling, production setup |
| 9. Troubleshooting | Common errors and fixes |
| Migration guide | Upgrading from 1.0.x through 1.7.x to 1.8.0 |
Package information
- Package:
@amadeus-protocol/sdk, latest 1.8.0. Release history is in the CHANGELOG. - Module system: pure ESM (
"type": "module"), no CommonJS build. See Getting Started. - Runtime: Node.js 20 or later, or a browser through a bundler (Vite, webpack, esbuild). React Native needs extra setup; see Browsers and other runtimes.
- Runtime dependencies:
@noble/curves,@noble/hashes,@scure/bip39,bs58andeffect. - License: MIT.
Resources
- npm: @amadeus-protocol/sdk
- Source: github.com/amadeusprotocol/amadeus-typescript-sdk
- Mainnet explorer: explorer.ama.one
- Testnet explorer: testnet.explorer.ama.one