git.delta.rocks / unique-network / refs/commits / 2e2d3bf50283

difftreelog

Merge branch 'develop' into feature/transferfromtests

Greg Zaitsev2021-02-09parents: #0954b32 #337b8d4.patch.diff
in: master

4 files changed

modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
185185
186 // Timeouts for item types in passed blocks186 // Timeouts for item types in passed blocks
187 pub sponsor_transfer_timeout: u32,187 pub sponsor_transfer_timeout: u32,
188 pub owner_can_transfer: bool,
189 pub owner_can_destroy: bool,
188}190}
189191
190impl Default for CollectionLimits {192impl Default for CollectionLimits {
193 account_token_ownership_limit: 10_000_000, 195 account_token_ownership_limit: 10_000_000,
194 token_limit: u32::max_value(),196 token_limit: u32::max_value(),
195 sponsored_data_size: u32::max_value(), 197 sponsored_data_size: u32::max_value(),
196 sponsor_transfer_timeout: 14400 }198 sponsor_transfer_timeout: 14400,
199 owner_can_transfer: true,
200 owner_can_destroy: true
201 }
197 }202 }
198}203}
modifiedruntime_types.jsondiffbeforeafterboth
95 "AccountTokenOwnershipLimit": "u32",95 "AccountTokenOwnershipLimit": "u32",
96 "SponsoredMintSize": "u32",96 "SponsoredMintSize": "u32",
97 "TokenLimit": "u32",97 "TokenLimit": "u32",
98 "SponsorTimeout": "u32"98 "SponsorTimeout": "u32",
99 "OwnerCanTransfer": "bool",
100 "OwnerCanDestroy": "bool"
99 }101 }
100}102}
addedtests/src/removeFromContractWhiteList.test.tsdiffbeforeafterboth

no changes

modifiedtests/src/util/helpers.tsdiffbeforeafterboth
410 });410 });
411}411}
412
413export async function toggleContractWhitelistExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, enabled: boolean) {
414 await usingApi(async (api) => {
415 const tx = api.tx.nft.toggleContractWhiteList(contractAddress, true);
416 const events = await submitTransactionAsync(sender, tx);
417 const result = getGenericResult(events);
418
419 expect(result.success).to.be.true;
420 });
421}
422
423export async function isWhitelistedInContract(contractAddress: AccountId | string, user: string) {
424 let whitelisted: boolean = false;
425 await usingApi(async (api) => {
426 whitelisted = (await api.query.nft.contractWhiteList(contractAddress, user)).toJSON() as boolean;
427 });
428 return whitelisted;
429}
430
431export async function addToContractWhiteListExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, user: string) {
432 await usingApi(async (api) => {
433 const tx = api.tx.nft.addToContractWhiteList(contractAddress, user);
434 const events = await submitTransactionAsync(sender, tx);
435 const result = getGenericResult(events);
436
437 expect(result.success).to.be.true;
438 });
439}
440
441export async function removeFromContractWhiteListExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, user: string) {
442 await usingApi(async (api) => {
443 const tx = api.tx.nft.removeFromContractWhiteList(contractAddress, user);
444 const events = await submitTransactionAsync(sender, tx);
445 const result = getGenericResult(events);
446
447 expect(result.success).to.be.true;
448 });
449}
450
451export async function removeFromContractWhiteListExpectFailure(sender: IKeyringPair, contractAddress: AccountId | string, user: string) {
452 await usingApi(async (api) => {
453 const tx = api.tx.nft.removeFromContractWhiteList(contractAddress, user);
454 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;
455 const result = getGenericResult(events);
456
457 expect(result.success).to.be.false;
458 });
459}
412460
413export async function setVariableMetaDataExpectSuccess(sender: IKeyringPair, collectionId: number, itemId: number, data: number[]) {461export async function setVariableMetaDataExpectSuccess(sender: IKeyringPair, collectionId: number, itemId: number, data: number[]) {
414 await usingApi(async (api) => {462 await usingApi(async (api) => {