@keplr-wallet/types 0.12.98 → 0.12.99-rc.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/build/chain-info.d.ts +7 -6
- package/build/ethereum.d.ts +8 -0
- package/build/wallet/keplr.d.ts +19 -0
- package/package.json +2 -2
- package/src/chain-info.ts +7 -6
- package/src/ethereum.ts +10 -0
- package/src/wallet/keplr.ts +32 -0
package/build/chain-info.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Currency, AppCurrency, FeeCurrency } from "./currency";
|
2
2
|
import { BIP44 } from "./bip44";
|
3
3
|
import { Bech32Config } from "./bech32";
|
4
|
+
import { EVMInfo } from "./ethereum";
|
4
5
|
export interface ChainInfo {
|
5
6
|
readonly rpc: string;
|
6
7
|
readonly rest: string;
|
@@ -39,13 +40,13 @@ export interface ChainInfo {
|
|
39
40
|
readonly beta?: boolean;
|
40
41
|
readonly chainSymbolImageUrl?: string;
|
41
42
|
readonly hideInUI?: boolean;
|
42
|
-
readonly evm?:
|
43
|
-
chainId: number;
|
44
|
-
rpc: string;
|
45
|
-
};
|
43
|
+
readonly evm?: EVMInfo;
|
46
44
|
}
|
47
45
|
export type ChainInfoWithoutEndpoints = Omit<ChainInfo, "rest" | "rpc" | "nodeProvider" | "evm"> & {
|
48
|
-
|
49
|
-
|
46
|
+
readonly rest: undefined;
|
47
|
+
readonly rpc: undefined;
|
48
|
+
readonly nodeProvider: undefined;
|
49
|
+
readonly evm?: Omit<EVMInfo, "rpc"> & {
|
50
|
+
readonly rpc: undefined;
|
50
51
|
};
|
51
52
|
};
|
package/build/ethereum.d.ts
CHANGED
package/build/wallet/keplr.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
/// <reference types="node" />
|
1
2
|
import { ChainInfo, ChainInfoWithoutEndpoints } from "../chain-info";
|
2
3
|
import { EthSignType } from "../ethereum";
|
3
4
|
import { BroadcastMode, AminoSignResponse, StdSignDoc, OfflineAminoSigner, StdSignature, DirectSignResponse, OfflineDirectSigner } from "../cosmjs";
|
@@ -5,12 +6,14 @@ import { SecretUtils } from "../secretjs";
|
|
5
6
|
import Long from "long";
|
6
7
|
import { SettledResponses } from "../settled";
|
7
8
|
import { DirectAuxSignResponse } from "../cosmjs-alt";
|
9
|
+
import EventEmitter from "events";
|
8
10
|
export interface Key {
|
9
11
|
readonly name: string;
|
10
12
|
readonly algo: string;
|
11
13
|
readonly pubKey: Uint8Array;
|
12
14
|
readonly address: Uint8Array;
|
13
15
|
readonly bech32Address: string;
|
16
|
+
readonly ethereumHexAddress: string;
|
14
17
|
readonly isNanoLedger: boolean;
|
15
18
|
readonly isKeystone: boolean;
|
16
19
|
}
|
@@ -119,6 +122,7 @@ export interface Keplr {
|
|
119
122
|
primaryType: string;
|
120
123
|
}, signDoc: StdSignDoc, signOptions?: KeplrSignOptions): Promise<AminoSignResponse>;
|
121
124
|
getChainInfosWithoutEndpoints(): Promise<ChainInfoWithoutEndpoints[]>;
|
125
|
+
getChainInfoWithoutEndpoints(chainId: string): Promise<ChainInfoWithoutEndpoints>;
|
122
126
|
/** Change wallet extension user name **/
|
123
127
|
changeKeyRingName(opts: {
|
124
128
|
defaultName: string;
|
@@ -126,4 +130,19 @@ export interface Keplr {
|
|
126
130
|
}): Promise<string>;
|
127
131
|
sendEthereumTx(chainId: string, tx: Uint8Array): Promise<string>;
|
128
132
|
suggestERC20(chainId: string, contractAddress: string): Promise<void>;
|
133
|
+
readonly ethereum: IEthereumProvider;
|
134
|
+
}
|
135
|
+
export interface IEthereumProvider extends EventEmitter {
|
136
|
+
readonly chainId: string | null;
|
137
|
+
readonly networkVersion: string | null;
|
138
|
+
readonly selectedAddress: string | null;
|
139
|
+
readonly isKeplr: boolean;
|
140
|
+
readonly isMetaMask: boolean;
|
141
|
+
isConnected(): boolean;
|
142
|
+
request<T>({ method, params, }: {
|
143
|
+
method: string;
|
144
|
+
params?: unknown[] | Record<string, unknown>;
|
145
|
+
}): Promise<T>;
|
146
|
+
enable(): Promise<string[]>;
|
147
|
+
net_version(): Promise<string>;
|
129
148
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@keplr-wallet/types",
|
3
|
-
"version": "0.12.
|
3
|
+
"version": "0.12.99-rc.1",
|
4
4
|
"main": "build/index.js",
|
5
5
|
"author": "chainapsis",
|
6
6
|
"license": "Apache-2.0",
|
@@ -18,5 +18,5 @@
|
|
18
18
|
"dependencies": {
|
19
19
|
"long": "^4.0.0"
|
20
20
|
},
|
21
|
-
"gitHead": "
|
21
|
+
"gitHead": "4b4fd93e79c4d3429a127fbd158d584f5d48591c"
|
22
22
|
}
|
package/src/chain-info.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Currency, AppCurrency, FeeCurrency } from "./currency";
|
2
2
|
import { BIP44 } from "./bip44";
|
3
3
|
import { Bech32Config } from "./bech32";
|
4
|
+
import { EVMInfo } from "./ethereum";
|
4
5
|
|
5
6
|
export interface ChainInfo {
|
6
7
|
readonly rpc: string;
|
@@ -46,17 +47,17 @@ export interface ChainInfo {
|
|
46
47
|
|
47
48
|
readonly hideInUI?: boolean;
|
48
49
|
|
49
|
-
readonly evm?:
|
50
|
-
chainId: number;
|
51
|
-
rpc: string;
|
52
|
-
};
|
50
|
+
readonly evm?: EVMInfo;
|
53
51
|
}
|
54
52
|
|
55
53
|
export type ChainInfoWithoutEndpoints = Omit<
|
56
54
|
ChainInfo,
|
57
55
|
"rest" | "rpc" | "nodeProvider" | "evm"
|
58
56
|
> & {
|
59
|
-
|
60
|
-
|
57
|
+
readonly rest: undefined;
|
58
|
+
readonly rpc: undefined;
|
59
|
+
readonly nodeProvider: undefined;
|
60
|
+
readonly evm?: Omit<EVMInfo, "rpc"> & {
|
61
|
+
readonly rpc: undefined;
|
61
62
|
};
|
62
63
|
};
|
package/src/ethereum.ts
CHANGED
@@ -40,3 +40,13 @@ export interface EthTxReceipt {
|
|
40
40
|
type: number;
|
41
41
|
status?: EthTxStatus;
|
42
42
|
}
|
43
|
+
|
44
|
+
export interface EVMInfo {
|
45
|
+
chainId: number;
|
46
|
+
rpc: string;
|
47
|
+
}
|
48
|
+
|
49
|
+
export interface EthereumSignResponse {
|
50
|
+
signingData: Uint8Array;
|
51
|
+
signature: Uint8Array;
|
52
|
+
}
|
package/src/wallet/keplr.ts
CHANGED
@@ -13,6 +13,7 @@ import { SecretUtils } from "../secretjs";
|
|
13
13
|
import Long from "long";
|
14
14
|
import { SettledResponses } from "../settled";
|
15
15
|
import { DirectAuxSignResponse } from "../cosmjs-alt";
|
16
|
+
import EventEmitter from "events";
|
16
17
|
|
17
18
|
export interface Key {
|
18
19
|
// Name of the selected key store.
|
@@ -21,6 +22,7 @@ export interface Key {
|
|
21
22
|
readonly pubKey: Uint8Array;
|
22
23
|
readonly address: Uint8Array;
|
23
24
|
readonly bech32Address: string;
|
25
|
+
readonly ethereumHexAddress: string;
|
24
26
|
// Indicate whether the selected account is from the nano ledger.
|
25
27
|
// Because current cosmos app in the nano ledger doesn't support the direct (proto) format msgs,
|
26
28
|
// this can be used to select the amino or direct signer.
|
@@ -227,6 +229,9 @@ export interface Keplr {
|
|
227
229
|
): Promise<AminoSignResponse>;
|
228
230
|
|
229
231
|
getChainInfosWithoutEndpoints(): Promise<ChainInfoWithoutEndpoints[]>;
|
232
|
+
getChainInfoWithoutEndpoints(
|
233
|
+
chainId: string
|
234
|
+
): Promise<ChainInfoWithoutEndpoints>;
|
230
235
|
|
231
236
|
/** Change wallet extension user name **/
|
232
237
|
changeKeyRingName(opts: {
|
@@ -237,4 +242,31 @@ export interface Keplr {
|
|
237
242
|
sendEthereumTx(chainId: string, tx: Uint8Array): Promise<string>;
|
238
243
|
|
239
244
|
suggestERC20(chainId: string, contractAddress: string): Promise<void>;
|
245
|
+
|
246
|
+
readonly ethereum: IEthereumProvider;
|
247
|
+
}
|
248
|
+
|
249
|
+
export interface IEthereumProvider extends EventEmitter {
|
250
|
+
// It must be in the hexadecimal format used in EVM-based chains, not the format used in Tendermint nodes.
|
251
|
+
readonly chainId: string | null;
|
252
|
+
// It must be in the decimal format of chainId.
|
253
|
+
readonly networkVersion: string | null;
|
254
|
+
|
255
|
+
readonly selectedAddress: string | null;
|
256
|
+
|
257
|
+
readonly isKeplr: boolean;
|
258
|
+
readonly isMetaMask: boolean;
|
259
|
+
|
260
|
+
isConnected(): boolean;
|
261
|
+
|
262
|
+
request<T>({
|
263
|
+
method,
|
264
|
+
params,
|
265
|
+
}: {
|
266
|
+
method: string;
|
267
|
+
params?: unknown[] | Record<string, unknown>;
|
268
|
+
}): Promise<T>;
|
269
|
+
|
270
|
+
enable(): Promise<string[]>;
|
271
|
+
net_version(): Promise<string>;
|
240
272
|
}
|