1.23.4 • Published 4 months ago

@velocitycareerlabs/metadata-registration v1.23.4

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
4 months ago

Example of the usage on your localhost with the blockchain-dev container.

const { generateKeyPair } = require('@velocitycareerlabs/crypto');
const ethers = require('ethers');
/* eslint-disable no-console */
const { initRevocationRegistry } = require('../index');

const { privateKey } = generateKeyPair();
const wallet = new ethers.Wallet(privateKey);
const contractAddress = '0xf755e1ca66be12f177178e7ea696969e0a55bb64';
const gasLimit = 470000;

const revocationRegistry = initRevocationRegistry({
  privateKey,
  contractAddress,
  rpcUrl: 'http://localhost:8545',
  gasLimit,
});

(async () => {
  const listId = 42;
  const index = 24;
  try {
    await revocationRegistry.addWallet();
    await revocationRegistry.addRevocationList(listId);
    const initialStatus = await revocationRegistry.getRevokedStatus(
      `ethereum:${contractAddress}/getRevokedStatus?address=${wallet.address}&listId=${listId}&index=${index}`
    );
    console.info('initialStatus', initialStatus);
    await revocationRegistry.setRevokedStatus(listId, index);
    const updatedStatus = await revocationRegistry.getRevokedStatus(
      `ethereum:${contractAddress}/getRevokedStatus?address=${wallet.address}&listId=${listId}&index=${index}`
    );
    console.info('updatedStatus', updatedStatus);
  } catch (error) {
    console.error('Revocation Registry Error', error);
  }
})();

Output:

initialStatus 0
updatedStatus 1
1.23.4

4 months ago

1.23.3

5 months ago

1.23.2

6 months ago

1.23.1

7 months ago

1.23.0

7 months ago

1.22.0

8 months ago

1.21.0

10 months ago

1.21.1

10 months ago

1.19.1

1 year ago

1.20.0

12 months ago

1.19.0

1 year ago

1.18.1

1 year ago

1.18.0

1 year ago

1.17.1

1 year ago

1.17.0

1 year ago

1.16.1

1 year ago

1.16.0

2 years ago