@injectivelabs/sdk-ts 1.15.43 → 1.16.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/grpc/IndexerGrpcTransactionApi.d.ts +3 -3
- package/dist/cjs/client/indexer/grpc/IndexerGrpcWeb3GwApi.d.ts +2 -2
- package/dist/cjs/core/accounts/PrivateKey.d.ts +2 -2
- package/dist/cjs/core/accounts/PrivateKey.js +17 -17
- 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/MsgExecuteContract.d.ts +1 -0
- package/dist/cjs/core/modules/wasm/msgs/MsgExecuteContract.js +3 -7
- 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 +5 -5
- package/dist/cjs/core/tx/broadcaster/MsgBroadcasterWithPk.js +6 -7
- package/dist/cjs/core/tx/eip712/eip712.d.ts +5 -5
- package/dist/cjs/core/tx/eip712/eip712.js +4 -4
- package/dist/cjs/core/tx/eip712/utils.d.ts +3 -3
- package/dist/cjs/core/tx/eip712/utils.js +4 -4
- package/dist/cjs/core/tx/utils/tx.d.ts +3 -3
- package/dist/cjs/core/tx/utils/tx.js +2 -2
- package/dist/cjs/utils/grpc.d.ts +1 -1
- package/dist/cjs/utils/pagination.d.ts +1 -1
- package/dist/cjs/utils/pagination.js +5 -12
- 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/grpc/IndexerGrpcTransactionApi.d.ts +3 -3
- package/dist/esm/client/indexer/grpc/IndexerGrpcWeb3GwApi.d.ts +2 -2
- package/dist/esm/core/accounts/PrivateKey.d.ts +2 -2
- package/dist/esm/core/accounts/PrivateKey.js +17 -17
- 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/MsgExecuteContract.d.ts +1 -0
- package/dist/esm/core/modules/wasm/msgs/MsgExecuteContract.js +3 -7
- 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 +5 -5
- package/dist/esm/core/tx/broadcaster/MsgBroadcasterWithPk.js +6 -7
- package/dist/esm/core/tx/eip712/eip712.d.ts +5 -5
- package/dist/esm/core/tx/eip712/eip712.js +5 -5
- package/dist/esm/core/tx/eip712/utils.d.ts +3 -3
- package/dist/esm/core/tx/eip712/utils.js +4 -4
- package/dist/esm/core/tx/utils/tx.d.ts +3 -3
- package/dist/esm/core/tx/utils/tx.js +2 -2
- package/dist/esm/utils/grpc.d.ts +1 -1
- package/dist/esm/utils/pagination.d.ts +1 -1
- package/dist/esm/utils/pagination.js +5 -12
- package/package.json +10 -14
|
@@ -62,13 +62,9 @@ class MsgExecuteContract extends MsgBase_js_1.MsgBase {
|
|
|
62
62
|
...value,
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// 'EIP712_v1 is not supported for MsgExecuteContract. Please use EIP712_v2',
|
|
69
|
-
// ),
|
|
70
|
-
// )
|
|
71
|
-
// }
|
|
65
|
+
toEip712() {
|
|
66
|
+
throw new exceptions_1.GeneralException(new Error('EIP712_v1 is not supported for MsgExecuteContract. Please use EIP712_v2'));
|
|
67
|
+
}
|
|
72
68
|
toDirectSign() {
|
|
73
69
|
const proto = this.toProto();
|
|
74
70
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExecArgs } from '../exec-args.js';
|
|
2
2
|
import { MsgBase } from '../../MsgBase.js';
|
|
3
|
-
import {
|
|
3
|
+
import { InjectiveWasmxV1Tx } from '@injectivelabs/core-proto-ts';
|
|
4
4
|
export declare namespace MsgExecuteContractCompat {
|
|
5
5
|
interface Params {
|
|
6
6
|
funds?: {
|
|
@@ -30,8 +30,8 @@ export declare namespace MsgExecuteContractCompat {
|
|
|
30
30
|
*/
|
|
31
31
|
msg?: Record<string, any>;
|
|
32
32
|
}
|
|
33
|
-
type Proto =
|
|
34
|
-
type Object = Omit<
|
|
33
|
+
type Proto = InjectiveWasmxV1Tx.MsgExecuteContractCompat;
|
|
34
|
+
type Object = Omit<InjectiveWasmxV1Tx.MsgExecuteContractCompat, 'msg'> & {
|
|
35
35
|
msg: string;
|
|
36
36
|
};
|
|
37
37
|
}
|
|
@@ -40,7 +40,7 @@ export declare namespace MsgExecuteContractCompat {
|
|
|
40
40
|
*/
|
|
41
41
|
export default class MsgExecuteContractCompat extends MsgBase<MsgExecuteContractCompat.Params, MsgExecuteContractCompat.Proto, MsgExecuteContractCompat.Object> {
|
|
42
42
|
static fromJSON(params: MsgExecuteContractCompat.Params): MsgExecuteContractCompat;
|
|
43
|
-
toProto():
|
|
43
|
+
toProto(): InjectiveWasmxV1Tx.MsgExecuteContractCompat;
|
|
44
44
|
toData(): {
|
|
45
45
|
sender: string;
|
|
46
46
|
contract: string;
|
|
@@ -66,7 +66,7 @@ export default class MsgExecuteContractCompat extends MsgBase<MsgExecuteContract
|
|
|
66
66
|
};
|
|
67
67
|
toDirectSign(): {
|
|
68
68
|
type: string;
|
|
69
|
-
message:
|
|
69
|
+
message: InjectiveWasmxV1Tx.MsgExecuteContractCompat;
|
|
70
70
|
};
|
|
71
71
|
toBinary(): Uint8Array;
|
|
72
72
|
private getMsgObject;
|
|
@@ -16,7 +16,7 @@ class MsgExecuteContractCompat extends MsgBase_js_1.MsgBase {
|
|
|
16
16
|
}
|
|
17
17
|
toProto() {
|
|
18
18
|
const { params } = this;
|
|
19
|
-
const message = core_proto_ts_1.
|
|
19
|
+
const message = core_proto_ts_1.InjectiveWasmxV1Tx.MsgExecuteContractCompat.create();
|
|
20
20
|
const msg = this.getMsgObject();
|
|
21
21
|
message.sender = params.sender;
|
|
22
22
|
message.contract = params.contractAddress;
|
|
@@ -33,7 +33,7 @@ class MsgExecuteContractCompat extends MsgBase_js_1.MsgBase {
|
|
|
33
33
|
else {
|
|
34
34
|
message.funds = '0';
|
|
35
35
|
}
|
|
36
|
-
return core_proto_ts_1.
|
|
36
|
+
return core_proto_ts_1.InjectiveWasmxV1Tx.MsgExecuteContractCompat.fromPartial(message);
|
|
37
37
|
}
|
|
38
38
|
toData() {
|
|
39
39
|
const proto = this.toProto();
|
|
@@ -71,7 +71,7 @@ class MsgExecuteContractCompat extends MsgBase_js_1.MsgBase {
|
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
toBinary() {
|
|
74
|
-
return core_proto_ts_1.
|
|
74
|
+
return core_proto_ts_1.InjectiveWasmxV1Tx.MsgExecuteContractCompat.encode(this.toProto()).finish();
|
|
75
75
|
}
|
|
76
76
|
getMsgObject() {
|
|
77
77
|
const { params } = this;
|
|
@@ -15,8 +15,8 @@ export declare class TxGrpcApi implements TxConcreteApi {
|
|
|
15
15
|
result: {
|
|
16
16
|
data: string | Uint8Array<ArrayBufferLike>;
|
|
17
17
|
log: string;
|
|
18
|
-
eventsList: import("@injectivelabs/core-proto-ts/cjs/
|
|
19
|
-
events?: import("@injectivelabs/core-proto-ts/cjs/
|
|
18
|
+
eventsList: import("@injectivelabs/core-proto-ts/cjs/cometbft/abci/v1/types.js").Event[];
|
|
19
|
+
events?: import("@injectivelabs/core-proto-ts/cjs/cometbft/abci/v1/types.js").Event[] | undefined;
|
|
20
20
|
msgResponses?: import("@injectivelabs/core-proto-ts/cjs/google/protobuf/any.js").Any[] | undefined;
|
|
21
21
|
};
|
|
22
22
|
gasInfo: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PrivateKey } from '../../accounts/index.js';
|
|
2
2
|
import { Msgs } from '../../modules/msgs.js';
|
|
3
|
-
import { ChainId,
|
|
3
|
+
import { ChainId, EvmChainId } from '@injectivelabs/ts-types';
|
|
4
4
|
import { Network, NetworkEndpoints } from '@injectivelabs/networks';
|
|
5
5
|
import { AccountDetails } from '../../../types/auth.js';
|
|
6
6
|
interface MsgBroadcasterTxOptions {
|
|
@@ -25,7 +25,7 @@ interface MsgBroadcasterWithPkOptions {
|
|
|
25
25
|
rest: string;
|
|
26
26
|
};
|
|
27
27
|
privateKey: string | PrivateKey;
|
|
28
|
-
|
|
28
|
+
evmChainId?: EvmChainId;
|
|
29
29
|
chainId?: ChainId;
|
|
30
30
|
simulateTx?: boolean;
|
|
31
31
|
loggingEnabled?: boolean;
|
|
@@ -45,7 +45,7 @@ interface MsgBroadcasterWithPkOptions {
|
|
|
45
45
|
export declare class MsgBroadcasterWithPk {
|
|
46
46
|
endpoints: NetworkEndpoints;
|
|
47
47
|
chainId: ChainId;
|
|
48
|
-
|
|
48
|
+
evmChainId?: EvmChainId;
|
|
49
49
|
privateKey: PrivateKey;
|
|
50
50
|
simulateTx: boolean;
|
|
51
51
|
txTimeoutOnFeeDelegation: boolean;
|
|
@@ -77,8 +77,8 @@ export declare class MsgBroadcasterWithPk {
|
|
|
77
77
|
result: {
|
|
78
78
|
data: string | Uint8Array<ArrayBufferLike>;
|
|
79
79
|
log: string;
|
|
80
|
-
eventsList: import("@injectivelabs/core-proto-ts/cjs/
|
|
81
|
-
events?: import("@injectivelabs/core-proto-ts/cjs/
|
|
80
|
+
eventsList: import("@injectivelabs/core-proto-ts/cjs/cometbft/abci/v1/types.js").Event[];
|
|
81
|
+
events?: import("@injectivelabs/core-proto-ts/cjs/cometbft/abci/v1/types.js").Event[] | undefined;
|
|
82
82
|
msgResponses?: import("@injectivelabs/core-proto-ts/cjs/google/protobuf/any.js").Any[] | undefined;
|
|
83
83
|
};
|
|
84
84
|
gasInfo: {
|
|
@@ -23,7 +23,7 @@ const index_js_5 = require("../../../json/index.js");
|
|
|
23
23
|
class MsgBroadcasterWithPk {
|
|
24
24
|
endpoints;
|
|
25
25
|
chainId;
|
|
26
|
-
|
|
26
|
+
evmChainId;
|
|
27
27
|
privateKey;
|
|
28
28
|
simulateTx = false;
|
|
29
29
|
txTimeoutOnFeeDelegation = false;
|
|
@@ -39,8 +39,7 @@ class MsgBroadcasterWithPk {
|
|
|
39
39
|
this.simulateTx = options.simulateTx || false;
|
|
40
40
|
this.chainId = options.chainId || networkInfo.chainId;
|
|
41
41
|
this.txTimeout = options.txTimeout || utils_1.DEFAULT_BLOCK_TIMEOUT_HEIGHT;
|
|
42
|
-
this.
|
|
43
|
-
options.ethereumChainId || networkInfo.ethereumChainId;
|
|
42
|
+
this.evmChainId = options.evmChainId || networkInfo.evmChainId;
|
|
44
43
|
this.endpoints = { ...endpoints, ...(options.endpoints || {}) };
|
|
45
44
|
this.privateKey =
|
|
46
45
|
options.privateKey instanceof index_js_1.PrivateKey
|
|
@@ -70,7 +69,7 @@ class MsgBroadcasterWithPk {
|
|
|
70
69
|
* @returns {string} transaction hash
|
|
71
70
|
*/
|
|
72
71
|
async broadcastWithFeeDelegation(transaction) {
|
|
73
|
-
const {
|
|
72
|
+
const { endpoints, txTimeout, simulateTx, privateKey, evmChainId, txTimeoutOnFeeDelegation, } = this;
|
|
74
73
|
const ethereumWallet = this.privateKey.toHex();
|
|
75
74
|
if (index_js_5.ofacWallets.includes(ethereumWallet)) {
|
|
76
75
|
throw new exceptions_1.GeneralException(new Error('You cannot execute this transaction'));
|
|
@@ -84,7 +83,7 @@ class MsgBroadcasterWithPk {
|
|
|
84
83
|
ethereumAddress: ethereumWallet,
|
|
85
84
|
};
|
|
86
85
|
const web3Msgs = msgs.map((msg) => msg.toWeb3());
|
|
87
|
-
if (!
|
|
86
|
+
if (!evmChainId) {
|
|
88
87
|
throw new exceptions_1.GeneralException(new Error('Please provide ethereumChainId'));
|
|
89
88
|
}
|
|
90
89
|
let timeoutHeight = undefined;
|
|
@@ -100,7 +99,7 @@ class MsgBroadcasterWithPk {
|
|
|
100
99
|
memo: tx.memo,
|
|
101
100
|
message: web3Msgs,
|
|
102
101
|
address: tx.ethereumAddress,
|
|
103
|
-
chainId:
|
|
102
|
+
chainId: evmChainId,
|
|
104
103
|
gasLimit: (0, msgs_js_1.getGasPriceBasedOnMessage)(msgs),
|
|
105
104
|
estimateGas: simulateTx || false,
|
|
106
105
|
timeoutHeight,
|
|
@@ -109,7 +108,7 @@ class MsgBroadcasterWithPk {
|
|
|
109
108
|
const response = await transactionApi.broadcastTxRequest({
|
|
110
109
|
txResponse,
|
|
111
110
|
message: web3Msgs,
|
|
112
|
-
chainId:
|
|
111
|
+
chainId: evmChainId,
|
|
113
112
|
signature: `0x${Buffer.from(signature).toString('hex')}`,
|
|
114
113
|
});
|
|
115
114
|
return await new TxGrpcApi_js_1.TxGrpcApi(endpoints.grpc).fetchTxPoll(response.txHash);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Msgs } from '../../modules/msgs.js';
|
|
2
|
-
import {
|
|
2
|
+
import { EvmChainId } from '@injectivelabs/ts-types';
|
|
3
3
|
import { Eip712ConvertFeeArgs, Eip712ConvertTxArgs } from './types.js';
|
|
4
|
-
export declare const getEip712TypedData: ({ msgs, tx, fee,
|
|
4
|
+
export declare const getEip712TypedData: ({ msgs, tx, fee, evmChainId, }: {
|
|
5
5
|
msgs: Msgs | Msgs[];
|
|
6
6
|
tx: Eip712ConvertTxArgs;
|
|
7
7
|
fee?: Eip712ConvertFeeArgs;
|
|
8
|
-
|
|
8
|
+
evmChainId: EvmChainId;
|
|
9
9
|
}) => {
|
|
10
10
|
message: {
|
|
11
11
|
msgs: {
|
|
@@ -57,11 +57,11 @@ export declare const getEip712TypedData: ({ msgs, tx, fee, ethereumChainId, }: {
|
|
|
57
57
|
}[];
|
|
58
58
|
};
|
|
59
59
|
};
|
|
60
|
-
export declare const getEip712TypedDataV2: ({ msgs, tx, fee,
|
|
60
|
+
export declare const getEip712TypedDataV2: ({ msgs, tx, fee, evmChainId, }: {
|
|
61
61
|
msgs: Msgs | Msgs[];
|
|
62
62
|
tx: Eip712ConvertTxArgs;
|
|
63
63
|
fee?: Eip712ConvertFeeArgs;
|
|
64
|
-
|
|
64
|
+
evmChainId: EvmChainId;
|
|
65
65
|
}) => {
|
|
66
66
|
message: {
|
|
67
67
|
context: string;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getEip712TypedDataV2 = exports.getEip712TypedData = void 0;
|
|
4
4
|
const utils_js_1 = require("./utils.js");
|
|
5
5
|
const utils_js_2 = require("./utils.js");
|
|
6
|
-
const getEip712TypedData = ({ msgs, tx, fee,
|
|
6
|
+
const getEip712TypedData = ({ msgs, tx, fee, evmChainId, }) => {
|
|
7
7
|
const messages = Array.isArray(msgs) ? msgs : [msgs];
|
|
8
8
|
const eip712Msgs = messages.map((m) => m.toEip712());
|
|
9
9
|
const eip712MessageTypes = messages[0].toEip712Types();
|
|
@@ -21,7 +21,7 @@ const getEip712TypedData = ({ msgs, tx, fee, ethereumChainId, }) => {
|
|
|
21
21
|
return {
|
|
22
22
|
...typesWithFeePayer,
|
|
23
23
|
primaryType: 'Tx',
|
|
24
|
-
...(0, utils_js_1.getEip712Domain)(
|
|
24
|
+
...(0, utils_js_1.getEip712Domain)(evmChainId),
|
|
25
25
|
message: {
|
|
26
26
|
...(0, utils_js_1.getEipTxDetails)(tx),
|
|
27
27
|
...(0, utils_js_1.getEip712Fee)(fee),
|
|
@@ -30,14 +30,14 @@ const getEip712TypedData = ({ msgs, tx, fee, ethereumChainId, }) => {
|
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
32
|
exports.getEip712TypedData = getEip712TypedData;
|
|
33
|
-
const getEip712TypedDataV2 = ({ msgs, tx, fee,
|
|
33
|
+
const getEip712TypedDataV2 = ({ msgs, tx, fee, evmChainId, }) => {
|
|
34
34
|
const messages = Array.isArray(msgs) ? msgs : [msgs];
|
|
35
35
|
const eip712Msgs = messages.map((m) => m.toEip712V2());
|
|
36
36
|
const types = (0, utils_js_1.getDefaultEip712TypesV2)();
|
|
37
37
|
return {
|
|
38
38
|
...types,
|
|
39
39
|
primaryType: 'Tx',
|
|
40
|
-
...(0, utils_js_1.getEip712DomainV2)(
|
|
40
|
+
...(0, utils_js_1.getEip712DomainV2)(evmChainId),
|
|
41
41
|
message: {
|
|
42
42
|
context: JSON.stringify((0, utils_js_2.getEipTxContext)({ ...tx, fee })),
|
|
43
43
|
msgs: JSON.stringify(eip712Msgs),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EvmChainId } from '@injectivelabs/ts-types';
|
|
2
2
|
import { Eip712ConvertFeeArgs, Eip712ConvertTxArgs } from './types.js';
|
|
3
|
-
export declare const getEip712Domain: (
|
|
3
|
+
export declare const getEip712Domain: (evmChainId: EvmChainId) => {
|
|
4
4
|
domain: {
|
|
5
5
|
name: string;
|
|
6
6
|
version: string;
|
|
@@ -9,7 +9,7 @@ export declare const getEip712Domain: (ethereumChainId: EthereumChainId) => {
|
|
|
9
9
|
verifyingContract: string;
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
export declare const getEip712DomainV2: (
|
|
12
|
+
export declare const getEip712DomainV2: (evmChainId: EvmChainId) => {
|
|
13
13
|
domain: {
|
|
14
14
|
name: string;
|
|
15
15
|
version: string;
|
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getEipTxContext = exports.getEipTxDetails = exports.getTypesIncludingFeePayer = exports.getEip712FeeV2 = exports.getEip712Fee = exports.getDefaultEip712TypesV2 = exports.getDefaultEip712Types = exports.getEip712DomainV2 = exports.getEip712Domain = void 0;
|
|
4
4
|
const utils_1 = require("@injectivelabs/utils");
|
|
5
|
-
const getEip712Domain = (
|
|
5
|
+
const getEip712Domain = (evmChainId) => {
|
|
6
6
|
return {
|
|
7
7
|
domain: {
|
|
8
8
|
name: 'Injective Web3',
|
|
9
9
|
version: '1.0.0',
|
|
10
|
-
chainId: '0x' + new utils_1.BigNumberInBase(
|
|
10
|
+
chainId: '0x' + new utils_1.BigNumberInBase(evmChainId).toString(16),
|
|
11
11
|
salt: '0',
|
|
12
12
|
verifyingContract: 'cosmos',
|
|
13
13
|
},
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
exports.getEip712Domain = getEip712Domain;
|
|
17
|
-
const getEip712DomainV2 = (
|
|
17
|
+
const getEip712DomainV2 = (evmChainId) => {
|
|
18
18
|
return {
|
|
19
19
|
domain: {
|
|
20
20
|
name: 'Injective Web3',
|
|
21
21
|
version: '1.0.0',
|
|
22
|
-
chainId: '0x' + new utils_1.BigNumberInBase(
|
|
22
|
+
chainId: '0x' + new utils_1.BigNumberInBase(evmChainId).toString(16),
|
|
23
23
|
verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
|
|
24
24
|
salt: '0',
|
|
25
25
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChainId,
|
|
1
|
+
import { ChainId, EvmChainId } from '@injectivelabs/ts-types';
|
|
2
2
|
import { Msgs } from '../../modules/msgs.js';
|
|
3
3
|
import { GoogleProtobufAny, CosmosTxV1Beta1Tx, InjectiveTypesV1Beta1TxExt, CosmosTxSigningV1Beta1Signing } from '@injectivelabs/core-proto-ts';
|
|
4
4
|
export declare const getPublicKey: ({ chainId, key, }: {
|
|
@@ -49,8 +49,8 @@ export declare const createSignDocFromTransaction: (args: {
|
|
|
49
49
|
accountNumber: number;
|
|
50
50
|
}) => CosmosTxV1Beta1Tx.SignDoc;
|
|
51
51
|
export declare const createTxRawEIP712: (txRaw: CosmosTxV1Beta1Tx.TxRaw, extension: InjectiveTypesV1Beta1TxExt.ExtensionOptionsWeb3Tx, nonCriticalExtension?: GoogleProtobufAny.Any | GoogleProtobufAny.Any[]) => CosmosTxV1Beta1Tx.TxRaw;
|
|
52
|
-
export declare const createWeb3Extension: ({
|
|
53
|
-
|
|
52
|
+
export declare const createWeb3Extension: ({ evmChainId, feePayer, feePayerSig, }: {
|
|
53
|
+
evmChainId: EvmChainId;
|
|
54
54
|
feePayer?: string;
|
|
55
55
|
feePayerSig?: Uint8Array;
|
|
56
56
|
}) => InjectiveTypesV1Beta1TxExt.ExtensionOptionsWeb3Tx;
|
|
@@ -120,9 +120,9 @@ const createTxRawEIP712 = (txRaw, extension, nonCriticalExtension) => {
|
|
|
120
120
|
return txRaw;
|
|
121
121
|
};
|
|
122
122
|
exports.createTxRawEIP712 = createTxRawEIP712;
|
|
123
|
-
const createWeb3Extension = ({
|
|
123
|
+
const createWeb3Extension = ({ evmChainId, feePayer, feePayerSig, }) => {
|
|
124
124
|
const web3Extension = core_proto_ts_1.InjectiveTypesV1Beta1TxExt.ExtensionOptionsWeb3Tx.create();
|
|
125
|
-
web3Extension.typedDataChainID =
|
|
125
|
+
web3Extension.typedDataChainID = evmChainId.toString();
|
|
126
126
|
if (feePayer) {
|
|
127
127
|
web3Extension.feePayer = feePayer;
|
|
128
128
|
}
|
package/dist/cjs/utils/grpc.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as grpcPkg from '@injectivelabs/grpc-web';
|
|
2
2
|
declare const grpc: typeof grpcPkg.grpc;
|
|
3
|
-
export declare const getGrpcTransport: () =>
|
|
3
|
+
export declare const getGrpcTransport: () => grpcPkg.grpc.TransportFactory;
|
|
4
4
|
export { grpc, grpcPkg };
|
|
@@ -19,4 +19,4 @@ export declare const fetchAllWithPagination: <T extends {
|
|
|
19
19
|
pagination: PaginationOption | undefined;
|
|
20
20
|
} | PaginationOption | undefined, Q extends {
|
|
21
21
|
pagination: Pagination;
|
|
22
|
-
}>(args: T, method: (args: T) => Promise<Q>) => Promise<Q>;
|
|
22
|
+
}>(args: T, method: (args: T) => Promise<Q>, result?: Array<unknown>) => Promise<Q>;
|
|
@@ -97,24 +97,17 @@ const grpcPagingToPaging = (pagination) => {
|
|
|
97
97
|
};
|
|
98
98
|
};
|
|
99
99
|
exports.grpcPagingToPaging = grpcPagingToPaging;
|
|
100
|
-
const fetchAllWithPagination = async (args, method) => {
|
|
101
|
-
let result = [];
|
|
100
|
+
const fetchAllWithPagination = async (args, method, result = []) => {
|
|
102
101
|
let response = await method(args);
|
|
103
102
|
if (!args) {
|
|
104
103
|
return response;
|
|
105
104
|
}
|
|
106
|
-
const paginationOption = args.pagination;
|
|
107
|
-
if (!paginationOption) {
|
|
108
|
-
return response;
|
|
109
|
-
}
|
|
110
105
|
const keys = Object.keys(response);
|
|
111
106
|
const valueKey = keys.find((key) => key !== 'pagination');
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
pagination: { ...paginationOption, key: response.pagination.next },
|
|
117
|
-
});
|
|
107
|
+
result.push(...response[valueKey]);
|
|
108
|
+
const paginationOption = args;
|
|
109
|
+
if (response.pagination.next) {
|
|
110
|
+
return (0, exports.fetchAllWithPagination)({ ...paginationOption, key: response.pagination.next }, method, result);
|
|
118
111
|
}
|
|
119
112
|
return { [valueKey]: result, pagination: response.pagination };
|
|
120
113
|
};
|
|
@@ -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
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UnspecifiedErrorCode, grpcErrorCodeToErrorCode, GrpcUnaryRequestException, } from '@injectivelabs/exceptions';
|
|
2
|
-
import {
|
|
2
|
+
import { InjectivePeggyV1Query } from '@injectivelabs/core-proto-ts';
|
|
3
3
|
import BaseGrpcConsumer from '../../base/BaseGrpcConsumer.js';
|
|
4
4
|
import { ChainModule } from '../types/index.js';
|
|
5
5
|
import { ChainGrpcPeggyTransformer } from '../transformers/index.js';
|
|
@@ -11,16 +11,16 @@ export class ChainGrpcPeggyApi extends BaseGrpcConsumer {
|
|
|
11
11
|
client;
|
|
12
12
|
constructor(endpoint) {
|
|
13
13
|
super(endpoint);
|
|
14
|
-
this.client = new
|
|
14
|
+
this.client = new InjectivePeggyV1Query.QueryClientImpl(this.getGrpcWebImpl(endpoint));
|
|
15
15
|
}
|
|
16
16
|
async fetchModuleParams() {
|
|
17
|
-
const request =
|
|
17
|
+
const request = InjectivePeggyV1Query.QueryParamsRequest.create();
|
|
18
18
|
try {
|
|
19
19
|
const response = await this.retry(() => this.client.Params(request, this.metadata));
|
|
20
20
|
return ChainGrpcPeggyTransformer.moduleParamsResponseToModuleParams(response);
|
|
21
21
|
}
|
|
22
22
|
catch (e) {
|
|
23
|
-
if (e instanceof
|
|
23
|
+
if (e instanceof InjectivePeggyV1Query.GrpcWebError) {
|
|
24
24
|
throw new GrpcUnaryRequestException(new Error(e.toString()), {
|
|
25
25
|
code: grpcErrorCodeToErrorCode(e.code),
|
|
26
26
|
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
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UnspecifiedErrorCode, grpcErrorCodeToErrorCode, GrpcUnaryRequestException, } from '@injectivelabs/exceptions';
|
|
2
|
-
import {
|
|
2
|
+
import { InjectiveWasmxV1Query } from '@injectivelabs/core-proto-ts';
|
|
3
3
|
import BaseGrpcConsumer from '../../base/BaseGrpcConsumer.js';
|
|
4
4
|
import { ChainModule } from '../types/index.js';
|
|
5
5
|
/**
|
|
@@ -10,16 +10,16 @@ export class ChainGrpcWasmXApi extends BaseGrpcConsumer {
|
|
|
10
10
|
client;
|
|
11
11
|
constructor(endpoint) {
|
|
12
12
|
super(endpoint);
|
|
13
|
-
this.client = new
|
|
13
|
+
this.client = new InjectiveWasmxV1Query.QueryClientImpl(this.getGrpcWebImpl(endpoint));
|
|
14
14
|
}
|
|
15
15
|
async fetchModuleParams() {
|
|
16
|
-
const request =
|
|
16
|
+
const request = InjectiveWasmxV1Query.QueryWasmxParamsRequest.create();
|
|
17
17
|
try {
|
|
18
18
|
const response = await this.retry(() => this.client.WasmxParams(request, this.metadata));
|
|
19
19
|
return response;
|
|
20
20
|
}
|
|
21
21
|
catch (e) {
|
|
22
|
-
if (e instanceof
|
|
22
|
+
if (e instanceof InjectiveWasmxV1Query.GrpcWebError) {
|
|
23
23
|
throw new GrpcUnaryRequestException(new Error(e.toString()), {
|
|
24
24
|
code: grpcErrorCodeToErrorCode(e.code),
|
|
25
25
|
context: 'WasmxParams',
|
|
@@ -34,13 +34,13 @@ export class ChainGrpcWasmXApi extends BaseGrpcConsumer {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
async fetchModuleState() {
|
|
37
|
-
const request =
|
|
37
|
+
const request = InjectiveWasmxV1Query.QueryModuleStateRequest.create();
|
|
38
38
|
try {
|
|
39
39
|
const response = await this.retry(() => this.client.WasmxModuleState(request, this.metadata));
|
|
40
40
|
return response.state; /* TODO */
|
|
41
41
|
}
|
|
42
42
|
catch (e) {
|
|
43
|
-
if (e instanceof
|
|
43
|
+
if (e instanceof InjectiveWasmxV1Query.GrpcWebError) {
|
|
44
44
|
throw new GrpcUnaryRequestException(new Error(e.toString()), {
|
|
45
45
|
code: grpcErrorCodeToErrorCode(e.code),
|
|
46
46
|
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,10 +1,10 @@
|
|
|
1
|
-
import { AccountAddress,
|
|
1
|
+
import { AccountAddress, EvmChainId } from '@injectivelabs/ts-types';
|
|
2
2
|
import { InjectiveExchangeRpc } from '@injectivelabs/indexer-proto-ts';
|
|
3
3
|
import { CosmosTxV1Beta1Tx } from '@injectivelabs/core-proto-ts';
|
|
4
4
|
import BaseGrpcConsumer from '../../base/BaseIndexerGrpcConsumer.js';
|
|
5
5
|
interface PrepareTxArgs {
|
|
6
6
|
address: AccountAddress;
|
|
7
|
-
chainId:
|
|
7
|
+
chainId: EvmChainId;
|
|
8
8
|
message: any;
|
|
9
9
|
estimateGas?: boolean;
|
|
10
10
|
gasLimit?: number;
|
|
@@ -41,7 +41,7 @@ export declare class IndexerGrpcTransactionApi extends BaseGrpcConsumer {
|
|
|
41
41
|
*/
|
|
42
42
|
broadcastTxRequest({ signature, chainId, message, txResponse, }: {
|
|
43
43
|
signature: string;
|
|
44
|
-
chainId:
|
|
44
|
+
chainId: EvmChainId;
|
|
45
45
|
useCorrectEIP712Hash?: boolean;
|
|
46
46
|
txResponse: InjectiveExchangeRpc.PrepareTxResponse;
|
|
47
47
|
message: Record<string, any>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountAddress,
|
|
1
|
+
import { AccountAddress, EvmChainId } from '@injectivelabs/ts-types';
|
|
2
2
|
import { InjectiveExchangeRpc } from '@injectivelabs/indexer-proto-ts';
|
|
3
3
|
import { IndexerGrpcTransactionApi } from './IndexerGrpcTransactionApi.js';
|
|
4
4
|
/**
|
|
@@ -9,7 +9,7 @@ export declare class IndexerGrpcWeb3GwApi extends IndexerGrpcTransactionApi {
|
|
|
9
9
|
constructor(endpoint: string);
|
|
10
10
|
prepareEip712Request({ address, chainId, message, memo, sequence, accountNumber, estimateGas, gasLimit, feeDenom, feePrice, timeoutHeight, eip712Version, }: {
|
|
11
11
|
address: AccountAddress;
|
|
12
|
-
chainId:
|
|
12
|
+
chainId: EvmChainId;
|
|
13
13
|
message: any;
|
|
14
14
|
estimateGas?: boolean;
|
|
15
15
|
gasLimit?: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PublicKey } from './PublicKey.js';
|
|
2
|
-
import { Address } from './Address.js';
|
|
3
1
|
import { CosmosTxV1Beta1Tx } from '@injectivelabs/core-proto-ts';
|
|
2
|
+
import { Address } from './Address.js';
|
|
3
|
+
import { PublicKey } from './PublicKey.js';
|
|
4
4
|
/**
|
|
5
5
|
* Class for wrapping SigningKey that is used for signature creation and public key derivation.
|
|
6
6
|
*
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { generateMnemonic } from 'bip39';
|
|
2
|
-
import { Wallet, HDNodeWallet, Signature, getBytes, concat } from 'ethers';
|
|
3
1
|
import secp256k1 from 'secp256k1';
|
|
4
2
|
import keccak256 from 'keccak256';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { generateMnemonic } from 'bip39';
|
|
4
|
+
import { InjectiveTypesV1Beta1TxExt, } from '@injectivelabs/core-proto-ts';
|
|
5
|
+
import { GeneralException } from '@injectivelabs/exceptions';
|
|
6
|
+
import { ChainId, EvmChainId } from '@injectivelabs/ts-types';
|
|
7
|
+
import { Wallet, HDNodeWallet, Signature, getBytes, concat } from 'ethers';
|
|
7
8
|
import { signTypedData, SignTypedDataVersion } from '@metamask/eth-sig-util';
|
|
8
9
|
import { DEFAULT_DERIVATION_PATH, recoverTypedSignaturePubKey, } from '../../utils/index.js';
|
|
9
|
-
import {
|
|
10
|
+
import { Address } from './Address.js';
|
|
11
|
+
import { PublicKey } from './PublicKey.js';
|
|
10
12
|
import { getTransactionPartsFromTxRaw } from '../tx/utils/tx.js';
|
|
11
13
|
import { getEip712TypedData, MsgDecoder } from '../tx/eip712/index.js';
|
|
12
|
-
import { GeneralException } from '@injectivelabs/exceptions';
|
|
13
|
-
import { ChainId, EthereumChainId } from '@injectivelabs/ts-types';
|
|
14
14
|
/**
|
|
15
15
|
* Class for wrapping SigningKey that is used for signature creation and public key derivation.
|
|
16
16
|
*
|
|
@@ -260,31 +260,31 @@ export class PrivateKey {
|
|
|
260
260
|
const getChainIds = () => {
|
|
261
261
|
if (!body.extensionOptions.length) {
|
|
262
262
|
return {
|
|
263
|
-
ethereumChainId: EthereumChainId.Mainnet,
|
|
264
263
|
chainId: ChainId.Mainnet,
|
|
264
|
+
EvmChainId: EvmChainId.Mainnet,
|
|
265
265
|
};
|
|
266
266
|
}
|
|
267
267
|
const extension = body.extensionOptions.find((extension) => extension.typeUrl.includes('ExtensionOptionsWeb3Tx'));
|
|
268
268
|
if (!extension) {
|
|
269
269
|
return {
|
|
270
|
-
ethereumChainId: EthereumChainId.Mainnet,
|
|
271
270
|
chainId: ChainId.Mainnet,
|
|
271
|
+
EvmChainId: EvmChainId.Mainnet,
|
|
272
272
|
};
|
|
273
273
|
}
|
|
274
274
|
const decodedExtension = InjectiveTypesV1Beta1TxExt.ExtensionOptionsWeb3Tx.decode(extension.value);
|
|
275
|
-
const
|
|
275
|
+
const evmChainId = Number(decodedExtension.typedDataChainID);
|
|
276
276
|
return {
|
|
277
|
-
|
|
277
|
+
evmChainId: EvmChainId,
|
|
278
278
|
chainId: [
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
].includes(
|
|
279
|
+
EvmChainId.Kovan,
|
|
280
|
+
EvmChainId.Goerli,
|
|
281
|
+
EvmChainId.Sepolia,
|
|
282
|
+
].includes(evmChainId)
|
|
283
283
|
? ChainId.Testnet
|
|
284
284
|
: ChainId.Mainnet,
|
|
285
285
|
};
|
|
286
286
|
};
|
|
287
|
-
const {
|
|
287
|
+
const { evmChainId, chainId } = getChainIds();
|
|
288
288
|
const [signerInfo] = authInfo.signerInfos;
|
|
289
289
|
const [signature] = signatures;
|
|
290
290
|
const [msg] = body.messages;
|
|
@@ -299,7 +299,7 @@ export class PrivateKey {
|
|
|
299
299
|
timeoutHeight: body.timeoutHeight.toString(),
|
|
300
300
|
chainId,
|
|
301
301
|
},
|
|
302
|
-
|
|
302
|
+
evmChainId: evmChainId,
|
|
303
303
|
});
|
|
304
304
|
return this.verifySignature({
|
|
305
305
|
eip712: eip712TypedData,
|
package/dist/esm/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
|
/**
|