carbon-js-sdk 0.2.10 → 0.2.11-dev.2
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/lib/clients/CarbonQueryClient.js +1 -1
- package/lib/clients/ETHClient.js +15 -15
- package/lib/clients/HydrogenClient.js +1 -1
- package/lib/clients/InsightsQueryClient.d.ts +3 -1
- package/lib/clients/InsightsQueryClient.js +17 -6
- package/lib/clients/NEOClient.js +7 -7
- package/lib/clients/TokenClient.d.ts +4 -0
- package/lib/clients/TokenClient.js +23 -7
- package/lib/clients/ZILClient.js +16 -16
- package/lib/codec/book/genesis.d.ts +1 -1
- package/lib/codec/book/genesis.js +1 -1
- package/lib/codec/book/query.d.ts +1 -1
- package/lib/codec/book/query.js +1 -1
- package/lib/codec/broker/genesis.d.ts +1 -1
- package/lib/codec/broker/genesis.js +1 -1
- package/lib/codec/broker/query.d.ts +3 -3
- package/lib/codec/broker/query.js +3 -3
- package/lib/codec/btcx/denom_cross_chain_info.d.ts +1 -1
- package/lib/codec/btcx/denom_cross_chain_info.js +1 -1
- package/lib/codec/btcx/query.d.ts +1 -1
- package/lib/codec/btcx/query.js +1 -1
- package/lib/codec/ccm/genesis.d.ts +1 -1
- package/lib/codec/ccm/genesis.js +1 -1
- package/lib/codec/cdp/asset_params.d.ts +1 -0
- package/lib/codec/cdp/asset_params.js +31 -15
- package/lib/codec/cdp/event.d.ts +226 -22
- package/lib/codec/cdp/event.js +1414 -80
- package/lib/codec/cdp/genesis.d.ts +57 -4
- package/lib/codec/cdp/genesis.js +417 -22
- package/lib/codec/cdp/query.d.ts +328 -94
- package/lib/codec/cdp/query.js +1300 -236
- package/lib/codec/cdp/tx.d.ts +466 -96
- package/lib/codec/cdp/tx.js +1961 -181
- package/lib/codec/coin/event.d.ts +1 -1
- package/lib/codec/coin/event.js +1 -1
- package/lib/codec/coin/genesis.d.ts +2 -2
- package/lib/codec/coin/genesis.js +2 -2
- package/lib/codec/coin/proposal.d.ts +1 -1
- package/lib/codec/coin/proposal.js +1 -1
- package/lib/codec/coin/query.d.ts +2 -5
- package/lib/codec/coin/query.js +2 -8
- package/lib/codec/coin/token.d.ts +11 -0
- package/lib/codec/coin/token.js +65 -1
- package/lib/codec/coin/tx.d.ts +1 -1
- package/lib/codec/coin/tx.js +1 -1
- package/lib/codec/cosmos/auth/v1beta1/genesis.d.ts +1 -1
- package/lib/codec/cosmos/auth/v1beta1/genesis.js +1 -1
- package/lib/codec/cosmos/auth/v1beta1/query.d.ts +2 -2
- package/lib/codec/cosmos/auth/v1beta1/query.js +2 -2
- package/lib/codec/cosmos/authz/v1beta1/query.d.ts +2 -2
- package/lib/codec/cosmos/authz/v1beta1/query.js +2 -2
- package/lib/codec/cosmos/authz/v1beta1/tx.d.ts +1 -1
- package/lib/codec/cosmos/authz/v1beta1/tx.js +1 -1
- package/lib/codec/cosmos/bank/v1beta1/authz.d.ts +1 -1
- package/lib/codec/cosmos/bank/v1beta1/authz.js +1 -1
- package/lib/codec/cosmos/bank/v1beta1/bank.d.ts +1 -1
- package/lib/codec/cosmos/bank/v1beta1/bank.js +1 -1
- package/lib/codec/cosmos/bank/v1beta1/genesis.d.ts +2 -2
- package/lib/codec/cosmos/bank/v1beta1/genesis.js +2 -2
- package/lib/codec/cosmos/bank/v1beta1/query.d.ts +3 -3
- package/lib/codec/cosmos/bank/v1beta1/query.js +3 -3
- package/lib/codec/cosmos/bank/v1beta1/tx.d.ts +2 -2
- package/lib/codec/cosmos/bank/v1beta1/tx.js +2 -2
- package/lib/codec/cosmos/base/tendermint/v1beta1/query.d.ts +1 -1
- package/lib/codec/cosmos/base/tendermint/v1beta1/query.js +1 -1
- package/lib/codec/cosmos/capability/v1beta1/genesis.d.ts +1 -1
- package/lib/codec/cosmos/capability/v1beta1/genesis.js +1 -1
- package/lib/codec/cosmos/crisis/v1beta1/genesis.d.ts +1 -1
- package/lib/codec/cosmos/crisis/v1beta1/genesis.js +1 -1
- package/lib/codec/cosmos/distribution/v1beta1/distribution.d.ts +1 -1
- package/lib/codec/cosmos/distribution/v1beta1/distribution.js +1 -1
- package/lib/codec/cosmos/distribution/v1beta1/genesis.d.ts +2 -2
- package/lib/codec/cosmos/distribution/v1beta1/genesis.js +2 -2
- package/lib/codec/cosmos/distribution/v1beta1/query.d.ts +3 -3
- package/lib/codec/cosmos/distribution/v1beta1/query.js +3 -3
- package/lib/codec/cosmos/distribution/v1beta1/tx.d.ts +1 -1
- package/lib/codec/cosmos/distribution/v1beta1/tx.js +1 -1
- package/lib/codec/cosmos/evidence/v1beta1/query.d.ts +1 -1
- package/lib/codec/cosmos/evidence/v1beta1/query.js +1 -1
- package/lib/codec/cosmos/feegrant/v1beta1/feegrant.d.ts +1 -1
- package/lib/codec/cosmos/feegrant/v1beta1/feegrant.js +1 -1
- package/lib/codec/cosmos/feegrant/v1beta1/genesis.d.ts +1 -1
- package/lib/codec/cosmos/feegrant/v1beta1/genesis.js +1 -1
- package/lib/codec/cosmos/feegrant/v1beta1/query.d.ts +2 -2
- package/lib/codec/cosmos/feegrant/v1beta1/query.js +2 -2
- package/lib/codec/cosmos/gov/v1beta1/genesis.d.ts +1 -1
- package/lib/codec/cosmos/gov/v1beta1/genesis.js +1 -1
- package/lib/codec/cosmos/gov/v1beta1/gov.d.ts +1 -1
- package/lib/codec/cosmos/gov/v1beta1/gov.js +1 -1
- package/lib/codec/cosmos/gov/v1beta1/query.d.ts +2 -2
- package/lib/codec/cosmos/gov/v1beta1/query.js +4 -4
- package/lib/codec/cosmos/gov/v1beta1/tx.d.ts +2 -2
- package/lib/codec/cosmos/gov/v1beta1/tx.js +4 -4
- package/lib/codec/cosmos/mint/v1beta1/genesis.d.ts +1 -1
- package/lib/codec/cosmos/mint/v1beta1/genesis.js +1 -1
- package/lib/codec/cosmos/mint/v1beta1/query.d.ts +1 -1
- package/lib/codec/cosmos/mint/v1beta1/query.js +1 -1
- package/lib/codec/cosmos/params/v1beta1/query.d.ts +1 -1
- package/lib/codec/cosmos/params/v1beta1/query.js +1 -1
- package/lib/codec/cosmos/slashing/v1beta1/genesis.d.ts +1 -1
- package/lib/codec/cosmos/slashing/v1beta1/genesis.js +1 -1
- package/lib/codec/cosmos/slashing/v1beta1/query.d.ts +2 -2
- package/lib/codec/cosmos/slashing/v1beta1/query.js +2 -2
- package/lib/codec/cosmos/staking/v1beta1/authz.d.ts +1 -1
- package/lib/codec/cosmos/staking/v1beta1/authz.js +1 -1
- package/lib/codec/cosmos/staking/v1beta1/genesis.d.ts +1 -1
- package/lib/codec/cosmos/staking/v1beta1/genesis.js +1 -1
- package/lib/codec/cosmos/staking/v1beta1/query.d.ts +2 -2
- package/lib/codec/cosmos/staking/v1beta1/query.js +2 -2
- package/lib/codec/cosmos/staking/v1beta1/staking.d.ts +1 -1
- package/lib/codec/cosmos/staking/v1beta1/staking.js +1 -1
- package/lib/codec/cosmos/staking/v1beta1/tx.d.ts +2 -2
- package/lib/codec/cosmos/staking/v1beta1/tx.js +2 -2
- package/lib/codec/cosmos/tx/signing/v1beta1/signing.d.ts +1 -1
- package/lib/codec/cosmos/tx/signing/v1beta1/signing.js +1 -1
- package/lib/codec/cosmos/tx/v1beta1/service.d.ts +3 -3
- package/lib/codec/cosmos/tx/v1beta1/service.js +3 -3
- package/lib/codec/cosmos/tx/v1beta1/tx.d.ts +3 -3
- package/lib/codec/cosmos/tx/v1beta1/tx.js +5 -5
- package/lib/codec/cosmos/upgrade/v1beta1/query.d.ts +1 -1
- package/lib/codec/cosmos/upgrade/v1beta1/query.js +1 -1
- package/lib/codec/cosmos/vesting/v1beta1/tx.d.ts +1 -1
- package/lib/codec/cosmos/vesting/v1beta1/tx.js +1 -1
- package/lib/codec/cosmos/vesting/v1beta1/vesting.d.ts +2 -2
- package/lib/codec/cosmos/vesting/v1beta1/vesting.js +2 -2
- package/lib/codec/fee/genesis.d.ts +1 -1
- package/lib/codec/fee/genesis.js +1 -1
- package/lib/codec/fee/proposal.d.ts +1 -1
- package/lib/codec/fee/proposal.js +1 -1
- package/lib/codec/fee/query.d.ts +1 -1
- package/lib/codec/fee/query.js +1 -1
- package/lib/codec/fee/tx.d.ts +1 -1
- package/lib/codec/fee/tx.js +1 -1
- package/lib/codec/headersync/genesis.d.ts +1 -1
- package/lib/codec/headersync/genesis.js +1 -1
- package/lib/codec/headersync/query.d.ts +1 -1
- package/lib/codec/headersync/query.js +1 -1
- package/lib/codec/index.d.ts +53 -22
- package/lib/codec/index.js +514 -384
- package/lib/codec/inflation/genesis.d.ts +1 -1
- package/lib/codec/inflation/genesis.js +1 -1
- package/lib/codec/inflation/query.d.ts +1 -1
- package/lib/codec/inflation/query.js +1 -1
- package/lib/codec/insurance/genesis.d.ts +1 -1
- package/lib/codec/insurance/genesis.js +1 -1
- package/lib/codec/leverage/genesis.d.ts +1 -1
- package/lib/codec/leverage/genesis.js +1 -1
- package/lib/codec/leverage/query.d.ts +1 -1
- package/lib/codec/leverage/query.js +1 -1
- package/lib/codec/liquidation/genesis.d.ts +1 -1
- package/lib/codec/liquidation/genesis.js +1 -1
- package/lib/codec/liquidation/query.d.ts +1 -1
- package/lib/codec/liquidation/query.js +1 -1
- package/lib/codec/liquidation/quote_changes.d.ts +1 -1
- package/lib/codec/liquidation/quote_changes.js +1 -1
- package/lib/codec/liquiditypool/event.d.ts +2 -2
- package/lib/codec/liquiditypool/event.js +2 -2
- package/lib/codec/liquiditypool/genesis.d.ts +2 -2
- package/lib/codec/liquiditypool/genesis.js +2 -2
- package/lib/codec/liquiditypool/proposal.d.ts +1 -1
- package/lib/codec/liquiditypool/proposal.js +1 -1
- package/lib/codec/liquiditypool/query.d.ts +2 -2
- package/lib/codec/liquiditypool/query.js +2 -2
- package/lib/codec/liquiditypool/tx.d.ts +1 -1
- package/lib/codec/liquiditypool/tx.js +1 -1
- package/lib/codec/lockproxy/genesis.d.ts +1 -1
- package/lib/codec/lockproxy/genesis.js +1 -1
- package/lib/codec/lockproxy/query.d.ts +1 -1
- package/lib/codec/lockproxy/query.js +1 -1
- package/lib/codec/market/event.d.ts +1 -1
- package/lib/codec/market/event.js +1 -1
- package/lib/codec/market/genesis.d.ts +2 -1
- package/lib/codec/market/genesis.js +20 -2
- package/lib/codec/market/proposal.d.ts +1 -1
- package/lib/codec/market/proposal.js +1 -1
- package/lib/codec/market/query.d.ts +1 -1
- package/lib/codec/market/query.js +1 -1
- package/lib/codec/market/tx.d.ts +1 -1
- package/lib/codec/market/tx.js +1 -1
- package/lib/codec/marketstats/genesis.d.ts +1 -1
- package/lib/codec/marketstats/genesis.js +1 -1
- package/lib/codec/marketstats/query.d.ts +2 -2
- package/lib/codec/marketstats/query.js +2 -2
- package/lib/codec/misc/message.d.ts +1 -1
- package/lib/codec/misc/message.js +1 -1
- package/lib/codec/misc/query.d.ts +3 -3
- package/lib/codec/misc/query.js +3 -3
- package/lib/codec/misc/trade.d.ts +1 -0
- package/lib/codec/misc/trade.js +17 -0
- package/lib/codec/misc/transaction.d.ts +1 -1
- package/lib/codec/misc/transaction.js +1 -1
- package/lib/codec/oracle/event.d.ts +1 -1
- package/lib/codec/oracle/event.js +1 -1
- package/lib/codec/oracle/genesis.d.ts +1 -1
- package/lib/codec/oracle/genesis.js +1 -1
- package/lib/codec/oracle/proposal.d.ts +1 -1
- package/lib/codec/oracle/proposal.js +1 -1
- package/lib/codec/oracle/query.d.ts +2 -2
- package/lib/codec/oracle/query.js +2 -2
- package/lib/codec/order/event.d.ts +1 -1
- package/lib/codec/order/event.js +1 -1
- package/lib/codec/order/genesis.d.ts +1 -1
- package/lib/codec/order/genesis.js +1 -1
- package/lib/codec/order/query.d.ts +1 -1
- package/lib/codec/order/query.js +1 -1
- package/lib/codec/position/event.d.ts +1 -1
- package/lib/codec/position/event.js +1 -1
- package/lib/codec/position/genesis.d.ts +1 -1
- package/lib/codec/position/genesis.js +1 -1
- package/lib/codec/position/query.d.ts +1 -1
- package/lib/codec/position/query.js +1 -1
- package/lib/codec/pricing/event.d.ts +11 -1
- package/lib/codec/pricing/event.js +52 -2
- package/lib/codec/pricing/genesis.d.ts +2 -1
- package/lib/codec/pricing/genesis.js +20 -5
- package/lib/codec/pricing/pricing.d.ts +13 -0
- package/lib/codec/pricing/pricing.js +83 -1
- package/lib/codec/pricing/query.d.ts +1 -1
- package/lib/codec/pricing/query.js +1 -1
- package/lib/codec/profile/event.d.ts +1 -1
- package/lib/codec/profile/event.js +1 -1
- package/lib/codec/profile/genesis.d.ts +1 -1
- package/lib/codec/profile/genesis.js +1 -1
- package/lib/codec/profile/query.d.ts +1 -1
- package/lib/codec/profile/query.js +1 -1
- package/lib/codec/subaccount/genesis.d.ts +1 -1
- package/lib/codec/subaccount/genesis.js +1 -1
- package/lib/codec/subaccount/query.d.ts +1 -1
- package/lib/codec/subaccount/query.js +1 -1
- package/lib/codec/tendermint/abci/types.d.ts +4 -4
- package/lib/codec/tendermint/abci/types.js +4 -4
- package/lib/codec/tendermint/types/block.d.ts +2 -2
- package/lib/codec/tendermint/types/block.js +2 -2
- package/lib/codec/tendermint/types/evidence.d.ts +2 -2
- package/lib/codec/tendermint/types/evidence.js +2 -2
- package/lib/codec/tendermint/types/types.d.ts +3 -3
- package/lib/codec/tendermint/types/types.js +3 -3
- package/lib/codec/tendermint/types/validator.d.ts +1 -1
- package/lib/codec/tendermint/types/validator.js +1 -1
- package/lib/constant/generic.js +1 -1
- package/lib/insights/common.d.ts +2 -0
- package/lib/insights/common.js +2 -0
- package/lib/insights/competition.d.ts +49 -7
- package/lib/modules/admin.d.ts +61 -1
- package/lib/modules/admin.js +193 -42
- package/lib/modules/cdp.d.ts +55 -12
- package/lib/modules/cdp.js +134 -20
- package/lib/modules/gov.js +14 -14
- package/lib/modules/liquiditypool.js +1 -1
- package/lib/provider/account/EthLedgerAccount/EthLedgerAccount.js +1 -1
- package/lib/provider/account/NeoLedgerAccount/N3Ledger/ErrorCode.js +1 -1
- package/lib/provider/account/NeoLedgerAccount/N3Ledger/main.js +8 -8
- package/lib/provider/account/NeoLedgerAccount/NeoLedgerAccount.js +3 -3
- package/lib/provider/account/NeoLedgerAccount/NeonLedger.js +1 -1
- package/lib/provider/amino/types/admin.js +67 -26
- package/lib/provider/amino/types/bank.js +1 -1
- package/lib/provider/amino/types/broker.js +1 -1
- package/lib/provider/amino/types/cdp.js +72 -32
- package/lib/provider/amino/types/coin.js +2 -2
- package/lib/provider/amino/types/gov.js +4 -4
- package/lib/provider/amino/types/ibc.js +1 -1
- package/lib/provider/amino/types/leverage.js +1 -1
- package/lib/provider/amino/types/liquidityPool.js +7 -7
- package/lib/provider/amino/types/market.js +1 -1
- package/lib/provider/amino/types/oracle.js +1 -1
- package/lib/provider/amino/types/order.js +4 -4
- package/lib/provider/amino/types/position.js +1 -1
- package/lib/provider/amino/types/profile.js +1 -1
- package/lib/provider/amino/types/staking.js +4 -4
- package/lib/provider/amino/types/subaccount.js +3 -3
- package/lib/provider/amino/utils.js +11 -11
- package/lib/provider/keplr/KeplrStore.js +1 -1
- package/lib/provider/ledger/ledger.js +2 -2
- package/lib/provider/metamask/MetaMask.js +1 -1
- package/lib/provider/o3/O3Wallet.js +2 -2
- package/lib/util/address.js +13 -13
- package/lib/util/api.js +4 -4
- package/lib/util/fetch.js +1 -1
- package/lib/util/generic.js +3 -3
- package/lib/util/number.js +5 -5
- package/lib/util/tx.d.ts +42 -14
- package/lib/wallet/CarbonSigner.js +2 -2
- package/lib/wallet/CarbonSigningClient.js +8 -8
- package/lib/wallet/CarbonWallet.js +6 -6
- package/lib/websocket/channel.js +26 -0
- package/lib/websocket/connector.js +3 -3
- package/lib/websocket/models.d.ts +63 -0
- package/lib/websocket/types.d.ts +38 -3
- package/lib/websocket/types.js +16 -0
- package/package.json +2 -1
|
@@ -22,39 +22,79 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
22
22
|
const CarbonTx = __importStar(require("../../../util/tx"));
|
|
23
23
|
const utils_1 = require("../utils");
|
|
24
24
|
const TxTypes = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
const
|
|
43
|
-
aminoType: TxTypes.
|
|
44
|
-
valueMap: {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
},
|
|
25
|
+
SupplyAsset: "cdp/SupplyAsset",
|
|
26
|
+
WithdrawAsset: "cdp/WithdrawAsset",
|
|
27
|
+
LockCollateral: "cdp/LockCollateral",
|
|
28
|
+
UnlockCollateral: "cdp/UnlockCollateral",
|
|
29
|
+
BorrowAsset: "cdp/BorrowAsset",
|
|
30
|
+
RepayAsset: "cdp/RepayAsset",
|
|
31
|
+
SupplyAssetAndLockCollateral: "cdp/SupplyAssetAndLockCollateral",
|
|
32
|
+
UnlockCollateralAndWithdrawAsset: "cdp/UnlockCollateralAndWithdrawAsset",
|
|
33
|
+
LiquidateCollateral: "cdp/LiquidateCollateral",
|
|
34
|
+
RepayAssetWithCdpTokens: "cdp/RepayAssetWithCdpTokens",
|
|
35
|
+
RepayAssetWithCollateral: "cdp/RepayAssetWithCollateral",
|
|
36
|
+
MintStablecoin: "cdp/MintStablecoin",
|
|
37
|
+
};
|
|
38
|
+
const MsgSupplyAsset = {
|
|
39
|
+
aminoType: TxTypes.SupplyAsset,
|
|
40
|
+
valueMap: {},
|
|
41
|
+
};
|
|
42
|
+
const MsgWithdrawAsset = {
|
|
43
|
+
aminoType: TxTypes.WithdrawAsset,
|
|
44
|
+
valueMap: {},
|
|
45
|
+
};
|
|
46
|
+
const MsgLockCollateral = {
|
|
47
|
+
aminoType: TxTypes.LockCollateral,
|
|
48
|
+
valueMap: {},
|
|
49
|
+
};
|
|
50
|
+
const MsgUnlockCollateral = {
|
|
51
|
+
aminoType: TxTypes.UnlockCollateral,
|
|
52
|
+
valueMap: {},
|
|
53
|
+
};
|
|
54
|
+
const MsgBorrowAsset = {
|
|
55
|
+
aminoType: TxTypes.BorrowAsset,
|
|
56
|
+
valueMap: {},
|
|
57
|
+
};
|
|
58
|
+
const MsgRepayAsset = {
|
|
59
|
+
aminoType: TxTypes.RepayAsset,
|
|
60
|
+
valueMap: {},
|
|
61
|
+
};
|
|
62
|
+
const MsgSupplyAssetAndLockCollateral = {
|
|
63
|
+
aminoType: TxTypes.SupplyAssetAndLockCollateral,
|
|
64
|
+
valueMap: {},
|
|
65
|
+
};
|
|
66
|
+
const MsgUnlockCollateralAndWithdrawAsset = {
|
|
67
|
+
aminoType: TxTypes.UnlockCollateralAndWithdrawAsset,
|
|
68
|
+
valueMap: {},
|
|
69
|
+
};
|
|
70
|
+
const MsgLiquidateCollateral = {
|
|
71
|
+
aminoType: TxTypes.LiquidateCollateral,
|
|
72
|
+
valueMap: {},
|
|
73
|
+
};
|
|
74
|
+
const MsgRepayAssetWithCdpTokens = {
|
|
75
|
+
aminoType: TxTypes.RepayAssetWithCdpTokens,
|
|
76
|
+
valueMap: {},
|
|
77
|
+
};
|
|
78
|
+
const MsgRepayAssetWithCollateral = {
|
|
79
|
+
aminoType: TxTypes.RepayAssetWithCollateral,
|
|
80
|
+
valueMap: {},
|
|
81
|
+
};
|
|
82
|
+
const MsgMintStablecoin = {
|
|
83
|
+
aminoType: TxTypes.MintStablecoin,
|
|
84
|
+
valueMap: {},
|
|
53
85
|
};
|
|
54
86
|
const CdpAmino = {
|
|
55
|
-
[CarbonTx.Types.
|
|
56
|
-
[CarbonTx.Types.
|
|
57
|
-
[CarbonTx.Types.
|
|
58
|
-
[CarbonTx.Types.
|
|
87
|
+
[CarbonTx.Types.MsgSupplyAsset]: (0, utils_1.generateAminoType)(MsgSupplyAsset),
|
|
88
|
+
[CarbonTx.Types.MsgWithdrawAsset]: (0, utils_1.generateAminoType)(MsgWithdrawAsset),
|
|
89
|
+
[CarbonTx.Types.MsgLockCollateral]: (0, utils_1.generateAminoType)(MsgLockCollateral),
|
|
90
|
+
[CarbonTx.Types.MsgUnlockCollateral]: (0, utils_1.generateAminoType)(MsgUnlockCollateral),
|
|
91
|
+
[CarbonTx.Types.MsgBorrowAsset]: (0, utils_1.generateAminoType)(MsgBorrowAsset),
|
|
92
|
+
[CarbonTx.Types.MsgRepayAsset]: (0, utils_1.generateAminoType)(MsgRepayAsset),
|
|
93
|
+
[CarbonTx.Types.MsgSupplyAssetAndLockCollateral]: (0, utils_1.generateAminoType)(MsgSupplyAssetAndLockCollateral),
|
|
94
|
+
[CarbonTx.Types.MsgUnlockCollateralAndWithdrawAsset]: (0, utils_1.generateAminoType)(MsgUnlockCollateralAndWithdrawAsset),
|
|
95
|
+
[CarbonTx.Types.MsgLiquidateCollateral]: (0, utils_1.generateAminoType)(MsgLiquidateCollateral),
|
|
96
|
+
[CarbonTx.Types.MsgRepayAssetWithCdpTokens]: (0, utils_1.generateAminoType)(MsgRepayAssetWithCdpTokens),
|
|
97
|
+
[CarbonTx.Types.MsgRepayAssetWithCollateral]: (0, utils_1.generateAminoType)(MsgRepayAssetWithCollateral),
|
|
98
|
+
[CarbonTx.Types.MsgMintStablecoin]: (0, utils_1.generateAminoType)(MsgMintStablecoin),
|
|
59
99
|
};
|
|
60
100
|
exports.default = CdpAmino;
|
|
@@ -34,7 +34,7 @@ const MsgMintToken = {
|
|
|
34
34
|
valueMap: {},
|
|
35
35
|
};
|
|
36
36
|
const CoinAmino = {
|
|
37
|
-
[CarbonTx.Types.MsgWithdraw]: utils_1.generateAminoType(MsgWithdraw),
|
|
38
|
-
[CarbonTx.Types.MsgMintToken]: utils_1.generateAminoType(MsgMintToken),
|
|
37
|
+
[CarbonTx.Types.MsgWithdraw]: (0, utils_1.generateAminoType)(MsgWithdraw),
|
|
38
|
+
[CarbonTx.Types.MsgMintToken]: (0, utils_1.generateAminoType)(MsgMintToken),
|
|
39
39
|
};
|
|
40
40
|
exports.default = CoinAmino;
|
|
@@ -172,7 +172,7 @@ const SettlementPrice = {
|
|
|
172
172
|
};
|
|
173
173
|
;
|
|
174
174
|
const preProcessAmino = (value, valueMap) => {
|
|
175
|
-
return utils_1.mapEachIndiv(value, valueMap, false);
|
|
175
|
+
return (0, utils_1.mapEachIndiv)(value, valueMap, false);
|
|
176
176
|
};
|
|
177
177
|
const checkDecodeProposal = (content, amino) => {
|
|
178
178
|
const decodedValue = util_1.GovUtils.decodeContent(content);
|
|
@@ -403,8 +403,8 @@ const proposalAminoProcess = {
|
|
|
403
403
|
},
|
|
404
404
|
};
|
|
405
405
|
const GovAmino = {
|
|
406
|
-
[CarbonTx.Types.MsgSubmitProposal]: utils_1.generateAminoType(SubmitProposalMsg, proposalAminoProcess),
|
|
407
|
-
[CarbonTx.Types.MsgDeposit]: utils_1.generateAminoType(MsgDeposit),
|
|
408
|
-
[CarbonTx.Types.MsgVote]: utils_1.generateAminoType(MsgVote),
|
|
406
|
+
[CarbonTx.Types.MsgSubmitProposal]: (0, utils_1.generateAminoType)(SubmitProposalMsg, proposalAminoProcess),
|
|
407
|
+
[CarbonTx.Types.MsgDeposit]: (0, utils_1.generateAminoType)(MsgDeposit),
|
|
408
|
+
[CarbonTx.Types.MsgVote]: (0, utils_1.generateAminoType)(MsgVote),
|
|
409
409
|
};
|
|
410
410
|
exports.default = GovAmino;
|
|
@@ -55,6 +55,6 @@ const pruneTransferProcess = {
|
|
|
55
55
|
},
|
|
56
56
|
};
|
|
57
57
|
const IbcAmino = {
|
|
58
|
-
[CarbonTx.Types.MsgTransfer]: utils_1.generateAminoType(MsgTransfer, pruneTransferProcess),
|
|
58
|
+
[CarbonTx.Types.MsgTransfer]: (0, 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]: utils_1.generateAminoType(MsgSetLeverage),
|
|
34
|
+
[CarbonTx.Types.MsgSetLeverage]: (0, 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]: 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),
|
|
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),
|
|
103
103
|
};
|
|
104
104
|
exports.default = LiquidityPoolAmino;
|
|
@@ -41,6 +41,6 @@ const MsgUpdateMarket = {
|
|
|
41
41
|
},
|
|
42
42
|
};
|
|
43
43
|
const MarketAmino = {
|
|
44
|
-
[CarbonTx.Types.MsgUpdateMarket]: utils_1.generateAminoType(MsgUpdateMarket),
|
|
44
|
+
[CarbonTx.Types.MsgUpdateMarket]: (0, utils_1.generateAminoType)(MsgUpdateMarket),
|
|
45
45
|
};
|
|
46
46
|
exports.default = MarketAmino;
|
|
@@ -80,9 +80,9 @@ const createOrderProcess = {
|
|
|
80
80
|
},
|
|
81
81
|
};
|
|
82
82
|
const OrderAmino = {
|
|
83
|
-
[CarbonTx.Types.MsgCreateOrder]: utils_1.generateAminoType(MsgCreateOrder, createOrderProcess),
|
|
84
|
-
[CarbonTx.Types.MsgCancelOrder]: utils_1.generateAminoType(MsgCancelOrder),
|
|
85
|
-
[CarbonTx.Types.MsgEditOrder]: utils_1.generateAminoType(MsgEditOrder),
|
|
86
|
-
[CarbonTx.Types.MsgCancelAll]: utils_1.generateAminoType(MsgCancelAll),
|
|
83
|
+
[CarbonTx.Types.MsgCreateOrder]: (0, utils_1.generateAminoType)(MsgCreateOrder, createOrderProcess),
|
|
84
|
+
[CarbonTx.Types.MsgCancelOrder]: (0, utils_1.generateAminoType)(MsgCancelOrder),
|
|
85
|
+
[CarbonTx.Types.MsgEditOrder]: (0, utils_1.generateAminoType)(MsgEditOrder),
|
|
86
|
+
[CarbonTx.Types.MsgCancelAll]: (0, utils_1.generateAminoType)(MsgCancelAll),
|
|
87
87
|
};
|
|
88
88
|
exports.default = OrderAmino;
|
|
@@ -29,6 +29,6 @@ const MsgSetMargin = {
|
|
|
29
29
|
valueMap: {},
|
|
30
30
|
};
|
|
31
31
|
const PositionAmino = {
|
|
32
|
-
[CarbonTx.Types.MsgSetMargin]: utils_1.generateAminoType(MsgSetMargin),
|
|
32
|
+
[CarbonTx.Types.MsgSetMargin]: (0, 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]: utils_1.generateAminoType(MsgUpdateProfile, updateProfileProcess),
|
|
48
|
+
[CarbonTx.Types.MsgUpdateProfile]: (0, 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]: 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),
|
|
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),
|
|
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]: utils_1.generateAminoType(MsgCreateSubAccount),
|
|
43
|
-
[CarbonTx.Types.MsgActivateSubAccount]: utils_1.generateAminoType(MsgActivateSubAccount),
|
|
44
|
-
[CarbonTx.Types.MsgRemoveSubAccount]: utils_1.generateAminoType(MsgRemoveSubAccount),
|
|
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),
|
|
45
45
|
};
|
|
46
46
|
exports.default = SubAccountAmino;
|
|
@@ -48,23 +48,23 @@ const mapEachIndiv = (mapItem, valueKey, toAmino = false) => {
|
|
|
48
48
|
if (typeof keyMap !== "object") {
|
|
49
49
|
// Check if this is a Long/BigNumber/Buffer/Date/Duration obj or a non-object/array
|
|
50
50
|
if (typeCheck(mapItem[key]) || typeof mapItem[key] !== "object") {
|
|
51
|
-
directMap[altKey] = exports.paramConverter(mapItem[key], keyMap, toAmino);
|
|
51
|
+
directMap[altKey] = (0, exports.paramConverter)(mapItem[key], keyMap, toAmino);
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
if (mapItem[key].length && typeof mapItem[key] === "object") {
|
|
56
56
|
// If value is an array of objects, iterate through objects and call mapToObj function
|
|
57
57
|
directMap[altKey] = mapItem[key].map((newMap) => {
|
|
58
|
-
return exports.mapEachIndiv(newMap, valueKey, toAmino);
|
|
58
|
+
return (0, exports.mapEachIndiv)(newMap, valueKey, toAmino);
|
|
59
59
|
});
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
63
|
if (util_1.TypeUtils.isDurationType(mapItem[key])) {
|
|
64
|
-
directMap[altKey] = exports.paramConverter(mapItem[key], keyMap, toAmino);
|
|
64
|
+
directMap[altKey] = (0, exports.paramConverter)(mapItem[key], keyMap, toAmino);
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
directMap[altKey] = exports.mapEachIndiv(mapItem[key], keyMap, toAmino);
|
|
67
|
+
directMap[altKey] = (0, exports.mapEachIndiv)(mapItem[key], keyMap, toAmino);
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
70
|
return directMap;
|
|
@@ -147,18 +147,18 @@ const generateAminoType = (amino, aminoProcess = {}) => {
|
|
|
147
147
|
if (!newInput[key])
|
|
148
148
|
return;
|
|
149
149
|
if (typeCheck(newInput[key])) {
|
|
150
|
-
aminoObj[snakeKey] = exports.paramConverter(newInput[key], newAminoMap[key], true);
|
|
150
|
+
aminoObj[snakeKey] = (0, exports.paramConverter)(newInput[key], newAminoMap[key], true);
|
|
151
151
|
return;
|
|
152
152
|
}
|
|
153
153
|
if (typeof newInput[key] !== "object" && typeof newAminoMap[key] !== "object") {
|
|
154
|
-
aminoObj[snakeKey] = exports.paramConverter(newInput[key], newAminoMap[key], true);
|
|
154
|
+
aminoObj[snakeKey] = (0, exports.paramConverter)(newInput[key], newAminoMap[key], true);
|
|
155
155
|
}
|
|
156
156
|
else {
|
|
157
157
|
if (((_a = newInput[key]) === null || _a === void 0 ? void 0 : _a.length) && typeof newInput[key] === "object") {
|
|
158
|
-
aminoObj[snakeKey] = newInput[key].map((newItem) => exports.mapEachIndiv(newItem, newAminoMap[key], true));
|
|
158
|
+
aminoObj[snakeKey] = newInput[key].map((newItem) => (0, exports.mapEachIndiv)(newItem, newAminoMap[key], true));
|
|
159
159
|
return;
|
|
160
160
|
}
|
|
161
|
-
aminoObj[snakeKey] = exports.mapEachIndiv(newInput[key], newAminoMap[key], true);
|
|
161
|
+
aminoObj[snakeKey] = (0, exports.mapEachIndiv)(newInput[key], newAminoMap[key], true);
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
164
|
return aminoObj;
|
|
@@ -172,14 +172,14 @@ const generateAminoType = (amino, aminoProcess = {}) => {
|
|
|
172
172
|
var _a;
|
|
173
173
|
const camelKey = util_1.TypeUtils.snakeToCamel(key);
|
|
174
174
|
if (typeof newInput[key] !== "object" && typeof newAminoMap[key] !== "object") {
|
|
175
|
-
aminoObj[camelKey] = exports.paramConverter(newInput[key], newAminoMap[camelKey], false);
|
|
175
|
+
aminoObj[camelKey] = (0, exports.paramConverter)(newInput[key], newAminoMap[camelKey], false);
|
|
176
176
|
}
|
|
177
177
|
else {
|
|
178
178
|
if (((_a = newInput[key]) === null || _a === void 0 ? void 0 : _a.length) && typeof newInput[key] === "object") {
|
|
179
|
-
aminoObj[camelKey] = newInput[key].map((newItem) => exports.mapEachIndiv(newItem, newAminoMap[camelKey], false));
|
|
179
|
+
aminoObj[camelKey] = newInput[key].map((newItem) => (0, exports.mapEachIndiv)(newItem, newAminoMap[camelKey], false));
|
|
180
180
|
return;
|
|
181
181
|
}
|
|
182
|
-
aminoObj[camelKey] = exports.mapEachIndiv(newInput[key], newAminoMap[camelKey], false);
|
|
182
|
+
aminoObj[camelKey] = (0, exports.mapEachIndiv)(newInput[key], newAminoMap[camelKey], false);
|
|
183
183
|
}
|
|
184
184
|
});
|
|
185
185
|
return aminoObj;
|
|
@@ -149,7 +149,7 @@ class CosmosLedger {
|
|
|
149
149
|
const response = yield this.cosmosApp.getVersion();
|
|
150
150
|
this.checkLedgerErrors(response);
|
|
151
151
|
const { major, minor, patch, test_mode } = response;
|
|
152
|
-
exports.checkAppMode(this.testModeAllowed, test_mode);
|
|
152
|
+
(0, exports.checkAppMode)(this.testModeAllowed, test_mode);
|
|
153
153
|
const version = versionString({ major, minor, patch });
|
|
154
154
|
return version;
|
|
155
155
|
});
|
|
@@ -218,7 +218,7 @@ class CosmosLedger {
|
|
|
218
218
|
const response = yield this.cosmosApp.sign(this.hdPath, signMessage);
|
|
219
219
|
this.checkLedgerErrors(response);
|
|
220
220
|
// we have to parse the signature from Ledger as it's in DER format
|
|
221
|
-
const parsedSignature = secp256k1_1.signatureImport(response.signature);
|
|
221
|
+
const parsedSignature = (0, secp256k1_1.signatureImport)(response.signature);
|
|
222
222
|
return parsedSignature;
|
|
223
223
|
});
|
|
224
224
|
}
|
|
@@ -157,7 +157,7 @@ class MetaMask {
|
|
|
157
157
|
return __awaiter(this, void 0, void 0, function* () {
|
|
158
158
|
const chainIdHex = yield ((_a = this.getAPI()) === null || _a === void 0 ? void 0 : _a.request({ method: 'eth_chainId' }));
|
|
159
159
|
const chainId = !!chainIdHex ? parseInt(chainIdHex, 16) : undefined;
|
|
160
|
-
const blockchain = blockchain_1.getBlockchainFromChain(chainId);
|
|
160
|
+
const blockchain = (0, blockchain_1.getBlockchainFromChain)(chainId);
|
|
161
161
|
this.blockchain = blockchain;
|
|
162
162
|
return { chainId, blockchain };
|
|
163
163
|
});
|
|
@@ -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(generic_1.sortObject(doc));
|
|
63
|
+
const msg = JSON.stringify((0, generic_1.sortObject)(doc));
|
|
64
64
|
const signBytes = yield dapi.signMessage(msg);
|
|
65
|
-
const signature = amino_1.encodeSecp256k1Signature(pubKey, signBytes);
|
|
65
|
+
const signature = (0, amino_1.encodeSecp256k1Signature)(pubKey, signBytes);
|
|
66
66
|
return {
|
|
67
67
|
signed: doc,
|
|
68
68
|
signature,
|
package/lib/util/address.js
CHANGED
|
@@ -96,13 +96,13 @@ const randomMnemonic = () => {
|
|
|
96
96
|
};
|
|
97
97
|
exports.randomMnemonic = randomMnemonic;
|
|
98
98
|
const wifEncodePrivateKey = (privateKey, iter = 128) => {
|
|
99
|
-
const privateKeyBuf = exports.stringOrBufferToBuffer(privateKey);
|
|
99
|
+
const privateKeyBuf = (0, exports.stringOrBufferToBuffer)(privateKey);
|
|
100
100
|
return wif.encode(iter, privateKeyBuf, true);
|
|
101
101
|
};
|
|
102
102
|
exports.wifEncodePrivateKey = wifEncodePrivateKey;
|
|
103
103
|
exports.SWTHAddress = {
|
|
104
104
|
newMnemonic: () => {
|
|
105
|
-
return exports.randomMnemonic();
|
|
105
|
+
return (0, exports.randomMnemonic)();
|
|
106
106
|
},
|
|
107
107
|
coinType: () => {
|
|
108
108
|
return SWTH_COIN_TYPE;
|
|
@@ -112,10 +112,10 @@ exports.SWTHAddress = {
|
|
|
112
112
|
return new BIP44Path(BIP44_PURPOSE, coinType).update(index, change, account).toArray();
|
|
113
113
|
},
|
|
114
114
|
publicKeyToScriptHash: (publicKey) => {
|
|
115
|
-
const pubKeyBuffer = exports.stringOrBufferToBuffer(publicKey);
|
|
115
|
+
const pubKeyBuffer = (0, exports.stringOrBufferToBuffer)(publicKey);
|
|
116
116
|
const sha256Hash = ethers_1.ethers.utils.sha256(pubKeyBuffer);
|
|
117
117
|
const ripemdHash = ethers_1.ethers.utils.ripemd160(sha256Hash);
|
|
118
|
-
return generic_1.stripHexPrefix(ripemdHash);
|
|
118
|
+
return (0, generic_1.stripHexPrefix)(ripemdHash);
|
|
119
119
|
},
|
|
120
120
|
publicKeyToAddress: (publicKey, opts) => {
|
|
121
121
|
const scriptHash = exports.SWTHAddress.publicKeyToScriptHash(publicKey);
|
|
@@ -137,7 +137,7 @@ exports.SWTHAddress = {
|
|
|
137
137
|
return privateKey;
|
|
138
138
|
},
|
|
139
139
|
privateToPublicKey: (privateKey) => {
|
|
140
|
-
const privateKeyBuff = exports.stringOrBufferToBuffer(privateKey);
|
|
140
|
+
const privateKeyBuff = (0, exports.stringOrBufferToBuffer)(privateKey);
|
|
141
141
|
const publicKeyUint8Array = secp256k1.publicKeyCreate(privateKeyBuff, true);
|
|
142
142
|
const publicKey = Buffer.from(publicKeyUint8Array);
|
|
143
143
|
return publicKey;
|
|
@@ -148,7 +148,7 @@ exports.SWTHAddress = {
|
|
|
148
148
|
return address;
|
|
149
149
|
},
|
|
150
150
|
encode: (hash, opts) => {
|
|
151
|
-
const hashBuff = exports.stringOrBufferToBuffer(hash, 'hex');
|
|
151
|
+
const hashBuff = (0, exports.stringOrBufferToBuffer)(hash, 'hex');
|
|
152
152
|
const words = bech32.toWords(hashBuff.slice(0, 20));
|
|
153
153
|
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);
|
|
154
154
|
const address = bech32.encode(addressPrefix, words);
|
|
@@ -203,7 +203,7 @@ exports.NEOAddress = {
|
|
|
203
203
|
]);
|
|
204
204
|
const sha256Hash = ethers_1.ethers.utils.sha256(addressScript);
|
|
205
205
|
const ripemdHash = ethers_1.ethers.utils.ripemd160(sha256Hash);
|
|
206
|
-
return generic_1.stripHexPrefix(ripemdHash);
|
|
206
|
+
return (0, generic_1.stripHexPrefix)(ripemdHash);
|
|
207
207
|
},
|
|
208
208
|
publicKeyToAddress: (publicKey) => {
|
|
209
209
|
const addressScript = exports.NEOAddress.publicKeyToScriptHash(publicKey);
|
|
@@ -211,7 +211,7 @@ exports.NEOAddress = {
|
|
|
211
211
|
return address;
|
|
212
212
|
},
|
|
213
213
|
encodePublicKey: (unencodedPublicKey) => {
|
|
214
|
-
const unencPubKeyBuf = exports.stringOrBufferToBuffer(unencodedPublicKey);
|
|
214
|
+
const unencPubKeyBuf = (0, exports.stringOrBufferToBuffer)(unencodedPublicKey);
|
|
215
215
|
if (unencPubKeyBuf.length <= 33) {
|
|
216
216
|
// length indicates already encoded
|
|
217
217
|
return unencPubKeyBuf;
|
|
@@ -236,7 +236,7 @@ exports.NEOAddress = {
|
|
|
236
236
|
return privateKey;
|
|
237
237
|
},
|
|
238
238
|
privateToPublicKey: (privateKey) => {
|
|
239
|
-
const privateKeyBuff = exports.stringOrBufferToBuffer(privateKey);
|
|
239
|
+
const privateKeyBuff = (0, exports.stringOrBufferToBuffer)(privateKey);
|
|
240
240
|
const publicKeyUint8Array = secp256r1.publicKeyCreate(privateKeyBuff, true);
|
|
241
241
|
return Buffer.from(publicKeyUint8Array);
|
|
242
242
|
},
|
|
@@ -254,7 +254,7 @@ exports.NEOAddress = {
|
|
|
254
254
|
},
|
|
255
255
|
};
|
|
256
256
|
exports.N3Address = Object.assign(Object.assign({}, exports.NEOAddress), { publicKeyToScriptHash: (publicKey) => {
|
|
257
|
-
const publicKeyHex = exports.stringOrBufferToBuffer(publicKey).toString("hex");
|
|
257
|
+
const publicKeyHex = (0, exports.stringOrBufferToBuffer)(publicKey).toString("hex");
|
|
258
258
|
return neon_core_next_1.wallet.getScriptHashFromPublicKey(publicKeyHex);
|
|
259
259
|
}, publicKeyToAddress: (publicKey) => {
|
|
260
260
|
const addressScript = exports.N3Address.publicKeyToScriptHash(publicKey);
|
|
@@ -280,11 +280,11 @@ exports.ETHAddress = {
|
|
|
280
280
|
return ethers_1.ethers.utils.keccak256(encodedPublicKey);
|
|
281
281
|
},
|
|
282
282
|
publicKeyToAddress: (publicKey) => {
|
|
283
|
-
const publicKeyBuff = exports.stringOrBufferToBuffer(publicKey);
|
|
283
|
+
const publicKeyBuff = (0, exports.stringOrBufferToBuffer)(publicKey);
|
|
284
284
|
return ethers_1.ethers.utils.computeAddress(publicKeyBuff);
|
|
285
285
|
},
|
|
286
286
|
encodePublicKey: (unencodedPublicKey) => {
|
|
287
|
-
const unencodedPublicKeyBuff = exports.stringOrBufferToBuffer(unencodedPublicKey);
|
|
287
|
+
const unencodedPublicKeyBuff = (0, exports.stringOrBufferToBuffer)(unencodedPublicKey);
|
|
288
288
|
const publicKey = ethers_1.ethers.utils.computePublicKey(unencodedPublicKeyBuff, true);
|
|
289
289
|
return Buffer.from(publicKey, "hex");
|
|
290
290
|
},
|
|
@@ -296,7 +296,7 @@ exports.ETHAddress = {
|
|
|
296
296
|
return Buffer.from((_a = wallet.privateKey) === null || _a === void 0 ? void 0 : _a.replace(/^0x/, ""), "hex");
|
|
297
297
|
},
|
|
298
298
|
privateToPublicKey: (privateKey) => {
|
|
299
|
-
const privateKeyBuff = exports.stringOrBufferToBuffer(privateKey);
|
|
299
|
+
const privateKeyBuff = (0, exports.stringOrBufferToBuffer)(privateKey);
|
|
300
300
|
return Buffer.from(ethers_1.ethers.utils.computePublicKey(privateKeyBuff).replace(/^0x/, ""), "hex");
|
|
301
301
|
},
|
|
302
302
|
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 fetch_1.fetch(url, {
|
|
87
|
+
return (0, 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 fetch_1.fetch(options.url, {
|
|
96
|
+
return (0, 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 fetch_1.fetch(options.url, {
|
|
106
|
+
return (0, 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 fetch_1.fetch(url, otherOpts);
|
|
117
|
+
return (0, fetch_1.fetch)(url, otherOpts);
|
|
118
118
|
};
|
|
119
119
|
this.apiPrefix = apiPrefix;
|
|
120
120
|
this.apiEndpoints = apiEndpoints;
|
package/lib/util/fetch.js
CHANGED
package/lib/util/generic.js
CHANGED
|
@@ -22,7 +22,7 @@ const overrideConfig = (defaults, override) => {
|
|
|
22
22
|
continue;
|
|
23
23
|
if (typeof member === "object") {
|
|
24
24
|
// @ts-ignore
|
|
25
|
-
result[key] = exports.overrideConfig(result[key], member);
|
|
25
|
+
result[key] = (0, exports.overrideConfig)(result[key], member);
|
|
26
26
|
}
|
|
27
27
|
else {
|
|
28
28
|
// @ts-ignore
|
|
@@ -41,7 +41,7 @@ const sortObject = (input) => {
|
|
|
41
41
|
Object.keys(input)
|
|
42
42
|
.sort()
|
|
43
43
|
// @ts-ignore noImplicitAny
|
|
44
|
-
.forEach((key) => (output[key] = exports.sortObject(input[key])));
|
|
44
|
+
.forEach((key) => (output[key] = (0, exports.sortObject)(input[key])));
|
|
45
45
|
return output;
|
|
46
46
|
};
|
|
47
47
|
exports.sortObject = sortObject;
|
|
@@ -56,7 +56,7 @@ exports.appendHexPrefix = appendHexPrefix;
|
|
|
56
56
|
const computeTxHash = (bytes) => {
|
|
57
57
|
if (!bytes)
|
|
58
58
|
return bytes;
|
|
59
|
-
return exports.toTxHash(crypto_1.sha256(bytes));
|
|
59
|
+
return (0, exports.toTxHash)((0, crypto_1.sha256)(bytes));
|
|
60
60
|
};
|
|
61
61
|
exports.computeTxHash = computeTxHash;
|
|
62
62
|
const toTxHash = (bytes) => {
|
package/lib/util/number.js
CHANGED
|
@@ -17,26 +17,26 @@ const parseBN = (input, defaultValue) => {
|
|
|
17
17
|
};
|
|
18
18
|
exports.parseBN = parseBN;
|
|
19
19
|
const bnOrZero = (input, defaultValue = exports.BN_ZERO) => {
|
|
20
|
-
return exports.parseBN(input, defaultValue);
|
|
20
|
+
return (0, exports.parseBN)(input, defaultValue);
|
|
21
21
|
};
|
|
22
22
|
exports.bnOrZero = bnOrZero;
|
|
23
23
|
const toHuman = (value, decimals) => {
|
|
24
24
|
if (value === undefined || value === null)
|
|
25
25
|
return undefined;
|
|
26
|
-
const valueBN = exports.bnOrZero(value);
|
|
26
|
+
const valueBN = (0, exports.bnOrZero)(value);
|
|
27
27
|
if (!decimals)
|
|
28
28
|
return valueBN; // decimals = 0 or nullish
|
|
29
|
-
const decimalsBN = exports.bnOrZero(decimals);
|
|
29
|
+
const decimalsBN = (0, exports.bnOrZero)(decimals);
|
|
30
30
|
return valueBN.shiftedBy(decimalsBN.negated().toNumber());
|
|
31
31
|
};
|
|
32
32
|
exports.toHuman = toHuman;
|
|
33
33
|
const toUnitless = (value, decimals) => {
|
|
34
34
|
if (value === undefined || value === null)
|
|
35
35
|
return undefined;
|
|
36
|
-
const valueBN = exports.bnOrZero(value);
|
|
36
|
+
const valueBN = (0, exports.bnOrZero)(value);
|
|
37
37
|
if (!decimals)
|
|
38
38
|
return valueBN; // decimals = 0 or nullish
|
|
39
|
-
const decimalsBN = exports.bnOrZero(decimals);
|
|
39
|
+
const decimalsBN = (0, exports.bnOrZero)(decimals);
|
|
40
40
|
return valueBN.shiftedBy(decimalsBN.toNumber());
|
|
41
41
|
};
|
|
42
42
|
exports.toUnitless = toUnitless;
|