@anticxyz/access-mini
v1.0.6
Published
```ts const [alice, bob] = await hre.ethers.getSigners();
Downloads
24
Readme
Access Mini
const [alice, bob] = await hre.ethers.getSigners();
// Bootstrap the system
const accessBootstrapper: IAccessBootstrapper = new AccessBootstrapper();
const accessFactory: IAccessFactory =
await accessBootstrapper.createAccessFactory(alice);
// Create a new instance
const initData: InitData = {
to: alice.address, // Minting to this address
amount: 17041997, // Pre mints this amount
};
const access: IAccess = await accessFactory.clone(initData);
// Check if an account has access
const isAliceHasAccess: boolean = await access.hasAccess(alice.address);
console.log(`Is Alice has access? ${isAliceHasAccess}`);
// Check the amount of tickets left
const ticketsLeft: BigNumber = await access.ticketsLeft();
console.log(`Tickets left: ${ticketsLeft}`);
// Alice transfers a ticket to Bob
await access.transferTicket(bob.address);
// Load Access from a contract's address
const access2: IAccess = new Access(await access.getAddress(), alice);
console.log(`Access 2 address: ${await access2.getAddress()}`); // The same as access