"There are two approaches, purist and high-level."
Alexander Kahl.
The purist uses the functions generated out of the Swagger file. After creating the SDK instance aeSdk with the AeSdk class it exposes a mapping of all operationIds as functions, converted to camelCase (from PascalCase). So e.g. in order to get a transaction based on its hash you would invoke aeSdk.api.getTransactionByHash('th_...').
In this way the SDK is simply a mapping of the raw API calls into JavaScript. It's excellent for low-level control, and as a teaching tool to understand the node's operations. Most real-world requirements involves a series of chain operations, so the SDK provides abstractions for these.
(Recommended) High-level SDK usage
Example spend function, using æternity's SDK abstraction.
import { MemoryAccount, Node, AeSdk } from '@aeternity/aepp-sdk';
async function init() {
const node = new Node('https://testnet.aeternity.io'); // ideally host your own node!
const aeSdk = new AeSdk({
nodes: [{ name: 'testnet', instance: node }],
accounts: [new MemoryAccount('<SECRET_KEY_HERE>')],
});
// log transaction info
console.log(await aeSdk.spend(100, 'ak_...'));
}