Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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'],
});
return ledger.provider.encoder.decodeParameters(outputTypes, res.result)[0] ? ability : -1;
}),
).then((abilities) => {
return abilities.filter((a) => a !== -1).sort((a, b) => a - b);
}).catch(() => {