@keplr-wallet/types 0.13.13 → 0.13.15-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.
@@ -43,7 +43,11 @@ export interface ChainInfo {
43
43
  readonly hideInUI?: boolean;
44
44
  readonly evm?: EVMInfo;
45
45
  readonly isTestnet?: boolean;
46
+ readonly explorers?: {
47
+ readonly txPage: string;
48
+ };
46
49
  }
50
+ export declare function isEthSignChainInfo(chainInfo: ChainInfo): boolean;
47
51
  export type ChainInfoWithoutEndpoints = Omit<ChainInfo, "rest" | "rpc" | "nodeProvider" | "evm"> & {
48
52
  readonly rest: undefined;
49
53
  readonly rpc: undefined;
@@ -66,24 +70,84 @@ export interface BitcoinChainInfo {
66
70
  readonly bip44: BIP44;
67
71
  readonly currencies: AppCurrency[];
68
72
  }
69
- export type ChainInfoModule = "cosmos" | "starknet" | "bitcoin";
70
- export type ModularChainInfo = {
73
+ export interface CosmosChainInfo {
74
+ readonly rpc: string;
75
+ readonly rest: string;
76
+ readonly nodeProvider?: {
77
+ readonly name: string;
78
+ readonly email?: string;
79
+ readonly discord?: string;
80
+ readonly website?: string;
81
+ };
71
82
  readonly chainId: string;
72
83
  readonly chainName: string;
84
+ /**
85
+ * This indicates the type of coin that can be used for stake.
86
+ * You can get actual currency information from Currencies.
87
+ */
88
+ readonly stakeCurrency?: Currency;
89
+ readonly walletUrl?: string;
90
+ readonly walletUrlForStaking?: string;
91
+ readonly bip44: BIP44;
92
+ readonly alternativeBIP44s?: BIP44[];
93
+ readonly bech32Config?: Bech32Config;
94
+ readonly currencies: AppCurrency[];
95
+ /**
96
+ * This indicates which coin or token can be used for fee to send transaction.
97
+ * You can get actual currency information from Currencies.
98
+ */
99
+ readonly feeCurrencies: FeeCurrency[];
100
+ /**
101
+ * Indicate the features supported by this chain. Ex) cosmwasm, secretwasm ...
102
+ */
103
+ readonly features?: string[];
104
+ /**
105
+ * Shows whether the blockchain is in production phase or beta phase.
106
+ * Major features such as staking and sending are supported on staging blockchains, but without guarantee.
107
+ * If the blockchain is in an early stage, please set it as beta.
108
+ */
109
+ readonly beta?: boolean;
73
110
  readonly chainSymbolImageUrl?: string;
74
111
  readonly isTestnet?: boolean;
75
- readonly cosmos: ChainInfo;
76
- } | {
112
+ }
113
+ export interface EvmChainInfo {
114
+ readonly chainId: number;
115
+ readonly rpc: string;
116
+ readonly websocket?: string;
117
+ readonly nativeCurrency: Currency;
118
+ readonly tokens: ERC20Currency[];
119
+ readonly features?: string[];
120
+ }
121
+ export type ModularChainInfoCommon = {
122
+ readonly isV2: true;
77
123
  readonly chainId: string;
78
124
  readonly chainName: string;
79
125
  readonly chainSymbolImageUrl?: string;
80
126
  readonly isTestnet?: boolean;
127
+ readonly hideInUI?: boolean;
128
+ readonly isBuiltInChain?: boolean;
129
+ readonly linkedChainKey?: string;
130
+ };
131
+ export type ModularChainInfoWithTypes = {
132
+ readonly type: "cosmos";
133
+ readonly cosmos: CosmosChainInfo;
134
+ } | {
135
+ readonly type: "ethermint";
136
+ readonly evm: EvmChainInfo;
137
+ readonly cosmos: CosmosChainInfo;
138
+ } | {
139
+ readonly type: "evm";
140
+ readonly evm: EvmChainInfo;
141
+ } | {
142
+ readonly type: "starknet";
81
143
  readonly starknet: StarknetChainInfo;
82
144
  } | {
83
- readonly chainId: string;
84
- readonly chainName: string;
85
- readonly chainSymbolImageUrl?: string;
86
- readonly linkedChainKey: string;
87
- readonly isTestnet?: boolean;
145
+ readonly type: "bitcoin";
88
146
  readonly bitcoin: BitcoinChainInfo;
89
147
  };
148
+ export type ModularChainInfo = ModularChainInfoCommon & ModularChainInfoWithTypes;
149
+ export type ModularChainInfoTypeNames = ModularChainInfoWithTypes["type"];
150
+ export type ModularChainInfoByType<T extends ModularChainInfoTypeNames> = ModularChainInfoCommon & Extract<ModularChainInfoWithTypes, {
151
+ type: T;
152
+ }>;
153
+ export declare function isEthSignChain(modularChainInfo: ModularChainInfo): boolean;
@@ -1,3 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isEthSignChain = exports.isEthSignChainInfo = void 0;
4
+ function isEthSignChainInfo(chainInfo) {
5
+ var _a, _b;
6
+ return (!!chainInfo.evm ||
7
+ chainInfo.bip44.coinType === 60 ||
8
+ !!((_a = chainInfo.features) === null || _a === void 0 ? void 0 : _a.includes("eth-address-gen")) ||
9
+ !!((_b = chainInfo.features) === null || _b === void 0 ? void 0 : _b.includes("eth-key-sign")));
10
+ }
11
+ exports.isEthSignChainInfo = isEthSignChainInfo;
12
+ function isEthSignChain(modularChainInfo) {
13
+ var _a, _b;
14
+ switch (modularChainInfo.type) {
15
+ case "ethermint":
16
+ case "evm":
17
+ return true;
18
+ case "cosmos":
19
+ return (modularChainInfo.cosmos.bip44.coinType === 60 ||
20
+ !!((_a = modularChainInfo.cosmos.features) === null || _a === void 0 ? void 0 : _a.includes("eth-address-gen")) ||
21
+ !!((_b = modularChainInfo.cosmos.features) === null || _b === void 0 ? void 0 : _b.includes("eth-key-sign")));
22
+ default:
23
+ return false;
24
+ }
25
+ }
26
+ exports.isEthSignChain = isEthSignChain;
3
27
  //# sourceMappingURL=chain-info.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"chain-info.js","sourceRoot":"","sources":["../src/chain-info.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"chain-info.js","sourceRoot":"","sources":["../src/chain-info.ts"],"names":[],"mappings":";;;AA2DA,SAAgB,kBAAkB,CAAC,SAAoB;;IACrD,OAAO,CACL,CAAC,CAAC,SAAS,CAAC,GAAG;QACf,SAAS,CAAC,KAAK,CAAC,QAAQ,KAAK,EAAE;QAC/B,CAAC,CAAC,CAAA,MAAA,SAAS,CAAC,QAAQ,0CAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAA;QACjD,CAAC,CAAC,CAAA,MAAA,SAAS,CAAC,QAAQ,0CAAE,QAAQ,CAAC,cAAc,CAAC,CAAA,CAC/C,CAAC;AACJ,CAAC;AAPD,gDAOC;AAgID,SAAgB,cAAc,CAAC,gBAAkC;;IAC/D,QAAQ,gBAAgB,CAAC,IAAI,EAAE;QAC7B,KAAK,WAAW,CAAC;QACjB,KAAK,KAAK;YACR,OAAO,IAAI,CAAC;QACd,KAAK,QAAQ;YACX,OAAO,CACL,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,KAAK,EAAE;gBAC7C,CAAC,CAAC,CAAA,MAAA,gBAAgB,CAAC,MAAM,CAAC,QAAQ,0CAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAA;gBAC/D,CAAC,CAAC,CAAA,MAAA,gBAAgB,CAAC,MAAM,CAAC,QAAQ,0CAAE,QAAQ,CAAC,cAAc,CAAC,CAAA,CAC7D,CAAC;QACJ;YACE,OAAO,KAAK,CAAC;KAChB;AACH,CAAC;AAdD,wCAcC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keplr-wallet/types",
3
- "version": "0.13.13",
3
+ "version": "0.13.15-rc.0",
4
4
  "main": "build/index.js",
5
5
  "author": "chainapsis",
6
6
  "license": "Apache-2.0",
@@ -26,5 +26,5 @@
26
26
  "peerDependencies": {
27
27
  "starknet": "^8"
28
28
  },
29
- "gitHead": "d806e87af06491dd189d849f69614a8b06c627bc"
29
+ "gitHead": "5a3e0763e91ef98e83059cb7340074b5967cf897"
30
30
  }
package/src/chain-info.ts CHANGED
@@ -51,6 +51,19 @@ export interface ChainInfo {
51
51
  readonly evm?: EVMInfo;
52
52
 
53
53
  readonly isTestnet?: boolean;
54
+
55
+ readonly explorers?: {
56
+ readonly txPage: string;
57
+ };
58
+ }
59
+
60
+ export function isEthSignChainInfo(chainInfo: ChainInfo): boolean {
61
+ return (
62
+ !!chainInfo.evm ||
63
+ chainInfo.bip44.coinType === 60 ||
64
+ !!chainInfo.features?.includes("eth-address-gen") ||
65
+ !!chainInfo.features?.includes("eth-key-sign")
66
+ );
54
67
  }
55
68
 
56
69
  export type ChainInfoWithoutEndpoints = Omit<
@@ -81,28 +94,116 @@ export interface BitcoinChainInfo {
81
94
  readonly currencies: AppCurrency[];
82
95
  }
83
96
 
84
- export type ChainInfoModule = "cosmos" | "starknet" | "bitcoin";
97
+ export interface CosmosChainInfo {
98
+ readonly rpc: string;
99
+ readonly rest: string;
100
+ readonly nodeProvider?: {
101
+ readonly name: string;
102
+ readonly email?: string;
103
+ readonly discord?: string;
104
+ readonly website?: string;
105
+ };
106
+ readonly chainId: string;
107
+ readonly chainName: string;
108
+ /**
109
+ * This indicates the type of coin that can be used for stake.
110
+ * You can get actual currency information from Currencies.
111
+ */
112
+ readonly stakeCurrency?: Currency;
113
+ readonly walletUrl?: string;
114
+ readonly walletUrlForStaking?: string;
115
+ readonly bip44: BIP44;
116
+ readonly alternativeBIP44s?: BIP44[];
117
+ readonly bech32Config?: Bech32Config;
85
118
 
86
- export type ModularChainInfo =
119
+ readonly currencies: AppCurrency[];
120
+ /**
121
+ * This indicates which coin or token can be used for fee to send transaction.
122
+ * You can get actual currency information from Currencies.
123
+ */
124
+ readonly feeCurrencies: FeeCurrency[];
125
+
126
+ /**
127
+ * Indicate the features supported by this chain. Ex) cosmwasm, secretwasm ...
128
+ */
129
+ readonly features?: string[];
130
+
131
+ /**
132
+ * Shows whether the blockchain is in production phase or beta phase.
133
+ * Major features such as staking and sending are supported on staging blockchains, but without guarantee.
134
+ * If the blockchain is in an early stage, please set it as beta.
135
+ */
136
+ readonly beta?: boolean;
137
+
138
+ readonly chainSymbolImageUrl?: string;
139
+
140
+ readonly isTestnet?: boolean;
141
+ }
142
+
143
+ export interface EvmChainInfo {
144
+ readonly chainId: number;
145
+ readonly rpc: string;
146
+ readonly websocket?: string;
147
+ readonly nativeCurrency: Currency;
148
+ readonly tokens: ERC20Currency[];
149
+ readonly features?: string[];
150
+ }
151
+
152
+ export type ModularChainInfoCommon = {
153
+ readonly isV2: true;
154
+
155
+ readonly chainId: string;
156
+ readonly chainName: string;
157
+ readonly chainSymbolImageUrl?: string;
158
+ readonly isTestnet?: boolean;
159
+ readonly hideInUI?: boolean;
160
+ readonly isBuiltInChain?: boolean;
161
+
162
+ readonly linkedChainKey?: string;
163
+ };
164
+ export type ModularChainInfoWithTypes =
87
165
  | {
88
- readonly chainId: string;
89
- readonly chainName: string;
90
- readonly chainSymbolImageUrl?: string;
91
- readonly isTestnet?: boolean;
92
- readonly cosmos: ChainInfo;
166
+ readonly type: "cosmos";
167
+ readonly cosmos: CosmosChainInfo;
93
168
  }
94
169
  | {
95
- readonly chainId: string;
96
- readonly chainName: string;
97
- readonly chainSymbolImageUrl?: string;
98
- readonly isTestnet?: boolean;
170
+ readonly type: "ethermint";
171
+ readonly evm: EvmChainInfo;
172
+ readonly cosmos: CosmosChainInfo;
173
+ }
174
+ | {
175
+ readonly type: "evm";
176
+ readonly evm: EvmChainInfo;
177
+ }
178
+ | {
179
+ readonly type: "starknet";
99
180
  readonly starknet: StarknetChainInfo;
100
181
  }
101
182
  | {
102
- readonly chainId: string;
103
- readonly chainName: string;
104
- readonly chainSymbolImageUrl?: string;
105
- readonly linkedChainKey: string;
106
- readonly isTestnet?: boolean;
183
+ readonly type: "bitcoin";
107
184
  readonly bitcoin: BitcoinChainInfo;
108
185
  };
186
+
187
+ export type ModularChainInfo = ModularChainInfoCommon &
188
+ ModularChainInfoWithTypes;
189
+
190
+ export type ModularChainInfoTypeNames = ModularChainInfoWithTypes["type"];
191
+
192
+ export type ModularChainInfoByType<T extends ModularChainInfoTypeNames> =
193
+ ModularChainInfoCommon & Extract<ModularChainInfoWithTypes, { type: T }>;
194
+
195
+ export function isEthSignChain(modularChainInfo: ModularChainInfo): boolean {
196
+ switch (modularChainInfo.type) {
197
+ case "ethermint":
198
+ case "evm":
199
+ return true;
200
+ case "cosmos":
201
+ return (
202
+ modularChainInfo.cosmos.bip44.coinType === 60 ||
203
+ !!modularChainInfo.cosmos.features?.includes("eth-address-gen") ||
204
+ !!modularChainInfo.cosmos.features?.includes("eth-key-sign")
205
+ );
206
+ default:
207
+ return false;
208
+ }
209
+ }
@@ -22,6 +22,8 @@
22
22
  "@keplr-wallet/hooks/build/*": ["../hooks/src/*"],
23
23
  "@keplr-wallet/hooks-bitcoin": ["../hooks-bitcoin/src"],
24
24
  "@keplr-wallet/hooks-bitcoin/build/*": ["../hooks-bitcoin/src/*"],
25
+ "@keplr-wallet/hooks-evm": ["../hooks-evm/src"],
26
+ "@keplr-wallet/hooks-evm/build/*": ["../hooks-evm/src/*"],
25
27
  "@keplr-wallet/hooks-starknet": ["../hooks-starknet/src"],
26
28
  "@keplr-wallet/hooks-starknet/build/*": ["../hooks-starknet/src/*"],
27
29
  "@keplr-wallet/ledger-cosmos": ["../ledger-cosmos/src"],