keepkey-vault-sdk 2.0.3 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +103 -0
- package/lib/index.d.ts +178 -34
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +191 -65
- package/lib/index.js.map +1 -1
- package/lib/types.d.ts +99 -0
- package/lib/types.d.ts.map +1 -1
- package/openapi/swagger.json +6558 -0
- package/package.json +50 -8
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# keepkey-vault-sdk
|
|
2
|
+
|
|
3
|
+
Typed TypeScript SDK for the KeepKey hardware wallet REST API.
|
|
4
|
+
|
|
5
|
+
Zero dependencies, native `fetch`. Works in browser, Node, Bun, and edge runtimes.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install keepkey-vault-sdk
|
|
11
|
+
# or
|
|
12
|
+
pnpm add keepkey-vault-sdk
|
|
13
|
+
# or
|
|
14
|
+
bun add keepkey-vault-sdk
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { KeepKeySdk } from 'keepkey-vault-sdk'
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Requirements
|
|
22
|
+
|
|
23
|
+
The KeepKey desktop application must be running on the same machine as your app. It exposes the REST API on `http://localhost:1646`.
|
|
24
|
+
|
|
25
|
+
Download the latest desktop application: https://github.com/keepkey/keepkey-vault/releases/latest
|
|
26
|
+
|
|
27
|
+
## Quick start
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { KeepKeySdk } from 'keepkey-vault-sdk'
|
|
31
|
+
|
|
32
|
+
// Auto-pairs on first run — prompts the user to approve in the KeepKey app.
|
|
33
|
+
const sdk = await KeepKeySdk.create({
|
|
34
|
+
serviceName: 'My App',
|
|
35
|
+
serviceImageUrl: 'https://example.com/icon.png',
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
// Derive an ETH address
|
|
39
|
+
const { address } = await sdk.address.ethGetAddress({
|
|
40
|
+
address_n: [0x8000002C, 0x8000003C, 0x80000000, 0, 0],
|
|
41
|
+
show_display: true,
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
console.log(address)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Reusing a saved API key
|
|
48
|
+
|
|
49
|
+
After the first successful pairing, save the API key and reuse it on subsequent runs to skip the approval prompt:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
const sdk = await KeepKeySdk.create({
|
|
53
|
+
apiKey: process.env.KEEPKEY_API_KEY,
|
|
54
|
+
serviceName: 'My App',
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
console.log(sdk.apiKey) // store this somewhere safe
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
If the key is invalid or revoked, the SDK will re-pair automatically.
|
|
61
|
+
|
|
62
|
+
## API surface
|
|
63
|
+
|
|
64
|
+
All methods are grouped by domain on the `KeepKeySdk` instance:
|
|
65
|
+
|
|
66
|
+
| Namespace | What it does |
|
|
67
|
+
|-----------------|---------------------------------------------------------------------|
|
|
68
|
+
| `sdk.system` | Device info, health, PIN management, initialization, firmware |
|
|
69
|
+
| `sdk.address` | Derive addresses (BTC, ETH, Cosmos, Osmosis, Solana, XRP, TRON, …) |
|
|
70
|
+
| `sdk.eth` | Ethereum signing — tx, message, EIP-712 typed data |
|
|
71
|
+
| `sdk.btc` | Bitcoin / UTXO transaction signing |
|
|
72
|
+
| `sdk.cosmos` | Cosmos Hub amino signing — transfer, staking, IBC |
|
|
73
|
+
| `sdk.osmosis` | Osmosis amino signing — transfer, staking, IBC, LP, swap |
|
|
74
|
+
| `sdk.thorchain` | THORChain transfer and deposit |
|
|
75
|
+
| `sdk.mayachain` | MAYAChain transfer and deposit |
|
|
76
|
+
| `sdk.ripple` | XRP transaction signing |
|
|
77
|
+
| `sdk.binance` | BNB Beacon Chain signing |
|
|
78
|
+
| `sdk.solana` | Solana transaction signing (incl. SPL tokens) |
|
|
79
|
+
| `sdk.tron` | TRON signing (incl. TRC-20) |
|
|
80
|
+
| `sdk.ton` | TON signing (incl. Jettons) |
|
|
81
|
+
| `sdk.xpub` | Extended public key derivation — single and batch |
|
|
82
|
+
| `sdk.chain` | Portfolio balances, market info, UTXOs, tx history, swap quotes |
|
|
83
|
+
| `sdk.sweep` | Recover BTC from non-standard derivation paths |
|
|
84
|
+
|
|
85
|
+
## OpenAPI spec
|
|
86
|
+
|
|
87
|
+
The REST API specification is bundled with the package:
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
import spec from 'keepkey-vault-sdk/openapi/swagger.json'
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Use it with Swagger UI, Redoc, or any OpenAPI-compatible tool.
|
|
94
|
+
|
|
95
|
+
## Security
|
|
96
|
+
|
|
97
|
+
- Every signing operation requires the user to confirm on the KeepKey hardware device.
|
|
98
|
+
- Signing endpoints block until the user approves or rejects. Default timeout is 10 minutes.
|
|
99
|
+
- The API key grants the holder the ability to *request* signatures from the device. The device is still the only place the user's keys exist.
|
|
100
|
+
|
|
101
|
+
## License
|
|
102
|
+
|
|
103
|
+
MIT
|
package/lib/index.d.ts
CHANGED
|
@@ -1,61 +1,104 @@
|
|
|
1
1
|
import { VaultClient } from './client';
|
|
2
|
-
import type { SdkConfig, DeviceFeatures, DeviceInfo, SignedTx, AddressRequest, EthSignTxParams, EthSignTypedDataParams, EthSignMessageParams, EthVerifyMessageParams, BtcSignTxParams, CosmosAminoSignParams, XrpSignTxParams, BnbSignTxParams, SolanaSignTxParams, TronSignTxParams, TonSignTxParams, GetPublicKeyRequest, BatchPubkeysPath, ApplySettingsParams, HealthResponse, SupportedAsset } from './types';
|
|
2
|
+
import type { SdkConfig, DeviceFeatures, DeviceInfo, SignedTx, AddressRequest, EthSignTxParams, EthSignTypedDataParams, EthSignMessageParams, EthVerifyMessageParams, BtcSignTxParams, CosmosAminoSignParams, XrpSignTxParams, BnbSignTxParams, SolanaSignTxParams, TronSignTxParams, TonSignTxParams, GetPublicKeyRequest, BatchPubkeysPath, ApplySettingsParams, HealthResponse, SupportedAsset, PortfolioBalancesParams, MarketInfoParams, SearchAssetsParams, ListUnspentParams, PubkeyInfoParams, TxHistoryParams, BroadcastParams, NetworkIdParams, NetworkAddressParams, TokenDecimalsParams, StakingParams, SwapQuoteParams, SweepScanParams, SweepScanStatus, SweepExecuteParams, SweepExecuteResult } from './types';
|
|
3
3
|
export { SdkError } from './client';
|
|
4
4
|
export * from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Typed client for the KeepKey REST API.
|
|
7
|
+
*
|
|
8
|
+
* The KeepKey desktop application exposes a local REST API on
|
|
9
|
+
* `http://localhost:1646`. This SDK is a thin, typed wrapper around
|
|
10
|
+
* that API — zero dependencies, native `fetch`, works in browser,
|
|
11
|
+
* Node, Bun, and edge runtimes.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { KeepKeySdk } from 'keepkey-vault-sdk'
|
|
16
|
+
*
|
|
17
|
+
* const sdk = await KeepKeySdk.create({
|
|
18
|
+
* serviceName: 'My App',
|
|
19
|
+
* serviceImageUrl: 'https://example.com/icon.png',
|
|
20
|
+
* })
|
|
21
|
+
*
|
|
22
|
+
* const { address } = await sdk.address.ethGetAddress({
|
|
23
|
+
* address_n: [0x8000002C, 0x8000003C, 0x80000000, 0, 0],
|
|
24
|
+
* show_display: true,
|
|
25
|
+
* })
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
5
28
|
export declare class KeepKeySdk {
|
|
6
29
|
private client;
|
|
7
|
-
/** Use KeepKeySdk.create() instead of constructing directly */
|
|
8
30
|
private constructor();
|
|
9
31
|
/**
|
|
10
|
-
* Create a connected KeepKeySdk instance.
|
|
32
|
+
* Create a connected `KeepKeySdk` instance.
|
|
11
33
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
34
|
+
* Verifies the local REST API is reachable, then either validates
|
|
35
|
+
* the supplied `apiKey` or initiates a new pairing (which requires
|
|
36
|
+
* the user to approve on the device).
|
|
37
|
+
*
|
|
38
|
+
* @param config - Optional configuration. If `apiKey` is omitted, the
|
|
39
|
+
* SDK will auto-pair, which shows an approval prompt in the KeepKey app.
|
|
40
|
+
* @returns A connected `KeepKeySdk` ready to make API calls.
|
|
41
|
+
* @throws {@link SdkError} if the REST API is not reachable or pairing fails.
|
|
15
42
|
*/
|
|
16
43
|
static create(config?: SdkConfig): Promise<KeepKeySdk>;
|
|
17
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Access the underlying HTTP client for advanced use cases
|
|
46
|
+
* (custom endpoints, raw requests).
|
|
47
|
+
*/
|
|
18
48
|
getClient(): VaultClient;
|
|
19
|
-
/**
|
|
49
|
+
/** The current API key, or `null` if not yet paired. */
|
|
20
50
|
get apiKey(): string | null;
|
|
51
|
+
/** Device information, health, and initialization. */
|
|
21
52
|
system: {
|
|
53
|
+
/** Read-only device info and health endpoints. */
|
|
22
54
|
info: {
|
|
55
|
+
/** Get full device features — model, firmware version, PIN/passphrase state, policies. */
|
|
23
56
|
getFeatures: () => Promise<DeviceFeatures>;
|
|
57
|
+
/** List all connected KeepKey devices. */
|
|
24
58
|
getDevices: () => Promise<{
|
|
25
59
|
devices: DeviceInfo[];
|
|
26
60
|
total: number;
|
|
27
61
|
}>;
|
|
62
|
+
/** List assets supported by the connected device. */
|
|
28
63
|
getSupportedAssets: () => Promise<{
|
|
29
64
|
assets: SupportedAsset[];
|
|
30
65
|
}>;
|
|
66
|
+
/** Check REST API health and device connection state. Does not require auth. */
|
|
31
67
|
getHealth: () => Promise<HealthResponse>;
|
|
68
|
+
/** List all coins the firmware knows about. */
|
|
32
69
|
listCoins: () => Promise<any[]>;
|
|
70
|
+
/** Derive an extended public key (xpub) at the given BIP32 path. */
|
|
33
71
|
getPublicKey: (params: GetPublicKeyRequest) => Promise<{
|
|
34
72
|
xpub: string;
|
|
35
73
|
}>;
|
|
36
|
-
ping: () => Promise<{
|
|
37
|
-
message: string;
|
|
38
|
-
}>;
|
|
39
74
|
};
|
|
75
|
+
/** Device management — PIN, recovery, settings, firmware. */
|
|
40
76
|
device: {
|
|
77
|
+
/** Ping the device. Useful for connection checks. */
|
|
41
78
|
ping: () => Promise<{
|
|
42
79
|
message: string;
|
|
43
80
|
}>;
|
|
81
|
+
/** Wipe all secrets from the device. Requires user confirmation on device. */
|
|
44
82
|
wipe: () => Promise<{
|
|
45
83
|
success: boolean;
|
|
46
84
|
}>;
|
|
85
|
+
/** Change device label, passphrase protection, or auto-lock delay. */
|
|
47
86
|
applySettings: (params: ApplySettingsParams) => Promise<{
|
|
48
87
|
success: boolean;
|
|
49
88
|
}>;
|
|
89
|
+
/** Apply device policy changes. */
|
|
50
90
|
applyPolicies: (params: any) => Promise<{
|
|
51
91
|
success: boolean;
|
|
52
92
|
}>;
|
|
93
|
+
/** Start a PIN change flow. Pass `remove: true` to remove the PIN. */
|
|
53
94
|
changePin: (remove?: boolean) => Promise<{
|
|
54
95
|
success: boolean;
|
|
55
96
|
}>;
|
|
97
|
+
/** Clear the device session (forces PIN re-entry for the next sensitive call). */
|
|
56
98
|
clearSession: () => Promise<{
|
|
57
99
|
success: boolean;
|
|
58
100
|
}>;
|
|
101
|
+
/** Initialize a new device with a fresh seed. Requires user confirmation. */
|
|
59
102
|
resetDevice: (params: {
|
|
60
103
|
word_count?: number;
|
|
61
104
|
label?: string;
|
|
@@ -64,6 +107,7 @@ export declare class KeepKeySdk {
|
|
|
64
107
|
}) => Promise<{
|
|
65
108
|
success: boolean;
|
|
66
109
|
}>;
|
|
110
|
+
/** Recover an existing device from a seed phrase. Requires user input on device. */
|
|
67
111
|
recoverDevice: (params: {
|
|
68
112
|
word_count?: number;
|
|
69
113
|
label?: string;
|
|
@@ -72,138 +116,238 @@ export declare class KeepKeySdk {
|
|
|
72
116
|
}) => Promise<{
|
|
73
117
|
success: boolean;
|
|
74
118
|
}>;
|
|
119
|
+
/** Load a device with a specific seed (testing only). */
|
|
75
120
|
loadDevice: (params: any) => Promise<{
|
|
76
121
|
success: boolean;
|
|
77
122
|
}>;
|
|
123
|
+
/** Send a PIN entered via matrix input during a recovery flow. */
|
|
78
124
|
sendPin: (pin: string) => Promise<{
|
|
79
125
|
success: boolean;
|
|
80
126
|
}>;
|
|
81
127
|
};
|
|
82
128
|
};
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Derive receive addresses on the device. Every method takes a BIP32
|
|
131
|
+
* derivation path (`address_n`) and returns the derived address.
|
|
132
|
+
*
|
|
133
|
+
* Pass `show_display: true` to have the device show the address
|
|
134
|
+
* on-screen so the user can visually verify it before use.
|
|
135
|
+
*/
|
|
90
136
|
address: {
|
|
137
|
+
/** Derive a UTXO (BTC/LTC/BCH/DOGE/DASH) address. */
|
|
91
138
|
utxoGetAddress: (params: AddressRequest) => Promise<{
|
|
92
139
|
address: string;
|
|
93
140
|
}>;
|
|
141
|
+
/** Derive an Ethereum (or EVM-compatible) address. */
|
|
94
142
|
ethGetAddress: (params: AddressRequest) => Promise<{
|
|
95
143
|
address: string;
|
|
96
144
|
}>;
|
|
97
|
-
|
|
98
|
-
address: string;
|
|
99
|
-
}>;
|
|
145
|
+
/** Derive a Cosmos Hub (ATOM) address. */
|
|
100
146
|
cosmosGetAddress: (params: AddressRequest) => Promise<{
|
|
101
147
|
address: string;
|
|
102
148
|
}>;
|
|
149
|
+
/** Derive a THORChain (RUNE) address. */
|
|
103
150
|
thorchainGetAddress: (params: AddressRequest) => Promise<{
|
|
104
151
|
address: string;
|
|
105
152
|
}>;
|
|
153
|
+
/** Derive a MAYAChain (CACAO) address. */
|
|
106
154
|
mayachainGetAddress: (params: AddressRequest) => Promise<{
|
|
107
155
|
address: string;
|
|
108
156
|
}>;
|
|
157
|
+
/** Derive an Osmosis (OSMO) address. */
|
|
109
158
|
osmosisGetAddress: (params: AddressRequest) => Promise<{
|
|
110
159
|
address: string;
|
|
111
160
|
}>;
|
|
161
|
+
/** Derive a generic Tendermint-based address. */
|
|
112
162
|
tendermintGetAddress: (params: AddressRequest) => Promise<{
|
|
113
163
|
address: string;
|
|
114
164
|
}>;
|
|
165
|
+
/** Derive an XRP (Ripple) address. */
|
|
115
166
|
xrpGetAddress: (params: AddressRequest) => Promise<{
|
|
116
167
|
address: string;
|
|
117
168
|
}>;
|
|
169
|
+
/** Derive a BNB Beacon Chain address. */
|
|
118
170
|
bnbGetAddress: (params: AddressRequest) => Promise<{
|
|
119
171
|
address: string;
|
|
120
172
|
}>;
|
|
121
|
-
|
|
122
|
-
address: string;
|
|
123
|
-
}>;
|
|
173
|
+
/** Derive a Solana (SOL) address. */
|
|
124
174
|
solanaGetAddress: (params: AddressRequest) => Promise<{
|
|
125
175
|
address: string;
|
|
126
176
|
}>;
|
|
177
|
+
/** Derive a TRON (TRX) address. */
|
|
127
178
|
tronGetAddress: (params: AddressRequest) => Promise<{
|
|
128
179
|
address: string;
|
|
129
180
|
}>;
|
|
181
|
+
/** Derive a TON address. */
|
|
130
182
|
tonGetAddress: (params: AddressRequest) => Promise<{
|
|
131
183
|
address: string;
|
|
132
184
|
}>;
|
|
133
185
|
};
|
|
186
|
+
/** Ethereum and EVM-compatible signing (sign-tx, sign-message, EIP-712). */
|
|
134
187
|
eth: {
|
|
188
|
+
/** Sign an Ethereum or EVM transaction. Supports legacy and EIP-1559. */
|
|
135
189
|
ethSignTransaction: (params: EthSignTxParams) => Promise<SignedTx>;
|
|
190
|
+
/** Sign a personal message (`eth_sign` / `personal_sign`). */
|
|
136
191
|
ethSignMessage: (params: EthSignMessageParams) => Promise<any>;
|
|
137
|
-
|
|
192
|
+
/** Sign an EIP-712 typed data structure. */
|
|
138
193
|
ethSignTypedData: (params: EthSignTypedDataParams) => Promise<any>;
|
|
194
|
+
/** Verify an Ethereum personal message signature. Returns `true` if valid. */
|
|
139
195
|
ethVerifyMessage: (params: EthVerifyMessageParams) => Promise<boolean>;
|
|
140
196
|
};
|
|
197
|
+
/** Bitcoin and UTXO chain signing. */
|
|
141
198
|
btc: {
|
|
199
|
+
/** Sign a UTXO transaction (BTC, LTC, BCH, DOGE, DASH, etc.). */
|
|
142
200
|
btcSignTransaction: (params: BtcSignTxParams) => Promise<SignedTx>;
|
|
143
201
|
};
|
|
202
|
+
/** Cosmos Hub amino signing (transfer, staking, IBC). */
|
|
144
203
|
cosmos: {
|
|
204
|
+
/** Sign a generic Cosmos amino message. */
|
|
145
205
|
cosmosSignAmino: (params: CosmosAminoSignParams) => Promise<SignedTx>;
|
|
206
|
+
/** Sign a Cosmos `MsgDelegate`. */
|
|
146
207
|
cosmosSignAminoDelegate: (params: CosmosAminoSignParams) => Promise<SignedTx>;
|
|
208
|
+
/** Sign a Cosmos `MsgUndelegate`. */
|
|
147
209
|
cosmosSignAminoUndelegate: (params: CosmosAminoSignParams) => Promise<SignedTx>;
|
|
210
|
+
/** Sign a Cosmos `MsgBeginRedelegate`. */
|
|
148
211
|
cosmosSignAminoRedelegate: (params: CosmosAminoSignParams) => Promise<SignedTx>;
|
|
212
|
+
/** Sign a Cosmos `MsgWithdrawDelegatorReward` for all delegations. */
|
|
149
213
|
cosmosSignAminoWithdrawRewards: (params: CosmosAminoSignParams) => Promise<SignedTx>;
|
|
150
|
-
|
|
214
|
+
/** Sign a Cosmos IBC `MsgTransfer`. */
|
|
151
215
|
cosmosSignAminoIbcTransfer: (params: CosmosAminoSignParams) => Promise<SignedTx>;
|
|
152
216
|
};
|
|
217
|
+
/** Osmosis amino signing — transfer, staking, IBC, LP, swap. */
|
|
153
218
|
osmosis: {
|
|
219
|
+
/** Sign a generic Osmosis amino message. */
|
|
154
220
|
osmosisSignAmino: (params: CosmosAminoSignParams) => Promise<SignedTx>;
|
|
221
|
+
/** Sign an Osmosis `MsgDelegate`. */
|
|
155
222
|
osmosisSignAminoDelegate: (params: CosmosAminoSignParams) => Promise<SignedTx>;
|
|
223
|
+
/** Sign an Osmosis `MsgUndelegate`. */
|
|
156
224
|
osmosisSignAminoUndelegate: (params: CosmosAminoSignParams) => Promise<SignedTx>;
|
|
225
|
+
/** Sign an Osmosis `MsgBeginRedelegate`. */
|
|
157
226
|
osmosisSignAminoRedelegate: (params: CosmosAminoSignParams) => Promise<SignedTx>;
|
|
227
|
+
/** Sign an Osmosis `MsgWithdrawDelegatorReward` for all delegations. */
|
|
158
228
|
osmosisSignAminoWithdrawRewards: (params: CosmosAminoSignParams) => Promise<SignedTx>;
|
|
229
|
+
/** Sign an Osmosis IBC `MsgTransfer`. */
|
|
159
230
|
osmosisSignAminoIbcTransfer: (params: CosmosAminoSignParams) => Promise<SignedTx>;
|
|
231
|
+
/** Sign an Osmosis `MsgExitPool` (remove liquidity). */
|
|
160
232
|
osmosisSignAminoLpRemove: (params: CosmosAminoSignParams) => Promise<SignedTx>;
|
|
233
|
+
/** Sign an Osmosis `MsgJoinPool` (add liquidity). */
|
|
161
234
|
osmosisSignAminoLpAdd: (params: CosmosAminoSignParams) => Promise<SignedTx>;
|
|
235
|
+
/** Sign an Osmosis `MsgSwapExactAmountIn` (swap). */
|
|
162
236
|
osmosisSignAminoSwap: (params: CosmosAminoSignParams) => Promise<SignedTx>;
|
|
163
|
-
osmoSignAminoDelegate: (params: any) => Promise<SignedTx>;
|
|
164
|
-
osmoSignAminoUndelegate: (params: any) => Promise<SignedTx>;
|
|
165
|
-
osmoSignAminoRedelegate: (params: any) => Promise<SignedTx>;
|
|
166
|
-
osmoSignAminoWithdrawDelegatorRewardsAll: (params: any) => Promise<SignedTx>;
|
|
167
|
-
osmoSignAminoIbcTransfer: (params: any) => Promise<SignedTx>;
|
|
168
|
-
osmoSignAminoLpAdd: (params: any) => Promise<SignedTx>;
|
|
169
|
-
osmoSignAminoLpRemove: (params: any) => Promise<SignedTx>;
|
|
170
|
-
osmoSignAminoSwap: (params: any) => Promise<SignedTx>;
|
|
171
237
|
};
|
|
238
|
+
/** THORChain signing (RUNE transfers and deposits for swaps). */
|
|
172
239
|
thorchain: {
|
|
240
|
+
/** Sign a THORChain `MsgSend` transfer. */
|
|
173
241
|
thorchainSignAminoTransfer: (params: CosmosAminoSignParams) => Promise<SignedTx>;
|
|
242
|
+
/** Sign a THORChain `MsgDeposit` (used for swaps and loans). */
|
|
174
243
|
thorchainSignAminoDeposit: (params: CosmosAminoSignParams) => Promise<SignedTx>;
|
|
175
244
|
};
|
|
245
|
+
/** MAYAChain signing (CACAO transfers and deposits). */
|
|
176
246
|
mayachain: {
|
|
247
|
+
/** Sign a MAYAChain `MsgSend` transfer. */
|
|
177
248
|
mayachainSignAminoTransfer: (params: CosmosAminoSignParams) => Promise<SignedTx>;
|
|
249
|
+
/** Sign a MAYAChain `MsgDeposit` (used for swaps). */
|
|
178
250
|
mayachainSignAminoDeposit: (params: CosmosAminoSignParams) => Promise<SignedTx>;
|
|
179
251
|
};
|
|
252
|
+
/** XRP (Ripple) signing. */
|
|
180
253
|
ripple: {
|
|
254
|
+
/** Sign an XRP payment transaction. */
|
|
181
255
|
xrpSignTransaction: (params: XrpSignTxParams) => Promise<SignedTx>;
|
|
182
256
|
};
|
|
257
|
+
/** BNB Beacon Chain signing. */
|
|
183
258
|
binance: {
|
|
259
|
+
/** Sign a BNB Beacon Chain transaction. */
|
|
184
260
|
binanceSignTransaction: (params: BnbSignTxParams) => Promise<SignedTx>;
|
|
185
261
|
};
|
|
262
|
+
/** Solana signing (supports SPL tokens). */
|
|
186
263
|
solana: {
|
|
264
|
+
/** Sign a Solana transaction. `raw_tx` must be the base64-encoded serialized transaction. */
|
|
187
265
|
solanaSignTransaction: (params: SolanaSignTxParams) => Promise<SignedTx>;
|
|
188
266
|
};
|
|
267
|
+
/** TRON (TRX) signing, including TRC-20 tokens. */
|
|
189
268
|
tron: {
|
|
269
|
+
/** Sign a TRON transaction. `amount` is in sun (1 TRX = 1,000,000 sun). */
|
|
190
270
|
tronSignTransaction: (params: TronSignTxParams) => Promise<SignedTx>;
|
|
191
271
|
};
|
|
272
|
+
/** TON signing (supports Jettons). */
|
|
192
273
|
ton: {
|
|
274
|
+
/** Sign a TON transaction. `raw_tx` must be the base64- or hex-encoded raw transaction. */
|
|
193
275
|
tonSignTransaction: (params: TonSignTxParams) => Promise<SignedTx>;
|
|
194
276
|
};
|
|
277
|
+
/** Extended public key (xpub) derivation — single and batch. */
|
|
195
278
|
xpub: {
|
|
279
|
+
/** Derive a single xpub at the given BIP32 path. */
|
|
196
280
|
getPublicKey: (params: GetPublicKeyRequest) => Promise<{
|
|
197
281
|
xpub: string;
|
|
198
282
|
}>;
|
|
283
|
+
/**
|
|
284
|
+
* Derive many xpubs in a single request. The server caches results,
|
|
285
|
+
* so subsequent calls for the same path are fast.
|
|
286
|
+
*/
|
|
199
287
|
getPublicKeys: (paths: BatchPubkeysPath[]) => Promise<{
|
|
200
288
|
pubkeys: any[];
|
|
201
289
|
cached_count: number;
|
|
202
290
|
total_requested: number;
|
|
203
291
|
}>;
|
|
204
292
|
};
|
|
293
|
+
/** Quick device connection status. */
|
|
205
294
|
deviceStatus: {
|
|
295
|
+
/** Returns `true` if a KeepKey device is currently connected and responsive. */
|
|
206
296
|
isDeviceConnected: () => Promise<boolean>;
|
|
207
297
|
};
|
|
298
|
+
/**
|
|
299
|
+
* Chain data queries: portfolio balances, market prices, UTXOs,
|
|
300
|
+
* transaction history, fee estimation, and swap quotes. Pulls data
|
|
301
|
+
* from upstream indexers — does not require the device to be connected.
|
|
302
|
+
*/
|
|
303
|
+
chain: {
|
|
304
|
+
/** Get portfolio balances across the supplied pubkeys. */
|
|
305
|
+
getPortfolioBalances: (params: PortfolioBalancesParams) => Promise<any>;
|
|
306
|
+
/** Get market info (price, market cap) for the supplied CAIPs. */
|
|
307
|
+
getMarketInfo: (params: MarketInfoParams) => Promise<any>;
|
|
308
|
+
/** List all assets the chain indexer knows about. */
|
|
309
|
+
getAvailableAssets: () => Promise<any>;
|
|
310
|
+
/** Search assets by symbol or name. */
|
|
311
|
+
searchAssets: (params: SearchAssetsParams) => Promise<any>;
|
|
312
|
+
/** List unspent outputs for a UTXO xpub. */
|
|
313
|
+
listUnspent: (params: ListUnspentParams) => Promise<any>;
|
|
314
|
+
/** Get pubkey info (balance, tx count) for a UTXO xpub. */
|
|
315
|
+
getPubkeyInfo: (params: PubkeyInfoParams) => Promise<any>;
|
|
316
|
+
/** Get transaction history for one or more pubkeys. */
|
|
317
|
+
getTransactionHistory: (params: TxHistoryParams) => Promise<any>;
|
|
318
|
+
/** Broadcast a signed transaction to the network. */
|
|
319
|
+
broadcast: (params: BroadcastParams) => Promise<any>;
|
|
320
|
+
/** Get the current recommended fee rate for a UTXO network. */
|
|
321
|
+
getFeeRate: (params: NetworkIdParams) => Promise<any>;
|
|
322
|
+
/** Get the current gas price for an EVM network. */
|
|
323
|
+
getGasPrice: (params: NetworkIdParams) => Promise<any>;
|
|
324
|
+
/** Get the nonce (tx count) for an EVM address. */
|
|
325
|
+
getNonce: (params: NetworkAddressParams) => Promise<any>;
|
|
326
|
+
/** Get the native asset balance for an address. */
|
|
327
|
+
getBalance: (params: NetworkAddressParams) => Promise<any>;
|
|
328
|
+
/** Get the decimals for an ERC-20 / token contract. */
|
|
329
|
+
getTokenDecimals: (params: TokenDecimalsParams) => Promise<any>;
|
|
330
|
+
/** Get staking positions for an address. */
|
|
331
|
+
getStakingPositions: (params: StakingParams) => Promise<any>;
|
|
332
|
+
/** Get a swap quote from the integrated aggregator. */
|
|
333
|
+
getSwapQuote: (params: SwapQuoteParams) => Promise<any>;
|
|
334
|
+
/** Get THORChain/Mayachain inbound addresses (for swap deposits). */
|
|
335
|
+
getInboundAddresses: () => Promise<any>;
|
|
336
|
+
};
|
|
337
|
+
/**
|
|
338
|
+
* Async sweep tool for recovering BTC from non-standard derivation paths
|
|
339
|
+
* (e.g. mistakes from other wallets). Workflow: `startScan` → poll
|
|
340
|
+
* `getScanStatus` → `execute` with a destination.
|
|
341
|
+
*/
|
|
342
|
+
sweep: {
|
|
343
|
+
/** Start an async scan for funds on non-standard BTC paths. Returns a `scanId` to poll. */
|
|
344
|
+
startScan: (params?: SweepScanParams) => Promise<{
|
|
345
|
+
scanId: string;
|
|
346
|
+
}>;
|
|
347
|
+
/** Poll scan progress and results. */
|
|
348
|
+
getScanStatus: (scanId: string) => Promise<SweepScanStatus>;
|
|
349
|
+
/** Execute a sweep: build the tx, sign on device, broadcast. */
|
|
350
|
+
execute: (params: SweepExecuteParams) => Promise<SweepExecuteResult>;
|
|
351
|
+
};
|
|
208
352
|
}
|
|
209
353
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAY,MAAM,UAAU,CAAA;AAChD,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,UAAU,EACV,QAAQ,EACR,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACf,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,cAAc,SAAS,CAAA;AAEvB,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAa;IAE3B
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAY,MAAM,UAAU,CAAA;AAChD,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,UAAU,EACV,QAAQ,EACR,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,o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