difftreelog
tests: contract whitelist helpers
in: master
1 file changed
tests/src/util/helpers.tsdiffbeforeafterboth424 });424 });425}425}426427export async function toggleContractWhitelistExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, enabled: boolean) {428 await usingApi(async (api) => {429 const tx = api.tx.nft.toggleContractWhiteList(contractAddress, true);430 const events = await submitTransactionAsync(sender, tx);431 const result = getGenericResult(events);432433 expect(result.success).to.be.true;434 });435}436437export async function isWhitelistedInContract(contractAddress: AccountId | string, user: string) {438 let whitelisted: boolean = false;439 await usingApi(async (api) => {440 whitelisted = (await api.query.nft.contractWhiteList(contractAddress, user)).toJSON() as boolean;441 });442 return whitelisted;443}444445export async function addToContractWhiteListExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, user: string) {446 await usingApi(async (api) => {447 const tx = api.tx.nft.addToContractWhiteList(contractAddress, user);448 const events = await submitTransactionAsync(sender, tx);449 const result = getGenericResult(events);450451 expect(result.success).to.be.true;452 });453}454455export async function removeFromContractWhiteListExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, user: string) {456 await usingApi(async (api) => {457 const tx = api.tx.nft.removeFromContractWhiteList(contractAddress, user);458 const events = await submitTransactionAsync(sender, tx);459 const result = getGenericResult(events);460461 expect(result.success).to.be.true;462 });463}464465export async function removeFromContractWhiteListExpectFailure(sender: IKeyringPair, contractAddress: AccountId | string, user: string) {466 await usingApi(async (api) => {467 const tx = api.tx.nft.removeFromContractWhiteList(contractAddress, user);468 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;469 const result = getGenericResult(events);470471 expect(result.success).to.be.false;472 });473}426474427export async function setVariableMetaDataExpectSuccess(sender: IKeyringPair, collectionId: number, itemId: number, data: number[]) {475export async function setVariableMetaDataExpectSuccess(sender: IKeyringPair, collectionId: number, itemId: number, data: number[]) {428 await usingApi(async (api) => {476 await usingApi(async (api) => {