forked from paritytech/substrate
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added test script for balances (paritytech#276)
* added test script * update type * publish types
- Loading branch information
1 parent
302187d
commit 601d78c
Showing
5 changed files
with
363 additions
and
111 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { ApiPromise, WsProvider } from "@polkadot/api"; | ||
import Web3 from "web3"; | ||
import { typesBundle } from "../moonbeam-types-bundle"; | ||
const wsProviderUrl = `wss://wss.testnet.moonbeam.network`; | ||
const GERALD = "0x6be02d1d3665660d22ff9624b7be0551ee1ac91b"; | ||
const FAITH = "0xC0F0f4ab324C46e55D02D0033343B4Be8A55532d"; | ||
|
||
export default async function test(ACC: string) { | ||
const web3 = new Web3(wsProviderUrl); | ||
let balance = await web3.eth.getBalance(ACC); | ||
console.log("BALANCE WEB3", balance.toString()); | ||
|
||
const wsProvider = new WsProvider(wsProviderUrl); | ||
const polkadotApi = await ApiPromise.create({ | ||
provider: wsProvider, | ||
typesBundle: typesBundle as any, | ||
}); | ||
const account = await polkadotApi.query.system.account(ACC); | ||
// console.log("BALANCE API", account.data.feeFrozen.toString()); | ||
// console.log("BALANCE API", account.data.miscFrozen.toString()); | ||
// console.log("BALANCE API", account.data.reserved.toString()); | ||
console.log("BALANCE API", account.data.free.toString()); | ||
} | ||
test(FAITH); |
Oops, something went wrong.