@gear-js/api
Version:
A JavaScript library that provides functionality to connect GEAR Component APIs.
15 lines (12 loc) • 504 B
JavaScript
import { GearTransaction } from './Transaction.js';
class GearBalance extends GearTransaction {
async findOut(publicKey) {
const { data: balance } = (await this._api.query.system.account(publicKey));
return this._api.createType('Balance', balance.free);
}
transfer(to, value, keepAlive = true) {
this.extrinsic = this._api.tx.balances[keepAlive ? 'transferKeepAlive' : 'transferAllowDeath'](to, value);
return this.extrinsic;
}
}
export { GearBalance };