difftreelog
fix(tests) keyring/logs/decimals parsing/comments
in: master
1 file changed
tests/src/util/helpers.tsdiffbeforeafterboth108 const dotPos = numberStr.length - decimals;108 const dotPos = numberStr.length - decimals;109109110 if (dotPos <= 0) {110 if (dotPos <= 0) {111 return '0.' + numberStr;111 return '0.' + '0'.repeat(Math.abs(dotPos)) + numberStr;112 } else {112 } else {113 const intPart = numberStr.substring(0, dotPos);113 const intPart = numberStr.substring(0, dotPos);114 const fractPart = numberStr.substring(dotPos);114 const fractPart = numberStr.substring(dotPos);111511151116export async function paraSiblingSovereignAccount(paraid: number): Promise<string> {1116export async function paraSiblingSovereignAccount(paraid: number): Promise<string> {1117 return usingApi(async api => {1117 return usingApi(async api => {1118 // We are getting a *sibling* parachain sovereign account,1119 // so we need a sibling prefix: encoded(b"sibl") == 0x7369626c1118 const siblingPrefix = '0x7369626c';1120 const siblingPrefix = '0x7369626c';11211119 const encodedParaId = api.createType('u32', paraid).toHex(true).substring(2);1122 const encodedParaId = api.createType('u32', paraid).toHex(true).substring(2);1805 });1808 });180618091807 if (neededEvent) {1810 if (neededEvent) {1808 console.log(`Event \`${eventIdStr}\` is found`);18091810 unsubscribe();1811 unsubscribe();1811 resolve(neededEvent);1812 resolve(neededEvent);185218531853let accountSeed = 10000;1854let accountSeed = 10000;18541855const keyringEth = new Keyring({type: 'ethereum'});1856const keyringEd25519 = new Keyring({type: 'ed25519'});1857const keyringSr25519 = new Keyring({type: 'sr25519'});185818551859export function generateKeyringPair(type: 'ethereum' | 'sr25519' | 'ed25519' = 'sr25519') {1856export function generateKeyringPair(keyring: Keyring) {1860 const privateKey = `0xDEADBEEF${(accountSeed++).toString(16).padStart(56, '0')}`;1857 const privateKey = `0xDEADBEEF${(accountSeed++).toString(16).padStart(56, '0')}`;1861 if (type == 'sr25519') {1862 return keyringSr25519.addFromUri(privateKey);1863 } else if (type == 'ed25519') {1864 return keyringEd25519.addFromUri(privateKey);1865 }1866 return keyringEth.addFromUri(privateKey);1858 return keyring.addFromUri(privateKey);1867}1859}18681860