carbon-js-sdk 0.4.19 → 0.4.21-beta.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/CarbonSDK.d.ts +12 -1
- package/lib/CarbonSDK.js +30 -2
- package/lib/clients/CarbonQueryClient.d.ts +13 -0
- package/lib/clients/CarbonQueryClient.js +56 -44
- package/lib/clients/TokenClient.js +1 -2
- package/lib/codec/broker/amm.d.ts +35 -7
- package/lib/codec/broker/amm.js +185 -6
- package/lib/codec/broker/genesis.d.ts +2 -2
- package/lib/codec/broker/genesis.js +9 -9
- package/lib/codec/cosmos/group/v1/query.d.ts +41 -0
- package/lib/codec/cosmos/group/v1/query.js +124 -1
- package/lib/codec/cosmos/vesting/v1beta1/tx.d.ts +2 -0
- package/lib/codec/cosmos/vesting/v1beta1/vesting.d.ts +3 -0
- package/lib/codec/ethermint/crypto/v1/ethsecp256k1/export.d.ts +1 -0
- package/lib/codec/ethermint/crypto/v1/ethsecp256k1/export.js +6 -0
- package/lib/codec/ethermint/evm/v1/export.d.ts +5 -0
- package/lib/codec/ethermint/evm/v1/export.js +53 -0
- package/lib/codec/ethermint/feemarket/v1/export.d.ts +4 -0
- package/lib/codec/ethermint/feemarket/v1/export.js +18 -0
- package/lib/codec/ethermint/types/v1/export.d.ts +4 -0
- package/lib/codec/ethermint/types/v1/export.js +11 -0
- package/lib/codec/ethermint-models.d.ts +4 -0
- package/lib/codec/ethermint-models.js +26 -0
- package/lib/codec/index.d.ts +41 -3
- package/lib/codec/index.js +23535 -479
- package/lib/codec/market/fee.d.ts +123 -0
- package/lib/codec/market/fee.js +334 -0
- package/lib/codec/market/genesis.d.ts +3 -0
- package/lib/codec/market/genesis.js +33 -2
- package/lib/codec/market/market.d.ts +8 -0
- package/lib/codec/market/query.d.ts +93 -0
- package/lib/codec/market/query.js +420 -1
- package/lib/codec/market/tx.d.ts +100 -3
- package/lib/codec/market/tx.js +553 -7
- package/lib/codec/perpsliquidity/event.d.ts +102 -0
- package/lib/codec/perpsliquidity/event.js +581 -0
- package/lib/codec/perpsliquidity/genesis.d.ts +35 -0
- package/lib/codec/perpsliquidity/genesis.js +162 -0
- package/lib/codec/perpsliquidity/params.d.ts +24 -0
- package/lib/codec/perpsliquidity/params.js +103 -0
- package/lib/codec/perpsliquidity/pool.d.ts +137 -0
- package/lib/codec/perpsliquidity/pool.js +747 -0
- package/lib/codec/perpsliquidity/query.d.ts +194 -0
- package/lib/codec/perpsliquidity/query.js +876 -0
- package/lib/codec/perpsliquidity/tx.d.ts +199 -0
- package/lib/codec/perpsliquidity/tx.js +940 -0
- package/lib/codec/tendermint/abci/types.d.ts +1 -1
- package/lib/codec/tendermint/crypto/keys.d.ts +1 -1
- package/lib/codec/tendermint/types/types.d.ts +1 -1
- package/lib/constant/eip712.d.ts +46 -0
- package/lib/constant/eip712.js +106 -0
- package/lib/constant/network.d.ts +9 -1
- package/lib/constant/network.js +21 -7
- package/lib/constant/walletProvider.d.ts +3 -1
- package/lib/constant/walletProvider.js +3 -0
- package/lib/modules/cdp.d.ts +1 -1
- package/lib/modules/cdp.js +56 -43
- package/lib/modules/evm.d.ts +46 -0
- package/lib/modules/evm.js +127 -0
- package/lib/modules/evmmerge.d.ts +12 -0
- package/lib/modules/evmmerge.js +35 -0
- package/lib/modules/feemarket.d.ts +20 -0
- package/lib/modules/feemarket.js +45 -0
- package/lib/modules/index.d.ts +4 -0
- package/lib/modules/index.js +4 -0
- package/lib/modules/vault.d.ts +56 -0
- package/lib/modules/vault.js +128 -0
- package/lib/provider/amino/AminoTypesMap.js +1 -1
- package/lib/provider/amino/types/evm.d.ts +4 -0
- package/lib/provider/amino/types/evm.js +40 -0
- package/lib/provider/amino/types/evmmerge.d.ts +4 -0
- package/lib/provider/amino/types/evmmerge.js +34 -0
- package/lib/provider/amino/types/feemarket.d.ts +4 -0
- package/lib/provider/amino/types/feemarket.js +34 -0
- package/lib/provider/amino/types/gov.js +20 -0
- package/lib/provider/amino/types/index.d.ts +3 -0
- package/lib/provider/amino/types/index.js +7 -1
- package/lib/provider/amino/types/liquidityPool.js +18 -0
- package/lib/provider/amino/types/oracle.js +6 -0
- package/lib/provider/keplr/KeplrAccount.d.ts +2 -0
- package/lib/provider/keplr/KeplrAccount.js +38 -0
- package/lib/provider/leap/LeapAccount.js +4 -0
- package/lib/provider/metamask/MetaMask.d.ts +25 -1
- package/lib/provider/metamask/MetaMask.js +309 -7
- package/lib/provider/metamask/legacy-accounts.d.ts +6 -0
- package/lib/provider/metamask/legacy-accounts.js +44 -0
- package/lib/provider/o3/O3Wallet.js +3 -0
- package/lib/util/address.d.ts +5 -1
- package/lib/util/address.js +11 -0
- package/lib/util/blockchain.d.ts +4 -5
- package/lib/util/blockchain.js +9 -3
- package/lib/util/eip712.d.ts +10 -0
- package/lib/util/eip712.js +195 -0
- package/lib/util/ethermint.d.ts +8 -0
- package/lib/util/ethermint.js +68 -0
- package/lib/util/legacyEIP712.d.ts +20 -0
- package/lib/util/legacyEIP712.js +98 -0
- package/lib/util/tx.d.ts +30 -0
- package/lib/wallet/CarbonSigner.d.ts +21 -4
- package/lib/wallet/CarbonSigner.js +20 -1
- package/lib/wallet/CarbonSigningClient.d.ts +1 -0
- package/lib/wallet/CarbonSigningClient.js +52 -4
- package/lib/wallet/CarbonWallet.d.ts +14 -2
- package/lib/wallet/CarbonWallet.js +141 -16
- package/package.json +2 -1
- package/lib/clients/EvmIbcClient.d.ts +0 -86
- package/lib/clients/EvmIbcClient.js +0 -90
- package/lib/codec/broker/incoming_pool_swap.d.ts +0 -23
- package/lib/codec/broker/incoming_pool_swap.js +0 -136
- package/lib/util/ethermint/evm-ibc.d.ts +0 -97
- package/lib/util/ethermint/evm-ibc.js +0 -134
- package/lib/util/ethermint/index.d.ts +0 -3
- package/lib/util/ethermint/index.js +0 -12
- package/lib/util/ethermint/keys.d.ts +0 -39
- package/lib/util/ethermint/keys.js +0 -138
- package/lib/util/ethermint/web3.d.ts +0 -36
- package/lib/util/ethermint/web3.js +0 -124
package/lib/CarbonSDK.d.ts
CHANGED
|
@@ -4,10 +4,12 @@ import { Tendermint34Client } from "@cosmjs/tendermint-rpc";
|
|
|
4
4
|
import { CarbonQueryClient, ETHClient, HydrogenClient, InsightsQueryClient, NEOClient, TokenClient, ZILClient } from "./clients";
|
|
5
5
|
import * as clients from "./clients";
|
|
6
6
|
import N3Client from "./clients/N3Client";
|
|
7
|
-
import { AdminModule, BankModule, BrokerModule, CDPModule, CoinModule, FeeModule, GovModule, IBCModule, LeverageModule, LiquidityPoolModule, MarketModule, OracleModule, OrderModule, PositionModule, ProfileModule, SubAccountModule, XChainModule } from "./modules";
|
|
7
|
+
import { AdminModule, BankModule, BrokerModule, CDPModule, CoinModule, FeeModule, GovModule, IBCModule, LeverageModule, LiquidityPoolModule, MarketModule, OracleModule, OrderModule, PositionModule, ProfileModule, SubAccountModule, XChainModule, EvmModule, FeemarketModule, EvmMergeModule, VaultModule } from "./modules";
|
|
8
8
|
import { StakingModule } from "./modules/staking";
|
|
9
9
|
import { CosmosLedger, Keplr, LeapExtended } from "./provider";
|
|
10
10
|
import { CarbonSigner, CarbonWallet, CarbonWalletGenericOpts } from "./wallet";
|
|
11
|
+
import { MetaMask } from "./provider/metamask/MetaMask";
|
|
12
|
+
import { ethers } from "ethers";
|
|
11
13
|
export { CarbonTx } from "./util";
|
|
12
14
|
export { CarbonSigner, CarbonSignerTypes, CarbonWallet, CarbonWalletGenericOpts, CarbonWalletInitOpts } from "./wallet";
|
|
13
15
|
export { DenomPrefix } from "./constant";
|
|
@@ -15,6 +17,7 @@ export interface CarbonSDKOpts {
|
|
|
15
17
|
network: Network;
|
|
16
18
|
tmClient: Tendermint34Client;
|
|
17
19
|
chainId?: string;
|
|
20
|
+
evmChainId?: string;
|
|
18
21
|
token?: TokenClient;
|
|
19
22
|
config?: Partial<NetworkConfig>;
|
|
20
23
|
defaultTimeoutBlocks?: number;
|
|
@@ -41,6 +44,7 @@ declare class CarbonSDK {
|
|
|
41
44
|
readonly query: CarbonQueryClient;
|
|
42
45
|
insights: InsightsQueryClient;
|
|
43
46
|
hydrogen: HydrogenClient;
|
|
47
|
+
evmJsonRpc: ethers.providers.JsonRpcProvider;
|
|
44
48
|
wallet?: CarbonWallet;
|
|
45
49
|
network: Network;
|
|
46
50
|
configOverride: Partial<NetworkConfig>;
|
|
@@ -50,6 +54,7 @@ declare class CarbonSDK {
|
|
|
50
54
|
admin: AdminModule;
|
|
51
55
|
order: OrderModule;
|
|
52
56
|
lp: LiquidityPoolModule;
|
|
57
|
+
vault: VaultModule;
|
|
53
58
|
subaccount: SubAccountModule;
|
|
54
59
|
profile: ProfileModule;
|
|
55
60
|
cdp: CDPModule;
|
|
@@ -65,6 +70,9 @@ declare class CarbonSDK {
|
|
|
65
70
|
fee: FeeModule;
|
|
66
71
|
ibc: IBCModule;
|
|
67
72
|
xchain: XChainModule;
|
|
73
|
+
evm: EvmModule;
|
|
74
|
+
evmmerge: EvmMergeModule;
|
|
75
|
+
feemarket: FeemarketModule;
|
|
68
76
|
neo: NEOClient;
|
|
69
77
|
eth: ETHClient;
|
|
70
78
|
bsc: ETHClient;
|
|
@@ -74,6 +82,7 @@ declare class CarbonSDK {
|
|
|
74
82
|
zil: ZILClient;
|
|
75
83
|
n3: N3Client;
|
|
76
84
|
chainId: string;
|
|
85
|
+
evmChainId: string;
|
|
77
86
|
constructor(opts: CarbonSDKOpts);
|
|
78
87
|
static instance(opts?: CarbonSDKInitOpts): Promise<CarbonSDK>;
|
|
79
88
|
static instanceWithWallet(wallet: CarbonWallet, sdkOpts?: CarbonSDKInitOpts): Promise<ConnectedCarbonSDK>;
|
|
@@ -83,6 +92,7 @@ declare class CarbonSDK {
|
|
|
83
92
|
static instanceWithLedger(ledger: CosmosLedger, sdkOpts?: CarbonSDKInitOpts, walletOpts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
|
|
84
93
|
static instanceWithKeplr(keplr: Keplr, sdkOpts?: CarbonSDKInitOpts, walletOpts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
|
|
85
94
|
static instanceWithLeap(leap: LeapExtended, sdkOpts?: CarbonSDKInitOpts, walletOpts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
|
|
95
|
+
static instanceWithMetamask(metamask: MetaMask, sdkOpts?: CarbonSDKInitOpts, walletOpts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
|
|
86
96
|
static instanceViewOnly(bech32Address: string, sdkOpts?: CarbonSDKInitOpts, walletOpts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
|
|
87
97
|
initialize(): Promise<CarbonSDK>;
|
|
88
98
|
clone(): CarbonSDK;
|
|
@@ -95,6 +105,7 @@ declare class CarbonSDK {
|
|
|
95
105
|
connectWithLedger(ledger: CosmosLedger, opts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
|
|
96
106
|
connectWithKeplr(keplr: Keplr, opts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
|
|
97
107
|
connectWithLeap(leap: LeapExtended, opts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
|
|
108
|
+
connectWithMetamask(metamask: MetaMask, opts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
|
|
98
109
|
connectViewOnly(bech32Address: string, opts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
|
|
99
110
|
getConfig(): NetworkConfig;
|
|
100
111
|
getTokenClient(): TokenClient;
|
package/lib/CarbonSDK.js
CHANGED
|
@@ -43,6 +43,7 @@ const staking_1 = require("./modules/staking");
|
|
|
43
43
|
const provider_1 = require("./provider");
|
|
44
44
|
const blockchain_1 = require("./util/blockchain");
|
|
45
45
|
const wallet_1 = require("./wallet");
|
|
46
|
+
const ethers_1 = require("ethers");
|
|
46
47
|
var util_2 = require("./util");
|
|
47
48
|
Object.defineProperty(exports, "CarbonTx", { enumerable: true, get: function () { return util_2.CarbonTx; } });
|
|
48
49
|
var wallet_2 = require("./wallet");
|
|
@@ -60,19 +61,23 @@ const DEFAULT_SDK_INIT_OPTS = {
|
|
|
60
61
|
*/
|
|
61
62
|
class CarbonSDK {
|
|
62
63
|
constructor(opts) {
|
|
63
|
-
var _a, _b, _c, _d, _e;
|
|
64
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
64
65
|
this.network = (_a = opts.network) !== null && _a !== void 0 ? _a : constant_1.DEFAULT_NETWORK;
|
|
65
66
|
this.configOverride = (_b = opts.config) !== null && _b !== void 0 ? _b : {};
|
|
66
67
|
this.networkConfig = util_1.GenericUtils.overrideConfig(constant_1.NetworkConfigs[this.network], this.configOverride);
|
|
67
68
|
this.tmClient = opts.tmClient;
|
|
68
69
|
this.chainId = (_d = (_c = opts.chainId) !== null && _c !== void 0 ? _c : constant_1.CarbonChainIDs[this.network]) !== null && _d !== void 0 ? _d : constant_1.CarbonChainIDs[constant_1.Network.MainNet];
|
|
70
|
+
this.evmChainId = (_f = (_e = opts.evmChainId) !== null && _e !== void 0 ? _e : constant_1.CarbonEvmChainIDs[this.network]) !== null && _f !== void 0 ? _f : constant_1.CarbonEvmChainIDs[constant_1.Network.MainNet];
|
|
69
71
|
this.query = new clients_1.CarbonQueryClient(opts.tmClient);
|
|
70
72
|
this.insights = new clients_1.InsightsQueryClient(this.networkConfig);
|
|
71
|
-
this.token = (
|
|
73
|
+
this.token = (_g = opts.token) !== null && _g !== void 0 ? _g : clients_1.TokenClient.instance(this.query, this);
|
|
74
|
+
this.hydrogen = new clients_1.HydrogenClient(this.networkConfig, this.token);
|
|
75
|
+
this.evmJsonRpc = new ethers_1.ethers.providers.JsonRpcProvider(constant_1.NetworkConfigs[this.network].evmJsonRpcUrl);
|
|
72
76
|
this.hydrogen = clients_1.HydrogenClient.instance(this.networkConfig, this.token);
|
|
73
77
|
this.admin = new modules_1.AdminModule(this);
|
|
74
78
|
this.order = new modules_1.OrderModule(this);
|
|
75
79
|
this.lp = new modules_1.LiquidityPoolModule(this);
|
|
80
|
+
this.vault = new modules_1.VaultModule(this);
|
|
76
81
|
this.subaccount = new modules_1.SubAccountModule(this);
|
|
77
82
|
this.profile = new modules_1.ProfileModule(this);
|
|
78
83
|
this.cdp = new modules_1.CDPModule(this);
|
|
@@ -88,6 +93,9 @@ class CarbonSDK {
|
|
|
88
93
|
this.fee = new modules_1.FeeModule(this);
|
|
89
94
|
this.ibc = new modules_1.IBCModule(this);
|
|
90
95
|
this.xchain = new modules_1.XChainModule(this);
|
|
96
|
+
this.evm = new modules_1.EvmModule(this);
|
|
97
|
+
this.evmmerge = new modules_1.EvmMergeModule(this);
|
|
98
|
+
this.feemarket = new modules_1.FeemarketModule(this);
|
|
91
99
|
this.neo = clients_1.NEOClient.instance({
|
|
92
100
|
configProvider: this,
|
|
93
101
|
blockchain: blockchain_1.Blockchain.Neo,
|
|
@@ -187,6 +195,12 @@ class CarbonSDK {
|
|
|
187
195
|
return sdk.connectWithLeap(leap, walletOpts);
|
|
188
196
|
});
|
|
189
197
|
}
|
|
198
|
+
static instanceWithMetamask(metamask, sdkOpts = DEFAULT_SDK_INIT_OPTS, walletOpts) {
|
|
199
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
200
|
+
const sdk = yield CarbonSDK.instance(sdkOpts);
|
|
201
|
+
return sdk.connectWithMetamask(metamask, walletOpts);
|
|
202
|
+
});
|
|
203
|
+
}
|
|
190
204
|
static instanceViewOnly(bech32Address, sdkOpts = DEFAULT_SDK_INIT_OPTS, walletOpts) {
|
|
191
205
|
return __awaiter(this, void 0, void 0, function* () {
|
|
192
206
|
const sdk = yield CarbonSDK.instance(sdkOpts);
|
|
@@ -290,6 +304,20 @@ class CarbonSDK {
|
|
|
290
304
|
return this.connect(wallet);
|
|
291
305
|
});
|
|
292
306
|
}
|
|
307
|
+
connectWithMetamask(metamask, opts) {
|
|
308
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
309
|
+
const evmChainId = this.evmChainId;
|
|
310
|
+
const addressOptions = {
|
|
311
|
+
network: this.networkConfig.network,
|
|
312
|
+
bech32Prefix: this.networkConfig.Bech32Prefix
|
|
313
|
+
};
|
|
314
|
+
const address = yield metamask.defaultAccount();
|
|
315
|
+
const publicKeyHex = yield metamask.getPublicKey(address);
|
|
316
|
+
const publicKeyBase64 = Buffer.from(publicKeyHex, 'hex').toString('base64');
|
|
317
|
+
const wallet = wallet_1.CarbonWallet.withMetamask(metamask, evmChainId, publicKeyBase64, addressOptions, Object.assign(Object.assign({}, opts), { network: this.network, config: this.configOverride }));
|
|
318
|
+
return this.connect(wallet);
|
|
319
|
+
});
|
|
320
|
+
}
|
|
293
321
|
connectViewOnly(bech32Address, opts) {
|
|
294
322
|
return __awaiter(this, void 0, void 0, function* () {
|
|
295
323
|
const wallet = wallet_1.CarbonWallet.withAddress(bech32Address, Object.assign(Object.assign({}, opts), { network: this.network, config: this.configOverride }));
|
|
@@ -14,6 +14,10 @@ import { QueryClientImpl as ParamsQueryClient } from "../codec/cosmos/params/v1b
|
|
|
14
14
|
import { QueryClientImpl as SlashingQueryClient } from "../codec/cosmos/slashing/v1beta1/query";
|
|
15
15
|
import { QueryClientImpl as StakingQueryClient } from "../codec/cosmos/staking/v1beta1/query";
|
|
16
16
|
import { QueryClientImpl as UpgradeQueryClient } from "../codec/cosmos/upgrade/v1beta1/query";
|
|
17
|
+
import { QueryClientImpl as EthermintEVMQueryClient } from "../codec/ethermint/evm/v1/query";
|
|
18
|
+
import { QueryClientImpl as EvmMergeQueryClient } from "../codec/evmmerge/query";
|
|
19
|
+
import { QueryClientImpl as EvmBankQueryClient } from "../codec/evmbank/query";
|
|
20
|
+
import { QueryClientImpl as EthermintFeeMarketQueryClient } from "../codec/ethermint/feemarket/v1/query";
|
|
17
21
|
import { QueryClientImpl as FeeQueryClient } from "../codec/fee/query";
|
|
18
22
|
import { QueryClientImpl as HeadersyncQueryClient } from "../codec/headersync/query";
|
|
19
23
|
import { QueryClientImpl as IBCInterchainControlQueryClient } from "../codec/ibc/applications/interchain_accounts/controller/v1/query";
|
|
@@ -27,6 +31,7 @@ import { QueryClientImpl as InsuranceQueryClient } from "../codec/insurance/quer
|
|
|
27
31
|
import { QueryClientImpl as LeverageQueryClient } from "../codec/leverage/query";
|
|
28
32
|
import { QueryClientImpl as LiquidationQueryClient } from "../codec/liquidation/query";
|
|
29
33
|
import { QueryClientImpl as LiquidityPoolQueryClient } from "../codec/liquiditypool/query";
|
|
34
|
+
import { QueryClientImpl as PerpLiquidityPoolQueryClient } from "../codec/perpsliquidity/query";
|
|
30
35
|
import { QueryClientImpl as MarketQueryClient } from "../codec/market/query";
|
|
31
36
|
import { QueryClientImpl as MarketStatsQueryClient } from "../codec/marketstats/query";
|
|
32
37
|
import { QueryClientImpl as MiscQueryClient } from "../codec/misc/query";
|
|
@@ -46,6 +51,10 @@ export interface IBCClientGroup {
|
|
|
46
51
|
connection: IBCConnectionQueryClient;
|
|
47
52
|
channel: IBCChannelQueryClient;
|
|
48
53
|
}
|
|
54
|
+
export interface EthermintClientGroup {
|
|
55
|
+
evm: EthermintEVMQueryClient;
|
|
56
|
+
feeMarket: EthermintFeeMarketQueryClient;
|
|
57
|
+
}
|
|
49
58
|
declare class CarbonQueryClient {
|
|
50
59
|
private readonly tmClient;
|
|
51
60
|
adl: ADLQueryClient;
|
|
@@ -59,6 +68,7 @@ declare class CarbonQueryClient {
|
|
|
59
68
|
leverage: LeverageQueryClient;
|
|
60
69
|
liquidation: LiquidationQueryClient;
|
|
61
70
|
liquiditypool: LiquidityPoolQueryClient;
|
|
71
|
+
perpetualpool: PerpLiquidityPoolQueryClient;
|
|
62
72
|
market: MarketQueryClient;
|
|
63
73
|
marketstats: MarketStatsQueryClient;
|
|
64
74
|
misc: MiscQueryClient;
|
|
@@ -82,6 +92,9 @@ declare class CarbonQueryClient {
|
|
|
82
92
|
cosmosTm: CosmosTmClient;
|
|
83
93
|
chain: BlockchainClient;
|
|
84
94
|
ibc: IBCClientGroup;
|
|
95
|
+
ethermint: EthermintClientGroup;
|
|
96
|
+
evmmerge: EvmMergeQueryClient;
|
|
97
|
+
evmbank: EvmBankQueryClient;
|
|
85
98
|
private baseClient;
|
|
86
99
|
constructor(tmClient: Tendermint34Client);
|
|
87
100
|
getProtobufRpcClient(): import("@cosmjs/stargate").ProtobufRpcClient;
|
|
@@ -19,28 +19,33 @@ const query_13 = require("../codec/cosmos/params/v1beta1/query");
|
|
|
19
19
|
const query_14 = require("../codec/cosmos/slashing/v1beta1/query");
|
|
20
20
|
const query_15 = require("../codec/cosmos/staking/v1beta1/query");
|
|
21
21
|
const query_16 = require("../codec/cosmos/upgrade/v1beta1/query");
|
|
22
|
-
const query_17 = require("../codec/
|
|
23
|
-
const query_18 = require("../codec/
|
|
24
|
-
const query_19 = require("../codec/
|
|
25
|
-
const query_20 = require("../codec/
|
|
26
|
-
const query_21 = require("../codec/
|
|
27
|
-
const query_22 = require("../codec/
|
|
28
|
-
const query_23 = require("../codec/ibc/
|
|
29
|
-
const query_24 = require("../codec/ibc/
|
|
30
|
-
const query_25 = require("../codec/
|
|
31
|
-
const query_26 = require("../codec/
|
|
32
|
-
const query_27 = require("../codec/
|
|
33
|
-
const query_28 = require("../codec/
|
|
34
|
-
const query_29 = require("../codec/
|
|
35
|
-
const query_30 = require("../codec/
|
|
36
|
-
const query_31 = require("../codec/
|
|
37
|
-
const query_32 = require("../codec/
|
|
38
|
-
const query_33 = require("../codec/
|
|
39
|
-
const query_34 = require("../codec/
|
|
40
|
-
const query_35 = require("../codec/
|
|
41
|
-
const query_36 = require("../codec/
|
|
42
|
-
const query_37 = require("../codec/
|
|
43
|
-
const query_38 = require("../codec/
|
|
22
|
+
const query_17 = require("../codec/ethermint/evm/v1/query");
|
|
23
|
+
const query_18 = require("../codec/evmmerge/query");
|
|
24
|
+
const query_19 = require("../codec/evmbank/query");
|
|
25
|
+
const query_20 = require("../codec/ethermint/feemarket/v1/query");
|
|
26
|
+
const query_21 = require("../codec/fee/query");
|
|
27
|
+
const query_22 = require("../codec/headersync/query");
|
|
28
|
+
const query_23 = require("../codec/ibc/applications/interchain_accounts/controller/v1/query");
|
|
29
|
+
const query_24 = require("../codec/ibc/applications/interchain_accounts/host/v1/query");
|
|
30
|
+
const query_25 = require("../codec/ibc/applications/transfer/v1/query");
|
|
31
|
+
const query_26 = require("../codec/ibc/core/client/v1/query");
|
|
32
|
+
const query_27 = require("../codec/ibc/core/connection/v1/query");
|
|
33
|
+
const query_28 = require("../codec/ibc/core/channel/v1/query");
|
|
34
|
+
const query_29 = require("../codec/inflation/query");
|
|
35
|
+
const query_30 = require("../codec/insurance/query");
|
|
36
|
+
const query_31 = require("../codec/leverage/query");
|
|
37
|
+
const query_32 = require("../codec/liquidation/query");
|
|
38
|
+
const query_33 = require("../codec/liquiditypool/query");
|
|
39
|
+
const query_34 = require("../codec/perpsliquidity/query");
|
|
40
|
+
const query_35 = require("../codec/market/query");
|
|
41
|
+
const query_36 = require("../codec/marketstats/query");
|
|
42
|
+
const query_37 = require("../codec/misc/query");
|
|
43
|
+
const query_38 = require("../codec/oracle/query");
|
|
44
|
+
const query_39 = require("../codec/order/query");
|
|
45
|
+
const query_40 = require("../codec/position/query");
|
|
46
|
+
const query_41 = require("../codec/pricing/query");
|
|
47
|
+
const query_42 = require("../codec/profile/query");
|
|
48
|
+
const query_43 = require("../codec/subaccount/query");
|
|
44
49
|
const stargate_1 = require("@cosmjs/stargate");
|
|
45
50
|
const BlockchainClient_1 = __importDefault(require("./BlockchainClient"));
|
|
46
51
|
class CarbonQueryClient {
|
|
@@ -54,22 +59,25 @@ class CarbonQueryClient {
|
|
|
54
59
|
this.broker = new query_3.QueryClientImpl(rpcClient);
|
|
55
60
|
this.coin = new query_5.QueryClientImpl(rpcClient);
|
|
56
61
|
this.cdp = new query_4.QueryClientImpl(rpcClient);
|
|
57
|
-
this.fee = new
|
|
58
|
-
this.inflation = new
|
|
59
|
-
this.insurance = new
|
|
60
|
-
this.leverage = new
|
|
61
|
-
this.liquidation = new
|
|
62
|
-
this.liquiditypool = new
|
|
63
|
-
this.
|
|
64
|
-
this.
|
|
65
|
-
this.
|
|
66
|
-
this.
|
|
67
|
-
this.
|
|
68
|
-
this.
|
|
69
|
-
this.
|
|
70
|
-
this.
|
|
71
|
-
this.
|
|
72
|
-
this.
|
|
62
|
+
this.fee = new query_21.QueryClientImpl(rpcClient);
|
|
63
|
+
this.inflation = new query_29.QueryClientImpl(rpcClient);
|
|
64
|
+
this.insurance = new query_30.QueryClientImpl(rpcClient);
|
|
65
|
+
this.leverage = new query_31.QueryClientImpl(rpcClient);
|
|
66
|
+
this.liquidation = new query_32.QueryClientImpl(rpcClient);
|
|
67
|
+
this.liquiditypool = new query_33.QueryClientImpl(rpcClient);
|
|
68
|
+
this.perpetualpool = new query_34.QueryClientImpl(rpcClient);
|
|
69
|
+
this.market = new query_35.QueryClientImpl(rpcClient);
|
|
70
|
+
this.marketstats = new query_36.QueryClientImpl(rpcClient);
|
|
71
|
+
this.misc = new query_37.QueryClientImpl(rpcClient);
|
|
72
|
+
this.oracle = new query_38.QueryClientImpl(rpcClient);
|
|
73
|
+
this.order = new query_39.QueryClientImpl(rpcClient);
|
|
74
|
+
this.position = new query_40.QueryClientImpl(rpcClient);
|
|
75
|
+
this.pricing = new query_41.QueryClientImpl(rpcClient);
|
|
76
|
+
this.profile = new query_42.QueryClientImpl(rpcClient);
|
|
77
|
+
this.subaccount = new query_43.QueryClientImpl(rpcClient);
|
|
78
|
+
this.headersync = new query_22.QueryClientImpl(rpcClient);
|
|
79
|
+
this.evmmerge = new query_18.QueryClientImpl(rpcClient);
|
|
80
|
+
this.evmbank = new query_19.QueryClientImpl(rpcClient);
|
|
73
81
|
this.auth = new query_6.QueryClientImpl(rpcClient);
|
|
74
82
|
this.bank = new query_7.QueryClientImpl(rpcClient);
|
|
75
83
|
this.distribution = new query_9.QueryClientImpl(rpcClient);
|
|
@@ -82,12 +90,16 @@ class CarbonQueryClient {
|
|
|
82
90
|
this.upgrade = new query_16.QueryClientImpl(rpcClient);
|
|
83
91
|
this.cosmosTm = new query_8.ServiceClientImpl(rpcClient);
|
|
84
92
|
this.ibc = {
|
|
85
|
-
controller: new
|
|
86
|
-
host: new
|
|
87
|
-
transfer: new
|
|
88
|
-
client: new
|
|
89
|
-
connection: new
|
|
90
|
-
channel: new
|
|
93
|
+
controller: new query_23.QueryClientImpl(rpcClient),
|
|
94
|
+
host: new query_24.QueryClientImpl(rpcClient),
|
|
95
|
+
transfer: new query_25.QueryClientImpl(rpcClient),
|
|
96
|
+
client: new query_26.QueryClientImpl(rpcClient),
|
|
97
|
+
connection: new query_27.QueryClientImpl(rpcClient),
|
|
98
|
+
channel: new query_28.QueryClientImpl(rpcClient),
|
|
99
|
+
};
|
|
100
|
+
this.ethermint = {
|
|
101
|
+
evm: new query_17.QueryClientImpl(rpcClient),
|
|
102
|
+
feeMarket: new query_20.QueryClientImpl(rpcClient),
|
|
91
103
|
};
|
|
92
104
|
}
|
|
93
105
|
getProtobufRpcClient() {
|
|
@@ -69,12 +69,11 @@ class TokenClient {
|
|
|
69
69
|
this.setCommonAssetConfig();
|
|
70
70
|
yield this.reloadWrapperMap();
|
|
71
71
|
yield this.reloadTokens();
|
|
72
|
-
yield this.reloadDenomGeckoMap();
|
|
73
72
|
yield this.reloadDenomTraces();
|
|
74
73
|
yield this.getBridges();
|
|
75
74
|
// non-blocking reload
|
|
76
75
|
try {
|
|
77
|
-
this.reloadUSDValues();
|
|
76
|
+
this.reloadDenomGeckoMap().finally(() => this.reloadUSDValues());
|
|
78
77
|
}
|
|
79
78
|
catch (error) {
|
|
80
79
|
console.error("failed to reload usd values");
|
|
@@ -1,19 +1,47 @@
|
|
|
1
1
|
import Long from "long";
|
|
2
2
|
import _m0 from "protobufjs/minimal";
|
|
3
3
|
export declare const protobufPackage = "Switcheo.carbon.broker";
|
|
4
|
-
|
|
4
|
+
/** SpotAmm exists when there is a quote on the orderbook */
|
|
5
|
+
export interface SpotAmm {
|
|
5
6
|
poolId: Long;
|
|
6
7
|
market: string;
|
|
7
8
|
reservesHash: Uint8Array;
|
|
8
9
|
orders: string[];
|
|
9
10
|
poolRoute: Uint8Array;
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
/** PerpsPoolAmm exists when there is at least 1 PerpsMarketAmm */
|
|
13
|
+
export interface PerpsPoolAmm {
|
|
14
|
+
poolId: Long;
|
|
15
|
+
quotingHash: Uint8Array;
|
|
16
|
+
lastQuotedAt: Long;
|
|
17
|
+
}
|
|
18
|
+
/** PerpsMarketAmm exists when it is active or when there's orders or open position */
|
|
19
|
+
export interface PerpsMarketAmm {
|
|
20
|
+
poolId: Long;
|
|
21
|
+
market: string;
|
|
22
|
+
orders: string[];
|
|
23
|
+
lastIndexPrice: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const SpotAmm: {
|
|
26
|
+
encode(message: SpotAmm, writer?: _m0.Writer): _m0.Writer;
|
|
27
|
+
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): SpotAmm;
|
|
28
|
+
fromJSON(object: any): SpotAmm;
|
|
29
|
+
toJSON(message: SpotAmm): unknown;
|
|
30
|
+
fromPartial(object: DeepPartial<SpotAmm>): SpotAmm;
|
|
31
|
+
};
|
|
32
|
+
export declare const PerpsPoolAmm: {
|
|
33
|
+
encode(message: PerpsPoolAmm, writer?: _m0.Writer): _m0.Writer;
|
|
34
|
+
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): PerpsPoolAmm;
|
|
35
|
+
fromJSON(object: any): PerpsPoolAmm;
|
|
36
|
+
toJSON(message: PerpsPoolAmm): unknown;
|
|
37
|
+
fromPartial(object: DeepPartial<PerpsPoolAmm>): PerpsPoolAmm;
|
|
38
|
+
};
|
|
39
|
+
export declare const PerpsMarketAmm: {
|
|
40
|
+
encode(message: PerpsMarketAmm, writer?: _m0.Writer): _m0.Writer;
|
|
41
|
+
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): PerpsMarketAmm;
|
|
42
|
+
fromJSON(object: any): PerpsMarketAmm;
|
|
43
|
+
toJSON(message: PerpsMarketAmm): unknown;
|
|
44
|
+
fromPartial(object: DeepPartial<PerpsMarketAmm>): PerpsMarketAmm;
|
|
17
45
|
};
|
|
18
46
|
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
19
47
|
export declare type DeepPartial<T> = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
package/lib/codec/broker/amm.js
CHANGED
|
@@ -3,13 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.PerpsMarketAmm = exports.PerpsPoolAmm = exports.SpotAmm = exports.protobufPackage = void 0;
|
|
7
7
|
/* eslint-disable */
|
|
8
8
|
const long_1 = __importDefault(require("long"));
|
|
9
9
|
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
10
10
|
exports.protobufPackage = "Switcheo.carbon.broker";
|
|
11
|
-
const
|
|
12
|
-
exports.
|
|
11
|
+
const baseSpotAmm = { poolId: long_1.default.UZERO, market: "", orders: "" };
|
|
12
|
+
exports.SpotAmm = {
|
|
13
13
|
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
14
14
|
if (!message.poolId.isZero()) {
|
|
15
15
|
writer.uint32(8).uint64(message.poolId);
|
|
@@ -31,7 +31,7 @@ exports.Amm = {
|
|
|
31
31
|
decode(input, length) {
|
|
32
32
|
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
33
33
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
34
|
-
const message = Object.assign({},
|
|
34
|
+
const message = Object.assign({}, baseSpotAmm);
|
|
35
35
|
message.orders = [];
|
|
36
36
|
message.reservesHash = new Uint8Array();
|
|
37
37
|
message.poolRoute = new Uint8Array();
|
|
@@ -62,7 +62,7 @@ exports.Amm = {
|
|
|
62
62
|
},
|
|
63
63
|
fromJSON(object) {
|
|
64
64
|
var _a;
|
|
65
|
-
const message = Object.assign({},
|
|
65
|
+
const message = Object.assign({}, baseSpotAmm);
|
|
66
66
|
message.poolId =
|
|
67
67
|
object.poolId !== undefined && object.poolId !== null
|
|
68
68
|
? long_1.default.fromString(object.poolId)
|
|
@@ -103,7 +103,7 @@ exports.Amm = {
|
|
|
103
103
|
},
|
|
104
104
|
fromPartial(object) {
|
|
105
105
|
var _a, _b, _c, _d;
|
|
106
|
-
const message = Object.assign({},
|
|
106
|
+
const message = Object.assign({}, baseSpotAmm);
|
|
107
107
|
message.poolId =
|
|
108
108
|
object.poolId !== undefined && object.poolId !== null
|
|
109
109
|
? long_1.default.fromValue(object.poolId)
|
|
@@ -115,6 +115,185 @@ exports.Amm = {
|
|
|
115
115
|
return message;
|
|
116
116
|
},
|
|
117
117
|
};
|
|
118
|
+
const basePerpsPoolAmm = {
|
|
119
|
+
poolId: long_1.default.UZERO,
|
|
120
|
+
lastQuotedAt: long_1.default.UZERO,
|
|
121
|
+
};
|
|
122
|
+
exports.PerpsPoolAmm = {
|
|
123
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
124
|
+
if (!message.poolId.isZero()) {
|
|
125
|
+
writer.uint32(8).uint64(message.poolId);
|
|
126
|
+
}
|
|
127
|
+
if (message.quotingHash.length !== 0) {
|
|
128
|
+
writer.uint32(18).bytes(message.quotingHash);
|
|
129
|
+
}
|
|
130
|
+
if (!message.lastQuotedAt.isZero()) {
|
|
131
|
+
writer.uint32(24).uint64(message.lastQuotedAt);
|
|
132
|
+
}
|
|
133
|
+
return writer;
|
|
134
|
+
},
|
|
135
|
+
decode(input, length) {
|
|
136
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
137
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
138
|
+
const message = Object.assign({}, basePerpsPoolAmm);
|
|
139
|
+
message.quotingHash = new Uint8Array();
|
|
140
|
+
while (reader.pos < end) {
|
|
141
|
+
const tag = reader.uint32();
|
|
142
|
+
switch (tag >>> 3) {
|
|
143
|
+
case 1:
|
|
144
|
+
message.poolId = reader.uint64();
|
|
145
|
+
break;
|
|
146
|
+
case 2:
|
|
147
|
+
message.quotingHash = reader.bytes();
|
|
148
|
+
break;
|
|
149
|
+
case 3:
|
|
150
|
+
message.lastQuotedAt = reader.uint64();
|
|
151
|
+
break;
|
|
152
|
+
default:
|
|
153
|
+
reader.skipType(tag & 7);
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return message;
|
|
158
|
+
},
|
|
159
|
+
fromJSON(object) {
|
|
160
|
+
const message = Object.assign({}, basePerpsPoolAmm);
|
|
161
|
+
message.poolId =
|
|
162
|
+
object.poolId !== undefined && object.poolId !== null
|
|
163
|
+
? long_1.default.fromString(object.poolId)
|
|
164
|
+
: long_1.default.UZERO;
|
|
165
|
+
message.quotingHash =
|
|
166
|
+
object.quotingHash !== undefined && object.quotingHash !== null
|
|
167
|
+
? bytesFromBase64(object.quotingHash)
|
|
168
|
+
: new Uint8Array();
|
|
169
|
+
message.lastQuotedAt =
|
|
170
|
+
object.lastQuotedAt !== undefined && object.lastQuotedAt !== null
|
|
171
|
+
? long_1.default.fromString(object.lastQuotedAt)
|
|
172
|
+
: long_1.default.UZERO;
|
|
173
|
+
return message;
|
|
174
|
+
},
|
|
175
|
+
toJSON(message) {
|
|
176
|
+
const obj = {};
|
|
177
|
+
message.poolId !== undefined &&
|
|
178
|
+
(obj.poolId = (message.poolId || long_1.default.UZERO).toString());
|
|
179
|
+
message.quotingHash !== undefined &&
|
|
180
|
+
(obj.quotingHash = base64FromBytes(message.quotingHash !== undefined
|
|
181
|
+
? message.quotingHash
|
|
182
|
+
: new Uint8Array()));
|
|
183
|
+
message.lastQuotedAt !== undefined &&
|
|
184
|
+
(obj.lastQuotedAt = (message.lastQuotedAt || long_1.default.UZERO).toString());
|
|
185
|
+
return obj;
|
|
186
|
+
},
|
|
187
|
+
fromPartial(object) {
|
|
188
|
+
var _a;
|
|
189
|
+
const message = Object.assign({}, basePerpsPoolAmm);
|
|
190
|
+
message.poolId =
|
|
191
|
+
object.poolId !== undefined && object.poolId !== null
|
|
192
|
+
? long_1.default.fromValue(object.poolId)
|
|
193
|
+
: long_1.default.UZERO;
|
|
194
|
+
message.quotingHash = (_a = object.quotingHash) !== null && _a !== void 0 ? _a : new Uint8Array();
|
|
195
|
+
message.lastQuotedAt =
|
|
196
|
+
object.lastQuotedAt !== undefined && object.lastQuotedAt !== null
|
|
197
|
+
? long_1.default.fromValue(object.lastQuotedAt)
|
|
198
|
+
: long_1.default.UZERO;
|
|
199
|
+
return message;
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
const basePerpsMarketAmm = {
|
|
203
|
+
poolId: long_1.default.UZERO,
|
|
204
|
+
market: "",
|
|
205
|
+
orders: "",
|
|
206
|
+
lastIndexPrice: "",
|
|
207
|
+
};
|
|
208
|
+
exports.PerpsMarketAmm = {
|
|
209
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
210
|
+
if (!message.poolId.isZero()) {
|
|
211
|
+
writer.uint32(8).uint64(message.poolId);
|
|
212
|
+
}
|
|
213
|
+
if (message.market !== "") {
|
|
214
|
+
writer.uint32(18).string(message.market);
|
|
215
|
+
}
|
|
216
|
+
for (const v of message.orders) {
|
|
217
|
+
writer.uint32(26).string(v);
|
|
218
|
+
}
|
|
219
|
+
if (message.lastIndexPrice !== "") {
|
|
220
|
+
writer.uint32(34).string(message.lastIndexPrice);
|
|
221
|
+
}
|
|
222
|
+
return writer;
|
|
223
|
+
},
|
|
224
|
+
decode(input, length) {
|
|
225
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
226
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
227
|
+
const message = Object.assign({}, basePerpsMarketAmm);
|
|
228
|
+
message.orders = [];
|
|
229
|
+
while (reader.pos < end) {
|
|
230
|
+
const tag = reader.uint32();
|
|
231
|
+
switch (tag >>> 3) {
|
|
232
|
+
case 1:
|
|
233
|
+
message.poolId = reader.uint64();
|
|
234
|
+
break;
|
|
235
|
+
case 2:
|
|
236
|
+
message.market = reader.string();
|
|
237
|
+
break;
|
|
238
|
+
case 3:
|
|
239
|
+
message.orders.push(reader.string());
|
|
240
|
+
break;
|
|
241
|
+
case 4:
|
|
242
|
+
message.lastIndexPrice = reader.string();
|
|
243
|
+
break;
|
|
244
|
+
default:
|
|
245
|
+
reader.skipType(tag & 7);
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return message;
|
|
250
|
+
},
|
|
251
|
+
fromJSON(object) {
|
|
252
|
+
var _a;
|
|
253
|
+
const message = Object.assign({}, basePerpsMarketAmm);
|
|
254
|
+
message.poolId =
|
|
255
|
+
object.poolId !== undefined && object.poolId !== null
|
|
256
|
+
? long_1.default.fromString(object.poolId)
|
|
257
|
+
: long_1.default.UZERO;
|
|
258
|
+
message.market =
|
|
259
|
+
object.market !== undefined && object.market !== null
|
|
260
|
+
? String(object.market)
|
|
261
|
+
: "";
|
|
262
|
+
message.orders = ((_a = object.orders) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
|
|
263
|
+
message.lastIndexPrice =
|
|
264
|
+
object.lastIndexPrice !== undefined && object.lastIndexPrice !== null
|
|
265
|
+
? String(object.lastIndexPrice)
|
|
266
|
+
: "";
|
|
267
|
+
return message;
|
|
268
|
+
},
|
|
269
|
+
toJSON(message) {
|
|
270
|
+
const obj = {};
|
|
271
|
+
message.poolId !== undefined &&
|
|
272
|
+
(obj.poolId = (message.poolId || long_1.default.UZERO).toString());
|
|
273
|
+
message.market !== undefined && (obj.market = message.market);
|
|
274
|
+
if (message.orders) {
|
|
275
|
+
obj.orders = message.orders.map((e) => e);
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
obj.orders = [];
|
|
279
|
+
}
|
|
280
|
+
message.lastIndexPrice !== undefined &&
|
|
281
|
+
(obj.lastIndexPrice = message.lastIndexPrice);
|
|
282
|
+
return obj;
|
|
283
|
+
},
|
|
284
|
+
fromPartial(object) {
|
|
285
|
+
var _a, _b, _c;
|
|
286
|
+
const message = Object.assign({}, basePerpsMarketAmm);
|
|
287
|
+
message.poolId =
|
|
288
|
+
object.poolId !== undefined && object.poolId !== null
|
|
289
|
+
? long_1.default.fromValue(object.poolId)
|
|
290
|
+
: long_1.default.UZERO;
|
|
291
|
+
message.market = (_a = object.market) !== null && _a !== void 0 ? _a : "";
|
|
292
|
+
message.orders = ((_b = object.orders) !== null && _b !== void 0 ? _b : []).map((e) => e);
|
|
293
|
+
message.lastIndexPrice = (_c = object.lastIndexPrice) !== null && _c !== void 0 ? _c : "";
|
|
294
|
+
return message;
|
|
295
|
+
},
|
|
296
|
+
};
|
|
118
297
|
var globalThis = (() => {
|
|
119
298
|
if (typeof globalThis !== "undefined")
|
|
120
299
|
return globalThis;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Long from "long";
|
|
2
2
|
import _m0 from "protobufjs/minimal";
|
|
3
|
-
import {
|
|
3
|
+
import { SpotAmm } from "./amm";
|
|
4
4
|
export declare const protobufPackage = "Switcheo.carbon.broker";
|
|
5
5
|
/** GenesisState defines the broker module's genesis state. */
|
|
6
6
|
export interface GenesisState {
|
|
@@ -8,7 +8,7 @@ export interface GenesisState {
|
|
|
8
8
|
* this line is used by starport scaffolding # genesis/proto/state
|
|
9
9
|
* this line is used by starport scaffolding # ibc/genesis/proto
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
spotAmms: SpotAmm[];
|
|
12
12
|
}
|
|
13
13
|
export declare const GenesisState: {
|
|
14
14
|
encode(message: GenesisState, writer?: _m0.Writer): _m0.Writer;
|