@injectivelabs/sdk-ts 1.15.42 → 1.16.1-alpha.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/dist/cjs/client/chain/grpc/ChainGrpcPeggyApi.d.ts +2 -2
- package/dist/cjs/client/chain/grpc/ChainGrpcPeggyApi.js +3 -3
- package/dist/cjs/client/chain/grpc/ChainGrpcTendermintApi.d.ts +2 -2
- package/dist/cjs/client/chain/grpc/ChainGrpcWasmXApi.d.ts +3 -3
- package/dist/cjs/client/chain/grpc/ChainGrpcWasmXApi.js +5 -5
- package/dist/cjs/client/chain/transformers/ChainGrpcPeggyTransformer.d.ts +2 -2
- package/dist/cjs/client/indexer/transformers/IndexerGrpcExplorerTransformer.d.ts +1 -1
- package/dist/cjs/client/indexer/transformers/IndexerGrpcExplorerTransformer.js +29 -32
- package/dist/cjs/core/modules/authz/msgs/authorizations/ContractExecutionCompatAuthorization.d.ts +2 -2
- package/dist/cjs/core/modules/authz/msgs/authorizations/ContractExecutionCompatAuthorization.js +3 -3
- package/dist/cjs/core/modules/gov/index.d.ts +3 -2
- package/dist/cjs/core/modules/gov/index.js +3 -1
- package/dist/cjs/core/modules/gov/msgs/MsgSubmitProposalPerpetualMarketLaunchV2.d.ts +88 -0
- package/dist/cjs/core/modules/gov/msgs/MsgSubmitProposalPerpetualMarketLaunchV2.js +174 -0
- package/dist/cjs/core/modules/peggy/msgs/MsgSendToEth.d.ts +4 -4
- package/dist/cjs/core/modules/peggy/msgs/MsgSendToEth.js +3 -3
- package/dist/cjs/core/modules/wasm/msgs/MsgExecuteContractCompat.d.ts +5 -5
- package/dist/cjs/core/modules/wasm/msgs/MsgExecuteContractCompat.js +3 -3
- package/dist/cjs/core/tx/api/TxGrpcApi.d.ts +2 -2
- package/dist/cjs/core/tx/broadcaster/MsgBroadcasterWithPk.d.ts +2 -2
- package/dist/esm/client/chain/grpc/ChainGrpcPeggyApi.d.ts +2 -2
- package/dist/esm/client/chain/grpc/ChainGrpcPeggyApi.js +4 -4
- package/dist/esm/client/chain/grpc/ChainGrpcTendermintApi.d.ts +2 -2
- package/dist/esm/client/chain/grpc/ChainGrpcWasmXApi.d.ts +3 -3
- package/dist/esm/client/chain/grpc/ChainGrpcWasmXApi.js +6 -6
- package/dist/esm/client/chain/transformers/ChainGrpcPeggyTransformer.d.ts +2 -2
- package/dist/esm/client/indexer/transformers/IndexerGrpcExplorerTransformer.d.ts +1 -1
- package/dist/esm/client/indexer/transformers/IndexerGrpcExplorerTransformer.js +29 -32
- package/dist/esm/core/modules/authz/msgs/authorizations/ContractExecutionCompatAuthorization.d.ts +2 -2
- package/dist/esm/core/modules/authz/msgs/authorizations/ContractExecutionCompatAuthorization.js +4 -4
- package/dist/esm/core/modules/gov/index.d.ts +3 -2
- package/dist/esm/core/modules/gov/index.js +2 -1
- package/dist/esm/core/modules/gov/msgs/MsgSubmitProposalPerpetualMarketLaunchV2.d.ts +88 -0
- package/dist/esm/core/modules/gov/msgs/MsgSubmitProposalPerpetualMarketLaunchV2.js +168 -0
- package/dist/esm/core/modules/peggy/msgs/MsgSendToEth.d.ts +4 -4
- package/dist/esm/core/modules/peggy/msgs/MsgSendToEth.js +4 -4
- package/dist/esm/core/modules/wasm/msgs/MsgExecuteContractCompat.d.ts +5 -5
- package/dist/esm/core/modules/wasm/msgs/MsgExecuteContractCompat.js +4 -4
- package/dist/esm/core/tx/api/TxGrpcApi.d.ts +2 -2
- package/dist/esm/core/tx/broadcaster/MsgBroadcasterWithPk.d.ts +2 -2
- package/package.json +7 -7
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InjectivePeggyV1Query } from '@injectivelabs/core-proto-ts';
|
|
2
2
|
import BaseGrpcConsumer from '../../base/BaseGrpcConsumer.js';
|
|
3
3
|
/**
|
|
4
4
|
* @category Chain Grpc API
|
|
5
5
|
*/
|
|
6
6
|
export declare class ChainGrpcPeggyApi extends BaseGrpcConsumer {
|
|
7
7
|
protected module: string;
|
|
8
|
-
protected client:
|
|
8
|
+
protected client: InjectivePeggyV1Query.QueryClientImpl;
|
|
9
9
|
constructor(endpoint: string);
|
|
10
10
|
fetchModuleParams(): Promise<import("../types/peggy.js").PeggyModuleParams>;
|
|
11
11
|
}
|
|
@@ -17,16 +17,16 @@ class ChainGrpcPeggyApi extends BaseGrpcConsumer_js_1.default {
|
|
|
17
17
|
client;
|
|
18
18
|
constructor(endpoint) {
|
|
19
19
|
super(endpoint);
|
|
20
|
-
this.client = new core_proto_ts_1.
|
|
20
|
+
this.client = new core_proto_ts_1.InjectivePeggyV1Query.QueryClientImpl(this.getGrpcWebImpl(endpoint));
|
|
21
21
|
}
|
|
22
22
|
async fetchModuleParams() {
|
|
23
|
-
const request = core_proto_ts_1.
|
|
23
|
+
const request = core_proto_ts_1.InjectivePeggyV1Query.QueryParamsRequest.create();
|
|
24
24
|
try {
|
|
25
25
|
const response = await this.retry(() => this.client.Params(request, this.metadata));
|
|
26
26
|
return index_js_2.ChainGrpcPeggyTransformer.moduleParamsResponseToModuleParams(response);
|
|
27
27
|
}
|
|
28
28
|
catch (e) {
|
|
29
|
-
if (e instanceof core_proto_ts_1.
|
|
29
|
+
if (e instanceof core_proto_ts_1.InjectivePeggyV1Query.GrpcWebError) {
|
|
30
30
|
throw new exceptions_1.GrpcUnaryRequestException(new Error(e.toString()), {
|
|
31
31
|
code: (0, exceptions_1.grpcErrorCodeToErrorCode)(e.code),
|
|
32
32
|
context: 'Params',
|
|
@@ -7,6 +7,6 @@ export declare class ChainGrpcTendermintApi extends BaseGrpcConsumer {
|
|
|
7
7
|
protected module: string;
|
|
8
8
|
protected client: CosmosBaseTendermintV1Beta1Query.ServiceClientImpl;
|
|
9
9
|
constructor(endpoint: string);
|
|
10
|
-
fetchLatestBlock(): Promise<import("@injectivelabs/core-proto-ts/cjs/cosmos/base/tendermint/v1beta1/types.js").Block | import("@injectivelabs/core-proto-ts/cjs/
|
|
11
|
-
fetchBlock(height: number | string): Promise<import("@injectivelabs/core-proto-ts/cjs/cosmos/base/tendermint/v1beta1/types.js").Block | import("@injectivelabs/core-proto-ts/cjs/
|
|
10
|
+
fetchLatestBlock(): Promise<import("@injectivelabs/core-proto-ts/cjs/cosmos/base/tendermint/v1beta1/types.js").Block | import("@injectivelabs/core-proto-ts/cjs/cometbft/types/v1/block.js").Block | undefined>;
|
|
11
|
+
fetchBlock(height: number | string): Promise<import("@injectivelabs/core-proto-ts/cjs/cosmos/base/tendermint/v1beta1/types.js").Block | import("@injectivelabs/core-proto-ts/cjs/cometbft/types/v1/block.js").Block | undefined>;
|
|
12
12
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InjectiveWasmxV1Query } from '@injectivelabs/core-proto-ts';
|
|
2
2
|
import BaseGrpcConsumer from '../../base/BaseGrpcConsumer.js';
|
|
3
3
|
/**
|
|
4
4
|
* @category Chain Grpc API
|
|
5
5
|
*/
|
|
6
6
|
export declare class ChainGrpcWasmXApi extends BaseGrpcConsumer {
|
|
7
7
|
protected module: string;
|
|
8
|
-
protected client:
|
|
8
|
+
protected client: InjectiveWasmxV1Query.QueryClientImpl;
|
|
9
9
|
constructor(endpoint: string);
|
|
10
|
-
fetchModuleParams(): Promise<
|
|
10
|
+
fetchModuleParams(): Promise<InjectiveWasmxV1Query.QueryWasmxParamsResponse>;
|
|
11
11
|
fetchModuleState(): Promise<import("@injectivelabs/core-proto-ts/cjs/injective/wasmx/v1/genesis.js").GenesisState | undefined>;
|
|
12
12
|
}
|
|
@@ -16,16 +16,16 @@ class ChainGrpcWasmXApi extends BaseGrpcConsumer_js_1.default {
|
|
|
16
16
|
client;
|
|
17
17
|
constructor(endpoint) {
|
|
18
18
|
super(endpoint);
|
|
19
|
-
this.client = new core_proto_ts_1.
|
|
19
|
+
this.client = new core_proto_ts_1.InjectiveWasmxV1Query.QueryClientImpl(this.getGrpcWebImpl(endpoint));
|
|
20
20
|
}
|
|
21
21
|
async fetchModuleParams() {
|
|
22
|
-
const request = core_proto_ts_1.
|
|
22
|
+
const request = core_proto_ts_1.InjectiveWasmxV1Query.QueryWasmxParamsRequest.create();
|
|
23
23
|
try {
|
|
24
24
|
const response = await this.retry(() => this.client.WasmxParams(request, this.metadata));
|
|
25
25
|
return response;
|
|
26
26
|
}
|
|
27
27
|
catch (e) {
|
|
28
|
-
if (e instanceof core_proto_ts_1.
|
|
28
|
+
if (e instanceof core_proto_ts_1.InjectiveWasmxV1Query.GrpcWebError) {
|
|
29
29
|
throw new exceptions_1.GrpcUnaryRequestException(new Error(e.toString()), {
|
|
30
30
|
code: (0, exceptions_1.grpcErrorCodeToErrorCode)(e.code),
|
|
31
31
|
context: 'WasmxParams',
|
|
@@ -40,13 +40,13 @@ class ChainGrpcWasmXApi extends BaseGrpcConsumer_js_1.default {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
async fetchModuleState() {
|
|
43
|
-
const request = core_proto_ts_1.
|
|
43
|
+
const request = core_proto_ts_1.InjectiveWasmxV1Query.QueryModuleStateRequest.create();
|
|
44
44
|
try {
|
|
45
45
|
const response = await this.retry(() => this.client.WasmxModuleState(request, this.metadata));
|
|
46
46
|
return response.state; /* TODO */
|
|
47
47
|
}
|
|
48
48
|
catch (e) {
|
|
49
|
-
if (e instanceof core_proto_ts_1.
|
|
49
|
+
if (e instanceof core_proto_ts_1.InjectiveWasmxV1Query.GrpcWebError) {
|
|
50
50
|
throw new exceptions_1.GrpcUnaryRequestException(new Error(e.toString()), {
|
|
51
51
|
code: (0, exceptions_1.grpcErrorCodeToErrorCode)(e.code),
|
|
52
52
|
context: 'WasmxModuleState',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PeggyModuleParams } from '../types/peggy.js';
|
|
2
|
-
import {
|
|
2
|
+
import { InjectivePeggyV1Query } from '@injectivelabs/core-proto-ts';
|
|
3
3
|
/**
|
|
4
4
|
* @category Chain Grpc Transformer
|
|
5
5
|
*/
|
|
6
6
|
export declare class ChainGrpcPeggyTransformer {
|
|
7
|
-
static moduleParamsResponseToModuleParams(response:
|
|
7
|
+
static moduleParamsResponseToModuleParams(response: InjectivePeggyV1Query.QueryParamsResponse): PeggyModuleParams;
|
|
8
8
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Block, GasFee, GrpcGasFee, Transaction, BlockWithTxs, IBCTransferTx, ExplorerStats, PeggyDepositTx, ValidatorUptime, ExplorerValidator, PeggyWithdrawalTx, GrpcIBCTransferTx, GrpcPeggyDepositTx, GrpcValidatorUptime, GrpcPeggyWithdrawalTx, BankMsgSendTransaction, ValidatorSlashingEvent, IndexerStreamTransaction, GrpcValidatorSlashingEvent, ExplorerValidatorDescription, GrpcIndexerValidatorDescription
|
|
1
|
+
import { Block, GasFee, GrpcGasFee, Transaction, BlockWithTxs, IBCTransferTx, ExplorerStats, PeggyDepositTx, ValidatorUptime, ExplorerValidator, PeggyWithdrawalTx, GrpcIBCTransferTx, GrpcPeggyDepositTx, GrpcValidatorUptime, GrpcPeggyWithdrawalTx, BankMsgSendTransaction, ValidatorSlashingEvent, ExplorerTransaction, ContractTransaction, IndexerStreamTransaction, GrpcValidatorSlashingEvent, ExplorerValidatorDescription, GrpcIndexerValidatorDescription } from '../types/explorer.js';
|
|
2
2
|
import { InjectiveExplorerRpc } from '@injectivelabs/indexer-proto-ts';
|
|
3
3
|
/**
|
|
4
4
|
* @category Indexer Grpc Transformer
|
|
@@ -21,18 +21,32 @@ const getContractTransactionV2Amount = (ApiTransaction) => {
|
|
|
21
21
|
}
|
|
22
22
|
return new utils_1.BigNumberInWei(msgObj.transfer.amount).toBase();
|
|
23
23
|
};
|
|
24
|
-
const
|
|
24
|
+
const parseStringToObjectLikeNoThrow = (object, defaultValue = []) => {
|
|
25
|
+
if (!object) {
|
|
26
|
+
return defaultValue;
|
|
27
|
+
}
|
|
28
|
+
if (typeof object === 'string') {
|
|
29
|
+
try {
|
|
30
|
+
return JSON.parse(object);
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
return defaultValue;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
25
36
|
try {
|
|
26
|
-
return JSON.parse(Buffer.from(
|
|
27
|
-
type: msg.type,
|
|
28
|
-
message: msg.value,
|
|
29
|
-
}));
|
|
37
|
+
return JSON.parse(Buffer.from(object).toString('utf8'));
|
|
30
38
|
}
|
|
31
|
-
catch (
|
|
32
|
-
|
|
33
|
-
return []; // Return an empty array in case of error
|
|
39
|
+
catch (e) {
|
|
40
|
+
return defaultValue;
|
|
34
41
|
}
|
|
35
42
|
};
|
|
43
|
+
const transactionV2MessagesToMessagesNoThrow = (messages) => {
|
|
44
|
+
const messagesArray = parseStringToObjectLikeNoThrow(messages);
|
|
45
|
+
return messagesArray.map((msg) => ({
|
|
46
|
+
type: msg.type,
|
|
47
|
+
message: msg.value,
|
|
48
|
+
}));
|
|
49
|
+
};
|
|
36
50
|
/**
|
|
37
51
|
* @category Indexer Grpc Transformer
|
|
38
52
|
*/
|
|
@@ -321,16 +335,9 @@ class IndexerGrpcExplorerTransformer {
|
|
|
321
335
|
};
|
|
322
336
|
}
|
|
323
337
|
static grpcTxV2ToTransaction(tx) {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
logs = JSON.parse(rawLogs || '[]');
|
|
328
|
-
}
|
|
329
|
-
catch (e) {
|
|
330
|
-
console.error('Failed to parse logs');
|
|
331
|
-
logs = [];
|
|
332
|
-
}
|
|
333
|
-
const txType = JSON.parse(Buffer.from(tx.txMsgTypes).toString('utf8'));
|
|
338
|
+
const logs = parseStringToObjectLikeNoThrow(tx.logs);
|
|
339
|
+
const txType = parseStringToObjectLikeNoThrow(tx.txMsgTypes);
|
|
340
|
+
const messages = transactionV2MessagesToMessagesNoThrow(tx.messages);
|
|
334
341
|
const signatures = tx.signatures.map((signature) => ({
|
|
335
342
|
address: signature.address,
|
|
336
343
|
pubkey: signature.pubkey,
|
|
@@ -340,7 +347,6 @@ class IndexerGrpcExplorerTransformer {
|
|
|
340
347
|
return parseInt(signature.sequence, 10);
|
|
341
348
|
}
|
|
342
349
|
catch (e) {
|
|
343
|
-
console.error('Failed to parse signature sequence:', e);
|
|
344
350
|
return 0;
|
|
345
351
|
}
|
|
346
352
|
})(),
|
|
@@ -350,24 +356,14 @@ class IndexerGrpcExplorerTransformer {
|
|
|
350
356
|
return parseInt(claimId, 10);
|
|
351
357
|
}
|
|
352
358
|
catch (e) {
|
|
353
|
-
console.error('Failed to parse claimId:', e);
|
|
354
359
|
return 0;
|
|
355
360
|
}
|
|
356
361
|
});
|
|
357
|
-
let messages = [];
|
|
358
|
-
try {
|
|
359
|
-
messages = transactionV2MessagesToMessages(tx.messages);
|
|
360
|
-
}
|
|
361
|
-
catch (e) {
|
|
362
|
-
console.error('Failed to parse messages:', e);
|
|
363
|
-
messages = [];
|
|
364
|
-
}
|
|
365
362
|
const blockNumber = parseInt(tx.blockNumber);
|
|
366
363
|
return {
|
|
367
364
|
logs,
|
|
368
365
|
info: '',
|
|
369
366
|
memo: '',
|
|
370
|
-
txType,
|
|
371
367
|
claimIds,
|
|
372
368
|
messages,
|
|
373
369
|
id: tx.id,
|
|
@@ -380,6 +376,7 @@ class IndexerGrpcExplorerTransformer {
|
|
|
380
376
|
errorLog: tx.errorLog,
|
|
381
377
|
codespace: tx.codespace,
|
|
382
378
|
blockTimestamp: tx.blockTimestamp,
|
|
379
|
+
txType: Array.isArray(txType) ? txType.join(',') : txType,
|
|
383
380
|
gasFee: { amounts: [], gasLimit: 0, granter: '', payer: '' },
|
|
384
381
|
};
|
|
385
382
|
}
|
|
@@ -419,8 +416,8 @@ class IndexerGrpcExplorerTransformer {
|
|
|
419
416
|
signature: signature.signature,
|
|
420
417
|
sequence: parseInt(signature.sequence, 10),
|
|
421
418
|
})),
|
|
422
|
-
messages:
|
|
423
|
-
logs:
|
|
419
|
+
messages: transactionV2MessagesToMessagesNoThrow(tx.messages),
|
|
420
|
+
logs: parseStringToObjectLikeNoThrow(tx.logs),
|
|
424
421
|
data: '/' + Buffer.from(tx.data).toString('utf8').split('/').pop(),
|
|
425
422
|
claimIds: tx.claimIds.map((claimId) => parseInt(claimId, 10)),
|
|
426
423
|
};
|
|
@@ -450,7 +447,7 @@ class IndexerGrpcExplorerTransformer {
|
|
|
450
447
|
};
|
|
451
448
|
}
|
|
452
449
|
static grpcContractTxV2ToTransaction(tx) {
|
|
453
|
-
const messages =
|
|
450
|
+
const messages = transactionV2MessagesToMessagesNoThrow(tx.messages);
|
|
454
451
|
return {
|
|
455
452
|
messages,
|
|
456
453
|
code: tx.code,
|
package/dist/cjs/core/modules/authz/msgs/authorizations/ContractExecutionCompatAuthorization.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Coin } from '@injectivelabs/ts-types';
|
|
2
|
-
import { GoogleProtobufAny,
|
|
2
|
+
import { GoogleProtobufAny, InjectiveWasmxV1Authz } from '@injectivelabs/core-proto-ts';
|
|
3
3
|
import { BaseAuthorization } from './Base.js';
|
|
4
4
|
export declare namespace ContractExecutionCompatAuthorization {
|
|
5
5
|
interface Params {
|
|
@@ -13,7 +13,7 @@ export declare namespace ContractExecutionCompatAuthorization {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
type Any = GoogleProtobufAny.Any;
|
|
16
|
-
type Proto =
|
|
16
|
+
type Proto = InjectiveWasmxV1Authz.ContractExecutionCompatAuthorization;
|
|
17
17
|
type Amino = Object;
|
|
18
18
|
}
|
|
19
19
|
/**
|
package/dist/cjs/core/modules/authz/msgs/authorizations/ContractExecutionCompatAuthorization.js
CHANGED
|
@@ -11,7 +11,7 @@ class ContractExecutionCompatAuthorization extends Base_js_1.BaseAuthorization {
|
|
|
11
11
|
}
|
|
12
12
|
toAny() {
|
|
13
13
|
const { params } = this;
|
|
14
|
-
const authorization = core_proto_ts_1.
|
|
14
|
+
const authorization = core_proto_ts_1.InjectiveWasmxV1Authz.ContractExecutionCompatAuthorization.create();
|
|
15
15
|
const grant = core_proto_ts_1.CosmwasmWasmV1Authz.ContractGrant.create();
|
|
16
16
|
grant.contract = params.contract;
|
|
17
17
|
if (params.limit) {
|
|
@@ -62,11 +62,11 @@ class ContractExecutionCompatAuthorization extends Base_js_1.BaseAuthorization {
|
|
|
62
62
|
const any = core_proto_ts_1.GoogleProtobufAny.Any.create();
|
|
63
63
|
any.typeUrl = '/injective.wasmx.v1.ContractExecutionCompatAuthorization';
|
|
64
64
|
any.value =
|
|
65
|
-
core_proto_ts_1.
|
|
65
|
+
core_proto_ts_1.InjectiveWasmxV1Authz.ContractExecutionCompatAuthorization.encode(authorization).finish();
|
|
66
66
|
return any;
|
|
67
67
|
}
|
|
68
68
|
toProto() {
|
|
69
|
-
const authorization = core_proto_ts_1.
|
|
69
|
+
const authorization = core_proto_ts_1.InjectiveWasmxV1Authz.ContractExecutionCompatAuthorization.decode(this.toAny().value);
|
|
70
70
|
return authorization;
|
|
71
71
|
}
|
|
72
72
|
toAmino() {
|
|
@@ -6,7 +6,8 @@ import MsgSubmitProposalSpotMarketLaunch from './msgs/MsgSubmitProposalSpotMarke
|
|
|
6
6
|
import MsgSubmitProposalPerpetualMarketLaunch from './msgs/MsgSubmitProposalPerpetualMarketLaunch.js';
|
|
7
7
|
import MsgSubmitProposalSpotMarketParamUpdate from './msgs/MsgSubmitProposalSpotMarketParamUpdate.js';
|
|
8
8
|
import MsgSubmitProposalExpiryFuturesMarketLaunch from './msgs/MsgSubmitProposalExpiryFuturesMarketLaunch.js';
|
|
9
|
-
|
|
10
|
-
export
|
|
9
|
+
import MsgSubmitProposalPerpetualMarketLaunchV2 from './msgs/MsgSubmitProposalPerpetualMarketLaunchV2.js';
|
|
10
|
+
export type MsgSubmitProposal = MsgSubmitTextProposal | MsgSubmitGenericProposal | MsgSubmitProposalSpotMarketLaunch | MsgSubmitProposalPerpetualMarketLaunch | MsgSubmitProposalSpotMarketParamUpdate | MsgSubmitProposalPerpetualMarketLaunchV2 | MsgSubmitProposalExpiryFuturesMarketLaunch;
|
|
11
|
+
export { MsgSubmitTextProposal, MsgSubmitGenericProposal, MsgSubmitProposalSpotMarketLaunch, MsgSubmitProposalPerpetualMarketLaunch, MsgSubmitProposalSpotMarketParamUpdate, MsgSubmitProposalPerpetualMarketLaunchV2, MsgSubmitProposalExpiryFuturesMarketLaunch, };
|
|
11
12
|
export * from './ProposalContentDecomposer.js';
|
|
12
13
|
export { MsgVote, MsgGovDeposit };
|
|
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.MsgGovDeposit = exports.MsgVote = exports.MsgSubmitProposalExpiryFuturesMarketLaunch = exports.MsgSubmitProposalSpotMarketParamUpdate = exports.MsgSubmitProposalPerpetualMarketLaunch = exports.MsgSubmitProposalSpotMarketLaunch = exports.MsgSubmitGenericProposal = exports.MsgSubmitTextProposal = void 0;
|
|
20
|
+
exports.MsgGovDeposit = exports.MsgVote = exports.MsgSubmitProposalExpiryFuturesMarketLaunch = exports.MsgSubmitProposalPerpetualMarketLaunchV2 = exports.MsgSubmitProposalSpotMarketParamUpdate = exports.MsgSubmitProposalPerpetualMarketLaunch = exports.MsgSubmitProposalSpotMarketLaunch = exports.MsgSubmitGenericProposal = exports.MsgSubmitTextProposal = void 0;
|
|
21
21
|
const MsgVote_js_1 = __importDefault(require("./msgs/MsgVote.js"));
|
|
22
22
|
exports.MsgVote = MsgVote_js_1.default;
|
|
23
23
|
const MsgDeposit_js_1 = __importDefault(require("./msgs/MsgDeposit.js"));
|
|
@@ -34,4 +34,6 @@ const MsgSubmitProposalSpotMarketParamUpdate_js_1 = __importDefault(require("./m
|
|
|
34
34
|
exports.MsgSubmitProposalSpotMarketParamUpdate = MsgSubmitProposalSpotMarketParamUpdate_js_1.default;
|
|
35
35
|
const MsgSubmitProposalExpiryFuturesMarketLaunch_js_1 = __importDefault(require("./msgs/MsgSubmitProposalExpiryFuturesMarketLaunch.js"));
|
|
36
36
|
exports.MsgSubmitProposalExpiryFuturesMarketLaunch = MsgSubmitProposalExpiryFuturesMarketLaunch_js_1.default;
|
|
37
|
+
const MsgSubmitProposalPerpetualMarketLaunchV2_js_1 = __importDefault(require("./msgs/MsgSubmitProposalPerpetualMarketLaunchV2.js"));
|
|
38
|
+
exports.MsgSubmitProposalPerpetualMarketLaunchV2 = MsgSubmitProposalPerpetualMarketLaunchV2_js_1.default;
|
|
37
39
|
__exportStar(require("./ProposalContentDecomposer.js"), exports);
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { GoogleProtobufAny, CosmosGovV1Beta1Tx, CosmosBaseV1Beta1Coin, InjectiveOracleV1Beta1Oracle } from '@injectivelabs/core-proto-ts';
|
|
2
|
+
import { SnakeCaseKeys } from 'snakecase-keys';
|
|
3
|
+
import { MsgBase } from '../../MsgBase.js';
|
|
4
|
+
export declare namespace MsgSubmitProposalPerpetualMarketLaunchV2 {
|
|
5
|
+
interface Params {
|
|
6
|
+
market: {
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
ticker: string;
|
|
10
|
+
quoteDenom: string;
|
|
11
|
+
oracleBase: string;
|
|
12
|
+
oracleQuote: string;
|
|
13
|
+
oracleScaleFactor: number;
|
|
14
|
+
oracleType: InjectiveOracleV1Beta1Oracle.OracleType;
|
|
15
|
+
initialMarginRatio: string;
|
|
16
|
+
maintenanceMarginRatio: string;
|
|
17
|
+
makerFeeRate: string;
|
|
18
|
+
takerFeeRate: string;
|
|
19
|
+
minPriceTickSize: string;
|
|
20
|
+
minQuantityTickSize: string;
|
|
21
|
+
minNotional: string;
|
|
22
|
+
reduceMarginRatio: string;
|
|
23
|
+
adminInfo?: {
|
|
24
|
+
admin: string;
|
|
25
|
+
adminPermissions: number;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
proposer: string;
|
|
29
|
+
deposit: {
|
|
30
|
+
amount: string;
|
|
31
|
+
denom: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
type Proto = CosmosGovV1Beta1Tx.MsgSubmitProposal;
|
|
35
|
+
type Object = Omit<CosmosGovV1Beta1Tx.MsgSubmitProposal, 'content'> & {
|
|
36
|
+
content: {
|
|
37
|
+
type_url: string;
|
|
38
|
+
value: any;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @category Messages
|
|
44
|
+
*/
|
|
45
|
+
export default class MsgSubmitProposalPerpetualMarketLaunchV2 extends MsgBase<MsgSubmitProposalPerpetualMarketLaunchV2.Params, MsgSubmitProposalPerpetualMarketLaunchV2.Proto, MsgSubmitProposalPerpetualMarketLaunchV2.Object> {
|
|
46
|
+
static fromJSON(params: MsgSubmitProposalPerpetualMarketLaunchV2.Params): MsgSubmitProposalPerpetualMarketLaunchV2;
|
|
47
|
+
toProto(): CosmosGovV1Beta1Tx.MsgSubmitProposal;
|
|
48
|
+
toData(): {
|
|
49
|
+
content: GoogleProtobufAny.Any | undefined;
|
|
50
|
+
initialDeposit: CosmosBaseV1Beta1Coin.Coin[];
|
|
51
|
+
proposer: string;
|
|
52
|
+
'@type': string;
|
|
53
|
+
};
|
|
54
|
+
toAmino(): {
|
|
55
|
+
type: string;
|
|
56
|
+
value: SnakeCaseKeys<MsgSubmitProposalPerpetualMarketLaunchV2.Object>;
|
|
57
|
+
};
|
|
58
|
+
toWeb3Gw(): {
|
|
59
|
+
initial_deposit: {
|
|
60
|
+
denom: string;
|
|
61
|
+
amount: string;
|
|
62
|
+
}[];
|
|
63
|
+
proposer: string;
|
|
64
|
+
content: {
|
|
65
|
+
type_url: string;
|
|
66
|
+
value: any;
|
|
67
|
+
};
|
|
68
|
+
'@type': string;
|
|
69
|
+
};
|
|
70
|
+
toEip712(): {
|
|
71
|
+
type: string;
|
|
72
|
+
value: SnakeCaseKeys<MsgSubmitProposalPerpetualMarketLaunchV2.Object>;
|
|
73
|
+
};
|
|
74
|
+
toEip712V2(): {
|
|
75
|
+
content: any;
|
|
76
|
+
initial_deposit: {
|
|
77
|
+
denom: string;
|
|
78
|
+
amount: string;
|
|
79
|
+
}[];
|
|
80
|
+
proposer: string;
|
|
81
|
+
'@type': string;
|
|
82
|
+
};
|
|
83
|
+
toDirectSign(): {
|
|
84
|
+
type: string;
|
|
85
|
+
message: CosmosGovV1Beta1Tx.MsgSubmitProposal;
|
|
86
|
+
};
|
|
87
|
+
toBinary(): Uint8Array;
|
|
88
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
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
|
+
const core_proto_ts_1 = require("@injectivelabs/core-proto-ts");
|
|
7
|
+
const snakecase_keys_1 = __importDefault(require("snakecase-keys"));
|
|
8
|
+
const MsgBase_js_1 = require("../../MsgBase.js");
|
|
9
|
+
const numbers_js_1 = require("../../../../utils/numbers.js");
|
|
10
|
+
const createPerpetualMarketLaunch = (params) => {
|
|
11
|
+
const content = core_proto_ts_1.InjectiveExchangeV2Proposal.PerpetualMarketLaunchProposal.create();
|
|
12
|
+
content.title = params.market.title;
|
|
13
|
+
content.description = params.market.description;
|
|
14
|
+
content.ticker = params.market.ticker;
|
|
15
|
+
content.quoteDenom = params.market.quoteDenom;
|
|
16
|
+
content.oracleBase = params.market.oracleBase;
|
|
17
|
+
content.oracleQuote = params.market.oracleQuote;
|
|
18
|
+
content.oracleScaleFactor = params.market.oracleScaleFactor;
|
|
19
|
+
content.oracleType = params.market.oracleType;
|
|
20
|
+
content.initialMarginRatio = params.market.initialMarginRatio;
|
|
21
|
+
content.maintenanceMarginRatio = params.market.maintenanceMarginRatio;
|
|
22
|
+
content.makerFeeRate = params.market.makerFeeRate;
|
|
23
|
+
content.takerFeeRate = params.market.takerFeeRate;
|
|
24
|
+
content.minPriceTickSize = params.market.minPriceTickSize;
|
|
25
|
+
content.minQuantityTickSize = params.market.minQuantityTickSize;
|
|
26
|
+
content.minNotional = params.market.minNotional;
|
|
27
|
+
content.reduceMarginRatio = params.market.reduceMarginRatio;
|
|
28
|
+
if (params.market.adminInfo) {
|
|
29
|
+
const adminInfo = core_proto_ts_1.InjectiveExchangeV2Proposal.AdminInfo.create();
|
|
30
|
+
adminInfo.admin = params.market.adminInfo.admin;
|
|
31
|
+
adminInfo.adminPermissions = params.market.adminInfo.adminPermissions;
|
|
32
|
+
content.adminInfo = adminInfo;
|
|
33
|
+
}
|
|
34
|
+
return core_proto_ts_1.InjectiveExchangeV2Proposal.PerpetualMarketLaunchProposal.fromPartial(content);
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* @category Messages
|
|
38
|
+
*/
|
|
39
|
+
class MsgSubmitProposalPerpetualMarketLaunchV2 extends MsgBase_js_1.MsgBase {
|
|
40
|
+
static fromJSON(params) {
|
|
41
|
+
return new MsgSubmitProposalPerpetualMarketLaunchV2(params);
|
|
42
|
+
}
|
|
43
|
+
toProto() {
|
|
44
|
+
const { params: initialParams } = this;
|
|
45
|
+
const params = {
|
|
46
|
+
...initialParams,
|
|
47
|
+
market: {
|
|
48
|
+
...initialParams.market,
|
|
49
|
+
initialMarginRatio: (0, numbers_js_1.amountToCosmosSdkDecAmount)(initialParams.market.initialMarginRatio).toFixed(),
|
|
50
|
+
maintenanceMarginRatio: (0, numbers_js_1.amountToCosmosSdkDecAmount)(initialParams.market.maintenanceMarginRatio).toFixed(),
|
|
51
|
+
makerFeeRate: (0, numbers_js_1.amountToCosmosSdkDecAmount)(initialParams.market.makerFeeRate).toFixed(),
|
|
52
|
+
takerFeeRate: (0, numbers_js_1.amountToCosmosSdkDecAmount)(initialParams.market.takerFeeRate).toFixed(),
|
|
53
|
+
minQuantityTickSize: (0, numbers_js_1.amountToCosmosSdkDecAmount)(initialParams.market.minQuantityTickSize).toFixed(),
|
|
54
|
+
minNotional: (0, numbers_js_1.amountToCosmosSdkDecAmount)(initialParams.market.minNotional).toFixed(),
|
|
55
|
+
reduceMarginRatio: (0, numbers_js_1.amountToCosmosSdkDecAmount)(initialParams.market.reduceMarginRatio).toFixed(),
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
const depositParams = core_proto_ts_1.CosmosBaseV1Beta1Coin.Coin.create();
|
|
59
|
+
depositParams.denom = params.deposit.denom;
|
|
60
|
+
depositParams.amount = params.deposit.amount;
|
|
61
|
+
const contentAny = core_proto_ts_1.GoogleProtobufAny.Any.create();
|
|
62
|
+
contentAny.typeUrl =
|
|
63
|
+
'/injective.exchange.v1beta1.PerpetualMarketLaunchProposal';
|
|
64
|
+
contentAny.value =
|
|
65
|
+
core_proto_ts_1.InjectiveExchangeV2Proposal.PerpetualMarketLaunchProposal.encode(createPerpetualMarketLaunch(params)).finish();
|
|
66
|
+
const message = core_proto_ts_1.CosmosGovV1Beta1Tx.MsgSubmitProposal.create();
|
|
67
|
+
message.content = contentAny;
|
|
68
|
+
message.initialDeposit = [depositParams];
|
|
69
|
+
message.proposer = params.proposer;
|
|
70
|
+
return core_proto_ts_1.CosmosGovV1Beta1Tx.MsgSubmitProposal.fromPartial(message);
|
|
71
|
+
}
|
|
72
|
+
toData() {
|
|
73
|
+
const proto = this.toProto();
|
|
74
|
+
return {
|
|
75
|
+
'@type': '/cosmos.gov.v1beta1.MsgSubmitProposal',
|
|
76
|
+
...proto,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
toAmino() {
|
|
80
|
+
const { params } = this;
|
|
81
|
+
const content = createPerpetualMarketLaunch(params);
|
|
82
|
+
const messageWithProposalType = (0, snakecase_keys_1.default)({
|
|
83
|
+
content: {
|
|
84
|
+
type: 'exchange/PerpetualMarketLaunchProposal',
|
|
85
|
+
value: content,
|
|
86
|
+
},
|
|
87
|
+
initial_deposit: [
|
|
88
|
+
{
|
|
89
|
+
denom: params.deposit.denom,
|
|
90
|
+
amount: params.deposit.amount,
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
proposer: params.proposer,
|
|
94
|
+
});
|
|
95
|
+
return {
|
|
96
|
+
type: 'cosmos-sdk/MsgSubmitProposal',
|
|
97
|
+
value: messageWithProposalType,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
toWeb3Gw() {
|
|
101
|
+
const amino = this.toAmino();
|
|
102
|
+
const { value } = amino;
|
|
103
|
+
const messageWithProposalType = {
|
|
104
|
+
...value,
|
|
105
|
+
content: {
|
|
106
|
+
'@type': '/injective.exchange.v1beta1.PerpetualMarketLaunchProposal',
|
|
107
|
+
...value.content.value,
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
return {
|
|
111
|
+
'@type': '/cosmos.gov.v1beta1.MsgSubmitProposal',
|
|
112
|
+
...messageWithProposalType,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
toEip712() {
|
|
116
|
+
const { params } = this;
|
|
117
|
+
const amino = this.toAmino();
|
|
118
|
+
const { value, type } = amino;
|
|
119
|
+
const messageAdjusted = {
|
|
120
|
+
...value,
|
|
121
|
+
content: {
|
|
122
|
+
type: 'exchange/PerpetualMarketLaunchProposal',
|
|
123
|
+
value: {
|
|
124
|
+
...value.content.value,
|
|
125
|
+
initial_margin_ratio: (0, numbers_js_1.amountToCosmosSdkDecAmount)(params.market.initialMarginRatio).toFixed(),
|
|
126
|
+
maintenance_margin_ratio: (0, numbers_js_1.amountToCosmosSdkDecAmount)(params.market.maintenanceMarginRatio).toFixed(),
|
|
127
|
+
maker_fee_rate: (0, numbers_js_1.amountToCosmosSdkDecAmount)(params.market.makerFeeRate).toFixed(),
|
|
128
|
+
taker_fee_rate: (0, numbers_js_1.amountToCosmosSdkDecAmount)(params.market.takerFeeRate).toFixed(),
|
|
129
|
+
min_price_tick_size: (0, numbers_js_1.amountToCosmosSdkDecAmount)(params.market.minPriceTickSize).toFixed(),
|
|
130
|
+
min_notional: (0, numbers_js_1.amountToCosmosSdkDecAmount)(params.market.minNotional).toFixed(),
|
|
131
|
+
min_quantity_tick_size: (0, numbers_js_1.amountToCosmosSdkDecAmount)(params.market.minQuantityTickSize).toFixed(),
|
|
132
|
+
reduce_margin_ratio: (0, numbers_js_1.amountToCosmosSdkDecAmount)(params.market.reduceMarginRatio).toFixed(),
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
return {
|
|
137
|
+
type,
|
|
138
|
+
value: messageAdjusted,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
toEip712V2() {
|
|
142
|
+
const { params } = this;
|
|
143
|
+
const web3gw = this.toWeb3Gw();
|
|
144
|
+
const content = web3gw.content;
|
|
145
|
+
const messageAdjusted = {
|
|
146
|
+
...web3gw,
|
|
147
|
+
content: {
|
|
148
|
+
...content,
|
|
149
|
+
oracle_type: core_proto_ts_1.InjectiveOracleV1Beta1Oracle.oracleTypeToJSON(content.oracle_type),
|
|
150
|
+
initial_margin_ratio: (0, numbers_js_1.numberToCosmosSdkDecString)(params.market.initialMarginRatio),
|
|
151
|
+
maintenance_margin_ratio: (0, numbers_js_1.numberToCosmosSdkDecString)(params.market.maintenanceMarginRatio),
|
|
152
|
+
maker_fee_rate: (0, numbers_js_1.numberToCosmosSdkDecString)(params.market.makerFeeRate),
|
|
153
|
+
taker_fee_rate: (0, numbers_js_1.numberToCosmosSdkDecString)(params.market.takerFeeRate),
|
|
154
|
+
min_price_tick_size: (0, numbers_js_1.numberToCosmosSdkDecString)(params.market.minPriceTickSize),
|
|
155
|
+
min_notional: (0, numbers_js_1.numberToCosmosSdkDecString)(params.market.minNotional),
|
|
156
|
+
min_quantity_tick_size: (0, numbers_js_1.numberToCosmosSdkDecString)(params.market.minQuantityTickSize),
|
|
157
|
+
admin_info: content.admin_info || null,
|
|
158
|
+
reduce_margin_ratio: (0, numbers_js_1.numberToCosmosSdkDecString)(params.market.reduceMarginRatio),
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
return messageAdjusted;
|
|
162
|
+
}
|
|
163
|
+
toDirectSign() {
|
|
164
|
+
const proto = this.toProto();
|
|
165
|
+
return {
|
|
166
|
+
type: '/cosmos.gov.v1beta1.MsgSubmitProposal',
|
|
167
|
+
message: proto,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
toBinary() {
|
|
171
|
+
return core_proto_ts_1.CosmosGovV1Beta1Tx.MsgSubmitProposal.encode(this.toProto()).finish();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
exports.default = MsgSubmitProposalPerpetualMarketLaunchV2;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MsgBase } from '../../MsgBase.js';
|
|
2
|
-
import {
|
|
2
|
+
import { InjectivePeggyV1Msgs, CosmosBaseV1Beta1Coin } from '@injectivelabs/core-proto-ts';
|
|
3
3
|
export declare namespace MsgSendToEth {
|
|
4
4
|
interface Params {
|
|
5
5
|
amount: {
|
|
@@ -13,14 +13,14 @@ export declare namespace MsgSendToEth {
|
|
|
13
13
|
address: string;
|
|
14
14
|
injectiveAddress: string;
|
|
15
15
|
}
|
|
16
|
-
type Proto =
|
|
16
|
+
type Proto = InjectivePeggyV1Msgs.MsgSendToEth;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* @category Messages
|
|
20
20
|
*/
|
|
21
21
|
export default class MsgSendToEth extends MsgBase<MsgSendToEth.Params, MsgSendToEth.Proto> {
|
|
22
22
|
static fromJSON(params: MsgSendToEth.Params): MsgSendToEth;
|
|
23
|
-
toProto():
|
|
23
|
+
toProto(): InjectivePeggyV1Msgs.MsgSendToEth;
|
|
24
24
|
toData(): {
|
|
25
25
|
sender: string;
|
|
26
26
|
ethDest: string;
|
|
@@ -46,7 +46,7 @@ export default class MsgSendToEth extends MsgBase<MsgSendToEth.Params, MsgSendTo
|
|
|
46
46
|
};
|
|
47
47
|
toDirectSign(): {
|
|
48
48
|
type: string;
|
|
49
|
-
message:
|
|
49
|
+
message: InjectivePeggyV1Msgs.MsgSendToEth;
|
|
50
50
|
};
|
|
51
51
|
toBinary(): Uint8Array;
|
|
52
52
|
}
|
|
@@ -26,12 +26,12 @@ class MsgSendToEth extends MsgBase_js_1.MsgBase {
|
|
|
26
26
|
bridgeFee.amount = params.bridgeFee
|
|
27
27
|
? params.bridgeFee.amount
|
|
28
28
|
: utils_1.DEFAULT_BRIDGE_FEE_AMOUNT;
|
|
29
|
-
const message = core_proto_ts_1.
|
|
29
|
+
const message = core_proto_ts_1.InjectivePeggyV1Msgs.MsgSendToEth.create();
|
|
30
30
|
message.sender = params.injectiveAddress;
|
|
31
31
|
message.ethDest = params.address;
|
|
32
32
|
message.amount = coinAmount;
|
|
33
33
|
message.bridgeFee = bridgeFee;
|
|
34
|
-
return core_proto_ts_1.
|
|
34
|
+
return core_proto_ts_1.InjectivePeggyV1Msgs.MsgSendToEth.fromPartial(message);
|
|
35
35
|
}
|
|
36
36
|
toData() {
|
|
37
37
|
const proto = this.toProto();
|
|
@@ -66,7 +66,7 @@ class MsgSendToEth extends MsgBase_js_1.MsgBase {
|
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
toBinary() {
|
|
69
|
-
return core_proto_ts_1.
|
|
69
|
+
return core_proto_ts_1.InjectivePeggyV1Msgs.MsgSendToEth.encode(this.toProto()).finish();
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
exports.default = MsgSendToEth;
|