mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-10 21:49:15 +00:00
launchpad-ledger: Add basic type declaration for ledger-cosmos-js
This commit is contained in:
parent
dd73f24ebf
commit
dc0d5d2649
53
packages/launchpad-ledger/custom_types/ledger-cosmos-js.d.ts
vendored
Normal file
53
packages/launchpad-ledger/custom_types/ledger-cosmos-js.d.ts
vendored
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
declare module "ledger-cosmos-js" {
|
||||||
|
import Transport from "@ledgerhq/hw-transport";
|
||||||
|
|
||||||
|
export interface ErrorResponse {
|
||||||
|
readonly return_code: number;
|
||||||
|
readonly error_message: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface VersionResponse {
|
||||||
|
readonly major: number;
|
||||||
|
readonly minor: number;
|
||||||
|
readonly patch: number;
|
||||||
|
readonly test_mode: boolean;
|
||||||
|
readonly error_message: string;
|
||||||
|
readonly device_locked: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AppInfoResponse {
|
||||||
|
readonly appName: string;
|
||||||
|
readonly error_message: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PublicKeyResponse {
|
||||||
|
readonly compressed_pk: Buffer;
|
||||||
|
readonly error_message: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AddressAndPublicKeyResponse {
|
||||||
|
readonly compressed_pk: Buffer;
|
||||||
|
readonly address: string;
|
||||||
|
readonly error_message: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SignResponse {
|
||||||
|
readonly signature: Buffer;
|
||||||
|
readonly error_message: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class CosmosApp {
|
||||||
|
static getBech32FromPK(hrp: string, pk: Buffer): string;
|
||||||
|
|
||||||
|
constructor(transport: Transport, scrambleKey?: string);
|
||||||
|
|
||||||
|
getVersion: () => Promise<VersionResponse | ErrorResponse>;
|
||||||
|
appInfo: () => Promise<AppInfoResponse | ErrorResponse>;
|
||||||
|
publicKey: (path: Array<number>) => Promise<PublicKeyResponse | ErrorResponse>;
|
||||||
|
showAddressAndPubKey: (
|
||||||
|
path: Array<number>,
|
||||||
|
hrp: string,
|
||||||
|
) => Promise<AddressAndPublicKeyResponse | ErrorResponse>;
|
||||||
|
sign: (path: Array<number>, message: string) => Promise<SignResponse | ErrorResponse>;
|
||||||
|
}
|
||||||
|
}
|
@ -7,5 +7,5 @@
|
|||||||
"rootDir": "src",
|
"rootDir": "src",
|
||||||
"lib": ["es2017", "dom"]
|
"lib": ["es2017", "dom"]
|
||||||
},
|
},
|
||||||
"include": ["src/**/*"]
|
"include": ["src/**/*", "./custom_types/*"]
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
"declaration": true,
|
"declaration": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"lib": ["es2017"],
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"newLine": "LF",
|
"newLine": "LF",
|
||||||
@ -17,7 +18,6 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"target": "es2017",
|
"target": "es2017"
|
||||||
"lib": ["es2017"]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user