carbon-js-sdk 0.6.0-rc7.alpha.2 → 0.6.0
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 +3 -5
- package/lib/CarbonSDK.js +4 -6
- package/lib/clients/CarbonQueryClient.d.ts +0 -2
- package/lib/clients/CarbonQueryClient.js +0 -2
- package/lib/clients/ETHClient.js +1 -1
- package/lib/clients/InsightsQueryClient.d.ts +1 -0
- package/lib/clients/InsightsQueryClient.js +7 -0
- package/lib/clients/TokenClient.d.ts +0 -8
- package/lib/clients/TokenClient.js +2 -58
- package/lib/codec/alliance/query.d.ts +24 -3
- package/lib/codec/book/book.d.ts +1 -0
- package/lib/codec/book/book.js +14 -2
- package/lib/codec/broker/amm.d.ts +7 -35
- package/lib/codec/broker/amm.js +6 -185
- package/lib/codec/broker/genesis.d.ts +2 -2
- package/lib/codec/broker/genesis.js +9 -9
- package/lib/codec/google/protobuf/any.d.ts +1 -4
- package/lib/codec/google/protobuf/timestamp.d.ts +2 -0
- package/lib/codec/index.d.ts +2 -24
- package/lib/codec/index.js +681 -1568
- package/lib/codec/inflation/inflation.d.ts +6 -2
- package/lib/codec/inflation/inflation.js +80 -25
- package/lib/codec/insurance/genesis.d.ts +4 -11
- package/lib/codec/insurance/genesis.js +4 -37
- package/lib/codec/insurance/query.d.ts +0 -48
- package/lib/codec/insurance/query.js +1 -217
- package/lib/codec/lockproxy/export.d.ts +1 -1
- package/lib/codec/lockproxy/export.js +1 -3
- package/lib/codec/lockproxy/tx.d.ts +0 -31
- package/lib/codec/lockproxy/tx.js +1 -235
- package/lib/constant/ibc.d.ts +2 -0
- package/lib/constant/network.d.ts +0 -2
- package/lib/constant/network.js +1 -5
- package/lib/insights/common.d.ts +1 -0
- package/lib/insights/common.js +1 -0
- package/lib/insights/index.d.ts +1 -0
- package/lib/insights/index.js +1 -0
- package/lib/insights/inflation.d.ts +6 -0
- package/lib/insights/inflation.js +2 -0
- package/lib/modules/cosmwasm.d.ts +6 -2
- package/lib/modules/cosmwasm.js +25 -5
- package/lib/modules/ibc.d.ts +3 -3
- package/lib/modules/ibc.js +33 -49
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/index.js +0 -2
- package/lib/modules/liquiditypool.d.ts +1 -0
- package/lib/modules/liquiditypool.js +22 -4
- package/lib/provider/amino/AminoTypesMap.js +1 -1
- package/lib/provider/amino/types/ibc.js +0 -3
- package/lib/provider/amino/types/index.d.ts +0 -2
- package/lib/provider/amino/types/index.js +1 -5
- package/lib/provider/amino/types/liquidityPool.js +3 -0
- package/lib/provider/amino/utils.js +7 -2
- package/lib/provider/keplr/KeplrAccount.js +18 -31
- package/lib/provider/metamask/MetaMask.js +4 -12
- package/lib/provider/o3/O3Wallet.js +4 -4
- package/lib/provider/sdk/SDKProvider.d.ts +2 -1
- package/lib/util/eip712.js +7 -7
- package/lib/util/ethermint.js +1 -1
- package/lib/util/generic.d.ts +4 -0
- package/lib/util/generic.js +19 -1
- package/lib/util/tx.d.ts +0 -16
- package/lib/websocket/channel.js +0 -9
- package/lib/websocket/types.d.ts +2 -6
- package/lib/websocket/types.js +0 -1
- package/package.json +2 -2
package/lib/CarbonSDK.d.ts
CHANGED
|
@@ -5,13 +5,13 @@ import * as clients from "./clients";
|
|
|
5
5
|
import { CarbonQueryClient, ETHClient, HydrogenClient, InsightsQueryClient, NEOClient, TokenClient, ZILClient } from "./clients";
|
|
6
6
|
import GrpcQueryClient from "./clients/GrpcQueryClient";
|
|
7
7
|
import N3Client from "./clients/N3Client";
|
|
8
|
-
import { AdminModule, AllianceModule, BankModule, BrokerModule, CDPModule, CoinModule,
|
|
8
|
+
import { AdminModule, AllianceModule, BankModule, BrokerModule, CDPModule, CoinModule, EvmMergeModule, EvmModule, FeeModule, FeemarketModule, GovModule, IBCModule, LeverageModule, LiquidityPoolModule, MarketModule, OracleModule, OrderModule, PositionModule, ProfileModule, SubAccountModule, XChainModule } from "./modules";
|
|
9
9
|
import { StakingModule } from "./modules/staking";
|
|
10
10
|
import { CosmosLedger, Keplr, LeapExtended } from "./provider";
|
|
11
11
|
import { MetaMask } from "./provider/metamask/MetaMask";
|
|
12
|
-
import { CarbonWallet, CarbonWalletGenericOpts,
|
|
13
|
-
export { CarbonSigner, CarbonSignerTypes, CarbonWallet, CarbonWalletGenericOpts, CarbonWalletInitOpts } from "./wallet";
|
|
12
|
+
import { CarbonSigner, CarbonWallet, CarbonWalletGenericOpts, MetaMaskWalletOpts } from "./wallet";
|
|
14
13
|
export { CarbonTx } from "./util";
|
|
14
|
+
export { CarbonSigner, CarbonSignerTypes, CarbonWallet, CarbonWalletGenericOpts, CarbonWalletInitOpts } from "./wallet";
|
|
15
15
|
export { DenomPrefix } from "./constant";
|
|
16
16
|
export interface CarbonSDKOpts {
|
|
17
17
|
network: Network;
|
|
@@ -61,8 +61,6 @@ declare class CarbonSDK {
|
|
|
61
61
|
alliance: AllianceModule;
|
|
62
62
|
order: OrderModule;
|
|
63
63
|
lp: LiquidityPoolModule;
|
|
64
|
-
erc20: ERC20Module;
|
|
65
|
-
plp: PerpsLiquidityModule;
|
|
66
64
|
subaccount: SubAccountModule;
|
|
67
65
|
profile: ProfileModule;
|
|
68
66
|
cdp: CDPModule;
|
package/lib/CarbonSDK.js
CHANGED
|
@@ -31,7 +31,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
31
31
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
32
|
};
|
|
33
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
-
exports.ConnectedCarbonSDK = exports.DenomPrefix = exports.
|
|
34
|
+
exports.ConnectedCarbonSDK = exports.DenomPrefix = exports.CarbonWallet = exports.CarbonSignerTypes = exports.CarbonTx = void 0;
|
|
35
35
|
const constant_1 = require("./constant");
|
|
36
36
|
const util_1 = require("./util");
|
|
37
37
|
const tendermint_rpc_1 = require("@cosmjs/tendermint-rpc");
|
|
@@ -45,11 +45,11 @@ const staking_1 = require("./modules/staking");
|
|
|
45
45
|
const provider_1 = require("./provider");
|
|
46
46
|
const blockchain_1 = require("./util/blockchain");
|
|
47
47
|
const wallet_1 = require("./wallet");
|
|
48
|
+
var util_2 = require("./util");
|
|
49
|
+
Object.defineProperty(exports, "CarbonTx", { enumerable: true, get: function () { return util_2.CarbonTx; } });
|
|
48
50
|
var wallet_2 = require("./wallet");
|
|
49
51
|
Object.defineProperty(exports, "CarbonSignerTypes", { enumerable: true, get: function () { return wallet_2.CarbonSignerTypes; } });
|
|
50
52
|
Object.defineProperty(exports, "CarbonWallet", { enumerable: true, get: function () { return wallet_2.CarbonWallet; } });
|
|
51
|
-
var util_2 = require("./util");
|
|
52
|
-
Object.defineProperty(exports, "CarbonTx", { enumerable: true, get: function () { return util_2.CarbonTx; } });
|
|
53
53
|
var constant_2 = require("./constant");
|
|
54
54
|
Object.defineProperty(exports, "DenomPrefix", { enumerable: true, get: function () { return constant_2.DenomPrefix; } });
|
|
55
55
|
const DEFAULT_SDK_INIT_OPTS = {
|
|
@@ -88,8 +88,6 @@ class CarbonSDK {
|
|
|
88
88
|
this.alliance = new modules_1.AllianceModule(this);
|
|
89
89
|
this.order = new modules_1.OrderModule(this);
|
|
90
90
|
this.lp = new modules_1.LiquidityPoolModule(this);
|
|
91
|
-
this.erc20 = new modules_1.ERC20Module(this);
|
|
92
|
-
this.plp = new modules_1.PerpsLiquidityModule(this);
|
|
93
91
|
this.subaccount = new modules_1.SubAccountModule(this);
|
|
94
92
|
this.profile = new modules_1.ProfileModule(this);
|
|
95
93
|
this.cdp = new modules_1.CDPModule(this);
|
|
@@ -322,7 +320,7 @@ class CarbonSDK {
|
|
|
322
320
|
const evmChainId = this.evmChainId;
|
|
323
321
|
const addressOptions = {
|
|
324
322
|
network: this.networkConfig.network,
|
|
325
|
-
bech32Prefix: this.networkConfig.Bech32Prefix
|
|
323
|
+
bech32Prefix: this.networkConfig.Bech32Prefix
|
|
326
324
|
};
|
|
327
325
|
let publicKeyBase64;
|
|
328
326
|
const address = yield metamask.defaultAccount();
|
|
@@ -42,7 +42,6 @@ import { QueryClientImpl as PricingQueryClient } from "../codec/pricing/query";
|
|
|
42
42
|
import { QueryClientImpl as ProfileQueryClient } from "../codec/profile/query";
|
|
43
43
|
import { QueryClientImpl as SubaccountQueryClient } from "../codec/subaccount/query";
|
|
44
44
|
import { QueryClientImpl as AllianceClient } from "../codec/alliance/query";
|
|
45
|
-
import { QueryClientImpl as PerpsLiquidityQueryClient } from "../codec/perpsliquidity/query";
|
|
46
45
|
import { Tendermint34Client } from "@cosmjs/tendermint-rpc";
|
|
47
46
|
import BlockchainClient from "./BlockchainClient";
|
|
48
47
|
import GrpcQueryClient from "./GrpcQueryClient";
|
|
@@ -84,7 +83,6 @@ declare class CarbonQueryClient {
|
|
|
84
83
|
profile: ProfileQueryClient;
|
|
85
84
|
subaccount: SubaccountQueryClient;
|
|
86
85
|
headersync: HeadersyncQueryClient;
|
|
87
|
-
perpsliquidity: PerpsLiquidityQueryClient;
|
|
88
86
|
auth: AuthQueryClient;
|
|
89
87
|
bank: BankQueryClient;
|
|
90
88
|
nativeBank: NativeBankQueryClient;
|
|
@@ -47,7 +47,6 @@ const query_41 = require("../codec/pricing/query");
|
|
|
47
47
|
const query_42 = require("../codec/profile/query");
|
|
48
48
|
const query_43 = require("../codec/subaccount/query");
|
|
49
49
|
const query_44 = require("../codec/alliance/query");
|
|
50
|
-
const query_45 = require("../codec/perpsliquidity/query");
|
|
51
50
|
const stargate_1 = require("@cosmjs/stargate");
|
|
52
51
|
const BlockchainClient_1 = __importDefault(require("./BlockchainClient"));
|
|
53
52
|
class CarbonQueryClient {
|
|
@@ -81,7 +80,6 @@ class CarbonQueryClient {
|
|
|
81
80
|
this.headersync = new query_23.QueryClientImpl(rpcClient);
|
|
82
81
|
this.evmmerge = new query_19.QueryClientImpl(rpcClient);
|
|
83
82
|
this.evmbank = new query_20.QueryClientImpl(rpcClient);
|
|
84
|
-
this.perpsliquidity = new query_45.QueryClientImpl(rpcClient);
|
|
85
83
|
this.auth = new query_6.QueryClientImpl(rpcClient);
|
|
86
84
|
this.bank = new query_7.QueryClientImpl(rpcClient);
|
|
87
85
|
this.nativeBank = new query_8.QueryClientImpl(rpcClient);
|
package/lib/clients/ETHClient.js
CHANGED
|
@@ -369,6 +369,6 @@ ETHClient.BLOCKCHAINV2_MAPPING = {
|
|
|
369
369
|
[blockchain_1.Blockchain.Ethereum]: "Ethereum",
|
|
370
370
|
[blockchain_1.Blockchain.Arbitrum]: "Arbitrum",
|
|
371
371
|
[blockchain_1.Blockchain.Polygon]: "Polygon",
|
|
372
|
-
[blockchain_1.Blockchain.Okc]: "
|
|
372
|
+
[blockchain_1.Blockchain.Okc]: "OKC",
|
|
373
373
|
};
|
|
374
374
|
exports.default = ETHClient;
|
|
@@ -8,6 +8,7 @@ declare class InsightsQueryClient {
|
|
|
8
8
|
Stake(req?: Insights.QueryGetStakeRequest): Promise<Insights.InsightsQueryResponse<Insights.QueryGetStakeResponse>>;
|
|
9
9
|
Transaction(req?: Insights.QueryGetTransactionRequest): Promise<Insights.InsightsQueryResponse<Insights.QueryGetTransactionResponse>>;
|
|
10
10
|
AvgBlockTime(req: Insights.QueryGetAvgBlockTimeRequest): Promise<Insights.InsightsQueryResponse<Insights.QueryGetAvgBlockTimeResponse>>;
|
|
11
|
+
Inflation(): Promise<Insights.InsightsQueryResponse<Insights.QueryGetInflation>>;
|
|
11
12
|
ActiveAccounts(req?: Insights.QueryGetActiveAccountsRequest): Promise<Insights.InsightsQueryResponse<Insights.QueryGetActiveAccountsResponse>>;
|
|
12
13
|
UserProfile(req: Insights.QueryGetUserProfileRequest): Promise<Insights.InsightsQueryResponse<Insights.QueryGetUserProfileResponse>>;
|
|
13
14
|
UserGrowth(req?: Insights.QueryGetUserGrowthRequest): Promise<Insights.InsightsQueryResponse<Insights.QueryGetUserGrowthResponse>>;
|
|
@@ -64,6 +64,13 @@ class InsightsQueryClient {
|
|
|
64
64
|
return response.data;
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
+
Inflation() {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
const request = this.apiManager.path("chain/inflation");
|
|
70
|
+
const response = yield request.get();
|
|
71
|
+
return response.data;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
67
74
|
// User api
|
|
68
75
|
ActiveAccounts(req = {}) {
|
|
69
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { Bridge, Token, TokenPrice } from "../codec";
|
|
2
|
-
import { DenomTrace } from "../codec/ibc/applications/transfer/v1/transfer";
|
|
3
2
|
import { NetworkConfigProvider } from "../constant";
|
|
4
3
|
import { GetFeeQuoteResponse } from "../hydrogen/feeQuote";
|
|
5
4
|
import { BlockchainUtils, TypeUtils } from "../util";
|
|
6
5
|
import { BlockchainV2, BridgeMap, IbcBridge } from '../util/blockchain';
|
|
7
6
|
import BigNumber from "bignumber.js";
|
|
8
7
|
import CarbonQueryClient from "./CarbonQueryClient";
|
|
9
|
-
export interface DenomTraceExtended extends DenomTrace {
|
|
10
|
-
token?: Token;
|
|
11
|
-
}
|
|
12
8
|
declare class TokenClient {
|
|
13
9
|
readonly query: CarbonQueryClient;
|
|
14
10
|
readonly configProvider: NetworkConfigProvider;
|
|
@@ -22,7 +18,6 @@ declare class TokenClient {
|
|
|
22
18
|
readonly usdValues: TypeUtils.SimpleMap<BigNumber>;
|
|
23
19
|
readonly commonAssetNames: TypeUtils.SimpleMap<string>;
|
|
24
20
|
readonly geckoTokenNames: TypeUtils.SimpleMap<string>;
|
|
25
|
-
readonly denomTraces: TypeUtils.SimpleMap<DenomTraceExtended>;
|
|
26
21
|
private additionalGeckoDenoms;
|
|
27
22
|
private constructor();
|
|
28
23
|
static instance(query: CarbonQueryClient, configProvider: NetworkConfigProvider): TokenClient;
|
|
@@ -61,8 +56,6 @@ declare class TokenClient {
|
|
|
61
56
|
getDepositTokenFor(tokenDenom: string, chain: BlockchainUtils.Blockchain | BlockchainUtils.BlockchainV2, version?: string): Token | undefined;
|
|
62
57
|
getAllTokens(): Promise<Token[]>;
|
|
63
58
|
reloadTokens(): Promise<TypeUtils.SimpleMap<Token>>;
|
|
64
|
-
reloadDenomTraces(): Promise<TypeUtils.SimpleMap<DenomTraceExtended>>;
|
|
65
|
-
getDenomTraceData(denom: string): DenomTrace | undefined;
|
|
66
59
|
getBridges(): Promise<BridgeMap>;
|
|
67
60
|
matchChainsWithDifferentChainIds(bridges: Bridge[]): Promise<IbcBridge[]>;
|
|
68
61
|
getIbcBlockchainNames(): string[];
|
|
@@ -75,7 +68,6 @@ declare class TokenClient {
|
|
|
75
68
|
getBlockchainV2FromIDs(chainId: string, bridgeId: string): BlockchainV2 | undefined;
|
|
76
69
|
getBridgeFromToken(token: Token | null): Bridge | IbcBridge | undefined;
|
|
77
70
|
getIbcChainIdFromToken(token: Token | null): string | undefined;
|
|
78
|
-
getCarbonDenomTraces(): Promise<TypeUtils.SimpleMap<DenomTrace>>;
|
|
79
71
|
getCdpUnderlyingToken(cdpDenom: string): Token | undefined;
|
|
80
72
|
reloadWrapperMap(): Promise<TypeUtils.SimpleMap<string>>;
|
|
81
73
|
reloadDenomGeckoMap(): Promise<void>;
|
|
@@ -16,13 +16,9 @@ const pagination_1 = require("../codec/cosmos/base/query/v1beta1/pagination");
|
|
|
16
16
|
const tendermint_1 = require("../codec/ibc/lightclients/tendermint/v1/tendermint");
|
|
17
17
|
const constant_1 = require("../constant");
|
|
18
18
|
const ibc_1 = require("../constant/ibc");
|
|
19
|
-
const network_1 = require("../constant/network");
|
|
20
19
|
const util_1 = require("../util");
|
|
21
20
|
const blockchain_1 = require("../util/blockchain");
|
|
22
21
|
const number_1 = require("../util/number");
|
|
23
|
-
const query_1 = require("../codec/ibc/applications/transfer/v1/query");
|
|
24
|
-
const stargate_1 = require("@cosmjs/stargate");
|
|
25
|
-
const tendermint_rpc_1 = require("@cosmjs/tendermint-rpc");
|
|
26
22
|
const long_1 = __importDefault(require("long"));
|
|
27
23
|
const InsightsQueryClient_1 = __importDefault(require("./InsightsQueryClient"));
|
|
28
24
|
const SYMBOL_OVERRIDE = {
|
|
@@ -53,8 +49,6 @@ class TokenClient {
|
|
|
53
49
|
this.usdValues = {};
|
|
54
50
|
this.commonAssetNames = constant_1.CommonAssetName;
|
|
55
51
|
this.geckoTokenNames = constant_1.CoinGeckoTokenNames;
|
|
56
|
-
// ibc apis
|
|
57
|
-
this.denomTraces = {};
|
|
58
52
|
this.additionalGeckoDenoms = {};
|
|
59
53
|
this.getIbcChainFromBlockchainV2 = (blockchain) => {
|
|
60
54
|
const ibcBridge = this.bridges.ibc.find(bridge => (bridge.chainName === blockchain || bridge.chainName.toLowerCase() === blockchain));
|
|
@@ -79,7 +73,6 @@ class TokenClient {
|
|
|
79
73
|
try {
|
|
80
74
|
this.reloadDenomGeckoMap().finally(() => {
|
|
81
75
|
this.reloadUSDValues();
|
|
82
|
-
this.reloadDenomTraces();
|
|
83
76
|
});
|
|
84
77
|
}
|
|
85
78
|
catch (error) {
|
|
@@ -348,7 +341,7 @@ class TokenClient {
|
|
|
348
341
|
const networkConfig = this.configProvider.getConfig();
|
|
349
342
|
const token = this.tokenForDenom(tokenDenom);
|
|
350
343
|
if (!token) {
|
|
351
|
-
console.
|
|
344
|
+
console.debug("getDepositTokenFor token not found for", tokenDenom);
|
|
352
345
|
return;
|
|
353
346
|
}
|
|
354
347
|
let targetChain = "";
|
|
@@ -366,7 +359,7 @@ class TokenClient {
|
|
|
366
359
|
// if not source token find wrapped token for chain
|
|
367
360
|
const depositToken = isSourceToken ? token : this.getWrappedToken(token.denom, chain, version);
|
|
368
361
|
if (!depositToken) {
|
|
369
|
-
console.
|
|
362
|
+
console.debug(`getDepositTokenFor wrapped token not found for "${token.denom}"`);
|
|
370
363
|
return;
|
|
371
364
|
}
|
|
372
365
|
return depositToken;
|
|
@@ -411,29 +404,6 @@ class TokenClient {
|
|
|
411
404
|
return this.tokens;
|
|
412
405
|
});
|
|
413
406
|
}
|
|
414
|
-
reloadDenomTraces() {
|
|
415
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
416
|
-
const result = yield this.query.ibc.transfer.DenomTraces({
|
|
417
|
-
pagination: {
|
|
418
|
-
limit: new long_1.default(1000000),
|
|
419
|
-
offset: long_1.default.UZERO,
|
|
420
|
-
key: new Uint8Array(),
|
|
421
|
-
countTotal: false,
|
|
422
|
-
reverse: false,
|
|
423
|
-
},
|
|
424
|
-
});
|
|
425
|
-
result.denomTraces.forEach((denomTrace) => {
|
|
426
|
-
const ibcDenom = util_1.IBCUtils.makeIBCMinimalDenom(denomTrace.path, denomTrace.baseDenom);
|
|
427
|
-
const token = this.tokenForDenom(ibcDenom);
|
|
428
|
-
this.denomTraces[ibcDenom] = Object.assign(Object.assign({}, denomTrace), { token });
|
|
429
|
-
});
|
|
430
|
-
const swthTraces = yield this.getCarbonDenomTraces();
|
|
431
|
-
return Object.assign(Object.assign({}, this.denomTraces), swthTraces);
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
getDenomTraceData(denom) {
|
|
435
|
-
return this.denomTraces[denom];
|
|
436
|
-
}
|
|
437
407
|
getBridges() {
|
|
438
408
|
return __awaiter(this, void 0, void 0, function* () {
|
|
439
409
|
const allBridges = yield this.query.coin.BridgeAll({
|
|
@@ -580,32 +550,6 @@ class TokenClient {
|
|
|
580
550
|
return undefined;
|
|
581
551
|
return bridge.chain_id_name;
|
|
582
552
|
}
|
|
583
|
-
getCarbonDenomTraces() {
|
|
584
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
585
|
-
// get swth on osmosis
|
|
586
|
-
const osmoTmClient = yield tendermint_rpc_1.Tendermint34Client.connect(network_1.publicRpcNodes.Osmosis);
|
|
587
|
-
const osmoClient = new stargate_1.QueryClient(osmoTmClient);
|
|
588
|
-
const osmosRpcClient = stargate_1.createProtobufRpcClient(osmoClient);
|
|
589
|
-
const osmoIbcClient = new query_1.QueryClientImpl(osmosRpcClient);
|
|
590
|
-
const osmoDenomTraces = yield osmoIbcClient.DenomTraces({
|
|
591
|
-
pagination: pagination_1.PageRequest.fromPartial({
|
|
592
|
-
limit: new long_1.default(1000000),
|
|
593
|
-
}),
|
|
594
|
-
});
|
|
595
|
-
const osmoSwthDenomTrace = osmoDenomTraces.denomTraces.filter((trace) => {
|
|
596
|
-
return trace.baseDenom === "swth";
|
|
597
|
-
});
|
|
598
|
-
return osmoSwthDenomTrace.reduce((prev, trace) => {
|
|
599
|
-
var _a;
|
|
600
|
-
const coinMinimalDenom = util_1.IBCUtils.makeIBCMinimalDenom(trace.path, trace.baseDenom);
|
|
601
|
-
const token = (_a = this.tokenForDenom(coinMinimalDenom)) !== null && _a !== void 0 ? _a : this.tokenForDenom(trace.baseDenom);
|
|
602
|
-
const traceExtended = Object.assign(Object.assign({}, trace), { token });
|
|
603
|
-
this.denomTraces[coinMinimalDenom] = traceExtended;
|
|
604
|
-
prev[coinMinimalDenom] = traceExtended;
|
|
605
|
-
return prev;
|
|
606
|
-
}, {});
|
|
607
|
-
});
|
|
608
|
-
}
|
|
609
553
|
getCdpUnderlyingToken(cdpDenom) {
|
|
610
554
|
if (!this.cdpTokens[cdpDenom]) {
|
|
611
555
|
console.error("not a CDP denom");
|
|
@@ -27,6 +27,7 @@ export interface QueryAllianceRequest {
|
|
|
27
27
|
export interface QueryAllianceResponse {
|
|
28
28
|
alliance?: AllianceAsset;
|
|
29
29
|
}
|
|
30
|
+
/** @deprecated */
|
|
30
31
|
export interface QueryIBCAllianceRequest {
|
|
31
32
|
hash: string;
|
|
32
33
|
}
|
|
@@ -69,6 +70,7 @@ export interface QueryAllianceDelegationRequest {
|
|
|
69
70
|
denom: string;
|
|
70
71
|
pagination?: PageRequest;
|
|
71
72
|
}
|
|
73
|
+
/** @deprecated */
|
|
72
74
|
export interface QueryIBCAllianceDelegationRequest {
|
|
73
75
|
delegatorAddr: string;
|
|
74
76
|
validatorAddr: string;
|
|
@@ -85,6 +87,7 @@ export interface QueryAllianceDelegationRewardsRequest {
|
|
|
85
87
|
denom: string;
|
|
86
88
|
pagination?: PageRequest;
|
|
87
89
|
}
|
|
90
|
+
/** @deprecated */
|
|
88
91
|
export interface QueryIBCAllianceDelegationRewardsRequest {
|
|
89
92
|
delegatorAddr: string;
|
|
90
93
|
validatorAddr: string;
|
|
@@ -262,7 +265,13 @@ export interface Query {
|
|
|
262
265
|
Params(request: QueryParamsRequest): Promise<QueryParamsResponse>;
|
|
263
266
|
/** Query paginated alliances */
|
|
264
267
|
Alliances(request: QueryAlliancesRequest): Promise<QueryAlliancesResponse>;
|
|
265
|
-
/**
|
|
268
|
+
/**
|
|
269
|
+
* Query a specific alliance by ibc hash
|
|
270
|
+
* @deprecated: this endpoint will be replaced for by the encoded version
|
|
271
|
+
* of the denom e.g.: GET:/terra/alliances/ibc%2Falliance
|
|
272
|
+
*
|
|
273
|
+
* @deprecated
|
|
274
|
+
*/
|
|
266
275
|
IBCAlliance(request: QueryIBCAllianceRequest): Promise<QueryAllianceResponse>;
|
|
267
276
|
/** Query all paginated alliance delegations */
|
|
268
277
|
AllAlliancesDelegations(request: QueryAllAlliancesDelegationsRequest): Promise<QueryAlliancesDelegationsResponse>;
|
|
@@ -276,11 +285,23 @@ export interface Query {
|
|
|
276
285
|
AlliancesDelegationByValidator(request: QueryAlliancesDelegationByValidatorRequest): Promise<QueryAlliancesDelegationsResponse>;
|
|
277
286
|
/** Query a delegation to an alliance by delegator addr, validator_addr and denom */
|
|
278
287
|
AllianceDelegation(request: QueryAllianceDelegationRequest): Promise<QueryAllianceDelegationResponse>;
|
|
279
|
-
/**
|
|
288
|
+
/**
|
|
289
|
+
* Query a delegation to an alliance by delegator addr, validator_addr and denom
|
|
290
|
+
* @deprecated: this endpoint will be replaced for by the encoded version
|
|
291
|
+
* of the denom e.g.: GET:/terra/alliances/terradr1231/terravaloper41234/ibc%2Falliance
|
|
292
|
+
*
|
|
293
|
+
* @deprecated
|
|
294
|
+
*/
|
|
280
295
|
IBCAllianceDelegation(request: QueryIBCAllianceDelegationRequest): Promise<QueryAllianceDelegationResponse>;
|
|
281
296
|
/** Query for rewards by delegator addr, validator_addr and denom */
|
|
282
297
|
AllianceDelegationRewards(request: QueryAllianceDelegationRewardsRequest): Promise<QueryAllianceDelegationRewardsResponse>;
|
|
283
|
-
/**
|
|
298
|
+
/**
|
|
299
|
+
* Query for rewards by delegator addr, validator_addr and denom
|
|
300
|
+
* @deprecated: this endpoint will be replaced for by the encoded version
|
|
301
|
+
* of the denom e.g.: GET:/terra/alliances/terradr1231/terravaloper41234/ibc%2Falliance
|
|
302
|
+
*
|
|
303
|
+
* @deprecated
|
|
304
|
+
*/
|
|
284
305
|
IBCAllianceDelegationRewards(request: QueryIBCAllianceDelegationRewardsRequest): Promise<QueryAllianceDelegationRewardsResponse>;
|
|
285
306
|
/** Query a specific alliance by denom */
|
|
286
307
|
Alliance(request: QueryAllianceRequest): Promise<QueryAllianceResponse>;
|
package/lib/codec/book/book.d.ts
CHANGED
package/lib/codec/book/book.js
CHANGED
|
@@ -158,7 +158,7 @@ exports.OrderBook = {
|
|
|
158
158
|
return message;
|
|
159
159
|
},
|
|
160
160
|
};
|
|
161
|
-
const baseStopBook = { market: "", asks: "", bids: "" };
|
|
161
|
+
const baseStopBook = { market: "", asks: "", bids: "", trigger: "" };
|
|
162
162
|
exports.StopBook = {
|
|
163
163
|
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
164
164
|
if (message.market !== "") {
|
|
@@ -170,6 +170,9 @@ exports.StopBook = {
|
|
|
170
170
|
for (const v of message.bids) {
|
|
171
171
|
writer.uint32(26).string(v);
|
|
172
172
|
}
|
|
173
|
+
if (message.trigger !== "") {
|
|
174
|
+
writer.uint32(34).string(message.trigger);
|
|
175
|
+
}
|
|
173
176
|
return writer;
|
|
174
177
|
},
|
|
175
178
|
decode(input, length) {
|
|
@@ -190,6 +193,9 @@ exports.StopBook = {
|
|
|
190
193
|
case 3:
|
|
191
194
|
message.bids.push(reader.string());
|
|
192
195
|
break;
|
|
196
|
+
case 4:
|
|
197
|
+
message.trigger = reader.string();
|
|
198
|
+
break;
|
|
193
199
|
default:
|
|
194
200
|
reader.skipType(tag & 7);
|
|
195
201
|
break;
|
|
@@ -206,6 +212,10 @@ exports.StopBook = {
|
|
|
206
212
|
: "";
|
|
207
213
|
message.asks = ((_a = object.asks) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
|
|
208
214
|
message.bids = ((_b = object.bids) !== null && _b !== void 0 ? _b : []).map((e) => String(e));
|
|
215
|
+
message.trigger =
|
|
216
|
+
object.trigger !== undefined && object.trigger !== null
|
|
217
|
+
? String(object.trigger)
|
|
218
|
+
: "";
|
|
209
219
|
return message;
|
|
210
220
|
},
|
|
211
221
|
toJSON(message) {
|
|
@@ -223,14 +233,16 @@ exports.StopBook = {
|
|
|
223
233
|
else {
|
|
224
234
|
obj.bids = [];
|
|
225
235
|
}
|
|
236
|
+
message.trigger !== undefined && (obj.trigger = message.trigger);
|
|
226
237
|
return obj;
|
|
227
238
|
},
|
|
228
239
|
fromPartial(object) {
|
|
229
|
-
var _a, _b, _c;
|
|
240
|
+
var _a, _b, _c, _d;
|
|
230
241
|
const message = Object.assign({}, baseStopBook);
|
|
231
242
|
message.market = (_a = object.market) !== null && _a !== void 0 ? _a : "";
|
|
232
243
|
message.asks = ((_b = object.asks) !== null && _b !== void 0 ? _b : []).map((e) => e);
|
|
233
244
|
message.bids = ((_c = object.bids) !== null && _c !== void 0 ? _c : []).map((e) => e);
|
|
245
|
+
message.trigger = (_d = object.trigger) !== null && _d !== void 0 ? _d : "";
|
|
234
246
|
return message;
|
|
235
247
|
},
|
|
236
248
|
};
|
|
@@ -1,47 +1,19 @@
|
|
|
1
1
|
import Long from "long";
|
|
2
2
|
import _m0 from "protobufjs/minimal";
|
|
3
3
|
export declare const protobufPackage = "Switcheo.carbon.broker";
|
|
4
|
-
|
|
5
|
-
export interface SpotAmm {
|
|
4
|
+
export interface Amm {
|
|
6
5
|
poolId: Long;
|
|
7
6
|
market: string;
|
|
8
7
|
reservesHash: Uint8Array;
|
|
9
8
|
orders: string[];
|
|
10
9
|
poolRoute: Uint8Array;
|
|
11
10
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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;
|
|
11
|
+
export declare const Amm: {
|
|
12
|
+
encode(message: Amm, writer?: _m0.Writer): _m0.Writer;
|
|
13
|
+
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): Amm;
|
|
14
|
+
fromJSON(object: any): Amm;
|
|
15
|
+
toJSON(message: Amm): unknown;
|
|
16
|
+
fromPartial(object: DeepPartial<Amm>): Amm;
|
|
45
17
|
};
|
|
46
18
|
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
47
19
|
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 {} ? {
|