diff --git a/bin/cli.js b/bin/cli.js index e60d288b55..34cff4d922 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -255,7 +255,7 @@ async function run_signup(account_file) console.log('Identity stored in', filename); // Ok, transfer for staking. - await api.transferForStaking(member_address, role_address); + await api.transferForStaking(member_address, role_address, ROLE_STORAGE); console.log('Funds transferred.'); // Now apply for the role diff --git a/lib/joystream/substrate/balances.js b/lib/joystream/substrate/balances.js index 46bb956079..287976f538 100644 --- a/lib/joystream/substrate/balances.js +++ b/lib/joystream/substrate/balances.js @@ -51,11 +51,6 @@ class BalancesApi extends IdentitiesApi return await this.api.tx.balances.transfer(to_decoded, amount) .signAndSend(from_key); } - - async transferForStaking(from, to) - { - return await this.transfer(from, to, DEFAULT_STAKING_AMOUNT + 100 /*FIXME */); - } } module.exports = { diff --git a/lib/joystream/substrate/roles.js b/lib/joystream/substrate/roles.js index a2f12b4486..6f27713b8a 100644 --- a/lib/joystream/substrate/roles.js +++ b/lib/joystream/substrate/roles.js @@ -63,6 +63,13 @@ class RolesApi extends BalancesApi return await this.hasMinimumBalanceOf(accountId, required); } + async transferForStaking(from, to, role) + { + const required = await this.requiredBalanceForRoleStaking(role); + return await this.transfer(from, to, required); + } + + async applyForRole(roleAccountId, role, memberAccountId) { const memberId = await this.memberIdOf(memberAccountId);