How to use the @0xcert/scaffold.SuperAssetLedgerAbility.MANAGE_ABILITIES function in @0xcert/scaffold

To help you get started, we’ve selected a few @0xcert/scaffold examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 0xcert / framework / packages / 0xcert-ethereum-asset-ledger / src / core / ledger.ts View on Github external
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);
  }
github 0xcert / framework / packages / 0xcert-ethereum-asset-ledger / src / queries / get-abilities.ts View on Github external
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'],
      });