@keplr-wallet/wc-client 0.12.21-rc.2 → 0.12.22-rc.0

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/index.d.ts CHANGED
@@ -1,107 +1,91 @@
1
- /// <reference types="long" />
2
- import { IConnector, IJsonRpcRequest, IRequestOptions } from "@walletconnect/types";
3
- import { ChainInfo, EthSignType, Keplr, KeplrIntereactionOptions, KeplrMode, KeplrSignOptions, Key, DirectSignResponse, OfflineDirectSigner, AminoSignResponse, BroadcastMode, OfflineAminoSigner, StdSignature, StdSignDoc, ICNSAdr36Signatures, ChainInfoWithoutEndpoints, SecretUtils, SettledResponses } from "@keplr-wallet/types";
4
- import { KVStore } from "@keplr-wallet/common";
5
- export type KeplrGetKeyWalletCoonectV1Response = {
6
- address: string;
7
- algo: string;
8
- bech32Address: string;
9
- isKeystone: boolean;
10
- isNanoLedger: boolean;
11
- name: string;
12
- pubKey: string;
13
- };
14
- export type KeplrKeystoreMayChangedEventParam = {
15
- algo: string;
16
- name: string;
17
- isKeystone: boolean;
18
- isNanoLedger: boolean;
19
- keys: {
20
- chainIdentifier: string;
21
- address: string;
22
- bech32Address: string;
23
- pubKey: string;
24
- }[];
25
- };
26
- export declare class KeplrWalletConnectV1 implements Keplr {
27
- readonly connector: IConnector;
1
+ import { AminoSignResponse, BroadcastMode, ChainInfo, ChainInfoWithoutEndpoints, DirectSignResponse, EthSignType, ICNSAdr36Signatures, Keplr, KeplrIntereactionOptions, KeplrMode, KeplrSignOptions, Key, OfflineAminoSigner, OfflineDirectSigner, SecretUtils, SettledResponses, StdSignature, StdSignDoc } from "@keplr-wallet/types";
2
+ import SignClient from "@walletconnect/sign-client";
3
+ import { ProposalTypes, SessionTypes } from "@walletconnect/types";
4
+ import Long from "long";
5
+ interface RequestParams {
6
+ topic: string;
7
+ request: {
8
+ method: string;
9
+ params: any;
10
+ };
11
+ chainId: string;
12
+ expiry?: number;
13
+ }
14
+ interface KeplrGetKeyWalletConnectV2Response {
15
+ readonly name: string;
16
+ readonly algo: string;
17
+ readonly pubKey: string;
18
+ readonly address: string;
19
+ readonly bech32Address: string;
20
+ readonly isNanoLedger: boolean;
21
+ }
22
+ export declare class KeplrWalletConnectV2 implements Keplr {
23
+ readonly signClient: SignClient;
28
24
  readonly options: {
29
- kvStore?: KVStore;
30
25
  sendTx?: Keplr["sendTx"];
31
- onBeforeSendRequest?: (request: Partial<IJsonRpcRequest>, options?: IRequestOptions) => Promise<void> | void;
32
- onAfterSendRequest?: (response: any, request: Partial<IJsonRpcRequest>, options?: IRequestOptions) => Promise<void> | void;
26
+ sessionProperties?: ProposalTypes.SessionProperties;
33
27
  };
34
- constructor(connector: IConnector, options?: {
35
- kvStore?: KVStore;
36
- sendTx?: Keplr["sendTx"];
37
- onBeforeSendRequest?: (request: Partial<IJsonRpcRequest>, options?: IRequestOptions) => Promise<void> | void;
38
- onAfterSendRequest?: (response: any, request: Partial<IJsonRpcRequest>, options?: IRequestOptions) => Promise<void> | void;
39
- });
28
+ defaultOptions: KeplrIntereactionOptions;
40
29
  readonly version: string;
41
30
  readonly mode: KeplrMode;
42
- defaultOptions: KeplrIntereactionOptions;
43
- protected readonly onCallReqeust: (error: Error | null, payload: any | null) => Promise<void>;
44
- protected clearSaved(): Promise<void>;
45
- protected sendCustomRequest(request: Partial<IJsonRpcRequest>, options?: IRequestOptions): Promise<any>;
31
+ protected readonly storeKey = "keplr_wallet_connect_v2_key";
32
+ constructor(signClient: SignClient, options: {
33
+ sendTx?: Keplr["sendTx"];
34
+ sessionProperties?: ProposalTypes.SessionProperties;
35
+ });
36
+ protected saveKeys(sessionProperty: ProposalTypes.SessionProperties): void;
37
+ protected convertToKeplrGetKeyWalletConnectV2Response(data: any): KeplrGetKeyWalletConnectV2Response;
38
+ protected getLastSession(): SessionTypes.Struct | undefined;
39
+ protected getCurrentTopic(): string;
40
+ protected getKeyLastSeenKey(): string;
41
+ protected getLastSeenKey(chainId: string): KeplrGetKeyWalletConnectV2Response | undefined;
42
+ protected getAllLastSeenKey(): any;
43
+ protected saveLastSeenKey(chainId: string, response: KeplrGetKeyWalletConnectV2Response): void;
44
+ protected saveAllLastSeenKey(data: {
45
+ [chainId: string]: KeplrGetKeyWalletConnectV2Response | undefined;
46
+ }): void;
47
+ protected sendCustomRequest<T>(requestParams: RequestParams): Promise<T>;
48
+ protected getNamespaceChainId(): string;
49
+ protected checkDeepLink(): void;
50
+ changeKeyRingName(_opts: {
51
+ defaultName: string;
52
+ editable?: boolean | undefined;
53
+ }): Promise<string>;
54
+ disable(_chainIds?: string | string[]): Promise<void>;
46
55
  enable(chainIds: string | string[]): Promise<void>;
47
- protected getKeyHasEnabled(): string;
48
- protected getHasEnabledChainIds(): Promise<string[]>;
49
- protected saveHasEnabledChainIds(chainIds: string[]): Promise<void>;
50
56
  enigmaDecrypt(_chainId: string, _ciphertext: Uint8Array, _nonce: Uint8Array): Promise<Uint8Array>;
51
57
  enigmaEncrypt(_chainId: string, _contractCodeHash: string, _msg: object): Promise<Uint8Array>;
58
+ experimentalSignEIP712CosmosTx_v0(_chainId: string, _signer: string, _eip712: {
59
+ types: Record<string, {
60
+ name: string;
61
+ type: string;
62
+ }[] | undefined>;
63
+ domain: Record<string, any>;
64
+ primaryType: string;
65
+ }, _signDoc: StdSignDoc, _signOptions?: KeplrSignOptions): Promise<AminoSignResponse>;
52
66
  experimentalSuggestChain(_chainInfo: ChainInfo): Promise<void>;
67
+ getChainInfosWithoutEndpoints(): Promise<ChainInfoWithoutEndpoints[]>;
53
68
  getEnigmaPubKey(_chainId: string): Promise<Uint8Array>;
54
69
  getEnigmaTxEncryptionKey(_chainId: string, _nonce: Uint8Array): Promise<Uint8Array>;
55
70
  getEnigmaUtils(_chainId: string): SecretUtils;
56
71
  getKey(chainId: string): Promise<Key>;
57
- getKeysSettled(_chainIds: string[]): Promise<SettledResponses<Key>>;
58
- protected getKeyLastSeenKey(): string;
59
- protected getLastSeenKey(chainId: string): Promise<KeplrGetKeyWalletCoonectV1Response | undefined>;
60
- protected getAllLastSeenKey(): Promise<{
61
- [chainId: string]: KeplrGetKeyWalletCoonectV1Response | undefined;
62
- } | undefined>;
63
- protected saveAllLastSeenKey(data: {
64
- [chainId: string]: KeplrGetKeyWalletCoonectV1Response | undefined;
65
- }): Promise<void>;
66
- protected saveLastSeenKey(chainId: string, response: KeplrGetKeyWalletCoonectV1Response): Promise<void>;
67
- signArbitrary(_chainId: string, _signer: string, _data: string | Uint8Array): Promise<StdSignature>;
68
- verifyArbitrary(_chainId: string, _signer: string, _data: string | Uint8Array, _signature: StdSignature): Promise<boolean>;
69
- signEthereum(_chainId: string, _signer: string, _data: string | Uint8Array, _mode: EthSignType): Promise<Uint8Array>;
70
- signICNSAdr36(_chainId: string, _contractAddress: string, _owner: string, _username: string, _addressChainIds: string[]): Promise<ICNSAdr36Signatures>;
72
+ getKeysSettled(chainIds: string[]): Promise<SettledResponses<Key>>;
71
73
  getOfflineSigner(chainId: string): OfflineAminoSigner & OfflineDirectSigner;
72
74
  getOfflineSignerAuto(chainId: string): Promise<OfflineAminoSigner | OfflineDirectSigner>;
73
75
  getOfflineSignerOnlyAmino(chainId: string): OfflineAminoSigner;
74
76
  getSecret20ViewingKey(_chainId: string, _contractAddress: string): Promise<string>;
75
- /**
76
- * In the extension environment, this API let the extension to send the tx on behalf of the client.
77
- * But, in the wallet connect environment, in order to send the tx on behalf of the client, wallet should receive the tx data from remote.
78
- * However, this approach is not efficient and hard to ensure the stability and `KeplrWalletConnect` should have the informations of rpc and rest endpoints.
79
- * So, rather than implementing this, just fallback to the client sided implementation or throw error of the client sided implementation is not delivered to the `options`.
80
- * @param chainId
81
- * @param stdTx
82
- * @param mode
83
- */
84
77
  sendTx(chainId: string, tx: Uint8Array, mode: BroadcastMode): Promise<Uint8Array>;
85
78
  signAmino(chainId: string, signer: string, signDoc: StdSignDoc, signOptions?: KeplrSignOptions): Promise<AminoSignResponse>;
86
- signDirect(_chainId: string, _signer: string, _signDoc: {
79
+ signArbitrary(chainId: string, signer: string, data: string | Uint8Array): Promise<StdSignature>;
80
+ signDirect(chainId: string, signer: string, signDoc: {
87
81
  bodyBytes?: Uint8Array | null;
88
82
  authInfoBytes?: Uint8Array | null;
89
83
  chainId?: string | null;
90
84
  accountNumber?: Long | null;
91
- }, _signOptions?: KeplrSignOptions): Promise<DirectSignResponse>;
85
+ }, signOptions?: KeplrSignOptions): Promise<DirectSignResponse>;
86
+ signEthereum(_chainId: string, _signer: string, _data: string | Uint8Array, _type: EthSignType): Promise<Uint8Array>;
87
+ signICNSAdr36(_chainId: string, _contractAddress: string, _owner: string, _username: string, _addressChainIds: string[]): Promise<ICNSAdr36Signatures>;
92
88
  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>;
89
+ verifyArbitrary(_chainId: string, _signer: string, _data: string | Uint8Array, _signature: StdSignature): Promise<boolean>;
107
90
  }
91
+ export {};