carbon-js-sdk 0.4.20 → 0.4.21

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 (114) hide show
  1. package/lib/clients/CarbonQueryClient.js +2 -2
  2. package/lib/clients/ETHClient.js +15 -15
  3. package/lib/clients/HydrogenClient.js +1 -1
  4. package/lib/clients/NEOClient.js +7 -7
  5. package/lib/clients/TokenClient.js +3 -3
  6. package/lib/clients/ZILClient.js +17 -17
  7. package/lib/codec/cosmos/gov/v1/query.js +2 -2
  8. package/lib/codec/cosmos/gov/v1/tx.js +2 -2
  9. package/lib/codec/cosmos/gov/v1beta1/query.js +2 -2
  10. package/lib/codec/cosmos/gov/v1beta1/tx.js +2 -2
  11. package/lib/codec/cosmos/group/v1/events.js +2 -2
  12. package/lib/codec/cosmos/group/v1/tx.js +4 -4
  13. package/lib/codec/cosmos/tx/v1beta1/tx.js +4 -4
  14. package/lib/codec/ethermint/crypto/v1/ethsecp256k1/export.d.ts +1 -0
  15. package/lib/codec/ethermint/crypto/v1/ethsecp256k1/export.js +6 -0
  16. package/lib/codec/ethermint/evm/v1/export.d.ts +5 -0
  17. package/lib/codec/ethermint/evm/v1/export.js +53 -0
  18. package/lib/codec/ethermint/feemarket/v1/export.d.ts +4 -0
  19. package/lib/codec/ethermint/feemarket/v1/export.js +18 -0
  20. package/lib/codec/ethermint/types/v1/export.d.ts +4 -0
  21. package/lib/codec/ethermint/types/v1/export.js +11 -0
  22. package/lib/codec/ethermint-models.d.ts +4 -0
  23. package/lib/codec/ethermint-models.js +26 -0
  24. package/lib/codec/market/fee.d.ts +123 -0
  25. package/lib/codec/market/fee.js +334 -0
  26. package/lib/codec/perpsliquidity/event.d.ts +102 -0
  27. package/lib/codec/perpsliquidity/event.js +581 -0
  28. package/lib/codec/perpsliquidity/genesis.d.ts +35 -0
  29. package/lib/codec/perpsliquidity/genesis.js +162 -0
  30. package/lib/codec/perpsliquidity/params.d.ts +24 -0
  31. package/lib/codec/perpsliquidity/params.js +103 -0
  32. package/lib/codec/perpsliquidity/pool.d.ts +137 -0
  33. package/lib/codec/perpsliquidity/pool.js +747 -0
  34. package/lib/codec/perpsliquidity/query.d.ts +167 -0
  35. package/lib/codec/perpsliquidity/query.js +719 -0
  36. package/lib/codec/perpsliquidity/tx.d.ts +199 -0
  37. package/lib/codec/perpsliquidity/tx.js +940 -0
  38. package/lib/constant/eip712.d.ts +46 -0
  39. package/lib/constant/eip712.js +106 -0
  40. package/lib/constant/generic.js +1 -1
  41. package/lib/constant/network.js +2 -2
  42. package/lib/modules/cdp.js +43 -43
  43. package/lib/modules/cosmwasm.js +1 -1
  44. package/lib/modules/evm.d.ts +46 -0
  45. package/lib/modules/evm.js +127 -0
  46. package/lib/modules/evmmerge.d.ts +12 -0
  47. package/lib/modules/evmmerge.js +35 -0
  48. package/lib/modules/feemarket.d.ts +20 -0
  49. package/lib/modules/feemarket.js +45 -0
  50. package/lib/modules/gov.js +12 -12
  51. package/lib/modules/liquiditypool.js +1 -1
  52. package/lib/modules/vault.d.ts +44 -0
  53. package/lib/modules/vault.js +95 -0
  54. package/lib/provider/account/EthLedgerAccount/EthLedgerAccount.js +1 -1
  55. package/lib/provider/account/NeoLedgerAccount/N3Ledger/ErrorCode.js +1 -1
  56. package/lib/provider/account/NeoLedgerAccount/N3Ledger/main.js +8 -8
  57. package/lib/provider/account/NeoLedgerAccount/NeoLedgerAccount.js +3 -3
  58. package/lib/provider/account/NeoLedgerAccount/NeonLedger.js +1 -1
  59. package/lib/provider/amino/types/admin.js +27 -27
  60. package/lib/provider/amino/types/bank.js +1 -1
  61. package/lib/provider/amino/types/broker.js +1 -1
  62. package/lib/provider/amino/types/cdp.js +25 -25
  63. package/lib/provider/amino/types/coin.js +4 -4
  64. package/lib/provider/amino/types/evm.d.ts +4 -0
  65. package/lib/provider/amino/types/evm.js +40 -0
  66. package/lib/provider/amino/types/evmmerge.d.ts +4 -0
  67. package/lib/provider/amino/types/evmmerge.js +34 -0
  68. package/lib/provider/amino/types/feemarket.d.ts +4 -0
  69. package/lib/provider/amino/types/feemarket.js +34 -0
  70. package/lib/provider/amino/types/gov.js +4 -4
  71. package/lib/provider/amino/types/ibc.js +1 -1
  72. package/lib/provider/amino/types/leverage.js +1 -1
  73. package/lib/provider/amino/types/liquidityPool.js +7 -7
  74. package/lib/provider/amino/types/market.js +2 -2
  75. package/lib/provider/amino/types/oracle.js +1 -1
  76. package/lib/provider/amino/types/order.js +4 -4
  77. package/lib/provider/amino/types/position.js +1 -1
  78. package/lib/provider/amino/types/profile.js +1 -1
  79. package/lib/provider/amino/types/staking.js +4 -4
  80. package/lib/provider/amino/types/subaccount.js +3 -3
  81. package/lib/provider/amino/utils.js +11 -11
  82. package/lib/provider/ledger/ledger.js +2 -2
  83. package/lib/provider/metamask/MetaMask.js +1 -1
  84. package/lib/provider/metamask/legacy-accounts.d.ts +6 -0
  85. package/lib/provider/metamask/legacy-accounts.js +44 -0
  86. package/lib/provider/o3/O3Wallet.js +2 -2
  87. package/lib/util/address.js +13 -13
  88. package/lib/util/api.js +4 -4
  89. package/lib/util/eip712.d.ts +10 -0
  90. package/lib/util/eip712.js +195 -0
  91. package/lib/util/ethermint.d.ts +8 -0
  92. package/lib/util/ethermint.js +68 -0
  93. package/lib/util/fetch.js +1 -1
  94. package/lib/util/generic.js +3 -3
  95. package/lib/util/legacyEIP712.d.ts +20 -0
  96. package/lib/util/legacyEIP712.js +98 -0
  97. package/lib/util/number.js +5 -5
  98. package/lib/wallet/CarbonSigner.js +2 -2
  99. package/lib/wallet/CarbonSigningClient.js +8 -8
  100. package/lib/wallet/CarbonWallet.js +6 -6
  101. package/lib/websocket/connector.js +3 -3
  102. package/package.json +1 -1
  103. package/lib/clients/EvmIbcClient.d.ts +0 -86
  104. package/lib/clients/EvmIbcClient.js +0 -90
  105. package/lib/codec/broker/incoming_pool_swap.d.ts +0 -23
  106. package/lib/codec/broker/incoming_pool_swap.js +0 -136
  107. package/lib/util/ethermint/evm-ibc.d.ts +0 -97
  108. package/lib/util/ethermint/evm-ibc.js +0 -134
  109. package/lib/util/ethermint/index.d.ts +0 -3
  110. package/lib/util/ethermint/index.js +0 -12
  111. package/lib/util/ethermint/keys.d.ts +0 -39
  112. package/lib/util/ethermint/keys.js +0 -138
  113. package/lib/util/ethermint/web3.d.ts +0 -36
  114. package/lib/util/ethermint/web3.js +0 -124
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ const CarbonTx = __importStar(require("../../../util/tx"));
23
+ const utils_1 = require("../utils");
24
+ const TxTypes = {
25
+ UpdateParams: "ethermint/MsgUpdateParams",
26
+ EthereumTx: "evm/v1/MsgEthereumTx"
27
+ };
28
+ const MsgEthereumTx = {
29
+ aminoType: TxTypes.EthereumTx,
30
+ valueMap: {},
31
+ };
32
+ const MsgUpdateParams = {
33
+ aminoType: TxTypes.UpdateParams,
34
+ valueMap: {},
35
+ };
36
+ const EvmAmino = {
37
+ [CarbonTx.Types.MsgEthereumTx]: utils_1.generateAminoType(MsgEthereumTx),
38
+ [CarbonTx.Types.MsgEvmUpdateParams]: utils_1.generateAminoType(MsgUpdateParams),
39
+ };
40
+ exports.default = EvmAmino;
@@ -0,0 +1,4 @@
1
+ import { TypeUtils } from "../../../util";
2
+ import { AminoConverter } from "@cosmjs/stargate";
3
+ declare const EvmMergeAmino: TypeUtils.SimpleMap<AminoConverter>;
4
+ export default EvmMergeAmino;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ const CarbonTx = __importStar(require("../../../util/tx"));
23
+ const utils_1 = require("../utils");
24
+ const TxTypes = {
25
+ MergeAccount: "evmmerge/MsgMergeAccount",
26
+ };
27
+ const MsgMergeAccount = {
28
+ aminoType: TxTypes.MergeAccount,
29
+ valueMap: {},
30
+ };
31
+ const EvmMergeAmino = {
32
+ [CarbonTx.Types.MsgMergeAccount]: utils_1.generateAminoType(MsgMergeAccount),
33
+ };
34
+ exports.default = EvmMergeAmino;
@@ -0,0 +1,4 @@
1
+ import { TypeUtils } from "../../../util";
2
+ import { AminoConverter } from "@cosmjs/stargate";
3
+ declare const FeeMarketAmino: TypeUtils.SimpleMap<AminoConverter>;
4
+ export default FeeMarketAmino;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ const CarbonTx = __importStar(require("../../../util/tx"));
23
+ const utils_1 = require("../utils");
24
+ const TxTypes = {
25
+ UpdateParams: "ethermint/feemarket/MsgUpdateParams",
26
+ };
27
+ const MsgUpdateParams = {
28
+ aminoType: TxTypes.UpdateParams,
29
+ valueMap: {},
30
+ };
31
+ const FeeMarketAmino = {
32
+ [CarbonTx.Types.MsgUpdateParams]: utils_1.generateAminoType(MsgUpdateParams),
33
+ };
34
+ exports.default = FeeMarketAmino;
@@ -217,7 +217,7 @@ const SettlementPrice = {
217
217
  },
218
218
  };
219
219
  const preProcessAmino = (value, valueMap) => {
220
- return (0, utils_1.mapEachIndiv)(value, valueMap, false);
220
+ return utils_1.mapEachIndiv(value, valueMap, false);
221
221
  };
222
222
  const checkDecodeProposal = (content, amino) => {
223
223
  const decodedValue = util_1.GovUtils.decodeContent(content);
@@ -437,8 +437,8 @@ const proposalAminoProcess = {
437
437
  },
438
438
  };
439
439
  const GovAmino = {
440
- [CarbonTx.Types.MsgSubmitProposal]: (0, utils_1.generateAminoType)(SubmitProposalMsg, proposalAminoProcess),
441
- [CarbonTx.Types.MsgDeposit]: (0, utils_1.generateAminoType)(MsgDeposit),
442
- [CarbonTx.Types.MsgVote]: (0, utils_1.generateAminoType)(MsgVote),
440
+ [CarbonTx.Types.MsgSubmitProposal]: utils_1.generateAminoType(SubmitProposalMsg, proposalAminoProcess),
441
+ [CarbonTx.Types.MsgDeposit]: utils_1.generateAminoType(MsgDeposit),
442
+ [CarbonTx.Types.MsgVote]: utils_1.generateAminoType(MsgVote),
443
443
  };
444
444
  exports.default = GovAmino;
@@ -55,6 +55,6 @@ const pruneTransferProcess = {
55
55
  },
56
56
  };
57
57
  const IbcAmino = {
58
- [CarbonTx.Types.MsgTransfer]: (0, utils_1.generateAminoType)(MsgTransfer, pruneTransferProcess),
58
+ [CarbonTx.Types.MsgTransfer]: utils_1.generateAminoType(MsgTransfer, pruneTransferProcess),
59
59
  };
60
60
  exports.default = IbcAmino;
@@ -31,6 +31,6 @@ const MsgSetLeverage = {
31
31
  },
32
32
  };
33
33
  const LeverageAmino = {
34
- [CarbonTx.Types.MsgSetLeverage]: (0, utils_1.generateAminoType)(MsgSetLeverage),
34
+ [CarbonTx.Types.MsgSetLeverage]: utils_1.generateAminoType(MsgSetLeverage),
35
35
  };
36
36
  exports.default = LeverageAmino;
@@ -93,12 +93,12 @@ const commitTokensProcess = {
93
93
  },
94
94
  };
95
95
  const LiquidityPoolAmino = {
96
- [CarbonTx.Types.MsgCreatePool]: (0, utils_1.generateAminoType)(MsgCreatePool),
97
- [CarbonTx.Types.MsgCreatePoolWithLiquidity]: (0, utils_1.generateAminoType)(MsgCreatePoolWithLiquidity),
98
- [CarbonTx.Types.MsgAddLiquidity]: (0, utils_1.generateAminoType)(MsgAddLiquidity),
99
- [CarbonTx.Types.MsgRemoveLiquidity]: (0, utils_1.generateAminoType)(MsgRemoveLiquidity),
100
- [CarbonTx.Types.MsgStakePoolToken]: (0, utils_1.generateAminoType)(MsgStakePoolToken, commitTokensProcess),
101
- [CarbonTx.Types.MsgUnstakePoolToken]: (0, utils_1.generateAminoType)(MsgUnstakePoolToken),
102
- [CarbonTx.Types.MsgClaimPoolRewards]: (0, utils_1.generateAminoType)(MsgClaimPoolRewards),
96
+ [CarbonTx.Types.MsgCreatePool]: utils_1.generateAminoType(MsgCreatePool),
97
+ [CarbonTx.Types.MsgCreatePoolWithLiquidity]: utils_1.generateAminoType(MsgCreatePoolWithLiquidity),
98
+ [CarbonTx.Types.MsgAddLiquidity]: utils_1.generateAminoType(MsgAddLiquidity),
99
+ [CarbonTx.Types.MsgRemoveLiquidity]: utils_1.generateAminoType(MsgRemoveLiquidity),
100
+ [CarbonTx.Types.MsgStakePoolToken]: utils_1.generateAminoType(MsgStakePoolToken, commitTokensProcess),
101
+ [CarbonTx.Types.MsgUnstakePoolToken]: utils_1.generateAminoType(MsgUnstakePoolToken),
102
+ [CarbonTx.Types.MsgClaimPoolRewards]: utils_1.generateAminoType(MsgClaimPoolRewards),
103
103
  };
104
104
  exports.default = LiquidityPoolAmino;
@@ -46,7 +46,7 @@ const MsgDisableSpotMarket = {
46
46
  valueMap: {},
47
47
  };
48
48
  const MarketAmino = {
49
- [CarbonTx.Types.MsgUpdateMarket]: (0, utils_1.generateAminoType)(MsgUpdateMarket),
50
- [CarbonTx.Types.MsgDisableSpotMarket]: (0, utils_1.generateAminoType)(MsgDisableSpotMarket),
49
+ [CarbonTx.Types.MsgUpdateMarket]: utils_1.generateAminoType(MsgUpdateMarket),
50
+ [CarbonTx.Types.MsgDisableSpotMarket]: utils_1.generateAminoType(MsgDisableSpotMarket),
51
51
  };
52
52
  exports.default = MarketAmino;
@@ -31,6 +31,6 @@ const MsgCreateVote = {
31
31
  },
32
32
  };
33
33
  const OracleAmino = {
34
- [CarbonTx.Types.MsgCreateVote]: (0, utils_1.generateAminoType)(MsgCreateVote),
34
+ [CarbonTx.Types.MsgCreateVote]: utils_1.generateAminoType(MsgCreateVote),
35
35
  };
36
36
  exports.default = OracleAmino;
@@ -76,9 +76,9 @@ const createOrderProcess = {
76
76
  },
77
77
  };
78
78
  const OrderAmino = {
79
- [CarbonTx.Types.MsgCreateOrder]: (0, utils_1.generateAminoType)(MsgCreateOrder, createOrderProcess),
80
- [CarbonTx.Types.MsgCancelOrder]: (0, utils_1.generateAminoType)(MsgCancelOrder),
81
- [CarbonTx.Types.MsgEditOrder]: (0, utils_1.generateAminoType)(MsgEditOrder),
82
- [CarbonTx.Types.MsgCancelAll]: (0, utils_1.generateAminoType)(MsgCancelAll),
79
+ [CarbonTx.Types.MsgCreateOrder]: utils_1.generateAminoType(MsgCreateOrder, createOrderProcess),
80
+ [CarbonTx.Types.MsgCancelOrder]: utils_1.generateAminoType(MsgCancelOrder),
81
+ [CarbonTx.Types.MsgEditOrder]: utils_1.generateAminoType(MsgEditOrder),
82
+ [CarbonTx.Types.MsgCancelAll]: utils_1.generateAminoType(MsgCancelAll),
83
83
  };
84
84
  exports.default = OrderAmino;
@@ -29,6 +29,6 @@ const MsgSetMargin = {
29
29
  valueMap: {},
30
30
  };
31
31
  const PositionAmino = {
32
- [CarbonTx.Types.MsgSetMargin]: (0, utils_1.generateAminoType)(MsgSetMargin),
32
+ [CarbonTx.Types.MsgSetMargin]: utils_1.generateAminoType(MsgSetMargin),
33
33
  };
34
34
  exports.default = PositionAmino;
@@ -45,6 +45,6 @@ const updateProfileProcess = {
45
45
  },
46
46
  };
47
47
  const ProfileAmino = {
48
- [CarbonTx.Types.MsgUpdateProfile]: (0, utils_1.generateAminoType)(MsgUpdateProfile, updateProfileProcess),
48
+ [CarbonTx.Types.MsgUpdateProfile]: utils_1.generateAminoType(MsgUpdateProfile, updateProfileProcess),
49
49
  };
50
50
  exports.default = ProfileAmino;
@@ -44,9 +44,9 @@ const MsgWithdrawDelegatorReward = {
44
44
  valueMap: {},
45
45
  };
46
46
  const StakingAmino = {
47
- [CarbonTx.Types.MsgDelegate]: (0, utils_1.generateAminoType)(MsgDelegate),
48
- [CarbonTx.Types.MsgUndelegate]: (0, utils_1.generateAminoType)(MsgUndelegate),
49
- [CarbonTx.Types.MsgBeginRedelegate]: (0, utils_1.generateAminoType)(MsgBeginRedelegate),
50
- [CarbonTx.Types.MsgWithdrawDelegatorReward]: (0, utils_1.generateAminoType)(MsgWithdrawDelegatorReward),
47
+ [CarbonTx.Types.MsgDelegate]: utils_1.generateAminoType(MsgDelegate),
48
+ [CarbonTx.Types.MsgUndelegate]: utils_1.generateAminoType(MsgUndelegate),
49
+ [CarbonTx.Types.MsgBeginRedelegate]: utils_1.generateAminoType(MsgBeginRedelegate),
50
+ [CarbonTx.Types.MsgWithdrawDelegatorReward]: utils_1.generateAminoType(MsgWithdrawDelegatorReward),
51
51
  };
52
52
  exports.default = StakingAmino;
@@ -39,8 +39,8 @@ const MsgRemoveSubAccount = {
39
39
  valueMap: {},
40
40
  };
41
41
  const SubAccountAmino = {
42
- [CarbonTx.Types.MsgCreateSubAccount]: (0, utils_1.generateAminoType)(MsgCreateSubAccount),
43
- [CarbonTx.Types.MsgActivateSubAccount]: (0, utils_1.generateAminoType)(MsgActivateSubAccount),
44
- [CarbonTx.Types.MsgRemoveSubAccount]: (0, utils_1.generateAminoType)(MsgRemoveSubAccount),
42
+ [CarbonTx.Types.MsgCreateSubAccount]: utils_1.generateAminoType(MsgCreateSubAccount),
43
+ [CarbonTx.Types.MsgActivateSubAccount]: utils_1.generateAminoType(MsgActivateSubAccount),
44
+ [CarbonTx.Types.MsgRemoveSubAccount]: utils_1.generateAminoType(MsgRemoveSubAccount),
45
45
  };
46
46
  exports.default = SubAccountAmino;
@@ -44,23 +44,23 @@ const mapEachIndiv = (mapItem, valueKey, toAmino = false) => {
44
44
  if (typeof keyMap !== "object") {
45
45
  // Check if this is a Long/BigNumber/Buffer/Date/Duration obj or a non-object/array
46
46
  if (typeCheck(mapItem[key]) || typeof mapItem[key] !== "object") {
47
- directMap[altKey] = (0, exports.paramConverter)(mapItem[key], keyMap, toAmino);
47
+ directMap[altKey] = exports.paramConverter(mapItem[key], keyMap, toAmino);
48
48
  return;
49
49
  }
50
50
  }
51
51
  if (mapItem[key].length && typeof mapItem[key] === "object") {
52
52
  // If value is an array of objects, iterate through objects and call mapToObj function
53
53
  directMap[altKey] = mapItem[key].map((newMap) => {
54
- return (0, exports.mapEachIndiv)(newMap, valueKey, toAmino);
54
+ return exports.mapEachIndiv(newMap, valueKey, toAmino);
55
55
  });
56
56
  return;
57
57
  }
58
58
  else {
59
59
  if (util_1.TypeUtils.isDurationType(mapItem[key])) {
60
- directMap[altKey] = (0, exports.paramConverter)(mapItem[key], keyMap, toAmino);
60
+ directMap[altKey] = exports.paramConverter(mapItem[key], keyMap, toAmino);
61
61
  return;
62
62
  }
63
- directMap[altKey] = (0, exports.mapEachIndiv)(mapItem[key], keyMap, toAmino);
63
+ directMap[altKey] = exports.mapEachIndiv(mapItem[key], keyMap, toAmino);
64
64
  }
65
65
  });
66
66
  return directMap;
@@ -137,18 +137,18 @@ const generateAminoType = (amino, aminoProcess = {}) => {
137
137
  if (!newInput[key])
138
138
  return;
139
139
  if (typeCheck(newInput[key])) {
140
- aminoObj[snakeKey] = (0, exports.paramConverter)(newInput[key], newAminoMap[key], true);
140
+ aminoObj[snakeKey] = exports.paramConverter(newInput[key], newAminoMap[key], true);
141
141
  return;
142
142
  }
143
143
  if (typeof newInput[key] !== "object" && typeof newAminoMap[key] !== "object") {
144
- aminoObj[snakeKey] = (0, exports.paramConverter)(newInput[key], newAminoMap[key], true);
144
+ aminoObj[snakeKey] = exports.paramConverter(newInput[key], newAminoMap[key], true);
145
145
  }
146
146
  else {
147
147
  if (((_a = newInput[key]) === null || _a === void 0 ? void 0 : _a.length) && typeof newInput[key] === "object") {
148
- aminoObj[snakeKey] = newInput[key].map((newItem) => (0, exports.mapEachIndiv)(newItem, newAminoMap[key], true));
148
+ aminoObj[snakeKey] = newInput[key].map((newItem) => exports.mapEachIndiv(newItem, newAminoMap[key], true));
149
149
  return;
150
150
  }
151
- aminoObj[snakeKey] = (0, exports.mapEachIndiv)(newInput[key], newAminoMap[key], true);
151
+ aminoObj[snakeKey] = exports.mapEachIndiv(newInput[key], newAminoMap[key], true);
152
152
  }
153
153
  });
154
154
  return aminoObj;
@@ -162,14 +162,14 @@ const generateAminoType = (amino, aminoProcess = {}) => {
162
162
  var _a;
163
163
  const camelKey = util_1.TypeUtils.snakeToCamel(key);
164
164
  if (typeof newInput[key] !== "object" && typeof newAminoMap[key] !== "object") {
165
- aminoObj[camelKey] = (0, exports.paramConverter)(newInput[key], newAminoMap[camelKey], false);
165
+ aminoObj[camelKey] = exports.paramConverter(newInput[key], newAminoMap[camelKey], false);
166
166
  }
167
167
  else {
168
168
  if (((_a = newInput[key]) === null || _a === void 0 ? void 0 : _a.length) && typeof newInput[key] === "object") {
169
- aminoObj[camelKey] = newInput[key].map((newItem) => (0, exports.mapEachIndiv)(newItem, newAminoMap[camelKey], false));
169
+ aminoObj[camelKey] = newInput[key].map((newItem) => exports.mapEachIndiv(newItem, newAminoMap[camelKey], false));
170
170
  return;
171
171
  }
172
- aminoObj[camelKey] = (0, exports.mapEachIndiv)(newInput[key], newAminoMap[camelKey], false);
172
+ aminoObj[camelKey] = exports.mapEachIndiv(newInput[key], newAminoMap[camelKey], false);
173
173
  }
174
174
  });
175
175
  return aminoObj;
@@ -153,7 +153,7 @@ class CosmosLedger {
153
153
  const response = yield this.cosmosApp.getVersion();
154
154
  this.checkLedgerErrors(response);
155
155
  const { major, minor, patch, test_mode } = response;
156
- (0, exports.checkAppMode)(this.testModeAllowed, test_mode);
156
+ exports.checkAppMode(this.testModeAllowed, test_mode);
157
157
  const version = versionString({ major, minor, patch });
158
158
  return version;
159
159
  });
@@ -244,7 +244,7 @@ class CosmosLedger {
244
244
  const response = yield this.cosmosApp.sign(this.hdPath, signMessage);
245
245
  this.checkLedgerErrors(response);
246
246
  // we have to parse the signature from Ledger as it's in DER format
247
- const parsedSignature = (0, secp256k1_1.signatureImport)(response.signature);
247
+ const parsedSignature = secp256k1_1.signatureImport(response.signature);
248
248
  return parsedSignature;
249
249
  });
250
250
  }
@@ -284,7 +284,7 @@ class MetaMask {
284
284
  return __awaiter(this, void 0, void 0, function* () {
285
285
  const chainIdHex = (yield ((_a = this.getAPI()) === null || _a === void 0 ? void 0 : _a.request({ method: "eth_chainId" })));
286
286
  const chainId = !!chainIdHex ? parseInt(chainIdHex, 16) : undefined;
287
- const blockchain = (0, blockchain_1.getBlockchainFromChainV2)(chainId);
287
+ const blockchain = blockchain_1.getBlockchainFromChainV2(chainId);
288
288
  this.blockchain = blockchain;
289
289
  return { chainId, blockchain };
290
290
  });
@@ -0,0 +1,6 @@
1
+ export declare const LEGACY_ACCOUNTS_TESTNET: {
2
+ Ethereum: string[];
3
+ };
4
+ export declare const LEGACY_ACCOUNTS_MAINNET: {
5
+ Ethereum: string[];
6
+ };
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LEGACY_ACCOUNTS_MAINNET = exports.LEGACY_ACCOUNTS_TESTNET = void 0;
4
+ // As of 16 May 2023
5
+ exports.LEGACY_ACCOUNTS_TESTNET = {
6
+ "Ethereum": [
7
+ "0x32c1069dcf38a7294ee9633fcb897c18cabd1668",
8
+ "0x6a8247bc77084acf32901f6a29369bc702d25769",
9
+ "0xe3f544b81a8e60087b25b1e6f0e71d579686c798",
10
+ "0xc6a53d96f92be41b9a7ccd9daa5d52cb7a8fdb92",
11
+ "0x8440a2e6e763ee99b29dcf663a72896817d6a6fd",
12
+ "0x04d40c9e02e0f793c25d2e4c993b853f6a1c7b6c",
13
+ "0x1e9eb8d2320a52dcd91a4016b1471947844ed903",
14
+ "0x7d831dd3a6f1553b9b995f499f4d31d4935b34f8",
15
+ "0xb88cb290efff1017a27db762fba8f15e754fdd67",
16
+ "0xc120adde16e45c1a36e65fb9bdb5bd8b1f620c19",
17
+ "0x0897fbc3eb27992cadbffa506e1403d180c94735",
18
+ "0x49367893FF5e5481312159D1EC7dfFd1bCD082B7",
19
+ "0x6fC1b1665BF2EC94d3d936EAb45ACa6b58eE2797",
20
+ "0x3619d35d2ca763d63387138Fff3a13A5fFE7c8Ce",
21
+ "0xEEe3c236312a81f3CC3CB78763968e24355b513F",
22
+ "0x184268C2eA4332234d6Ee5b0bA1C212E63fa55Cc",
23
+ "0x05a2F90551Dcba19C42c6E85FB00843C0859a427",
24
+ "0xad045ec15DbBe6FebE8e7D1EC85Eb7D496c4ebe1",
25
+ "0xcFa83a56f1479BB9CD5a25f36a0C3E44EE08D7DB",
26
+ "0x8e2C2E908195F87Bc6C14fAEC31F7726d094b3c6"
27
+ ]
28
+ };
29
+ // To be updated
30
+ exports.LEGACY_ACCOUNTS_MAINNET = {
31
+ "Ethereum": [
32
+ "0x32c1069dcf38a7294ee9633fcb897c18cabd1668",
33
+ "0x6a8247bc77084acf32901f6a29369bc702d25769",
34
+ "0xe3f544b81a8e60087b25b1e6f0e71d579686c798",
35
+ "0xc6a53d96f92be41b9a7ccd9daa5d52cb7a8fdb92",
36
+ "0x8440a2e6e763ee99b29dcf663a72896817d6a6fd",
37
+ "0x04d40c9e02e0f793c25d2e4c993b853f6a1c7b6c",
38
+ "0x1e9eb8d2320a52dcd91a4016b1471947844ed903",
39
+ "0x7d831dd3a6f1553b9b995f499f4d31d4935b34f8",
40
+ "0xb88cb290efff1017a27db762fba8f15e754fdd67",
41
+ "0xc120adde16e45c1a36e65fb9bdb5bd8b1f620c19",
42
+ "0x0897fbc3eb27992cadbffa506e1403d180c94735"
43
+ ]
44
+ };
@@ -60,9 +60,9 @@ class O3Wallet {
60
60
  return {
61
61
  type: index_1.CarbonSignerTypes.BrowserInjected,
62
62
  signAmino: (_, doc) => __awaiter(this, void 0, void 0, function* () {
63
- const msg = JSON.stringify((0, generic_1.sortObject)(doc));
63
+ const msg = JSON.stringify(generic_1.sortObject(doc));
64
64
  const signBytes = yield dapi.signMessage(msg);
65
- const signature = (0, amino_1.encodeSecp256k1Signature)(pubKey, signBytes);
65
+ const signature = amino_1.encodeSecp256k1Signature(pubKey, signBytes);
66
66
  return {
67
67
  signed: doc,
68
68
  signature,
@@ -94,13 +94,13 @@ const randomMnemonic = () => {
94
94
  };
95
95
  exports.randomMnemonic = randomMnemonic;
96
96
  const wifEncodePrivateKey = (privateKey, iter = 128) => {
97
- const privateKeyBuf = (0, exports.stringOrBufferToBuffer)(privateKey);
97
+ const privateKeyBuf = exports.stringOrBufferToBuffer(privateKey);
98
98
  return wif.encode(iter, privateKeyBuf, true);
99
99
  };
100
100
  exports.wifEncodePrivateKey = wifEncodePrivateKey;
101
101
  exports.SWTHAddress = {
102
102
  newMnemonic: () => {
103
- return (0, exports.randomMnemonic)();
103
+ return exports.randomMnemonic();
104
104
  },
105
105
  coinType: () => {
106
106
  return SWTH_COIN_TYPE;
@@ -110,10 +110,10 @@ exports.SWTHAddress = {
110
110
  return new BIP44Path(BIP44_PURPOSE, coinType).update(index, change, account).toArray();
111
111
  },
112
112
  publicKeyToScriptHash: (publicKey) => {
113
- const pubKeyBuffer = (0, exports.stringOrBufferToBuffer)(publicKey);
113
+ const pubKeyBuffer = exports.stringOrBufferToBuffer(publicKey);
114
114
  const sha256Hash = ethers_1.ethers.utils.sha256(pubKeyBuffer);
115
115
  const ripemdHash = ethers_1.ethers.utils.ripemd160(sha256Hash);
116
- return (0, generic_1.stripHexPrefix)(ripemdHash);
116
+ return generic_1.stripHexPrefix(ripemdHash);
117
117
  },
118
118
  publicKeyToAddress: (publicKey, opts) => {
119
119
  const scriptHash = exports.SWTHAddress.publicKeyToScriptHash(publicKey);
@@ -135,7 +135,7 @@ exports.SWTHAddress = {
135
135
  return privateKey;
136
136
  },
137
137
  privateToPublicKey: (privateKey) => {
138
- const privateKeyBuff = (0, exports.stringOrBufferToBuffer)(privateKey);
138
+ const privateKeyBuff = exports.stringOrBufferToBuffer(privateKey);
139
139
  const publicKeyUint8Array = secp256k1.publicKeyCreate(privateKeyBuff, true);
140
140
  const publicKey = Buffer.from(publicKeyUint8Array);
141
141
  return publicKey;
@@ -146,7 +146,7 @@ exports.SWTHAddress = {
146
146
  return address;
147
147
  },
148
148
  encode: (hash, opts) => {
149
- const hashBuff = (0, exports.stringOrBufferToBuffer)(hash, "hex");
149
+ const hashBuff = exports.stringOrBufferToBuffer(hash, "hex");
150
150
  const words = bech32.toWords(hashBuff.slice(0, 20));
151
151
  const addressPrefix = exports.SWTHAddress.getBech32Prefix(opts === null || opts === void 0 ? void 0 : opts.network, opts === null || opts === void 0 ? void 0 : opts.bech32Prefix, opts === null || opts === void 0 ? void 0 : opts.type);
152
152
  const address = bech32.encode(addressPrefix, words);
@@ -205,7 +205,7 @@ exports.NEOAddress = {
205
205
  ]);
206
206
  const sha256Hash = ethers_1.ethers.utils.sha256(addressScript);
207
207
  const ripemdHash = ethers_1.ethers.utils.ripemd160(sha256Hash);
208
- return (0, generic_1.stripHexPrefix)(ripemdHash);
208
+ return generic_1.stripHexPrefix(ripemdHash);
209
209
  },
210
210
  publicKeyToAddress: (publicKey) => {
211
211
  const addressScript = exports.NEOAddress.publicKeyToScriptHash(publicKey);
@@ -213,7 +213,7 @@ exports.NEOAddress = {
213
213
  return address;
214
214
  },
215
215
  encodePublicKey: (unencodedPublicKey) => {
216
- const unencPubKeyBuf = (0, exports.stringOrBufferToBuffer)(unencodedPublicKey);
216
+ const unencPubKeyBuf = exports.stringOrBufferToBuffer(unencodedPublicKey);
217
217
  if (unencPubKeyBuf.length <= 33) {
218
218
  // length indicates already encoded
219
219
  return unencPubKeyBuf;
@@ -238,7 +238,7 @@ exports.NEOAddress = {
238
238
  return privateKey;
239
239
  },
240
240
  privateToPublicKey: (privateKey) => {
241
- const privateKeyBuff = (0, exports.stringOrBufferToBuffer)(privateKey);
241
+ const privateKeyBuff = exports.stringOrBufferToBuffer(privateKey);
242
242
  const publicKeyUint8Array = secp256r1.publicKeyCreate(privateKeyBuff, true);
243
243
  return Buffer.from(publicKeyUint8Array);
244
244
  },
@@ -256,7 +256,7 @@ exports.NEOAddress = {
256
256
  },
257
257
  };
258
258
  exports.N3Address = Object.assign(Object.assign({}, exports.NEOAddress), { publicKeyToScriptHash: (publicKey) => {
259
- const publicKeyHex = (0, exports.stringOrBufferToBuffer)(publicKey).toString("hex");
259
+ const publicKeyHex = exports.stringOrBufferToBuffer(publicKey).toString("hex");
260
260
  return neon_core_next_1.wallet.getScriptHashFromPublicKey(publicKeyHex);
261
261
  }, publicKeyToAddress: (publicKey) => {
262
262
  const addressScript = exports.N3Address.publicKeyToScriptHash(publicKey);
@@ -282,11 +282,11 @@ exports.ETHAddress = {
282
282
  return ethers_1.ethers.utils.keccak256(encodedPublicKey);
283
283
  },
284
284
  publicKeyToAddress: (publicKey) => {
285
- const publicKeyBuff = (0, exports.stringOrBufferToBuffer)(publicKey);
285
+ const publicKeyBuff = exports.stringOrBufferToBuffer(publicKey);
286
286
  return ethers_1.ethers.utils.computeAddress(publicKeyBuff);
287
287
  },
288
288
  encodePublicKey: (unencodedPublicKey) => {
289
- const unencodedPublicKeyBuff = (0, exports.stringOrBufferToBuffer)(unencodedPublicKey);
289
+ const unencodedPublicKeyBuff = exports.stringOrBufferToBuffer(unencodedPublicKey);
290
290
  const publicKey = ethers_1.ethers.utils.computePublicKey(unencodedPublicKeyBuff, true);
291
291
  return Buffer.from(publicKey, "hex");
292
292
  },
@@ -298,7 +298,7 @@ exports.ETHAddress = {
298
298
  return Buffer.from((_a = wallet.privateKey) === null || _a === void 0 ? void 0 : _a.replace(/^0x/, ""), "hex");
299
299
  },
300
300
  privateToPublicKey: (privateKey) => {
301
- const privateKeyBuff = (0, exports.stringOrBufferToBuffer)(privateKey);
301
+ const privateKeyBuff = exports.stringOrBufferToBuffer(privateKey);
302
302
  return Buffer.from(ethers_1.ethers.utils.computePublicKey(privateKeyBuff).replace(/^0x/, ""), "hex");
303
303
  },
304
304
  privateKeyToAddress: (privateKey) => {
package/lib/util/api.js CHANGED
@@ -84,7 +84,7 @@ class HTTP {
84
84
  * Executes HTTP GET request with fetch
85
85
  */
86
86
  this.get = ({ url, headers }) => {
87
- return (0, fetch_1.fetch)(url, {
87
+ return fetch_1.fetch(url, {
88
88
  method: "GET",
89
89
  headers,
90
90
  });
@@ -93,7 +93,7 @@ class HTTP {
93
93
  * Executes HTTP POST request with fetch
94
94
  */
95
95
  this.post = (options) => {
96
- return (0, fetch_1.fetch)(options.url, {
96
+ return fetch_1.fetch(options.url, {
97
97
  method: "POST",
98
98
  headers: Object.assign({ "Content-Type": options.content_type || "application/json" }, options.headers),
99
99
  body: JSON.stringify(options.body),
@@ -103,7 +103,7 @@ class HTTP {
103
103
  * Executes HTTP DELETE request with fetch
104
104
  */
105
105
  this.del = (options) => {
106
- return (0, fetch_1.fetch)(options.url, {
106
+ return fetch_1.fetch(options.url, {
107
107
  method: "DELETE",
108
108
  headers: Object.assign({ "Content-Type": options.content_type || "application/json" }, options.headers),
109
109
  body: JSON.stringify(options.body),
@@ -114,7 +114,7 @@ class HTTP {
114
114
  */
115
115
  this.raw = (options) => {
116
116
  const { url } = options, otherOpts = __rest(options, ["url"]);
117
- return (0, fetch_1.fetch)(url, otherOpts);
117
+ return fetch_1.fetch(url, otherOpts);
118
118
  };
119
119
  this.apiPrefix = apiPrefix;
120
120
  this.apiEndpoints = apiEndpoints;
@@ -0,0 +1,10 @@
1
+ import { TypedDataDomain, TypedDataField } from "@ethersproject/abstract-signer";
2
+ import { TypeUtils } from ".";
3
+ import { CarbonTx } from "../util";
4
+ export interface EIP712Tx {
5
+ readonly types: TypeUtils.SimpleMap<TypedDataField[]>;
6
+ readonly primaryType: string;
7
+ readonly domain: TypedDataDomain;
8
+ readonly message: any;
9
+ }
10
+ export declare function constructEIP712Tx(doc: CarbonTx.StdSignDoc): EIP712Tx;