ICON
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.
note
You can skip straight to our kitchen sink example directly:
๐ ICON Example
- NPM
- Yarn
Initializing Extension
- ES Modules/TypeScript
Get User Info
Get Account
Using getAccount function to get ICON public address for current user.
- ES Modules/TypeScript
Send Transaction
Getting 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
Call sendTransaction Extension Method
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 the magic.icon.sendTransaction
method.
- ES Modules/TypeScript
Call signTransaction Extension Method
To send a standard ICON blockchain transaction, you can call the magic.icon.signTransaction
method to get the signature and raw transaction then send to blockchain by yourself.
- ES Modules/TypeScript
Smart Contract
Deploy Contract
Getting 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
Call Extension Method
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 the magic.icon.sendTransaction
method to send deploy contract transaction.
- ES Modules/TypeScript