Skip to content

Instantly share code, notes, and snippets.

@jimmychu0807
Created March 4, 2020 11:58
Show Gist options
  • Save jimmychu0807/3f03835f43e01c1b24a5f1887896e77c to your computer and use it in GitHub Desktop.
Save jimmychu0807/3f03835f43e01c1b24a5f1887896e77c to your computer and use it in GitHub Desktop.
Markdium-用 Polkadot-JS API 輕鬆搭建 Substrate 前端
// 引入
import { ApiPromise, WsProvider } from '@polkadot/api';
// 創建 api 對象
const wsProvider = new WsProvider('ws://localhost:9944');
const api = await ApiPromise.create({ provider: wsProvider });
// 簡單測試-讀取常量
console.log(api.consts.balances.transactionByteFee.toNumber());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment