@keplr-wallet/wc-client 0.12.0-alpha.0 → 0.12.0-alpha.3
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/index.d.ts +24 -9
- package/build/index.js +26 -4
- package/build/index.js.map +1 -1
- package/package.json +6 -10
- package/src/index.ts +61 -12
package/LICENSE
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
License: Apache2.0
|
1
|
+
License: Apache2.0 (Extension) / All rights reserved (Mobile)
|
2
|
+
|
3
|
+
## Keplr Extension License:
|
2
4
|
|
3
5
|
Apache License
|
4
6
|
Version 2.0, January 2004
|
@@ -200,4 +202,8 @@ License: Apache2.0
|
|
200
202
|
distributed under the License is distributed on an "AS IS" BASIS,
|
201
203
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
202
204
|
See the License for the specific language governing permissions and
|
203
|
-
limitations under the License.
|
205
|
+
limitations under the License.
|
206
|
+
|
207
|
+
## Keplr Mobile License
|
208
|
+
|
209
|
+
Copyright (c) 2021 Chainapsis Inc. All rights reserved.
|
package/build/index.d.ts
CHANGED
@@ -1,21 +1,20 @@
|
|
1
1
|
/// <reference types="long" />
|
2
2
|
import { IConnector, IJsonRpcRequest, IRequestOptions } from "@walletconnect/types";
|
3
|
-
import { ChainInfo, EthSignType, Keplr, KeplrIntereactionOptions, KeplrMode, KeplrSignOptions, Key } from "@keplr-wallet/types";
|
4
|
-
import { DirectSignResponse, OfflineDirectSigner } from "@cosmjs/proto-signing";
|
5
|
-
import { AminoSignResponse, BroadcastMode, OfflineSigner, StdSignature, StdSignDoc } from "@cosmjs/launchpad";
|
6
|
-
import { SecretUtils } from "secretjs/types/enigmautils";
|
3
|
+
import { ChainInfo, EthSignType, Keplr, KeplrIntereactionOptions, KeplrMode, KeplrSignOptions, Key, DirectSignResponse, OfflineDirectSigner, AminoSignResponse, BroadcastMode, OfflineAminoSigner, StdSignature, StdSignDoc, ICNSAdr36Signatures, ChainInfoWithoutEndpoints, SecretUtils, SettledResponses } from "@keplr-wallet/types";
|
7
4
|
import { KVStore } from "@keplr-wallet/common";
|
8
|
-
export
|
5
|
+
export type KeplrGetKeyWalletCoonectV1Response = {
|
9
6
|
address: string;
|
10
7
|
algo: string;
|
11
8
|
bech32Address: string;
|
9
|
+
isKeystone: boolean;
|
12
10
|
isNanoLedger: boolean;
|
13
11
|
name: string;
|
14
12
|
pubKey: string;
|
15
13
|
};
|
16
|
-
export
|
14
|
+
export type KeplrKeystoreMayChangedEventParam = {
|
17
15
|
algo: string;
|
18
16
|
name: string;
|
17
|
+
isKeystone: boolean;
|
19
18
|
isNanoLedger: boolean;
|
20
19
|
keys: {
|
21
20
|
chainIdentifier: string;
|
@@ -55,6 +54,7 @@ export declare class KeplrWalletConnectV1 implements Keplr {
|
|
55
54
|
getEnigmaTxEncryptionKey(_chainId: string, _nonce: Uint8Array): Promise<Uint8Array>;
|
56
55
|
getEnigmaUtils(_chainId: string): SecretUtils;
|
57
56
|
getKey(chainId: string): Promise<Key>;
|
57
|
+
getKeysSettled(_chainIds: string[]): Promise<SettledResponses<Key>>;
|
58
58
|
protected getKeyLastSeenKey(): string;
|
59
59
|
protected getLastSeenKey(chainId: string): Promise<KeplrGetKeyWalletCoonectV1Response | undefined>;
|
60
60
|
protected getAllLastSeenKey(): Promise<{
|
@@ -67,9 +67,10 @@ export declare class KeplrWalletConnectV1 implements Keplr {
|
|
67
67
|
signArbitrary(_chainId: string, _signer: string, _data: string | Uint8Array): Promise<StdSignature>;
|
68
68
|
verifyArbitrary(_chainId: string, _signer: string, _data: string | Uint8Array, _signature: StdSignature): Promise<boolean>;
|
69
69
|
signEthereum(_chainId: string, _signer: string, _data: string | Uint8Array, _mode: EthSignType): Promise<Uint8Array>;
|
70
|
-
|
71
|
-
|
72
|
-
|
70
|
+
signICNSAdr36(_chainId: string, _contractAddress: string, _owner: string, _username: string, _addressChainIds: string[]): Promise<ICNSAdr36Signatures>;
|
71
|
+
getOfflineSigner(chainId: string): OfflineAminoSigner & OfflineDirectSigner;
|
72
|
+
getOfflineSignerAuto(chainId: string): Promise<OfflineAminoSigner | OfflineDirectSigner>;
|
73
|
+
getOfflineSignerOnlyAmino(chainId: string): OfflineAminoSigner;
|
73
74
|
getSecret20ViewingKey(_chainId: string, _contractAddress: string): Promise<string>;
|
74
75
|
/**
|
75
76
|
* In the extension environment, this API let the extension to send the tx on behalf of the client.
|
@@ -89,4 +90,18 @@ export declare class KeplrWalletConnectV1 implements Keplr {
|
|
89
90
|
accountNumber?: Long | null;
|
90
91
|
}, _signOptions?: KeplrSignOptions): Promise<DirectSignResponse>;
|
91
92
|
suggestToken(_chainId: string, _contractAddress: string, _viewingKey?: string): Promise<void>;
|
93
|
+
experimentalSignEIP712CosmosTx_v0(_chainId: string, _signer: string, _eip712: {
|
94
|
+
types: Record<string, {
|
95
|
+
name: string;
|
96
|
+
type: string;
|
97
|
+
}[] | undefined>;
|
98
|
+
domain: Record<string, any>;
|
99
|
+
primaryType: string;
|
100
|
+
}, _signDoc: StdSignDoc, _signOptions?: KeplrSignOptions): Promise<AminoSignResponse>;
|
101
|
+
getChainInfosWithoutEndpoints(): Promise<ChainInfoWithoutEndpoints[]>;
|
102
|
+
disable(_chainIds?: string | string[]): Promise<void>;
|
103
|
+
changeKeyRingName(_opts: {
|
104
|
+
defaultName: string;
|
105
|
+
editable?: boolean | undefined;
|
106
|
+
}): Promise<string>;
|
92
107
|
}
|
package/build/index.js
CHANGED
@@ -63,6 +63,7 @@ class KeplrWalletConnectV1 {
|
|
63
63
|
address: mayChangedKey.address,
|
64
64
|
algo: param.algo,
|
65
65
|
bech32Address: mayChangedKey.bech32Address,
|
66
|
+
isKeystone: param.isKeystone,
|
66
67
|
isNanoLedger: param.isNanoLedger,
|
67
68
|
name: param.name,
|
68
69
|
pubKey: mayChangedKey.pubKey,
|
@@ -77,6 +78,7 @@ class KeplrWalletConnectV1 {
|
|
77
78
|
if (mayChangedKey) {
|
78
79
|
if (mayChangedKey.algo !== savedKey.algo ||
|
79
80
|
mayChangedKey.name !== savedKey.name ||
|
81
|
+
mayChangedKey.isKeystone !== savedKey.isKeystone ||
|
80
82
|
mayChangedKey.isNanoLedger !== savedKey.isNanoLedger ||
|
81
83
|
mayChangedKey.address !== savedKey.address ||
|
82
84
|
mayChangedKey.bech32Address !== savedKey.bech32Address ||
|
@@ -139,7 +141,7 @@ class KeplrWalletConnectV1 {
|
|
139
141
|
return;
|
140
142
|
}
|
141
143
|
yield this.sendCustomRequest({
|
142
|
-
id: utils_1.payloadId(),
|
144
|
+
id: (0, utils_1.payloadId)(),
|
143
145
|
jsonrpc: "2.0",
|
144
146
|
method: "keplr_enable_wallet_connect_v1",
|
145
147
|
params: chainIds,
|
@@ -195,13 +197,14 @@ class KeplrWalletConnectV1 {
|
|
195
197
|
address: buffer_1.Buffer.from(lastSeenKey.address, "hex"),
|
196
198
|
algo: lastSeenKey.algo,
|
197
199
|
bech32Address: lastSeenKey.bech32Address,
|
200
|
+
isKeystone: lastSeenKey.isKeystone,
|
198
201
|
isNanoLedger: lastSeenKey.isNanoLedger,
|
199
202
|
name: lastSeenKey.name,
|
200
203
|
pubKey: buffer_1.Buffer.from(lastSeenKey.pubKey, "hex"),
|
201
204
|
};
|
202
205
|
}
|
203
206
|
const response = (yield this.sendCustomRequest({
|
204
|
-
id: utils_1.payloadId(),
|
207
|
+
id: (0, utils_1.payloadId)(),
|
205
208
|
jsonrpc: "2.0",
|
206
209
|
method: "keplr_get_key_wallet_connect_v1",
|
207
210
|
params: [chainId],
|
@@ -211,12 +214,16 @@ class KeplrWalletConnectV1 {
|
|
211
214
|
address: buffer_1.Buffer.from(response.address, "hex"),
|
212
215
|
algo: response.algo,
|
213
216
|
bech32Address: response.bech32Address,
|
217
|
+
isKeystone: response.isKeystone,
|
214
218
|
isNanoLedger: response.isNanoLedger,
|
215
219
|
name: response.name,
|
216
220
|
pubKey: buffer_1.Buffer.from(response.pubKey, "hex"),
|
217
221
|
};
|
218
222
|
});
|
219
223
|
}
|
224
|
+
getKeysSettled(_chainIds) {
|
225
|
+
throw new Error("Not yet implemented");
|
226
|
+
}
|
220
227
|
getKeyLastSeenKey() {
|
221
228
|
return `${this.connector.session.handshakeTopic}-key`;
|
222
229
|
}
|
@@ -258,6 +265,9 @@ class KeplrWalletConnectV1 {
|
|
258
265
|
signEthereum(_chainId, _signer, _data, _mode) {
|
259
266
|
throw new Error("Not yet implemented");
|
260
267
|
}
|
268
|
+
signICNSAdr36(_chainId, _contractAddress, _owner, _username, _addressChainIds) {
|
269
|
+
throw new Error("Not yet implemented");
|
270
|
+
}
|
261
271
|
getOfflineSigner(chainId) {
|
262
272
|
return new provider_1.CosmJSOfflineSigner(chainId, this);
|
263
273
|
}
|
@@ -295,14 +305,14 @@ class KeplrWalletConnectV1 {
|
|
295
305
|
var _a;
|
296
306
|
return __awaiter(this, void 0, void 0, function* () {
|
297
307
|
return (yield this.sendCustomRequest({
|
298
|
-
id: utils_1.payloadId(),
|
308
|
+
id: (0, utils_1.payloadId)(),
|
299
309
|
jsonrpc: "2.0",
|
300
310
|
method: "keplr_sign_amino_wallet_connect_v1",
|
301
311
|
params: [
|
302
312
|
chainId,
|
303
313
|
signer,
|
304
314
|
signDoc,
|
305
|
-
deepmerge_1.default((_a = this.defaultOptions.sign) !== null && _a !== void 0 ? _a : {}, signOptions),
|
315
|
+
(0, deepmerge_1.default)((_a = this.defaultOptions.sign) !== null && _a !== void 0 ? _a : {}, signOptions),
|
306
316
|
],
|
307
317
|
}))[0];
|
308
318
|
});
|
@@ -313,6 +323,18 @@ class KeplrWalletConnectV1 {
|
|
313
323
|
suggestToken(_chainId, _contractAddress, _viewingKey) {
|
314
324
|
throw new Error("Not yet implemented");
|
315
325
|
}
|
326
|
+
experimentalSignEIP712CosmosTx_v0(_chainId, _signer, _eip712, _signDoc, _signOptions = {}) {
|
327
|
+
throw new Error("Not yet implemented");
|
328
|
+
}
|
329
|
+
getChainInfosWithoutEndpoints() {
|
330
|
+
throw new Error("Not yet implemented");
|
331
|
+
}
|
332
|
+
disable(_chainIds) {
|
333
|
+
throw new Error("Not yet implemented");
|
334
|
+
}
|
335
|
+
changeKeyRingName(_opts) {
|
336
|
+
throw new Error("Not yet implemented");
|
337
|
+
}
|
316
338
|
}
|
317
339
|
exports.KeplrWalletConnectV1 = KeplrWalletConnectV1;
|
318
340
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAyBA,qDAGgC;AAChC,gDAAiD;AACjD,0DAAkC;AAClC,oCAAiC;AACjC,iDAAiE;AAEjE,yFAAyF;AACzF,8DAA8D;AAC9D,MAAM,wBAAwB,GAAG,cAAc,CAAC;AAEhD,SAAS,YAAY,CAAC,OAAe;IAInC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACtE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACtB,OAAO;YACL,UAAU,EAAE,OAAO;YACnB,OAAO,EAAE,CAAC;SACX,CAAC;KACH;SAAM;QACL,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9D;AACH,CAAC;AAyBD,MAAa,oBAAoB;IAC/B,YACkB,SAAqB,EACrB,UAYZ,EAAE;QAbU,cAAS,GAAT,SAAS,CAAY;QACrB,YAAO,GAAP,OAAO,CAYjB;QAaC,YAAO,GAAW,OAAO,CAAC;QAC1B,SAAI,GAAc,eAAe,CAAC;QAE3C,mBAAc,GAA6B,EAA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AAC,iBAAiB,CAAC;gBAC3B,EAAE,EAAE,IAAA,iBAAS,GAAE;gBACf,OAAO,EAAE,KAAK;gBACd,MAAM,EAAE,oCAAoC;gBAC5C,MAAM,EAAE;oBACN,OAAO;oBACP,MAAM;oBACN,OAAO;oBACP,IAAA,mBAAS,EAAC,MAAA,IAAI,CAAC,cAAc,CAAC,IAAI,mCAAI,EAAE,EAAE,WAAW,CAAC;iBACvD;aACF,CAAC,CACH,CAAC,CAAC,CAAC,CAAC;;KACN;IAED,UAAU,CACR,QAAgB,EAChB,OAAe,EACf,QAKC,EACD,eAAiC,EAAE;QAEnC,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IAED,YAAY,CACV,QAAgB,EAChB,gBAAwB,EACxB,WAAoB;QAEpB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IAED,iCAAiC,CAC/B,QAAgB,EAChB,OAAe,EACf,OAIC,EACD,QAAoB,EACpB,eAAiC,EAAE;QAEnC,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IAED,6BAA6B;QAC3B,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,CAAC,SAA6B;QACnC,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IAED,iBAAiB,CAAC,KAGjB;QACC,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;CACF;AA1cD,oDA0cC"}
|
package/package.json
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"name": "@keplr-wallet/wc-client",
|
3
|
-
"version": "0.12.0-alpha.
|
3
|
+
"version": "0.12.0-alpha.3",
|
4
4
|
"main": "build/index.js",
|
5
5
|
"author": "chainapsis",
|
6
6
|
"license": "Apache-2.0",
|
7
|
-
"private": false,
|
8
7
|
"publishConfig": {
|
9
8
|
"access": "public"
|
10
9
|
},
|
@@ -17,16 +16,13 @@
|
|
17
16
|
"lint-fix": "eslint --fix \"src/**/*\" && prettier --write \"src/**/*\""
|
18
17
|
},
|
19
18
|
"dependencies": {
|
20
|
-
"@
|
21
|
-
"@
|
22
|
-
"@keplr-wallet/
|
23
|
-
"@keplr-wallet/provider": "0.12.0-alpha.0",
|
24
|
-
"@keplr-wallet/types": "0.12.0-alpha.0",
|
19
|
+
"@keplr-wallet/common": "0.12.0-alpha.3",
|
20
|
+
"@keplr-wallet/provider": "0.12.0-alpha.3",
|
21
|
+
"@keplr-wallet/types": "0.12.0-alpha.3",
|
25
22
|
"@walletconnect/types": "^1.6.4",
|
26
23
|
"@walletconnect/utils": "^1.6.4",
|
27
24
|
"buffer": "^6.0.3",
|
28
|
-
"deepmerge": "^4.2.2"
|
29
|
-
"secretjs": "0.17.7"
|
25
|
+
"deepmerge": "^4.2.2"
|
30
26
|
},
|
31
|
-
"gitHead": "
|
27
|
+
"gitHead": "1ee89644b711dd1dbbebc8eb86ed29d407088834"
|
32
28
|
}
|
package/src/index.ts
CHANGED
@@ -11,20 +11,22 @@ import {
|
|
11
11
|
KeplrMode,
|
12
12
|
KeplrSignOptions,
|
13
13
|
Key,
|
14
|
-
|
15
|
-
|
16
|
-
import {
|
14
|
+
DirectSignResponse,
|
15
|
+
OfflineDirectSigner,
|
17
16
|
AminoSignResponse,
|
18
17
|
BroadcastMode,
|
19
|
-
|
18
|
+
OfflineAminoSigner,
|
20
19
|
StdSignature,
|
21
20
|
StdSignDoc,
|
22
|
-
|
21
|
+
ICNSAdr36Signatures,
|
22
|
+
ChainInfoWithoutEndpoints,
|
23
|
+
SecretUtils,
|
24
|
+
SettledResponses,
|
25
|
+
} from "@keplr-wallet/types";
|
23
26
|
import {
|
24
27
|
CosmJSOfflineSigner,
|
25
28
|
CosmJSOfflineSignerOnlyAmino,
|
26
29
|
} from "@keplr-wallet/provider";
|
27
|
-
import { SecretUtils } from "secretjs/types/enigmautils";
|
28
30
|
import { payloadId } from "@walletconnect/utils";
|
29
31
|
import deepmerge from "deepmerge";
|
30
32
|
import { Buffer } from "buffer/";
|
@@ -34,9 +36,7 @@ import { IndexedDBKVStore, KVStore } from "@keplr-wallet/common";
|
|
34
36
|
// The chainID should be in the form: `{identifier}-{version}`
|
35
37
|
const ChainVersionFormatRegExp = /(.+)-([\d]+)/;
|
36
38
|
|
37
|
-
function parseChainId(
|
38
|
-
chainId: string
|
39
|
-
): {
|
39
|
+
function parseChainId(chainId: string): {
|
40
40
|
identifier: string;
|
41
41
|
version: number;
|
42
42
|
} {
|
@@ -55,6 +55,7 @@ export type KeplrGetKeyWalletCoonectV1Response = {
|
|
55
55
|
address: string;
|
56
56
|
algo: string;
|
57
57
|
bech32Address: string;
|
58
|
+
isKeystone: boolean;
|
58
59
|
isNanoLedger: boolean;
|
59
60
|
name: string;
|
60
61
|
pubKey: string;
|
@@ -63,6 +64,7 @@ export type KeplrGetKeyWalletCoonectV1Response = {
|
|
63
64
|
export type KeplrKeystoreMayChangedEventParam = {
|
64
65
|
algo: string;
|
65
66
|
name: string;
|
67
|
+
isKeystone: boolean;
|
66
68
|
isNanoLedger: boolean;
|
67
69
|
keys: {
|
68
70
|
chainIdentifier: string;
|
@@ -142,6 +144,7 @@ export class KeplrWalletConnectV1 implements Keplr {
|
|
142
144
|
address: mayChangedKey.address,
|
143
145
|
algo: param.algo,
|
144
146
|
bech32Address: mayChangedKey.bech32Address,
|
147
|
+
isKeystone: param.isKeystone,
|
145
148
|
isNanoLedger: param.isNanoLedger,
|
146
149
|
name: param.name,
|
147
150
|
pubKey: mayChangedKey.pubKey,
|
@@ -159,6 +162,7 @@ export class KeplrWalletConnectV1 implements Keplr {
|
|
159
162
|
if (
|
160
163
|
mayChangedKey.algo !== savedKey.algo ||
|
161
164
|
mayChangedKey.name !== savedKey.name ||
|
165
|
+
mayChangedKey.isKeystone !== savedKey.isKeystone ||
|
162
166
|
mayChangedKey.isNanoLedger !== savedKey.isNanoLedger ||
|
163
167
|
mayChangedKey.address !== savedKey.address ||
|
164
168
|
mayChangedKey.bech32Address !== savedKey.bech32Address ||
|
@@ -299,6 +303,7 @@ export class KeplrWalletConnectV1 implements Keplr {
|
|
299
303
|
address: Buffer.from(lastSeenKey.address, "hex"),
|
300
304
|
algo: lastSeenKey.algo,
|
301
305
|
bech32Address: lastSeenKey.bech32Address,
|
306
|
+
isKeystone: lastSeenKey.isKeystone,
|
302
307
|
isNanoLedger: lastSeenKey.isNanoLedger,
|
303
308
|
name: lastSeenKey.name,
|
304
309
|
pubKey: Buffer.from(lastSeenKey.pubKey, "hex"),
|
@@ -320,12 +325,17 @@ export class KeplrWalletConnectV1 implements Keplr {
|
|
320
325
|
address: Buffer.from(response.address, "hex"),
|
321
326
|
algo: response.algo,
|
322
327
|
bech32Address: response.bech32Address,
|
328
|
+
isKeystone: response.isKeystone,
|
323
329
|
isNanoLedger: response.isNanoLedger,
|
324
330
|
name: response.name,
|
325
331
|
pubKey: Buffer.from(response.pubKey, "hex"),
|
326
332
|
};
|
327
333
|
}
|
328
334
|
|
335
|
+
getKeysSettled(_chainIds: string[]): Promise<SettledResponses<Key>> {
|
336
|
+
throw new Error("Not yet implemented");
|
337
|
+
}
|
338
|
+
|
329
339
|
protected getKeyLastSeenKey() {
|
330
340
|
return `${this.connector.session.handshakeTopic}-key`;
|
331
341
|
}
|
@@ -395,13 +405,23 @@ export class KeplrWalletConnectV1 implements Keplr {
|
|
395
405
|
throw new Error("Not yet implemented");
|
396
406
|
}
|
397
407
|
|
398
|
-
|
408
|
+
signICNSAdr36(
|
409
|
+
_chainId: string,
|
410
|
+
_contractAddress: string,
|
411
|
+
_owner: string,
|
412
|
+
_username: string,
|
413
|
+
_addressChainIds: string[]
|
414
|
+
): Promise<ICNSAdr36Signatures> {
|
415
|
+
throw new Error("Not yet implemented");
|
416
|
+
}
|
417
|
+
|
418
|
+
getOfflineSigner(chainId: string): OfflineAminoSigner & OfflineDirectSigner {
|
399
419
|
return new CosmJSOfflineSigner(chainId, this);
|
400
420
|
}
|
401
421
|
|
402
422
|
async getOfflineSignerAuto(
|
403
423
|
chainId: string
|
404
|
-
): Promise<
|
424
|
+
): Promise<OfflineAminoSigner | OfflineDirectSigner> {
|
405
425
|
const key = await this.getKey(chainId);
|
406
426
|
if (key.isNanoLedger) {
|
407
427
|
return new CosmJSOfflineSignerOnlyAmino(chainId, this);
|
@@ -409,7 +429,7 @@ export class KeplrWalletConnectV1 implements Keplr {
|
|
409
429
|
return new CosmJSOfflineSigner(chainId, this);
|
410
430
|
}
|
411
431
|
|
412
|
-
getOfflineSignerOnlyAmino(chainId: string):
|
432
|
+
getOfflineSignerOnlyAmino(chainId: string): OfflineAminoSigner {
|
413
433
|
return new CosmJSOfflineSignerOnlyAmino(chainId, this);
|
414
434
|
}
|
415
435
|
|
@@ -483,4 +503,33 @@ export class KeplrWalletConnectV1 implements Keplr {
|
|
483
503
|
): Promise<void> {
|
484
504
|
throw new Error("Not yet implemented");
|
485
505
|
}
|
506
|
+
|
507
|
+
experimentalSignEIP712CosmosTx_v0(
|
508
|
+
_chainId: string,
|
509
|
+
_signer: string,
|
510
|
+
_eip712: {
|
511
|
+
types: Record<string, { name: string; type: string }[] | undefined>;
|
512
|
+
domain: Record<string, any>;
|
513
|
+
primaryType: string;
|
514
|
+
},
|
515
|
+
_signDoc: StdSignDoc,
|
516
|
+
_signOptions: KeplrSignOptions = {}
|
517
|
+
): Promise<AminoSignResponse> {
|
518
|
+
throw new Error("Not yet implemented");
|
519
|
+
}
|
520
|
+
|
521
|
+
getChainInfosWithoutEndpoints(): Promise<ChainInfoWithoutEndpoints[]> {
|
522
|
+
throw new Error("Not yet implemented");
|
523
|
+
}
|
524
|
+
|
525
|
+
disable(_chainIds?: string | string[]): Promise<void> {
|
526
|
+
throw new Error("Not yet implemented");
|
527
|
+
}
|
528
|
+
|
529
|
+
changeKeyRingName(_opts: {
|
530
|
+
defaultName: string;
|
531
|
+
editable?: boolean | undefined;
|
532
|
+
}): Promise<string> {
|
533
|
+
throw new Error("Not yet implemented");
|
534
|
+
}
|
486
535
|
}
|