git.delta.rocks / unique-network / refs/commits / 6c1065a66823

difftreelog

Code style and format

Greg Zaitsev2021-07-27parent: #793a35d.patch.diff
in: master

10 files changed

modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -946,7 +946,7 @@
 			let mut target_collection = Self::get_collection(collection_id)?;
 
 			Self::check_owner_permissions(&target_collection, &sender)?;
-			
+
 			target_collection.transfers_enabled = value;
 			Self::save_collection(target_collection);
 
@@ -1607,10 +1607,7 @@
 		);
 
 		// preliminary transfer check
-		ensure!(
-			collection.transfers_enabled,
-			Error::<T>::TransferNotAllowed
-		);
+		ensure!(collection.transfers_enabled, Error::<T>::TransferNotAllowed);
 
 		Ok(())
 	}
modifiedpallets/nft/src/tests.rsdiffbeforeafterboth
--- a/pallets/nft/src/tests.rs
+++ b/pallets/nft/src/tests.rs
@@ -2387,7 +2387,9 @@
 		let origin1 = Origin::signed(1);
 
 		let collection_id = create_test_collection(&CollectionMode::NFT, 1);
-		assert_ok!(TemplateModule::set_transfers_enabled_flag(origin1, 1, false));
+		assert_ok!(TemplateModule::set_transfers_enabled_flag(
+			origin1, 1, false
+		));
 
 		let data = default_nft_data();
 		create_test_item(collection_id, &data.into());
modifiedruntime/src/lib.rsdiffbeforeafterboth
--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -154,7 +154,7 @@
 	transaction_version: 1,
 };
 
-pub const MILLISECS_PER_BLOCK: u64 = 12000;
+pub const MILLISECS_PER_BLOCK: u64 = 1200;
 
 pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
 
modifiedtests/src/change-collection-owner.test.tsdiffbeforeafterboth
--- a/tests/src/change-collection-owner.test.ts
+++ b/tests/src/change-collection-owner.test.ts
@@ -7,7 +7,7 @@
 import chaiAsPromised from 'chai-as-promised';
 import privateKey from './substrate/privateKey';
 import { default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync } from './substrate/substrate-api';
-import { createCollectionExpectSuccess, normalizeAccountId } from './util/helpers';
+import { createCollectionExpectSuccess } from './util/helpers';
 
 chai.use(chaiAsPromised);
 const expect = chai.expect;
modifiedtests/src/enableDisableTransfer.test.tsdiffbeforeafterboth
before · tests/src/enableDisableTransfer.test.ts
1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import chai from 'chai';7import chaiAsPromised from 'chai-as-promised';8import privateKey from './substrate/privateKey';9import usingApi from './substrate/substrate-api';10import {11  createItemExpectSuccess,12  createCollectionExpectSuccess,13  transferExpectSuccess,14  transferExpectFailure,15  setTransferFlagExpectSuccess16} from './util/helpers';1718chai.use(chaiAsPromised);1920describe('Enable/Disable Transfers', () => {21  it('User can transfer token with enabled transfer flag', async () => {22    await usingApi(async () => {23      const Alice = privateKey('//Alice');24      const Bob = privateKey('//Bob');25      // nft26      const nftCollectionId = await createCollectionExpectSuccess();27      const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');2829      // explicitely set transfer flag30      await setTransferFlagExpectSuccess(Alice, nftCollectionId, true);3132      await transferExpectSuccess(nftCollectionId, newNftTokenId, Alice, Bob, 1);33    });34  });3536  it('User can\'n transfer token with disabled transfer flag', async () => {37    await usingApi(async () => {38      const Alice = privateKey('//Alice');39      const Bob = privateKey('//Bob');40      // nft41      const nftCollectionId = await createCollectionExpectSuccess();42      const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');4344      // explicitely set transfer flag45      await setTransferFlagExpectSuccess(Alice, nftCollectionId, false);4647      await transferExpectFailure(nftCollectionId, newNftTokenId, Alice, Bob, 1);48    });49  });50});
after · tests/src/enableDisableTransfer.test.ts
1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import chai from 'chai';7import chaiAsPromised from 'chai-as-promised';8import privateKey from './substrate/privateKey';9import usingApi from './substrate/substrate-api';10import {11  createItemExpectSuccess,12  createCollectionExpectSuccess,13  transferExpectSuccess,14  transferExpectFailure,15  setTransferFlagExpectSuccess,16} from './util/helpers';1718chai.use(chaiAsPromised);1920describe('Enable/Disable Transfers', () => {21  it('User can transfer token with enabled transfer flag', async () => {22    await usingApi(async () => {23      const Alice = privateKey('//Alice');24      const Bob = privateKey('//Bob');25      // nft26      const nftCollectionId = await createCollectionExpectSuccess();27      const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');2829      // explicitely set transfer flag30      await setTransferFlagExpectSuccess(Alice, nftCollectionId, true);3132      await transferExpectSuccess(nftCollectionId, newNftTokenId, Alice, Bob, 1);33    });34  });3536  it('User can\'n transfer token with disabled transfer flag', async () => {37    await usingApi(async () => {38      const Alice = privateKey('//Alice');39      const Bob = privateKey('//Bob');40      // nft41      const nftCollectionId = await createCollectionExpectSuccess();42      const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');4344      // explicitely set transfer flag45      await setTransferFlagExpectSuccess(Alice, nftCollectionId, false);4647      await transferExpectFailure(nftCollectionId, newNftTokenId, Alice, Bob, 1);48    });49  });50});
modifiedtests/src/pallet-presence.test.tsdiffbeforeafterboth
--- a/tests/src/pallet-presence.test.ts
+++ b/tests/src/pallet-presence.test.ts
@@ -32,14 +32,14 @@
   'nft',
   'scheduler',
   'nftpayment',
-  'charging'
+  'charging',
 ];
 
 // Pallets that depend on consensus and governance configuration
 const consensusPallets = [
   'sudo',
   'aura',
-  'auraext'
+  'auraext',
 ];
 
 describe('Pallet presence', () => {
modifiedtests/src/setConstOnChainSchema.test.tsdiffbeforeafterboth
--- a/tests/src/setConstOnChainSchema.test.ts
+++ b/tests/src/setConstOnChainSchema.test.ts
@@ -11,7 +11,6 @@
 import {
   createCollectionExpectSuccess,
   destroyCollectionExpectSuccess,
-  normalizeAccountId,
 } from './util/helpers';
 
 chai.use(chaiAsPromised);
modifiedtests/src/setVariableOnChainSchema.test.tsdiffbeforeafterboth
--- a/tests/src/setVariableOnChainSchema.test.ts
+++ b/tests/src/setVariableOnChainSchema.test.ts
@@ -11,7 +11,6 @@
 import {
   createCollectionExpectSuccess,
   destroyCollectionExpectSuccess,
-  normalizeAccountId,
 } from './util/helpers';
 
 chai.use(chaiAsPromised);
modifiedtests/src/substrate/substrate-api.tsdiffbeforeafterboth
--- a/tests/src/substrate/substrate-api.ts
+++ b/tests/src/substrate/substrate-api.ts
@@ -48,12 +48,12 @@
   console.warn = outFn;
 
   try {
-   await promisifySubstrate(api, async () => {
+    await promisifySubstrate(api, async () => {
       if (api) {
         await api.isReadyOrError;
         result = await action(api);
       }
-   })();
+    })();
   } finally {
     await api.disconnect();
     console.error = consoleErr;
modifiedtests/src/util/helpers.tsdiffbeforeafterboth
--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -555,7 +555,7 @@
   });
 }
 
-export async function toggleContractWhitelistExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, value: boolean = true) {
+export async function toggleContractWhitelistExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, value = true) {
   await usingApi(async (api) => {
     const tx = api.tx.nft.toggleContractWhiteList(contractAddress, value);
     const events = await submitTransactionAsync(sender, tx);
@@ -761,7 +761,7 @@
   recipient: IKeyringPair,
   value: number | bigint = 1,
   blockTimeMs: number,
-  blockSchedule: number
+  blockSchedule: number,
 ) {
   await usingApi(async (api: ApiPromise) => {
     const blockNumber: number | undefined = await getBlockNumber(api);