Add full Chain 138 integration: 8 steps, chain spec, app-ethereum config, docs
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
15
step-04-signer/README.md
Normal file
15
step-04-signer/README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Step 4 — Derivation / Signer
|
||||
|
||||
- **types-signer.ts** — Signer interface (Ethereum-style: getAddress, signTransaction, signPersonalMessage). Use as-is for EVM/Chain 138.
|
||||
- **getAddress.ts** — getAddress resolver using `@ledgerhq/coin-framework` (GetAddressFn, SignerContext, GetAddressOptions). Register in live-common family setup.
|
||||
|
||||
**CLI check (after currency is added):**
|
||||
```bash
|
||||
ledger-live getAddress --currency defi_oracle_meta_mainnet --path "44'/60'/0'/0/0" --derivationMode ""
|
||||
```
|
||||
Or with ethereum currency and chainId in config:
|
||||
```bash
|
||||
ledger-live getAddress --currency ethereum --path "44'/60'/0'/0/0" --derivationMode ""
|
||||
```
|
||||
|
||||
Derivation for Chain 138: **44'/60'/0'/0/0** (standard EVM BIP44).
|
||||
32
step-04-signer/getAddress.ts
Normal file
32
step-04-signer/getAddress.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 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;
|
||||
22
step-04-signer/types-signer.ts
Normal file
22
step-04-signer/types-signer.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Step 4 — Derivation / Signer: types
|
||||
* Target: ledger-live libs/coin-modules/coin-*/src/types/signer.ts
|
||||
* For EVM we use the same as Ethereum; Chain 138 uses path 44'/60'/0'/0/0.
|
||||
*/
|
||||
|
||||
export type EthereumAddress = {
|
||||
address: string;
|
||||
publicKey: string;
|
||||
returnCode: number;
|
||||
};
|
||||
|
||||
export type EthereumSignature = {
|
||||
signature: Buffer | null;
|
||||
returnCode: number;
|
||||
};
|
||||
|
||||
export interface EthereumSigner {
|
||||
getAddress(path: string, display?: boolean): Promise<EthereumAddress>;
|
||||
signTransaction(path: string, rawTxHex: string): Promise<EthereumSignature>;
|
||||
signPersonalMessage(path: string, messageHex: string): Promise<EthereumSignature>;
|
||||
}
|
||||
Reference in New Issue
Block a user