Installation
Magic interacts with the Avalanche blockchain via Magic’s extension NPM package@magic-ext/avalanche
. The Avalanche extension also lets you interact with the blockchain using methods from Avalanche’s JavaScript SDK.
Initialization
Note: This is for X-Chain implementation.JavaScript
Common Methods
Get Test AVAX Before you can send transaction on the Avalanche blockchain, you’ll need to acquire some test AVAX (Avalanche’s native cryptocurrency for test network).- Go to our Avalanche Example
- Login with your email address
- Copy your Avalanche public address
- Go to the Avalanche Faucet
- Paste your copied Avalanche public address in the text input
- You can receive 10000000 nAVAX
- Now you can use your test AVAX in our example app
Send Transaction
Note that the Magic Avalanche extension follows the method names and conventions by Avalanche’s JavaScript SDK. To send a standard Avalanche blockchain transaction, you can call themagic.xchain.signTransaction()
method.
JavaScript