@keplr-wallet/types 0.12.131 → 0.12.133-rc.0
Sign up to get free protection for your applications and to get access to all the features.
- package/build/chain-info.d.ts +20 -1
- package/build/wallet/eip6963.d.ts +1 -1
- package/build/wallet/ethereum.d.ts +17 -0
- package/build/wallet/ethereum.js +3 -0
- package/build/wallet/ethereum.js.map +1 -0
- package/build/wallet/index.d.ts +2 -0
- package/build/wallet/index.js +2 -0
- package/build/wallet/index.js.map +1 -1
- package/build/wallet/keplr.d.ts +25 -17
- package/build/wallet/starknet.d.ts +59 -0
- package/build/wallet/starknet.js +3 -0
- package/build/wallet/starknet.js.map +1 -0
- package/package.json +5 -2
- package/src/chain-info.ts +25 -1
- package/src/wallet/eip6963.ts +1 -1
- package/src/wallet/ethereum.ts +28 -0
- package/src/wallet/index.ts +2 -0
- package/src/wallet/keplr.ts +39 -27
- package/src/wallet/starknet.ts +75 -0
package/build/chain-info.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Currency, AppCurrency, FeeCurrency } from "./currency";
|
1
|
+
import { Currency, AppCurrency, FeeCurrency, ERC20Currency } from "./currency";
|
2
2
|
import { BIP44 } from "./bip44";
|
3
3
|
import { Bech32Config } from "./bech32";
|
4
4
|
import { EVMInfo } from "./ethereum";
|
@@ -51,3 +51,22 @@ export type ChainInfoWithoutEndpoints = Omit<ChainInfo, "rest" | "rpc" | "nodePr
|
|
51
51
|
readonly rpc: undefined;
|
52
52
|
};
|
53
53
|
};
|
54
|
+
export interface StarknetChainInfo {
|
55
|
+
readonly chainId: string;
|
56
|
+
readonly rpc: string;
|
57
|
+
readonly currencies: ERC20Currency[];
|
58
|
+
readonly ethContractAddress: string;
|
59
|
+
readonly strkContractAddress: string;
|
60
|
+
}
|
61
|
+
export type ChainInfoModule = "cosmos" | "starknet";
|
62
|
+
export type ModularChainInfo = {
|
63
|
+
readonly chainId: string;
|
64
|
+
readonly chainName: string;
|
65
|
+
readonly chainSymbolImageUrl?: string;
|
66
|
+
readonly cosmos: ChainInfo;
|
67
|
+
} | {
|
68
|
+
readonly chainId: string;
|
69
|
+
readonly chainName: string;
|
70
|
+
readonly chainSymbolImageUrl?: string;
|
71
|
+
readonly starknet: StarknetChainInfo;
|
72
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import EventEmitter from "events";
|
3
|
+
export interface IEthereumProvider extends EventEmitter {
|
4
|
+
readonly chainId: string | null;
|
5
|
+
readonly networkVersion: string | null;
|
6
|
+
readonly selectedAddress: string | null;
|
7
|
+
readonly isKeplr: boolean;
|
8
|
+
readonly isMetaMask: boolean;
|
9
|
+
isConnected(): boolean;
|
10
|
+
request<T = unknown>({ method, params, chainId, }: {
|
11
|
+
method: string;
|
12
|
+
params?: readonly unknown[] | Record<string, unknown>;
|
13
|
+
chainId?: string;
|
14
|
+
}): Promise<T>;
|
15
|
+
enable(): Promise<string[]>;
|
16
|
+
net_version(): Promise<string>;
|
17
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ethereum.js","sourceRoot":"","sources":["../../src/wallet/ethereum.ts"],"names":[],"mappings":""}
|
package/build/wallet/index.d.ts
CHANGED
package/build/wallet/index.js
CHANGED
@@ -16,4 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
17
|
__exportStar(require("./keplr"), exports);
|
18
18
|
__exportStar(require("./eip6963"), exports);
|
19
|
+
__exportStar(require("./ethereum"), exports);
|
20
|
+
__exportStar(require("./starknet"), exports);
|
19
21
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/wallet/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,4CAA0B"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/wallet/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,4CAA0B;AAC1B,6CAA2B;AAC3B,6CAA2B"}
|
package/build/wallet/keplr.d.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
/// <reference types="node" />
|
2
1
|
import { ChainInfo, ChainInfoWithoutEndpoints } from "../chain-info";
|
3
2
|
import { EthSignType } from "../ethereum";
|
4
3
|
import { BroadcastMode, AminoSignResponse, StdSignDoc, OfflineAminoSigner, StdSignature, DirectSignResponse, OfflineDirectSigner } from "../cosmjs";
|
@@ -6,7 +5,9 @@ import { SecretUtils } from "../secretjs";
|
|
6
5
|
import Long from "long";
|
7
6
|
import { SettledResponses } from "../settled";
|
8
7
|
import { DirectAuxSignResponse } from "../cosmjs-alt";
|
9
|
-
import
|
8
|
+
import { IEthereumProvider } from "./ethereum";
|
9
|
+
import { IStarknetProvider } from "./starknet";
|
10
|
+
import { Call, DeployAccountSignerDetails, InvocationsSignerDetails } from "starknet";
|
10
11
|
export interface Key {
|
11
12
|
readonly name: string;
|
12
13
|
readonly algo: string;
|
@@ -130,20 +131,27 @@ export interface Keplr {
|
|
130
131
|
}): Promise<string>;
|
131
132
|
sendEthereumTx(chainId: string, tx: Uint8Array): Promise<string>;
|
132
133
|
suggestERC20(chainId: string, contractAddress: string): Promise<void>;
|
134
|
+
getStarknetKey(chainId: string): Promise<{
|
135
|
+
name: string;
|
136
|
+
hexAddress: string;
|
137
|
+
pubKey: Uint8Array;
|
138
|
+
address: Uint8Array;
|
139
|
+
}>;
|
140
|
+
getStarknetKeysSettled(chainIds: string[]): Promise<SettledResponses<{
|
141
|
+
name: string;
|
142
|
+
hexAddress: string;
|
143
|
+
pubKey: Uint8Array;
|
144
|
+
address: Uint8Array;
|
145
|
+
}>>;
|
146
|
+
signStarknetDeployAccountTransaction(chainId: string, transaction: DeployAccountSignerDetails): Promise<{
|
147
|
+
transaction: DeployAccountSignerDetails;
|
148
|
+
signature: string[];
|
149
|
+
}>;
|
150
|
+
signStarknetTx(chainId: string, transactions: Call[], details: InvocationsSignerDetails): Promise<{
|
151
|
+
transactions: Call[];
|
152
|
+
details: InvocationsSignerDetails;
|
153
|
+
signature: string[];
|
154
|
+
}>;
|
133
155
|
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 = unknown>({ method, params, chainId, }: {
|
143
|
-
method: string;
|
144
|
-
params?: readonly unknown[] | Record<string, unknown>;
|
145
|
-
chainId?: string;
|
146
|
-
}): Promise<T>;
|
147
|
-
enable(): Promise<string[]>;
|
148
|
-
net_version(): Promise<string>;
|
156
|
+
readonly starknet: IStarknetProvider;
|
149
157
|
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import { AccountInterface, ProviderInterface } from "starknet";
|
2
|
+
export type AccountChangeEventHandler = (accounts: string[]) => void;
|
3
|
+
export type NetworkChangeEventHandler = (network?: string) => void;
|
4
|
+
export type WalletEvents = {
|
5
|
+
type: "accountsChanged";
|
6
|
+
handler: AccountChangeEventHandler;
|
7
|
+
} | {
|
8
|
+
type: "networkChanged";
|
9
|
+
handler: NetworkChangeEventHandler;
|
10
|
+
};
|
11
|
+
export interface WatchAssetParameters {
|
12
|
+
type: "ERC20";
|
13
|
+
options: {
|
14
|
+
address: string;
|
15
|
+
symbol?: string;
|
16
|
+
decimals?: number;
|
17
|
+
image?: string;
|
18
|
+
name?: string;
|
19
|
+
};
|
20
|
+
}
|
21
|
+
export interface AddStarknetChainParameters {
|
22
|
+
id: string;
|
23
|
+
chainId: string;
|
24
|
+
chainName: string;
|
25
|
+
baseUrl: string;
|
26
|
+
rpcUrls?: string[];
|
27
|
+
blockExplorerUrls?: string[];
|
28
|
+
nativeCurrency?: {
|
29
|
+
address: string;
|
30
|
+
name: string;
|
31
|
+
symbol: string;
|
32
|
+
decimals: number;
|
33
|
+
};
|
34
|
+
iconUrls?: string[];
|
35
|
+
}
|
36
|
+
export interface SwitchStarknetChainParameter {
|
37
|
+
chainId: string;
|
38
|
+
}
|
39
|
+
export interface IStarknetProvider {
|
40
|
+
id: string;
|
41
|
+
name: string;
|
42
|
+
version: string;
|
43
|
+
icon: string;
|
44
|
+
isConnected: boolean;
|
45
|
+
account?: AccountInterface;
|
46
|
+
provider?: ProviderInterface;
|
47
|
+
selectedAddress?: string;
|
48
|
+
chainId?: string;
|
49
|
+
request<T = unknown>({ type, params, }: {
|
50
|
+
type: string;
|
51
|
+
params?: any;
|
52
|
+
}): Promise<T>;
|
53
|
+
enable(options?: {
|
54
|
+
starknetVersion?: "v4" | "v5";
|
55
|
+
}): Promise<string[]>;
|
56
|
+
isPreauthorized(): Promise<boolean>;
|
57
|
+
on<E extends WalletEvents>(event: E["type"], handleEvent: E["handler"]): void;
|
58
|
+
off<E extends WalletEvents>(event: E["type"], handleEvent: E["handler"]): void;
|
59
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"starknet.js","sourceRoot":"","sources":["../../src/wallet/starknet.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@keplr-wallet/types",
|
3
|
-
"version": "0.12.
|
3
|
+
"version": "0.12.133-rc.0",
|
4
4
|
"main": "build/index.js",
|
5
5
|
"author": "chainapsis",
|
6
6
|
"license": "Apache-2.0",
|
@@ -18,5 +18,8 @@
|
|
18
18
|
"dependencies": {
|
19
19
|
"long": "^4.0.0"
|
20
20
|
},
|
21
|
-
"
|
21
|
+
"peerDependencies": {
|
22
|
+
"starknet": "^6"
|
23
|
+
},
|
24
|
+
"gitHead": "6496cf28fc619e718b4e2e9e347755730292745b"
|
22
25
|
}
|
package/src/chain-info.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Currency, AppCurrency, FeeCurrency } from "./currency";
|
1
|
+
import { Currency, AppCurrency, FeeCurrency, ERC20Currency } from "./currency";
|
2
2
|
import { BIP44 } from "./bip44";
|
3
3
|
import { Bech32Config } from "./bech32";
|
4
4
|
import { EVMInfo } from "./ethereum";
|
@@ -62,3 +62,27 @@ export type ChainInfoWithoutEndpoints = Omit<
|
|
62
62
|
readonly rpc: undefined;
|
63
63
|
};
|
64
64
|
};
|
65
|
+
|
66
|
+
export interface StarknetChainInfo {
|
67
|
+
readonly chainId: string;
|
68
|
+
readonly rpc: string;
|
69
|
+
readonly currencies: ERC20Currency[];
|
70
|
+
readonly ethContractAddress: string;
|
71
|
+
readonly strkContractAddress: string;
|
72
|
+
}
|
73
|
+
|
74
|
+
export type ChainInfoModule = "cosmos" | "starknet";
|
75
|
+
|
76
|
+
export type ModularChainInfo =
|
77
|
+
| {
|
78
|
+
readonly chainId: string;
|
79
|
+
readonly chainName: string;
|
80
|
+
readonly chainSymbolImageUrl?: string;
|
81
|
+
readonly cosmos: ChainInfo;
|
82
|
+
}
|
83
|
+
| {
|
84
|
+
readonly chainId: string;
|
85
|
+
readonly chainName: string;
|
86
|
+
readonly chainSymbolImageUrl?: string;
|
87
|
+
readonly starknet: StarknetChainInfo;
|
88
|
+
};
|
package/src/wallet/eip6963.ts
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
import EventEmitter from "events";
|
2
|
+
|
3
|
+
export interface IEthereumProvider extends EventEmitter {
|
4
|
+
// It must be in the hexadecimal format used in EVM-based chains, not the format used in Tendermint nodes.
|
5
|
+
readonly chainId: string | null;
|
6
|
+
// It must be in the decimal format of chainId.
|
7
|
+
readonly networkVersion: string | null;
|
8
|
+
|
9
|
+
readonly selectedAddress: string | null;
|
10
|
+
|
11
|
+
readonly isKeplr: boolean;
|
12
|
+
readonly isMetaMask: boolean;
|
13
|
+
|
14
|
+
isConnected(): boolean;
|
15
|
+
|
16
|
+
request<T = unknown>({
|
17
|
+
method,
|
18
|
+
params,
|
19
|
+
chainId,
|
20
|
+
}: {
|
21
|
+
method: string;
|
22
|
+
params?: readonly unknown[] | Record<string, unknown>;
|
23
|
+
chainId?: string;
|
24
|
+
}): Promise<T>;
|
25
|
+
|
26
|
+
enable(): Promise<string[]>;
|
27
|
+
net_version(): Promise<string>;
|
28
|
+
}
|
package/src/wallet/index.ts
CHANGED
package/src/wallet/keplr.ts
CHANGED
@@ -13,7 +13,13 @@ 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
|
16
|
+
import { IEthereumProvider } from "./ethereum";
|
17
|
+
import { IStarknetProvider } from "./starknet";
|
18
|
+
import {
|
19
|
+
Call,
|
20
|
+
DeployAccountSignerDetails,
|
21
|
+
InvocationsSignerDetails,
|
22
|
+
} from "starknet";
|
17
23
|
|
18
24
|
export interface Key {
|
19
25
|
// Name of the selected key store.
|
@@ -243,32 +249,38 @@ export interface Keplr {
|
|
243
249
|
|
244
250
|
suggestERC20(chainId: string, contractAddress: string): Promise<void>;
|
245
251
|
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
252
|
+
getStarknetKey(chainId: string): Promise<{
|
253
|
+
name: string;
|
254
|
+
hexAddress: string;
|
255
|
+
pubKey: Uint8Array;
|
256
|
+
address: Uint8Array;
|
257
|
+
}>;
|
258
|
+
getStarknetKeysSettled(chainIds: string[]): Promise<
|
259
|
+
SettledResponses<{
|
260
|
+
name: string;
|
261
|
+
hexAddress: string;
|
262
|
+
pubKey: Uint8Array;
|
263
|
+
address: Uint8Array;
|
264
|
+
}>
|
265
|
+
>;
|
266
|
+
signStarknetDeployAccountTransaction(
|
267
|
+
chainId: string,
|
268
|
+
transaction: DeployAccountSignerDetails
|
269
|
+
): Promise<{
|
270
|
+
transaction: DeployAccountSignerDetails;
|
271
|
+
signature: string[];
|
272
|
+
}>;
|
273
|
+
signStarknetTx(
|
274
|
+
chainId: string,
|
275
|
+
transactions: Call[],
|
276
|
+
details: InvocationsSignerDetails
|
277
|
+
): Promise<{
|
278
|
+
transactions: Call[];
|
279
|
+
details: InvocationsSignerDetails;
|
280
|
+
signature: string[];
|
281
|
+
}>;
|
261
282
|
|
262
|
-
|
263
|
-
method,
|
264
|
-
params,
|
265
|
-
chainId,
|
266
|
-
}: {
|
267
|
-
method: string;
|
268
|
-
params?: readonly unknown[] | Record<string, unknown>;
|
269
|
-
chainId?: string;
|
270
|
-
}): Promise<T>;
|
283
|
+
readonly ethereum: IEthereumProvider;
|
271
284
|
|
272
|
-
|
273
|
-
net_version(): Promise<string>;
|
285
|
+
readonly starknet: IStarknetProvider;
|
274
286
|
}
|
@@ -0,0 +1,75 @@
|
|
1
|
+
import { AccountInterface, ProviderInterface } from "starknet";
|
2
|
+
|
3
|
+
export type AccountChangeEventHandler = (accounts: string[]) => void;
|
4
|
+
|
5
|
+
export type NetworkChangeEventHandler = (network?: string) => void;
|
6
|
+
|
7
|
+
export type WalletEvents =
|
8
|
+
| {
|
9
|
+
type: "accountsChanged";
|
10
|
+
handler: AccountChangeEventHandler;
|
11
|
+
}
|
12
|
+
| {
|
13
|
+
type: "networkChanged";
|
14
|
+
handler: NetworkChangeEventHandler;
|
15
|
+
};
|
16
|
+
|
17
|
+
export interface WatchAssetParameters {
|
18
|
+
type: "ERC20";
|
19
|
+
options: {
|
20
|
+
address: string;
|
21
|
+
symbol?: string;
|
22
|
+
decimals?: number;
|
23
|
+
image?: string;
|
24
|
+
name?: string;
|
25
|
+
};
|
26
|
+
}
|
27
|
+
|
28
|
+
export interface AddStarknetChainParameters {
|
29
|
+
id: string;
|
30
|
+
chainId: string;
|
31
|
+
chainName: string;
|
32
|
+
baseUrl: string;
|
33
|
+
rpcUrls?: string[];
|
34
|
+
blockExplorerUrls?: string[];
|
35
|
+
nativeCurrency?: {
|
36
|
+
address: string;
|
37
|
+
name: string;
|
38
|
+
symbol: string;
|
39
|
+
decimals: number;
|
40
|
+
};
|
41
|
+
iconUrls?: string[];
|
42
|
+
}
|
43
|
+
|
44
|
+
export interface SwitchStarknetChainParameter {
|
45
|
+
chainId: string; // A 0x-prefixed hexadecimal string
|
46
|
+
}
|
47
|
+
|
48
|
+
export interface IStarknetProvider {
|
49
|
+
id: string;
|
50
|
+
name: string;
|
51
|
+
version: string;
|
52
|
+
icon: string;
|
53
|
+
|
54
|
+
isConnected: boolean;
|
55
|
+
|
56
|
+
account?: AccountInterface;
|
57
|
+
provider?: ProviderInterface;
|
58
|
+
selectedAddress?: string;
|
59
|
+
chainId?: string;
|
60
|
+
|
61
|
+
request<T = unknown>({
|
62
|
+
type,
|
63
|
+
params,
|
64
|
+
}: {
|
65
|
+
type: string;
|
66
|
+
params?: any;
|
67
|
+
}): Promise<T>;
|
68
|
+
enable(options?: { starknetVersion?: "v4" | "v5" }): Promise<string[]>;
|
69
|
+
isPreauthorized(): Promise<boolean>;
|
70
|
+
on<E extends WalletEvents>(event: E["type"], handleEvent: E["handler"]): void;
|
71
|
+
off<E extends WalletEvents>(
|
72
|
+
event: E["type"],
|
73
|
+
handleEvent: E["handler"]
|
74
|
+
): void;
|
75
|
+
}
|