Update keyring, new ss58 checksums (#812)
This commit is contained in:
@@ -48,7 +48,7 @@ describe.skip('derive e2e', () => {
|
||||
// these only work on localhost, not the poc-3 URL
|
||||
// (and it is assuming it sent at least 1 tx)
|
||||
describe('accounts', () => {
|
||||
const ID = '5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ';
|
||||
const ID = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
|
||||
const IX = 'F7Gh';
|
||||
|
||||
it('looks up id & index from id', async (done) => {
|
||||
|
||||
@@ -36,6 +36,6 @@
|
||||
"@polkadot/rpc-rx": "^0.53.0-beta.1",
|
||||
"@polkadot/storage": "^0.53.0-beta.1",
|
||||
"@polkadot/types": "^0.53.0-beta.1",
|
||||
"@polkadot/util-crypto": "^0.42.1"
|
||||
"@polkadot/util-crypto": "^0.43.0-beta.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,6 @@
|
||||
"@polkadot/jsonrpc": "^0.53.0-beta.1",
|
||||
"@polkadot/rpc-provider": "^0.53.0-beta.1",
|
||||
"@polkadot/types": "^0.53.0-beta.1",
|
||||
"@polkadot/util": "^0.42.1"
|
||||
"@polkadot/util": "^0.43.0-beta.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@ import storage from '@polkadot/storage/static';
|
||||
|
||||
import Api from '.';
|
||||
|
||||
const ADDR_ONE = '5EhmTa7fL6SdjgKXo9g6hetR6nHnRAmrtisoGFWEESjzECtY';
|
||||
const ADDR_TWO = '5FjbQAHSptRU4Q7Py6zDsRnE7UkpZikJVg5nm1tmu3WuZXKd';
|
||||
const ADDR_ONE = '5DkQbYAExs3M2sZgT1Ec3mKfZnAQCL4Dt9beTCknkCUn5jzo';
|
||||
const ADDR_TWO = '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF';
|
||||
|
||||
const ENC_ONE = '0x24988a82b3bbaae58680bc9de5dea5aa';
|
||||
const ENC_TWO = '0xdb190750267d8849c35316ec9d342111';
|
||||
const ENC_ONE = '0x4af2c53fce3ec33c6ccccf22e926f1a7';
|
||||
const ENC_TWO = '0x3e62f7ed6e788e1337bce2a97b68a12a';
|
||||
|
||||
describe('formatting', () => {
|
||||
let api: Api;
|
||||
|
||||
@@ -7,7 +7,7 @@ import storage from '@polkadot/storage/static';
|
||||
|
||||
import Rpc from '../../src';
|
||||
|
||||
const ALICE = '5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ';
|
||||
const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
|
||||
|
||||
describe.skip('e2e state', () => {
|
||||
let api;
|
||||
|
||||
@@ -30,10 +30,10 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.4.0",
|
||||
"@polkadot/keyring": "^0.42.1",
|
||||
"@polkadot/keyring": "^0.43.0-beta.0",
|
||||
"@polkadot/storage": "^0.53.0-beta.1",
|
||||
"@polkadot/util": "^0.42.1",
|
||||
"@polkadot/util-crypto": "^0.42.1",
|
||||
"@polkadot/util": "^0.43.0-beta.0",
|
||||
"@polkadot/util-crypto": "^0.43.0-beta.0",
|
||||
"@types/nock": "^9.3.1",
|
||||
"eventemitter3": "^3.1.0",
|
||||
"isomorphic-fetch": "^2.2.1",
|
||||
|
||||
@@ -12,6 +12,6 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.4.0",
|
||||
"@polkadot/types": "^0.53.0-beta.1",
|
||||
"@polkadot/util": "^0.42.1"
|
||||
"@polkadot/util": "^0.43.0-beta.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ describe('fromMetadata', () => {
|
||||
});
|
||||
|
||||
it('should return a value if the storage function does not expect an argument', () => {
|
||||
expect(() => newExtrinsics.balances.setBalance('5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s', 2, 3)).not.toThrow();
|
||||
expect(() => newExtrinsics.balances.setBalance('5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF', 2, 3)).not.toThrow();
|
||||
});
|
||||
|
||||
it('should return properly-encoded transactions', () => {
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-storage#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.4.0",
|
||||
"@polkadot/keyring": "^0.42.1",
|
||||
"@polkadot/keyring": "^0.43.0-beta.0",
|
||||
"@polkadot/types": "^0.53.0-beta.1",
|
||||
"@polkadot/util": "^0.42.1",
|
||||
"@polkadot/util-crypto": "^0.42.1"
|
||||
"@polkadot/util": "^0.43.0-beta.0",
|
||||
"@polkadot/util-crypto": "^0.43.0-beta.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { u8aToHex } from '@polkadot/util';
|
||||
import { Metadata } from '@polkadot/types';
|
||||
import json from '@polkadot/types/Metadata/v0/static';
|
||||
|
||||
@@ -20,11 +21,13 @@ describe('fromMetadata', () => {
|
||||
expect(() => newStorage.timestamp.now()).not.toThrow();
|
||||
});
|
||||
|
||||
// FIXME check again when we have a valid chain/UI
|
||||
it('should return the correct length-prefixed storage key', () => {
|
||||
expect(newStorage.balances.freeBalance('5GwPuAgYgP6q58uWTXp4uSg6FwfzQv9HfFZwAFEREUrQjCvy')).toEqual(
|
||||
// U8a is length-prefixed
|
||||
Uint8Array.from([64, 52, 103, 23, 10, 157, 95, 244, 9, 70, 215, 120, 149, 1, 238, 109, 69])
|
||||
expect(
|
||||
u8aToHex(
|
||||
newStorage.balances.freeBalance('5DkQbYAExs3M2sZgT1Ec3mKfZnAQCL4Dt9beTCknkCUn5jzo')
|
||||
)
|
||||
).toEqual(
|
||||
'0x404af2c53fce3ec33c6ccccf22e926f1a7'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.4.0",
|
||||
"@polkadot/keyring": "^0.42.1",
|
||||
"@polkadot/util": "^0.42.1"
|
||||
"@polkadot/keyring": "^0.43.0-beta.0",
|
||||
"@polkadot/util": "^0.43.0-beta.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,12 +129,12 @@ describe('Vector', () => {
|
||||
});
|
||||
|
||||
it('finds the index of an value', () => {
|
||||
const myId = '5GfWeNe33QeyzVMV2uENuvSXLVfVXCiuLvfEP6WCDHADZhen';
|
||||
const myId = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
|
||||
const vec = new Vector(AccountId, [
|
||||
'5H4787dXL43BaA6PvTwUTyA38JBbfC9r8QyK3ay8Nozc2Ta3', '5GeJHN5EcUGPoa5pUwYkXjymoDVN1DJHsBR4UGX4XRAwKBVk', '5Dn8F1SUX6SoLt1BTfKEPL5VY9wMvG1A6tEJTSCHpLsinThm', '5DPW1n4q2THUjKGj3QKkcqdh6oxY1bmLsSQ7t8FuiuNtRoUc', '5E8k3u7iRysqPPYsBK1UgetCquZznwRZxryTzynkDTzg3vNy', '5DteAmjoppNJ8rrBugKctCXM82UVWZSCHeU8pqFwQBbyAWyB', '5GfWeNe33QeyzVMV2uENuvSXLVfVXCiuLvfEP6WCDHADZhen'
|
||||
'5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw', '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty', '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'
|
||||
]);
|
||||
|
||||
expect(vec.indexOf(myId)).toEqual(6);
|
||||
expect(vec.indexOf(myId)).toEqual(2);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { hexToU8a } from '@polkadot/util';
|
||||
import storage from '@polkadot/storage/static';
|
||||
|
||||
import StorageKey from './StorageKey';
|
||||
@@ -12,10 +13,10 @@ describe('StorageKey', () => {
|
||||
new StorageKey(
|
||||
storage
|
||||
.balances
|
||||
.freeBalance('5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ')
|
||||
.freeBalance('5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY')
|
||||
)
|
||||
.toHex()
|
||||
).toBe('0xce3f3d8f09e3411403f5ca59d042a40e'); // FIXME OK this should be length-prefixed in reality
|
||||
).toBe('0xc99f5446efa57788f39ab529311f4550'); // FIXME OK this should be length-prefixed in reality
|
||||
});
|
||||
|
||||
it(`should correctly get Alice's freeBalance storage key (u8a)`, () => {
|
||||
@@ -23,11 +24,12 @@ describe('StorageKey', () => {
|
||||
new StorageKey(
|
||||
storage
|
||||
.balances
|
||||
.freeBalance('5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ')
|
||||
.freeBalance('5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY')
|
||||
)
|
||||
.toU8a()
|
||||
).toEqual(
|
||||
Uint8Array.from([64, 206, 63, 61, 143, 9, 227, 65, 20, 3, 245, 202, 89, 208, 66, 164, 14]) // Length-prefixed
|
||||
// length prefix attached
|
||||
hexToU8a('0x40c99f5446efa57788f39ab529311f4550')
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@ describe('AccountId', () => {
|
||||
});
|
||||
|
||||
it('equals the empty address', () => {
|
||||
expect(id.eq('5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUppTZ')).toBe(true);
|
||||
expect(id.eq('5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM')).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -36,17 +36,17 @@ describe('AccountId', () => {
|
||||
testDecode(
|
||||
'AccountId',
|
||||
new AccountId('0x0102030405060708010203040506070801020304050607080102030405060708'),
|
||||
'5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s'
|
||||
'5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'
|
||||
);
|
||||
testDecode('hex', '0x0102030405060708010203040506070801020304050607080102030405060708', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s');
|
||||
testDecode('string', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s');
|
||||
testDecode('hex', '0x0102030405060708010203040506070801020304050607080102030405060708', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF');
|
||||
testDecode('string', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF');
|
||||
testDecode(
|
||||
'U8a',
|
||||
new U8a([
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8
|
||||
]),
|
||||
'5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s'
|
||||
'5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'
|
||||
);
|
||||
testDecode(
|
||||
'Uint8Array',
|
||||
@@ -54,12 +54,12 @@ describe('AccountId', () => {
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8
|
||||
]),
|
||||
'5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s'
|
||||
'5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'
|
||||
);
|
||||
});
|
||||
|
||||
describe('encoding', () => {
|
||||
const testEncode = (to: 'toHex' | 'toJSON' | 'toString' | 'toU8a', expected: Uint8Array | string, input: string = '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s') =>
|
||||
const testEncode = (to: 'toHex' | 'toJSON' | 'toString' | 'toU8a', expected: Uint8Array | string, input: string = '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF') =>
|
||||
it(`can encode ${to}`, () => {
|
||||
const a = new AccountId(input);
|
||||
|
||||
@@ -67,16 +67,16 @@ describe('AccountId', () => {
|
||||
});
|
||||
|
||||
testEncode('toHex', '0x0102030405060708010203040506070801020304050607080102030405060708');
|
||||
testEncode('toJSON', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s');
|
||||
testEncode('toString', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s');
|
||||
testEncode('toString', '5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUppTZ', '0x00');
|
||||
testEncode('toJSON', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF');
|
||||
testEncode('toString', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF');
|
||||
testEncode('toString', '5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM', '0x00');
|
||||
testEncode('toU8a', Uint8Array.from([
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8
|
||||
]));
|
||||
|
||||
it('decodes to a non-empty value', () => {
|
||||
expect(new AccountId('5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s').isEmpty).toBe(false);
|
||||
expect(new AccountId('7qT1BvpawNbqb3BZaBTMFMMAKrpJKLPf1LmEHR1JyarWJdMX').isEmpty).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -88,14 +88,14 @@ describe('AccountId', () => {
|
||||
const list = new Vector(AccountId, data).map((accountId) => accountId.toString());
|
||||
|
||||
expect(list).toEqual([
|
||||
'7qVJujLF3EDbZt5WfQXWvueFedMS4Vfk2Hb4GyR8jwksTZQ5',
|
||||
'7pHyqeYaJjJPgxQgCXoS2EZMhBhtpm6BLCqQ4jJZTQB2kEDM',
|
||||
'7pYLWV6PTUmLTMQfHmmuBwBNLkhcKhRAnkM36CSJtjat9Cxe',
|
||||
'7qT1BvpawNbqb3BZaBTMFMMAKrpJKLPf1LmEHR1JyarWJpvA',
|
||||
'7rADc9JW5EUGFPWLjPMipH4c3bJ2GyAUedmqQHiaGucWVifb',
|
||||
'7oK5KRH6jt4p8auipnru9ptqeuRwbLMHA2tgCViZzhmW4Mo2',
|
||||
'7ndAVsHvonnzTg4AvRhpraNCKj9g4CGQXKoLrgkTZ91NaLgJ',
|
||||
'7oL7VfXgLA8L3pJJwi11v3sBYc1b5R3tLrweHwzMNxgEpWuv'
|
||||
'7qVJujLF3EDbZt5WfQXWvueFedMS4Vfk2Hb4GyR8jwksTLup',
|
||||
'7pHyqeYaJjJPgxQgCXoS2EZMhBhtpm6BLCqQ4jJZTQB2kMhw',
|
||||
'7pYLWV6PTUmLTMQfHmmuBwBNLkhcKhRAnkM36CSJtjat9ACb',
|
||||
'7qT1BvpawNbqb3BZaBTMFMMAKrpJKLPf1LmEHR1JyarWJdMX',
|
||||
'7rADc9JW5EUGFPWLjPMipH4c3bJ2GyAUedmqQHiaGucWVrsT',
|
||||
'7oK5KRH6jt4p8auipnru9ptqeuRwbLMHA2tgCViZzhmW4Lox',
|
||||
'7ndAVsHvonnzTg4AvRhpraNCKj9g4CGQXKoLrgkTZ91Na6PE',
|
||||
'7oL7VfXgLA8L3pJJwi11v3sBYc1b5R3tLrweHwzMNxgEpjxP'
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,28 +14,28 @@ describe('AccountIndex', () => {
|
||||
|
||||
it('creates a BN representation (from ss-58)', () => {
|
||||
expect(
|
||||
new AccountIndex('Mwz15xN8').toNumber()
|
||||
new AccountIndex('Mwz15xP2').toNumber()
|
||||
).toEqual(336794129);
|
||||
});
|
||||
|
||||
it('constructs 2-byte from number', () => {
|
||||
expect(
|
||||
new AccountIndex(256 * 1).toString()
|
||||
).toEqual('25GUyk');
|
||||
).toEqual('25GUyv');
|
||||
});
|
||||
|
||||
it('constructs from number', () => {
|
||||
expect(
|
||||
new AccountIndex(new BN(336794129)).toString()
|
||||
).toEqual('Mwz15xN8');
|
||||
).toEqual('Mwz15xP2');
|
||||
});
|
||||
|
||||
it('compares ss-58 values', () => {
|
||||
expect(new AccountIndex(256 * 1).eq('25GUyk')).toBe(true);
|
||||
expect(new AccountIndex(256 * 1).eq('25GUyv')).toBe(true);
|
||||
});
|
||||
|
||||
it('compares numbers', () => {
|
||||
expect(new AccountIndex('25GUyk').eq(256 * 1)).toBe(true);
|
||||
expect(new AccountIndex('2jpAFn').eq(256 * 1)).toBe(true);
|
||||
});
|
||||
|
||||
describe('calcLength', () => {
|
||||
|
||||
@@ -15,38 +15,38 @@ describe('Address', () => {
|
||||
|
||||
describe('utility', () => {
|
||||
it('equals on AccountId', () => {
|
||||
const addr = '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s';
|
||||
const addr = '5DkQbYAExs3M2sZgT1Ec3mKfZnAQCL4Dt9beTCknkCUn5jzo';
|
||||
|
||||
expect(new Address(addr).eq(addr)).toBe(true);
|
||||
});
|
||||
|
||||
it('equals on AccountIndex', () => {
|
||||
// see the test below - these are equivalent (with different prefix encoding)
|
||||
expect(new Address('PrF3').eq('F7ih')).toBe(true);
|
||||
expect(new Address('2jpAFn').eq('25GUyv')).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('decoding', () => {
|
||||
testDecode(
|
||||
'Address',
|
||||
new Address('5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s'),
|
||||
'5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s'
|
||||
new Address('5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'),
|
||||
'5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'
|
||||
);
|
||||
testDecode(
|
||||
'AccountId',
|
||||
new AccountId('5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s'),
|
||||
'5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s'
|
||||
new AccountId('5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'),
|
||||
'5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'
|
||||
);
|
||||
testDecode(
|
||||
'AccountIndex (mixed prefixes)',
|
||||
new Address('PrF3'),
|
||||
new Address('2jpAFn'),
|
||||
// NOTE Expected adress here is encoded with prefix 42, input above with 68
|
||||
'F7ih'
|
||||
'25GUyv'
|
||||
);
|
||||
testDecode(
|
||||
'AccountIndex (hex)',
|
||||
new AccountIndex('0x0100'),
|
||||
'25GUyk'
|
||||
'25GUyv'
|
||||
);
|
||||
testDecode(
|
||||
'Array',
|
||||
@@ -55,7 +55,7 @@ describe('Address', () => {
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8
|
||||
],
|
||||
'5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s'
|
||||
'5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'
|
||||
);
|
||||
testDecode(
|
||||
'Uint8Array (with prefix 255)',
|
||||
@@ -64,22 +64,22 @@ describe('Address', () => {
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8
|
||||
]),
|
||||
'5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s'
|
||||
'5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'
|
||||
);
|
||||
testDecode(
|
||||
'Uint8Array (with prefix 1 byte)',
|
||||
Uint8Array.from([1]),
|
||||
'F7L6'
|
||||
'F7NZ'
|
||||
);
|
||||
testDecode(
|
||||
'Uint8Array (with prefix 2 bytes)',
|
||||
Uint8Array.from([0xfc, 0, 1]),
|
||||
'25GUyk'
|
||||
'25GUyv'
|
||||
);
|
||||
testDecode(
|
||||
'Uint8Array (with prefix 4 bytes)',
|
||||
Uint8Array.from([0xfd, 17, 18, 19, 20]),
|
||||
'Mwz15xN8'
|
||||
'Mwz15xP2'
|
||||
);
|
||||
// FIXME The specification allows for 8 byte addresses, however since AccountIndex is u32 internally
|
||||
// (and defined that way in thd efault Substrate),this does not actually work since it is 8 bytes,
|
||||
@@ -94,7 +94,7 @@ describe('Address', () => {
|
||||
describe('encoding', () => {
|
||||
const testEncode = (to: 'toHex' | 'toString' | 'toU8a', expected: string | Uint8Array) =>
|
||||
it(`can encode ${to}`, () => {
|
||||
const a = new Address('5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s');
|
||||
const a = new Address('5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF');
|
||||
expect(a[to]()).toEqual(expected);
|
||||
});
|
||||
|
||||
@@ -104,7 +104,7 @@ describe('Address', () => {
|
||||
);
|
||||
testEncode(
|
||||
'toString',
|
||||
'5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s'
|
||||
'5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'
|
||||
);
|
||||
testEncode(
|
||||
'toU8a',
|
||||
|
||||
@@ -29,7 +29,7 @@ describe('Extrinsic', () => {
|
||||
expect(extrinsic.signature.nonce.toNumber()).toEqual(3);
|
||||
expect(extrinsic.signature.era.toU8a()).toEqual(new Uint8Array([0]));
|
||||
expect(extrinsic.callIndex).toEqual(new Uint8Array([3, 0]));
|
||||
expect(extrinsic.args[0].toString()).toEqual('5DkQbYAExs3M2sZgT1Ec3mKfZnAQCL4Dt9beTCknkCUn5nni');
|
||||
expect(extrinsic.args[0].toString()).toEqual('5DkQbYAExs3M2sZgT1Ec3mKfZnAQCL4Dt9beTCknkCUn5jzo');
|
||||
});
|
||||
|
||||
it('decodes an actual transaction (old format)', () => {
|
||||
@@ -43,6 +43,6 @@ describe('Extrinsic', () => {
|
||||
expect(extrinsic.signature.nonce.toNumber()).toEqual(3);
|
||||
expect(extrinsic.signature.era.toU8a()).toEqual(new Uint8Array([0]));
|
||||
expect(extrinsic.callIndex).toEqual(new Uint8Array([3, 0]));
|
||||
expect(extrinsic.args[0].toString()).toEqual('5DkQbYAExs3M2sZgT1Ec3mKfZnAQCL4Dt9beTCknkCUn5nni');
|
||||
expect(extrinsic.args[0].toString()).toEqual('5DkQbYAExs3M2sZgT1Ec3mKfZnAQCL4Dt9beTCknkCUn5jzo');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user