difftreelog
fix after rebase
in: master
3 files changed
tests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth64 expect(adminList).to.be.like([{Substrate: newAdmin.address}]);64 expect(adminList).to.be.like([{Substrate: newAdmin.address}]);65 });65 });6667 itEth('Check adminlist', async ({helper, privateKey}) => {68 const owner = await helper.eth.createAccountWithBalance(donor);69 70 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');71 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);7273 const admin1 = helper.eth.createAccount();74 const admin2 = await privateKey('admin');75 await collectionEvm.methods.addCollectionAdmin(admin1).send();76 await collectionEvm.methods.addCollectionAdminSubstrate(admin2.addressRaw).send();7778 const adminListRpc = await helper.collection.getAdmins(collectionId);79 let adminListEth = await collectionEvm.methods.collectionAdmins().call();80 adminListEth = adminListEth.map((element: IEthCrossAccountId) => {81 return helper.address.convertCrossAccountFromEthCrossAcoount(element);82 });83 expect(adminListRpc).to.be.like(adminListEth);84 });668567 itEth('Verify owner or admin', async ({helper}) => {86 itEth('Verify owner or admin', async ({helper}) => {68 const owner = await helper.eth.createAccountWithBalance(donor);87 const owner = await helper.eth.createAccountWithBalance(donor);tests/src/eth/collectionProperties.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionProperties.test.ts
+++ b/tests/src/eth/collectionProperties.test.ts
@@ -14,10 +14,11 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-import {itEth, usingEthPlaygrounds, expect, EthUniqueHelper} from './util';
+import {itEth, usingEthPlaygrounds, expect, EthUniqueHelper, EthUniqueHelper} from './util';
import {Pallets} from '../util';
import {IProperty, ITokenPropertyPermission, TCollectionMode} from '../util/playgrounds/types';
import {IKeyringPair} from '@polkadot/types/types';
+import {TCollectionMode} from '../util/playgrounds/types';
describe('EVM collection properties', () => {
let donor: IKeyringPair;
tests/src/util/playgrounds/unique.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -2341,73 +2341,6 @@
return siblingPrefix + encodedParaId + suffix;
}
-
- /**
- * Encode key to substrate address
- * @param key key for encoding address
- * @param ss58Format prefix for encoding to the address of the corresponding network
- * @returns encoded substrate address
- */
- encodeSubstrateAddress (key: Uint8Array | string | bigint, ss58Format = 42): string {
- const u8a :Uint8Array = typeof key === 'string'
- ? hexToU8a(key)
- : typeof key === 'bigint'
- ? hexToU8a(key.toString(16))
- : key;
-
- if (ss58Format < 0 || ss58Format > 16383 || [46, 47].includes(ss58Format)) {
- throw new Error(`ss58Format is not valid, received ${typeof ss58Format} "${ss58Format}"`);
- }
-
- const allowedDecodedLengths = [1, 2, 4, 8, 32, 33];
- if (!allowedDecodedLengths.includes(u8a.length)) {
- throw new Error(`key length is not valid, received ${u8a.length}, valid values are ${allowedDecodedLengths.join(', ')}`);
- }
-
- const u8aPrefix = ss58Format < 64
- ? new Uint8Array([ss58Format])
- : new Uint8Array([
- ((ss58Format & 0xfc) >> 2) | 0x40,
- (ss58Format >> 8) | ((ss58Format & 0x03) << 6),
- ]);
-
- const input = u8aConcat(u8aPrefix, u8a);
-
- return base58Encode(u8aConcat(
- input,
- blake2AsU8a(input).subarray(0, [32, 33].includes(u8a.length) ? 2 : 1),
- ));
- }
-
- /**
- * Restore substrate address from bigint representation
- * @param number decimal representation of substrate address
- * @returns substrate address
- */
- restoreCrossAccountFromBigInt(number: bigint): TSubstrateAccount {
- if (this.helper.api === null) {
- throw 'Not connected';
- }
- const res = this.helper.api.registry.createType('AccountId', '0x' + number.toString(16).padStart(64, '0')).toJSON();
- if (res === undefined || res === null) {
- throw 'Restore address error';
- }
- return res.toString();
- }
-
- /**
- * Convert etherium cross account id to substrate cross account id
- * @param ethCrossAccount etherium cross account
- * @returns substrate cross account id
- */
- convertCrossAccountFromEthCrossAcoount(ethCrossAccount: IEthCrossAccountId): ICrossAccountId {
- if (ethCrossAccount.field_1 === '0') {
- return {Ethereum: ethCrossAccount.field_0.toLocaleLowerCase()};
- }
-
- const ss58 = this.restoreCrossAccountFromBigInt(BigInt(ethCrossAccount.field_1));
- return {Substrate: ss58};
- }
}
class StakingGroup extends HelperGroup<UniqueHelper> {