@tomo-inc/wallet-utils 0.0.16 → 0.0.17

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/dist/index.cjs CHANGED
@@ -144,20 +144,20 @@ var isEmail = (email) => {
144
144
  };
145
145
 
146
146
  // src/global-config.ts
147
- var ChainTypes = /* @__PURE__ */ ((ChainTypes2) => {
148
- ChainTypes2["BTC"] = "btc";
149
- ChainTypes2["DOGE"] = "doge";
150
- ChainTypes2["EVM"] = "evm";
151
- ChainTypes2["SOL"] = "sol";
152
- ChainTypes2["SUI"] = "sui";
153
- ChainTypes2["TON"] = "ton";
154
- ChainTypes2["TRON"] = "tron";
155
- ChainTypes2["COSMOS"] = "cosmos";
156
- ChainTypes2["APTOS"] = "aptos";
157
- return ChainTypes2;
158
- })(ChainTypes || {});
147
+ var ChainTypeEnum = /* @__PURE__ */ ((ChainTypeEnum2) => {
148
+ ChainTypeEnum2["BITCOIN"] = "bitcoin";
149
+ ChainTypeEnum2["DOGECOIN"] = "dogecoin";
150
+ ChainTypeEnum2["EVM"] = "evm";
151
+ ChainTypeEnum2["SOLANA"] = "solana";
152
+ ChainTypeEnum2["APTOS"] = "aptos";
153
+ ChainTypeEnum2["COSMOS"] = "cosmos";
154
+ ChainTypeEnum2["TON"] = "ton";
155
+ ChainTypeEnum2["TRON"] = "tron";
156
+ ChainTypeEnum2["SUI"] = "sui";
157
+ return ChainTypeEnum2;
158
+ })(ChainTypeEnum || {});
159
159
  var SupportedChainTypes = {
160
- ["doge" /* DOGE */]: {
160
+ ["dogecoin" /* DOGECOIN */]: {
161
161
  chainId: "3",
162
162
  chainIndex: 300,
163
163
  support: true,
@@ -171,7 +171,7 @@ var SupportedChainTypes = {
171
171
  gasFee: 1e-5,
172
172
  dust: 0
173
173
  },
174
- ["sol" /* SOL */]: {
174
+ ["solana" /* SOLANA */]: {
175
175
  chainId: "501",
176
176
  chainIndex: 50100,
177
177
  support: true,
@@ -187,7 +187,7 @@ var SupportedChainTypes = {
187
187
  gasFee: 0.5,
188
188
  dust: 0
189
189
  },
190
- ["btc" /* BTC */]: {
190
+ ["bitcoin" /* BITCOIN */]: {
191
191
  chainId: "0",
192
192
  //livenet
193
193
  chainIndex: 0,
@@ -216,6 +216,18 @@ var SupportedChainTypes = {
216
216
  dust: 0
217
217
  }
218
218
  };
219
+ var ProviderProtocol = /* @__PURE__ */ ((ProviderProtocol2) => {
220
+ ProviderProtocol2["INJECT"] = "inject";
221
+ ProviderProtocol2["DEEPLINK"] = "deeplink";
222
+ ProviderProtocol2["WALLET_CONNECT"] = "wallet-connect";
223
+ return ProviderProtocol2;
224
+ })(ProviderProtocol || {});
225
+ var ProviderStandard = /* @__PURE__ */ ((ProviderStandard2) => {
226
+ ProviderStandard2["NORMAL"] = "normal";
227
+ ProviderStandard2["EIP1193"] = "eip1193";
228
+ ProviderStandard2["WALLET_STANDARD"] = "wallet-standard";
229
+ return ProviderStandard2;
230
+ })(ProviderStandard || {});
219
231
 
220
232
  // src/password.ts
221
233
  var validatePassword = (password) => {
@@ -331,9 +343,11 @@ var TomoApiDomains = {
331
343
  dev: "https://wallet-test.tomo.inc"
332
344
  };
333
345
 
334
- exports.ChainTypes = ChainTypes;
346
+ exports.ChainTypeEnum = ChainTypeEnum;
335
347
  exports.CubeOrgIds = CubeOrgIds;
336
348
  exports.CubeStages = CubeStages;
349
+ exports.ProviderProtocol = ProviderProtocol;
350
+ exports.ProviderStandard = ProviderStandard;
337
351
  exports.RelayOrigins = RelayOrigins;
338
352
  exports.SupportedChainTypes = SupportedChainTypes;
339
353
  exports.TomoApiDomains = TomoApiDomains;
package/dist/index.d.cts CHANGED
@@ -18,16 +18,20 @@ declare const getBrowserName: () => string;
18
18
  declare const maskEmail: (email: string) => string | null | undefined;
19
19
  declare const isEmail: (email: string) => boolean;
20
20
 
21
- declare enum ChainTypes {
22
- BTC = "btc",
23
- DOGE = "doge",
21
+ /**
22
+ * Chain types supported by the wallet
23
+ * The name must be explicitly defined in the enum.
24
+ */
25
+ declare enum ChainTypeEnum {
26
+ BITCOIN = "bitcoin",
27
+ DOGECOIN = "dogecoin",
24
28
  EVM = "evm",
25
- SOL = "sol",
26
- SUI = "sui",
29
+ SOLANA = "solana",
30
+ APTOS = "aptos",
31
+ COSMOS = "cosmos",
27
32
  TON = "ton",
28
33
  TRON = "tron",
29
- COSMOS = "cosmos",
30
- APTOS = "aptos"
34
+ SUI = "sui"
31
35
  }
32
36
  interface ChainTypeConfig {
33
37
  chainId?: string;
@@ -37,7 +41,17 @@ interface ChainTypeConfig {
37
41
  dust: number;
38
42
  reserve?: number;
39
43
  }
40
- declare const SupportedChainTypes: Record<ChainTypes, ChainTypeConfig>;
44
+ declare const SupportedChainTypes: Record<ChainTypeEnum, ChainTypeConfig>;
45
+ declare enum ProviderProtocol {
46
+ INJECT = "inject",// fork from eip6963
47
+ DEEPLINK = "deeplink",
48
+ WALLET_CONNECT = "wallet-connect"
49
+ }
50
+ declare enum ProviderStandard {
51
+ NORMAL = "normal",
52
+ EIP1193 = "eip1193",
53
+ WALLET_STANDARD = "wallet-standard"
54
+ }
41
55
 
42
56
  declare const validatePassword: (password: string) => boolean;
43
57
 
@@ -75,4 +89,4 @@ declare const TomoApiDomains: {
75
89
  dev: string;
76
90
  };
77
91
 
78
- export { ChainTypes, CubeOrgIds, type CubeStage, CubeStages, RelayOrigins, SupportedChainTypes, TomoApiDomains, type TomoStage, cache, calcCtrLength, compareString, getBrowserName, getExplorerUrl, isEmail, maskEmail, stripHexPrefix, subs, validatePassword };
92
+ export { ChainTypeEnum, CubeOrgIds, type CubeStage, CubeStages, ProviderProtocol, ProviderStandard, RelayOrigins, SupportedChainTypes, TomoApiDomains, type TomoStage, cache, calcCtrLength, compareString, getBrowserName, getExplorerUrl, isEmail, maskEmail, stripHexPrefix, subs, validatePassword };
package/dist/index.d.ts CHANGED
@@ -18,16 +18,20 @@ declare const getBrowserName: () => string;
18
18
  declare const maskEmail: (email: string) => string | null | undefined;
19
19
  declare const isEmail: (email: string) => boolean;
20
20
 
21
- declare enum ChainTypes {
22
- BTC = "btc",
23
- DOGE = "doge",
21
+ /**
22
+ * Chain types supported by the wallet
23
+ * The name must be explicitly defined in the enum.
24
+ */
25
+ declare enum ChainTypeEnum {
26
+ BITCOIN = "bitcoin",
27
+ DOGECOIN = "dogecoin",
24
28
  EVM = "evm",
25
- SOL = "sol",
26
- SUI = "sui",
29
+ SOLANA = "solana",
30
+ APTOS = "aptos",
31
+ COSMOS = "cosmos",
27
32
  TON = "ton",
28
33
  TRON = "tron",
29
- COSMOS = "cosmos",
30
- APTOS = "aptos"
34
+ SUI = "sui"
31
35
  }
32
36
  interface ChainTypeConfig {
33
37
  chainId?: string;
@@ -37,7 +41,17 @@ interface ChainTypeConfig {
37
41
  dust: number;
38
42
  reserve?: number;
39
43
  }
40
- declare const SupportedChainTypes: Record<ChainTypes, ChainTypeConfig>;
44
+ declare const SupportedChainTypes: Record<ChainTypeEnum, ChainTypeConfig>;
45
+ declare enum ProviderProtocol {
46
+ INJECT = "inject",// fork from eip6963
47
+ DEEPLINK = "deeplink",
48
+ WALLET_CONNECT = "wallet-connect"
49
+ }
50
+ declare enum ProviderStandard {
51
+ NORMAL = "normal",
52
+ EIP1193 = "eip1193",
53
+ WALLET_STANDARD = "wallet-standard"
54
+ }
41
55
 
42
56
  declare const validatePassword: (password: string) => boolean;
43
57
 
@@ -75,4 +89,4 @@ declare const TomoApiDomains: {
75
89
  dev: string;
76
90
  };
77
91
 
78
- export { ChainTypes, CubeOrgIds, type CubeStage, CubeStages, RelayOrigins, SupportedChainTypes, TomoApiDomains, type TomoStage, cache, calcCtrLength, compareString, getBrowserName, getExplorerUrl, isEmail, maskEmail, stripHexPrefix, subs, validatePassword };
92
+ export { ChainTypeEnum, CubeOrgIds, type CubeStage, CubeStages, ProviderProtocol, ProviderStandard, RelayOrigins, SupportedChainTypes, TomoApiDomains, type TomoStage, cache, calcCtrLength, compareString, getBrowserName, getExplorerUrl, isEmail, maskEmail, stripHexPrefix, subs, validatePassword };
package/dist/index.js CHANGED
@@ -142,20 +142,20 @@ var isEmail = (email) => {
142
142
  };
143
143
 
144
144
  // src/global-config.ts
145
- var ChainTypes = /* @__PURE__ */ ((ChainTypes2) => {
146
- ChainTypes2["BTC"] = "btc";
147
- ChainTypes2["DOGE"] = "doge";
148
- ChainTypes2["EVM"] = "evm";
149
- ChainTypes2["SOL"] = "sol";
150
- ChainTypes2["SUI"] = "sui";
151
- ChainTypes2["TON"] = "ton";
152
- ChainTypes2["TRON"] = "tron";
153
- ChainTypes2["COSMOS"] = "cosmos";
154
- ChainTypes2["APTOS"] = "aptos";
155
- return ChainTypes2;
156
- })(ChainTypes || {});
145
+ var ChainTypeEnum = /* @__PURE__ */ ((ChainTypeEnum2) => {
146
+ ChainTypeEnum2["BITCOIN"] = "bitcoin";
147
+ ChainTypeEnum2["DOGECOIN"] = "dogecoin";
148
+ ChainTypeEnum2["EVM"] = "evm";
149
+ ChainTypeEnum2["SOLANA"] = "solana";
150
+ ChainTypeEnum2["APTOS"] = "aptos";
151
+ ChainTypeEnum2["COSMOS"] = "cosmos";
152
+ ChainTypeEnum2["TON"] = "ton";
153
+ ChainTypeEnum2["TRON"] = "tron";
154
+ ChainTypeEnum2["SUI"] = "sui";
155
+ return ChainTypeEnum2;
156
+ })(ChainTypeEnum || {});
157
157
  var SupportedChainTypes = {
158
- ["doge" /* DOGE */]: {
158
+ ["dogecoin" /* DOGECOIN */]: {
159
159
  chainId: "3",
160
160
  chainIndex: 300,
161
161
  support: true,
@@ -169,7 +169,7 @@ var SupportedChainTypes = {
169
169
  gasFee: 1e-5,
170
170
  dust: 0
171
171
  },
172
- ["sol" /* SOL */]: {
172
+ ["solana" /* SOLANA */]: {
173
173
  chainId: "501",
174
174
  chainIndex: 50100,
175
175
  support: true,
@@ -185,7 +185,7 @@ var SupportedChainTypes = {
185
185
  gasFee: 0.5,
186
186
  dust: 0
187
187
  },
188
- ["btc" /* BTC */]: {
188
+ ["bitcoin" /* BITCOIN */]: {
189
189
  chainId: "0",
190
190
  //livenet
191
191
  chainIndex: 0,
@@ -214,6 +214,18 @@ var SupportedChainTypes = {
214
214
  dust: 0
215
215
  }
216
216
  };
217
+ var ProviderProtocol = /* @__PURE__ */ ((ProviderProtocol2) => {
218
+ ProviderProtocol2["INJECT"] = "inject";
219
+ ProviderProtocol2["DEEPLINK"] = "deeplink";
220
+ ProviderProtocol2["WALLET_CONNECT"] = "wallet-connect";
221
+ return ProviderProtocol2;
222
+ })(ProviderProtocol || {});
223
+ var ProviderStandard = /* @__PURE__ */ ((ProviderStandard2) => {
224
+ ProviderStandard2["NORMAL"] = "normal";
225
+ ProviderStandard2["EIP1193"] = "eip1193";
226
+ ProviderStandard2["WALLET_STANDARD"] = "wallet-standard";
227
+ return ProviderStandard2;
228
+ })(ProviderStandard || {});
217
229
 
218
230
  // src/password.ts
219
231
  var validatePassword = (password) => {
@@ -329,4 +341,4 @@ var TomoApiDomains = {
329
341
  dev: "https://wallet-test.tomo.inc"
330
342
  };
331
343
 
332
- export { ChainTypes, CubeOrgIds, CubeStages, RelayOrigins, SupportedChainTypes, TomoApiDomains, cache_exports as cache, calcCtrLength, compareString, getBrowserName, getExplorerUrl, isEmail, maskEmail, stripHexPrefix, subs, validatePassword };
344
+ export { ChainTypeEnum, CubeOrgIds, CubeStages, ProviderProtocol, ProviderStandard, RelayOrigins, SupportedChainTypes, TomoApiDomains, cache_exports as cache, calcCtrLength, compareString, getBrowserName, getExplorerUrl, isEmail, maskEmail, stripHexPrefix, subs, validatePassword };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomo-inc/wallet-utils",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "author": "tomo.inc",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -1,13 +1,17 @@
1
- export enum ChainTypes {
2
- BTC = "btc",
3
- DOGE = "doge",
1
+ /**
2
+ * Chain types supported by the wallet
3
+ * The name must be explicitly defined in the enum.
4
+ */
5
+ export enum ChainTypeEnum {
6
+ BITCOIN = "bitcoin",
7
+ DOGECOIN = "dogecoin",
4
8
  EVM = "evm",
5
- SOL = "sol",
6
- SUI = "sui",
9
+ SOLANA = "solana",
10
+ APTOS = "aptos",
11
+ COSMOS = "cosmos",
7
12
  TON = "ton",
8
13
  TRON = "tron",
9
- COSMOS = "cosmos",
10
- APTOS = "aptos",
14
+ SUI = "sui",
11
15
  }
12
16
 
13
17
  interface ChainTypeConfig {
@@ -19,22 +23,22 @@ interface ChainTypeConfig {
19
23
  reserve?: number;
20
24
  }
21
25
 
22
- export const SupportedChainTypes: Record<ChainTypes, ChainTypeConfig> = {
23
- [ChainTypes.DOGE]: {
26
+ export const SupportedChainTypes: Record<ChainTypeEnum, ChainTypeConfig> = {
27
+ [ChainTypeEnum.DOGECOIN]: {
24
28
  chainId: "3",
25
29
  chainIndex: 300,
26
30
  support: true,
27
31
  gasFee: 0.5,
28
32
  dust: 0.0001,
29
33
  },
30
- [ChainTypes.EVM]: {
34
+ [ChainTypeEnum.EVM]: {
31
35
  chainId: "1",
32
36
  chainIndex: 100,
33
37
  support: true,
34
38
  gasFee: 0.00001,
35
39
  dust: 0,
36
40
  },
37
- [ChainTypes.SOL]: {
41
+ [ChainTypeEnum.SOLANA]: {
38
42
  chainId: "501",
39
43
  chainIndex: 50100,
40
44
  support: true,
@@ -42,38 +46,50 @@ export const SupportedChainTypes: Record<ChainTypes, ChainTypeConfig> = {
42
46
  dust: 0,
43
47
  reserve: 0.0009, // Available balance = Total balance - Reserve balance (for rent exemption)
44
48
  },
45
- [ChainTypes.TRON]: {
49
+ [ChainTypeEnum.TRON]: {
46
50
  chainId: "19484",
47
51
  chainIndex: 1948400,
48
52
  support: true,
49
53
  gasFee: 0.5,
50
54
  dust: 0,
51
55
  },
52
- [ChainTypes.BTC]: {
56
+ [ChainTypeEnum.BITCOIN]: {
53
57
  chainId: "0", //livenet
54
58
  chainIndex: 0,
55
59
  support: false,
56
60
  gasFee: 0.00001,
57
61
  dust: 0.0001,
58
62
  },
59
- [ChainTypes.SUI]: {
63
+ [ChainTypeEnum.SUI]: {
60
64
  support: false,
61
65
  gasFee: 0,
62
66
  dust: 0,
63
67
  },
64
- [ChainTypes.TON]: {
68
+ [ChainTypeEnum.TON]: {
65
69
  support: false,
66
70
  gasFee: 0,
67
71
  dust: 0,
68
72
  },
69
- [ChainTypes.COSMOS]: {
73
+ [ChainTypeEnum.COSMOS]: {
70
74
  support: false,
71
75
  gasFee: 0,
72
76
  dust: 0,
73
77
  },
74
- [ChainTypes.APTOS]: {
78
+ [ChainTypeEnum.APTOS]: {
75
79
  support: false,
76
80
  gasFee: 0,
77
81
  dust: 0,
78
82
  },
79
83
  };
84
+
85
+ export enum ProviderProtocol {
86
+ INJECT = "inject", // fork from eip6963
87
+ DEEPLINK = "deeplink",
88
+ WALLET_CONNECT = "wallet-connect",
89
+ }
90
+
91
+ export enum ProviderStandard {
92
+ NORMAL = "normal",
93
+ EIP1193 = "eip1193",
94
+ WALLET_STANDARD = "wallet-standard",
95
+ }