difftreelog
add collection allow-list methods to playgrounds
in: master
1 file changed
tests/src/util/playgrounds/unique.tsdiffbeforeafterboth524 return normalized;524 return normalized;525 }525 }526527 /**528 * Get the normalized addresses added to the collection allow-list.529 * @param collectionId ID of collection530 * @example await getAllowList(1)531 * @returns array of allow-listed addresses532 */533 async getAllowList(collectionId: number): Promise<ICrossAccountId[]> {534 const normalized = [];535 const allowListed = (await this.helper.callRpc('api.rpc.unique.allowlist', [collectionId])).toHuman();536 for (const address of allowListed) {537 if (address.Substrate) normalized.push({Substrate: this.helper.address.normalizeSubstrate(address.Substrate)});538 else normalized.push(address);539 }540 return normalized;541 }526542527 /**543 /**528 * Get the effective limits of the collection instead of null for default values544 * Get the effective limits of the collection instead of null for default values667 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'CollectionAdminAdded', label);683 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'CollectionAdminAdded', label);668 }684 }685686 /**687 * Adds an address to allow list 688 * @param signer keyring of signer689 * @param collectionId ID of collection690 * @param addressObj address to add to the allow list691 * @param label extra label for log692 * @returns ```true``` if extrinsic success, otherwise ```false```693 */694 async addToAllowList(signer: TSigner, collectionId: number, addressObj: ICrossAccountId, label?: string): Promise<boolean> {695 if(typeof label === 'undefined') label = `collection #${collectionId}`;696 const result = await this.helper.executeExtrinsic(697 signer,698 'api.tx.unique.addToAllowList', [collectionId, addressObj],699 true, `Unable to add address to allow list for ${label}`,700 );701702 return this.helper.util.findCollectionInEvents(result.result.events, collectionId, 'unique', 'AllowListAddressAdded');703 }669704670 /**705 /**671 * Removes a collection administrator.706 * Removes a collection administrator.1992 return await this.helper.collection.getAdmins(this.collectionId);2027 return await this.helper.collection.getAdmins(this.collectionId);1993 }2028 }20292030 async getAllowList() {2031 return await this.helper.collection.getAllowList(this.collectionId);2032 }199420331995 async getEffectiveLimits() {2034 async getEffectiveLimits() {1996 return await this.helper.collection.getEffectiveLimits(this.collectionId);2035 return await this.helper.collection.getEffectiveLimits(this.collectionId);2016 return await this.helper.collection.addAdmin(signer, this.collectionId, adminAddressObj, label);2055 return await this.helper.collection.addAdmin(signer, this.collectionId, adminAddressObj, label);2017 }2056 }20572058 async addToAllowList(signer: TSigner, addressObj: ICrossAccountId, label?: string) {2059 return await this.helper.collection.addToAllowList(signer, this.collectionId, addressObj, label);2060 }201820612019 async removeAdmin(signer: TSigner, adminAddressObj: ICrossAccountId, label?: string) {2062 async removeAdmin(signer: TSigner, adminAddressObj: ICrossAccountId, label?: string) {2020 return await this.helper.collection.removeAdmin(signer, this.collectionId, adminAddressObj, label);2063 return await this.helper.collection.removeAdmin(signer, this.collectionId, adminAddressObj, label);