UNPKG

512 BJavaScriptView Raw
1import { decodeAddress } from './decode.js';
2import { encodeAddress } from './encode.js';
3import { createKeyDerived } from './keyDerived.js';
4/**
5 * @name encodeDerivedAddress
6 * @summary Creates a derived address as used in Substrate utility.
7 * @description
8 * Creates a Substrate derived address based on the input address/publicKey and the index supplied.
9 */
10export function encodeDerivedAddress(who, index, ss58Format) {
11 return encodeAddress(createKeyDerived(decodeAddress(who), index), ss58Format);
12}