Installation
Magic interacts with the ICON blockchain via Magic’s extension NPM package@magic-ext/icon
. The ICON extension also lets you interact with the blockchain using methods from ICON’s JavaScript SDK.
Initialization
JavaScript
Common Methods
Get Test ICON Before you can send transaction on the ICON blockchain, you’ll need to acquire some test ICON (ICON’s native cryptocurrency for test network).- Go to our ICON Example application
- Login with your email address
- Copy your ICON public address
- Go to the ICON Faucet
- Paste your copied ICON public address in the text input
- You can receive up to 100 test ICON per day
- Now you can use your test ICON in our example app
Get User Info
UsinggetAccount
function to get ICON public address for current user.
JavaScript
Send Transaction
Note that the Magic ICON extension follows the method names and conventions by ICON’s JavaScript SDK. To send a standard ICON blockchain transaction, you can call themagic.icon.sendTransaction
method.
JavaScript
Sign Transaction
To send a standard ICON blockchain transaction, you can call themagic.icon.signTransaction
method to get the signature and raw transaction then send to blockchain by yourself.
JavaScript
Deploy Smart Contract
Note that the Magic ICON extension follows the method names and conventions by ICON’s JavaScript SDK. Please follow ICON contract deploy documentation to create and compile the smart contract. To deploy an ICON smart contract, you can call themagic.icon.sendTransaction
method to send deploy contract transaction.
JavaScript