carbon-js-sdk 0.5.0-rc7 → 0.5.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/clients/EvmIbcClient.d.ts +86 -0
- package/lib/clients/EvmIbcClient.js +90 -0
- package/lib/clients/TokenClient.js +20 -25
- package/lib/codec/bank/event.d.ts +22 -0
- package/lib/codec/bank/event.js +123 -1
- package/lib/codec/broker/incoming_pool_swap.d.ts +23 -0
- package/lib/codec/broker/incoming_pool_swap.js +136 -0
- package/lib/codec/crisis/genesis.d.ts +18 -0
- package/lib/codec/crisis/genesis.js +46 -0
- package/lib/codec/crisis/query.d.ts +43 -0
- package/lib/codec/crisis/query.js +103 -0
- package/lib/codec/crisis/tx.d.ts +12 -0
- package/lib/codec/crisis/tx.js +20 -0
- package/lib/codec/ibc/applications/interchain_accounts/v1/genesis.d.ts +76 -0
- package/lib/codec/ibc/applications/interchain_accounts/v1/genesis.js +424 -0
- package/lib/codec/index.d.ts +1 -1
- package/lib/codec/index.js +35 -11
- package/lib/codec/market/legacy.d.ts +62 -0
- package/lib/codec/market/legacy.js +630 -0
- package/lib/codec/query/pagination.d.ts +29 -0
- package/lib/codec/query/pagination.js +126 -0
- package/lib/modules/ibc.d.ts +2 -1
- package/lib/modules/ibc.js +2 -2
- package/lib/modules/perpsliquidity.d.ts +1 -4
- package/lib/modules/perpsliquidity.js +14 -26
- package/lib/provider/amino/types/alliance.d.ts +4 -0
- package/lib/provider/amino/types/alliance.js +56 -0
- package/lib/util/ethermint/evm-ibc.d.ts +97 -0
- package/lib/util/ethermint/evm-ibc.js +134 -0
- package/lib/util/ethermint/index.d.ts +3 -0
- package/lib/util/ethermint/index.js +12 -0
- package/lib/util/ethermint/keys.d.ts +39 -0
- package/lib/util/ethermint/keys.js +138 -0
- package/lib/util/ethermint/web3.d.ts +36 -0
- package/lib/util/ethermint/web3.js +124 -0
- package/package.json +1 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Network } from "../constant";
|
|
2
|
+
import { StdSignDoc } from "@cosmjs/amino";
|
|
3
|
+
import { BlockchainUtils } from "../util";
|
|
4
|
+
declare type SupportedBlockchains = BlockchainUtils.Blockchain.Canto | BlockchainUtils.Blockchain.Evmos;
|
|
5
|
+
declare namespace EvmIbcClient {
|
|
6
|
+
interface TypedDomain {
|
|
7
|
+
name: string;
|
|
8
|
+
version: string;
|
|
9
|
+
chainId: number;
|
|
10
|
+
verifyingContract: string;
|
|
11
|
+
salt: string;
|
|
12
|
+
}
|
|
13
|
+
interface TypedDataV4 {
|
|
14
|
+
types: object;
|
|
15
|
+
primaryType: string;
|
|
16
|
+
message: StdSignDoc;
|
|
17
|
+
domain: TypedDomain;
|
|
18
|
+
}
|
|
19
|
+
const TYPED_DATA_REQUEST_METHOD = "eth_signTypedData_v4";
|
|
20
|
+
const DEFAULT_EIP712_TYPES: {
|
|
21
|
+
EIP712Domain: {
|
|
22
|
+
name: string;
|
|
23
|
+
type: string;
|
|
24
|
+
}[];
|
|
25
|
+
Tx: {
|
|
26
|
+
name: string;
|
|
27
|
+
type: string;
|
|
28
|
+
}[];
|
|
29
|
+
Fee: {
|
|
30
|
+
name: string;
|
|
31
|
+
type: string;
|
|
32
|
+
}[];
|
|
33
|
+
Coin: {
|
|
34
|
+
name: string;
|
|
35
|
+
type: string;
|
|
36
|
+
}[];
|
|
37
|
+
Msg: {
|
|
38
|
+
name: string;
|
|
39
|
+
type: string;
|
|
40
|
+
}[];
|
|
41
|
+
};
|
|
42
|
+
const getEvmChainId: (blockchain: SupportedBlockchains, network?: Network) => 7700 | 9001;
|
|
43
|
+
const getIbcTransferTypes: () => {
|
|
44
|
+
MsgValue: {
|
|
45
|
+
name: string;
|
|
46
|
+
type: string;
|
|
47
|
+
}[];
|
|
48
|
+
TypeToken: {
|
|
49
|
+
name: string;
|
|
50
|
+
type: string;
|
|
51
|
+
}[];
|
|
52
|
+
TypeTimeoutHeight: {
|
|
53
|
+
name: string;
|
|
54
|
+
type: string;
|
|
55
|
+
}[];
|
|
56
|
+
EIP712Domain: {
|
|
57
|
+
name: string;
|
|
58
|
+
type: string;
|
|
59
|
+
}[];
|
|
60
|
+
Tx: {
|
|
61
|
+
name: string;
|
|
62
|
+
type: string;
|
|
63
|
+
}[];
|
|
64
|
+
Fee: {
|
|
65
|
+
name: string;
|
|
66
|
+
type: string;
|
|
67
|
+
}[];
|
|
68
|
+
Coin: {
|
|
69
|
+
name: string;
|
|
70
|
+
type: string;
|
|
71
|
+
}[];
|
|
72
|
+
Msg: {
|
|
73
|
+
name: string;
|
|
74
|
+
type: string;
|
|
75
|
+
}[];
|
|
76
|
+
};
|
|
77
|
+
const getCosmosWeb3Domain: (blockchain: SupportedBlockchains) => {
|
|
78
|
+
name: string;
|
|
79
|
+
version: string;
|
|
80
|
+
chainId: number;
|
|
81
|
+
verifyingContract: string;
|
|
82
|
+
salt: string;
|
|
83
|
+
};
|
|
84
|
+
const getEIP712TypedData: (tx: StdSignDoc, blockchain: SupportedBlockchains, types?: object, domain?: EvmIbcClient.TypedDomain, primaryType?: string) => TypedDataV4;
|
|
85
|
+
}
|
|
86
|
+
export default EvmIbcClient;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const constant_1 = require("../constant");
|
|
4
|
+
const util_1 = require("../util");
|
|
5
|
+
const _DEFAULT_EIP712_TYPES = {
|
|
6
|
+
EIP712Domain: [
|
|
7
|
+
{ name: 'name', type: 'string' },
|
|
8
|
+
{ name: 'version', type: 'string' },
|
|
9
|
+
{ name: 'chainId', type: 'uint256' },
|
|
10
|
+
{ name: 'verifyingContract', type: 'string' },
|
|
11
|
+
{ name: 'salt', type: 'string' },
|
|
12
|
+
],
|
|
13
|
+
Tx: [
|
|
14
|
+
{ name: 'account_number', type: 'string' },
|
|
15
|
+
{ name: 'chain_id', type: 'string' },
|
|
16
|
+
{ name: 'fee', type: 'Fee' },
|
|
17
|
+
{ name: 'memo', type: 'string' },
|
|
18
|
+
{ name: 'msgs', type: 'Msg[]' },
|
|
19
|
+
{ name: 'sequence', type: 'string' },
|
|
20
|
+
],
|
|
21
|
+
Fee: [
|
|
22
|
+
{ name: 'feePayer', type: 'string' },
|
|
23
|
+
{ name: 'amount', type: 'Coin[]' },
|
|
24
|
+
{ name: 'gas', type: 'string' },
|
|
25
|
+
],
|
|
26
|
+
Coin: [
|
|
27
|
+
{ name: 'denom', type: 'string' },
|
|
28
|
+
{ name: 'amount', type: 'string' },
|
|
29
|
+
],
|
|
30
|
+
Msg: [
|
|
31
|
+
{ name: 'type', type: 'string' },
|
|
32
|
+
{ name: 'value', type: 'MsgValue' },
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
var EvmIbcClient;
|
|
36
|
+
(function (EvmIbcClient) {
|
|
37
|
+
EvmIbcClient.TYPED_DATA_REQUEST_METHOD = "eth_signTypedData_v4";
|
|
38
|
+
EvmIbcClient.DEFAULT_EIP712_TYPES = _DEFAULT_EIP712_TYPES;
|
|
39
|
+
EvmIbcClient.getEvmChainId = (blockchain, network = constant_1.Network.MainNet) => {
|
|
40
|
+
switch (network) {
|
|
41
|
+
case constant_1.Network.MainNet:
|
|
42
|
+
switch (blockchain) {
|
|
43
|
+
case util_1.BlockchainUtils.Blockchain.Canto:
|
|
44
|
+
return 7700;
|
|
45
|
+
case util_1.BlockchainUtils.Blockchain.Evmos:
|
|
46
|
+
return 9001;
|
|
47
|
+
default:
|
|
48
|
+
throw new Error("network not supported");
|
|
49
|
+
}
|
|
50
|
+
default:
|
|
51
|
+
throw new Error("network not supported");
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
EvmIbcClient.getIbcTransferTypes = () => {
|
|
55
|
+
return Object.assign(Object.assign({}, EvmIbcClient.DEFAULT_EIP712_TYPES), { MsgValue: [
|
|
56
|
+
{ name: 'source_port', type: 'string' },
|
|
57
|
+
{ name: 'source_channel', type: 'string' },
|
|
58
|
+
{ name: 'token', type: 'TypeToken' },
|
|
59
|
+
{ name: 'sender', type: 'string' },
|
|
60
|
+
{ name: 'receiver', type: 'string' },
|
|
61
|
+
{ name: 'timeout_height', type: 'TypeTimeoutHeight' },
|
|
62
|
+
{ name: 'timeout_timestamp', type: 'uint64' },
|
|
63
|
+
], TypeToken: [
|
|
64
|
+
{ name: 'denom', type: 'string' },
|
|
65
|
+
{ name: 'amount', type: 'string' },
|
|
66
|
+
], TypeTimeoutHeight: [
|
|
67
|
+
{ name: 'revision_number', type: 'uint64' },
|
|
68
|
+
{ name: 'revision_height', type: 'uint64' },
|
|
69
|
+
] });
|
|
70
|
+
};
|
|
71
|
+
EvmIbcClient.getCosmosWeb3Domain = (blockchain) => {
|
|
72
|
+
return {
|
|
73
|
+
name: "Cosmos Web3",
|
|
74
|
+
version: "1.0.0",
|
|
75
|
+
chainId: EvmIbcClient.getEvmChainId(blockchain),
|
|
76
|
+
verifyingContract: "cosmos",
|
|
77
|
+
salt: "0",
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
EvmIbcClient.getEIP712TypedData = (tx, blockchain, types = EvmIbcClient.getIbcTransferTypes(), domain = EvmIbcClient.getCosmosWeb3Domain(blockchain), primaryType = "Tx") => {
|
|
81
|
+
const typedData = {
|
|
82
|
+
types,
|
|
83
|
+
primaryType,
|
|
84
|
+
domain,
|
|
85
|
+
message: tx,
|
|
86
|
+
};
|
|
87
|
+
return typedData;
|
|
88
|
+
};
|
|
89
|
+
})(EvmIbcClient || (EvmIbcClient = {}));
|
|
90
|
+
exports.default = EvmIbcClient;
|
|
@@ -67,18 +67,22 @@ class TokenClient {
|
|
|
67
67
|
initialize() {
|
|
68
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
69
|
this.setCommonAssetConfig();
|
|
70
|
-
yield this.reloadWrapperMap();
|
|
71
|
-
yield this.reloadTokens();
|
|
72
|
-
yield this.getBridges();
|
|
73
70
|
// non-blocking reload
|
|
74
71
|
try {
|
|
75
|
-
this.
|
|
76
|
-
|
|
72
|
+
this.reloadDenomGeckoMap().finally(() => {
|
|
73
|
+
this.reloadUSDValues();
|
|
74
|
+
this.reloadDenomTraces();
|
|
75
|
+
});
|
|
77
76
|
}
|
|
78
77
|
catch (error) {
|
|
79
78
|
console.error("failed to reload usd values");
|
|
80
79
|
console.error(error);
|
|
81
80
|
}
|
|
81
|
+
yield Promise.all([
|
|
82
|
+
this.reloadWrapperMap(),
|
|
83
|
+
this.reloadTokens(),
|
|
84
|
+
this.getBridges(),
|
|
85
|
+
]);
|
|
82
86
|
});
|
|
83
87
|
}
|
|
84
88
|
registerGeckoIdMap(map) {
|
|
@@ -264,7 +268,6 @@ class TokenClient {
|
|
|
264
268
|
return result;
|
|
265
269
|
}
|
|
266
270
|
getWrappedToken(denom, blockchain, version = 'V1') {
|
|
267
|
-
const networkConfig = this.configProvider.getConfig();
|
|
268
271
|
// if denom is already a wrapped denom or no blockchain was specified,
|
|
269
272
|
// just return the input denom.
|
|
270
273
|
if (this.wrapperMap[denom] || !blockchain) {
|
|
@@ -454,34 +457,26 @@ class TokenClient {
|
|
|
454
457
|
return __awaiter(this, void 0, void 0, function* () {
|
|
455
458
|
let newBridges = [];
|
|
456
459
|
try {
|
|
457
|
-
const
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
})
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
});
|
|
467
|
-
const clientId_to_chainIdName = yield this.query.ibc.client.ClientStates({
|
|
468
|
-
pagination: pagination_1.PageRequest.fromPartial({
|
|
469
|
-
limit: new long_1.default(1000000)
|
|
470
|
-
})
|
|
471
|
-
});
|
|
472
|
-
const clientStates = clientId_to_chainIdName.clientStates.map(s => ({
|
|
473
|
-
clientState: Object.assign({}, tendermint_1.ClientState.decode(s.clientState.value)),
|
|
460
|
+
const pagination = pagination_1.PageRequest.fromPartial({ limit: new long_1.default(1e6) });
|
|
461
|
+
const results = yield Promise.all([
|
|
462
|
+
this.query.ibc.channel.Channels({ pagination }),
|
|
463
|
+
this.query.ibc.connection.Connections({ pagination }),
|
|
464
|
+
this.query.ibc.client.ClientStates({ pagination }),
|
|
465
|
+
]);
|
|
466
|
+
const [{ channels }, { connections }, { clientStates: rawClientStates }] = results;
|
|
467
|
+
const clientStates = rawClientStates.map(s => ({
|
|
468
|
+
clientState: tendermint_1.ClientState.decode(s.clientState.value),
|
|
474
469
|
clientId: s.clientId,
|
|
475
470
|
}));
|
|
476
471
|
newBridges = bridges.map(bridge => {
|
|
477
472
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
478
|
-
const connection =
|
|
473
|
+
const connection = channels.find(channel => channel.channelId === ("channel-" + (bridge.chainId.toNumber() - 1)));
|
|
479
474
|
const connectionId = connection === null || connection === void 0 ? void 0 : connection.connectionHops[0];
|
|
480
475
|
const src_channel = (_a = connection === null || connection === void 0 ? void 0 : connection.channelId) !== null && _a !== void 0 ? _a : "";
|
|
481
476
|
const dst_channel = (_c = (_b = connection === null || connection === void 0 ? void 0 : connection.counterparty) === null || _b === void 0 ? void 0 : _b.channelId) !== null && _c !== void 0 ? _c : "";
|
|
482
477
|
const cosmRegexArr = (_e = (_d = connection === null || connection === void 0 ? void 0 : connection.counterparty) === null || _d === void 0 ? void 0 : _d.portId) === null || _e === void 0 ? void 0 : _e.match(ibc_1.cosmBridgeRegex);
|
|
483
478
|
const portId = (_f = cosmRegexArr === null || cosmRegexArr === void 0 ? void 0 : cosmRegexArr[1]) !== null && _f !== void 0 ? _f : "transfer";
|
|
484
|
-
const clientId = (_g =
|
|
479
|
+
const clientId = (_g = connections.find(connection => connection.id === connectionId)) === null || _g === void 0 ? void 0 : _g.clientId;
|
|
485
480
|
const chainIdName = (_j = ((_h = clientStates.find(client => client.clientId === clientId)) === null || _h === void 0 ? void 0 : _h.clientState)) === null || _j === void 0 ? void 0 : _j.chainId;
|
|
486
481
|
return Object.assign(Object.assign({}, bridge), { chain_id_name: chainIdName !== null && chainIdName !== void 0 ? chainIdName : "", channels: { src_channel, dst_channel, port_id: portId } });
|
|
487
482
|
});
|
|
@@ -15,6 +15,14 @@ export interface CoinSent {
|
|
|
15
15
|
receiver: string;
|
|
16
16
|
amount: Coin[];
|
|
17
17
|
}
|
|
18
|
+
export interface CoinMint {
|
|
19
|
+
minter: string;
|
|
20
|
+
amount: Coin[];
|
|
21
|
+
}
|
|
22
|
+
export interface CoinBurn {
|
|
23
|
+
burner: string;
|
|
24
|
+
amount: Coin[];
|
|
25
|
+
}
|
|
18
26
|
export declare const CoinSpent: {
|
|
19
27
|
encode(message: CoinSpent, writer?: _m0.Writer): _m0.Writer;
|
|
20
28
|
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): CoinSpent;
|
|
@@ -36,6 +44,20 @@ export declare const CoinSent: {
|
|
|
36
44
|
toJSON(message: CoinSent): unknown;
|
|
37
45
|
fromPartial(object: DeepPartial<CoinSent>): CoinSent;
|
|
38
46
|
};
|
|
47
|
+
export declare const CoinMint: {
|
|
48
|
+
encode(message: CoinMint, writer?: _m0.Writer): _m0.Writer;
|
|
49
|
+
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): CoinMint;
|
|
50
|
+
fromJSON(object: any): CoinMint;
|
|
51
|
+
toJSON(message: CoinMint): unknown;
|
|
52
|
+
fromPartial(object: DeepPartial<CoinMint>): CoinMint;
|
|
53
|
+
};
|
|
54
|
+
export declare const CoinBurn: {
|
|
55
|
+
encode(message: CoinBurn, writer?: _m0.Writer): _m0.Writer;
|
|
56
|
+
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): CoinBurn;
|
|
57
|
+
fromJSON(object: any): CoinBurn;
|
|
58
|
+
toJSON(message: CoinBurn): unknown;
|
|
59
|
+
fromPartial(object: DeepPartial<CoinBurn>): CoinBurn;
|
|
60
|
+
};
|
|
39
61
|
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
40
62
|
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 {} ? {
|
|
41
63
|
[K in keyof T]?: DeepPartial<T[K]>;
|
package/lib/codec/bank/event.js
CHANGED
|
@@ -3,7 +3,7 @@ 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.CoinSent = exports.CoinReceived = exports.CoinSpent = exports.protobufPackage = void 0;
|
|
6
|
+
exports.CoinBurn = exports.CoinMint = exports.CoinSent = exports.CoinReceived = exports.CoinSpent = 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"));
|
|
@@ -204,6 +204,128 @@ exports.CoinSent = {
|
|
|
204
204
|
return message;
|
|
205
205
|
},
|
|
206
206
|
};
|
|
207
|
+
const baseCoinMint = { minter: "" };
|
|
208
|
+
exports.CoinMint = {
|
|
209
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
210
|
+
if (message.minter !== "") {
|
|
211
|
+
writer.uint32(10).string(message.minter);
|
|
212
|
+
}
|
|
213
|
+
for (const v of message.amount) {
|
|
214
|
+
coin_1.Coin.encode(v, writer.uint32(18).fork()).ldelim();
|
|
215
|
+
}
|
|
216
|
+
return writer;
|
|
217
|
+
},
|
|
218
|
+
decode(input, length) {
|
|
219
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
220
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
221
|
+
const message = Object.assign({}, baseCoinMint);
|
|
222
|
+
message.amount = [];
|
|
223
|
+
while (reader.pos < end) {
|
|
224
|
+
const tag = reader.uint32();
|
|
225
|
+
switch (tag >>> 3) {
|
|
226
|
+
case 1:
|
|
227
|
+
message.minter = reader.string();
|
|
228
|
+
break;
|
|
229
|
+
case 2:
|
|
230
|
+
message.amount.push(coin_1.Coin.decode(reader, reader.uint32()));
|
|
231
|
+
break;
|
|
232
|
+
default:
|
|
233
|
+
reader.skipType(tag & 7);
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return message;
|
|
238
|
+
},
|
|
239
|
+
fromJSON(object) {
|
|
240
|
+
var _a;
|
|
241
|
+
const message = Object.assign({}, baseCoinMint);
|
|
242
|
+
message.minter =
|
|
243
|
+
object.minter !== undefined && object.minter !== null
|
|
244
|
+
? String(object.minter)
|
|
245
|
+
: "";
|
|
246
|
+
message.amount = ((_a = object.amount) !== null && _a !== void 0 ? _a : []).map((e) => coin_1.Coin.fromJSON(e));
|
|
247
|
+
return message;
|
|
248
|
+
},
|
|
249
|
+
toJSON(message) {
|
|
250
|
+
const obj = {};
|
|
251
|
+
message.minter !== undefined && (obj.minter = message.minter);
|
|
252
|
+
if (message.amount) {
|
|
253
|
+
obj.amount = message.amount.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined));
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
obj.amount = [];
|
|
257
|
+
}
|
|
258
|
+
return obj;
|
|
259
|
+
},
|
|
260
|
+
fromPartial(object) {
|
|
261
|
+
var _a, _b;
|
|
262
|
+
const message = Object.assign({}, baseCoinMint);
|
|
263
|
+
message.minter = (_a = object.minter) !== null && _a !== void 0 ? _a : "";
|
|
264
|
+
message.amount = ((_b = object.amount) !== null && _b !== void 0 ? _b : []).map((e) => coin_1.Coin.fromPartial(e));
|
|
265
|
+
return message;
|
|
266
|
+
},
|
|
267
|
+
};
|
|
268
|
+
const baseCoinBurn = { burner: "" };
|
|
269
|
+
exports.CoinBurn = {
|
|
270
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
271
|
+
if (message.burner !== "") {
|
|
272
|
+
writer.uint32(10).string(message.burner);
|
|
273
|
+
}
|
|
274
|
+
for (const v of message.amount) {
|
|
275
|
+
coin_1.Coin.encode(v, writer.uint32(18).fork()).ldelim();
|
|
276
|
+
}
|
|
277
|
+
return writer;
|
|
278
|
+
},
|
|
279
|
+
decode(input, length) {
|
|
280
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
281
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
282
|
+
const message = Object.assign({}, baseCoinBurn);
|
|
283
|
+
message.amount = [];
|
|
284
|
+
while (reader.pos < end) {
|
|
285
|
+
const tag = reader.uint32();
|
|
286
|
+
switch (tag >>> 3) {
|
|
287
|
+
case 1:
|
|
288
|
+
message.burner = reader.string();
|
|
289
|
+
break;
|
|
290
|
+
case 2:
|
|
291
|
+
message.amount.push(coin_1.Coin.decode(reader, reader.uint32()));
|
|
292
|
+
break;
|
|
293
|
+
default:
|
|
294
|
+
reader.skipType(tag & 7);
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return message;
|
|
299
|
+
},
|
|
300
|
+
fromJSON(object) {
|
|
301
|
+
var _a;
|
|
302
|
+
const message = Object.assign({}, baseCoinBurn);
|
|
303
|
+
message.burner =
|
|
304
|
+
object.burner !== undefined && object.burner !== null
|
|
305
|
+
? String(object.burner)
|
|
306
|
+
: "";
|
|
307
|
+
message.amount = ((_a = object.amount) !== null && _a !== void 0 ? _a : []).map((e) => coin_1.Coin.fromJSON(e));
|
|
308
|
+
return message;
|
|
309
|
+
},
|
|
310
|
+
toJSON(message) {
|
|
311
|
+
const obj = {};
|
|
312
|
+
message.burner !== undefined && (obj.burner = message.burner);
|
|
313
|
+
if (message.amount) {
|
|
314
|
+
obj.amount = message.amount.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined));
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
obj.amount = [];
|
|
318
|
+
}
|
|
319
|
+
return obj;
|
|
320
|
+
},
|
|
321
|
+
fromPartial(object) {
|
|
322
|
+
var _a, _b;
|
|
323
|
+
const message = Object.assign({}, baseCoinBurn);
|
|
324
|
+
message.burner = (_a = object.burner) !== null && _a !== void 0 ? _a : "";
|
|
325
|
+
message.amount = ((_b = object.amount) !== null && _b !== void 0 ? _b : []).map((e) => coin_1.Coin.fromPartial(e));
|
|
326
|
+
return message;
|
|
327
|
+
},
|
|
328
|
+
};
|
|
207
329
|
if (minimal_1.default.util.Long !== long_1.default) {
|
|
208
330
|
minimal_1.default.util.Long = long_1.default;
|
|
209
331
|
minimal_1.default.configure();
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Long from "long";
|
|
2
|
+
import _m0 from "protobufjs/minimal";
|
|
3
|
+
export declare const protobufPackage = "Switcheo.carbon.broker";
|
|
4
|
+
export interface IncomingPoolSwap {
|
|
5
|
+
poolId: Long;
|
|
6
|
+
market: string;
|
|
7
|
+
tokenATotalInput: string;
|
|
8
|
+
tokenATotalExpectedOutput: string;
|
|
9
|
+
tokenBTotalInput: string;
|
|
10
|
+
tokenBTotalExpectedOutput: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const IncomingPoolSwap: {
|
|
13
|
+
encode(message: IncomingPoolSwap, writer?: _m0.Writer): _m0.Writer;
|
|
14
|
+
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): IncomingPoolSwap;
|
|
15
|
+
fromJSON(object: any): IncomingPoolSwap;
|
|
16
|
+
toJSON(message: IncomingPoolSwap): unknown;
|
|
17
|
+
fromPartial(object: DeepPartial<IncomingPoolSwap>): IncomingPoolSwap;
|
|
18
|
+
};
|
|
19
|
+
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
20
|
+
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 {} ? {
|
|
21
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
22
|
+
} : Partial<T>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.IncomingPoolSwap = exports.protobufPackage = void 0;
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
const long_1 = __importDefault(require("long"));
|
|
9
|
+
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
10
|
+
exports.protobufPackage = "Switcheo.carbon.broker";
|
|
11
|
+
const baseIncomingPoolSwap = {
|
|
12
|
+
poolId: long_1.default.UZERO,
|
|
13
|
+
market: "",
|
|
14
|
+
tokenATotalInput: "",
|
|
15
|
+
tokenATotalExpectedOutput: "",
|
|
16
|
+
tokenBTotalInput: "",
|
|
17
|
+
tokenBTotalExpectedOutput: "",
|
|
18
|
+
};
|
|
19
|
+
exports.IncomingPoolSwap = {
|
|
20
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
21
|
+
if (!message.poolId.isZero()) {
|
|
22
|
+
writer.uint32(8).uint64(message.poolId);
|
|
23
|
+
}
|
|
24
|
+
if (message.market !== "") {
|
|
25
|
+
writer.uint32(18).string(message.market);
|
|
26
|
+
}
|
|
27
|
+
if (message.tokenATotalInput !== "") {
|
|
28
|
+
writer.uint32(26).string(message.tokenATotalInput);
|
|
29
|
+
}
|
|
30
|
+
if (message.tokenATotalExpectedOutput !== "") {
|
|
31
|
+
writer.uint32(34).string(message.tokenATotalExpectedOutput);
|
|
32
|
+
}
|
|
33
|
+
if (message.tokenBTotalInput !== "") {
|
|
34
|
+
writer.uint32(42).string(message.tokenBTotalInput);
|
|
35
|
+
}
|
|
36
|
+
if (message.tokenBTotalExpectedOutput !== "") {
|
|
37
|
+
writer.uint32(50).string(message.tokenBTotalExpectedOutput);
|
|
38
|
+
}
|
|
39
|
+
return writer;
|
|
40
|
+
},
|
|
41
|
+
decode(input, length) {
|
|
42
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
43
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
44
|
+
const message = Object.assign({}, baseIncomingPoolSwap);
|
|
45
|
+
while (reader.pos < end) {
|
|
46
|
+
const tag = reader.uint32();
|
|
47
|
+
switch (tag >>> 3) {
|
|
48
|
+
case 1:
|
|
49
|
+
message.poolId = reader.uint64();
|
|
50
|
+
break;
|
|
51
|
+
case 2:
|
|
52
|
+
message.market = reader.string();
|
|
53
|
+
break;
|
|
54
|
+
case 3:
|
|
55
|
+
message.tokenATotalInput = reader.string();
|
|
56
|
+
break;
|
|
57
|
+
case 4:
|
|
58
|
+
message.tokenATotalExpectedOutput = reader.string();
|
|
59
|
+
break;
|
|
60
|
+
case 5:
|
|
61
|
+
message.tokenBTotalInput = reader.string();
|
|
62
|
+
break;
|
|
63
|
+
case 6:
|
|
64
|
+
message.tokenBTotalExpectedOutput = reader.string();
|
|
65
|
+
break;
|
|
66
|
+
default:
|
|
67
|
+
reader.skipType(tag & 7);
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return message;
|
|
72
|
+
},
|
|
73
|
+
fromJSON(object) {
|
|
74
|
+
const message = Object.assign({}, baseIncomingPoolSwap);
|
|
75
|
+
message.poolId =
|
|
76
|
+
object.poolId !== undefined && object.poolId !== null
|
|
77
|
+
? long_1.default.fromString(object.poolId)
|
|
78
|
+
: long_1.default.UZERO;
|
|
79
|
+
message.market =
|
|
80
|
+
object.market !== undefined && object.market !== null
|
|
81
|
+
? String(object.market)
|
|
82
|
+
: "";
|
|
83
|
+
message.tokenATotalInput =
|
|
84
|
+
object.tokenATotalInput !== undefined && object.tokenATotalInput !== null
|
|
85
|
+
? String(object.tokenATotalInput)
|
|
86
|
+
: "";
|
|
87
|
+
message.tokenATotalExpectedOutput =
|
|
88
|
+
object.tokenATotalExpectedOutput !== undefined &&
|
|
89
|
+
object.tokenATotalExpectedOutput !== null
|
|
90
|
+
? String(object.tokenATotalExpectedOutput)
|
|
91
|
+
: "";
|
|
92
|
+
message.tokenBTotalInput =
|
|
93
|
+
object.tokenBTotalInput !== undefined && object.tokenBTotalInput !== null
|
|
94
|
+
? String(object.tokenBTotalInput)
|
|
95
|
+
: "";
|
|
96
|
+
message.tokenBTotalExpectedOutput =
|
|
97
|
+
object.tokenBTotalExpectedOutput !== undefined &&
|
|
98
|
+
object.tokenBTotalExpectedOutput !== null
|
|
99
|
+
? String(object.tokenBTotalExpectedOutput)
|
|
100
|
+
: "";
|
|
101
|
+
return message;
|
|
102
|
+
},
|
|
103
|
+
toJSON(message) {
|
|
104
|
+
const obj = {};
|
|
105
|
+
message.poolId !== undefined &&
|
|
106
|
+
(obj.poolId = (message.poolId || long_1.default.UZERO).toString());
|
|
107
|
+
message.market !== undefined && (obj.market = message.market);
|
|
108
|
+
message.tokenATotalInput !== undefined &&
|
|
109
|
+
(obj.tokenATotalInput = message.tokenATotalInput);
|
|
110
|
+
message.tokenATotalExpectedOutput !== undefined &&
|
|
111
|
+
(obj.tokenATotalExpectedOutput = message.tokenATotalExpectedOutput);
|
|
112
|
+
message.tokenBTotalInput !== undefined &&
|
|
113
|
+
(obj.tokenBTotalInput = message.tokenBTotalInput);
|
|
114
|
+
message.tokenBTotalExpectedOutput !== undefined &&
|
|
115
|
+
(obj.tokenBTotalExpectedOutput = message.tokenBTotalExpectedOutput);
|
|
116
|
+
return obj;
|
|
117
|
+
},
|
|
118
|
+
fromPartial(object) {
|
|
119
|
+
var _a, _b, _c, _d, _e;
|
|
120
|
+
const message = Object.assign({}, baseIncomingPoolSwap);
|
|
121
|
+
message.poolId =
|
|
122
|
+
object.poolId !== undefined && object.poolId !== null
|
|
123
|
+
? long_1.default.fromValue(object.poolId)
|
|
124
|
+
: long_1.default.UZERO;
|
|
125
|
+
message.market = (_a = object.market) !== null && _a !== void 0 ? _a : "";
|
|
126
|
+
message.tokenATotalInput = (_b = object.tokenATotalInput) !== null && _b !== void 0 ? _b : "";
|
|
127
|
+
message.tokenATotalExpectedOutput = (_c = object.tokenATotalExpectedOutput) !== null && _c !== void 0 ? _c : "";
|
|
128
|
+
message.tokenBTotalInput = (_d = object.tokenBTotalInput) !== null && _d !== void 0 ? _d : "";
|
|
129
|
+
message.tokenBTotalExpectedOutput = (_e = object.tokenBTotalExpectedOutput) !== null && _e !== void 0 ? _e : "";
|
|
130
|
+
return message;
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
if (minimal_1.default.util.Long !== long_1.default) {
|
|
134
|
+
minimal_1.default.util.Long = long_1.default;
|
|
135
|
+
minimal_1.default.configure();
|
|
136
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Long from "long";
|
|
2
|
+
import _m0 from "protobufjs/minimal";
|
|
3
|
+
export declare const protobufPackage = "Switcheo.carbon.crisis";
|
|
4
|
+
/** GenesisState defines the crisis module's genesis state. */
|
|
5
|
+
export interface GenesisState {
|
|
6
|
+
}
|
|
7
|
+
export declare const GenesisState: {
|
|
8
|
+
encode(_: GenesisState, writer?: _m0.Writer): _m0.Writer;
|
|
9
|
+
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): GenesisState;
|
|
10
|
+
fromJSON(_: any): GenesisState;
|
|
11
|
+
toJSON(_: GenesisState): unknown;
|
|
12
|
+
fromPartial(_: DeepPartial<GenesisState>): GenesisState;
|
|
13
|
+
};
|
|
14
|
+
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
15
|
+
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 {} ? {
|
|
16
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
17
|
+
} : Partial<T>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.GenesisState = exports.protobufPackage = void 0;
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
const long_1 = __importDefault(require("long"));
|
|
9
|
+
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
10
|
+
exports.protobufPackage = "Switcheo.carbon.crisis";
|
|
11
|
+
const baseGenesisState = {};
|
|
12
|
+
exports.GenesisState = {
|
|
13
|
+
encode(_, writer = minimal_1.default.Writer.create()) {
|
|
14
|
+
return writer;
|
|
15
|
+
},
|
|
16
|
+
decode(input, length) {
|
|
17
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
18
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
19
|
+
const message = Object.assign({}, baseGenesisState);
|
|
20
|
+
while (reader.pos < end) {
|
|
21
|
+
const tag = reader.uint32();
|
|
22
|
+
switch (tag >>> 3) {
|
|
23
|
+
default:
|
|
24
|
+
reader.skipType(tag & 7);
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return message;
|
|
29
|
+
},
|
|
30
|
+
fromJSON(_) {
|
|
31
|
+
const message = Object.assign({}, baseGenesisState);
|
|
32
|
+
return message;
|
|
33
|
+
},
|
|
34
|
+
toJSON(_) {
|
|
35
|
+
const obj = {};
|
|
36
|
+
return obj;
|
|
37
|
+
},
|
|
38
|
+
fromPartial(_) {
|
|
39
|
+
const message = Object.assign({}, baseGenesisState);
|
|
40
|
+
return message;
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
if (minimal_1.default.util.Long !== long_1.default) {
|
|
44
|
+
minimal_1.default.util.Long = long_1.default;
|
|
45
|
+
minimal_1.default.configure();
|
|
46
|
+
}
|