L1
JavaScript SDK 教程
Æternity 官方 JavaScript/TypeScript SDK,最成熟、功能最完整
快速开始
安装 aepp-sdk 并连接到 Æternity 网络:
# 安装
npm install @aeternity/aepp-sdk
# 或使用 yarn
yarn add @aeternity/aepp-sdk
// ES6 导入
import { AeSdk, Node, AccountMemory } from '@aeternity/aepp-sdk';
// 连接节点
const node = new Node('https://mainnet.aeternity.io');
const aeSdk = new AeSdk({
nodes: [{ name: 'mainnet', instance: node }]
});
// 查询当前区块高度
const height = await node.getCurrentKeyBlockHeight();
console.log('当前区块高度:', height);