git.delta.rocks / unique-network / refs/commits / 447d08b0791f

difftreelog

fix misprints

Igor Kozyrev2022-04-21parent: #d3ed694.patch.diff
in: master

3 files changed

modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -36,9 +36,9 @@
 	SelfWeightOf, weights::WeightInfo,
 };
 
-fn error_unsupported_shema_version() -> Error {
+fn error_unsupported_schema_version() -> Error {
 	alloc::format!(
-		"Unsupported shema version! Support only {:?}",
+		"Unsupported schema version! Support only {:?}",
 		SchemaVersion::ImageURL
 	)
 	.as_str()
@@ -95,7 +95,7 @@
 	#[solidity(rename_selector = "tokenURI")]
 	fn token_uri(&self, token_id: uint256) -> Result<string> {
 		if !matches!(self.schema_version, SchemaVersion::ImageURL) {
-			return Err(error_unsupported_shema_version());
+			return Err(error_unsupported_schema_version());
 		}
 
 		self.consume_store_reads(1)?;
@@ -286,7 +286,7 @@
 		token_uri: string,
 	) -> Result<bool> {
 		if !matches!(self.schema_version, SchemaVersion::ImageURL) {
-			return Err(error_unsupported_shema_version());
+			return Err(error_unsupported_schema_version());
 		}
 
 		let caller = T::CrossAccountId::from_eth(caller);
@@ -431,7 +431,7 @@
 		tokens: Vec<(uint256, string)>,
 	) -> Result<bool> {
 		if !matches!(self.schema_version, SchemaVersion::ImageURL) {
-			return Err(error_unsupported_shema_version());
+			return Err(error_unsupported_schema_version());
 		}
 
 		let caller = T::CrossAccountId::from_eth(caller);
modifiedtests/src/eth/metadata.test.tsdiffbeforeafterboth
--- a/tests/src/eth/metadata.test.ts
+++ b/tests/src/eth/metadata.test.ts
@@ -68,10 +68,10 @@
 });
 
 describe('Support ERC721Metadata', () => {
-  itWeb3('Check unsupport ERC721Metadata ShemaVersion::Unique', async ({web3, api}) => {
+  itWeb3('Check unsupport ERC721Metadata SchemaVersion::Unique', async ({web3, api}) => {
     const collectionId = await createCollectionExpectSuccess({
       mode: {type: 'NFT'},
-      shemaVersion: 'Unique',
+      schemaVersion: 'Unique',
       name: 'some_name',
       tokenPrefix: 'some_prefix',
     });
@@ -98,7 +98,7 @@
       receiver,
       nextTokenId,
       'Test URI',
-    ).call({from: caller})).to.be.rejectedWith('Unsupported shema version! Support only ImageURL');
+    ).call({from: caller})).to.be.rejectedWith('Unsupported schema version! Support only ImageURL');
 
     await expect(contract.methods.mintBulkWithTokenURI(
       receiver,
@@ -107,10 +107,10 @@
         [+nextTokenId + 1, 'Test URI 1'],
         [+nextTokenId + 2, 'Test URI 2'],
       ],
-    ).call({from: caller})).to.be.rejectedWith('Unsupported shema version! Support only ImageURL');
+    ).call({from: caller})).to.be.rejectedWith('Unsupported schema version! Support only ImageURL');
   });
 
-  itWeb3('Check support ERC721Metadata for ShemaVersion::ImageURL', async ({web3, api}) => {
+  itWeb3('Check support ERC721Metadata for SchemaVersion::ImageURL', async ({web3, api}) => {
     const collectionId = await createCollectionExpectSuccess({
       mode: {type: 'NFT'},
       name: 'some_name',
modifiedtests/src/setConstOnChainSchema.test.tsdiffbeforeafterboth
3232
33let alice: IKeyringPair;33let alice: IKeyringPair;
34let bob: IKeyringPair;34let bob: IKeyringPair;
35let shema: any;35let schema: any;
36let largeShema: any;36let largeSchema: any;
3737
38before(async () => {38before(async () => {
39 await usingApi(async () => {39 await usingApi(async () => {
40 const keyring = new Keyring({type: 'sr25519'});40 const keyring = new Keyring({type: 'sr25519'});
41 alice = keyring.addFromUri('//Alice');41 alice = keyring.addFromUri('//Alice');
42 bob = keyring.addFromUri('//Bob');42 bob = keyring.addFromUri('//Bob');
43 shema = '0x31';43 schema = '0x31';
44 largeShema = new Array(1024 * 1024 + 10).fill(0xff);44 largeSchema = new Array(1024 * 1024 + 10).fill(0xff);
45 });45 });
46});46});
47describe('Integration Test ext. setConstOnChainSchema()', () => {47describe('Integration Test ext. setConstOnChainSchema()', () => {
51 const collectionId = await createCollectionExpectSuccess();51 const collectionId = await createCollectionExpectSuccess();
52 const collection = await queryCollectionExpectSuccess(api, collectionId);52 const collection = await queryCollectionExpectSuccess(api, collectionId);
53 expect(collection.owner.toString()).to.be.eq(alice.address);53 expect(collection.owner.toString()).to.be.eq(alice.address);
54 const setShema = api.tx.unique.setConstOnChainSchema(collectionId, shema);54 const setSchema = api.tx.unique.setConstOnChainSchema(collectionId, schema);
55 await submitTransactionAsync(alice, setShema);55 await submitTransactionAsync(alice, setSchema);
56 });56 });
57 });57 });
5858
62 const collection = await queryCollectionExpectSuccess(api, collectionId);62 const collection = await queryCollectionExpectSuccess(api, collectionId);
63 expect(collection.owner.toString()).to.be.eq(alice.address);63 expect(collection.owner.toString()).to.be.eq(alice.address);
64 await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);64 await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
65 const setShema = api.tx.unique.setConstOnChainSchema(collectionId, shema);65 const setSchema = api.tx.unique.setConstOnChainSchema(collectionId, schema);
66 await submitTransactionAsync(bob, setShema);66 await submitTransactionAsync(bob, setSchema);
67 });67 });
68 });68 });
6969
70 it('Checking collection data using the ConstOnChainSchema parameter', async () => {70 it('Checking collection data using the ConstOnChainSchema parameter', async () => {
71 await usingApi(async (api) => {71 await usingApi(async (api) => {
72 const collectionId = await createCollectionExpectSuccess();72 const collectionId = await createCollectionExpectSuccess();
73 const setShema = api.tx.unique.setConstOnChainSchema(collectionId, shema);73 const setSchema = api.tx.unique.setConstOnChainSchema(collectionId, schema);
74 await submitTransactionAsync(alice, setShema);74 await submitTransactionAsync(alice, setSchema);
75 const collection = await queryCollectionExpectSuccess(api, collectionId);75 const collection = await queryCollectionExpectSuccess(api, collectionId);
76 expect(collection.constOnChainSchema.toString()).to.be.eq(shema);76 expect(collection.constOnChainSchema.toString()).to.be.eq(schema);
77 });77 });
78 });78 });
79});79});
84 await usingApi(async (api) => {84 await usingApi(async (api) => {
85 // tslint:disable-next-line: radix85 // tslint:disable-next-line: radix
86 const collectionId = await getCreatedCollectionCount(api) + 1;86 const collectionId = await getCreatedCollectionCount(api) + 1;
87 const setShema = api.tx.unique.setConstOnChainSchema(collectionId, shema);87 const setSchema = api.tx.unique.setConstOnChainSchema(collectionId, schema);
88 await expect(submitTransactionExpectFailAsync(alice, setShema)).to.be.rejected;88 await expect(submitTransactionExpectFailAsync(alice, setSchema)).to.be.rejected;
89 });89 });
90 });90 });
9191
92 it('Set a previously deleted collection', async () => {92 it('Set a previously deleted collection', async () => {
93 await usingApi(async (api) => {93 await usingApi(async (api) => {
94 const collectionId = await createCollectionExpectSuccess();94 const collectionId = await createCollectionExpectSuccess();
95 await destroyCollectionExpectSuccess(collectionId);95 await destroyCollectionExpectSuccess(collectionId);
96 const setShema = api.tx.unique.setConstOnChainSchema(collectionId, shema);96 const setSchema = api.tx.unique.setConstOnChainSchema(collectionId, schema);
97 await expect(submitTransactionExpectFailAsync(alice, setShema)).to.be.rejected;97 await expect(submitTransactionExpectFailAsync(alice, setSchema)).to.be.rejected;
98 });98 });
99 });99 });
100100
101 it('Set invalid data in schema (size too large:> 1MB)', async () => {101 it('Set invalid data in schema (size too large:> 1MB)', async () => {
102 await usingApi(async (api) => {102 await usingApi(async (api) => {
103 const collectionId = await createCollectionExpectSuccess();103 const collectionId = await createCollectionExpectSuccess();
104 const setShema = api.tx.unique.setConstOnChainSchema(collectionId, largeShema);104 const setSchema = api.tx.unique.setConstOnChainSchema(collectionId, largeSchema);
105 await expect(submitTransactionExpectFailAsync(alice, setShema)).to.be.rejected;105 await expect(submitTransactionExpectFailAsync(alice, setSchema)).to.be.rejected;
106 });106 });
107 });107 });
108108
111 const collectionId = await createCollectionExpectSuccess();111 const collectionId = await createCollectionExpectSuccess();
112 const collection = await queryCollectionExpectSuccess(api, collectionId);112 const collection = await queryCollectionExpectSuccess(api, collectionId);
113 expect(collection.owner.toString()).to.be.eq(alice.address);113 expect(collection.owner.toString()).to.be.eq(alice.address);
114 const setShema = api.tx.unique.setConstOnChainSchema(collectionId, shema);114 const setSchema = api.tx.unique.setConstOnChainSchema(collectionId, schema);
115 await expect(submitTransactionExpectFailAsync(bob, setShema)).to.be.rejected;115 await expect(submitTransactionExpectFailAsync(bob, setSchema)).to.be.rejected;
116 });116 });
117 });117 });
118118