Created
March 3, 2023 02:33
-
-
Save h2pl69/f1f9b3e748c3c67bbcf313451d97a1fd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const IconBridgeSDK = require("@espanicon/icon-bridge-sdk-js"); | |
| const iconAddr = "hxf13e8fa67714132692162cb5e560ac54319c7933", | |
| iconPk = "", | |
| bscAddr = "0x6cfc659109E7443306408f48bD6a7Dc9408D55A0", | |
| bscPk = ""; | |
| async function runAsync() { | |
| const sdk = new IconBridgeSDK({ | |
| useMainnet: false | |
| }); | |
| console.log( | |
| await sdk.bsc.methods.transferNativeCoin( | |
| iconAddr, | |
| "icon", | |
| bscAddr, | |
| bscPk, | |
| "0.1" | |
| ) | |
| ); | |
| // Result | |
| // { | |
| // jsonrpc: '2.0', | |
| // id: 49, | |
| // result: '0x1ba9b737c9d53ea00c74e9f7cc605722fa0333ff2ed2a3fab64e7df964716dbe' | |
| // } | |
| console.log( | |
| await sdk.icon.methods.transferNativeCoin( | |
| bscAddr, | |
| "bsc", | |
| iconAddr, | |
| iconPk, | |
| "66" | |
| ) | |
| ); | |
| // Result | |
| // { | |
| // jsonrpc: '2.0', | |
| // result: '0xf659c8271611694abe3da26a3d74f012f2ec11521c879bc011311eb6508be183', | |
| // id: 531 | |
| // } | |
| } | |
| runAsync(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment