@keplr-wallet/provider 0.12.0-alpha.0 → 0.12.0-alpha.2
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/LICENSE +8 -2
- package/build/core-types.d.ts +3 -0
- package/build/core-types.js +3 -0
- package/build/core-types.js.map +1 -0
- package/build/core.d.ts +26 -13
- package/build/core.js +136 -94
- package/build/core.js.map +1 -1
- package/build/cosmjs.d.ts +3 -9
- package/build/cosmjs.js +0 -2
- package/build/cosmjs.js.map +1 -1
- package/build/enigma.d.ts +1 -2
- package/build/enigma.js.map +1 -1
- package/build/index.js +5 -1
- package/build/index.js.map +1 -1
- package/build/inject.d.ts +27 -11
- package/build/inject.js +126 -21
- package/build/inject.js.map +1 -1
- package/package.json +6 -10
- package/src/core-types.ts +3 -0
- package/src/core.ts +295 -160
- package/src/cosmjs.ts +10 -12
- package/src/enigma.ts +1 -2
- package/src/inject.ts +166 -18
- package/build/types/index.d.ts +0 -1
- package/build/types/index.js +0 -14
- package/build/types/index.js.map +0 -1
- package/build/types/msgs.d.ts +0 -150
- package/build/types/msgs.js +0 -390
- package/build/types/msgs.js.map +0 -1
- package/src/types/index.ts +0 -1
- package/src/types/msgs.ts +0 -493
package/src/core.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import { ChainIdHelper } from "@keplr-wallet/cosmos";
|
2
1
|
import {
|
3
2
|
ChainInfo,
|
4
3
|
EthSignType,
|
@@ -7,44 +6,34 @@ import {
|
|
7
6
|
KeplrMode,
|
8
7
|
KeplrSignOptions,
|
9
8
|
Key,
|
10
|
-
} from "@keplr-wallet/types";
|
11
|
-
import { BACKGROUND_PORT, MessageRequester } from "@keplr-wallet/router";
|
12
|
-
import {
|
13
9
|
BroadcastMode,
|
14
10
|
AminoSignResponse,
|
15
11
|
StdSignDoc,
|
16
12
|
StdTx,
|
17
|
-
|
13
|
+
OfflineAminoSigner,
|
18
14
|
StdSignature,
|
19
|
-
|
15
|
+
DirectSignResponse,
|
16
|
+
OfflineDirectSigner,
|
17
|
+
ICNSAdr36Signatures,
|
18
|
+
ChainInfoWithoutEndpoints,
|
19
|
+
SecretUtils,
|
20
|
+
SettledResponses,
|
21
|
+
} from "@keplr-wallet/types";
|
20
22
|
import {
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
SendTxMsg,
|
26
|
-
GetSecret20ViewingKey,
|
27
|
-
RequestSignAminoMsg,
|
28
|
-
RequestSignDirectMsg,
|
29
|
-
GetPubkeyMsg,
|
30
|
-
ReqeustEncryptMsg,
|
31
|
-
RequestDecryptMsg,
|
32
|
-
GetTxEncryptionKeyMsg,
|
33
|
-
RequestVerifyADR36AminoSignDoc,
|
34
|
-
} from "./types";
|
35
|
-
import { SecretUtils } from "secretjs/types/enigmautils";
|
23
|
+
BACKGROUND_PORT,
|
24
|
+
MessageRequester,
|
25
|
+
sendSimpleMessage,
|
26
|
+
} from "@keplr-wallet/router";
|
36
27
|
|
37
28
|
import { KeplrEnigmaUtils } from "./enigma";
|
38
|
-
import { DirectSignResponse, OfflineDirectSigner } from "@cosmjs/proto-signing";
|
39
29
|
|
40
30
|
import { CosmJSOfflineSigner, CosmJSOfflineSignerOnlyAmino } from "./cosmjs";
|
41
31
|
import deepmerge from "deepmerge";
|
42
32
|
import Long from "long";
|
43
33
|
import { Buffer } from "buffer/";
|
34
|
+
import { KeplrCoreTypes } from "./core-types";
|
44
35
|
|
45
|
-
|
46
|
-
|
47
|
-
export class Keplr implements IKeplr {
|
36
|
+
export class Keplr implements IKeplr, KeplrCoreTypes {
|
48
37
|
protected enigmaUtils: Map<string, SecretUtils> = new Map();
|
49
38
|
|
50
39
|
public defaultOptions: KeplrIntereactionOptions = {};
|
@@ -60,14 +49,35 @@ export class Keplr implements IKeplr {
|
|
60
49
|
chainIds = [chainIds];
|
61
50
|
}
|
62
51
|
|
63
|
-
await
|
52
|
+
await sendSimpleMessage(
|
53
|
+
this.requester,
|
64
54
|
BACKGROUND_PORT,
|
65
|
-
|
55
|
+
"permission-interactive",
|
56
|
+
"enable-access",
|
57
|
+
{
|
58
|
+
chainIds,
|
59
|
+
}
|
60
|
+
);
|
61
|
+
}
|
62
|
+
|
63
|
+
async disable(chainIds?: string | string[]): Promise<void> {
|
64
|
+
if (typeof chainIds === "string") {
|
65
|
+
chainIds = [chainIds];
|
66
|
+
}
|
67
|
+
|
68
|
+
await sendSimpleMessage(
|
69
|
+
this.requester,
|
70
|
+
BACKGROUND_PORT,
|
71
|
+
"permission-interactive",
|
72
|
+
"disable-access",
|
73
|
+
{
|
74
|
+
chainIds: chainIds ?? [],
|
75
|
+
}
|
66
76
|
);
|
67
77
|
}
|
68
78
|
|
69
79
|
async experimentalSuggestChain(
|
70
|
-
|
80
|
+
chainInfo: ChainInfo & {
|
71
81
|
// Legacy
|
72
82
|
gasPriceStep?: {
|
73
83
|
readonly low: number;
|
@@ -76,40 +86,21 @@ export class Keplr implements IKeplr {
|
|
76
86
|
};
|
77
87
|
}
|
78
88
|
): Promise<void> {
|
79
|
-
const chainIdentifier = ChainIdHelper.parse(suggestingChainInfo.chainId)
|
80
|
-
.identifier;
|
81
|
-
// TODO: 테스트 끝나면 chainapsis public repo URL로 바꿔야 한다.
|
82
|
-
const chainInfoResponse = await fetch(
|
83
|
-
`https://raw.githubusercontent.com/danielkim89/cicd-test/main/cosmos/${chainIdentifier}.json`
|
84
|
-
);
|
85
|
-
let chainInfo: Writeable<
|
86
|
-
ChainInfo & {
|
87
|
-
// Legacy
|
88
|
-
gasPriceStep?: {
|
89
|
-
readonly low: number;
|
90
|
-
readonly average: number;
|
91
|
-
readonly high: number;
|
92
|
-
};
|
93
|
-
}
|
94
|
-
> = suggestingChainInfo;
|
95
|
-
if (chainInfoResponse.ok) {
|
96
|
-
chainInfo = await chainInfoResponse.json();
|
97
|
-
chainInfo.isFromCommunity = true;
|
98
|
-
}
|
99
|
-
|
100
89
|
if (chainInfo.gasPriceStep) {
|
101
90
|
// Gas price step in ChainInfo is legacy format.
|
102
91
|
// Try to change the recent format for backward-compatibility.
|
103
92
|
const gasPriceStep = { ...chainInfo.gasPriceStep };
|
104
93
|
for (const feeCurrency of chainInfo.feeCurrencies) {
|
105
94
|
if (!feeCurrency.gasPriceStep) {
|
106
|
-
(
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
95
|
+
(
|
96
|
+
feeCurrency as {
|
97
|
+
gasPriceStep?: {
|
98
|
+
readonly low: number;
|
99
|
+
readonly average: number;
|
100
|
+
readonly high: number;
|
101
|
+
};
|
102
|
+
}
|
103
|
+
).gasPriceStep = gasPriceStep;
|
113
104
|
}
|
114
105
|
}
|
115
106
|
delete chainInfo.gasPriceStep;
|
@@ -119,13 +110,58 @@ export class Keplr implements IKeplr {
|
|
119
110
|
);
|
120
111
|
}
|
121
112
|
|
122
|
-
|
123
|
-
|
113
|
+
if ((chainInfo as any).coinType) {
|
114
|
+
console.warn(
|
115
|
+
"The `coinType` field of the `ChainInfo` is removed. This is automatically handled as of right now, but the upcoming update would potentially cause errors."
|
116
|
+
);
|
117
|
+
delete (chainInfo as any).coinType;
|
118
|
+
}
|
119
|
+
|
120
|
+
return await sendSimpleMessage(
|
121
|
+
this.requester,
|
122
|
+
BACKGROUND_PORT,
|
123
|
+
"chains",
|
124
|
+
"suggest-chain-info",
|
125
|
+
{
|
126
|
+
chainInfo,
|
127
|
+
}
|
128
|
+
);
|
124
129
|
}
|
125
130
|
|
126
131
|
async getKey(chainId: string): Promise<Key> {
|
127
|
-
|
128
|
-
|
132
|
+
return await sendSimpleMessage(
|
133
|
+
this.requester,
|
134
|
+
BACKGROUND_PORT,
|
135
|
+
"keyring-cosmos",
|
136
|
+
"get-cosmos-key",
|
137
|
+
{
|
138
|
+
chainId,
|
139
|
+
}
|
140
|
+
);
|
141
|
+
}
|
142
|
+
|
143
|
+
async getKeysSettled(chainIds: string[]): Promise<SettledResponses<Key>> {
|
144
|
+
return await sendSimpleMessage(
|
145
|
+
this.requester,
|
146
|
+
BACKGROUND_PORT,
|
147
|
+
"keyring-cosmos",
|
148
|
+
"get-cosmos-keys-settled",
|
149
|
+
{
|
150
|
+
chainIds,
|
151
|
+
}
|
152
|
+
);
|
153
|
+
}
|
154
|
+
|
155
|
+
async getChainInfosWithoutEndpoints(): Promise<ChainInfoWithoutEndpoints[]> {
|
156
|
+
return (
|
157
|
+
await sendSimpleMessage(
|
158
|
+
this.requester,
|
159
|
+
BACKGROUND_PORT,
|
160
|
+
"chains",
|
161
|
+
"get-chain-infos-without-endpoints",
|
162
|
+
{}
|
163
|
+
)
|
164
|
+
).chainInfos;
|
129
165
|
}
|
130
166
|
|
131
167
|
async sendTx(
|
@@ -133,8 +169,17 @@ export class Keplr implements IKeplr {
|
|
133
169
|
tx: StdTx | Uint8Array,
|
134
170
|
mode: BroadcastMode
|
135
171
|
): Promise<Uint8Array> {
|
136
|
-
|
137
|
-
|
172
|
+
return await sendSimpleMessage(
|
173
|
+
this.requester,
|
174
|
+
BACKGROUND_PORT,
|
175
|
+
"background-tx",
|
176
|
+
"send-tx-to-background",
|
177
|
+
{
|
178
|
+
chainId,
|
179
|
+
tx,
|
180
|
+
mode,
|
181
|
+
}
|
182
|
+
);
|
138
183
|
}
|
139
184
|
|
140
185
|
async signAmino(
|
@@ -143,13 +188,18 @@ export class Keplr implements IKeplr {
|
|
143
188
|
signDoc: StdSignDoc,
|
144
189
|
signOptions: KeplrSignOptions = {}
|
145
190
|
): Promise<AminoSignResponse> {
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
191
|
+
return await sendSimpleMessage(
|
192
|
+
this.requester,
|
193
|
+
BACKGROUND_PORT,
|
194
|
+
"keyring-cosmos",
|
195
|
+
"request-cosmos-sign-amino",
|
196
|
+
{
|
197
|
+
chainId,
|
198
|
+
signer,
|
199
|
+
signDoc,
|
200
|
+
signOptions: deepmerge(this.defaultOptions.sign ?? {}, signOptions),
|
201
|
+
}
|
151
202
|
);
|
152
|
-
return await this.requester.sendMessage(BACKGROUND_PORT, msg);
|
153
203
|
}
|
154
204
|
|
155
205
|
async signDirect(
|
@@ -163,20 +213,25 @@ export class Keplr implements IKeplr {
|
|
163
213
|
},
|
164
214
|
signOptions: KeplrSignOptions = {}
|
165
215
|
): Promise<DirectSignResponse> {
|
166
|
-
const
|
167
|
-
|
168
|
-
|
216
|
+
const response = await sendSimpleMessage(
|
217
|
+
this.requester,
|
218
|
+
BACKGROUND_PORT,
|
219
|
+
"keyring-cosmos",
|
220
|
+
"request-cosmos-sign-direct",
|
169
221
|
{
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
:
|
176
|
-
|
177
|
-
|
222
|
+
chainId,
|
223
|
+
signer,
|
224
|
+
signDoc: {
|
225
|
+
bodyBytes: signDoc.bodyBytes,
|
226
|
+
authInfoBytes: signDoc.authInfoBytes,
|
227
|
+
chainId: signDoc.chainId,
|
228
|
+
accountNumber: signDoc.accountNumber
|
229
|
+
? signDoc.accountNumber.toString()
|
230
|
+
: null,
|
231
|
+
},
|
232
|
+
signOptions: deepmerge(this.defaultOptions.sign ?? {}, signOptions),
|
233
|
+
}
|
178
234
|
);
|
179
|
-
const response = await this.requester.sendMessage(BACKGROUND_PORT, msg);
|
180
235
|
|
181
236
|
return {
|
182
237
|
signed: {
|
@@ -194,14 +249,20 @@ export class Keplr implements IKeplr {
|
|
194
249
|
signer: string,
|
195
250
|
data: string | Uint8Array
|
196
251
|
): Promise<StdSignature> {
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
252
|
+
return await sendSimpleMessage(
|
253
|
+
this.requester,
|
254
|
+
BACKGROUND_PORT,
|
255
|
+
"keyring-cosmos",
|
256
|
+
"request-cosmos-sign-amino-adr-36",
|
257
|
+
{
|
258
|
+
chainId,
|
259
|
+
signer,
|
260
|
+
data: typeof data === "string" ? Buffer.from(data) : data,
|
261
|
+
signOptions: {
|
262
|
+
isADR36WithString: typeof data === "string",
|
263
|
+
},
|
264
|
+
}
|
265
|
+
);
|
205
266
|
}
|
206
267
|
|
207
268
|
async verifyArbitrary(
|
@@ -214,52 +275,62 @@ export class Keplr implements IKeplr {
|
|
214
275
|
data = Buffer.from(data);
|
215
276
|
}
|
216
277
|
|
217
|
-
return await
|
278
|
+
return await sendSimpleMessage(
|
279
|
+
this.requester,
|
218
280
|
BACKGROUND_PORT,
|
219
|
-
|
281
|
+
"keyring-cosmos",
|
282
|
+
"verify-cosmos-sign-amino-adr-36",
|
283
|
+
{
|
284
|
+
chainId,
|
285
|
+
signer,
|
286
|
+
data,
|
287
|
+
signature,
|
288
|
+
}
|
220
289
|
);
|
221
290
|
}
|
222
291
|
|
223
292
|
async signEthereum(
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
293
|
+
_chainId: string,
|
294
|
+
_signer: string,
|
295
|
+
_data: string | Uint8Array,
|
296
|
+
_type: EthSignType
|
228
297
|
): Promise<Uint8Array> {
|
229
|
-
|
230
|
-
|
231
|
-
"Unsupported Ethereum signing type: expected 'message' or 'transaction.'"
|
232
|
-
);
|
233
|
-
}
|
234
|
-
|
235
|
-
let isADR36WithString: boolean;
|
236
|
-
[data, isADR36WithString] = this.getDataForADR36(data);
|
237
|
-
const signDoc = this.getADR36SignDoc(signer, data);
|
238
|
-
|
239
|
-
if (data === "") {
|
240
|
-
throw new Error("Signing empty data is not supported.");
|
241
|
-
}
|
298
|
+
throw new Error("TODO");
|
299
|
+
}
|
242
300
|
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
301
|
+
async signICNSAdr36(
|
302
|
+
chainId: string,
|
303
|
+
contractAddress: string,
|
304
|
+
owner: string,
|
305
|
+
username: string,
|
306
|
+
addressChainIds: string[]
|
307
|
+
): Promise<ICNSAdr36Signatures> {
|
308
|
+
return await sendSimpleMessage(
|
309
|
+
this.requester,
|
310
|
+
BACKGROUND_PORT,
|
311
|
+
"keyring-cosmos",
|
312
|
+
"request-icns-adr-36-signatures-v2",
|
313
|
+
{
|
314
|
+
chainId,
|
315
|
+
contractAddress,
|
316
|
+
owner,
|
317
|
+
username,
|
318
|
+
addressChainIds,
|
319
|
+
}
|
320
|
+
);
|
250
321
|
}
|
251
322
|
|
252
|
-
getOfflineSigner(chainId: string):
|
323
|
+
getOfflineSigner(chainId: string): OfflineAminoSigner & OfflineDirectSigner {
|
253
324
|
return new CosmJSOfflineSigner(chainId, this);
|
254
325
|
}
|
255
326
|
|
256
|
-
getOfflineSignerOnlyAmino(chainId: string):
|
327
|
+
getOfflineSignerOnlyAmino(chainId: string): OfflineAminoSigner {
|
257
328
|
return new CosmJSOfflineSignerOnlyAmino(chainId, this);
|
258
329
|
}
|
259
330
|
|
260
331
|
async getOfflineSignerAuto(
|
261
332
|
chainId: string
|
262
|
-
): Promise<
|
333
|
+
): Promise<OfflineAminoSigner | OfflineDirectSigner> {
|
263
334
|
const key = await this.getKey(chainId);
|
264
335
|
if (key.isNanoLedger) {
|
265
336
|
return new CosmJSOfflineSignerOnlyAmino(chainId, this);
|
@@ -272,22 +343,44 @@ export class Keplr implements IKeplr {
|
|
272
343
|
contractAddress: string,
|
273
344
|
viewingKey?: string
|
274
345
|
): Promise<void> {
|
275
|
-
|
276
|
-
|
346
|
+
return await sendSimpleMessage(
|
347
|
+
this.requester,
|
348
|
+
BACKGROUND_PORT,
|
349
|
+
"token-cw20",
|
350
|
+
"SuggestTokenMsg",
|
351
|
+
{
|
352
|
+
chainId,
|
353
|
+
contractAddress,
|
354
|
+
viewingKey,
|
355
|
+
}
|
356
|
+
);
|
277
357
|
}
|
278
358
|
|
279
359
|
async getSecret20ViewingKey(
|
280
360
|
chainId: string,
|
281
361
|
contractAddress: string
|
282
362
|
): Promise<string> {
|
283
|
-
|
284
|
-
|
363
|
+
return await sendSimpleMessage(
|
364
|
+
this.requester,
|
365
|
+
BACKGROUND_PORT,
|
366
|
+
"token-cw20",
|
367
|
+
"get-secret20-viewing-key",
|
368
|
+
{
|
369
|
+
chainId,
|
370
|
+
contractAddress,
|
371
|
+
}
|
372
|
+
);
|
285
373
|
}
|
286
374
|
|
287
375
|
async getEnigmaPubKey(chainId: string): Promise<Uint8Array> {
|
288
|
-
return await
|
376
|
+
return await sendSimpleMessage(
|
377
|
+
this.requester,
|
289
378
|
BACKGROUND_PORT,
|
290
|
-
|
379
|
+
"secret-wasm",
|
380
|
+
"get-pubkey-msg",
|
381
|
+
{
|
382
|
+
chainId,
|
383
|
+
}
|
291
384
|
);
|
292
385
|
}
|
293
386
|
|
@@ -295,9 +388,15 @@ export class Keplr implements IKeplr {
|
|
295
388
|
chainId: string,
|
296
389
|
nonce: Uint8Array
|
297
390
|
): Promise<Uint8Array> {
|
298
|
-
return await
|
391
|
+
return await sendSimpleMessage(
|
392
|
+
this.requester,
|
299
393
|
BACKGROUND_PORT,
|
300
|
-
|
394
|
+
"secret-wasm",
|
395
|
+
"get-tx-encryption-key-msg",
|
396
|
+
{
|
397
|
+
chainId,
|
398
|
+
nonce,
|
399
|
+
}
|
301
400
|
);
|
302
401
|
}
|
303
402
|
|
@@ -307,24 +406,38 @@ export class Keplr implements IKeplr {
|
|
307
406
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
308
407
|
msg: object
|
309
408
|
): Promise<Uint8Array> {
|
310
|
-
return await
|
409
|
+
return await sendSimpleMessage(
|
410
|
+
this.requester,
|
311
411
|
BACKGROUND_PORT,
|
312
|
-
|
412
|
+
"secret-wasm",
|
413
|
+
"request-encrypt-msg",
|
414
|
+
{
|
415
|
+
chainId,
|
416
|
+
contractCodeHash,
|
417
|
+
msg,
|
418
|
+
}
|
313
419
|
);
|
314
420
|
}
|
315
421
|
|
316
422
|
async enigmaDecrypt(
|
317
423
|
chainId: string,
|
318
|
-
|
424
|
+
cipherText: Uint8Array,
|
319
425
|
nonce: Uint8Array
|
320
426
|
): Promise<Uint8Array> {
|
321
|
-
if (!
|
427
|
+
if (!cipherText || cipherText.length === 0) {
|
322
428
|
return new Uint8Array();
|
323
429
|
}
|
324
430
|
|
325
|
-
return await
|
431
|
+
return await sendSimpleMessage(
|
432
|
+
this.requester,
|
326
433
|
BACKGROUND_PORT,
|
327
|
-
|
434
|
+
"secret-wasm",
|
435
|
+
"request-decrypt-msg",
|
436
|
+
{
|
437
|
+
chainId,
|
438
|
+
cipherText,
|
439
|
+
nonce,
|
440
|
+
}
|
328
441
|
);
|
329
442
|
}
|
330
443
|
|
@@ -339,36 +452,58 @@ export class Keplr implements IKeplr {
|
|
339
452
|
return enigmaUtils;
|
340
453
|
}
|
341
454
|
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
}
|
350
|
-
|
455
|
+
async experimentalSignEIP712CosmosTx_v0(
|
456
|
+
chainId: string,
|
457
|
+
signer: string,
|
458
|
+
eip712: {
|
459
|
+
types: Record<string, { name: string; type: string }[] | undefined>;
|
460
|
+
domain: Record<string, any>;
|
461
|
+
primaryType: string;
|
462
|
+
},
|
463
|
+
signDoc: StdSignDoc,
|
464
|
+
signOptions: KeplrSignOptions = {}
|
465
|
+
): Promise<AminoSignResponse> {
|
466
|
+
return await sendSimpleMessage(
|
467
|
+
this.requester,
|
468
|
+
BACKGROUND_PORT,
|
469
|
+
"keyring-cosmos",
|
470
|
+
"request-sign-eip-712-cosmos-tx-v0",
|
471
|
+
{
|
472
|
+
chainId,
|
473
|
+
signer,
|
474
|
+
eip712,
|
475
|
+
signDoc,
|
476
|
+
signOptions: deepmerge(this.defaultOptions.sign ?? {}, signOptions),
|
477
|
+
}
|
478
|
+
);
|
351
479
|
}
|
352
480
|
|
353
|
-
|
354
|
-
return
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
481
|
+
async __core__getAnalyticsId(): Promise<string> {
|
482
|
+
return await sendSimpleMessage(
|
483
|
+
this.requester,
|
484
|
+
BACKGROUND_PORT,
|
485
|
+
"analytics",
|
486
|
+
"get-analytics-id",
|
487
|
+
{}
|
488
|
+
);
|
489
|
+
}
|
490
|
+
|
491
|
+
async changeKeyRingName({
|
492
|
+
defaultName,
|
493
|
+
editable = true,
|
494
|
+
}: {
|
495
|
+
defaultName: string;
|
496
|
+
editable?: boolean;
|
497
|
+
}): Promise<string> {
|
498
|
+
return await sendSimpleMessage(
|
499
|
+
this.requester,
|
500
|
+
BACKGROUND_PORT,
|
501
|
+
"keyring-v2",
|
502
|
+
"change-keyring-name-interactive",
|
503
|
+
{
|
504
|
+
defaultName,
|
505
|
+
editable,
|
506
|
+
}
|
507
|
+
);
|
373
508
|
}
|
374
509
|
}
|
package/src/cosmjs.ts
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
import {
|
2
|
-
|
2
|
+
Keplr,
|
3
|
+
OfflineDirectSigner,
|
4
|
+
OfflineAminoSigner,
|
3
5
|
AccountData,
|
4
6
|
AminoSignResponse,
|
5
7
|
StdSignDoc,
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
import { DirectSignResponse } from "@cosmjs/proto-signing/build/signer";
|
10
|
-
import { SignDoc } from "@cosmjs/proto-signing/build/codec/cosmos/tx/v1beta1/tx";
|
8
|
+
DirectSignResponse,
|
9
|
+
SignDoc,
|
10
|
+
} from "@keplr-wallet/types";
|
11
11
|
|
12
|
-
export class CosmJSOfflineSignerOnlyAmino implements
|
12
|
+
export class CosmJSOfflineSignerOnlyAmino implements OfflineAminoSigner {
|
13
13
|
constructor(
|
14
14
|
protected readonly chainId: string,
|
15
15
|
protected readonly keplr: Keplr
|
@@ -56,11 +56,9 @@ export class CosmJSOfflineSignerOnlyAmino implements OfflineSigner {
|
|
56
56
|
|
57
57
|
export class CosmJSOfflineSigner
|
58
58
|
extends CosmJSOfflineSignerOnlyAmino
|
59
|
-
implements
|
60
|
-
|
61
|
-
|
62
|
-
protected readonly keplr: Keplr
|
63
|
-
) {
|
59
|
+
implements OfflineAminoSigner, OfflineDirectSigner
|
60
|
+
{
|
61
|
+
constructor(chainId: string, keplr: Keplr) {
|
64
62
|
super(chainId, keplr);
|
65
63
|
}
|
66
64
|
|
package/src/enigma.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
import { SecretUtils } from "
|
2
|
-
import { Keplr } from "@keplr-wallet/types";
|
1
|
+
import { Keplr, SecretUtils } from "@keplr-wallet/types";
|
3
2
|
|
4
3
|
/**
|
5
4
|
* KeplrEnigmaUtils duplicates the public methods that are supported on secretjs's EnigmaUtils class.
|