Skip to main content

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: TransactionBuilder builds and signs transfers, contract calls, NFT operations and Lockup/LockupPrime calls, either directly or from a contract ABI. The Nft, Lockup and LockupPrime contracts 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_prefix results 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:

ModuleWhat it covers
sdk.chainTip, stats, KPIs, entries by hash or height, transactions, transaction events by account, filtered transaction queries
sdk.walletBalance of one token, or all token balances of an address
sdk.transactionSubmit a transaction, submit and wait (confirmed or finalized), get a transaction, list the transactions of an entry
sdk.contractContract state reads (single key, prefix), read-only view calls, richlist
sdk.epochValidator scores, emission addresses, whether a solution is in an epoch
sdk.peerNodes, trainers (validators), removed trainers, ANRs
sdk.proofContract state proofs, validator record proofs, block inclusion proofs
sdk.stakingLockupVault staking positions, vaults, validator commissions, current epoch
note

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:

AreaMain exports
Keys and cryptogenerateKeypair, derivePublicKeyFromSeedBase58, getPublicKey, secretKeyToSeedBase58
Recovery phrases (mnemonic)generateMnemonic, validateMnemonic, mnemonicToSeedBase58, mnemonicToCandidateKeypairs, resolveMnemonicImport, resolveCandidateForAddress, derivationForSeed
NetworksNetworkType, NETWORK_URLS, NETWORK_CONFIGS, TESTNET_FAUCET_URL
SigningsignContractCall, buildAndSignRaw, signUnsigned, txDstForNetwork
Transaction buildingTransactionBuilder, buildCoinTransfer
Contract ABIscreateContract, buildContractCall, LOCKUP_ABI, LOCKUP_PRIME_ABI, NFT_ABI
NFTbuildNftTransfer, buildNftMint, buildNftCreateCollection
Staking (LockupVault)summarizeLockupVaults, parseLockupVaultEntries, flatToAma, epochFromHeight
Contract statereadAllPrefixPages, prefixPagePath, decodeContractStatePage, decodeContractState, parseStateNumber, parseStateString
Serializationencode, decode
EncodingtoBase58, fromBase58, uint8ArrayToBase64, base64ToUint8Array
AmountstoAtomicAma, fromAtomicAma, AMA_TOKEN_DECIMALS, AMA_TRANSFER_FEE
EncryptionencryptWithPassword, decryptWithPassword
ValidationisValidAddress, validateAddress, isValidSeed, validateAmount, validatePassword
FormattersformatBalance, formatAMAAmount, formatShortAddress
Explorer linksmakeTransactionUrl, makeAddressUrl, makeExplorerUrl
ErrorsAmadeusSDKError, 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​

PageRead it for
2. Getting StartedInstallation, ESM setup, first query, first transaction
3. Core ConceptsKeys, addresses, transactions, finality, amounts, serialization, errors
4. Transaction BuildingEvery way to build and sign a transaction
5. API ModulesReference for each sdk.* module
6. UtilitiesEncoding, conversion, validation, formatting and explorer helpers
Recovery phrasesMnemonics, the two derivations a phrase can open, importing a phrase into a wallet
Networks and testnetNetworkType, network-bound signing, testnet RPC and faucet
Contracts and NFTsABIs, createContract, NFT collections, minting and transfers
Contract statePaged prefix reads, decoders, view calls and state proofs
StakingLockupVault positions with sdk.staking
7. ExamplesEnd-to-end samples
8. Best PracticesKey handling, error handling, production setup
9. TroubleshootingCommon errors and fixes
Migration guideUpgrading 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, bs58 and effect.
  • License: MIT.

Resources​

Next steps​

  1. Install the SDK
  2. Learn the core concepts
  3. Build your first transaction
  4. Explore the API modules