carbon-js-sdk 0.7.1-beta.6 → 0.7.1
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/codec/index.d.ts +12 -8
- package/lib/codec/index.js +12 -8
- package/lib/modules/admin.d.ts +39 -38
- package/lib/modules/admin.js +1 -0
- package/lib/modules/alliance.d.ts +5 -5
- package/lib/modules/alliance.js +5 -5
- package/lib/modules/bank.d.ts +1 -1
- package/lib/modules/broker.d.ts +2 -2
- package/lib/modules/cdp.d.ts +29 -29
- package/lib/modules/coin.d.ts +7 -7
- package/lib/modules/erc20.d.ts +4 -4
- package/lib/modules/evm.d.ts +2 -2
- package/lib/modules/evmmerge.d.ts +1 -1
- package/lib/modules/feemarket.d.ts +1 -1
- package/lib/modules/gov.d.ts +3 -3
- package/lib/modules/ibc.d.ts +2 -2
- package/lib/modules/leverage.d.ts +2 -2
- package/lib/modules/liquiditypool.d.ts +8 -8
- package/lib/modules/market.d.ts +7 -7
- package/lib/modules/oracle.d.ts +1 -1
- package/lib/modules/order.d.ts +7 -7
- package/lib/modules/perpspool.d.ts +6 -6
- package/lib/modules/position.d.ts +2 -2
- package/lib/modules/profile.d.ts +1 -1
- package/lib/modules/staking.d.ts +5 -5
- package/lib/modules/subaccount.d.ts +3 -3
- package/lib/modules/xchain.d.ts +3 -3
- package/lib/provider/keplr/KeplrAccount.js +9 -4
- package/lib/provider/leap/LeapAccount.js +9 -4
- package/lib/provider/ledger/ledger.js +4 -1
- package/lib/provider/metamask/MetaMask.js +10 -7
- package/lib/util/provider.d.ts +1 -0
- package/lib/util/provider.js +24 -0
- package/lib/util/tx.d.ts +23 -12
- package/lib/util/tx.js +13 -5
- package/lib/wallet/CarbonWallet.d.ts +18 -6
- package/lib/wallet/CarbonWallet.js +80 -12
- package/package.json +1 -1
package/lib/codec/index.d.ts
CHANGED
|
@@ -152,14 +152,14 @@ export declare const TxTypes: {
|
|
|
152
152
|
MsgSetOracleSlashEnabled: string;
|
|
153
153
|
MsgSetOracleSlashEnabledResponse: string;
|
|
154
154
|
CreateOracleProposal: string;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
155
|
+
MsgAllianceDelegate: string;
|
|
156
|
+
MsgAllianceDelegateResponse: string;
|
|
157
|
+
MsgAllianceUndelegate: string;
|
|
158
|
+
MsgAllianceUndelegateResponse: string;
|
|
159
|
+
MsgAllianceRedelegate: string;
|
|
160
|
+
MsgAllianceRedelegateResponse: string;
|
|
161
|
+
MsgAllianceClaimDelegationRewards: string;
|
|
162
|
+
MsgAllianceClaimDelegationRewardsResponse: string;
|
|
163
163
|
MsgSoftwareUpgrade: string;
|
|
164
164
|
MsgSoftwareUpgradeResponse: string;
|
|
165
165
|
MsgCancelUpgrade: string;
|
|
@@ -227,8 +227,12 @@ export declare const TxTypes: {
|
|
|
227
227
|
MsgCreateValidatorResponse: string;
|
|
228
228
|
MsgEditValidator: string;
|
|
229
229
|
MsgEditValidatorResponse: string;
|
|
230
|
+
MsgDelegate: string;
|
|
231
|
+
MsgDelegateResponse: string;
|
|
230
232
|
MsgBeginRedelegate: string;
|
|
231
233
|
MsgBeginRedelegateResponse: string;
|
|
234
|
+
MsgUndelegate: string;
|
|
235
|
+
MsgUndelegateResponse: string;
|
|
232
236
|
MsgCancelUnbondingDelegation: string;
|
|
233
237
|
MsgCancelUnbondingDelegationResponse: string;
|
|
234
238
|
ParameterChangeProposal: string;
|
package/lib/codec/index.js
CHANGED
|
@@ -694,14 +694,14 @@ exports.TxTypes = {
|
|
|
694
694
|
"MsgSetOracleSlashEnabled": "/Switcheo.carbon.oracle.MsgSetOracleSlashEnabled",
|
|
695
695
|
"MsgSetOracleSlashEnabledResponse": "/Switcheo.carbon.oracle.MsgSetOracleSlashEnabledResponse",
|
|
696
696
|
"CreateOracleProposal": "/Switcheo.carbon.oracle.CreateOracleProposal",
|
|
697
|
-
"
|
|
698
|
-
"
|
|
699
|
-
"
|
|
700
|
-
"
|
|
701
|
-
"
|
|
702
|
-
"
|
|
703
|
-
"
|
|
704
|
-
"
|
|
697
|
+
"MsgAllianceDelegate": "/alliance.alliance.MsgDelegate",
|
|
698
|
+
"MsgAllianceDelegateResponse": "/alliance.alliance.MsgDelegateResponse",
|
|
699
|
+
"MsgAllianceUndelegate": "/alliance.alliance.MsgUndelegate",
|
|
700
|
+
"MsgAllianceUndelegateResponse": "/alliance.alliance.MsgUndelegateResponse",
|
|
701
|
+
"MsgAllianceRedelegate": "/alliance.alliance.MsgRedelegate",
|
|
702
|
+
"MsgAllianceRedelegateResponse": "/alliance.alliance.MsgRedelegateResponse",
|
|
703
|
+
"MsgAllianceClaimDelegationRewards": "/alliance.alliance.MsgClaimDelegationRewards",
|
|
704
|
+
"MsgAllianceClaimDelegationRewardsResponse": "/alliance.alliance.MsgClaimDelegationRewardsResponse",
|
|
705
705
|
"MsgSoftwareUpgrade": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade",
|
|
706
706
|
"MsgSoftwareUpgradeResponse": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse",
|
|
707
707
|
"MsgCancelUpgrade": "/cosmos.upgrade.v1beta1.MsgCancelUpgrade",
|
|
@@ -769,8 +769,12 @@ exports.TxTypes = {
|
|
|
769
769
|
"MsgCreateValidatorResponse": "/cosmos.staking.v1beta1.MsgCreateValidatorResponse",
|
|
770
770
|
"MsgEditValidator": "/cosmos.staking.v1beta1.MsgEditValidator",
|
|
771
771
|
"MsgEditValidatorResponse": "/cosmos.staking.v1beta1.MsgEditValidatorResponse",
|
|
772
|
+
"MsgDelegate": "/cosmos.staking.v1beta1.MsgDelegate",
|
|
773
|
+
"MsgDelegateResponse": "/cosmos.staking.v1beta1.MsgDelegateResponse",
|
|
772
774
|
"MsgBeginRedelegate": "/cosmos.staking.v1beta1.MsgBeginRedelegate",
|
|
773
775
|
"MsgBeginRedelegateResponse": "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse",
|
|
776
|
+
"MsgUndelegate": "/cosmos.staking.v1beta1.MsgUndelegate",
|
|
777
|
+
"MsgUndelegateResponse": "/cosmos.staking.v1beta1.MsgUndelegateResponse",
|
|
774
778
|
"MsgCancelUnbondingDelegation": "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation",
|
|
775
779
|
"MsgCancelUnbondingDelegationResponse": "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse",
|
|
776
780
|
"ParameterChangeProposal": "/cosmos.params.v1beta1.ParameterChangeProposal",
|
package/lib/modules/admin.d.ts
CHANGED
|
@@ -7,45 +7,45 @@ import Long from "long";
|
|
|
7
7
|
import BaseModule from "./base";
|
|
8
8
|
import { Any } from "../codec";
|
|
9
9
|
export declare class AdminModule extends BaseModule {
|
|
10
|
-
createOracle(params: AdminModule.CreateOracleParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
11
|
-
createToken(params: AdminModule.CreateTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
12
|
-
createTokens(params: AdminModule.CreateTokenParams[], opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
13
|
-
syncToken(params: AdminModule.SyncTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
14
|
-
bindToken(params: AdminModule.BindTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
15
|
-
unbindToken(params: AdminModule.UnbindTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
16
|
-
updateToken(params: AdminModule.UpdateTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
17
|
-
linkToken(params: AdminModule.LinkTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
18
|
-
createMarket(params: AdminModule.CreateMarketParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
19
|
-
createMarkets(params: AdminModule.CreateMarketParams[], opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
20
|
-
setRewardsWeights(params: AdminModule.SetRewardsWeightsParams[], opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
21
|
-
setRewardCurve(params: AdminModule.SetRewardCurveParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
22
|
-
setCommitmentCurve(params: AdminModule.SetCommitmentCurveParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
23
|
-
updatePool(params: AdminModule.UpdatePoolParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
24
|
-
setTradingFlag(params: AdminModule.SetTradingFlagParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
10
|
+
createOracle(params: AdminModule.CreateOracleParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
11
|
+
createToken(params: AdminModule.CreateTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
12
|
+
createTokens(params: AdminModule.CreateTokenParams[], opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
13
|
+
syncToken(params: AdminModule.SyncTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
14
|
+
bindToken(params: AdminModule.BindTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
15
|
+
unbindToken(params: AdminModule.UnbindTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
16
|
+
updateToken(params: AdminModule.UpdateTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
17
|
+
linkToken(params: AdminModule.LinkTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
18
|
+
createMarket(params: AdminModule.CreateMarketParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
19
|
+
createMarkets(params: AdminModule.CreateMarketParams[], opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
20
|
+
setRewardsWeights(params: AdminModule.SetRewardsWeightsParams[], opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
21
|
+
setRewardCurve(params: AdminModule.SetRewardCurveParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
22
|
+
setCommitmentCurve(params: AdminModule.SetCommitmentCurveParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
23
|
+
updatePool(params: AdminModule.UpdatePoolParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
24
|
+
setTradingFlag(params: AdminModule.SetTradingFlagParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
25
25
|
setMsgFee(): Promise<void>;
|
|
26
|
-
setMsgGasCost(params: AdminModule.SetMsgGasCostParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
27
|
-
setMinGasPrice(params: AdminModule.SetMinGasPriceParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
28
|
-
removeMsgGasCost(params: AdminModule.RemoveMsgGasCostParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
29
|
-
removeMinGasPrice(params: AdminModule.RemoveMinGasPriceParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
30
|
-
createValidator(params: AdminModule.CreateValidatorParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
31
|
-
editValidator(params: AdminModule.EditValidatorParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
32
|
-
authorizeBridge(params: AdminModule.AuthorizeBridgeParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
33
|
-
deauthorizeBridge(params: AdminModule.DeauthorizeBridgeParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
34
|
-
addRateStrategy(params: AdminModule.AddRateStrategyParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
35
|
-
updateRateStrategy(params: AdminModule.UpdateRateStrategyParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
36
|
-
removeRateStrategy(params: AdminModule.RemoveRateStrategyParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
37
|
-
addAsset(params: AdminModule.AddAssetParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
38
|
-
updateAsset(params: AdminModule.UpdateAssetParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
39
|
-
setLiquidationFee(params: AdminModule.SetLiquidationFeeParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
40
|
-
setInterestFee(params: AdminModule.SetInterestFeeParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
41
|
-
setCompleteLiquidationThreshold(params: AdminModule.SetCompleteLiquidationThresholdParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
42
|
-
setMinimumCloseFactor(params: AdminModule.SetMinimumCloseFactorParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
43
|
-
setSmallLiquidationSize(params: AdminModule.SetSmallLiquidationSizeParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
44
|
-
createNewGroup(params: AdminModule.CreateNewGroupParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
45
|
-
updateGroup(params: AdminModule.UpdateGroupParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
46
|
-
registerToGroup(params: AdminModule.RegisterDeregisterToGroupParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
47
|
-
deregisterFromGroup(params: AdminModule.RegisterDeregisterToGroupParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
48
|
-
updateGroupConfig(params: AdminModule.UpdateGroupConfigParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
26
|
+
setMsgGasCost(params: AdminModule.SetMsgGasCostParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
27
|
+
setMinGasPrice(params: AdminModule.SetMinGasPriceParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
28
|
+
removeMsgGasCost(params: AdminModule.RemoveMsgGasCostParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
29
|
+
removeMinGasPrice(params: AdminModule.RemoveMinGasPriceParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
30
|
+
createValidator(params: AdminModule.CreateValidatorParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
31
|
+
editValidator(params: AdminModule.EditValidatorParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
32
|
+
authorizeBridge(params: AdminModule.AuthorizeBridgeParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
33
|
+
deauthorizeBridge(params: AdminModule.DeauthorizeBridgeParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
34
|
+
addRateStrategy(params: AdminModule.AddRateStrategyParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
35
|
+
updateRateStrategy(params: AdminModule.UpdateRateStrategyParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
36
|
+
removeRateStrategy(params: AdminModule.RemoveRateStrategyParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
37
|
+
addAsset(params: AdminModule.AddAssetParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
38
|
+
updateAsset(params: AdminModule.UpdateAssetParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
39
|
+
setLiquidationFee(params: AdminModule.SetLiquidationFeeParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
40
|
+
setInterestFee(params: AdminModule.SetInterestFeeParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
41
|
+
setCompleteLiquidationThreshold(params: AdminModule.SetCompleteLiquidationThresholdParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
42
|
+
setMinimumCloseFactor(params: AdminModule.SetMinimumCloseFactorParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
43
|
+
setSmallLiquidationSize(params: AdminModule.SetSmallLiquidationSizeParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
44
|
+
createNewGroup(params: AdminModule.CreateNewGroupParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
45
|
+
updateGroup(params: AdminModule.UpdateGroupParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
46
|
+
registerToGroup(params: AdminModule.RegisterDeregisterToGroupParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
47
|
+
deregisterFromGroup(params: AdminModule.RegisterDeregisterToGroupParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
48
|
+
updateGroupConfig(params: AdminModule.UpdateGroupConfigParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
49
49
|
}
|
|
50
50
|
export declare namespace AdminModule {
|
|
51
51
|
interface AuthorizeBridgeParams {
|
|
@@ -214,6 +214,7 @@ export declare namespace AdminModule {
|
|
|
214
214
|
liquidationDiscount: BigNumber;
|
|
215
215
|
supplyCap: BigNumber;
|
|
216
216
|
borrowCap: BigNumber;
|
|
217
|
+
allowRepayStablecoinInterestDebt: boolean;
|
|
217
218
|
}
|
|
218
219
|
interface AddRateStrategyParams {
|
|
219
220
|
rateStrategy: RateStrategy;
|
package/lib/modules/admin.js
CHANGED
|
@@ -421,6 +421,7 @@ class AdminModule extends base_1.default {
|
|
|
421
421
|
loanToValue: params.asset.loanToValue.toString(10),
|
|
422
422
|
liquidationThreshold: params.asset.liquidationThreshold.toString(10),
|
|
423
423
|
liquidationDiscount: params.asset.liquidationDiscount.toString(10),
|
|
424
|
+
allowRepayStablecoinInterestDebt: params.asset.allowRepayStablecoinInterestDebt,
|
|
424
425
|
supplyCap: params.asset.supplyCap.toString(10),
|
|
425
426
|
borrowCap: params.asset.borrowCap.toString(10),
|
|
426
427
|
},
|
|
@@ -2,11 +2,11 @@ import BigNumber from "bignumber.js";
|
|
|
2
2
|
import { CarbonTx } from "../util";
|
|
3
3
|
import BaseModule from "./base";
|
|
4
4
|
export declare class AllianceModule extends BaseModule {
|
|
5
|
-
delegateTokens(params: AllianceModule.DelegateTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
6
|
-
undelegateTokens(params: AllianceModule.DelegateTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
7
|
-
redelegateTokens(params: AllianceModule.RedelegateTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
8
|
-
claimRewards(params: AllianceModule.ClaimRewardsParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
9
|
-
withdrawAllRewards(params: AllianceModule.WithdrawAllRewardsParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
5
|
+
delegateTokens(params: AllianceModule.DelegateTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
6
|
+
undelegateTokens(params: AllianceModule.DelegateTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
7
|
+
redelegateTokens(params: AllianceModule.RedelegateTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
8
|
+
claimRewards(params: AllianceModule.ClaimRewardsParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
9
|
+
withdrawAllRewards(params: AllianceModule.WithdrawAllRewardsParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
10
10
|
}
|
|
11
11
|
export declare namespace AllianceModule {
|
|
12
12
|
interface DelegateTokensParams {
|
package/lib/modules/alliance.js
CHANGED
|
@@ -31,7 +31,7 @@ class AllianceModule extends base_1.default {
|
|
|
31
31
|
},
|
|
32
32
|
});
|
|
33
33
|
return wallet.sendTx({
|
|
34
|
-
typeUrl: codec_1.TxTypes.
|
|
34
|
+
typeUrl: codec_1.TxTypes.MsgAllianceDelegate,
|
|
35
35
|
value,
|
|
36
36
|
}, opts);
|
|
37
37
|
});
|
|
@@ -49,7 +49,7 @@ class AllianceModule extends base_1.default {
|
|
|
49
49
|
},
|
|
50
50
|
});
|
|
51
51
|
return wallet.sendTx({
|
|
52
|
-
typeUrl: codec_1.TxTypes.
|
|
52
|
+
typeUrl: codec_1.TxTypes.MsgAllianceUndelegate,
|
|
53
53
|
value,
|
|
54
54
|
}, opts);
|
|
55
55
|
});
|
|
@@ -68,7 +68,7 @@ class AllianceModule extends base_1.default {
|
|
|
68
68
|
},
|
|
69
69
|
});
|
|
70
70
|
return wallet.sendTx({
|
|
71
|
-
typeUrl: codec_1.TxTypes.
|
|
71
|
+
typeUrl: codec_1.TxTypes.MsgAllianceRedelegate,
|
|
72
72
|
value,
|
|
73
73
|
}, opts);
|
|
74
74
|
});
|
|
@@ -83,7 +83,7 @@ class AllianceModule extends base_1.default {
|
|
|
83
83
|
denom: params.denom,
|
|
84
84
|
});
|
|
85
85
|
return wallet.sendTx({
|
|
86
|
-
typeUrl: codec_1.TxTypes.
|
|
86
|
+
typeUrl: codec_1.TxTypes.MsgAllianceClaimDelegationRewards,
|
|
87
87
|
value,
|
|
88
88
|
}, opts);
|
|
89
89
|
});
|
|
@@ -104,7 +104,7 @@ class AllianceModule extends base_1.default {
|
|
|
104
104
|
}
|
|
105
105
|
else {
|
|
106
106
|
return {
|
|
107
|
-
typeUrl: codec_1.TxTypes.
|
|
107
|
+
typeUrl: codec_1.TxTypes.MsgAllianceClaimDelegationRewards,
|
|
108
108
|
value: CarbonSDK_1.Carbon.Alliance.MsgClaimDelegationRewards.fromPartial({
|
|
109
109
|
delegatorAddress: (_b = params.delegatorAddress) !== null && _b !== void 0 ? _b : wallet.bech32Address,
|
|
110
110
|
validatorAddress: delegation.validatorAddress,
|
package/lib/modules/bank.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { CarbonTx } from "../util";
|
|
|
2
2
|
import { Coin } from "@cosmjs/amino";
|
|
3
3
|
import BaseModule from "./base";
|
|
4
4
|
export declare class BankModule extends BaseModule {
|
|
5
|
-
sendTokens(params: BankModule.SendTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
5
|
+
sendTokens(params: BankModule.SendTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
6
6
|
}
|
|
7
7
|
export declare namespace BankModule {
|
|
8
8
|
interface SendTokensParams {
|
package/lib/modules/broker.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CarbonTx } from "../util";
|
|
2
2
|
import BaseModule from "./base";
|
|
3
3
|
export declare class BrokerModule extends BaseModule {
|
|
4
|
-
initiateLiquidation(params: BrokerModule.InitiateLiquidationParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
5
|
-
initiateLiquidations(params: BrokerModule.InitiateLiquidationParams[], opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
4
|
+
initiateLiquidation(params: BrokerModule.InitiateLiquidationParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
5
|
+
initiateLiquidations(params: BrokerModule.InitiateLiquidationParams[], opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
6
6
|
}
|
|
7
7
|
export declare namespace BrokerModule {
|
|
8
8
|
export interface InitiateLiquidationParams {
|
package/lib/modules/cdp.d.ts
CHANGED
|
@@ -6,40 +6,40 @@ import Long from "long";
|
|
|
6
6
|
import BaseModule from "./base";
|
|
7
7
|
export declare class CDPModule extends BaseModule {
|
|
8
8
|
private cdpModuleAddress;
|
|
9
|
-
supplyAsset(params: CDPModule.SupplyAssetParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
10
|
-
withdrawAsset(params: CDPModule.WithdrawAssetParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
11
|
-
lockCollateral(params: CDPModule.LockCollateralParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
12
|
-
unlockCollateral(params: CDPModule.UnlockCollateralParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
13
|
-
borrowAsset(params: CDPModule.BorrowAssetParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
14
|
-
supplyAssetAndLockCollateral(params: CDPModule.SupplyAssetAndLockCollateralParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
15
|
-
unlockCollateralAndWithdrawAsset(params: CDPModule.UnlockCollateralAndWithdrawAssetParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
16
|
-
liquidateCollateral(params: CDPModule.LiquidateCollateralParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
17
|
-
liquidateCollateralWithCdpTokens(params: CDPModule.LiquidateCollateralWithCdpTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
18
|
-
liquidateCollateralWithCollateral(params: CDPModule.LiquidateCollateralWithCollateralParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
19
|
-
liquidateCollateralWithStablecoin(params: CDPModule.LiquidateCollateralWithStablecoinParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
20
|
-
repayAsset(params: CDPModule.RepayAssetParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
9
|
+
supplyAsset(params: CDPModule.SupplyAssetParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
10
|
+
withdrawAsset(params: CDPModule.WithdrawAssetParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
11
|
+
lockCollateral(params: CDPModule.LockCollateralParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
12
|
+
unlockCollateral(params: CDPModule.UnlockCollateralParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
13
|
+
borrowAsset(params: CDPModule.BorrowAssetParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
14
|
+
supplyAssetAndLockCollateral(params: CDPModule.SupplyAssetAndLockCollateralParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
15
|
+
unlockCollateralAndWithdrawAsset(params: CDPModule.UnlockCollateralAndWithdrawAssetParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
16
|
+
liquidateCollateral(params: CDPModule.LiquidateCollateralParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
17
|
+
liquidateCollateralWithCdpTokens(params: CDPModule.LiquidateCollateralWithCdpTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
18
|
+
liquidateCollateralWithCollateral(params: CDPModule.LiquidateCollateralWithCollateralParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
19
|
+
liquidateCollateralWithStablecoin(params: CDPModule.LiquidateCollateralWithStablecoinParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
20
|
+
repayAsset(params: CDPModule.RepayAssetParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
21
21
|
/**
|
|
22
22
|
* Uses grouped token balance to repay for existing CDP asset debt.
|
|
23
23
|
* Calls 2 msg in 1 tx, MsgWithdrawFromGroup and MsgRepayAsset.
|
|
24
24
|
* Ensure that grouped token balance is sufficient.
|
|
25
25
|
*/
|
|
26
|
-
repayAssetWithGroupedToken(params: CDPModule.RepayAssetWithGroupedToken, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
27
|
-
repayAssetWithCdpTokens(params: CDPModule.RepayAssetWithCdpTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
28
|
-
repayAssetWithCollateral(params: CDPModule.RepayAssetWithCollateralParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
29
|
-
mintStablecoin(params: CDPModule.MintStablecoinParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
30
|
-
returnStablecoin(params: CDPModule.ReturnStablecoinParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
31
|
-
updateRateStrategy(params: CDPModule.UpdateRateStrategyParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
32
|
-
claimRewards(opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
33
|
-
createRewardScheme(params: CDPModule.CreateRewardSchemeParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
34
|
-
updateRewardScheme(params: CDPModule.UpdateRewardSchemeParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
35
|
-
returnStablecoinWithInterestInCdpTokens(params: CDPModule.ReturnStablecoinWithInterestInCdpTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
36
|
-
returnStablecoinWithInterestInCollateral(params: CDPModule.ReturnStablecoinWithInterestInCollateralParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
37
|
-
liquidateCollateralWithStablecoinAndInterestInCdpTokens(params: CDPModule.LiquidateCollateralWithStablecoinAndInterestInCdpTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
38
|
-
liquidateCollateralWithStablecoinAndInterestInCollateral(params: CDPModule.LiquidateCollateralWithStablecoinAndInterestInCollateralParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
39
|
-
addEModeCategory(params: CDPModule.AddEModeCategoryParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
40
|
-
updateEModeCategory(params: CDPModule.UpdateEModeCategoryParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
41
|
-
setAccountEMode(params: CDPModule.SetAccountEModeParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
42
|
-
removeAccountEMode(opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
26
|
+
repayAssetWithGroupedToken(params: CDPModule.RepayAssetWithGroupedToken, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
27
|
+
repayAssetWithCdpTokens(params: CDPModule.RepayAssetWithCdpTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
28
|
+
repayAssetWithCollateral(params: CDPModule.RepayAssetWithCollateralParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
29
|
+
mintStablecoin(params: CDPModule.MintStablecoinParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
30
|
+
returnStablecoin(params: CDPModule.ReturnStablecoinParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
31
|
+
updateRateStrategy(params: CDPModule.UpdateRateStrategyParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
32
|
+
claimRewards(opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
33
|
+
createRewardScheme(params: CDPModule.CreateRewardSchemeParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
34
|
+
updateRewardScheme(params: CDPModule.UpdateRewardSchemeParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
35
|
+
returnStablecoinWithInterestInCdpTokens(params: CDPModule.ReturnStablecoinWithInterestInCdpTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
36
|
+
returnStablecoinWithInterestInCollateral(params: CDPModule.ReturnStablecoinWithInterestInCollateralParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
37
|
+
liquidateCollateralWithStablecoinAndInterestInCdpTokens(params: CDPModule.LiquidateCollateralWithStablecoinAndInterestInCdpTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
38
|
+
liquidateCollateralWithStablecoinAndInterestInCollateral(params: CDPModule.LiquidateCollateralWithStablecoinAndInterestInCollateralParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
39
|
+
addEModeCategory(params: CDPModule.AddEModeCategoryParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
40
|
+
updateEModeCategory(params: CDPModule.UpdateEModeCategoryParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
41
|
+
setAccountEMode(params: CDPModule.SetAccountEModeParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
42
|
+
removeAccountEMode(opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
43
43
|
getAccountData(account: string): Promise<{
|
|
44
44
|
TotalCollateralsUsd: BigNumber;
|
|
45
45
|
AvailableBorrowsUsd: BigNumber;
|
package/lib/modules/coin.d.ts
CHANGED
|
@@ -4,13 +4,13 @@ import BigNumber from "bignumber.js";
|
|
|
4
4
|
import BaseModule from "./base";
|
|
5
5
|
import Long from "long";
|
|
6
6
|
export declare class CoinModule extends BaseModule {
|
|
7
|
-
createWithdrawal(params: CoinModule.CreateWithdrawalParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
8
|
-
mintToken(params: CoinModule.MintTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
9
|
-
depositToGroup(params: CoinModule.DepositToGroupParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
10
|
-
convertToGroup(params: CoinModule.DepositToGroupParams[], opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
11
|
-
withdrawFromGroup(params: CoinModule.WithdrawFromGroupParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
12
|
-
addBridgeAddress(params: CoinModule.AddBridgeAddressParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
13
|
-
createToken(params: CoinModule.CreateTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
7
|
+
createWithdrawal(params: CoinModule.CreateWithdrawalParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
8
|
+
mintToken(params: CoinModule.MintTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
9
|
+
depositToGroup(params: CoinModule.DepositToGroupParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
10
|
+
convertToGroup(params: CoinModule.DepositToGroupParams[], opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
11
|
+
withdrawFromGroup(params: CoinModule.WithdrawFromGroupParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
12
|
+
addBridgeAddress(params: CoinModule.AddBridgeAddressParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
13
|
+
createToken(params: CoinModule.CreateTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
14
14
|
}
|
|
15
15
|
export declare namespace CoinModule {
|
|
16
16
|
interface CreateWithdrawalParams {
|
package/lib/modules/erc20.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CarbonTx } from "../CarbonSDK";
|
|
2
2
|
import BaseModule from "./base";
|
|
3
3
|
export declare class ERC20Module extends BaseModule {
|
|
4
|
-
convertCoin(params: ERC20Module.ConvertCoinParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
5
|
-
convertERC20(params: ERC20Module.ConvertERC20Params, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
6
|
-
registerToken(params: ERC20Module.RegisterTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
7
|
-
registerERC20(params: ERC20Module.RegisterERC20Params, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
4
|
+
convertCoin(params: ERC20Module.ConvertCoinParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
5
|
+
convertERC20(params: ERC20Module.ConvertERC20Params, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
6
|
+
registerToken(params: ERC20Module.RegisterTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
7
|
+
registerERC20(params: ERC20Module.RegisterERC20Params, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
8
8
|
}
|
|
9
9
|
export declare namespace ERC20Module {
|
|
10
10
|
interface ConvertCoinParams {
|
package/lib/modules/evm.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ import { ethers } from "ethers";
|
|
|
5
5
|
import BaseModule from "./base";
|
|
6
6
|
export declare type TxData = LegacyTx | AccessListTx | DynamicFeeTx;
|
|
7
7
|
export declare class EvmModule extends BaseModule {
|
|
8
|
-
sendEvmTx(req: ethers.providers.TransactionRequest, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
9
|
-
updateParams(p: EvmModule.UpdateParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
8
|
+
sendEvmTx(req: ethers.providers.TransactionRequest, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
9
|
+
updateParams(p: EvmModule.UpdateParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
10
10
|
}
|
|
11
11
|
export declare function constructTxDataAny(req: ethers.providers.TransactionRequest): Any;
|
|
12
12
|
export declare namespace EvmModule {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CarbonTx } from "../util";
|
|
2
2
|
import BaseModule from "./base";
|
|
3
3
|
export declare class EvmMergeModule extends BaseModule {
|
|
4
|
-
mergeAccount(params: EvmMergeModule.MergeAccountParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
4
|
+
mergeAccount(params: EvmMergeModule.MergeAccountParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
5
5
|
}
|
|
6
6
|
export declare namespace EvmMergeModule {
|
|
7
7
|
interface MergeAccountParams {
|
|
@@ -2,7 +2,7 @@ import { CarbonTx } from "../util";
|
|
|
2
2
|
import BigNumber from "bignumber.js";
|
|
3
3
|
import BaseModule from "./base";
|
|
4
4
|
export declare class FeemarketModule extends BaseModule {
|
|
5
|
-
updateParams(params: FeemarketModule.UpdateParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
5
|
+
updateParams(params: FeemarketModule.UpdateParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
6
6
|
}
|
|
7
7
|
export declare namespace FeemarketModule {
|
|
8
8
|
interface UpdateParams {
|
package/lib/modules/gov.d.ts
CHANGED
|
@@ -9,9 +9,9 @@ import { AdminModule } from "./admin";
|
|
|
9
9
|
import BaseModule from "./base";
|
|
10
10
|
import { MarketModule } from "./market";
|
|
11
11
|
export declare class GovModule extends BaseModule {
|
|
12
|
-
submit(params: GovModule.SubmitProposalParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
13
|
-
deposit(params: GovModule.DepositParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
14
|
-
vote(params: GovModule.VoteParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
12
|
+
submit(params: GovModule.SubmitProposalParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
13
|
+
deposit(params: GovModule.DepositParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
14
|
+
vote(params: GovModule.VoteParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
15
15
|
encode(proposalUrl: string, proposalMsg: any): Uint8Array;
|
|
16
16
|
}
|
|
17
17
|
export declare namespace GovModule {
|
package/lib/modules/ibc.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ import BigNumber from "bignumber.js";
|
|
|
8
8
|
import BaseModule from "./base";
|
|
9
9
|
export declare class IBCModule extends BaseModule {
|
|
10
10
|
/** @deprecated please use sendIbcTransferUpdated instead */
|
|
11
|
-
sendIBCTransfer(params: IBCModule.SendIBCTransferParams, msgOpts?: CarbonTx.SignTxOpts): Promise<import("
|
|
12
|
-
sendIbcTransferV2(params: IBCModule.SendIBCTransferV2Params, msgOpts?: CarbonTx.SignTxOpts): Promise<import("
|
|
11
|
+
sendIBCTransfer(params: IBCModule.SendIBCTransferParams, msgOpts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
12
|
+
sendIbcTransferV2(params: IBCModule.SendIBCTransferV2Params, msgOpts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
13
13
|
getChainInfoMap(denomTraces?: TypeUtils.SimpleMap<DenomTrace>): Promise<TypeUtils.SimpleMap<ExtendedChainInfo>>;
|
|
14
14
|
getAppCurrency(coinMinimalDenom: string, coinGeckoId: string, tokenInfo?: Token, cw20RegexArr?: RegExpMatchArray | null): AppCurrency;
|
|
15
15
|
getChainInfo(chainName: string): Promise<ChainInfo | undefined>;
|
|
@@ -2,8 +2,8 @@ import { CarbonTx } from "../util";
|
|
|
2
2
|
import BaseModule from "./base";
|
|
3
3
|
import { BigNumber } from "bignumber.js";
|
|
4
4
|
export declare class LeverageModule extends BaseModule {
|
|
5
|
-
set(params: LeverageModule.SetLeverageParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
6
|
-
setLeverages(params: LeverageModule.SetLeverageParams[], opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
5
|
+
set(params: LeverageModule.SetLeverageParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
6
|
+
setLeverages(params: LeverageModule.SetLeverageParams[], opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
7
7
|
}
|
|
8
8
|
export declare namespace LeverageModule {
|
|
9
9
|
interface SetLeverageParams {
|
|
@@ -3,13 +3,13 @@ import { BigNumber } from "bignumber.js";
|
|
|
3
3
|
import Long from "long";
|
|
4
4
|
import BaseModule from "./base";
|
|
5
5
|
export declare class LiquidityPoolModule extends BaseModule {
|
|
6
|
-
create(params: LiquidityPoolModule.CreatePoolParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
7
|
-
createWithLiquidity(params: LiquidityPoolModule.CreatePoolWithLiquidityParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
8
|
-
addLiquidity(params: LiquidityPoolModule.AddLiquidityParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
9
|
-
removeLiquidity(params: LiquidityPoolModule.RemoveLiquidityParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
10
|
-
stakePoolToken(params: LiquidityPoolModule.StakePoolTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
11
|
-
unstakePoolToken(params: LiquidityPoolModule.UnstakePoolTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
12
|
-
claimPoolRewards(params: LiquidityPoolModule.ClaimPoolRewardsParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
6
|
+
create(params: LiquidityPoolModule.CreatePoolParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
7
|
+
createWithLiquidity(params: LiquidityPoolModule.CreatePoolWithLiquidityParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
8
|
+
addLiquidity(params: LiquidityPoolModule.AddLiquidityParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
9
|
+
removeLiquidity(params: LiquidityPoolModule.RemoveLiquidityParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
10
|
+
stakePoolToken(params: LiquidityPoolModule.StakePoolTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
11
|
+
unstakePoolToken(params: LiquidityPoolModule.UnstakePoolTokenParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
12
|
+
claimPoolRewards(params: LiquidityPoolModule.ClaimPoolRewardsParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
13
13
|
/**
|
|
14
14
|
* Calculates weekly LP rewards (in SWTH)
|
|
15
15
|
* weeklySWTHRewards = ((INITIAL_SUPPLY) * (WEEKLY_DECAY)^(weeksFromInitalRewardsStart)) / 52
|
|
@@ -18,7 +18,7 @@ export declare class LiquidityPoolModule extends BaseModule {
|
|
|
18
18
|
*/
|
|
19
19
|
getWeeklyRewards(): Promise<BigNumber>;
|
|
20
20
|
getWeeklyRewardsRealInflation(): Promise<BigNumber>;
|
|
21
|
-
claimMultiPoolRewards(params: LiquidityPoolModule.ClaimMultiPoolRewards, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
21
|
+
claimMultiPoolRewards(params: LiquidityPoolModule.ClaimMultiPoolRewards, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
22
22
|
}
|
|
23
23
|
export declare namespace LiquidityPoolModule {
|
|
24
24
|
interface CreatePoolParams {
|
package/lib/modules/market.d.ts
CHANGED
|
@@ -6,13 +6,13 @@ import BaseModule from "./base";
|
|
|
6
6
|
export declare class MarketModule extends BaseModule {
|
|
7
7
|
getFeeTiers(marketType: string): Promise<Carbon.Market.FeeTier[]>;
|
|
8
8
|
getTradingFees(marketName: string, userAddress: string): Promise<Carbon.Market.TradingFees>;
|
|
9
|
-
update(params: MarketModule.UpdateMarketParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
10
|
-
createMarket(params: MarketModule.CreateMarketParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
11
|
-
disableSpotMarket(params: MarketModule.DisableSpotMarketParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
12
|
-
addFeeTier(params: MarketModule.AddFeeTierParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
13
|
-
updateFeeTier(params: MarketModule.UpdateFeeTierParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
14
|
-
removeFeeTier(params: MarketModule.RemoveFeeTierParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
15
|
-
setStakeEquivalence(params: MarketModule.SetStakeEquivalenceParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
9
|
+
update(params: MarketModule.UpdateMarketParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
10
|
+
createMarket(params: MarketModule.CreateMarketParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
11
|
+
disableSpotMarket(params: MarketModule.DisableSpotMarketParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
12
|
+
addFeeTier(params: MarketModule.AddFeeTierParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
13
|
+
updateFeeTier(params: MarketModule.UpdateFeeTierParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
14
|
+
removeFeeTier(params: MarketModule.RemoveFeeTierParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
15
|
+
setStakeEquivalence(params: MarketModule.SetStakeEquivalenceParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
16
16
|
}
|
|
17
17
|
export declare namespace MarketModule {
|
|
18
18
|
interface UpdateMarketParams {
|
package/lib/modules/oracle.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CarbonTx } from "../util";
|
|
2
2
|
import BaseModule from "./base";
|
|
3
3
|
export declare class OracleModule extends BaseModule {
|
|
4
|
-
createVote(params: OracleModule.CreateVoteParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
4
|
+
createVote(params: OracleModule.CreateVoteParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
5
5
|
}
|
|
6
6
|
export declare namespace OracleModule {
|
|
7
7
|
interface CreateVoteParams {
|
package/lib/modules/order.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ import { CarbonTx } from "../util";
|
|
|
2
2
|
import { BigNumber } from "bignumber.js";
|
|
3
3
|
import BaseModule from "./base";
|
|
4
4
|
export declare class OrderModule extends BaseModule {
|
|
5
|
-
create(params: OrderModule.CreateOrderParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
6
|
-
createOrders(params: OrderModule.CreateOrderParams[], opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
7
|
-
cancel(orderId: string, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
8
|
-
cancelOrders(orderIds: string[], opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
9
|
-
edit(params: OrderModule.EditOrderParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
10
|
-
editOrders(params: OrderModule.EditOrderParams[], opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
11
|
-
cancelAll(params: OrderModule.CancelAllParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
5
|
+
create(params: OrderModule.CreateOrderParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
6
|
+
createOrders(params: OrderModule.CreateOrderParams[], opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
7
|
+
cancel(orderId: string, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
8
|
+
cancelOrders(orderIds: string[], opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
9
|
+
edit(params: OrderModule.EditOrderParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
10
|
+
editOrders(params: OrderModule.EditOrderParams[], opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
11
|
+
cancelAll(params: OrderModule.CancelAllParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
12
12
|
}
|
|
13
13
|
export declare namespace OrderModule {
|
|
14
14
|
interface CreateOrderParams {
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { CarbonTx } from "../util";
|
|
3
3
|
import BaseModule from "./base";
|
|
4
4
|
export declare class PerpspoolModule extends BaseModule {
|
|
5
|
-
createPerpertualsPool(params: PerpspoolModule.CreatePoolParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
6
|
-
updatePerpetualsPool(params: PerpspoolModule.UpdatePoolParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
7
|
-
depositToPool(params: PerpspoolModule.DepositToPoolParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
8
|
-
withdrawFromPool(params: PerpspoolModule.WithdrawFromPoolParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
9
|
-
registerToPool(params: PerpspoolModule.RegisterToPoolParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
10
|
-
deregisterFromPool(params: PerpspoolModule.DeregisterFromPoolParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
5
|
+
createPerpertualsPool(params: PerpspoolModule.CreatePoolParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
6
|
+
updatePerpetualsPool(params: PerpspoolModule.UpdatePoolParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
7
|
+
depositToPool(params: PerpspoolModule.DepositToPoolParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
8
|
+
withdrawFromPool(params: PerpspoolModule.WithdrawFromPoolParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
9
|
+
registerToPool(params: PerpspoolModule.RegisterToPoolParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
10
|
+
deregisterFromPool(params: PerpspoolModule.DeregisterFromPoolParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
11
11
|
}
|
|
12
12
|
export declare namespace PerpspoolModule {
|
|
13
13
|
interface CreatePoolParams {
|
|
@@ -2,8 +2,8 @@ import { CarbonTx } from "../util";
|
|
|
2
2
|
import { BigNumber } from "bignumber.js";
|
|
3
3
|
import BaseModule from "./base";
|
|
4
4
|
export declare class PositionModule extends BaseModule {
|
|
5
|
-
editMargin(params: PositionModule.SetMarginParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
6
|
-
editMargins(params: PositionModule.SetMarginParams[], opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
5
|
+
editMargin(params: PositionModule.SetMarginParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
6
|
+
editMargins(params: PositionModule.SetMarginParams[], opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
7
7
|
}
|
|
8
8
|
export declare namespace PositionModule {
|
|
9
9
|
interface SetMarginParams {
|
package/lib/modules/profile.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CarbonTx } from "../util";
|
|
2
2
|
import BaseModule from "./base";
|
|
3
3
|
export declare class ProfileModule extends BaseModule {
|
|
4
|
-
update(params: ProfileModule.UpdateProfileParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
4
|
+
update(params: ProfileModule.UpdateProfileParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
5
5
|
}
|
|
6
6
|
export declare namespace ProfileModule {
|
|
7
7
|
interface UpdateProfileParams {
|
package/lib/modules/staking.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import { CarbonTx } from "../CarbonSDK";
|
|
|
2
2
|
import BigNumber from "bignumber.js";
|
|
3
3
|
import BaseModule from "./base";
|
|
4
4
|
export declare class StakingModule extends BaseModule {
|
|
5
|
-
delegateTokens(params: StakingModule.DelegateTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
6
|
-
undelegateTokens(params: StakingModule.DelegateTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
7
|
-
redelegateTokens(params: StakingModule.RedelegateTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
8
|
-
withdrawRewards(params: StakingModule.WithdrawRewardsParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
9
|
-
withdrawAllDelegatorRewards(params: StakingModule.WithdrawAllDelegatorRewardsParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
5
|
+
delegateTokens(params: StakingModule.DelegateTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
6
|
+
undelegateTokens(params: StakingModule.DelegateTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
7
|
+
redelegateTokens(params: StakingModule.RedelegateTokensParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
8
|
+
withdrawRewards(params: StakingModule.WithdrawRewardsParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
9
|
+
withdrawAllDelegatorRewards(params: StakingModule.WithdrawAllDelegatorRewardsParams, opts?: CarbonTx.SignTxOpts): Promise<import("../CarbonSDK").CarbonWallet.SendTxResponse>;
|
|
10
10
|
}
|
|
11
11
|
export declare namespace StakingModule {
|
|
12
12
|
interface DelegateTokensParams {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CarbonTx } from "../util";
|
|
2
2
|
import BaseModule from "./base";
|
|
3
3
|
export declare class SubAccountModule extends BaseModule {
|
|
4
|
-
create(params: SubAccountModule.CreateSubAccountParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
5
|
-
activate(params: SubAccountModule.ActivateSubAccountParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
6
|
-
remove(params: SubAccountModule.RemoveSubAccountParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
4
|
+
create(params: SubAccountModule.CreateSubAccountParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
5
|
+
activate(params: SubAccountModule.ActivateSubAccountParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
6
|
+
remove(params: SubAccountModule.RemoveSubAccountParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
7
7
|
}
|
|
8
8
|
export declare namespace SubAccountModule {
|
|
9
9
|
interface CreateSubAccountParams {
|
package/lib/modules/xchain.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CarbonTx } from "../util";
|
|
2
2
|
import BaseModule from "./base";
|
|
3
3
|
export declare class XChainModule extends BaseModule {
|
|
4
|
-
syncHeader(params: XChainModule.SyncHeaderParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
5
|
-
processCrossChainTx(params: XChainModule.ProcessCrossChainTxParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
6
|
-
processZionCrossChainTx(params: XChainModule.ProcessZionCrossChainTxParams, opts?: CarbonTx.SignTxOpts): Promise<import("
|
|
4
|
+
syncHeader(params: XChainModule.SyncHeaderParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
5
|
+
processCrossChainTx(params: XChainModule.ProcessCrossChainTxParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
6
|
+
processZionCrossChainTx(params: XChainModule.ProcessZionCrossChainTxParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
7
7
|
}
|
|
8
8
|
export declare namespace XChainModule {
|
|
9
9
|
interface SyncHeaderParams {
|
|
@@ -15,6 +15,7 @@ const wallet_1 = require("../../wallet");
|
|
|
15
15
|
const types_1 = require("@keplr-wallet/types");
|
|
16
16
|
const ethers_1 = require("ethers");
|
|
17
17
|
const ethermint_1 = require("../../util/ethermint");
|
|
18
|
+
const provider_1 = require("../../util/provider");
|
|
18
19
|
const error_1 = require("../metamask/error");
|
|
19
20
|
const SWTH = {
|
|
20
21
|
coinDenom: "SWTH",
|
|
@@ -26,12 +27,16 @@ const SWTH = {
|
|
|
26
27
|
class KeplrAccount {
|
|
27
28
|
static createKeplrSigner(keplr, chainInfo, account) {
|
|
28
29
|
const signDirect = (signerAddress, doc) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
return yield provider_1.signTransactionWrapper(() => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const signOpts = { preferNoSetFee: true };
|
|
32
|
+
return yield keplr.signDirect(chainInfo.chainId, signerAddress, doc, signOpts);
|
|
33
|
+
}));
|
|
31
34
|
});
|
|
32
35
|
const signAmino = (signerAddress, doc) => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
return yield provider_1.signTransactionWrapper(() => __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const signOpts = { preferNoSetFee: true };
|
|
38
|
+
return yield keplr.signAmino(chainInfo.chainId, signerAddress, doc, signOpts);
|
|
39
|
+
}));
|
|
35
40
|
});
|
|
36
41
|
const getAccounts = () => __awaiter(this, void 0, void 0, function* () {
|
|
37
42
|
return [
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
const constant_1 = require("../../constant");
|
|
13
13
|
const util_1 = require("../../util");
|
|
14
14
|
const wallet_1 = require("../../wallet");
|
|
15
|
+
const provider_1 = require("../../util/provider");
|
|
15
16
|
const SWTH = {
|
|
16
17
|
coinDenom: "SWTH",
|
|
17
18
|
coinMinimalDenom: "swth",
|
|
@@ -22,12 +23,16 @@ const SWTH = {
|
|
|
22
23
|
class LeapAccount {
|
|
23
24
|
static createLeapSigner(leap, chainId) {
|
|
24
25
|
const signDirect = (signerAddress, doc) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
return yield provider_1.signTransactionWrapper(() => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const signOpts = { preferNoSetFee: true };
|
|
28
|
+
return yield leap.signDirect(chainId, signerAddress, doc, signOpts);
|
|
29
|
+
}));
|
|
27
30
|
});
|
|
28
31
|
const signAmino = (signerAddress, doc) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
return yield provider_1.signTransactionWrapper(() => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const signOpts = { preferNoSetFee: true };
|
|
34
|
+
return yield leap.signAmino(chainId, signerAddress, doc, signOpts);
|
|
35
|
+
}));
|
|
31
36
|
});
|
|
32
37
|
const getAccounts = () => __awaiter(this, void 0, void 0, function* () {
|
|
33
38
|
const account = yield leap.getKey(chainId);
|
|
@@ -40,6 +40,7 @@ const ledger_cosmos_js_1 = __importDefault(require("ledger-cosmos-js"));
|
|
|
40
40
|
const bech32 = __importStar(require("bech32"));
|
|
41
41
|
const ethers_1 = require("ethers");
|
|
42
42
|
const secp256k1_1 = require("secp256k1");
|
|
43
|
+
const provider_1 = require("../../util/provider");
|
|
43
44
|
const semver = require("semver");
|
|
44
45
|
const INTERACTION_TIMEOUT = 120; // seconds to wait for user action on Ledger, currently is always limited to 60
|
|
45
46
|
const REQUIRED_COSMOS_APP_VERSION = "1.5.3";
|
|
@@ -250,7 +251,9 @@ class CosmosLedger {
|
|
|
250
251
|
sign(signMessage) {
|
|
251
252
|
return __awaiter(this, void 0, void 0, function* () {
|
|
252
253
|
yield this.connect();
|
|
253
|
-
const response = yield
|
|
254
|
+
const response = yield provider_1.signTransactionWrapper(() => __awaiter(this, void 0, void 0, function* () {
|
|
255
|
+
return yield this.cosmosApp.sign(this.hdPath, signMessage);
|
|
256
|
+
}));
|
|
254
257
|
yield this.checkLedgerErrors(response);
|
|
255
258
|
// we have to parse the signature from Ledger as it's in DER format
|
|
256
259
|
const parsedSignature = secp256k1_1.signatureImport(response.signature);
|
|
@@ -54,6 +54,7 @@ const legacy_accounts_1 = require("./legacy-accounts");
|
|
|
54
54
|
const detect_provider_1 = __importDefault(require("@metamask/detect-provider"));
|
|
55
55
|
const error_1 = require("./error");
|
|
56
56
|
const network_1 = require("../../util/network");
|
|
57
|
+
const provider_1 = require("../../util/provider");
|
|
57
58
|
const CONTRACT_HASH = {
|
|
58
59
|
Ethereum: {
|
|
59
60
|
// use same rinkeby contract for all non-mainnet uses
|
|
@@ -684,14 +685,16 @@ class MetaMask {
|
|
|
684
685
|
const metamaskAPI = yield this.getConnectedAPI();
|
|
685
686
|
const stdSignDoc = build_1.makeSignDoc(msgs, fee, evmChainId, memo, accountNumber, sequence);
|
|
686
687
|
const eip712Tx = this.legacyEip712SignMode ? legacyEIP712_1.legacyConstructEIP712Tx(Object.assign(Object.assign({}, stdSignDoc), { fee: Object.assign(Object.assign({}, fee), { feePayer }) })) : eip712_1.constructEIP712Tx(stdSignDoc);
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
688
|
+
return yield provider_1.signTransactionWrapper(() => __awaiter(this, void 0, void 0, function* () {
|
|
689
|
+
const signature = (yield metamaskAPI.request({
|
|
690
|
+
method: 'eth_signTypedData_v4',
|
|
691
|
+
params: [
|
|
692
|
+
evmHexAddress,
|
|
693
|
+
JSON.stringify(eip712Tx),
|
|
694
|
+
],
|
|
695
|
+
}));
|
|
696
|
+
return signature.split('0x')[1];
|
|
693
697
|
}));
|
|
694
|
-
return signature.split('0x')[1];
|
|
695
698
|
});
|
|
696
699
|
}
|
|
697
700
|
sendEvmTransaction(req, metamaskAPI) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function signTransactionWrapper(signTxTask: () => Promise<any>): Promise<any>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.signTransactionWrapper = void 0;
|
|
13
|
+
const tx_1 = require("./tx");
|
|
14
|
+
function signTransactionWrapper(signTxTask) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
try {
|
|
17
|
+
return yield signTxTask();
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
throw new tx_1.CarbonCustomError(err.message, tx_1.ErrorType.SIGNATURE_REJECTION);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
exports.signTransactionWrapper = signTransactionWrapper;
|
package/lib/util/tx.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import * as CosmosModels from "../codec/cosmos-models";
|
|
3
3
|
import { StdFee } from "@cosmjs/amino";
|
|
4
|
-
import {
|
|
4
|
+
import { SignerData } from "@cosmjs/stargate";
|
|
5
5
|
import { SWTHAddressOptions } from "./address";
|
|
6
6
|
export { StdSignDoc } from "@cosmjs/amino";
|
|
7
7
|
export interface TxBody extends Omit<CosmosModels.Tx.TxBody, "messages"> {
|
|
@@ -14,6 +14,7 @@ export declare const decode: (bytes?: Uint8Array | Buffer | undefined) => Tx | u
|
|
|
14
14
|
export declare const getSender: (decodedTx: Tx, opts?: SWTHAddressOptions | undefined) => string;
|
|
15
15
|
export declare enum BroadcastTxMode {
|
|
16
16
|
BroadcastTxSync = "sync",
|
|
17
|
+
BroadcastTxAsync = "async",
|
|
17
18
|
BroadcastTxBlock = "block"
|
|
18
19
|
}
|
|
19
20
|
export interface CarbonSignerData extends SignerData {
|
|
@@ -50,9 +51,15 @@ export interface TxResponse {
|
|
|
50
51
|
code?: number;
|
|
51
52
|
codespace?: string;
|
|
52
53
|
}
|
|
53
|
-
export declare
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
export declare enum ErrorType {
|
|
55
|
+
SIGNATURE_REJECTION = "signature_rejection",
|
|
56
|
+
BROADCAST_FAIL = "broadcast_fail",
|
|
57
|
+
BLOCK_FAIL = "block_fail"
|
|
58
|
+
}
|
|
59
|
+
export declare class CarbonCustomError extends Error {
|
|
60
|
+
readonly type?: ErrorType;
|
|
61
|
+
readonly data?: any;
|
|
62
|
+
constructor(msg: string, type?: ErrorType, data?: any);
|
|
56
63
|
}
|
|
57
64
|
export declare const Types: {
|
|
58
65
|
MsgSetTradingFlag: string;
|
|
@@ -202,14 +209,14 @@ export declare const Types: {
|
|
|
202
209
|
MsgSetOracleSlashEnabled: string;
|
|
203
210
|
MsgSetOracleSlashEnabledResponse: string;
|
|
204
211
|
CreateOracleProposal: string;
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
212
|
+
MsgAllianceDelegate: string;
|
|
213
|
+
MsgAllianceDelegateResponse: string;
|
|
214
|
+
MsgAllianceUndelegate: string;
|
|
215
|
+
MsgAllianceUndelegateResponse: string;
|
|
216
|
+
MsgAllianceRedelegate: string;
|
|
217
|
+
MsgAllianceRedelegateResponse: string;
|
|
218
|
+
MsgAllianceClaimDelegationRewards: string;
|
|
219
|
+
MsgAllianceClaimDelegationRewardsResponse: string;
|
|
213
220
|
MsgSoftwareUpgrade: string;
|
|
214
221
|
MsgSoftwareUpgradeResponse: string;
|
|
215
222
|
MsgCancelUpgrade: string;
|
|
@@ -277,8 +284,12 @@ export declare const Types: {
|
|
|
277
284
|
MsgCreateValidatorResponse: string;
|
|
278
285
|
MsgEditValidator: string;
|
|
279
286
|
MsgEditValidatorResponse: string;
|
|
287
|
+
MsgDelegate: string;
|
|
288
|
+
MsgDelegateResponse: string;
|
|
280
289
|
MsgBeginRedelegate: string;
|
|
281
290
|
MsgBeginRedelegateResponse: string;
|
|
291
|
+
MsgUndelegate: string;
|
|
292
|
+
MsgUndelegateResponse: string;
|
|
282
293
|
MsgCancelUnbondingDelegation: string;
|
|
283
294
|
MsgCancelUnbondingDelegationResponse: string;
|
|
284
295
|
ParameterChangeProposal: string;
|
package/lib/util/tx.js
CHANGED
|
@@ -19,7 +19,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.TxGasCostTypeMap = exports.TxMinGasPriceTypeDefaultKey = exports.TxGasCostTypeDefaultKey = exports.DEFAULT_SIGN_OPTS = exports.Types = exports.
|
|
22
|
+
exports.TxGasCostTypeMap = exports.TxMinGasPriceTypeDefaultKey = exports.TxGasCostTypeDefaultKey = exports.DEFAULT_SIGN_OPTS = exports.Types = exports.CarbonCustomError = exports.ErrorType = exports.BroadcastTxMode = exports.getSender = exports.decode = void 0;
|
|
23
23
|
const codec_1 = require("../codec");
|
|
24
24
|
const CosmosModels = __importStar(require("../codec/cosmos-models"));
|
|
25
25
|
const constant_1 = require("../constant");
|
|
@@ -102,15 +102,23 @@ exports.getSender = getSender;
|
|
|
102
102
|
var BroadcastTxMode;
|
|
103
103
|
(function (BroadcastTxMode) {
|
|
104
104
|
BroadcastTxMode["BroadcastTxSync"] = "sync";
|
|
105
|
+
BroadcastTxMode["BroadcastTxAsync"] = "async";
|
|
105
106
|
BroadcastTxMode["BroadcastTxBlock"] = "block";
|
|
106
107
|
})(BroadcastTxMode = exports.BroadcastTxMode || (exports.BroadcastTxMode = {}));
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
var ErrorType;
|
|
109
|
+
(function (ErrorType) {
|
|
110
|
+
ErrorType["SIGNATURE_REJECTION"] = "signature_rejection";
|
|
111
|
+
ErrorType["BROADCAST_FAIL"] = "broadcast_fail";
|
|
112
|
+
ErrorType["BLOCK_FAIL"] = "block_fail";
|
|
113
|
+
})(ErrorType = exports.ErrorType || (exports.ErrorType = {}));
|
|
114
|
+
class CarbonCustomError extends Error {
|
|
115
|
+
constructor(msg, type, data) {
|
|
109
116
|
super(msg);
|
|
110
|
-
this.
|
|
117
|
+
this.type = type;
|
|
118
|
+
this.data = data;
|
|
111
119
|
}
|
|
112
120
|
}
|
|
113
|
-
exports.
|
|
121
|
+
exports.CarbonCustomError = CarbonCustomError;
|
|
114
122
|
exports.Types = codec_1.TxTypes;
|
|
115
123
|
exports.DEFAULT_SIGN_OPTS = {
|
|
116
124
|
fee: constant_1.DEFAULT_FEE,
|
|
@@ -6,12 +6,13 @@ import { ChainInfo, CosmosLedger, Keplr, MetaMask } from "../provider";
|
|
|
6
6
|
import { CarbonTx } from "../util";
|
|
7
7
|
import { SWTHAddressOptions } from "../util/address";
|
|
8
8
|
import { SmartWalletBlockchain } from "../util/blockchain";
|
|
9
|
+
import { BroadcastTxMode } from "../util/tx";
|
|
9
10
|
import { SimpleMap } from "../util/type";
|
|
10
11
|
import { StdSignature } from "@cosmjs/amino";
|
|
11
12
|
import { EncodeObject, OfflineDirectSigner, OfflineSigner } from "@cosmjs/proto-signing";
|
|
12
13
|
import { Account, DeliverTxResponse } from "@cosmjs/stargate";
|
|
13
|
-
import { Tendermint34Client } from "@cosmjs/tendermint-rpc";
|
|
14
|
-
import { BroadcastTxSyncResponse } from "@cosmjs/tendermint-rpc/build/tendermint34/responses";
|
|
14
|
+
import { Tendermint34Client, TxResponse } from "@cosmjs/tendermint-rpc";
|
|
15
|
+
import { BroadcastTxAsyncResponse, BroadcastTxSyncResponse } from "@cosmjs/tendermint-rpc/build/tendermint34/responses";
|
|
15
16
|
import { Key as LeapKey } from "@cosmos-kit/core";
|
|
16
17
|
import { Leap } from "@cosmos-kit/leap";
|
|
17
18
|
import { Key } from "@keplr-wallet/types";
|
|
@@ -21,6 +22,7 @@ import { CarbonSigner, CarbonSignerTypes } from "./CarbonSigner";
|
|
|
21
22
|
import { CarbonSigningClient } from "./CarbonSigningClient";
|
|
22
23
|
export interface CarbonWalletGenericOpts {
|
|
23
24
|
tmClient?: Tendermint34Client;
|
|
25
|
+
txDefaultBroadcastMode?: BroadcastTxMode;
|
|
24
26
|
network?: Network;
|
|
25
27
|
config?: Partial<NetworkConfig>;
|
|
26
28
|
providerAgent?: ProviderAgent | string;
|
|
@@ -107,6 +109,7 @@ export declare class CarbonWallet {
|
|
|
107
109
|
txFees?: SimpleMap<BigNumber>;
|
|
108
110
|
txGasCosts?: SimpleMap<BigNumber>;
|
|
109
111
|
txGasPrices?: SimpleMap<BigNumber>;
|
|
112
|
+
txDefaultBroadCastMode?: BroadcastTxMode;
|
|
110
113
|
defaultFeeDenom: string;
|
|
111
114
|
initialized: boolean;
|
|
112
115
|
accountInfo?: AccountInfo;
|
|
@@ -150,14 +153,21 @@ export declare class CarbonWallet {
|
|
|
150
153
|
* broadcast TX to mempool but doesnt wait for block confirmation
|
|
151
154
|
*
|
|
152
155
|
*/
|
|
156
|
+
broadcastTxToMempoolWithoutConfirm(txRaw: CarbonWallet.TxRaw): Promise<CarbonWallet.SendTxToMempoolWithoutConfirmResponse>;
|
|
157
|
+
/**
|
|
158
|
+
* broadcast TX but doesnt wait for block confirmation nor submission to mempool
|
|
159
|
+
*
|
|
160
|
+
*/
|
|
153
161
|
broadcastTxWithoutConfirm(txRaw: CarbonWallet.TxRaw): Promise<CarbonWallet.SendTxWithoutConfirmResponse>;
|
|
154
|
-
signAndBroadcast(messages: EncodeObject[], signOpts?: CarbonTx.SignTxOpts, broadcastOpts?: CarbonTx.BroadcastTxOpts): Promise<DeliverTxResponse | BroadcastTxSyncResponse>;
|
|
162
|
+
signAndBroadcast(messages: EncodeObject[], signOpts?: CarbonTx.SignTxOpts, broadcastOpts?: CarbonTx.BroadcastTxOpts): Promise<DeliverTxResponse | BroadcastTxSyncResponse | BroadcastTxAsyncResponse>;
|
|
155
163
|
private signTx;
|
|
164
|
+
private getBroadcastFunc;
|
|
156
165
|
private dispatchTx;
|
|
157
166
|
sendTxs(msgs: EncodeObject[], opts?: CarbonTx.SignTxOpts): Promise<CarbonWallet.SendTxResponse>;
|
|
158
167
|
sendInitialMergeAccountTx(msgs: EncodeObject[], opts?: CarbonTx.SignTxOpts): Promise<void>;
|
|
159
|
-
sendTxsWithoutConfirm(msgs: EncodeObject[], opts?: CarbonTx.SignTxOpts): Promise<CarbonWallet.
|
|
168
|
+
sendTxsWithoutConfirm(msgs: EncodeObject[], opts?: CarbonTx.SignTxOpts): Promise<CarbonWallet.SendTxToMempoolWithoutConfirmResponse>;
|
|
160
169
|
sendTx(msg: EncodeObject, opts?: CarbonTx.SignTxOpts): Promise<CarbonWallet.SendTxResponse>;
|
|
170
|
+
waitForTx(txHash: string, throwIfNotIncludedInBlock?: boolean, timeoutMs?: number, pollIntervalMs?: number): Promise<TxResponse>;
|
|
161
171
|
getSigningClient(): CarbonSigningClient;
|
|
162
172
|
getTmClient(): Tendermint34Client;
|
|
163
173
|
getChainId(): string;
|
|
@@ -181,12 +191,14 @@ export declare class CarbonWallet {
|
|
|
181
191
|
isEvmWallet(): boolean;
|
|
182
192
|
private estimateTxFee;
|
|
183
193
|
private isAccountNotFoundError;
|
|
194
|
+
private isTxHashNotFound;
|
|
184
195
|
private isNonceMismatchError;
|
|
185
196
|
private getQueryClient;
|
|
186
197
|
}
|
|
187
198
|
export declare namespace CarbonWallet {
|
|
188
|
-
type SendTxResponse = DeliverTxResponse;
|
|
189
|
-
type
|
|
199
|
+
type SendTxResponse = DeliverTxResponse | BroadcastTxSyncResponse | BroadcastTxAsyncResponse;
|
|
200
|
+
type SendTxToMempoolWithoutConfirmResponse = BroadcastTxSyncResponse;
|
|
201
|
+
type SendTxWithoutConfirmResponse = BroadcastTxAsyncResponse;
|
|
190
202
|
type OnRequestSignCallback = (msgs: readonly EncodeObject[]) => void | Promise<void>;
|
|
191
203
|
type OnSignCompleteCallback = (signature: StdSignature | null) => void | Promise<void>;
|
|
192
204
|
type OnBroadcastTxFailCallback = (msgs: readonly EncodeObject[]) => void | Promise<void>;
|
|
@@ -27,6 +27,8 @@ const tx_1 = require("../util/tx");
|
|
|
27
27
|
const amino_1 = require("@cosmjs/amino");
|
|
28
28
|
const stargate_1 = require("@cosmjs/stargate");
|
|
29
29
|
const tendermint_rpc_1 = require("@cosmjs/tendermint-rpc");
|
|
30
|
+
const responses_1 = require("@cosmjs/tendermint-rpc/build/tendermint34/responses");
|
|
31
|
+
const utils_1 = require("@cosmjs/utils");
|
|
30
32
|
const tx_2 = require("cosmjs-types/cosmos/tx/v1beta1/tx");
|
|
31
33
|
const CarbonSigner_1 = require("./CarbonSigner");
|
|
32
34
|
const CarbonSigningClient_1 = require("./CarbonSigningClient");
|
|
@@ -40,19 +42,23 @@ class CarbonWallet {
|
|
|
40
42
|
var _a;
|
|
41
43
|
return (_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes(`account ${address} not found`);
|
|
42
44
|
};
|
|
45
|
+
this.isTxHashNotFound = (error, hash) => {
|
|
46
|
+
var _a;
|
|
47
|
+
return (_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes(`tx (${hash}) not found`);
|
|
48
|
+
};
|
|
43
49
|
this.isNonceMismatchError = (error) => {
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
50
|
+
const errorMessage = 'account sequence mismatch';
|
|
51
|
+
const includes = error === null || error === void 0 ? void 0 : error.message.includes(errorMessage);
|
|
52
|
+
if (includes) {
|
|
47
53
|
return {
|
|
48
|
-
|
|
49
|
-
provided: match[2],
|
|
54
|
+
message: error === null || error === void 0 ? void 0 : error.message,
|
|
50
55
|
};
|
|
51
56
|
}
|
|
52
57
|
return false;
|
|
53
58
|
};
|
|
54
59
|
const network = (_a = opts.network) !== null && _a !== void 0 ? _a : constant_1.DEFAULT_NETWORK;
|
|
55
60
|
this.network = network;
|
|
61
|
+
this.txDefaultBroadCastMode = opts.txDefaultBroadcastMode;
|
|
56
62
|
this.networkConfig = constant_1.NetworkConfigs[network];
|
|
57
63
|
this.configOverride = (_b = opts.config) !== null && _b !== void 0 ? _b : {};
|
|
58
64
|
this.providerAgent = opts.providerAgent;
|
|
@@ -206,7 +212,7 @@ class CarbonWallet {
|
|
|
206
212
|
const isEvmWallet = this.isEvmWallet();
|
|
207
213
|
if (hasEvmAddressBalances && !hasCarbonBalances && !isEvmWallet) {
|
|
208
214
|
this.sequenceInvalidated = true;
|
|
209
|
-
throw new Error('
|
|
215
|
+
throw new Error('Transaction is not allowed from a non-evm wallet for an account with only funds in evm address');
|
|
210
216
|
}
|
|
211
217
|
});
|
|
212
218
|
}
|
|
@@ -222,7 +228,7 @@ class CarbonWallet {
|
|
|
222
228
|
const response = yield carbonClient.broadcastTx(tx, timeoutMs, pollIntervalMs);
|
|
223
229
|
if (stargate_1.isDeliverTxFailure(response)) {
|
|
224
230
|
// tx failed
|
|
225
|
-
throw new tx_1.
|
|
231
|
+
throw new tx_1.CarbonCustomError(`[${response.code}] ${response.rawLog}`, tx_1.ErrorType.BLOCK_FAIL, response);
|
|
226
232
|
}
|
|
227
233
|
return response;
|
|
228
234
|
});
|
|
@@ -231,11 +237,27 @@ class CarbonWallet {
|
|
|
231
237
|
* broadcast TX to mempool but doesnt wait for block confirmation
|
|
232
238
|
*
|
|
233
239
|
*/
|
|
240
|
+
broadcastTxToMempoolWithoutConfirm(txRaw) {
|
|
241
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
242
|
+
const tx = CarbonWallet.TxRaw.encode(txRaw).finish();
|
|
243
|
+
const tmClient = this.getTmClient();
|
|
244
|
+
const response = yield tmClient.broadcastTxSync({ tx });
|
|
245
|
+
if (!responses_1.broadcastTxSyncSuccess(response)) {
|
|
246
|
+
// tx failed
|
|
247
|
+
throw new tx_1.CarbonCustomError(`[${response.code}] ${response.log}`, tx_1.ErrorType.BROADCAST_FAIL, response);
|
|
248
|
+
}
|
|
249
|
+
return response;
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* broadcast TX but doesnt wait for block confirmation nor submission to mempool
|
|
254
|
+
*
|
|
255
|
+
*/
|
|
234
256
|
broadcastTxWithoutConfirm(txRaw) {
|
|
235
257
|
return __awaiter(this, void 0, void 0, function* () {
|
|
236
258
|
const tx = CarbonWallet.TxRaw.encode(txRaw).finish();
|
|
237
259
|
const tmClient = this.getTmClient();
|
|
238
|
-
return tmClient.
|
|
260
|
+
return tmClient.broadcastTxAsync({ tx });
|
|
239
261
|
});
|
|
240
262
|
}
|
|
241
263
|
signAndBroadcast(messages, signOpts, broadcastOpts) {
|
|
@@ -294,17 +316,25 @@ class CarbonWallet {
|
|
|
294
316
|
}
|
|
295
317
|
});
|
|
296
318
|
}
|
|
319
|
+
getBroadcastFunc(broadcastMode) {
|
|
320
|
+
switch (broadcastMode) {
|
|
321
|
+
case tx_1.BroadcastTxMode.BroadcastTxSync: return this.broadcastTxToMempoolWithoutConfirm.bind(this);
|
|
322
|
+
case tx_1.BroadcastTxMode.BroadcastTxAsync: return this.broadcastTxWithoutConfirm.bind(this);
|
|
323
|
+
}
|
|
324
|
+
return this.broadcastTx.bind(this);
|
|
325
|
+
}
|
|
297
326
|
dispatchTx(txRequest) {
|
|
298
|
-
var _a;
|
|
327
|
+
var _a, _b;
|
|
299
328
|
return __awaiter(this, void 0, void 0, function* () {
|
|
300
329
|
const { broadcastOpts, signedTx, handler: { resolve, reject }, } = txRequest;
|
|
301
|
-
const
|
|
330
|
+
const broadcastMode = (_a = broadcastOpts === null || broadcastOpts === void 0 ? void 0 : broadcastOpts.mode) !== null && _a !== void 0 ? _a : this.txDefaultBroadCastMode;
|
|
331
|
+
const broadcastFunc = this.getBroadcastFunc(broadcastMode);
|
|
302
332
|
try {
|
|
303
333
|
const result = yield broadcastFunc(signedTx, broadcastOpts);
|
|
304
334
|
resolve(result);
|
|
305
335
|
}
|
|
306
336
|
catch (error) {
|
|
307
|
-
const reattempts = (
|
|
337
|
+
const reattempts = (_b = txRequest.reattempts) !== null && _b !== void 0 ? _b : 0;
|
|
308
338
|
// retry sendTx if nonce error once.
|
|
309
339
|
if (!this.disableRetryOnSequenceError && reattempts < 1 && this.isNonceMismatchError(error)) {
|
|
310
340
|
// invalidate account sequence for reload on next signTx call
|
|
@@ -331,7 +361,7 @@ class CarbonWallet {
|
|
|
331
361
|
yield this.sendInitialMergeAccountTx(msgs, opts);
|
|
332
362
|
}
|
|
333
363
|
try {
|
|
334
|
-
const result = yield this.signAndBroadcast(msgs, opts
|
|
364
|
+
const result = yield this.signAndBroadcast(msgs, opts);
|
|
335
365
|
if (msgs[0].typeUrl === util_1.CarbonTx.Types.MsgMergeAccount) {
|
|
336
366
|
this.updateMergeAccountStatus();
|
|
337
367
|
}
|
|
@@ -390,6 +420,44 @@ class CarbonWallet {
|
|
|
390
420
|
return this.sendTxs([msg], opts);
|
|
391
421
|
});
|
|
392
422
|
}
|
|
423
|
+
waitForTx(txHash, throwIfNotIncludedInBlock = false, timeoutMs = 60000, pollIntervalMs = 100) {
|
|
424
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
425
|
+
const txId = txHash.toUpperCase();
|
|
426
|
+
let timedOut = false;
|
|
427
|
+
const txPollTimeout = setTimeout(() => {
|
|
428
|
+
timedOut = true;
|
|
429
|
+
}, timeoutMs);
|
|
430
|
+
const pollForTx = (txId) => __awaiter(this, void 0, void 0, function* () {
|
|
431
|
+
try {
|
|
432
|
+
if (timedOut) {
|
|
433
|
+
throw new stargate_1.TimeoutError(`Transaction with ID ${txId} was submitted but was not yet found on the chain. You might want to check later. There was a wait of ${timeoutMs / 1000} seconds.`, txId);
|
|
434
|
+
}
|
|
435
|
+
const hash = Uint8Array.from(Buffer.from(txId, 'hex'));
|
|
436
|
+
const response = yield this.getTmClient().tx({ hash });
|
|
437
|
+
const { result } = response;
|
|
438
|
+
const isDeliverTxFailure = result.code !== 0;
|
|
439
|
+
if (isDeliverTxFailure && throwIfNotIncludedInBlock)
|
|
440
|
+
throw new tx_1.CarbonCustomError(`[${result.code}] ${result.log}`, tx_1.ErrorType.BLOCK_FAIL, response);
|
|
441
|
+
return response;
|
|
442
|
+
}
|
|
443
|
+
catch (err) {
|
|
444
|
+
const error = err;
|
|
445
|
+
if (this.isTxHashNotFound(error, txId)) {
|
|
446
|
+
yield utils_1.sleep(pollIntervalMs);
|
|
447
|
+
return pollForTx(txId);
|
|
448
|
+
}
|
|
449
|
+
throw err;
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
return new Promise((resolve, reject) => pollForTx(txId).then((value) => {
|
|
453
|
+
clearTimeout(txPollTimeout);
|
|
454
|
+
resolve(value);
|
|
455
|
+
}, (error) => {
|
|
456
|
+
clearTimeout(txPollTimeout);
|
|
457
|
+
reject(error);
|
|
458
|
+
}));
|
|
459
|
+
});
|
|
460
|
+
}
|
|
393
461
|
getSigningClient() {
|
|
394
462
|
const tmClient = this.getTmClient();
|
|
395
463
|
if (!this.signingClient) {
|