Package Exports
- @aeternity/aepp-sdk
- @aeternity/aepp-sdk/es
- @aeternity/aepp-sdk/es/account/memory
- @aeternity/aepp-sdk/es/ae/universal
- @aeternity/aepp-sdk/es/ae/wallet
- @aeternity/aepp-sdk/es/chain/node
- @aeternity/aepp-sdk/es/contract/compiler
- @aeternity/aepp-sdk/es/node
- @aeternity/aepp-sdk/es/tx/builder
- @aeternity/aepp-sdk/es/tx/builder/helpers
- @aeternity/aepp-sdk/es/tx/builder/schema
- @aeternity/aepp-sdk/es/tx/tx
- @aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-runtime
- @aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-window-message
- @aeternity/aepp-sdk/es/utils/aepp-wallet-communication/content-script-bridge
- @aeternity/aepp-sdk/es/utils/aepp-wallet-communication/helpers
- @aeternity/aepp-sdk/es/utils/aepp-wallet-communication/schema
- @aeternity/aepp-sdk/es/utils/aepp-wallet-communication/wallet-detector
- @aeternity/aepp-sdk/es/utils/bytes
- @aeternity/aepp-sdk/es/utils/crypto
- @aeternity/aepp-sdk/es/utils/keystore
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@aeternity/aepp-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Æternity's Javascript SDK
JavaScript SDK for the revolutionary æternity blockchain, targeting the
æternity node implementation. Aepp-sdk is hosted on GitHub.
Table of content
- Æternity's Javascript SDK
Quick Start
1. Install SDK
A) Simple Usage: with <script> tag
For those not using any JS bundling/complilation or compilation technique or tools like Codepen or similar online Editors, please check our Import SDK bundle with <script> tag.
If you're using bundling/compilation techniques (eg. webpack), please continue reading.
B) Advanced Usage: with npm or similar
Add the latest @aeternity/aepp-sdk release from npmjs.com to your project using one of these commands
# install using npm...or yarn or pnpm
npm i @aeternity/aepp-sdkNote: To install a Pre-Release (latest beta or alpha version) using on the latest Node version, you have to install the package appending the @next tag reference, or even use the # symbol and the Repo URL to install a version coming from a specific branch.
# install the @next version of the SDK
npm i @aeternity/aepp-sdk@next
# install the #develop version of the SDK
npm i https://github.com/aeternity/aepp-sdk-js#developNote : If you experience errors during the installation, you might need to install build tools for your OS.
Windows: Windows Build Tools
npm install -g windows-build-toolsUbuntu / Debian: Build Essential
sudo apt-get update
sudo apt-get install build-essentialMac: Download Xcode from AppStore, then run
xcode-select --install2. Create an Account
You can do many more things now, but you'll probably have to start with:
A) Using the Command Line
Create an account using the 💻 CLI
B) Using the SDK
import { Crypto } from '@aeternity/aepp-sdk/es'
const keypair = Crypto.generateKeyPair()
console.log(`Secret key: ${keypair.secretKey}`)
console.log(`Public key: ${keypair.publicKey}`)3. Give yourself some AE tokens
To get yourself some AEs you can use the 🚰 Faucet Aepp. Just add your publicKey, and you'll immediately get some test tokens.
4. Import (a chosen Flavor)
Import the right flavor. For this example with get the Universal flavor, which contains all the features of the SDK:
// Import Flavor
import Ae from '@aeternity/aepp-sdk/es/ae/universal' // or other flavor5. Play with Aetenity's blockchain features
// Use Flavor
import Ae from '@aeternity/aepp-sdk/es/ae/universal' // or other flavor
import MemoryAccount from '@aeternity/aepp-sdk/es/account/memory' // or other flavor
import Node from '@aeternity/aepp-sdk/es/node' // or other flavor
import { AE_AMOUNT_FORMATS } from '@aeternity/aepp-sdk/es/utils/amount-formatter'
const NODE_URL = 'https://sdk-testnet.aepps.com'
const COMPILER_URL = 'COMPILER_URL' // required for using Contract
const ACCOUNT = MemoryAccount({ keypair: { secretKey: 'A_PRIV_KEY', publicKey: 'A_PUB_ADDRESS' } })
(async function () {
const nodeInstance = await Node({ url: NODE_URL })
const sdkInstance = await Ae({
compilerUrl: COMPILER_URL,
nodes: [ { name: 'test-net', instance: nodeInstance } ],
accounts: [ ACCOUNT ]
})
await sdkInstance.height() // get top block height
console.log('Current Block Height:', height)
await sdkInstance.spend(1, 'ak_asd23dasdasda...', { denomination: AE_AMOUNT_FORMATS.AE }) // spend one AE
})()More: Guides & Examples
Check out our Guides and Examples.
CLI - Command Line Client
To quickly test all of Aeternity's blockchain features from your Terminal, you can Install and use our NodeJS CLI by running:
npm i -g @aeternity/aepp-clito globally install the CLIaecli --helpto get a list of possible commands
eg. Create an Account:
aecli account create testWhateverAccountName
Contributing
For advanced use, to get a deeper understanding of the SDK or to contribute to its development, it is advised to read the Contributing Guidelines section.
Change Log
We keep our Changelog up to date.
License
ISC License (ISC) Copyright © 2018 aeternity developers
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.