1 | // Copyright 2017-2023 @polkadot/util-crypto authors & contributors
|
2 | // SPDX-License-Identifier: Apache-2.0
|
3 |
|
4 | import { decodeAddress } from "./decode.js";
|
5 | import { encodeAddress } from "./encode.js";
|
6 | import { createKeyDerived } from "./keyDerived.js";
|
7 |
|
8 | /**
|
9 | * @name encodeDerivedAddress
|
10 | * @summary Creates a derived address as used in Substrate utility.
|
11 | * @description
|
12 | * Creates a Substrate derived address based on the input address/publicKey and the index supplied.
|
13 | */
|
14 | export function encodeDerivedAddress(who, index, ss58Format) {
|
15 | return encodeAddress(createKeyDerived(decodeAddress(who), index), ss58Format);
|
16 | } |
\ | No newline at end of file |