In case you're not using any JS bundling/compilation technique, the SDK can also be loaded with the traditional <script>
tag, as follows:
<script src="https://unpkg.com/@aeternity/aepp-sdk/dist/aepp-sdk.browser-script.js"></script>
<script src="https://unpkg.com/@aeternity/aepp-sdk@VERSION/dist/aepp-sdk.browser-script.js"></script>
...where VERSION
is the version number of the SDK you want to use (eg. 8.1.0
).
The bundle will assign the SDK to a global variable called Ae
that makes all functionalities of the SDK accessible.
Usage:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<!-- include latest SDK version -->
<script src="https://unpkg.com/@aeternity/aepp-sdk/dist/aepp-sdk.browser-script.js"></script>
<script type="text/javascript">
const node = new Ae.Node('https://testnet.aeternity.io')
const aeSdk = new Ae.AeSdk({
nodes: [{ name: 'testnet', instance: node }]
})
aeSdk.height().then(height => {
console.log("Current Block Height:" + height)
})
</script>
</body>
</html>
npm i @aeternity/aepp-sdk
To install a Pre-Release (latest beta
or alpha
version) you have to install the package appending the @next
tag reference.
npm i @aeternity/aepp-sdk@next
You can also install a version coming from a specific branch. In this case you would install the SDK version of the develop
branch.
npm i github:aeternity/aepp-sdk-js#develop
Note: 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-tools
Ubuntu / Debian: Build Essential
sudo apt-get update
sudo apt-get install build-essential
Mac
Download Xcode from AppStore, then run
xcode-select --install
If you don't need to include specific functionality into your application and just want to use or play around with features the SDK provides you can make use of the 💻 CLI and follow the instructions mentioned there.