33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
/**
|
|
* Step 4 — Derivation / Signer: getAddress resolver
|
|
* Target: ledger-live libs/coin-modules/coin-*/src/signer/getAddress.ts
|
|
*
|
|
* Uses @ledgerhq/coin-framework getAddressWrapper. For Ethereum family the
|
|
* existing Ethereum getAddress resolver applies; ensure currency/chainId 138
|
|
* is used when resolving for Defi Oracle Meta Mainnet.
|
|
*
|
|
* Example resolver shape (adapt to your coin-framework version):
|
|
*/
|
|
|
|
import type { GetAddressFn } from "@ledgerhq/coin-framework/bridge/getAddressWrapper";
|
|
import type { SignerContext } from "@ledgerhq/coin-framework/signer";
|
|
import type { GetAddressOptions } from "@ledgerhq/coin-framework/derivation";
|
|
import type { EthereumAddress, EthereumSigner } from "./types-signer";
|
|
|
|
const resolver = (
|
|
signerContext: SignerContext<EthereumSigner, EthereumAddress>
|
|
): GetAddressFn => {
|
|
return async (deviceId: string, { path, verify }: GetAddressOptions) => {
|
|
const address = (await signerContext(deviceId, (signer) =>
|
|
signer.getAddress(path, verify)
|
|
)) as EthereumAddress;
|
|
return {
|
|
address: address.address,
|
|
publicKey: address.publicKey,
|
|
path,
|
|
};
|
|
};
|
|
};
|
|
|
|
export default resolver;
|