Sort with ss58 prefix (#591)

This commit is contained in:
Jaco Greeff
2020-04-26 14:33:45 +02:00
committed by GitHub
parent 2397e1c5d7
commit 5d0abef952
+4 -2
View File
@@ -2,13 +2,15 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Prefix } from './types';
import { u8aSorted } from '@polkadot/util';
import decodeAddress from './decode';
import encodeAddress from './encode';
export default function sortAddresses (addresses: (Uint8Array | string)[]): string[] {
export default function sortAddresses (addresses: (Uint8Array | string)[], ss58Format?: Prefix): string[] {
return u8aSorted(
addresses.map((who) => decodeAddress(who))
).map((u8a) => encodeAddress(u8a));
).map((u8a) => encodeAddress(u8a, ss58Format));
}