difftreelog
Apply suggestions from code review
in: master
7 files changed
pallets/fungible/src/common.rsdiffbeforeafterboth364364365 /// Returns 10 tokens owners in no particular order.365 /// Returns 10 tokens owners in no particular order.366 fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId> {366 fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId> {367 <Pallet<T>>::token_owners(self.id, token).unwrap_or_else(|| vec![])367 <Pallet<T>>::token_owners(self.id, token).unwrap_or_default()368 }368 }369369370 fn token_property(&self, _token_id: TokenId, _key: &PropertyKey) -> Option<PropertyValue> {370 fn token_property(&self, _token_id: TokenId, _key: &PropertyKey) -> Option<PropertyValue> {pallets/fungible/src/lib.rsdiffbeforeafterboth629 .take(10)629 .take(10)630 .collect();630 .collect();631631632 if res.len() == 0 {632 if res.is_empty() {633 None633 None634 } else {634 } else {635 Some(res)635 Some(res)pallets/refungible/src/common.rsdiffbeforeafterboth440440441 /// Returns 10 token in no particular order.441 /// Returns 10 token in no particular order.442 fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId> {442 fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId> {443 <Pallet<T>>::token_owners(self.id, token).unwrap_or_else(|| vec![])443 <Pallet<T>>::token_owners(self.id, token).unwrap_or_default()444 }444 }445445446 fn token_property(&self, _token_id: TokenId, _key: &PropertyKey) -> Option<PropertyValue> {446 fn token_property(&self, _token_id: TokenId, _key: &PropertyKey) -> Option<PropertyValue> {pallets/refungible/src/lib.rsdiffbeforeafterboth1150 .take(10)1150 .take(10)1151 .collect();1151 .collect();115211521153 if res.len() == 0 {1153 if res.is_empty() {1154 None1154 None1155 } else {1155 } else {1156 Some(res)1156 Some(res)primitives/rpc/src/lib.rsdiffbeforeafterboth81 fn next_sponsored(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<Option<u64>>;81 fn next_sponsored(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<Option<u64>>;82 fn effective_collection_limits(collection_id: CollectionId) -> Result<Option<CollectionLimits>>;82 fn effective_collection_limits(collection_id: CollectionId) -> Result<Option<CollectionLimits>>;83 fn total_pieces(collection_id: CollectionId, token_id: TokenId) -> Result<Option<u128>>;83 fn total_pieces(collection_id: CollectionId, token_id: TokenId) -> Result<Option<u128>>;84 fn token_owners(collection: CollectionId, token: TokenId) -> Result<Vec::<CrossAccountId>>;84 fn token_owners(collection: CollectionId, token: TokenId) -> Result<Vec<CrossAccountId>>;85 }85 }86}86}8787tests/src/refungible.test.tsdiffbeforeafterboth100 // What to expect100 // What to expect101 // tslint:disable-next-line:no-unused-expression101 // tslint:disable-next-line:no-unused-expression102 expect(ids).to.deep.include.members([aliceID, ethAcc, bobId, ...facelessCrowd]);102 expect(ids).to.deep.include.members([aliceID, ethAcc, bobId, ...facelessCrowd]);103 expect(owners.length == 10).to.be.true;103 expect(owners.length).to.be.equal(10);104 104 105 const eleven = privateKeyWrapper('11');105 const eleven = privateKeyWrapper('11');106 expect(await transfer(api, collectionId, aliceTokenId, alice, eleven, 10n)).to.be.true;106 expect(await transfer(api, collectionId, aliceTokenId, alice, eleven, 10n)).to.be.true;tests/src/rpc.test.tsdiffbeforeafterboth23 });23 });24 });24 });25 25 26 it('RPC method tokenOnewrs for fungible collection and token', async () => {26 it('RPC method tokenOwners for fungible collection and token', async () => {27 await usingApi(async (api, privateKeyWrapper) => {27 await usingApi(async (api, privateKeyWrapper) => {28 const ethAcc = {Ethereum: '0x67fb3503a61b284dc83fa96dceec4192db47dc7c'};28 const ethAcc = {Ethereum: '0x67fb3503a61b284dc83fa96dceec4192db47dc7c'};29 const facelessCrowd = Array.from(Array(7).keys()).map(i => normalizeAccountId(privateKeyWrapper(i.toString())));29 const facelessCrowd = Array.from(Array(7).keys()).map(i => normalizeAccountId(privateKeyWrapper(i.toString())));