@keplr-wallet/types 0.11.15 → 0.11.16-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/cosmjs.d.ts +119 -0
- package/build/cosmjs.js +3 -0
- package/build/cosmjs.js.map +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/wallet/keplr.d.ts +4 -5
- package/build/window.d.ts +4 -5
- package/package.json +2 -4
- package/src/cosmjs.ts +141 -0
- package/src/index.ts +1 -0
- package/src/wallet/keplr.ts +7 -6
- package/src/window.ts +6 -5
@@ -0,0 +1,119 @@
|
|
1
|
+
import Long from "long";
|
2
|
+
export declare enum BroadcastMode {
|
3
|
+
/** Return after tx commit */
|
4
|
+
Block = "block",
|
5
|
+
/** Return after CheckTx */
|
6
|
+
Sync = "sync",
|
7
|
+
/** Return right away */
|
8
|
+
Async = "async"
|
9
|
+
}
|
10
|
+
export interface Coin {
|
11
|
+
readonly denom: string;
|
12
|
+
readonly amount: string;
|
13
|
+
}
|
14
|
+
export interface StdFee {
|
15
|
+
readonly amount: readonly Coin[];
|
16
|
+
readonly gas: string;
|
17
|
+
readonly payer?: string;
|
18
|
+
readonly granter?: string;
|
19
|
+
readonly feePayer?: string;
|
20
|
+
}
|
21
|
+
export interface Msg {
|
22
|
+
readonly type: string;
|
23
|
+
readonly value: any;
|
24
|
+
}
|
25
|
+
export interface StdSignDoc {
|
26
|
+
readonly chain_id: string;
|
27
|
+
readonly account_number: string;
|
28
|
+
readonly sequence: string;
|
29
|
+
readonly fee: StdFee;
|
30
|
+
readonly msgs: readonly Msg[];
|
31
|
+
readonly memo: string;
|
32
|
+
}
|
33
|
+
export interface PubKey {
|
34
|
+
readonly type: string;
|
35
|
+
readonly value: string;
|
36
|
+
}
|
37
|
+
export interface StdSignature {
|
38
|
+
readonly pub_key: PubKey;
|
39
|
+
readonly signature: string;
|
40
|
+
}
|
41
|
+
export interface StdTx {
|
42
|
+
readonly msg: readonly Msg[];
|
43
|
+
readonly fee: StdFee;
|
44
|
+
readonly signatures: readonly StdSignature[];
|
45
|
+
readonly memo: string | undefined;
|
46
|
+
}
|
47
|
+
export interface AminoSignResponse {
|
48
|
+
readonly signed: StdSignDoc;
|
49
|
+
readonly signature: StdSignature;
|
50
|
+
}
|
51
|
+
export interface SignDoc {
|
52
|
+
/**
|
53
|
+
* body_bytes is protobuf serialization of a TxBody that matches the
|
54
|
+
* representation in TxRaw.
|
55
|
+
*/
|
56
|
+
bodyBytes: Uint8Array;
|
57
|
+
/**
|
58
|
+
* auth_info_bytes is a protobuf serialization of an AuthInfo that matches the
|
59
|
+
* representation in TxRaw.
|
60
|
+
*/
|
61
|
+
authInfoBytes: Uint8Array;
|
62
|
+
/**
|
63
|
+
* chain_id is the unique identifier of the chain this transaction targets.
|
64
|
+
* It prevents signed transactions from being used on another chain by an
|
65
|
+
* attacker
|
66
|
+
*/
|
67
|
+
chainId: string;
|
68
|
+
/** account_number is the account number of the account in state */
|
69
|
+
accountNumber: Long;
|
70
|
+
}
|
71
|
+
export interface DirectSignResponse {
|
72
|
+
/**
|
73
|
+
* The sign doc that was signed.
|
74
|
+
* This may be different from the input signDoc when the signer modifies it as part of the signing process.
|
75
|
+
*/
|
76
|
+
readonly signed: SignDoc;
|
77
|
+
readonly signature: StdSignature;
|
78
|
+
}
|
79
|
+
/**
|
80
|
+
* This is the same as Algo from @cosmjs/launchpad but those might diverge in the future.
|
81
|
+
*/
|
82
|
+
export declare type Algo = "secp256k1" | "ed25519" | "sr25519";
|
83
|
+
/**
|
84
|
+
* This is the same as AccountData from @cosmjs/launchpad but those might diverge in the future.
|
85
|
+
*/
|
86
|
+
export interface AccountData {
|
87
|
+
/** A printable address (typically bech32 encoded) */
|
88
|
+
readonly address: string;
|
89
|
+
readonly algo: Algo;
|
90
|
+
readonly pubkey: Uint8Array;
|
91
|
+
}
|
92
|
+
export interface DirectSignResponse {
|
93
|
+
/**
|
94
|
+
* The sign doc that was signed.
|
95
|
+
* This may be different from the input signDoc when the signer modifies it as part of the signing process.
|
96
|
+
*/
|
97
|
+
readonly signed: SignDoc;
|
98
|
+
readonly signature: StdSignature;
|
99
|
+
}
|
100
|
+
export interface OfflineDirectSigner {
|
101
|
+
readonly getAccounts: () => Promise<readonly AccountData[]>;
|
102
|
+
readonly signDirect: (signerAddress: string, signDoc: SignDoc) => Promise<DirectSignResponse>;
|
103
|
+
}
|
104
|
+
export interface OfflineAminoSigner {
|
105
|
+
/**
|
106
|
+
* Get AccountData array from wallet. Rejects if not enabled.
|
107
|
+
*/
|
108
|
+
readonly getAccounts: () => Promise<readonly AccountData[]>;
|
109
|
+
/**
|
110
|
+
* Request signature from whichever key corresponds to provided bech32-encoded address. Rejects if not enabled.
|
111
|
+
*
|
112
|
+
* The signer implementation may offer the user the ability to override parts of the signDoc. It must
|
113
|
+
* return the doc that was signed in the response.
|
114
|
+
*
|
115
|
+
* @param signerAddress The address of the account that should sign the transaction
|
116
|
+
* @param signDoc The content that should be signed
|
117
|
+
*/
|
118
|
+
readonly signAmino: (signerAddress: string, signDoc: StdSignDoc) => Promise<AminoSignResponse>;
|
119
|
+
}
|
package/build/cosmjs.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"cosmjs.js","sourceRoot":"","sources":["../src/cosmjs.ts"],"names":[],"mappings":""}
|
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
@@ -17,4 +17,5 @@ __exportStar(require("./chain-info"), exports);
|
|
17
17
|
__exportStar(require("./wallet"), exports);
|
18
18
|
__exportStar(require("./window"), exports);
|
19
19
|
__exportStar(require("./ethereum"), exports);
|
20
|
+
__exportStar(require("./cosmjs"), exports);
|
20
21
|
//# 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":";;;;;;;;;;;;AAAA,6CAA2B;AAC3B,2CAAyB;AACzB,0CAAwB;AACxB,+CAA6B;AAC7B,2CAAyB;AACzB,2CAAyB;AACzB,6CAA2B"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA2B;AAC3B,2CAAyB;AACzB,0CAAwB;AACxB,+CAA6B;AAC7B,2CAAyB;AACzB,2CAAyB;AACzB,6CAA2B;AAC3B,2CAAyB"}
|
package/build/wallet/keplr.d.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import { ChainInfo } from "../chain-info";
|
2
2
|
import { EthSignType } from "../ethereum";
|
3
|
-
import { BroadcastMode, AminoSignResponse, StdSignDoc,
|
4
|
-
import { DirectSignResponse, OfflineDirectSigner } from "@cosmjs/proto-signing";
|
3
|
+
import { BroadcastMode, AminoSignResponse, StdSignDoc, OfflineAminoSigner, StdSignature, DirectSignResponse, OfflineDirectSigner } from "../cosmjs";
|
5
4
|
import { SecretUtils } from "secretjs/types/enigmautils";
|
6
5
|
import Long from "long";
|
7
6
|
export interface Key {
|
@@ -48,9 +47,9 @@ export interface Keplr {
|
|
48
47
|
signArbitrary(chainId: string, signer: string, data: string | Uint8Array): Promise<StdSignature>;
|
49
48
|
verifyArbitrary(chainId: string, signer: string, data: string | Uint8Array, signature: StdSignature): Promise<boolean>;
|
50
49
|
signEthereum(chainId: string, signer: string, data: string | Uint8Array, type: EthSignType): Promise<Uint8Array>;
|
51
|
-
getOfflineSigner(chainId: string):
|
52
|
-
getOfflineSignerOnlyAmino(chainId: string):
|
53
|
-
getOfflineSignerAuto(chainId: string): Promise<
|
50
|
+
getOfflineSigner(chainId: string): OfflineAminoSigner & OfflineDirectSigner;
|
51
|
+
getOfflineSignerOnlyAmino(chainId: string): OfflineAminoSigner;
|
52
|
+
getOfflineSignerAuto(chainId: string): Promise<OfflineAminoSigner | OfflineDirectSigner>;
|
54
53
|
suggestToken(chainId: string, contractAddress: string, viewingKey?: string): Promise<void>;
|
55
54
|
getSecret20ViewingKey(chainId: string, contractAddress: string): Promise<string>;
|
56
55
|
getEnigmaUtils(chainId: string): SecretUtils;
|
package/build/window.d.ts
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
import { Keplr } from "./wallet";
|
2
|
-
import {
|
2
|
+
import { OfflineAminoSigner, OfflineDirectSigner } from "./cosmjs";
|
3
3
|
import { SecretUtils } from "secretjs/types/enigmautils";
|
4
|
-
import { OfflineDirectSigner } from "@cosmjs/proto-signing";
|
5
4
|
export interface Window {
|
6
5
|
keplr?: Keplr;
|
7
|
-
getOfflineSigner?: (chainId: string) =>
|
8
|
-
getOfflineSignerOnlyAmino?: (chainId: string) =>
|
9
|
-
getOfflineSignerAuto?: (chainId: string) => Promise<
|
6
|
+
getOfflineSigner?: (chainId: string) => OfflineAminoSigner & OfflineDirectSigner;
|
7
|
+
getOfflineSignerOnlyAmino?: (chainId: string) => OfflineAminoSigner;
|
8
|
+
getOfflineSignerAuto?: (chainId: string) => Promise<OfflineAminoSigner | OfflineDirectSigner>;
|
10
9
|
getEnigmaUtils?: (chainId: string) => SecretUtils;
|
11
10
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@keplr-wallet/types",
|
3
|
-
"version": "0.11.
|
3
|
+
"version": "0.11.16-rc.0",
|
4
4
|
"main": "build/index.js",
|
5
5
|
"author": "chainapsis",
|
6
6
|
"license": "Apache-2.0",
|
@@ -17,11 +17,9 @@
|
|
17
17
|
"lint-fix": "eslint --fix \"src/**/*\" && prettier --write \"src/**/*\""
|
18
18
|
},
|
19
19
|
"dependencies": {
|
20
|
-
"@cosmjs/launchpad": "^0.24.0-alpha.25",
|
21
|
-
"@cosmjs/proto-signing": "^0.24.0-alpha.25",
|
22
20
|
"axios": "^0.27.2",
|
23
21
|
"long": "^4.0.0",
|
24
22
|
"secretjs": "0.17.7"
|
25
23
|
},
|
26
|
-
"gitHead": "
|
24
|
+
"gitHead": "b3edb75be1402ee9f679a692918922aaa0c99be7"
|
27
25
|
}
|
package/src/cosmjs.ts
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
import Long from "long";
|
2
|
+
|
3
|
+
export declare enum BroadcastMode {
|
4
|
+
/** Return after tx commit */
|
5
|
+
Block = "block",
|
6
|
+
/** Return after CheckTx */
|
7
|
+
Sync = "sync",
|
8
|
+
/** Return right away */
|
9
|
+
Async = "async",
|
10
|
+
}
|
11
|
+
|
12
|
+
export interface Coin {
|
13
|
+
readonly denom: string;
|
14
|
+
readonly amount: string;
|
15
|
+
}
|
16
|
+
|
17
|
+
export interface StdFee {
|
18
|
+
readonly amount: readonly Coin[];
|
19
|
+
readonly gas: string;
|
20
|
+
readonly payer?: string;
|
21
|
+
readonly granter?: string;
|
22
|
+
|
23
|
+
// XXX: "feePayer" should be "payer". But, it maybe from ethermint team's mistake.
|
24
|
+
// That means this part is not standard.
|
25
|
+
readonly feePayer?: string;
|
26
|
+
}
|
27
|
+
|
28
|
+
export interface Msg {
|
29
|
+
readonly type: string;
|
30
|
+
readonly value: any;
|
31
|
+
}
|
32
|
+
|
33
|
+
export interface StdSignDoc {
|
34
|
+
readonly chain_id: string;
|
35
|
+
readonly account_number: string;
|
36
|
+
readonly sequence: string;
|
37
|
+
readonly fee: StdFee;
|
38
|
+
readonly msgs: readonly Msg[];
|
39
|
+
readonly memo: string;
|
40
|
+
}
|
41
|
+
|
42
|
+
export interface PubKey {
|
43
|
+
readonly type: string;
|
44
|
+
readonly value: string;
|
45
|
+
}
|
46
|
+
|
47
|
+
export interface StdSignature {
|
48
|
+
readonly pub_key: PubKey;
|
49
|
+
readonly signature: string;
|
50
|
+
}
|
51
|
+
|
52
|
+
export interface StdTx {
|
53
|
+
readonly msg: readonly Msg[];
|
54
|
+
readonly fee: StdFee;
|
55
|
+
readonly signatures: readonly StdSignature[];
|
56
|
+
readonly memo: string | undefined;
|
57
|
+
}
|
58
|
+
|
59
|
+
export interface AminoSignResponse {
|
60
|
+
readonly signed: StdSignDoc;
|
61
|
+
readonly signature: StdSignature;
|
62
|
+
}
|
63
|
+
|
64
|
+
export interface SignDoc {
|
65
|
+
/**
|
66
|
+
* body_bytes is protobuf serialization of a TxBody that matches the
|
67
|
+
* representation in TxRaw.
|
68
|
+
*/
|
69
|
+
bodyBytes: Uint8Array;
|
70
|
+
/**
|
71
|
+
* auth_info_bytes is a protobuf serialization of an AuthInfo that matches the
|
72
|
+
* representation in TxRaw.
|
73
|
+
*/
|
74
|
+
authInfoBytes: Uint8Array;
|
75
|
+
/**
|
76
|
+
* chain_id is the unique identifier of the chain this transaction targets.
|
77
|
+
* It prevents signed transactions from being used on another chain by an
|
78
|
+
* attacker
|
79
|
+
*/
|
80
|
+
chainId: string;
|
81
|
+
/** account_number is the account number of the account in state */
|
82
|
+
accountNumber: Long;
|
83
|
+
}
|
84
|
+
|
85
|
+
export interface DirectSignResponse {
|
86
|
+
/**
|
87
|
+
* The sign doc that was signed.
|
88
|
+
* This may be different from the input signDoc when the signer modifies it as part of the signing process.
|
89
|
+
*/
|
90
|
+
readonly signed: SignDoc;
|
91
|
+
readonly signature: StdSignature;
|
92
|
+
}
|
93
|
+
|
94
|
+
/**
|
95
|
+
* This is the same as Algo from @cosmjs/launchpad but those might diverge in the future.
|
96
|
+
*/
|
97
|
+
export declare type Algo = "secp256k1" | "ed25519" | "sr25519";
|
98
|
+
/**
|
99
|
+
* This is the same as AccountData from @cosmjs/launchpad but those might diverge in the future.
|
100
|
+
*/
|
101
|
+
export interface AccountData {
|
102
|
+
/** A printable address (typically bech32 encoded) */
|
103
|
+
readonly address: string;
|
104
|
+
readonly algo: Algo;
|
105
|
+
readonly pubkey: Uint8Array;
|
106
|
+
}
|
107
|
+
export interface DirectSignResponse {
|
108
|
+
/**
|
109
|
+
* The sign doc that was signed.
|
110
|
+
* This may be different from the input signDoc when the signer modifies it as part of the signing process.
|
111
|
+
*/
|
112
|
+
readonly signed: SignDoc;
|
113
|
+
readonly signature: StdSignature;
|
114
|
+
}
|
115
|
+
export interface OfflineDirectSigner {
|
116
|
+
readonly getAccounts: () => Promise<readonly AccountData[]>;
|
117
|
+
readonly signDirect: (
|
118
|
+
signerAddress: string,
|
119
|
+
signDoc: SignDoc
|
120
|
+
) => Promise<DirectSignResponse>;
|
121
|
+
}
|
122
|
+
|
123
|
+
export interface OfflineAminoSigner {
|
124
|
+
/**
|
125
|
+
* Get AccountData array from wallet. Rejects if not enabled.
|
126
|
+
*/
|
127
|
+
readonly getAccounts: () => Promise<readonly AccountData[]>;
|
128
|
+
/**
|
129
|
+
* Request signature from whichever key corresponds to provided bech32-encoded address. Rejects if not enabled.
|
130
|
+
*
|
131
|
+
* The signer implementation may offer the user the ability to override parts of the signDoc. It must
|
132
|
+
* return the doc that was signed in the response.
|
133
|
+
*
|
134
|
+
* @param signerAddress The address of the account that should sign the transaction
|
135
|
+
* @param signDoc The content that should be signed
|
136
|
+
*/
|
137
|
+
readonly signAmino: (
|
138
|
+
signerAddress: string,
|
139
|
+
signDoc: StdSignDoc
|
140
|
+
) => Promise<AminoSignResponse>;
|
141
|
+
}
|
package/src/index.ts
CHANGED
package/src/wallet/keplr.ts
CHANGED
@@ -4,10 +4,11 @@ import {
|
|
4
4
|
BroadcastMode,
|
5
5
|
AminoSignResponse,
|
6
6
|
StdSignDoc,
|
7
|
-
|
7
|
+
OfflineAminoSigner,
|
8
8
|
StdSignature,
|
9
|
-
|
10
|
-
|
9
|
+
DirectSignResponse,
|
10
|
+
OfflineDirectSigner,
|
11
|
+
} from "../cosmjs";
|
11
12
|
import { SecretUtils } from "secretjs/types/enigmautils";
|
12
13
|
import Long from "long";
|
13
14
|
|
@@ -99,11 +100,11 @@ export interface Keplr {
|
|
99
100
|
type: EthSignType
|
100
101
|
): Promise<Uint8Array>;
|
101
102
|
|
102
|
-
getOfflineSigner(chainId: string):
|
103
|
-
getOfflineSignerOnlyAmino(chainId: string):
|
103
|
+
getOfflineSigner(chainId: string): OfflineAminoSigner & OfflineDirectSigner;
|
104
|
+
getOfflineSignerOnlyAmino(chainId: string): OfflineAminoSigner;
|
104
105
|
getOfflineSignerAuto(
|
105
106
|
chainId: string
|
106
|
-
): Promise<
|
107
|
+
): Promise<OfflineAminoSigner | OfflineDirectSigner>;
|
107
108
|
|
108
109
|
suggestToken(
|
109
110
|
chainId: string,
|
package/src/window.ts
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
import { Keplr } from "./wallet";
|
2
|
-
import {
|
2
|
+
import { OfflineAminoSigner, OfflineDirectSigner } from "./cosmjs";
|
3
3
|
import { SecretUtils } from "secretjs/types/enigmautils";
|
4
|
-
import { OfflineDirectSigner } from "@cosmjs/proto-signing";
|
5
4
|
|
6
5
|
export interface Window {
|
7
6
|
keplr?: Keplr;
|
8
|
-
getOfflineSigner?: (
|
9
|
-
|
7
|
+
getOfflineSigner?: (
|
8
|
+
chainId: string
|
9
|
+
) => OfflineAminoSigner & OfflineDirectSigner;
|
10
|
+
getOfflineSignerOnlyAmino?: (chainId: string) => OfflineAminoSigner;
|
10
11
|
getOfflineSignerAuto?: (
|
11
12
|
chainId: string
|
12
|
-
) => Promise<
|
13
|
+
) => Promise<OfflineAminoSigner | OfflineDirectSigner>;
|
13
14
|
getEnigmaUtils?: (chainId: string) => SecretUtils;
|
14
15
|
}
|