@injectivelabs/sdk-ts 1.14.0 → 1.14.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/core/accounts/BaseAccount.d.ts +1 -1
- package/dist/cjs/core/accounts/BaseAccount.d.ts.map +1 -1
- package/dist/cjs/core/accounts/BaseAccount.js +3 -2
- package/dist/cjs/core/accounts/BaseAccount.js.map +1 -1
- package/dist/cjs/core/modules/tx/broadcaster/MsgBroadcasterWithPk.d.ts +1 -3
- package/dist/cjs/core/modules/tx/broadcaster/MsgBroadcasterWithPk.d.ts.map +1 -1
- package/dist/cjs/core/modules/tx/broadcaster/MsgBroadcasterWithPk.js +5 -6
- package/dist/cjs/core/modules/tx/broadcaster/MsgBroadcasterWithPk.js.map +1 -1
- package/dist/cjs/core/modules/tx/broadcaster/MsgBroadcasterWithPkAndLocalSequence.d.ts +98 -0
- package/dist/cjs/core/modules/tx/broadcaster/MsgBroadcasterWithPkAndLocalSequence.d.ts.map +1 -0
- package/dist/cjs/core/modules/tx/broadcaster/MsgBroadcasterWithPkAndLocalSequence.js +222 -0
- package/dist/cjs/core/modules/tx/broadcaster/MsgBroadcasterWithPkAndLocalSequence.js.map +1 -0
- package/dist/cjs/core/modules/tx/broadcaster/index.d.ts +1 -0
- package/dist/cjs/core/modules/tx/broadcaster/index.d.ts.map +1 -1
- package/dist/cjs/core/modules/tx/broadcaster/index.js +1 -0
- package/dist/cjs/core/modules/tx/broadcaster/index.js.map +1 -1
- package/dist/esm/core/accounts/BaseAccount.d.ts +1 -1
- package/dist/esm/core/accounts/BaseAccount.d.ts.map +1 -1
- package/dist/esm/core/accounts/BaseAccount.js +3 -2
- package/dist/esm/core/accounts/BaseAccount.js.map +1 -1
- package/dist/esm/core/modules/tx/broadcaster/MsgBroadcasterWithPk.d.ts +1 -3
- package/dist/esm/core/modules/tx/broadcaster/MsgBroadcasterWithPk.d.ts.map +1 -1
- package/dist/esm/core/modules/tx/broadcaster/MsgBroadcasterWithPk.js +2 -9
- package/dist/esm/core/modules/tx/broadcaster/MsgBroadcasterWithPk.js.map +1 -1
- package/dist/esm/core/modules/tx/broadcaster/MsgBroadcasterWithPkAndLocalSequence.d.ts +98 -0
- package/dist/esm/core/modules/tx/broadcaster/MsgBroadcasterWithPkAndLocalSequence.d.ts.map +1 -0
- package/dist/esm/core/modules/tx/broadcaster/MsgBroadcasterWithPkAndLocalSequence.js +209 -0
- package/dist/esm/core/modules/tx/broadcaster/MsgBroadcasterWithPkAndLocalSequence.js.map +1 -0
- package/dist/esm/core/modules/tx/broadcaster/index.d.ts +1 -0
- package/dist/esm/core/modules/tx/broadcaster/index.d.ts.map +1 -1
- package/dist/esm/core/modules/tx/broadcaster/index.js +1 -0
- package/dist/esm/core/modules/tx/broadcaster/index.js.map +1 -1
- package/package.json +9 -9
|
@@ -22,7 +22,7 @@ export declare class BaseAccount extends Address {
|
|
|
22
22
|
});
|
|
23
23
|
static fromRestApi(accountResponse: AccountResponse): BaseAccount;
|
|
24
24
|
static fromRestCosmosApi(accountResponse: BaseAccountRestResponse): BaseAccount;
|
|
25
|
-
incrementSequence():
|
|
25
|
+
incrementSequence(): this;
|
|
26
26
|
toAccountDetails(): AccountDetails;
|
|
27
27
|
}
|
|
28
28
|
//# sourceMappingURL=BaseAccount.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseAccount.d.ts","sourceRoot":"","sources":["../../../../src/core/accounts/BaseAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD;;GAEG;AACH,qBAAa,WAAY,SAAQ,OAAO;IAC/B,aAAa,EAAE,MAAM,CAAA;IAErB,QAAQ,EAAE,MAAM,CAAA;IAEhB,MAA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,eAAe,EAAE,uBAAuB;IAqB1D,iBAAiB;IAMjB,gBAAgB,IAAI,cAAc;CAQ1C"}
|
|
@@ -53,13 +53,14 @@ class BaseAccount extends Address_1.Address {
|
|
|
53
53
|
}
|
|
54
54
|
incrementSequence() {
|
|
55
55
|
this.sequence += 1;
|
|
56
|
+
return this;
|
|
56
57
|
}
|
|
57
58
|
toAccountDetails() {
|
|
58
59
|
return {
|
|
59
|
-
address: this.bech32Address,
|
|
60
60
|
pubKey: this.pubKey,
|
|
61
|
-
accountNumber: this.accountNumber,
|
|
62
61
|
sequence: this.sequence,
|
|
62
|
+
address: this.bech32Address,
|
|
63
|
+
accountNumber: this.accountNumber,
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseAccount.js","sourceRoot":"","sources":["../../../../src/core/accounts/BaseAccount.ts"],"names":[],"mappings":";;;AAAA,uCAAmC;AAInC;;GAEG;AACH,MAAa,WAAY,SAAQ,iBAAO;IAUtC,YAAY,EACV,OAAO,EACP,aAAa,EACb,QAAQ,EACR,MAAM,GASP;QACC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,eAAgC;QACjD,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,eAAe,CAAC,OAAO,CAAA;QAE7D,OAAO,IAAI,WAAW,CAAC;YACrB,OAAO,EAAE,WAAW,CAAC,OAAO;YAC5B,aAAa,EAAE,WAAW,CAAC,cAAc;gBACvC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,cAAc,EAAE,EAAE,CAAC;gBAC1C,CAAC,CAAC,CAAC;YACL,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC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AAQ,EAAE,EAAE,CAAC;gBACxC,CAAC,CAAC,CAAC;YACL,MAAM,EAAE,eAAe,CAAC,OAAO;gBAC7B,CAAC,CAAC;oBACE,IAAI,EAAE,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC;oBACtC,GAAG,EAAE,eAAe,CAAC,OAAO,CAAC,GAAG;iBACjC;gBACH,CAAC,CAAC;oBACE,IAAI,EAAE,EAAE;oBACR,GAAG,EAAE,EAAE;iBACR;SACN,CAAC,CAAA;IACJ,CAAC;IAEM,iBAAiB;QACtB,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAA;QAElB,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,gBAAgB;QACrB,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,OAAO,EAAE,IAAI,CAAC,aAAa;YAC3B,aAAa,EAAE,IAAI,CAAC,aAAa;SAClC,CAAA;IACH,CAAC;CACF;AAtFD,kCAsFC"}
|
|
@@ -4,8 +4,6 @@ import { ChainId, EthereumChainId } from '@injectivelabs/ts-types';
|
|
|
4
4
|
import { Network, NetworkEndpoints } from '@injectivelabs/networks';
|
|
5
5
|
interface MsgBroadcasterTxOptions {
|
|
6
6
|
msgs: Msgs | Msgs[];
|
|
7
|
-
injectiveAddress: string;
|
|
8
|
-
ethereumAddress?: string;
|
|
9
7
|
memo?: string;
|
|
10
8
|
gas?: {
|
|
11
9
|
gasPrice?: string;
|
|
@@ -74,7 +72,7 @@ export declare class MsgBroadcasterWithPk {
|
|
|
74
72
|
};
|
|
75
73
|
gasInfo: {
|
|
76
74
|
gasWanted: number;
|
|
77
|
-
gasUsed: number;
|
|
75
|
+
gasUsed: number;
|
|
78
76
|
};
|
|
79
77
|
}>;
|
|
80
78
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MsgBroadcasterWithPk.d.ts","sourceRoot":"","sources":["../../../../../../src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"MsgBroadcasterWithPk.d.ts","sourceRoot":"","sources":["../../../../../../src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAcjC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAClE,OAAO,EACL,OAAO,EAGP,gBAAgB,EACjB,MAAM,yBAAyB,CAAA;AAKhC,UAAU,uBAAuB;IAC/B,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE;QACJ,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,GAAG,CAAC,EAAE,MAAM,CAAA,CAAC,gBAAgB;QAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB,CAAA;CACF;AAED,UAAU,2BAA2B;IACnC,OAAO,EAAE,OAAO,CAAA;IAEhB;;;OAGG;IACH,SAAS,CAAC,EAAE;QACV,OAAO,EAAE,MAAM,CAAA;QACf,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD,UAAU,EAAE,MAAM,GAAG,UAAU,CAAA;IAC/B,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED;;;;;;;GAOG;AACH,qBAAa,oBAAoB;IACxB,SAAS,EAAE,gBAAgB,CAAA;IAE3B,OAAO,EAAE,OAAO,CAAA;IAEhB,eAAe,CAAC,EAAE,eAAe,CAAA;IAEjC,UAAU,EAAE,UAAU,CAAA;IAEtB,UAAU,EAAE,OAAO,CAAQ;gBAEtB,OAAO,EAAE,2BAA2B;IAehD;;;;;OAKG;IACG,SAAS,CAAC,WAAW,EAAE,uBAAuB;IAgEpD;;;;;OAKG;IACG,0BAA0B,CAAC,WAAW,EAAE,uBAAuB;IAyCrE;;;;;OAKG;IACG,QAAQ,CAAC,WAAW,EAAE,uBAAuB;;;;;;;;;;;;;IAiDnD;;;;;;;OAOG;YACW,eAAe;IAqB7B;;OAEG;YACW,aAAa;CAY5B"}
|
|
@@ -16,7 +16,6 @@ const TxGrpcApi_1 = require("../api/TxGrpcApi");
|
|
|
16
16
|
const rest_1 = require("../../../../client/chain/rest");
|
|
17
17
|
const utils_1 = require("@injectivelabs/utils");
|
|
18
18
|
const exceptions_1 = require("@injectivelabs/exceptions");
|
|
19
|
-
const helpers_1 = require("../utils/helpers");
|
|
20
19
|
const networks_1 = require("@injectivelabs/networks");
|
|
21
20
|
const msgs_1 = require("../../../../utils/msgs");
|
|
22
21
|
const client_1 = require("../../../../client");
|
|
@@ -56,11 +55,11 @@ class MsgBroadcasterWithPk {
|
|
|
56
55
|
const msgs = Array.isArray(transaction.msgs)
|
|
57
56
|
? transaction.msgs
|
|
58
57
|
: [transaction.msgs];
|
|
59
|
-
const tx = Object.assign(Object.assign({}, transaction), { msgs: msgs
|
|
58
|
+
const tx = Object.assign(Object.assign({}, transaction), { msgs: msgs });
|
|
60
59
|
/** Account Details * */
|
|
61
60
|
const publicKey = privateKey.toPublicKey();
|
|
62
61
|
const chainRestAuthApi = new rest_1.ChainRestAuthApi(endpoints.rest);
|
|
63
|
-
const accountDetailsResponse = yield chainRestAuthApi.fetchAccount(
|
|
62
|
+
const accountDetailsResponse = yield chainRestAuthApi.fetchAccount(privateKey.toBech32());
|
|
64
63
|
const baseAccount = accounts_1.BaseAccount.fromRestApi(accountDetailsResponse);
|
|
65
64
|
const accountDetails = baseAccount.toAccountDetails();
|
|
66
65
|
/** Block Details */
|
|
@@ -104,7 +103,7 @@ class MsgBroadcasterWithPk {
|
|
|
104
103
|
const msgs = Array.isArray(transaction.msgs)
|
|
105
104
|
? transaction.msgs
|
|
106
105
|
: [transaction.msgs];
|
|
107
|
-
const tx = Object.assign(Object.assign({}, transaction), { msgs: msgs
|
|
106
|
+
const tx = Object.assign(Object.assign({}, transaction), { msgs: msgs });
|
|
108
107
|
const web3Msgs = msgs.map((msg) => msg.toWeb3());
|
|
109
108
|
if (!ethereumChainId) {
|
|
110
109
|
throw new exceptions_1.GeneralException(new Error('Please provide ethereumChainId'));
|
|
@@ -139,11 +138,11 @@ class MsgBroadcasterWithPk {
|
|
|
139
138
|
const { privateKey, endpoints, chainId } = this;
|
|
140
139
|
const tx = Object.assign(Object.assign({}, transaction), { msgs: Array.isArray(transaction.msgs)
|
|
141
140
|
? transaction.msgs
|
|
142
|
-
: [transaction.msgs]
|
|
141
|
+
: [transaction.msgs] });
|
|
143
142
|
/** Account Details * */
|
|
144
143
|
const publicKey = privateKey.toPublicKey();
|
|
145
144
|
const chainRestAuthApi = new rest_1.ChainRestAuthApi(endpoints.rest);
|
|
146
|
-
const accountDetailsResponse = yield chainRestAuthApi.fetchAccount(
|
|
145
|
+
const accountDetailsResponse = yield chainRestAuthApi.fetchAccount(privateKey.toBech32());
|
|
147
146
|
const baseAccount = accounts_1.BaseAccount.fromRestApi(accountDetailsResponse);
|
|
148
147
|
const accountDetails = baseAccount.toAccountDetails();
|
|
149
148
|
/** Block Details */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MsgBroadcasterWithPk.js","sourceRoot":"","sources":["../../../../../../src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAA2D;AAE3D,8BAAyC;AACzC,gDAA4C;AAC5C,wDAGsC;AACtC,gDAK6B;AAC7B,0DAA4D;
|
|
1
|
+
{"version":3,"file":"MsgBroadcasterWithPk.js","sourceR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Id, EthereumChainId } from '@injectivelabs/ts-types';
|
|
4
|
+
import { Network, NetworkEndpoints } from '@injectivelabs/networks';
|
|
5
|
+
interface MsgBroadcasterTxOptions {
|
|
6
|
+
msgs: Msgs | Msgs[];
|
|
7
|
+
memo?: string;
|
|
8
|
+
gas?: {
|
|
9
|
+
gasPrice?: string;
|
|
10
|
+
gas?: number; /** gas limit */
|
|
11
|
+
feePayer?: string;
|
|
12
|
+
granter?: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
interface MsgBroadcasterOptionsWithPk {
|
|
16
|
+
network: Network;
|
|
17
|
+
/**
|
|
18
|
+
* Only used if we want to override the default
|
|
19
|
+
* endpoints taken from the network param
|
|
20
|
+
*/
|
|
21
|
+
endpoints?: {
|
|
22
|
+
indexer: string;
|
|
23
|
+
grpc: string;
|
|
24
|
+
rest: string;
|
|
25
|
+
};
|
|
26
|
+
privateKey: string | PrivateKey;
|
|
27
|
+
ethereumChainId?: EthereumChainId;
|
|
28
|
+
simulateTx?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* This class is used to broadcast transactions
|
|
32
|
+
* using a privateKey as a signer
|
|
33
|
+
* for the transactions and broadcasting
|
|
34
|
+
* the transactions directly to the node
|
|
35
|
+
*
|
|
36
|
+
* Mainly used for working in a Node Environment
|
|
37
|
+
*/
|
|
38
|
+
export declare class MsgBroadcasterWithPkAndLocalSequence {
|
|
39
|
+
endpoints: NetworkEndpoints;
|
|
40
|
+
chainId: ChainId;
|
|
41
|
+
ethereumChainId?: EthereumChainId;
|
|
42
|
+
privateKey: PrivateKey;
|
|
43
|
+
simulateTx: boolean;
|
|
44
|
+
baseAccount: BaseAccount | undefined;
|
|
45
|
+
txCount: number;
|
|
46
|
+
constructor(options: MsgBroadcasterOptionsWithPk);
|
|
47
|
+
/**
|
|
48
|
+
* Broadcasting the transaction using the client
|
|
49
|
+
*
|
|
50
|
+
* @param tx
|
|
51
|
+
* @returns {string} transaction hash
|
|
52
|
+
*/
|
|
53
|
+
broadcast(transaction: MsgBroadcasterTxOptions): Promise<import("../types").TxResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* Broadcasting the transaction with fee delegation services
|
|
56
|
+
*
|
|
57
|
+
* @param tx
|
|
58
|
+
* @returns {string} transaction hash
|
|
59
|
+
*/
|
|
60
|
+
broadcastWithFeeDelegation(transaction: MsgBroadcasterTxOptions): Promise<import("../types").TxResponse>;
|
|
61
|
+
/**
|
|
62
|
+
* Broadcasting the transaction using the client
|
|
63
|
+
*
|
|
64
|
+
* @param tx
|
|
65
|
+
* @returns {string} transaction hash
|
|
66
|
+
*/
|
|
67
|
+
simulate(transaction: MsgBroadcasterTxOptions): Promise<{
|
|
68
|
+
result: {
|
|
69
|
+
data: string | Uint8Array;
|
|
70
|
+
/** Broadcast transaction */
|
|
71
|
+
log: string;
|
|
72
|
+
eventsList: import("@injectivelabs/core-proto-ts/cjs/tendermint/abci/types").Event[];
|
|
73
|
+
events?: import("@injectivelabs/core-proto-ts/cjs/tendermint/abci/types").Event[] | undefined;
|
|
74
|
+
msgResponses?: import("@injectivelabs/core-proto-ts/cjs/google/protobuf/any").Any[] | undefined;
|
|
75
|
+
};
|
|
76
|
+
gasInfo: {
|
|
77
|
+
gasWanted: number;
|
|
78
|
+
gasUsed: number;
|
|
79
|
+
};
|
|
80
|
+
}>;
|
|
81
|
+
/**
|
|
82
|
+
* In case we don't want to simulate the transaction
|
|
83
|
+
* we get the gas limit based on the message type.
|
|
84
|
+
*
|
|
85
|
+
* If we want to simulate the transaction we set the
|
|
86
|
+
* gas limit based on the simulation and add a small multiplier
|
|
87
|
+
* to be safe (factor of 1.1)
|
|
88
|
+
*/
|
|
89
|
+
private getTxWithStdFee;
|
|
90
|
+
/**
|
|
91
|
+
* Create TxRaw and simulate it
|
|
92
|
+
*/
|
|
93
|
+
private simulateTxRaw;
|
|
94
|
+
private getAccountDetails;
|
|
95
|
+
private incrementTxCount;
|
|
96
|
+
}
|
|
97
|
+
export {};
|
|
98
|
+
//# sourceMappingURL=MsgBroadcasterWithPkAndLocalSequence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MsgBroadcasterWithPkAndLocalSequence.d.ts","sourceRoot":"","sources":["../../../../../../src/core/modules/tx/broadcaster/MsgBroadcasterWithPkAndLocalSequence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAcjC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAClE,OAAO,EACL,OAAO,EAGP,gBAAgB,EACjB,MAAM,yBAAyB,CAAA;AAKhC,UAAU,uBAAuB;IAC/B,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE;QACJ,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,GAAG,CAAC,EAAE,MAAM,CAAA,CAAC,gBAAgB;QAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB,CAAA;CACF;AAED,UAAU,2BAA2B;IACnC,OAAO,EAAE,OAAO,CAAA;IAEhB;;;OAGG;IACH,SAAS,CAAC,EAAE;QACV,OAAO,EAAE,MAAM,CAAA;QACf,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD,UAAU,EAAE,MAAM,GAAG,UAAU,CAAA;IAC/B,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED;;;;;;;GAOG;AACH,qBAAa,oCAAoC;IACxC,SAAS,EAAE,gBAAgB,CAAA;IAE3B,OAAO,EAAE,OAAO,CAAA;IAEhB,eAAe,CAAC,EAAE,eAAe,CAAA;IAEjC,UAAU,EAAE,UAAU,CAAA;IAEtB,UAAU,EAAE,OAAO,CAAQ;IAE3B,WAAW,EAAE,WAAW,GAAG,SAAS,CAAY;IAEhD,OAAO,EAAE,MAAM,CAAI;gBAEd,OAAO,EAAE,2BAA2B;IAehD;;;;;OAKG;IACG,SAAS,CAAC,WAAW,EAAE,uBAAuB;IA6DpD;;;;;OAKG;IACG,0BAA0B,CAAC,WAAW,EAAE,uBAAuB;IAyCrE;;;;;OAKG;IACG,QAAQ,CAAC,WAAW,EAAE,uBAAuB;;;YArEjD,4BAA4B;;;;;;;;;;;IAmH9B;;;;;;;OAOG;YACW,eAAe;IAqB7B;;OAEG;YACW,aAAa;YAab,iBAAiB;YAejB,gBAAgB;CAG/B"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.MsgBroadcasterWithPkAndLocalSequence = void 0;
|
|
13
|
+
const accounts_1 = require("../../../accounts");
|
|
14
|
+
const tx_1 = require("../tx");
|
|
15
|
+
const TxGrpcApi_1 = require("../api/TxGrpcApi");
|
|
16
|
+
const rest_1 = require("../../../../client/chain/rest");
|
|
17
|
+
const utils_1 = require("@injectivelabs/utils");
|
|
18
|
+
const exceptions_1 = require("@injectivelabs/exceptions");
|
|
19
|
+
const networks_1 = require("@injectivelabs/networks");
|
|
20
|
+
const msgs_1 = require("../../../../utils/msgs");
|
|
21
|
+
const client_1 = require("../../../../client");
|
|
22
|
+
/**
|
|
23
|
+
* This class is used to broadcast transactions
|
|
24
|
+
* using a privateKey as a signer
|
|
25
|
+
* for the transactions and broadcasting
|
|
26
|
+
* the transactions directly to the node
|
|
27
|
+
*
|
|
28
|
+
* Mainly used for working in a Node Environment
|
|
29
|
+
*/
|
|
30
|
+
class MsgBroadcasterWithPkAndLocalSequence {
|
|
31
|
+
constructor(options) {
|
|
32
|
+
this.simulateTx = false;
|
|
33
|
+
this.baseAccount = undefined;
|
|
34
|
+
this.txCount = 0;
|
|
35
|
+
const networkInfo = (0, networks_1.getNetworkInfo)(options.network);
|
|
36
|
+
const endpoints = (0, networks_1.getNetworkEndpoints)(options.network);
|
|
37
|
+
this.simulateTx = options.simulateTx || false;
|
|
38
|
+
this.chainId = networkInfo.chainId;
|
|
39
|
+
this.ethereumChainId =
|
|
40
|
+
options.ethereumChainId || networkInfo.ethereumChainId;
|
|
41
|
+
this.endpoints = Object.assign(Object.assign({}, endpoints), (options.endpoints || {}));
|
|
42
|
+
this.privateKey =
|
|
43
|
+
options.privateKey instanceof accounts_1.PrivateKey
|
|
44
|
+
? options.privateKey
|
|
45
|
+
: accounts_1.PrivateKey.fromHex(options.privateKey);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Broadcasting the transaction using the client
|
|
49
|
+
*
|
|
50
|
+
* @param tx
|
|
51
|
+
* @returns {string} transaction hash
|
|
52
|
+
*/
|
|
53
|
+
broadcast(transaction) {
|
|
54
|
+
var _a;
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const { chainId, privateKey, endpoints, txCount } = this;
|
|
57
|
+
const msgs = Array.isArray(transaction.msgs)
|
|
58
|
+
? transaction.msgs
|
|
59
|
+
: [transaction.msgs];
|
|
60
|
+
const tx = Object.assign(Object.assign({}, transaction), { msgs });
|
|
61
|
+
/** Account Details * */
|
|
62
|
+
const publicKey = privateKey.toPublicKey();
|
|
63
|
+
const accountDetails = yield this.getAccountDetails();
|
|
64
|
+
/** Block Details */
|
|
65
|
+
const chainRestTendermintApi = new rest_1.ChainRestTendermintApi(endpoints.rest);
|
|
66
|
+
const latestBlock = yield chainRestTendermintApi.fetchLatestBlock();
|
|
67
|
+
const latestHeight = latestBlock.header.height;
|
|
68
|
+
const timeoutHeight = new utils_1.BigNumberInBase(latestHeight).plus(utils_1.DEFAULT_BLOCK_TIMEOUT_HEIGHT);
|
|
69
|
+
const gas = (((_a = transaction.gas) === null || _a === void 0 ? void 0 : _a.gas) || (0, msgs_1.getGasPriceBasedOnMessage)(msgs)).toString();
|
|
70
|
+
/** Prepare the Transaction * */
|
|
71
|
+
const { signBytes, txRaw } = yield this.getTxWithStdFee({
|
|
72
|
+
memo: tx.memo || '',
|
|
73
|
+
message: msgs,
|
|
74
|
+
fee: (0, utils_1.getStdFee)(Object.assign(Object.assign({}, tx.gas), { gas })),
|
|
75
|
+
timeoutHeight: timeoutHeight.toNumber(),
|
|
76
|
+
pubKey: publicKey.toBase64(),
|
|
77
|
+
sequence: accountDetails.sequence + txCount,
|
|
78
|
+
accountNumber: accountDetails.accountNumber,
|
|
79
|
+
chainId: chainId,
|
|
80
|
+
});
|
|
81
|
+
/** Sign transaction */
|
|
82
|
+
const signature = yield privateKey.sign(Buffer.from(signBytes));
|
|
83
|
+
/** Append Signatures */
|
|
84
|
+
txRaw.signatures = [signature];
|
|
85
|
+
/** Broadcast transaction */
|
|
86
|
+
const txResponse = yield new TxGrpcApi_1.TxGrpcApi(endpoints.grpc).broadcast(txRaw);
|
|
87
|
+
if (txResponse.code !== 0) {
|
|
88
|
+
throw new exceptions_1.GeneralException(new Error(`Transaction failed to be broadcasted - ${txResponse.rawLog}`));
|
|
89
|
+
}
|
|
90
|
+
this.incrementTxCount();
|
|
91
|
+
return txResponse;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Broadcasting the transaction with fee delegation services
|
|
96
|
+
*
|
|
97
|
+
* @param tx
|
|
98
|
+
* @returns {string} transaction hash
|
|
99
|
+
*/
|
|
100
|
+
broadcastWithFeeDelegation(transaction) {
|
|
101
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
const { simulateTx, privateKey, ethereumChainId, endpoints } = this;
|
|
103
|
+
const msgs = Array.isArray(transaction.msgs)
|
|
104
|
+
? transaction.msgs
|
|
105
|
+
: [transaction.msgs];
|
|
106
|
+
const tx = Object.assign(Object.assign({}, transaction), { msgs });
|
|
107
|
+
const web3Msgs = msgs.map((msg) => msg.toWeb3());
|
|
108
|
+
if (!ethereumChainId) {
|
|
109
|
+
throw new exceptions_1.GeneralException(new Error('Please provide ethereumChainId'));
|
|
110
|
+
}
|
|
111
|
+
const transactionApi = new client_1.IndexerGrpcTransactionApi(endpoints.indexer);
|
|
112
|
+
const txResponse = yield transactionApi.prepareTxRequest({
|
|
113
|
+
memo: tx.memo,
|
|
114
|
+
message: web3Msgs,
|
|
115
|
+
address: tx.ethereumAddress,
|
|
116
|
+
chainId: ethereumChainId,
|
|
117
|
+
gasLimit: (0, msgs_1.getGasPriceBasedOnMessage)(msgs),
|
|
118
|
+
estimateGas: simulateTx || false,
|
|
119
|
+
});
|
|
120
|
+
const signature = yield privateKey.signTypedData(JSON.parse(txResponse.data));
|
|
121
|
+
const response = yield transactionApi.broadcastTxRequest({
|
|
122
|
+
txResponse,
|
|
123
|
+
message: web3Msgs,
|
|
124
|
+
chainId: ethereumChainId,
|
|
125
|
+
signature: `0x${Buffer.from(signature).toString('hex')}`,
|
|
126
|
+
});
|
|
127
|
+
return yield new TxGrpcApi_1.TxGrpcApi(endpoints.grpc).fetchTxPoll(response.txHash);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Broadcasting the transaction using the client
|
|
132
|
+
*
|
|
133
|
+
* @param tx
|
|
134
|
+
* @returns {string} transaction hash
|
|
135
|
+
*/
|
|
136
|
+
simulate(transaction) {
|
|
137
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
const { privateKey, endpoints, chainId, txCount } = this;
|
|
139
|
+
const msgs = Array.isArray(transaction.msgs)
|
|
140
|
+
? transaction.msgs
|
|
141
|
+
: [transaction.msgs];
|
|
142
|
+
const tx = Object.assign(Object.assign({}, transaction), { msgs });
|
|
143
|
+
/** Account Details * */
|
|
144
|
+
const publicKey = privateKey.toPublicKey();
|
|
145
|
+
const accountDetails = yield this.getAccountDetails();
|
|
146
|
+
/** Block Details */
|
|
147
|
+
const chainRestTendermintApi = new rest_1.ChainRestTendermintApi(endpoints.rest);
|
|
148
|
+
const latestBlock = yield chainRestTendermintApi.fetchLatestBlock();
|
|
149
|
+
const latestHeight = latestBlock.header.height;
|
|
150
|
+
const timeoutHeight = new utils_1.BigNumberInBase(latestHeight).plus(utils_1.DEFAULT_BLOCK_TIMEOUT_HEIGHT);
|
|
151
|
+
/** Prepare the Transaction * */
|
|
152
|
+
const { txRaw } = (0, tx_1.createTransaction)({
|
|
153
|
+
memo: tx.memo || '',
|
|
154
|
+
fee: utils_1.DEFAULT_STD_FEE,
|
|
155
|
+
message: tx.msgs,
|
|
156
|
+
timeoutHeight: timeoutHeight.toNumber(),
|
|
157
|
+
pubKey: publicKey.toBase64(),
|
|
158
|
+
sequence: accountDetails.sequence + txCount,
|
|
159
|
+
accountNumber: accountDetails.accountNumber,
|
|
160
|
+
chainId: chainId,
|
|
161
|
+
});
|
|
162
|
+
/** Append Blank Signatures */
|
|
163
|
+
txRaw.signatures = [new Uint8Array(0)];
|
|
164
|
+
/** Simulate transaction */
|
|
165
|
+
const simulationResponse = yield new TxGrpcApi_1.TxGrpcApi(endpoints.grpc).simulate(txRaw);
|
|
166
|
+
return simulationResponse;
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* In case we don't want to simulate the transaction
|
|
171
|
+
* we get the gas limit based on the message type.
|
|
172
|
+
*
|
|
173
|
+
* If we want to simulate the transaction we set the
|
|
174
|
+
* gas limit based on the simulation and add a small multiplier
|
|
175
|
+
* to be safe (factor of 1.1)
|
|
176
|
+
*/
|
|
177
|
+
getTxWithStdFee(args) {
|
|
178
|
+
var _a;
|
|
179
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
180
|
+
const { simulateTx } = this;
|
|
181
|
+
if (!simulateTx) {
|
|
182
|
+
return (0, tx_1.createTransaction)(args);
|
|
183
|
+
}
|
|
184
|
+
const result = yield this.simulateTxRaw(args);
|
|
185
|
+
if (!((_a = result.gasInfo) === null || _a === void 0 ? void 0 : _a.gasUsed)) {
|
|
186
|
+
return (0, tx_1.createTransaction)(args);
|
|
187
|
+
}
|
|
188
|
+
const stdGasFee = (0, utils_1.getStdFee)(Object.assign(Object.assign({}, args.fee), { gas: new utils_1.BigNumberInBase(result.gasInfo.gasUsed).times(1.1).toFixed() }));
|
|
189
|
+
return (0, tx_1.createTransaction)(Object.assign(Object.assign({}, args), { fee: stdGasFee }));
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Create TxRaw and simulate it
|
|
194
|
+
*/
|
|
195
|
+
simulateTxRaw(args) {
|
|
196
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
197
|
+
const { endpoints } = this;
|
|
198
|
+
const { txRaw } = (0, tx_1.createTransaction)(args);
|
|
199
|
+
txRaw.signatures = [new Uint8Array(0)];
|
|
200
|
+
const simulationResponse = yield new TxGrpcApi_1.TxGrpcApi(endpoints.grpc).simulate(txRaw);
|
|
201
|
+
return simulationResponse;
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
getAccountDetails() {
|
|
205
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
206
|
+
if (this.baseAccount) {
|
|
207
|
+
return this.baseAccount.toAccountDetails();
|
|
208
|
+
}
|
|
209
|
+
const chainRestAuthApi = new rest_1.ChainRestAuthApi(this.endpoints.rest);
|
|
210
|
+
const accountDetailsResponse = yield chainRestAuthApi.fetchAccount(this.privateKey.toBech32());
|
|
211
|
+
this.baseAccount = accounts_1.BaseAccount.fromRestApi(accountDetailsResponse);
|
|
212
|
+
return this.baseAccount.toAccountDetails();
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
incrementTxCount() {
|
|
216
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
217
|
+
this.txCount += 1;
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
exports.MsgBroadcasterWithPkAndLocalSequence = MsgBroadcasterWithPkAndLocalSequence;
|
|
222
|
+
//# sourceMappingURL=MsgBroadcasterWithPkAndLocalSequence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MsgBroadcasterWithPkAndLocalSequence.js","sourceRoot":"","sources":["../../../../../../src/core/modules/tx/broadcaster/MsgBroadcasterWithPkAndLocalSequence.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAA2D;AAE3D,8BAAyC;AACzC,gDAA4C;AAC5C,wDAGsC;AACtC,gDAK6B;AAC7B,0DAA4D;AAE5D,sDAKgC;AAChC,iDAAkE;AAElE,+CAA8D;AA8B9D;;;;;;;GAOG;AACH,MAAa,oCAAoC;IAe/C,YAAY,OAAoC;QANzC,eAAU,GAAY,KAAK,CAAA;QAE3B,gBAAW,GAA4B,SAAS,CAAA;QAEhD,YAAO,GAAW,CAAC,CAAA;QAGxB,MAAM,WAAW,GAAG,IAAA,yBAAc,EAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QACnD,MAAM,SAAS,GAAG,IAAA,8BAAmB,EAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAEtD,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,KAAK,CAAA;QAC7C,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAAA;QAClC,IAAI,CAAC,eAAe;YAClB,OAAO,CAA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,CAAC,QAAQ,CACrE,KAAK,CACN,CAAA;YAED,OAAO,kBAAkB,CAAA;QAC3B,CAAC;KAAA;IAEa,iBAAiB;;YAC7B,IAAI,IAAI,CAAC,WAAW,EAAE;gBACpB,OAAO,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAA;aAC3C;YAED,MAAM,gBAAgB,GAAG,IAAI,uBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;YAClE,MAAM,sBAAsB,GAAG,MAAM,gBAAgB,CAAC,YAAY,CAChE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAC3B,CAAA;YAED,IAAI,CAAC,WAAW,GAAG,sBAAW,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAA;YAElE,OAAO,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAA;QAC5C,CAAC;KAAA;IAEa,gBAAgB;;YAC5B,IAAI,CAAC,OAAO,IAAI,CAAC,CAAA;QACnB,CAAC;KAAA;CACF;AAnQD,oFAmQC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/core/modules/tx/broadcaster/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/core/modules/tx/broadcaster/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,wCAAwC,CAAA"}
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./MsgBroadcasterWithPk"), exports);
|
|
18
|
+
__exportStar(require("./MsgBroadcasterWithPkAndLocalSequence"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/core/modules/tx/broadcaster/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAsC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/core/modules/tx/broadcaster/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAsC;AACtC,yEAAsD"}
|
|
@@ -22,7 +22,7 @@ export declare class BaseAccount extends Address {
|
|
|
22
22
|
});
|
|
23
23
|
static fromRestApi(accountResponse: AccountResponse): BaseAccount;
|
|
24
24
|
static fromRestCosmosApi(accountResponse: BaseAccountRestResponse): BaseAccount;
|
|
25
|
-
incrementSequence():
|
|
25
|
+
incrementSequence(): this;
|
|
26
26
|
toAccountDetails(): AccountDetails;
|
|
27
27
|
}
|
|
28
28
|
//# sourceMappingURL=BaseAccount.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseAccount.d.ts","sourceRoot":"","sources":["../../../../src/core/accounts/BaseAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD;;GAEG;AACH,qBAAa,WAAY,SAAQ,OAAO;IAC/B,aAAa,EAAE,MAAM,CAAA;IAErB,QAAQ,EAAE,MAAM,CAAA;IAEhB,MAAM,EAAE;QACb,IAAI,EAAE,MAAM,CAAA;QACZ,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;gBAEW,EACV,OAAO,EACP,aAAa,EACb,QAAQ,EACR,MAAM,GACP,EAAE;QACD,OAAO,EAAE,MAAM,CAAA;QACf,aAAa,EAAE,MAAM,CAAA;QACrB,QAAQ,EAAE,MAAM,CAAA;QAChB,MAAM,EAAE;YACN,IAAI,EAAE,MAAM,CAAA;YACZ,GAAG,EAAE,MAAM,CAAA;SACZ,CAAA;KACF;IAOD,MAAM,CAAC,WAAW,CAAC,eAAe,EAAE,eAAe;IAqBnD,MAAM,CAAC,iBAAiB,CAAC,eAAe,EAAE,uBAAuB;IAqB1D,iBAAiB;
|
|
1
|
+
{"version":3,"file":"BaseAccount.d.ts","sourceRoot":"","sources":["../../../../src/core/accounts/BaseAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD;;GAEG;AACH,qBAAa,WAAY,SAAQ,OAAO;IAC/B,aAAa,EAAE,MAAM,CAAA;IAErB,QAAQ,EAAE,MAAM,CAAA;IAEhB,MAAM,EAAE;QACb,IAAI,EAAE,MAAM,CAAA;QACZ,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;gBAEW,EACV,OAAO,EACP,aAAa,EACb,QAAQ,EACR,MAAM,GACP,EAAE;QACD,OAAO,EAAE,MAAM,CAAA;QACf,aAAa,EAAE,MAAM,CAAA;QACrB,QAAQ,EAAE,MAAM,CAAA;QAChB,MAAM,EAAE;YACN,IAAI,EAAE,MAAM,CAAA;YACZ,GAAG,EAAE,MAAM,CAAA;SACZ,CAAA;KACF;IAOD,MAAM,CAAC,WAAW,CAAC,eAAe,EAAE,eAAe;IAqBnD,MAAM,CAAC,iBAAiB,CAAC,eAAe,EAAE,uBAAuB;IAqB1D,iBAAiB;IAMjB,gBAAgB,IAAI,cAAc;CAQ1C"}
|
|
@@ -53,13 +53,14 @@ export class BaseAccount extends Address {
|
|
|
53
53
|
}
|
|
54
54
|
incrementSequence() {
|
|
55
55
|
this.sequence += 1;
|
|
56
|
+
return this;
|
|
56
57
|
}
|
|
57
58
|
toAccountDetails() {
|
|
58
59
|
return {
|
|
59
|
-
address: this.bech32Address,
|
|
60
60
|
pubKey: this.pubKey,
|
|
61
|
-
accountNumber: this.accountNumber,
|
|
62
61
|
sequence: this.sequence,
|
|
62
|
+
address: this.bech32Address,
|
|
63
|
+
accountNumber: this.accountNumber,
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseAccount.js","sourceRoot":"","sources":["../../../../src/core/accounts/BaseAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAInC;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,OAAO;IAC/B,aAAa,CAAQ;IAErB,QAAQ,CAAQ;IAEhB,MAAM,CAGZ;IAED,YAAY,EACV,OAAO,EACP,aAAa,EACb,QAAQ,EACR,MAAM,GASP;QACC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,eAAgC;QACjD,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,eAAe,CAAC,OAAO,CAAA;QAE7D,OAAO,IAAI,WAAW,CAAC;YACrB,OAAO,EAAE,WAAW,CAAC,OAAO;YAC5B,aAAa,EAAE,WAAW,CAAC,cAAc;gBACvC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,cAAc,EAAE,EAAE,CAAC;gBAC1C,CAAC,CAAC,CAAC;YACL,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YACvE,MAAM,EAAE,WAAW,CAAC,OAAO;gBACzB,CAAC,CAAC;oBACE,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC;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C,CAAC;oBACE,IAAI,EAAE,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC;oBACtC,GAAG,EAAE,eAAe,CAAC,OAAO,CAAC,GAAG;iBACjC;gBACH,CAAC,CAAC;oBACE,IAAI,EAAE,EAAE;oBACR,GAAG,EAAE,EAAE;iBACR;SACN,CAAC,CAAA;IACJ,CAAC;IAEM,iBAAiB;QACtB,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAA;QAElB,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,gBAAgB;QACrB,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,OAAO,EAAE,IAAI,CAAC,aAAa;YAC3B,aAAa,EAAE,IAAI,CAAC,aAAa;SAClC,CAAA;IACH,CAAC;CACF"}
|
|
@@ -4,8 +4,6 @@ import { ChainId, EthereumChainId } from '@injectivelabs/ts-types';
|
|
|
4
4
|
import { Network, NetworkEndpoints } from '@injectivelabs/networks';
|
|
5
5
|
interface MsgBroadcasterTxOptions {
|
|
6
6
|
msgs: Msgs | Msgs[];
|
|
7
|
-
injectiveAddress: string;
|
|
8
|
-
ethereumAddress?: string;
|
|
9
7
|
memo?: string;
|
|
10
8
|
gas?: {
|
|
11
9
|
gasPrice?: string;
|
|
@@ -74,7 +72,7 @@ export declare class MsgBroadcasterWithPk {
|
|
|
74
72
|
};
|
|
75
73
|
gasInfo: {
|
|
76
74
|
gasWanted: number;
|
|
77
|
-
gasUsed: number;
|
|
75
|
+
gasUsed: number;
|
|
78
76
|
};
|
|
79
77
|
}>;
|
|
80
78
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MsgBroadcasterWithPk.d.ts","sourceRoot":"","sources":["../../../../../../src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,IAAI,EA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;OAKG;IACG,SAAS,CAAC,WAAW,EAAE,uBAAuB;IAgEpD;;;;;OAKG;IACG,0BAA0B,CAAC,WAAW,EAAE,uBAAuB;IAyCrE;;;;;OAKG;IACG,QAAQ,CAAC,WAAW,EAAE,uBAAuB;;;;;;;;;;;;;IAiDnD;;;;;;;OAOG;YACW,eAAe;IAqB7B;;OAEG;YACW,aAAa;CAY5B"}
|
|
@@ -4,7 +4,6 @@ import { TxGrpcApi } from '../api/TxGrpcApi';
|
|
|
4
4
|
import { ChainRestAuthApi, ChainRestTendermintApi, } from '../../../../client/chain/rest';
|
|
5
5
|
import { getStdFee, DEFAULT_STD_FEE, BigNumberInBase, DEFAULT_BLOCK_TIMEOUT_HEIGHT, } from '@injectivelabs/utils';
|
|
6
6
|
import { GeneralException } from '@injectivelabs/exceptions';
|
|
7
|
-
import { getEthereumSignerAddress, getInjectiveSignerAddress, } from '../utils/helpers';
|
|
8
7
|
import { getNetworkInfo, getNetworkEndpoints, } from '@injectivelabs/networks';
|
|
9
8
|
import { getGasPriceBasedOnMessage } from '../../../../utils/msgs';
|
|
10
9
|
import { IndexerGrpcTransactionApi } from '../../../../client';
|
|
@@ -49,13 +48,11 @@ export class MsgBroadcasterWithPk {
|
|
|
49
48
|
const tx = {
|
|
50
49
|
...transaction,
|
|
51
50
|
msgs: msgs,
|
|
52
|
-
ethereumAddress: getEthereumSignerAddress(transaction.injectiveAddress),
|
|
53
|
-
injectiveAddress: getInjectiveSignerAddress(transaction.injectiveAddress),
|
|
54
51
|
};
|
|
55
52
|
/** Account Details * */
|
|
56
53
|
const publicKey = privateKey.toPublicKey();
|
|
57
54
|
const chainRestAuthApi = new ChainRestAuthApi(endpoints.rest);
|
|
58
|
-
const accountDetailsResponse = await chainRestAuthApi.fetchAccount(
|
|
55
|
+
const accountDetailsResponse = await chainRestAuthApi.fetchAccount(privateKey.toBech32());
|
|
59
56
|
const baseAccount = BaseAccount.fromRestApi(accountDetailsResponse);
|
|
60
57
|
const accountDetails = baseAccount.toAccountDetails();
|
|
61
58
|
/** Block Details */
|
|
@@ -100,8 +97,6 @@ export class MsgBroadcasterWithPk {
|
|
|
100
97
|
const tx = {
|
|
101
98
|
...transaction,
|
|
102
99
|
msgs: msgs,
|
|
103
|
-
ethereumAddress: getEthereumSignerAddress(transaction.injectiveAddress),
|
|
104
|
-
injectiveAddress: getInjectiveSignerAddress(transaction.injectiveAddress),
|
|
105
100
|
};
|
|
106
101
|
const web3Msgs = msgs.map((msg) => msg.toWeb3());
|
|
107
102
|
if (!ethereumChainId) {
|
|
@@ -138,13 +133,11 @@ export class MsgBroadcasterWithPk {
|
|
|
138
133
|
msgs: Array.isArray(transaction.msgs)
|
|
139
134
|
? transaction.msgs
|
|
140
135
|
: [transaction.msgs],
|
|
141
|
-
ethereumAddress: getEthereumSignerAddress(transaction.injectiveAddress),
|
|
142
|
-
injectiveAddress: getInjectiveSignerAddress(transaction.injectiveAddress),
|
|
143
136
|
};
|
|
144
137
|
/** Account Details * */
|
|
145
138
|
const publicKey = privateKey.toPublicKey();
|
|
146
139
|
const chainRestAuthApi = new ChainRestAuthApi(endpoints.rest);
|
|
147
|
-
const accountDetailsResponse = await chainRestAuthApi.fetchAccount(
|
|
140
|
+
const accountDetailsResponse = await chainRestAuthApi.fetchAccount(privateKey.toBech32());
|
|
148
141
|
const baseAccount = BaseAccount.fromRestApi(accountDetailsResponse);
|
|
149
142
|
const accountDetails = baseAccount.toAccountDetails();
|
|
150
143
|
/** Block Details */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MsgBroadcasterWithPk.js","sourceRoot":"","sources":["../../../../../../src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EACL,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACL,SAAS,EACT,eAAe,EACf,eAAe,EACf,4BAA4B,GAC7B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"MsgBroadcasterWithPk.js","sourceRoot":"","sources":["../../../../../../src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EACL,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACL,SAAS,EACT,eAAe,EACf,eAAe,EACf,4BAA4B,GAC7B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAE5D,OAAO,EAEL,cAAc,EACd,mBAAmB,GAEpB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAElE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAA;AA8B9D;;;;;;;GAOG;AACH,MAAM,OAAO,oBAAoB;IACxB,SAAS,CAAkB;IAE3B,OAAO,CAAS;IAEhB,eAAe,CAAkB;IAEjC,UAAU,CAAY;IAEtB,UAAU,GAAY,KAAK,CAAA;IAElC,YAAY,OAAoC;QAC9C,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QACnD,MAAM,SAAS,GAAG,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAEtD,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,KAA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,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE;SACtE,CAAC,CAAA;QAEF,OAAO,iBAAiB,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAA;IACvD,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,aAAa,CAAC,IAA2B;QACrD,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAA;QAC1B,MAAM,EAAE,KAAK,EAAE,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAA;QAEzC,KAAK,CAAC,UAAU,GAAG,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;QAEtC,MAAM,kBAAkB,GAAG,MAAM,IAAI,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,CACrE,KAAK,CACN,CAAA;QAED,OAAO,kBAAkB,CAAA;IAC3B,CAAC;CACF"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { BaseAccount, PrivateKey } from '../../../accounts';
|
|
2
|
+
import { Msgs } from '../../msgs';
|
|
3
|
+
import { ChainId, EthereumChainId } from '@injectivelabs/ts-types';
|
|
4
|
+
import { Network, NetworkEndpoints } from '@injectivelabs/networks';
|
|
5
|
+
interface MsgBroadcasterTxOptions {
|
|
6
|
+
msgs: Msgs | Msgs[];
|
|
7
|
+
memo?: string;
|
|
8
|
+
gas?: {
|
|
9
|
+
gasPrice?: string;
|
|
10
|
+
gas?: number; /** gas limit */
|
|
11
|
+
feePayer?: string;
|
|
12
|
+
granter?: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
interface MsgBroadcasterOptionsWithPk {
|
|
16
|
+
network: Network;
|
|
17
|
+
/**
|
|
18
|
+
* Only used if we want to override the default
|
|
19
|
+
* endpoints taken from the network param
|
|
20
|
+
*/
|
|
21
|
+
endpoints?: {
|
|
22
|
+
indexer: string;
|
|
23
|
+
grpc: string;
|
|
24
|
+
rest: string;
|
|
25
|
+
};
|
|
26
|
+
privateKey: string | PrivateKey;
|
|
27
|
+
ethereumChainId?: EthereumChainId;
|
|
28
|
+
simulateTx?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* This class is used to broadcast transactions
|
|
32
|
+
* using a privateKey as a signer
|
|
33
|
+
* for the transactions and broadcasting
|
|
34
|
+
* the transactions directly to the node
|
|
35
|
+
*
|
|
36
|
+
* Mainly used for working in a Node Environment
|
|
37
|
+
*/
|
|
38
|
+
export declare class MsgBroadcasterWithPkAndLocalSequence {
|
|
39
|
+
endpoints: NetworkEndpoints;
|
|
40
|
+
chainId: ChainId;
|
|
41
|
+
ethereumChainId?: EthereumChainId;
|
|
42
|
+
privateKey: PrivateKey;
|
|
43
|
+
simulateTx: boolean;
|
|
44
|
+
baseAccount: BaseAccount | undefined;
|
|
45
|
+
txCount: number;
|
|
46
|
+
constructor(options: MsgBroadcasterOptionsWithPk);
|
|
47
|
+
/**
|
|
48
|
+
* Broadcasting the transaction using the client
|
|
49
|
+
*
|
|
50
|
+
* @param tx
|
|
51
|
+
* @returns {string} transaction hash
|
|
52
|
+
*/
|
|
53
|
+
broadcast(transaction: MsgBroadcasterTxOptions): Promise<import("../types").TxResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* Broadcasting the transaction with fee delegation services
|
|
56
|
+
*
|
|
57
|
+
* @param tx
|
|
58
|
+
* @returns {string} transaction hash
|
|
59
|
+
*/
|
|
60
|
+
broadcastWithFeeDelegation(transaction: MsgBroadcasterTxOptions): Promise<import("../types").TxResponse>;
|
|
61
|
+
/**
|
|
62
|
+
* Broadcasting the transaction using the client
|
|
63
|
+
*
|
|
64
|
+
* @param tx
|
|
65
|
+
* @returns {string} transaction hash
|
|
66
|
+
*/
|
|
67
|
+
simulate(transaction: MsgBroadcasterTxOptions): Promise<{
|
|
68
|
+
result: {
|
|
69
|
+
data: string | Uint8Array;
|
|
70
|
+
/** Broadcast transaction */
|
|
71
|
+
log: string;
|
|
72
|
+
eventsList: import("@injectivelabs/core-proto-ts/cjs/tendermint/abci/types").Event[];
|
|
73
|
+
events?: import("@injectivelabs/core-proto-ts/cjs/tendermint/abci/types").Event[] | undefined;
|
|
74
|
+
msgResponses?: import("@injectivelabs/core-proto-ts/cjs/google/protobuf/any").Any[] | undefined;
|
|
75
|
+
};
|
|
76
|
+
gasInfo: {
|
|
77
|
+
gasWanted: number;
|
|
78
|
+
gasUsed: number;
|
|
79
|
+
};
|
|
80
|
+
}>;
|
|
81
|
+
/**
|
|
82
|
+
* In case we don't want to simulate the transaction
|
|
83
|
+
* we get the gas limit based on the message type.
|
|
84
|
+
*
|
|
85
|
+
* If we want to simulate the transaction we set the
|
|
86
|
+
* gas limit based on the simulation and add a small multiplier
|
|
87
|
+
* to be safe (factor of 1.1)
|
|
88
|
+
*/
|
|
89
|
+
private getTxWithStdFee;
|
|
90
|
+
/**
|
|
91
|
+
* Create TxRaw and simulate it
|
|
92
|
+
*/
|
|
93
|
+
private simulateTxRaw;
|
|
94
|
+
private getAccountDetails;
|
|
95
|
+
private incrementTxCount;
|
|
96
|
+
}
|
|
97
|
+
export {};
|
|
98
|
+
//# sourceMappingURL=MsgBroadcasterWithPkAndLocalSequence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MsgBroadcasterWithPkAndLocalSequence.d.ts","sourceRoot":"","sources":["../../../../../../src/core/modules/tx/broadcaster/MsgBroadcasterWithPkAndLocalSequence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAcjC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAClE,OAAO,EACL,OAAO,EAGP,gBAAgB,EACjB,MAAM,yBAAyB,CAAA;AAKhC,UAAU,uBAAuB;IAC/B,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,CAAA;IACnB,IAAI,CAA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|
|
3
|
+
import { TxGrpcApi } from '../api/TxGrpcApi';
|
|
4
|
+
import { ChainRestAuthApi, ChainRestTendermintApi, } from '../../../../client/chain/rest';
|
|
5
|
+
import { getStdFee, DEFAULT_STD_FEE, BigNumberInBase, DEFAULT_BLOCK_TIMEOUT_HEIGHT, } from '@injectivelabs/utils';
|
|
6
|
+
import { GeneralException } from '@injectivelabs/exceptions';
|
|
7
|
+
import { getNetworkInfo, getNetworkEndpoints, } from '@injectivelabs/networks';
|
|
8
|
+
import { getGasPriceBasedOnMessage } from '../../../../utils/msgs';
|
|
9
|
+
import { IndexerGrpcTransactionApi } from '../../../../client';
|
|
10
|
+
/**
|
|
11
|
+
* This class is used to broadcast transactions
|
|
12
|
+
* using a privateKey as a signer
|
|
13
|
+
* for the transactions and broadcasting
|
|
14
|
+
* the transactions directly to the node
|
|
15
|
+
*
|
|
16
|
+
* Mainly used for working in a Node Environment
|
|
17
|
+
*/
|
|
18
|
+
export class MsgBroadcasterWithPkAndLocalSequence {
|
|
19
|
+
endpoints;
|
|
20
|
+
chainId;
|
|
21
|
+
ethereumChainId;
|
|
22
|
+
privateKey;
|
|
23
|
+
simulateTx = false;
|
|
24
|
+
baseAccount = undefined;
|
|
25
|
+
txCount = 0;
|
|
26
|
+
constructor(options) {
|
|
27
|
+
const networkInfo = getNetworkInfo(options.network);
|
|
28
|
+
const endpoints = getNetworkEndpoints(options.network);
|
|
29
|
+
this.simulateTx = options.simulateTx || false;
|
|
30
|
+
this.chainId = networkInfo.chainId;
|
|
31
|
+
this.ethereumChainId =
|
|
32
|
+
options.ethereumChainId || networkInfo.ethereumChainId;
|
|
33
|
+
this.endpoints = { ...endpoints, ...(options.endpoints || {}) };
|
|
34
|
+
this.privateKey =
|
|
35
|
+
options.privateKey instanceof PrivateKey
|
|
36
|
+
? options.privateKey
|
|
37
|
+
: PrivateKey.fromHex(options.privateKey);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Broadcasting the transaction using the client
|
|
41
|
+
*
|
|
42
|
+
* @param tx
|
|
43
|
+
* @returns {string} transaction hash
|
|
44
|
+
*/
|
|
45
|
+
async broadcast(transaction) {
|
|
46
|
+
const { chainId, privateKey, endpoints, txCount } = this;
|
|
47
|
+
const msgs = Array.isArray(transaction.msgs)
|
|
48
|
+
? transaction.msgs
|
|
49
|
+
: [transaction.msgs];
|
|
50
|
+
const tx = {
|
|
51
|
+
...transaction,
|
|
52
|
+
msgs,
|
|
53
|
+
};
|
|
54
|
+
/** Account Details * */
|
|
55
|
+
const publicKey = privateKey.toPublicKey();
|
|
56
|
+
const accountDetails = await this.getAccountDetails();
|
|
57
|
+
/** Block Details */
|
|
58
|
+
const chainRestTendermintApi = new ChainRestTendermintApi(endpoints.rest);
|
|
59
|
+
const latestBlock = await chainRestTendermintApi.fetchLatestBlock();
|
|
60
|
+
const latestHeight = latestBlock.header.height;
|
|
61
|
+
const timeoutHeight = new BigNumberInBase(latestHeight).plus(DEFAULT_BLOCK_TIMEOUT_HEIGHT);
|
|
62
|
+
const gas = (transaction.gas?.gas || getGasPriceBasedOnMessage(msgs)).toString();
|
|
63
|
+
/** Prepare the Transaction * */
|
|
64
|
+
const { signBytes, txRaw } = await this.getTxWithStdFee({
|
|
65
|
+
memo: tx.memo || '',
|
|
66
|
+
message: msgs,
|
|
67
|
+
fee: getStdFee({ ...tx.gas, gas }),
|
|
68
|
+
timeoutHeight: timeoutHeight.toNumber(),
|
|
69
|
+
pubKey: publicKey.toBase64(),
|
|
70
|
+
sequence: accountDetails.sequence + txCount,
|
|
71
|
+
accountNumber: accountDetails.accountNumber,
|
|
72
|
+
chainId: chainId,
|
|
73
|
+
});
|
|
74
|
+
/** Sign transaction */
|
|
75
|
+
const signature = await privateKey.sign(Buffer.from(signBytes));
|
|
76
|
+
/** Append Signatures */
|
|
77
|
+
txRaw.signatures = [signature];
|
|
78
|
+
/** Broadcast transaction */
|
|
79
|
+
const txResponse = await new TxGrpcApi(endpoints.grpc).broadcast(txRaw);
|
|
80
|
+
if (txResponse.code !== 0) {
|
|
81
|
+
throw new GeneralException(new Error(`Transaction failed to be broadcasted - ${txResponse.rawLog}`));
|
|
82
|
+
}
|
|
83
|
+
this.incrementTxCount();
|
|
84
|
+
return txResponse;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Broadcasting the transaction with fee delegation services
|
|
88
|
+
*
|
|
89
|
+
* @param tx
|
|
90
|
+
* @returns {string} transaction hash
|
|
91
|
+
*/
|
|
92
|
+
async broadcastWithFeeDelegation(transaction) {
|
|
93
|
+
const { simulateTx, privateKey, ethereumChainId, endpoints } = this;
|
|
94
|
+
const msgs = Array.isArray(transaction.msgs)
|
|
95
|
+
? transaction.msgs
|
|
96
|
+
: [transaction.msgs];
|
|
97
|
+
const tx = {
|
|
98
|
+
...transaction,
|
|
99
|
+
msgs,
|
|
100
|
+
};
|
|
101
|
+
const web3Msgs = msgs.map((msg) => msg.toWeb3());
|
|
102
|
+
if (!ethereumChainId) {
|
|
103
|
+
throw new GeneralException(new Error('Please provide ethereumChainId'));
|
|
104
|
+
}
|
|
105
|
+
const transactionApi = new IndexerGrpcTransactionApi(endpoints.indexer);
|
|
106
|
+
const txResponse = await transactionApi.prepareTxRequest({
|
|
107
|
+
memo: tx.memo,
|
|
108
|
+
message: web3Msgs,
|
|
109
|
+
address: tx.ethereumAddress,
|
|
110
|
+
chainId: ethereumChainId,
|
|
111
|
+
gasLimit: getGasPriceBasedOnMessage(msgs),
|
|
112
|
+
estimateGas: simulateTx || false,
|
|
113
|
+
});
|
|
114
|
+
const signature = await privateKey.signTypedData(JSON.parse(txResponse.data));
|
|
115
|
+
const response = await transactionApi.broadcastTxRequest({
|
|
116
|
+
txResponse,
|
|
117
|
+
message: web3Msgs,
|
|
118
|
+
chainId: ethereumChainId,
|
|
119
|
+
signature: `0x${Buffer.from(signature).toString('hex')}`,
|
|
120
|
+
});
|
|
121
|
+
return await new TxGrpcApi(endpoints.grpc).fetchTxPoll(response.txHash);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Broadcasting the transaction using the client
|
|
125
|
+
*
|
|
126
|
+
* @param tx
|
|
127
|
+
* @returns {string} transaction hash
|
|
128
|
+
*/
|
|
129
|
+
async simulate(transaction) {
|
|
130
|
+
const { privateKey, endpoints, chainId, txCount } = this;
|
|
131
|
+
const msgs = Array.isArray(transaction.msgs)
|
|
132
|
+
? transaction.msgs
|
|
133
|
+
: [transaction.msgs];
|
|
134
|
+
const tx = {
|
|
135
|
+
...transaction,
|
|
136
|
+
msgs,
|
|
137
|
+
};
|
|
138
|
+
/** Account Details * */
|
|
139
|
+
const publicKey = privateKey.toPublicKey();
|
|
140
|
+
const accountDetails = await this.getAccountDetails();
|
|
141
|
+
/** Block Details */
|
|
142
|
+
const chainRestTendermintApi = new ChainRestTendermintApi(endpoints.rest);
|
|
143
|
+
const latestBlock = await chainRestTendermintApi.fetchLatestBlock();
|
|
144
|
+
const latestHeight = latestBlock.header.height;
|
|
145
|
+
const timeoutHeight = new BigNumberInBase(latestHeight).plus(DEFAULT_BLOCK_TIMEOUT_HEIGHT);
|
|
146
|
+
/** Prepare the Transaction * */
|
|
147
|
+
const { txRaw } = createTransaction({
|
|
148
|
+
memo: tx.memo || '',
|
|
149
|
+
fee: DEFAULT_STD_FEE,
|
|
150
|
+
message: tx.msgs,
|
|
151
|
+
timeoutHeight: timeoutHeight.toNumber(),
|
|
152
|
+
pubKey: publicKey.toBase64(),
|
|
153
|
+
sequence: accountDetails.sequence + txCount,
|
|
154
|
+
accountNumber: accountDetails.accountNumber,
|
|
155
|
+
chainId: chainId,
|
|
156
|
+
});
|
|
157
|
+
/** Append Blank Signatures */
|
|
158
|
+
txRaw.signatures = [new Uint8Array(0)];
|
|
159
|
+
/** Simulate transaction */
|
|
160
|
+
const simulationResponse = await new TxGrpcApi(endpoints.grpc).simulate(txRaw);
|
|
161
|
+
return simulationResponse;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* In case we don't want to simulate the transaction
|
|
165
|
+
* we get the gas limit based on the message type.
|
|
166
|
+
*
|
|
167
|
+
* If we want to simulate the transaction we set the
|
|
168
|
+
* gas limit based on the simulation and add a small multiplier
|
|
169
|
+
* to be safe (factor of 1.1)
|
|
170
|
+
*/
|
|
171
|
+
async getTxWithStdFee(args) {
|
|
172
|
+
const { simulateTx } = this;
|
|
173
|
+
if (!simulateTx) {
|
|
174
|
+
return createTransaction(args);
|
|
175
|
+
}
|
|
176
|
+
const result = await this.simulateTxRaw(args);
|
|
177
|
+
if (!result.gasInfo?.gasUsed) {
|
|
178
|
+
return createTransaction(args);
|
|
179
|
+
}
|
|
180
|
+
const stdGasFee = getStdFee({
|
|
181
|
+
...args.fee,
|
|
182
|
+
gas: new BigNumberInBase(result.gasInfo.gasUsed).times(1.1).toFixed(),
|
|
183
|
+
});
|
|
184
|
+
return createTransaction({ ...args, fee: stdGasFee });
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Create TxRaw and simulate it
|
|
188
|
+
*/
|
|
189
|
+
async simulateTxRaw(args) {
|
|
190
|
+
const { endpoints } = this;
|
|
191
|
+
const { txRaw } = createTransaction(args);
|
|
192
|
+
txRaw.signatures = [new Uint8Array(0)];
|
|
193
|
+
const simulationResponse = await new TxGrpcApi(endpoints.grpc).simulate(txRaw);
|
|
194
|
+
return simulationResponse;
|
|
195
|
+
}
|
|
196
|
+
async getAccountDetails() {
|
|
197
|
+
if (this.baseAccount) {
|
|
198
|
+
return this.baseAccount.toAccountDetails();
|
|
199
|
+
}
|
|
200
|
+
const chainRestAuthApi = new ChainRestAuthApi(this.endpoints.rest);
|
|
201
|
+
const accountDetailsResponse = await chainRestAuthApi.fetchAccount(this.privateKey.toBech32());
|
|
202
|
+
this.baseAccount = BaseAccount.fromRestApi(accountDetailsResponse);
|
|
203
|
+
return this.baseAccount.toAccountDetails();
|
|
204
|
+
}
|
|
205
|
+
async incrementTxCount() {
|
|
206
|
+
this.txCount += 1;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=MsgBroadcasterWithPkAndLocalSequence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MsgBroadcasterWithPkAndLocalSequence.js","sourceRoot":"","sources":["../../../../../../src/core/modules/tx/broadcaster/MsgBroadcasterWithPkAndLocalSequence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EACL,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACL,SAAS,EACT,eAAe,EACf,eAAe,EACf,4BAA4B,GAC7B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAE5D,OAAO,EAEL,cAAc,EACd,mBAAmB,GAEpB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAElE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAA;AA8B9D;;;;;;;GAOG;AACH,MAAM,OAAO,oCAAoC;IACxC,SAAS,CAAkB;IAE3B,OAAO,CAAS;IAEhB,eAAe,CAAkB;IAEjC,UAAU,CAAY;IAEtB,UAAU,GAAY,KAAK,CAAA;IAE3B,WAAW,GAA4B,SAAS,CAAA;IAEhD,OAAO,GAAW,CAAC,CAAA;IAE1B,YAAY,OAAoC;QAC9C,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QACnD,MAAM,SAAS,GAAG,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAEtD,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,KAAK,CAAA;QAC7C,IAAI,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,MAAM,kBAAkB,GAAG,MAAM,IAAI,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,CACrE,KAAK,CACN,CAAA;QAED,OAAO,kBAAkB,CAAA;IAC3B,CAAC;IAEO,KAAK,CAAC,iBAAiB;QAC7B,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,OAAO,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAA;SAC3C;QAED,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;QAClE,MAAM,sBAAsB,GAAG,MAAM,gBAAgB,CAAC,YAAY,CAChE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAC3B,CAAA;QAED,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAA;QAElE,OAAO,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAA;IAC5C,CAAC;IAEO,KAAK,CAAC,gBAAgB;QAC5B,IAAI,CAAC,OAAO,IAAI,CAAC,CAAA;IACnB,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/core/modules/tx/broadcaster/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/core/modules/tx/broadcaster/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,wCAAwC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/core/modules/tx/broadcaster/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/core/modules/tx/broadcaster/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,wCAAwC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/sdk-ts",
|
|
3
3
|
"description": "SDK in TypeScript for building Injective applications in a browser, node, and react native environment.",
|
|
4
|
-
"version": "1.14.
|
|
4
|
+
"version": "1.14.1-beta.1",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"author": {
|
|
@@ -40,17 +40,17 @@
|
|
|
40
40
|
"@ethersproject/bytes": "^5.7.0",
|
|
41
41
|
"@injectivelabs/core-proto-ts": "^0.0.18",
|
|
42
42
|
"@injectivelabs/dmm-proto-ts": "1.0.16",
|
|
43
|
-
"@injectivelabs/exceptions": "^1.14.0",
|
|
43
|
+
"@injectivelabs/exceptions": "^1.14.1-beta.0",
|
|
44
44
|
"@injectivelabs/grpc-web": "^0.0.1",
|
|
45
45
|
"@injectivelabs/grpc-web-node-http-transport": "^0.0.2",
|
|
46
46
|
"@injectivelabs/grpc-web-react-native-transport": "^0.0.2",
|
|
47
|
-
"@injectivelabs/indexer-proto-ts": "1.11.
|
|
47
|
+
"@injectivelabs/indexer-proto-ts": "1.11.10",
|
|
48
48
|
"@injectivelabs/mito-proto-ts": "1.0.46",
|
|
49
|
-
"@injectivelabs/networks": "^1.14.0",
|
|
50
|
-
"@injectivelabs/test-utils": "^1.14.0",
|
|
51
|
-
"@injectivelabs/token-metadata": "^1.14.0",
|
|
52
|
-
"@injectivelabs/ts-types": "^1.14.0",
|
|
53
|
-
"@injectivelabs/utils": "^1.14.0",
|
|
49
|
+
"@injectivelabs/networks": "^1.14.1-beta.0",
|
|
50
|
+
"@injectivelabs/test-utils": "^1.14.1-beta.0",
|
|
51
|
+
"@injectivelabs/token-metadata": "^1.14.1-beta.0",
|
|
52
|
+
"@injectivelabs/ts-types": "^1.14.1-beta.0",
|
|
53
|
+
"@injectivelabs/utils": "^1.14.1-beta.0",
|
|
54
54
|
"@metamask/eth-sig-util": "^4.0.0",
|
|
55
55
|
"axios": "^0.27.2",
|
|
56
56
|
"bech32": "^2.0.0",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"shx": "^0.3.2",
|
|
72
72
|
"snakecase-keys": "^5.4.1"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "35371b3aeddbd84b5c6986d5da75260a49a5b306",
|
|
75
75
|
"typedoc": {
|
|
76
76
|
"entryPoint": "./src/index.ts",
|
|
77
77
|
"readmeFile": "./README.md",
|