carbon-js-sdk 0.3.49 → 0.3.51

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.
Files changed (106) hide show
  1. package/lib/CarbonSDK.d.ts +2 -0
  2. package/lib/CarbonSDK.js +10 -0
  3. package/lib/clients/ETHClient.d.ts +2 -0
  4. package/lib/clients/ETHClient.js +3 -1
  5. package/lib/codec/broker/event.d.ts +13 -7
  6. package/lib/codec/broker/event.js +181 -93
  7. package/lib/codec/cdp/asset_params.d.ts +17 -0
  8. package/lib/codec/cdp/asset_params.js +148 -1
  9. package/lib/codec/cdp/tx.d.ts +2 -2
  10. package/lib/codec/cdp/tx.js +5 -5
  11. package/lib/codec/ibc/applications/interchain_accounts/controller/export.d.ts +1 -1
  12. package/lib/codec/ibc/applications/interchain_accounts/controller/export.js +3 -1
  13. package/lib/codec/ibc/applications/interchain_accounts/controller/v1/query.d.ts +26 -0
  14. package/lib/codec/ibc/applications/interchain_accounts/controller/v1/query.js +113 -1
  15. package/lib/codec/ibc/applications/transfer/v1/export.d.ts +1 -1
  16. package/lib/codec/ibc/applications/transfer/v1/export.js +3 -1
  17. package/lib/codec/ibc/applications/transfer/v1/query.d.ts +30 -1
  18. package/lib/codec/ibc/applications/transfer/v1/query.js +110 -1
  19. package/lib/codec/ibc/applications/transfer/v1/tx.d.ts +8 -4
  20. package/lib/codec/ibc/applications/transfer/v1/tx.js +35 -6
  21. package/lib/codec/ibc/applications/transfer/v2/packet.d.ts +2 -0
  22. package/lib/codec/ibc/applications/transfer/v2/packet.js +14 -1
  23. package/lib/codec/ibc/core/channel/v1/tx.d.ts +12 -10
  24. package/lib/codec/ibc/core/channel/v1/tx.js +50 -25
  25. package/lib/codec/ibc/core/client/v1/export.d.ts +1 -1
  26. package/lib/codec/ibc/core/client/v1/export.js +3 -1
  27. package/lib/codec/ibc/core/client/v1/query.d.ts +37 -0
  28. package/lib/codec/ibc/core/client/v1/query.js +137 -1
  29. package/lib/codec/ibc/lightclients/tendermint/v1/tendermint.d.ts +6 -4
  30. package/lib/codec/index.d.ts +1 -1
  31. package/lib/codec/index.js +13 -12
  32. package/lib/codec/{evmmerge/event.d.ts → liquiditypool/legacy.d.ts} +9 -11
  33. package/lib/codec/liquiditypool/legacy.js +64 -0
  34. package/lib/constant/network.d.ts +2 -0
  35. package/lib/constant/network.js +72 -0
  36. package/lib/modules/admin.d.ts +8 -1
  37. package/lib/modules/admin.js +8 -8
  38. package/lib/provider/metamask/MetaMask.d.ts +2 -2
  39. package/lib/provider/metamask/MetaMask.js +90 -0
  40. package/lib/util/blockchain.d.ts +7 -1
  41. package/lib/util/blockchain.js +20 -0
  42. package/lib/websocket/models.d.ts +18 -0
  43. package/package.json +1 -1
  44. package/lib/clients/EvmIbcClient.d.ts +0 -86
  45. package/lib/clients/EvmIbcClient.js +0 -90
  46. package/lib/codec/ethermint/crypto/v1/ethsecp256k1/keys.d.ts +0 -39
  47. package/lib/codec/ethermint/crypto/v1/ethsecp256k1/keys.js +0 -138
  48. package/lib/codec/ethermint/evm/v1/evm.d.ts +0 -239
  49. package/lib/codec/ethermint/evm/v1/evm.js +0 -1140
  50. package/lib/codec/ethermint/evm/v1/genesis.d.ts +0 -43
  51. package/lib/codec/ethermint/evm/v1/genesis.js +0 -153
  52. package/lib/codec/ethermint/evm/v1/query.d.ts +0 -424
  53. package/lib/codec/ethermint/evm/v1/query.js +0 -1637
  54. package/lib/codec/ethermint/evm/v1/tx.d.ts +0 -183
  55. package/lib/codec/ethermint/evm/v1/tx.js +0 -836
  56. package/lib/codec/ethermint/feemarket/v1/feemarket.d.ts +0 -41
  57. package/lib/codec/ethermint/feemarket/v1/feemarket.js +0 -149
  58. package/lib/codec/ethermint/feemarket/v1/genesis.d.ts +0 -26
  59. package/lib/codec/ethermint/feemarket/v1/genesis.js +0 -79
  60. package/lib/codec/ethermint/feemarket/v1/query.d.ts +0 -100
  61. package/lib/codec/ethermint/feemarket/v1/query.js +0 -276
  62. package/lib/codec/ethermint/types/v1/account.d.ts +0 -26
  63. package/lib/codec/ethermint/types/v1/account.js +0 -78
  64. package/lib/codec/ethermint/types/v1/dynamic_fee.d.ts +0 -20
  65. package/lib/codec/ethermint/types/v1/dynamic_fee.js +0 -60
  66. package/lib/codec/ethermint/types/v1/indexer.d.ts +0 -41
  67. package/lib/codec/ethermint/types/v1/indexer.js +0 -153
  68. package/lib/codec/ethermint/types/v1/web3.d.ts +0 -36
  69. package/lib/codec/ethermint/types/v1/web3.js +0 -124
  70. package/lib/codec/evmbank/genesis.d.ts +0 -32
  71. package/lib/codec/evmbank/genesis.js +0 -152
  72. package/lib/codec/evmbank/query.d.ts +0 -40
  73. package/lib/codec/evmbank/query.js +0 -116
  74. package/lib/codec/evmmerge/event.js +0 -90
  75. package/lib/codec/evmmerge/genesis.d.ts +0 -48
  76. package/lib/codec/evmmerge/genesis.js +0 -216
  77. package/lib/codec/evmmerge/offchain.d.ts +0 -22
  78. package/lib/codec/evmmerge/offchain.js +0 -105
  79. package/lib/codec/evmmerge/query.d.ts +0 -43
  80. package/lib/codec/evmmerge/query.js +0 -117
  81. package/lib/codec/evmmerge/tx.d.ts +0 -45
  82. package/lib/codec/evmmerge/tx.js +0 -128
  83. package/lib/codec/ibc/applications/fee/v1/ack.d.ts +0 -24
  84. package/lib/codec/ibc/applications/fee/v1/ack.js +0 -125
  85. package/lib/codec/ibc/applications/fee/v1/fee.d.ts +0 -68
  86. package/lib/codec/ibc/applications/fee/v1/fee.js +0 -289
  87. package/lib/codec/ibc/applications/fee/v1/genesis.d.ts +0 -93
  88. package/lib/codec/ibc/applications/fee/v1/genesis.js +0 -390
  89. package/lib/codec/ibc/applications/fee/v1/metadata.d.ts +0 -25
  90. package/lib/codec/ibc/applications/fee/v1/metadata.js +0 -71
  91. package/lib/codec/ibc/applications/fee/v1/query.d.ts +0 -312
  92. package/lib/codec/ibc/applications/fee/v1/query.js +0 -1187
  93. package/lib/codec/ibc/applications/fee/v1/tx.d.ts +0 -171
  94. package/lib/codec/ibc/applications/fee/v1/tx.js +0 -524
  95. package/lib/codec/ibc/applications/interchain_accounts/controller/v1/tx.d.ts +0 -78
  96. package/lib/codec/ibc/applications/interchain_accounts/controller/v1/tx.js +0 -296
  97. package/lib/codec/ibc/applications/interchain_accounts/genesis/v1/genesis.d.ts +0 -80
  98. package/lib/codec/ibc/applications/interchain_accounts/genesis/v1/genesis.js +0 -439
  99. package/lib/util/ethermint/evm-ibc.d.ts +0 -97
  100. package/lib/util/ethermint/evm-ibc.js +0 -134
  101. package/lib/util/ethermint/index.d.ts +0 -3
  102. package/lib/util/ethermint/index.js +0 -12
  103. package/lib/util/ethermint/keys.d.ts +0 -39
  104. package/lib/util/ethermint/keys.js +0 -138
  105. package/lib/util/ethermint/web3.d.ts +0 -36
  106. package/lib/util/ethermint/web3.js +0 -124
@@ -56,6 +56,20 @@ const CONTRACT_HASH = {
56
56
  [constant_1.Network.LocalHost]: "",
57
57
  [constant_1.Network.MainNet]: "0x43138036d1283413035b8eca403559737e8f7980",
58
58
  },
59
+ [blockchain_1.Blockchain.Polygon]: {
60
+ // use same testnet contract for all non-mainnet uses
61
+ [constant_1.Network.TestNet]: "",
62
+ [constant_1.Network.DevNet]: "",
63
+ [constant_1.Network.LocalHost]: "",
64
+ [constant_1.Network.MainNet]: "0x61B9503Fe023E1F1Dd0ab7417923cB0A41DD9E0c",
65
+ },
66
+ [blockchain_1.Blockchain.Okc]: {
67
+ // use same testnet contract for all non-mainnet uses
68
+ [constant_1.Network.TestNet]: "",
69
+ [constant_1.Network.DevNet]: "",
70
+ [constant_1.Network.LocalHost]: "",
71
+ [constant_1.Network.MainNet]: "0x7e8D8c98a016877Cb3103e837Fc71D41b155aF70",
72
+ },
59
73
  };
60
74
  const REGISTRY_CONTRACT_ABI = eth_1.ABIs.keyStorage;
61
75
  const ENCRYPTION_VERSION = "x25519-xsalsa20-poly1305";
@@ -143,6 +157,50 @@ const ARBITRUM_TESTNET = {
143
157
  symbol: "ETH",
144
158
  },
145
159
  };
160
+ const POLYGON_MAINNET = {
161
+ chainId: "0x89",
162
+ blockExplorerUrls: ["https://polygonscan.com/"],
163
+ chainName: "Polygon Mainnet",
164
+ rpcUrls: ["https://polygon-rpc.com"],
165
+ nativeCurrency: {
166
+ decimals: 18,
167
+ name: "Matic",
168
+ symbol: "MATIC",
169
+ },
170
+ };
171
+ const POLYGON_TESTNET = {
172
+ chainId: "0x13881",
173
+ blockExplorerUrls: ["https://mumbai.polygonscan.com"],
174
+ chainName: "Polygon Mumbai",
175
+ rpcUrls: ["https://polygon-mumbai.infura.io/v3/4458cf4d1689497b9a38b1d6bbf05e78"],
176
+ nativeCurrency: {
177
+ decimals: 18,
178
+ name: "Matic",
179
+ symbol: "MATIC",
180
+ },
181
+ };
182
+ const OKC_MAINNET = {
183
+ chainId: "0x42",
184
+ blockExplorerUrls: ["https://www.oklink.com/okc"],
185
+ chainName: "OKC Mainnet",
186
+ rpcUrls: ["https://exchainrpc.okex.org"],
187
+ nativeCurrency: {
188
+ decimals: 18,
189
+ name: "OKT",
190
+ symbol: "OKT",
191
+ },
192
+ };
193
+ const OKC_TESTNET = {
194
+ chainId: "0x41",
195
+ blockExplorerUrls: ["https://www.oklink.com/okc-test"],
196
+ chainName: "OKC Testnet",
197
+ rpcUrls: ["https://exchaintestrpc.okex.org"],
198
+ nativeCurrency: {
199
+ decimals: 18,
200
+ name: "OKT",
201
+ symbol: "OKT",
202
+ },
203
+ };
146
204
  /**
147
205
  * TODO: Add docs
148
206
  */
@@ -158,6 +216,10 @@ class MetaMask {
158
216
  return BSC_MAINNET;
159
217
  case blockchain_1.Blockchain.Arbitrum:
160
218
  return ARBITRUM_MAINNET;
219
+ case blockchain_1.Blockchain.Polygon:
220
+ return POLYGON_MAINNET;
221
+ case blockchain_1.Blockchain.Okc:
222
+ return OKC_MAINNET;
161
223
  default:
162
224
  // metamask should come with Ethereum configs
163
225
  return ETH_MAINNET;
@@ -168,6 +230,10 @@ class MetaMask {
168
230
  return BSC_TESTNET;
169
231
  case blockchain_1.Blockchain.Arbitrum:
170
232
  return ARBITRUM_TESTNET;
233
+ case blockchain_1.Blockchain.Polygon:
234
+ return POLYGON_TESTNET;
235
+ case blockchain_1.Blockchain.Okc:
236
+ return OKC_TESTNET;
171
237
  default:
172
238
  // metamask should come with Ethereum configs
173
239
  return ETH_TESTNET;
@@ -180,6 +246,10 @@ class MetaMask {
180
246
  return 56;
181
247
  case blockchain_1.Blockchain.Arbitrum:
182
248
  return 42161;
249
+ case blockchain_1.Blockchain.Polygon:
250
+ return 137;
251
+ case blockchain_1.Blockchain.Okc:
252
+ return 66;
183
253
  default:
184
254
  return 1;
185
255
  }
@@ -189,6 +259,10 @@ class MetaMask {
189
259
  return 97;
190
260
  case blockchain_1.Blockchain.Arbitrum:
191
261
  return 421611;
262
+ case blockchain_1.Blockchain.Polygon:
263
+ return 80001;
264
+ case blockchain_1.Blockchain.Okc:
265
+ return 65;
192
266
  default:
193
267
  return 5;
194
268
  }
@@ -363,6 +437,14 @@ class MetaMask {
363
437
  this.blockchain = blockchain_1.Blockchain.Arbitrum;
364
438
  return currentChainId;
365
439
  }
440
+ if (currentChainId === 137) {
441
+ this.blockchain = blockchain_1.Blockchain.Polygon;
442
+ return currentChainId;
443
+ }
444
+ if (currentChainId === 66) {
445
+ this.blockchain = blockchain_1.Blockchain.Okc;
446
+ return currentChainId;
447
+ }
366
448
  return 1;
367
449
  }
368
450
  if (currentChainId === 5) {
@@ -377,6 +459,14 @@ class MetaMask {
377
459
  this.blockchain = blockchain_1.Blockchain.Arbitrum;
378
460
  return currentChainId;
379
461
  }
462
+ if (currentChainId === 80001) {
463
+ this.blockchain = blockchain_1.Blockchain.Polygon;
464
+ return currentChainId;
465
+ }
466
+ if (currentChainId === 65) {
467
+ this.blockchain = blockchain_1.Blockchain.Okc;
468
+ return currentChainId;
469
+ }
380
470
  // Deal with cases where users are logging in to devnet using mainnet chains
381
471
  if (currentChainId === 56) {
382
472
  return 97;
@@ -6,6 +6,8 @@ export declare enum Blockchain {
6
6
  BinanceSmartChain = "bsc",
7
7
  Zilliqa = "zil",
8
8
  Arbitrum = "arbitrum",
9
+ Polygon = "polygon",
10
+ Okc = "okc",
9
11
  Native = "native",
10
12
  Btc = "btc",
11
13
  Carbon = "carbon",
@@ -46,6 +48,10 @@ export declare const ChainNames: {
46
48
  readonly 97: "BSC TestNet";
47
49
  readonly 110: "ZIL DevNet";
48
50
  readonly 111: "ZIL TestNet";
51
+ readonly 65: "Okc TestNet";
52
+ readonly 66: "Okc MainNet";
53
+ readonly 137: "Polygon MainNet";
54
+ readonly 80001: "Polygon Mumbai";
49
55
  readonly 42161: "Arbitrum MainNet";
50
56
  readonly 421611: "Arbitrum TestNet";
51
57
  };
@@ -55,5 +61,5 @@ export declare const CHAIN_IDS_TEST: ChainIds;
55
61
  export declare const chainIdsByBlockchain: SimpleMap<ChainIds>;
56
62
  export declare function parseBlockchain(value: string | null): Blockchain | null;
57
63
  export declare function getChainFromID(id: number): string | undefined;
58
- export declare const getBlockchainFromChain: (chainId?: number | undefined) => Blockchain.Ethereum | Blockchain.BinanceSmartChain | Blockchain.Zilliqa | Blockchain.Arbitrum | undefined;
64
+ export declare const getBlockchainFromChain: (chainId?: number | undefined) => Blockchain.Ethereum | Blockchain.BinanceSmartChain | Blockchain.Zilliqa | Blockchain.Arbitrum | Blockchain.Polygon | Blockchain.Okc | undefined;
59
65
  export declare const blockchainForChainId: (chainId?: number | undefined, network?: Network) => Blockchain | undefined;
@@ -9,6 +9,8 @@ var Blockchain;
9
9
  Blockchain["BinanceSmartChain"] = "bsc";
10
10
  Blockchain["Zilliqa"] = "zil";
11
11
  Blockchain["Arbitrum"] = "arbitrum";
12
+ Blockchain["Polygon"] = "polygon";
13
+ Blockchain["Okc"] = "okc";
12
14
  Blockchain["Native"] = "native";
13
15
  Blockchain["Btc"] = "btc";
14
16
  Blockchain["Carbon"] = "carbon";
@@ -48,6 +50,10 @@ exports.ChainNames = {
48
50
  97: "BSC TestNet",
49
51
  110: "ZIL DevNet",
50
52
  111: "ZIL TestNet",
53
+ 65: "Okc TestNet",
54
+ 66: "Okc MainNet",
55
+ 137: "Polygon MainNet",
56
+ 80001: "Polygon Mumbai",
51
57
  42161: "Arbitrum MainNet",
52
58
  421611: "Arbitrum TestNet",
53
59
  };
@@ -60,6 +66,8 @@ exports.CHAIN_IDS = {
60
66
  neo3: 14,
61
67
  zil: 18,
62
68
  arbitrum: 19,
69
+ okc: 66,
70
+ polygon: 137,
63
71
  osmosis: 244,
64
72
  terra: 245,
65
73
  cosmoshub: 246,
@@ -119,6 +127,12 @@ const getBlockchainFromChain = (chainId) => {
119
127
  case 56:
120
128
  case 97:
121
129
  return Blockchain.BinanceSmartChain;
130
+ case 65:
131
+ case 66:
132
+ return Blockchain.Okc;
133
+ case 137:
134
+ case 80001:
135
+ return Blockchain.Polygon;
122
136
  case 110:
123
137
  case 111:
124
138
  return Blockchain.Zilliqa;
@@ -148,6 +162,12 @@ const blockchainForChainId = (chainId, network = network_1.Network.MainNet) => {
148
162
  case 9: /* FALLTHROUGH */
149
163
  case 18:
150
164
  return Blockchain.Zilliqa;
165
+ case 12: /* FALLTHROUGH */
166
+ case 66:
167
+ return Blockchain.Okc;
168
+ case 17: /* FALLTHROUGH */
169
+ case 137:
170
+ return Blockchain.Polygon;
151
171
  case 244:
152
172
  return Blockchain.Osmosis;
153
173
  case 13: /* FALLTHROUGH */
@@ -77,6 +77,24 @@ export interface AccountTrade {
77
77
  quantity: string;
78
78
  side: string;
79
79
  trade_id: number;
80
+ id?: string;
81
+ liquidation?: string;
82
+ taker_id?: string;
83
+ taker_side?: string;
84
+ taker_address?: string;
85
+ taker_fee_amount?: string;
86
+ taker_fee_denom?: string;
87
+ taker_fee_kickback?: string;
88
+ taker_fee_commission?: string;
89
+ taker_fee_commission_address?: string;
90
+ maker_id?: string;
91
+ maker_side?: string;
92
+ maker_address?: string;
93
+ maker_fee_amount?: string;
94
+ maker_fee_denom?: string;
95
+ maker_fee_kickback?: string;
96
+ maker_fee_commission?: string;
97
+ maker_fee_commission_address?: string;
80
98
  }
81
99
  export interface Position {
82
100
  market: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-js-sdk",
3
- "version": "0.3.49",
3
+ "version": "0.3.51",
4
4
  "description": "TypeScript SDK for Carbon blockchain",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,86 +0,0 @@
1
- import { Network } from "../constant";
2
- import { StdSignDoc } from "@cosmjs/amino";
3
- import { BlockchainUtils } from "../util";
4
- declare type SupportedBlockchains = BlockchainUtils.Blockchain.Canto | BlockchainUtils.Blockchain.Evmos;
5
- declare namespace EvmIbcClient {
6
- interface TypedDomain {
7
- name: string;
8
- version: string;
9
- chainId: number;
10
- verifyingContract: string;
11
- salt: string;
12
- }
13
- interface TypedDataV4 {
14
- types: object;
15
- primaryType: string;
16
- message: StdSignDoc;
17
- domain: TypedDomain;
18
- }
19
- const TYPED_DATA_REQUEST_METHOD = "eth_signTypedData_v4";
20
- const DEFAULT_EIP712_TYPES: {
21
- EIP712Domain: {
22
- name: string;
23
- type: string;
24
- }[];
25
- Tx: {
26
- name: string;
27
- type: string;
28
- }[];
29
- Fee: {
30
- name: string;
31
- type: string;
32
- }[];
33
- Coin: {
34
- name: string;
35
- type: string;
36
- }[];
37
- Msg: {
38
- name: string;
39
- type: string;
40
- }[];
41
- };
42
- const getEvmChainId: (blockchain: SupportedBlockchains, network?: Network) => 7700 | 9001;
43
- const getIbcTransferTypes: () => {
44
- MsgValue: {
45
- name: string;
46
- type: string;
47
- }[];
48
- TypeToken: {
49
- name: string;
50
- type: string;
51
- }[];
52
- TypeTimeoutHeight: {
53
- name: string;
54
- type: string;
55
- }[];
56
- EIP712Domain: {
57
- name: string;
58
- type: string;
59
- }[];
60
- Tx: {
61
- name: string;
62
- type: string;
63
- }[];
64
- Fee: {
65
- name: string;
66
- type: string;
67
- }[];
68
- Coin: {
69
- name: string;
70
- type: string;
71
- }[];
72
- Msg: {
73
- name: string;
74
- type: string;
75
- }[];
76
- };
77
- const getCosmosWeb3Domain: (blockchain: SupportedBlockchains) => {
78
- name: string;
79
- version: string;
80
- chainId: number;
81
- verifyingContract: string;
82
- salt: string;
83
- };
84
- const getEIP712TypedData: (tx: StdSignDoc, blockchain: SupportedBlockchains, types?: object, domain?: EvmIbcClient.TypedDomain, primaryType?: string) => TypedDataV4;
85
- }
86
- export default EvmIbcClient;
@@ -1,90 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const constant_1 = require("../constant");
4
- const util_1 = require("../util");
5
- const _DEFAULT_EIP712_TYPES = {
6
- EIP712Domain: [
7
- { name: 'name', type: 'string' },
8
- { name: 'version', type: 'string' },
9
- { name: 'chainId', type: 'uint256' },
10
- { name: 'verifyingContract', type: 'string' },
11
- { name: 'salt', type: 'string' },
12
- ],
13
- Tx: [
14
- { name: 'account_number', type: 'string' },
15
- { name: 'chain_id', type: 'string' },
16
- { name: 'fee', type: 'Fee' },
17
- { name: 'memo', type: 'string' },
18
- { name: 'msgs', type: 'Msg[]' },
19
- { name: 'sequence', type: 'string' },
20
- ],
21
- Fee: [
22
- { name: 'feePayer', type: 'string' },
23
- { name: 'amount', type: 'Coin[]' },
24
- { name: 'gas', type: 'string' },
25
- ],
26
- Coin: [
27
- { name: 'denom', type: 'string' },
28
- { name: 'amount', type: 'string' },
29
- ],
30
- Msg: [
31
- { name: 'type', type: 'string' },
32
- { name: 'value', type: 'MsgValue' },
33
- ],
34
- };
35
- var EvmIbcClient;
36
- (function (EvmIbcClient) {
37
- EvmIbcClient.TYPED_DATA_REQUEST_METHOD = "eth_signTypedData_v4";
38
- EvmIbcClient.DEFAULT_EIP712_TYPES = _DEFAULT_EIP712_TYPES;
39
- EvmIbcClient.getEvmChainId = (blockchain, network = constant_1.Network.MainNet) => {
40
- switch (network) {
41
- case constant_1.Network.MainNet:
42
- switch (blockchain) {
43
- case util_1.BlockchainUtils.Blockchain.Canto:
44
- return 7700;
45
- case util_1.BlockchainUtils.Blockchain.Evmos:
46
- return 9001;
47
- default:
48
- throw new Error("network not supported");
49
- }
50
- default:
51
- throw new Error("network not supported");
52
- }
53
- };
54
- EvmIbcClient.getIbcTransferTypes = () => {
55
- return Object.assign(Object.assign({}, EvmIbcClient.DEFAULT_EIP712_TYPES), { MsgValue: [
56
- { name: 'source_port', type: 'string' },
57
- { name: 'source_channel', type: 'string' },
58
- { name: 'token', type: 'TypeToken' },
59
- { name: 'sender', type: 'string' },
60
- { name: 'receiver', type: 'string' },
61
- { name: 'timeout_height', type: 'TypeTimeoutHeight' },
62
- { name: 'timeout_timestamp', type: 'uint64' },
63
- ], TypeToken: [
64
- { name: 'denom', type: 'string' },
65
- { name: 'amount', type: 'string' },
66
- ], TypeTimeoutHeight: [
67
- { name: 'revision_number', type: 'uint64' },
68
- { name: 'revision_height', type: 'uint64' },
69
- ] });
70
- };
71
- EvmIbcClient.getCosmosWeb3Domain = (blockchain) => {
72
- return {
73
- name: "Cosmos Web3",
74
- version: "1.0.0",
75
- chainId: EvmIbcClient.getEvmChainId(blockchain),
76
- verifyingContract: "cosmos",
77
- salt: "0",
78
- };
79
- };
80
- EvmIbcClient.getEIP712TypedData = (tx, blockchain, types = EvmIbcClient.getIbcTransferTypes(), domain = EvmIbcClient.getCosmosWeb3Domain(blockchain), primaryType = "Tx") => {
81
- const typedData = {
82
- types,
83
- primaryType,
84
- domain,
85
- message: tx,
86
- };
87
- return typedData;
88
- };
89
- })(EvmIbcClient || (EvmIbcClient = {}));
90
- exports.default = EvmIbcClient;
@@ -1,39 +0,0 @@
1
- import Long from "long";
2
- import _m0 from "protobufjs/minimal";
3
- export declare const protobufPackage = "ethermint.crypto.v1.ethsecp256k1";
4
- /**
5
- * PubKey defines a type alias for an ecdsa.PublicKey that implements
6
- * Tendermint's PubKey interface. It represents the 33-byte compressed public
7
- * key format.
8
- */
9
- export interface PubKey {
10
- /** key is the public key in byte form */
11
- key: Uint8Array;
12
- }
13
- /**
14
- * PrivKey defines a type alias for an ecdsa.PrivateKey that implements
15
- * Tendermint's PrivateKey interface.
16
- */
17
- export interface PrivKey {
18
- /** key is the private key in byte form */
19
- key: Uint8Array;
20
- }
21
- export declare const PubKey: {
22
- encode(message: PubKey, writer?: _m0.Writer): _m0.Writer;
23
- decode(input: _m0.Reader | Uint8Array, length?: number | undefined): PubKey;
24
- fromJSON(object: any): PubKey;
25
- toJSON(message: PubKey): unknown;
26
- fromPartial(object: DeepPartial<PubKey>): PubKey;
27
- };
28
- export declare const PrivKey: {
29
- encode(message: PrivKey, writer?: _m0.Writer): _m0.Writer;
30
- decode(input: _m0.Reader | Uint8Array, length?: number | undefined): PrivKey;
31
- fromJSON(object: any): PrivKey;
32
- toJSON(message: PrivKey): unknown;
33
- fromPartial(object: DeepPartial<PrivKey>): PrivKey;
34
- };
35
- declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
36
- export declare type DeepPartial<T> = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
37
- [K in keyof T]?: DeepPartial<T[K]>;
38
- } : Partial<T>;
39
- export {};
@@ -1,138 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PrivKey = exports.PubKey = exports.protobufPackage = void 0;
7
- /* eslint-disable */
8
- const long_1 = __importDefault(require("long"));
9
- const minimal_1 = __importDefault(require("protobufjs/minimal"));
10
- exports.protobufPackage = "ethermint.crypto.v1.ethsecp256k1";
11
- const basePubKey = {};
12
- exports.PubKey = {
13
- encode(message, writer = minimal_1.default.Writer.create()) {
14
- if (message.key.length !== 0) {
15
- writer.uint32(10).bytes(message.key);
16
- }
17
- return writer;
18
- },
19
- decode(input, length) {
20
- const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
21
- let end = length === undefined ? reader.len : reader.pos + length;
22
- const message = Object.assign({}, basePubKey);
23
- message.key = new Uint8Array();
24
- while (reader.pos < end) {
25
- const tag = reader.uint32();
26
- switch (tag >>> 3) {
27
- case 1:
28
- message.key = reader.bytes();
29
- break;
30
- default:
31
- reader.skipType(tag & 7);
32
- break;
33
- }
34
- }
35
- return message;
36
- },
37
- fromJSON(object) {
38
- const message = Object.assign({}, basePubKey);
39
- message.key =
40
- object.key !== undefined && object.key !== null
41
- ? bytesFromBase64(object.key)
42
- : new Uint8Array();
43
- return message;
44
- },
45
- toJSON(message) {
46
- const obj = {};
47
- message.key !== undefined &&
48
- (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array()));
49
- return obj;
50
- },
51
- fromPartial(object) {
52
- var _a;
53
- const message = Object.assign({}, basePubKey);
54
- message.key = (_a = object.key) !== null && _a !== void 0 ? _a : new Uint8Array();
55
- return message;
56
- },
57
- };
58
- const basePrivKey = {};
59
- exports.PrivKey = {
60
- encode(message, writer = minimal_1.default.Writer.create()) {
61
- if (message.key.length !== 0) {
62
- writer.uint32(10).bytes(message.key);
63
- }
64
- return writer;
65
- },
66
- decode(input, length) {
67
- const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
68
- let end = length === undefined ? reader.len : reader.pos + length;
69
- const message = Object.assign({}, basePrivKey);
70
- message.key = new Uint8Array();
71
- while (reader.pos < end) {
72
- const tag = reader.uint32();
73
- switch (tag >>> 3) {
74
- case 1:
75
- message.key = reader.bytes();
76
- break;
77
- default:
78
- reader.skipType(tag & 7);
79
- break;
80
- }
81
- }
82
- return message;
83
- },
84
- fromJSON(object) {
85
- const message = Object.assign({}, basePrivKey);
86
- message.key =
87
- object.key !== undefined && object.key !== null
88
- ? bytesFromBase64(object.key)
89
- : new Uint8Array();
90
- return message;
91
- },
92
- toJSON(message) {
93
- const obj = {};
94
- message.key !== undefined &&
95
- (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array()));
96
- return obj;
97
- },
98
- fromPartial(object) {
99
- var _a;
100
- const message = Object.assign({}, basePrivKey);
101
- message.key = (_a = object.key) !== null && _a !== void 0 ? _a : new Uint8Array();
102
- return message;
103
- },
104
- };
105
- var globalThis = (() => {
106
- if (typeof globalThis !== "undefined")
107
- return globalThis;
108
- if (typeof self !== "undefined")
109
- return self;
110
- if (typeof window !== "undefined")
111
- return window;
112
- if (typeof global !== "undefined")
113
- return global;
114
- throw "Unable to locate global object";
115
- })();
116
- const atob = globalThis.atob ||
117
- ((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
118
- function bytesFromBase64(b64) {
119
- const bin = atob(b64);
120
- const arr = new Uint8Array(bin.length);
121
- for (let i = 0; i < bin.length; ++i) {
122
- arr[i] = bin.charCodeAt(i);
123
- }
124
- return arr;
125
- }
126
- const btoa = globalThis.btoa ||
127
- ((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
128
- function base64FromBytes(arr) {
129
- const bin = [];
130
- for (const byte of arr) {
131
- bin.push(String.fromCharCode(byte));
132
- }
133
- return btoa(bin.join(""));
134
- }
135
- if (minimal_1.default.util.Long !== long_1.default) {
136
- minimal_1.default.util.Long = long_1.default;
137
- minimal_1.default.configure();
138
- }