Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async revokeAbilities(accountId: string | OrderGatewayBase, abilities: AssetLedgerAbility[]): Promise {
if (typeof accountId !== 'string') {
accountId = await (accountId as any).getProxyAccountId(0); // OrderGatewayProxy.XCERT_CREATE
}
let allowSuperRevoke = false;
if (abilities.indexOf(SuperAssetLedgerAbility.MANAGE_ABILITIES) !== -1) {
allowSuperRevoke = true;
}
accountId = this._provider.encoder.normalizeAddress(accountId as string);
let bitAbilities = bigNumberify(0);
abilities.forEach((ability) => {
bitAbilities = bitAbilities.add(ability);
});
return revokeAbilities(this, accountId, bitAbilities, allowSuperRevoke);
}
export default async function(ledger: AssetLedger, accountId: string) {
return Promise.all(
[ SuperAssetLedgerAbility.MANAGE_ABILITIES,
GeneralAssetLedgerAbility.CREATE_ASSET,
GeneralAssetLedgerAbility.REVOKE_ASSET,
GeneralAssetLedgerAbility.TOGGLE_TRANSFERS,
GeneralAssetLedgerAbility.UPDATE_ASSET,
GeneralAssetLedgerAbility.ALLOW_CREATE_ASSET,
GeneralAssetLedgerAbility.UPDATE_URI_BASE,
GeneralAssetLedgerAbility.ALLOW_UPDATE_ASSET_IMPRINT,
].map(async (ability) => {
const attrs = {
to: ledger.id,
data: functionSignature + ledger.provider.encoder.encodeParameters(inputTypes, [accountId, ability]).substr(2),
};
const res = await ledger.provider.post({
method: 'eth_call',
params: [attrs, 'latest'],
});