git.delta.rocks / unique-network / refs/commits / fe6b71bedc93

difftreelog

CORE-302 Fix shema => schema

Trubnikov Sergey2022-04-27parent: #4647586.patch.diff
in: master

6 files changed

modifiedpallets/evm-collection/src/eth.rsdiffbeforeafterboth
--- a/pallets/evm-collection/src/eth.rs
+++ b/pallets/evm-collection/src/eth.rs
@@ -130,20 +130,20 @@
 		Ok(())
 	}
 
-	fn set_offchain_shema(
+	fn set_offchain_schema(
 		&self,
 		caller: caller,
 		collection_address: address,
-		shema: string,
+		schema: string,
 	) -> Result<void> {
 		let mut collection = collection_from_address(collection_address, &self.0)?;
 		check_is_owner(caller, &collection)?;
 
-		let shema = shema
+		let schema = schema
 			.into_bytes()
 			.try_into()
 			.map_err(|_| error_feild_too_long(stringify!(shema), OFFCHAIN_SCHEMA_LIMIT))?;
-		// collection.offchain_schema = shema;
+		// collection.offchain_schema = schema;
 		collection.save().map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
 		Ok(())
 	}
modifiedpallets/evm-collection/src/stubs/Collection.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/evm-collection/src/stubs/Collection.soldiffbeforeafterboth
--- a/pallets/evm-collection/src/stubs/Collection.sol
+++ b/pallets/evm-collection/src/stubs/Collection.sol
@@ -21,7 +21,7 @@
 	}
 }
 
-// Selector: 037b69c8
+// Selector: f83ad95b
 contract Collection is Dummy, ERC165 {
 	// Selector: create721Collection(string,string,string) 951c0151
 	function create721Collection(
@@ -55,8 +55,8 @@
 		dummy;
 	}
 
-	// Selector: setOffchainShema(address,string) d7dc2de3
-	function setOffchainShema(address collectionAddress, string memory shema)
+	// Selector: setOffchainSchema(address,string) 2c9d9d70
+	function setOffchainSchema(address collectionAddress, string memory shema)
 		public
 		view
 	{
modifiedtests/src/eth/api/Collection.soldiffbeforeafterboth
12 function supportsInterface(bytes4 interfaceID) external view returns (bool);12 function supportsInterface(bytes4 interfaceID) external view returns (bool);
13}13}
1414
15// Selector: 037b69c815// Selector: f83ad95b
16interface Collection is Dummy, ERC165 {16interface Collection is Dummy, ERC165 {
17 // Selector: create721Collection(string,string,string) 951c015117 // Selector: create721Collection(string,string,string) 951c0151
18 function create721Collection(18 function create721Collection(
29 // Selector: confirmSponsorship(address) abc0000129 // Selector: confirmSponsorship(address) abc00001
30 function confirmSponsorship(address collectionAddress) external view;30 function confirmSponsorship(address collectionAddress) external view;
3131
32 // Selector: setOffchainShema(address,string) d7dc2de332 // Selector: setOffchainSchema(address,string) 2c9d9d70
33 function setOffchainShema(address collectionAddress, string memory shema)33 function setOffchainSchema(address collectionAddress, string memory shema)
34 external34 external
35 view;35 view;
3636
modifiedtests/src/eth/collectionAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/collectionAbi.json
+++ b/tests/src/eth/collectionAbi.json
@@ -60,7 +60,7 @@
       },
       { "internalType": "string", "name": "shema", "type": "string" }
     ],
-    "name": "setOffchainShema",
+    "name": "setOffchainSchema",
     "outputs": [],
     "stateMutability": "view",
     "type": "function"
modifiedtests/src/eth/createCollection.test.tsdiffbeforeafterboth
--- a/tests/src/eth/createCollection.test.ts
+++ b/tests/src/eth/createCollection.test.ts
@@ -79,15 +79,15 @@
     expect(collection.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));
   });
   
-  itWeb3('Set offchain shema', async ({api, web3}) => {
+  itWeb3('Set offchain schema', async ({api, web3}) => {
     const owner = await createEthAccountWithBalance(api, web3);
     const helper = collectionHelper(web3, owner);
-    let result = await helper.methods.create721Collection('Shema collection', '2', '2').send();
+    let result = await helper.methods.create721Collection('Schema collection', '2', '2').send();
     const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
-    const shema = 'Some shema';
-    result = await helper.methods.setOffchainShema(collectionIdAddress, shema).send();
+    const schema = 'Some schema';
+    result = await helper.methods.setOffchainSchema(collectionIdAddress, schema).send();
     const collection = (await getDetailedCollectionInfo(api, collectionId))!;
-    expect(collection.offchainSchema.toHuman()).to.be.eq(shema);
+    expect(collection.offchainSchema.toHuman()).to.be.eq(schema);
   });
   
   itWeb3('Set variable on chain schema', async ({api, web3}) => {
@@ -106,10 +106,10 @@
     const helper = collectionHelper(web3, owner);
     let result = await helper.methods.create721Collection('Const collection', '4', '4').send();
     const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
-    const constShema = 'Some const';
-    result = await helper.methods.setConstOnChainSchema(collectionIdAddress, constShema).send();
+    const constSchema = 'Some const';
+    result = await helper.methods.setConstOnChainSchema(collectionIdAddress, constSchema).send();
     const collection = (await getDetailedCollectionInfo(api, collectionId))!;
-    expect(collection.constOnChainSchema.toHuman()).to.be.eq(constShema);
+    expect(collection.constOnChainSchema.toHuman()).to.be.eq(constSchema);
   });
 
   itWeb3('Set limits', async ({api, web3}) => {
@@ -178,7 +178,7 @@
     expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');
 
     // TODO: this wont work right now, need release 919000 first
-    // await helper.methods.setOffchainShema(collectionIdAddress, 'https://offchain-service.local/token-info/{id}').send();
+    // await helper.methods.setOffchainSchema(collectionIdAddress, 'https://offchain-service.local/token-info/{id}').send();
     // const tokenUri = await contract.methods.tokenURI(nextTokenId).call();
     // expect(tokenUri).to.be.equal(`https://offchain-service.local/token-info/${nextTokenId}`);
   });
@@ -248,9 +248,9 @@
         .call()).to.be.rejectedWith(EXPECTED_ERROR);
     }
     {
-      const shema = 'Some shema';
+      const schema = 'Some schema';
       await expect(helper.methods
-        .setOffchainShema(collectionAddressWithBadPrefix, shema)
+        .setOffchainSchema(collectionAddressWithBadPrefix, schema)
         .call()).to.be.rejectedWith(EXPECTED_ERROR);
     }
     {
@@ -293,9 +293,9 @@
         .call()).to.be.rejectedWith('Caller is not set as sponsor');
     }
     {
-      const shema = 'Some shema';
+      const schema = 'Some schema';
       await expect(helperFromNotOwner.methods
-        .setOffchainShema(collectionIdAddress, shema)
+        .setOffchainSchema(collectionIdAddress, schema)
         .call()).to.be.rejectedWith(EXPECTED_ERROR);
     }
     {
@@ -318,22 +318,22 @@
     }
   });
 
-  itWeb3('(!negative test!) Set offchain shema (length limit)', async ({api, web3}) => {
+  itWeb3('(!negative test!) Set offchain schema (length limit)', async ({api, web3}) => {
     const owner = await createEthAccountWithBalance(api, web3);
     const helper = collectionHelper(web3, owner);
-    const result = await helper.methods.create721Collection('Shema collection', 'A', 'A').send();
+    const result = await helper.methods.create721Collection('Schema collection', 'A', 'A').send();
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const OFFCHAIN_SCHEMA_LIMIT = 8192;
-    const shema = 'A'.repeat(OFFCHAIN_SCHEMA_LIMIT + 1);
+    const schema = 'A'.repeat(OFFCHAIN_SCHEMA_LIMIT + 1);
     await expect(helper.methods
-      .setOffchainShema(collectionIdAddress, shema)
-      .call()).to.be.rejectedWith('shema is too long. Max length is ' + OFFCHAIN_SCHEMA_LIMIT);
+      .setOffchainSchema(collectionIdAddress, schema)
+      .call()).to.be.rejectedWith('schema is too long. Max length is ' + OFFCHAIN_SCHEMA_LIMIT);
   });
 
   itWeb3('(!negative test!) Set variable on chain schema (length limit)', async ({api, web3}) => {
     const owner = await createEthAccountWithBalance(api, web3);
     const helper = collectionHelper(web3, owner);
-    const result = await helper.methods.create721Collection('Shema collection', 'A', 'A').send();
+    const result = await helper.methods.create721Collection('Schema collection', 'A', 'A').send();
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const VARIABLE_ON_CHAIN_SCHEMA_LIMIT = 8192;
     const variable = 'A'.repeat(VARIABLE_ON_CHAIN_SCHEMA_LIMIT + 1);
@@ -345,7 +345,7 @@
   itWeb3('(!negative test!) Set const on chain schema (length limit)', async ({api, web3}) => {
     const owner = await createEthAccountWithBalance(api, web3);
     const helper = collectionHelper(web3, owner);
-    const result = await helper.methods.create721Collection('Shema collection', 'A', 'A').send();
+    const result = await helper.methods.create721Collection('Schema collection', 'A', 'A').send();
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const CONST_ON_CHAIN_SCHEMA_LIMIT = 32768;
     const constData = 'A'.repeat(CONST_ON_CHAIN_SCHEMA_LIMIT + 1);
@@ -357,7 +357,7 @@
   itWeb3('(!negative test!) Set limits', async ({api, web3}) => {
     const owner = await createEthAccountWithBalance(api, web3);
     const helper = collectionHelper(web3, owner);
-    const result = await helper.methods.create721Collection('Shema collection', 'A', 'A').send();
+    const result = await helper.methods.create721Collection('Schema collection', 'A', 'A').send();
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const badJson = '{accountTokenOwnershipLimit: 1000}';
     await expect(helper.methods