@injectivelabs/sdk-ts 0.0.65 → 0.0.68
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/README.md +197 -104
- package/dist/client/chain/grpc/index.d.ts +0 -1
- package/dist/client/chain/grpc/index.d.ts.map +1 -1
- package/dist/client/chain/grpc/index.js +1 -3
- package/dist/client/chain/grpc/index.js.map +1 -1
- package/dist/client/exchange/grpc/ExchangeGrpcTransactionApi.d.ts +35 -0
- package/dist/client/exchange/grpc/ExchangeGrpcTransactionApi.d.ts.map +1 -0
- package/dist/client/exchange/grpc/ExchangeGrpcTransactionApi.js +122 -0
- package/dist/client/exchange/grpc/ExchangeGrpcTransactionApi.js.map +1 -0
- package/dist/client/exchange/grpc/index.d.ts +1 -0
- package/dist/client/exchange/grpc/index.d.ts.map +1 -1
- package/dist/client/exchange/grpc/index.js +3 -1
- package/dist/client/exchange/grpc/index.js.map +1 -1
- package/dist/client/exchange/rest/ExchangeRestExplorerApi.d.ts +6 -6
- package/dist/client/exchange/rest/ExchangeRestExplorerApi.d.ts.map +1 -1
- package/dist/client/exchange/transformers/ExchangeRestExplorerTransformer.d.ts +6 -6
- package/dist/client/exchange/transformers/ExchangeRestExplorerTransformer.d.ts.map +1 -1
- package/dist/client/exchange/transformers/index.d.ts +9 -8
- package/dist/client/exchange/transformers/index.d.ts.map +1 -1
- package/dist/client/exchange/transformers/index.js +9 -8
- package/dist/client/exchange/transformers/index.js.map +1 -1
- package/dist/client/exchange/types/explorer-rest.d.ts +4 -4
- package/dist/client/exchange/types/explorer-rest.d.ts.map +1 -1
- package/dist/client/exchange/types/index.d.ts +1 -0
- package/dist/client/exchange/types/index.d.ts.map +1 -1
- package/dist/client/exchange/types/index.js +1 -0
- package/dist/client/exchange/types/index.js.map +1 -1
- package/dist/local/index.d.ts +0 -2
- package/dist/local/index.d.ts.map +1 -1
- package/dist/local/index.js +0 -2
- package/dist/local/index.js.map +1 -1
- package/dist/utils/transaction.js +2 -2
- package/dist/utils/transaction.js.map +1 -1
- package/package.json +3 -3
- package/dist/local/TxInjective.d.ts +0 -28
- package/dist/local/TxInjective.d.ts.map +0 -1
- package/dist/local/TxInjective.js +0 -105
- package/dist/local/TxInjective.js.map +0 -1
- package/dist/local/TxService.d.ts +0 -17
- package/dist/local/TxService.d.ts.map +0 -1
- package/dist/local/TxService.js +0 -70
- package/dist/local/TxService.js.map +0 -1
package/README.md
CHANGED
|
@@ -6,9 +6,32 @@
|
|
|
6
6
|
|
|
7
7
|
_Accessing decentralized finance through TypeScript (for Web and Node environment)_
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
`@injectivelabs/sdk-ts` is a TypeScript SDK for writing applications on top of the Injective chain in both a Node.js and a browser environment.
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="#"><strong>Documentation</strong></a>
|
|
13
|
+
·
|
|
14
|
+
<a href="https://github.com/InjectiveLabs/sdk-ts-examples">Examples</a>
|
|
15
|
+
·
|
|
16
|
+
<a href="#">API Reference</a>
|
|
17
|
+
·
|
|
18
|
+
<a href="https://www.npmjs.com/package/@injectivelabs/sdk-ts">NPM Package</a>
|
|
19
|
+
·
|
|
20
|
+
<a href="https://github.com/injectivelabs/sdk-ts">GitHub</a>
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
### ✨ Features
|
|
24
|
+
|
|
25
|
+
- **Written in TypeScript**, with type definitions,
|
|
26
|
+
- Works in Node.js and in the browser,
|
|
27
|
+
- Exposes on-chain data and the exchange-api data,
|
|
28
|
+
- Parses responses into native JavaScript types
|
|
29
|
+
- much more ...
|
|
30
|
+
|
|
31
|
+
We highly suggest using the `@injectivelabs/sdk-ts` with TypeScript, or JavaScript in a code editor that has support for type declarations, so you can take advantage of the helpful type hints that are included with the package.
|
|
10
32
|
|
|
11
|
-
|
|
33
|
+
|
|
34
|
+
### 📚 Installation
|
|
12
35
|
|
|
13
36
|
```bash
|
|
14
37
|
yarn add @injectivelabs/sdk-ts
|
|
@@ -18,48 +41,35 @@ yarn add @injectivelabs/sdk-ts
|
|
|
18
41
|
|
|
19
42
|
## 📖 Documentation
|
|
20
43
|
|
|
21
|
-
There are
|
|
22
|
-
|
|
23
|
-
We are going to go through all of the components of the package and explain them in depth.
|
|
44
|
+
There are two pieces of the `sdk-ts` - **querying a data source** and **making transactions**.
|
|
24
45
|
|
|
25
|
-
###
|
|
46
|
+
### Querying a data source
|
|
26
47
|
|
|
27
|
-
|
|
48
|
+
There are 2 data sources that can be accessed through the `sdk-ts`:
|
|
28
49
|
|
|
29
|
-
-
|
|
50
|
+
- The Injective chain itself through a sentry node,
|
|
51
|
+
- The Exchange API indexer (indexer of events from the Injective chain to a MongoDB),
|
|
30
52
|
|
|
31
|
-
|
|
53
|
+
For each of the data sources there are two ways that they can be queried:
|
|
32
54
|
|
|
33
|
-
|
|
55
|
+
- using the gRPC protocol,
|
|
56
|
+
- using REST
|
|
34
57
|
|
|
35
|
-
|
|
36
|
-
- Chain -> Consuming data directly from the chain,
|
|
37
|
-
- Exchange -> Consuming data directly from the exchange (indexer) API,
|
|
58
|
+
We also have a GraphQL consumer of the Peggy subgraph on Ethereum (used only for tracking deposits and withdrawals on Ethereum).
|
|
38
59
|
|
|
39
|
-
|
|
60
|
+
For the 2 main data sources, there are abstraction classes that developers can use to access specific modules of the Injective Chain **or** specific modules within the Exchange API. The responses of these requests are always mapped into normal JavaScript objects (regardless of the data source type) and served to the end user.
|
|
40
61
|
|
|
41
|
-
###
|
|
62
|
+
### Making Transactions
|
|
42
63
|
|
|
43
|
-
|
|
64
|
+
To interact with Injective, the user has to issue a transaction. Each transaction that is broadcasted to Injective can hold multiple messages that can change the state of the Injective chain. Within the `core` folder, developers can find a convenient way to make these messages with methods that can convert these messages in a way that they can be used by developers in different scenarios (broadcasting using the normal cosmos way or converted to EIP712 to be signed using Ethereum wallets).
|
|
44
65
|
|
|
45
|
-
Every message
|
|
66
|
+
Every message extends the `MsgBase` interface, which has couple of mapping functionalities:
|
|
46
67
|
- `toData` -> Converts the Message to a simple Object representation,
|
|
47
|
-
- `toProto` -> Returns a proto representation of the
|
|
48
|
-
- `toDirectSign` -> Converts the Message to a proto representation
|
|
49
|
-
- `toWeb3` -> Converts the Message to a web3 representation + type (ready
|
|
50
|
-
|
|
51
|
-
### Utils
|
|
52
|
-
|
|
53
|
-
This package contains some utility functions and constants.
|
|
68
|
+
- `toProto` -> Returns a proto representation of the Message,
|
|
69
|
+
- `toDirectSign` -> Converts the Message to a proto representation (ready to be used in the normal Cosmos way of handling transactions),
|
|
70
|
+
- `toWeb3` -> Converts the Message to a web3 representation + type (ready to be used in the Ethereum way of handling transactions using EIP712 typed data),
|
|
54
71
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
This package contains some utility functions and constants for client-side usage (a local - node environment)
|
|
58
|
-
|
|
59
|
-
- `Network` class -> Can be used to get a pre-defined set of endpoints (sentry, api, etc) for easier usage,
|
|
60
|
-
- `PrivateKey` class -> Can be used to sign transactions, etc
|
|
61
|
-
- `InjectiveTx` class -> Can be used to prepare a transaction for signing/broadcasting on the client side,
|
|
62
|
-
- `TxService` class -> Can be used for simulating or broadcasting a transaction on the client side
|
|
72
|
+
There are also some utility classes and functions that are exposed from the package. There is also a `local` folder that exposes some utility classes that can be used to make developers life easier in a Node environment.
|
|
63
73
|
|
|
64
74
|
---
|
|
65
75
|
|
|
@@ -69,17 +79,48 @@ Let's go through couple of use-cases of the `sdk-ts` so developers can have a re
|
|
|
69
79
|
|
|
70
80
|
### Consuming data
|
|
71
81
|
|
|
72
|
-
- Fetching user's balance from the chain
|
|
82
|
+
- Fetching user's inj balance from the chain
|
|
73
83
|
|
|
74
84
|
```ts
|
|
75
|
-
|
|
76
|
-
import {
|
|
85
|
+
import { getNetworkInfo, Network } from "@injectivelabs/networks";
|
|
86
|
+
import { ExchangeGrpcClient } from "@injectivelabs/sdk-ts/dist/client/exchange/ExchangeGrpcClient";
|
|
87
|
+
|
|
88
|
+
(async () => {
|
|
89
|
+
const network = getNetworkInfo(Network.TestnetK8s);
|
|
90
|
+
const injectiveAddress = "inj14au322k9munkmx5wrchz9q30juf5wjgz2cfqku";
|
|
91
|
+
const chainClient = new ExchangeGrpcClient(
|
|
92
|
+
network.sentryGrpcApi
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
const balances = await chainClient.bank.fetchBalances(
|
|
96
|
+
injectiveAddress
|
|
97
|
+
);
|
|
98
|
+
const injBalance = balances.find(balace => balance.denom === 'inj')
|
|
99
|
+
|
|
100
|
+
console.log(injBalance);
|
|
101
|
+
})();
|
|
77
102
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
- Fetching user's subaccount balance from the exchange api
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
import { getNetworkInfo, Network } from "@injectivelabs/networks";
|
|
109
|
+
import { ChainGrpcClient } from "@injectivelabs/sdk-ts/dist/client/chain/ChainGrpcClient";
|
|
110
|
+
|
|
111
|
+
(async () => {
|
|
112
|
+
const network = getNetworkInfo(Network.TestnetK8s);
|
|
113
|
+
const subaccountId = "0xaf79152ac5df276d9a8e1e2e22822f9713474902000000000000000000000000";
|
|
114
|
+
const exchangeClient = new ChainGrpcClient(
|
|
115
|
+
network.exchangeApi
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
const subaccountBalancesList = await exchangeClient.account.fetchSubaccountBalancesList(
|
|
119
|
+
subaccountId
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
console.log(subaccountBalancesList);
|
|
123
|
+
})();
|
|
83
124
|
```
|
|
84
125
|
|
|
85
126
|
```ts
|
|
@@ -115,81 +156,124 @@ console.log(await derivativesApi.markets())
|
|
|
115
156
|
|
|
116
157
|
### Broadcasting Transactions
|
|
117
158
|
|
|
118
|
-
-
|
|
159
|
+
- Bidding on an auction
|
|
119
160
|
|
|
120
161
|
```ts
|
|
121
|
-
import {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
162
|
+
import { getNetworkInfo, Network } from "@injectivelabs/networks";
|
|
163
|
+
import {
|
|
164
|
+
AuctionCore,
|
|
165
|
+
ChainClient,
|
|
166
|
+
PrivateKey,
|
|
167
|
+
BaseAccount,
|
|
168
|
+
TxInjective,
|
|
169
|
+
TxService,
|
|
170
|
+
} from "@injectivelabs/sdk-ts";
|
|
171
|
+
import { BigNumberInBase } from "@injectivelabs/utils";
|
|
172
|
+
|
|
173
|
+
/** MsgBid Example */
|
|
174
|
+
(async () => {
|
|
175
|
+
const network = getNetworkInfo(Network.TestnetK8s);
|
|
176
|
+
const privateKey = PrivateKey.fromPrivateKey(
|
|
177
|
+
"f9db9bf330e23cb7839039e944adef6e9df447b90b503d5b4464c90bea9022f3"
|
|
178
|
+
);
|
|
179
|
+
const injectiveAddress = privateKey.toBech32();
|
|
180
|
+
console.log(injectiveAddress, privateKey.toHex());
|
|
181
|
+
|
|
182
|
+
/** Account Details **/
|
|
183
|
+
const accountDetails = await new ChainClient.AuthRestApi(
|
|
184
|
+
network.sentryHttpApi
|
|
185
|
+
).account(injectiveAddress);
|
|
186
|
+
const baseAccount = BaseAccount.fromRestApi(accountDetails);
|
|
187
|
+
|
|
188
|
+
/** Prepare the Message */
|
|
189
|
+
const auctionModuleState = await new ChainClient.AuctionApi(
|
|
190
|
+
network.sentryGrpcApi
|
|
191
|
+
).moduleState();
|
|
192
|
+
const latestRound = auctionModuleState.getState()?.getAuctionRound();
|
|
193
|
+
const round = latestRound || 1;
|
|
194
|
+
const bid = 1; /** 100 INJ */
|
|
195
|
+
const amount = {
|
|
196
|
+
amount: new BigNumberInBase(bid).toWei().toFixed(),
|
|
197
|
+
denom: "inj",
|
|
198
|
+
};
|
|
199
|
+
const msg = new AuctionCore.MsgBid({
|
|
200
|
+
round,
|
|
201
|
+
amount,
|
|
202
|
+
injectiveAddress,
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
/** Prepare the Transaction **/
|
|
206
|
+
const txInjective = new TxInjective({
|
|
207
|
+
baseAccount,
|
|
156
208
|
msgs: [msg],
|
|
157
209
|
chainId: network.chainId,
|
|
158
|
-
address: injectiveAddress
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
210
|
+
address: injectiveAddress,
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
/** Sign transaction */
|
|
214
|
+
const signature = await privateKey.sign(txInjective.signBytes);
|
|
215
|
+
const signedTxInjective = txInjective.withSignature(signature);
|
|
216
|
+
|
|
217
|
+
/** Calculate hash of the transaction */
|
|
218
|
+
console.log(`Transaction Hash: ${signedTxInjective.getTxHash()}`);
|
|
219
|
+
|
|
220
|
+
const txService = new TxService({
|
|
221
|
+
txInjective: signedTxInjective,
|
|
222
|
+
endpoint: network.sentryGrpcApi,
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
/** Simulate transaction */
|
|
226
|
+
const simulationResponse = await txService.simulate();
|
|
227
|
+
console.log(
|
|
228
|
+
`Transaction simulation response: ${JSON.stringify(
|
|
229
|
+
simulationResponse.gasInfo
|
|
230
|
+
)}`
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
/** Broadcast transaction */
|
|
234
|
+
const txResponse = await txService.broadcast();
|
|
235
|
+
console.log(
|
|
236
|
+
`Broadcasted transaction hash: ${JSON.stringify(txResponse.txhash)}`
|
|
237
|
+
);
|
|
238
|
+
})();
|
|
176
239
|
```
|
|
177
240
|
|
|
178
241
|
### Streaming Data
|
|
179
242
|
|
|
180
|
-
|
|
243
|
+
- Streaming users subaccount balances from the exchange API
|
|
181
244
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
245
|
+
```ts
|
|
246
|
+
import { getNetworkInfo, Network } from "@injectivelabs/networks";
|
|
247
|
+
import { protoObjectToJson } from "@injectivelabs/sdk-ts";
|
|
248
|
+
import { ExchangeGrpcStreamClient } from "@injectivelabs/sdk-ts/dist/client/exchange/ExchangeGrpcStreamClient";
|
|
249
|
+
|
|
250
|
+
(async () => {
|
|
251
|
+
const network = getNetworkInfo(Network.TestnetK8s);
|
|
252
|
+
|
|
253
|
+
const subaccountId =
|
|
254
|
+
"0xaf79152ac5df276d9a8e1e2e22822f9713474902000000000000000000000000";
|
|
255
|
+
|
|
256
|
+
const exchangeClient = new ExchangeGrpcStreamClient(
|
|
257
|
+
network.exchangeApi
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
await exchangeClient.account.streamSubaccountBalance({
|
|
261
|
+
subaccountId,
|
|
262
|
+
callback: (subaccountBalance) => {
|
|
263
|
+
console.log(protoObjectToJson(subaccountBalance));
|
|
264
|
+
},
|
|
265
|
+
onEndCallback: (status) => {
|
|
266
|
+
console.log("Stream has ended with status: " + status);
|
|
267
|
+
},
|
|
268
|
+
});
|
|
269
|
+
})();
|
|
270
|
+
```
|
|
185
271
|
|
|
186
|
-
|
|
187
|
-
yarn ts-node pathToExample
|
|
272
|
+
---
|
|
188
273
|
|
|
189
|
-
##
|
|
190
|
-
```
|
|
274
|
+
## 📜 Contribution
|
|
191
275
|
|
|
192
|
-
|
|
276
|
+
**Contribution guides and practices will be available once there is a stable foundation of the whole package set within the `injective-ts` repo.**
|
|
193
277
|
|
|
194
278
|
---
|
|
195
279
|
|
|
@@ -197,9 +281,18 @@ Don't forget to do `yarn` and install dependencies before executing any example.
|
|
|
197
281
|
|
|
198
282
|
Reach out to us at one of the following places!
|
|
199
283
|
|
|
200
|
-
- Website at <a href="https://
|
|
284
|
+
- Website at <a href="https://injective.com" target="_blank">`injective.com`</a>
|
|
201
285
|
- Twitter at <a href="https://twitter.com/InjectiveLabs" target="_blank">`@InjectiveLabs`</a>
|
|
286
|
+
- Discord at <a href="https://discord.com/invite/NK4qdbv" target="_blank">`Discord`</a>
|
|
287
|
+
- Telegram at <a href="https://t.me/joininjective" target="_blank">`Telegram`</a>
|
|
202
288
|
|
|
203
289
|
---
|
|
204
290
|
|
|
205
291
|
## 🔓 License
|
|
292
|
+
|
|
293
|
+
This software is licensed under the MIT license. See [LICENSE](./LICENSE) for full disclosure.
|
|
294
|
+
|
|
295
|
+
<p> </p>
|
|
296
|
+
<div align="center">
|
|
297
|
+
<sub><em>Powering the future of decentralized finance.</em></sub>
|
|
298
|
+
</div>
|
|
@@ -10,5 +10,4 @@ export { ChainGrpcMintApi } from './ChainGrpcMintApi';
|
|
|
10
10
|
export { ChainGrpcOracleApi } from './ChainGrpcOracleApi';
|
|
11
11
|
export { ChainGrpcPeggyApi } from './ChainGrpcPeggyApi';
|
|
12
12
|
export { ChainGrpcStakingApi } from './ChainGrpcStakingApi';
|
|
13
|
-
export { ChainGrpcTransactionApi } from './ChainGrpcTransactionApi';
|
|
14
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/chain/grpc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAA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E,MAAM,uBAAuB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ChainGrpcStakingApi = exports.ChainGrpcPeggyApi = exports.ChainGrpcOracleApi = exports.ChainGrpcMintApi = exports.ChainGrpcInsuranceFundApi = exports.ChainGrpcIbcApi = exports.ChainGrpcGovApi = exports.ChainGrpcExchangeApi = exports.ChainGrpcDistributionApi = exports.ChainGrpcBankApi = exports.ChainGrpcAuthApi = exports.ChainGrpcAuctionApi = void 0;
|
|
4
4
|
var ChainGrpcAuctionApi_1 = require("./ChainGrpcAuctionApi");
|
|
5
5
|
Object.defineProperty(exports, "ChainGrpcAuctionApi", { enumerable: true, get: function () { return ChainGrpcAuctionApi_1.ChainGrpcAuctionApi; } });
|
|
6
6
|
var ChainGrpcAuthApi_1 = require("./ChainGrpcAuthApi");
|
|
@@ -25,6 +25,4 @@ var ChainGrpcPeggyApi_1 = require("./ChainGrpcPeggyApi");
|
|
|
25
25
|
Object.defineProperty(exports, "ChainGrpcPeggyApi", { enumerable: true, get: function () { return ChainGrpcPeggyApi_1.ChainGrpcPeggyApi; } });
|
|
26
26
|
var ChainGrpcStakingApi_1 = require("./ChainGrpcStakingApi");
|
|
27
27
|
Object.defineProperty(exports, "ChainGrpcStakingApi", { enumerable: true, get: function () { return ChainGrpcStakingApi_1.ChainGrpcStakingApi; } });
|
|
28
|
-
var ChainGrpcTransactionApi_1 = require("./ChainGrpcTransactionApi");
|
|
29
|
-
Object.defineProperty(exports, "ChainGrpcTransactionApi", { enumerable: true, get: function () { return ChainGrpcTransactionApi_1.ChainGrpcTransactionApi; } });
|
|
30
28
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/chain/grpc/index.ts"],"names":[],"mappings":";;;AAAA,6DAA2D;AAAlD,0HAAA,mBAAmB,OAAA;AAC5B,uDAAqD;AAA5C,oHAAA,gBAAgB,OAAA;AACzB,uDAAqD;AAA5C,oHAAA,gBAAgB,OAAA;AACzB,uEAAqE;AAA5D,oIAAA,wBAAwB,OAAA;AACjC,+DAA6D;AAApD,4HAAA,oBAAoB,OAAA;AAC7B,qDAAmD;AAA1C,kHAAA,eAAe,OAAA;AACxB,qDAAmD;AAA1C,kHAAA,eAAe,OAAA;AACxB,yEAAuE;AAA9D,sIAAA,yBAAyB,OAAA;AAClC,uDAAqD;AAA5C,oHAAA,gBAAgB,OAAA;AACzB,2DAAyD;AAAhD,wHAAA,kBAAkB,OAAA;AAC3B,yDAAuD;AAA9C,sHAAA,iBAAiB,OAAA;AAC1B,6DAA2D;AAAlD,0HAAA,mBAAmB,OAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/chain/grpc/index.ts"],"names":[],"mappings":";;;AAAA,6DAA2D;AAAlD,0HAAA,mBAAmB,OAAA;AAC5B,uDAAqD;AAA5C,oHAAA,gBAAgB,OAAA;AACzB,uDAAqD;AAA5C,oHAAA,gBAAgB,OAAA;AACzB,uEAAqE;AAA5D,oIAAA,wBAAwB,OAAA;AACjC,+DAA6D;AAApD,4HAAA,oBAAoB,OAAA;AAC7B,qDAAmD;AAA1C,kHAAA,eAAe,OAAA;AACxB,qDAAmD;AAA1C,kHAAA,eAAe,OAAA;AACxB,yEAAuE;AAA9D,sIAAA,yBAAyB,OAAA;AAClC,uDAAqD;AAA5C,oHAAA,gBAAgB,OAAA;AACzB,2DAAyD;AAAhD,wHAAA,kBAAkB,OAAA;AAC3B,yDAAuD;AAA9C,sHAAA,iBAAiB,OAAA;AAC1B,6DAA2D;AAAlD,0HAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { PrepareTxResponse, BroadcastTxResponse } from '@injectivelabs/exchange-api/injective_exchange_rpc_pb';
|
|
2
|
+
import { AccountAddress, EthereumChainId } from '@injectivelabs/ts-types';
|
|
3
|
+
import BaseConsumer from '../../BaseGrpcConsumer';
|
|
4
|
+
export declare class ExchangeGrpcTransactionApi extends BaseConsumer {
|
|
5
|
+
prepareTxRequest({ address, chainId, message, memo, estimateGas, gasLimit, feeDenom, feePrice, timeoutHeight, }: {
|
|
6
|
+
address: AccountAddress;
|
|
7
|
+
chainId: EthereumChainId;
|
|
8
|
+
message: any;
|
|
9
|
+
estimateGas?: boolean;
|
|
10
|
+
gasLimit?: number;
|
|
11
|
+
memo?: string;
|
|
12
|
+
timeoutHeight?: number;
|
|
13
|
+
feeDenom?: string;
|
|
14
|
+
feePrice?: string;
|
|
15
|
+
}): Promise<PrepareTxResponse>;
|
|
16
|
+
prepareExchangeTxRequest({ address, chainId, message, memo, estimateGas, gasLimit, feeDenom, feePrice, timeoutHeight, delegatedFee, }: {
|
|
17
|
+
address: AccountAddress;
|
|
18
|
+
chainId: EthereumChainId;
|
|
19
|
+
message: any;
|
|
20
|
+
estimateGas?: boolean;
|
|
21
|
+
gasLimit?: number;
|
|
22
|
+
memo?: string;
|
|
23
|
+
feeDenom?: string;
|
|
24
|
+
feePrice?: string;
|
|
25
|
+
timeoutHeight?: number;
|
|
26
|
+
delegatedFee?: boolean;
|
|
27
|
+
}): Promise<PrepareTxResponse>;
|
|
28
|
+
broadcastTxRequest({ signature, chainId, message, txResponse, }: {
|
|
29
|
+
signature: string;
|
|
30
|
+
chainId: EthereumChainId;
|
|
31
|
+
txResponse: PrepareTxResponse;
|
|
32
|
+
message: Record<string, any>;
|
|
33
|
+
}): Promise<BroadcastTxResponse.AsObject>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=ExchangeGrpcTransactionApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExchangeGrpcTransactionApi.d.ts","sourceRoot":"","sources":["../../../../src/client/exchange/grpc/ExchangeGrpcTransactionApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAE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ACD,SAAS,EAAE,MAAM,CAAA;QACjB,OAAO,EAAE,eAAe,CAAA;QACxB,UAAU,EAAE,iBAAiB,CAAA;QAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAC7B;CAuCF"}
|
|
@@ -0,0 +1,122 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ExchangeGrpcTransactionApi = void 0;
|
|
16
|
+
const injective_exchange_rpc_pb_1 = require("@injectivelabs/exchange-api/injective_exchange_rpc_pb");
|
|
17
|
+
const injective_exchange_rpc_pb_service_1 = require("@injectivelabs/exchange-api/injective_exchange_rpc_pb_service");
|
|
18
|
+
const coin_pb_1 = require("@injectivelabs/chain-api/cosmos/base/v1beta1/coin_pb");
|
|
19
|
+
const utils_1 = require("@injectivelabs/utils");
|
|
20
|
+
const BaseGrpcConsumer_1 = __importDefault(require("../../BaseGrpcConsumer"));
|
|
21
|
+
const transaction_1 = require("../../../utils/transaction");
|
|
22
|
+
class ExchangeGrpcTransactionApi extends BaseGrpcConsumer_1.default {
|
|
23
|
+
prepareTxRequest({ address, chainId, message, memo, estimateGas = true, gasLimit = utils_1.DEFAULT_GAS_LIMIT, feeDenom = utils_1.DEFAULT_BRIDGE_FEE_DENOM, feePrice = utils_1.DEFAULT_BRIDGE_FEE_PRICE, timeoutHeight, }) {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const txFeeAmount = new coin_pb_1.Coin();
|
|
26
|
+
txFeeAmount.setDenom(feeDenom);
|
|
27
|
+
txFeeAmount.setAmount(feePrice);
|
|
28
|
+
const cosmosTxFee = new injective_exchange_rpc_pb_1.CosmosTxFee();
|
|
29
|
+
cosmosTxFee.setPriceList([txFeeAmount]);
|
|
30
|
+
if (!estimateGas) {
|
|
31
|
+
cosmosTxFee.setGas(gasLimit);
|
|
32
|
+
}
|
|
33
|
+
const prepareTxRequest = new injective_exchange_rpc_pb_1.PrepareTxRequest();
|
|
34
|
+
prepareTxRequest.setChainId(chainId);
|
|
35
|
+
prepareTxRequest.setSignerAddress(address);
|
|
36
|
+
prepareTxRequest.setFee(cosmosTxFee);
|
|
37
|
+
const arrayOfMessages = Array.isArray(message) ? message : [message];
|
|
38
|
+
for (const message of arrayOfMessages) {
|
|
39
|
+
prepareTxRequest.addMsgs(Buffer.from(JSON.stringify(message), 'utf8'));
|
|
40
|
+
}
|
|
41
|
+
if (timeoutHeight !== undefined) {
|
|
42
|
+
prepareTxRequest.setTimeoutHeight(timeoutHeight);
|
|
43
|
+
}
|
|
44
|
+
if (memo) {
|
|
45
|
+
prepareTxRequest.setMemo(memo);
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
const response = yield this.request(prepareTxRequest, injective_exchange_rpc_pb_service_1.InjectiveExchangeRPC.PrepareTx);
|
|
49
|
+
return response;
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
throw new Error(e.message);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
prepareExchangeTxRequest({ address, chainId, message, memo, estimateGas = true, gasLimit = utils_1.DEFAULT_EXCHANGE_LIMIT, feeDenom = utils_1.DEFAULT_BRIDGE_FEE_DENOM, feePrice = utils_1.DEFAULT_BRIDGE_FEE_PRICE, timeoutHeight, delegatedFee, }) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const txFeeAmount = new coin_pb_1.Coin();
|
|
59
|
+
txFeeAmount.setDenom(feeDenom);
|
|
60
|
+
txFeeAmount.setAmount(feePrice);
|
|
61
|
+
const cosmosTxFee = new injective_exchange_rpc_pb_1.CosmosTxFee();
|
|
62
|
+
cosmosTxFee.setPriceList([txFeeAmount]);
|
|
63
|
+
if (delegatedFee !== undefined) {
|
|
64
|
+
cosmosTxFee.setDelegateFee(delegatedFee);
|
|
65
|
+
}
|
|
66
|
+
if (!estimateGas) {
|
|
67
|
+
cosmosTxFee.setGas(gasLimit);
|
|
68
|
+
}
|
|
69
|
+
const prepareTxRequest = new injective_exchange_rpc_pb_1.PrepareTxRequest();
|
|
70
|
+
prepareTxRequest.setChainId(chainId);
|
|
71
|
+
prepareTxRequest.setSignerAddress(address);
|
|
72
|
+
prepareTxRequest.setFee(cosmosTxFee);
|
|
73
|
+
const arrayOfMessages = Array.isArray(message) ? message : [message];
|
|
74
|
+
for (const message of arrayOfMessages) {
|
|
75
|
+
prepareTxRequest.addMsgs(Buffer.from(JSON.stringify(message), 'utf8'));
|
|
76
|
+
}
|
|
77
|
+
if (timeoutHeight !== undefined) {
|
|
78
|
+
prepareTxRequest.setTimeoutHeight(timeoutHeight);
|
|
79
|
+
}
|
|
80
|
+
if (memo) {
|
|
81
|
+
prepareTxRequest.setMemo(memo);
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
const response = yield this.request(prepareTxRequest, injective_exchange_rpc_pb_service_1.InjectiveExchangeRPC.PrepareTx);
|
|
85
|
+
return response;
|
|
86
|
+
}
|
|
87
|
+
catch (e) {
|
|
88
|
+
throw new Error(e.message);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
broadcastTxRequest({ signature, chainId, message, txResponse, }) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
const parsedTypedData = JSON.parse(txResponse.getData());
|
|
95
|
+
const publicKeyHex = (0, transaction_1.recoverTypedSignaturePubKey)(parsedTypedData, signature);
|
|
96
|
+
const cosmosPubKey = new injective_exchange_rpc_pb_1.CosmosPubKey();
|
|
97
|
+
cosmosPubKey.setType(txResponse.getPubKeyType());
|
|
98
|
+
cosmosPubKey.setKey(publicKeyHex);
|
|
99
|
+
parsedTypedData.message.msgs = null;
|
|
100
|
+
const broadcastTxRequest = new injective_exchange_rpc_pb_1.BroadcastTxRequest();
|
|
101
|
+
broadcastTxRequest.setMode('block');
|
|
102
|
+
broadcastTxRequest.setChainId(chainId);
|
|
103
|
+
broadcastTxRequest.setPubKey(cosmosPubKey);
|
|
104
|
+
broadcastTxRequest.setSignature(signature);
|
|
105
|
+
broadcastTxRequest.setTx(Buffer.from(JSON.stringify(parsedTypedData.message), 'utf8'));
|
|
106
|
+
broadcastTxRequest.setFeePayer(txResponse.getFeePayer());
|
|
107
|
+
broadcastTxRequest.setFeePayerSig(txResponse.getFeePayerSig());
|
|
108
|
+
const arrayOfMessages = Array.isArray(message) ? message : [message];
|
|
109
|
+
const messagesList = arrayOfMessages.map((message) => Buffer.from(JSON.stringify(message), 'utf8'));
|
|
110
|
+
broadcastTxRequest.setMsgsList(messagesList);
|
|
111
|
+
try {
|
|
112
|
+
const response = yield this.request(broadcastTxRequest, injective_exchange_rpc_pb_service_1.InjectiveExchangeRPC.BroadcastTx);
|
|
113
|
+
return response.toObject();
|
|
114
|
+
}
|
|
115
|
+
catch (e) {
|
|
116
|
+
throw new Error(e.message);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.ExchangeGrpcTransactionApi = ExchangeGrpcTransactionApi;
|
|
122
|
+
//# sourceMappingURL=ExchangeGrpcTransactionApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExchangeGrpcTransactionApi.js","sourceRoot":"","sources":["../../../../src/client/exchange/grpc/ExchangeGrpcTransactionApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qGAO8D;AAC9D,qHAAoG;AACpG,kFAA2E;AAE3E,gDAK6B;AAC7B,8EAAiD;AACjD,4DAAwE;AAExE,MAAa,0BAA2B,SAAQ,0BAAY;IACpD,gBAAgB,CAAC,EACrB,OAAO,EACP,OAAO,EACP,OAAO,EACP,IAAI,EACJ,WAAW,GAAG,IAAI,EAClB,QAAQ,GAAG,yBAAiB,EAC5B,QAAQ,GAAG,gCAAwB,EACnC,QAAQ,GAAG,gCAAwB,EACnC,aAAa,GAWd;;YACC,MAAM,WAAW,GAAG,IAAI,cAAI,EAAE,CAAA;YAC9B,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;YAC9B,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;YAE/B,MAAM,WAAW,GAAG,IAAI,uCAAW,EAAE,CAAA;YACrC,WAAW,CAAC,YAAY,CAAC,CAAC,WAAW,CAAC,CAAC,CAAA;YAEvC,IAAI,CAAC,WAAW,EAAE;gBAChB,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;aAC7B;YAED,MAAM,gBAAgB,GAAG,IAAI,4CAAgB,EAAE,CAAA;YAC/C,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;YACpC,gBAAgB,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAA;YAC1C,gBAAgB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;YAEpC,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;YACpE,KAAK,MAAM,OAAO,IAAI,eAAe,EAAE;gBACrC,gBAAgB,CA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AO,CAAC,CAAA;aAC3B;QACH,CAAC;KAAA;CACF;AAtLD,gEAsLC"}
|
|
@@ -6,4 +6,5 @@ export { ExchangeGrpcOracleApi } from './ExchangeGrpcOracleApi';
|
|
|
6
6
|
export { ExchangeGrpcInsuranceFundApi } from './ExchangeGrpcInsuranceFundApi';
|
|
7
7
|
export { ExchangeGrpcDerivativesApi } from './ExchangeGrpcDerivativesApi';
|
|
8
8
|
export { ExchangeGrpcSpotApi } from './ExchangeGrpcSpotApi';
|
|
9
|
+
export { ExchangeGrpcTransactionApi } from './ExchangeGrpcTransactionApi';
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/exchange/grpc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAC7E,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAA;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/exchange/grpc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAC7E,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAA;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ExchangeGrpcSpotApi = exports.ExchangeGrpcDerivativesApi = exports.ExchangeGrpcInsuranceFundApi = exports.ExchangeGrpcOracleApi = exports.ExchangeGrpcMetaApi = exports.ExchangeGrpcExplorerApi = exports.ExchangeGrpcAuctionApi = exports.ExchangeGrpcAccountApi = void 0;
|
|
3
|
+
exports.ExchangeGrpcTransactionApi = exports.ExchangeGrpcSpotApi = exports.ExchangeGrpcDerivativesApi = exports.ExchangeGrpcInsuranceFundApi = exports.ExchangeGrpcOracleApi = exports.ExchangeGrpcMetaApi = exports.ExchangeGrpcExplorerApi = exports.ExchangeGrpcAuctionApi = exports.ExchangeGrpcAccountApi = void 0;
|
|
4
4
|
var ExchangeGrpcAccountApi_1 = require("./ExchangeGrpcAccountApi");
|
|
5
5
|
Object.defineProperty(exports, "ExchangeGrpcAccountApi", { enumerable: true, get: function () { return ExchangeGrpcAccountApi_1.ExchangeGrpcAccountApi; } });
|
|
6
6
|
var ExchangeGrpcAuctionApi_1 = require("./ExchangeGrpcAuctionApi");
|
|
@@ -17,4 +17,6 @@ var ExchangeGrpcDerivativesApi_1 = require("./ExchangeGrpcDerivativesApi");
|
|
|
17
17
|
Object.defineProperty(exports, "ExchangeGrpcDerivativesApi", { enumerable: true, get: function () { return ExchangeGrpcDerivativesApi_1.ExchangeGrpcDerivativesApi; } });
|
|
18
18
|
var ExchangeGrpcSpotApi_1 = require("./ExchangeGrpcSpotApi");
|
|
19
19
|
Object.defineProperty(exports, "ExchangeGrpcSpotApi", { enumerable: true, get: function () { return ExchangeGrpcSpotApi_1.ExchangeGrpcSpotApi; } });
|
|
20
|
+
var ExchangeGrpcTransactionApi_1 = require("./ExchangeGrpcTransactionApi");
|
|
21
|
+
Object.defineProperty(exports, "ExchangeGrpcTransactionApi", { enumerable: true, get: function () { return ExchangeGrpcTransactionApi_1.ExchangeGrpcTransactionApi; } });
|
|
20
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/exchange/grpc/index.ts"],"names":[],"mappings":";;;AAAA,mEAAiE;AAAxD,gIAAA,sBAAsB,OAAA;AAC/B,mEAAiE;AAAxD,gIAAA,sBAAsB,OAAA;AAC/B,qEAAmE;AAA1D,kIAAA,uBAAuB,OAAA;AAChC,6DAA2D;AAAlD,0HAAA,mBAAmB,OAAA;AAC5B,iEAA+D;AAAtD,8HAAA,qBAAqB,OAAA;AAC9B,+EAA6E;AAApE,4IAAA,4BAA4B,OAAA;AACrC,2EAAyE;AAAhE,wIAAA,0BAA0B,OAAA;AACnC,6DAA2D;AAAlD,0HAAA,mBAAmB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/exchange/grpc/index.ts"],"names":[],"mappings":";;;AAAA,mEAAiE;AAAxD,gIAAA,sBAAsB,OAAA;AAC/B,mEAAiE;AAAxD,gIAAA,sBAAsB,OAAA;AAC/B,qEAAmE;AAA1D,kIAAA,uBAAuB,OAAA;AAChC,6DAA2D;AAAlD,0HAAA,mBAAmB,OAAA;AAC5B,iEAA+D;AAAtD,8HAAA,qBAAqB,OAAA;AAC9B,+EAA6E;AAApE,4IAAA,4BAA4B,OAAA;AACrC,2EAAyE;AAAhE,wIAAA,0BAA0B,OAAA;AACnC,6DAA2D;AAAlD,0HAAA,mBAAmB,OAAA;AAC5B,2EAAyE;AAAhE,wIAAA,0BAA0B,OAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import BaseRestConsumer from '../../BaseRestConsumer';
|
|
2
|
-
import {
|
|
2
|
+
import { ExplorerBlockWithTxs, ExplorerTransaction, ExplorerValidatorUptime } from '../types/explorer-rest';
|
|
3
3
|
import { Block, ExplorerValidator } from '../types/explorer';
|
|
4
4
|
export declare class ExchangeRestExplorerApi extends BaseRestConsumer {
|
|
5
|
-
fetchBlock(blockHashHeight: string): Promise<
|
|
5
|
+
fetchBlock(blockHashHeight: string): Promise<ExplorerBlockWithTxs>;
|
|
6
6
|
fetchBlocks(params?: {
|
|
7
7
|
limit?: number;
|
|
8
8
|
}): Promise<Block[]>;
|
|
@@ -11,7 +11,7 @@ export declare class ExchangeRestExplorerApi extends BaseRestConsumer {
|
|
|
11
11
|
limit?: number;
|
|
12
12
|
}): Promise<{
|
|
13
13
|
total: number;
|
|
14
|
-
blocks:
|
|
14
|
+
blocks: ExplorerBlockWithTxs[];
|
|
15
15
|
}>;
|
|
16
16
|
fetchTransactions(params?: {
|
|
17
17
|
before?: number;
|
|
@@ -19,7 +19,7 @@ export declare class ExchangeRestExplorerApi extends BaseRestConsumer {
|
|
|
19
19
|
skip?: number;
|
|
20
20
|
}): Promise<{
|
|
21
21
|
total: number;
|
|
22
|
-
transactions:
|
|
22
|
+
transactions: ExplorerTransaction[];
|
|
23
23
|
}>;
|
|
24
24
|
fetchAccountTransactions({ account, before, limit, skip, }: {
|
|
25
25
|
account: string;
|
|
@@ -28,9 +28,9 @@ export declare class ExchangeRestExplorerApi extends BaseRestConsumer {
|
|
|
28
28
|
skip?: number;
|
|
29
29
|
}): Promise<{
|
|
30
30
|
total: number;
|
|
31
|
-
transactions:
|
|
31
|
+
transactions: ExplorerTransaction[];
|
|
32
32
|
}>;
|
|
33
|
-
fetchTransaction(hash: string): Promise<
|
|
33
|
+
fetchTransaction(hash: string): Promise<ExplorerTransaction>;
|
|
34
34
|
fetchValidators(): Promise<Partial<ExplorerValidator>[]>;
|
|
35
35
|
fetchValidatorUptime(validatorConsensusAddress: string): Promise<ExplorerValidatorUptime[]>;
|
|
36
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExchangeRestExplorerApi.d.ts","sourceRoot":"","sources":["../../../../src/client/exchange/rest/ExchangeRestExplorerApi.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,wBAAwB,CAAA;AACrD,OAAO,EAGL,
|
|
1
|
+
{"version":3,"file":"ExchangeRestExplorerApi.d.ts","sourceRoot":"","sources":["../../../../src/client/exchange/rest/ExchangeRestExplorerApi.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,wBAAwB,CAAA;AACrD,OAAO,EAGL,oBAAoB,EAEpB,mBAAmB,EAEnB,uBAAuB,EACxB,MAAM,wBAAwB,CAAA;AAQ/B,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE5D,qBAAa,uBAAwB,SAAQ,gBAAgB;IACrD,UAAU,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAkBlE,WAAW,CAAC,MAAM,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAa1D,iBAAiB,CAAC,MAAM,CAAC,EAAE;QAC/B,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,oBAAoB,EAAE,CAAA;KAAE,CAAC;IAqBxD,iBAAiB,CAAC,MAAM,CAAC,EAAE;QAC/B,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,mBAAmB,EAAE,CAAA;KAAE,CAAC;IAsB7D,wBAAwB,CAAC,EAC7B,OAAO,EACP,MAAM,EACN,KAAK,EACL,IAAI,GACL,EAAE;QACD,OAAO,EAAE,MAAM,CAAA;QACf,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,mBAAmB,EAAE,CAAA;KAAE,CAAC;IAoB7D,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAkB5D,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,CAAC;IAkBxD,oBAAoB,CACxB,yBAAyB,EAAE,MAAM,GAChC,OAAO,CAAC,uBAAuB,EAAE,CAAC;CAiBtC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Block, ExplorerValidator } from '../types/explorer';
|
|
2
|
-
import { BlockFromExplorerApiResponse,
|
|
2
|
+
import { BlockFromExplorerApiResponse, ExplorerBlockWithTxs, BaseTransaction, ExplorerTransaction, TransactionFromExplorerApiResponse, ValidatorUptimeFromExplorerApiResponse, ExplorerValidatorUptime } from '../types/explorer-rest';
|
|
3
3
|
export declare class ExchangeRestExplorerTransformer {
|
|
4
4
|
static blockToBlock(block: BlockFromExplorerApiResponse): Block;
|
|
5
5
|
static blocksToBlocks(blocks: BlockFromExplorerApiResponse[]): Block[];
|
|
6
|
-
static transactionToTransaction(transaction: TransactionFromExplorerApiResponse):
|
|
7
|
-
static transactionsToTransactions(transactions: TransactionFromExplorerApiResponse[]):
|
|
8
|
-
static blockWithTxToBlockWithTx(block: BlockFromExplorerApiResponse):
|
|
9
|
-
static blocksWithTxsToBlocksWithTxs(blocks: BlockFromExplorerApiResponse[]):
|
|
10
|
-
static baseTransactionToTransaction(transaction: BaseTransaction):
|
|
6
|
+
static transactionToTransaction(transaction: TransactionFromExplorerApiResponse): ExplorerTransaction;
|
|
7
|
+
static transactionsToTransactions(transactions: TransactionFromExplorerApiResponse[]): ExplorerTransaction[];
|
|
8
|
+
static blockWithTxToBlockWithTx(block: BlockFromExplorerApiResponse): ExplorerBlockWithTxs;
|
|
9
|
+
static blocksWithTxsToBlocksWithTxs(blocks: BlockFromExplorerApiResponse[]): ExplorerBlockWithTxs[];
|
|
10
|
+
static baseTransactionToTransaction(transaction: BaseTransaction): ExplorerTransaction;
|
|
11
11
|
static validatorExplorerToValidator(validators: any[]): Partial<ExplorerValidator>[];
|
|
12
12
|
static validatorUptimeToExplorerValidatorUptime(validatorUptimeList: ValidatorUptimeFromExplorerApiResponse[]): ExplorerValidatorUptime[];
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExchangeRestExplorerTransformer.d.ts","sourceRoot":"","sources":["../../../../src/client/exchange/transformers/ExchangeRestExplorerTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,EACL,4BAA4B,EAC5B,
|
|
1
|
+
{"version":3,"file":"ExchangeRestExplorerTransformer.d.ts","sourceRoot":"","sources":["../../../../src/client/exchange/transformers/ExchangeRestExplorerTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,kCAAkC,EAClC,sCAAsC,EACtC,uBAAuB,EACxB,MAAM,wBAAwB,CAAA;AAE/B,qBAAa,+BAA+B;IAC1C,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,4BAA4B,GAAG,KAAK;IAa/D,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,4BAA4B,EAAE,GAAG,KAAK,EAAE;IAItE,MAAM,CAAC,wBAAwB,CAC7B,WAAW,EAAE,kCAAkC,GAC9C,mBAAmB;IA6BtB,MAAM,CAAC,0BAA0B,CAC/B,YAAY,EAAE,kCAAkC,EAAE,GACjD,mBAAmB,EAAE;IAMxB,MAAM,CAAC,wBAAwB,CAC7B,KAAK,EAAE,4BAA4B,GAClC,oBAAoB;IAgBvB,MAAM,CAAC,4BAA4B,CACjC,MAAM,EAAE,4BAA4B,EAAE,GACrC,oBAAoB,EAAE;IAIzB,MAAM,CAAC,4BAA4B,CACjC,WAAW,EAAE,eAAe,GAC3B,mBAAmB;IAWtB,MAAM,CAAC,4BAA4B,CACjC,UAAU,EAAE,GAAG,EAAE,GAChB,OAAO,CAAC,iBAAiB,CAAC,EAAE;IAY/B,MAAM,CAAC,wCAAwC,CAC7C,mBAAmB,EAAE,sCAAsC,EAAE,GAC5D,uBAAuB,EAAE;CAQ7B"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './ExchangeAccountStreamTransformer';
|
|
2
|
+
export * from './ExchangeAuctionStreamTransformer';
|
|
2
3
|
export * from './ExchangeDerivativeStreamTransformer';
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './ExchangeSpotStreamTransformer';
|
|
4
|
+
export * from './ExchangeExplorerStreamTransformer';
|
|
5
5
|
export * from './ExchangeGrpcAccountTransformer';
|
|
6
|
-
export * from './
|
|
6
|
+
export * from './ExchangeGrpcDerivativeTransformer';
|
|
7
|
+
export * from './ExchangeGrpcSpotTransformer';
|
|
8
|
+
export * from './ExchangeGrpcOracleTransformer';
|
|
7
9
|
export * from './ExchangeGrpcAuctionTransformer';
|
|
8
|
-
export * from './ExchangeAuctionStreamTransformer';
|
|
9
|
-
export * from './ExchangeOracleStreamTransformer';
|
|
10
10
|
export * from './ExchangeGrpcExplorerTransformer';
|
|
11
|
-
export * from './ExchangeExplorerStreamTransformer';
|
|
12
|
-
export * from './ExchangeRestExplorerTransformer';
|
|
13
11
|
export * from './ExchangeGrpcInsuranceFundTransformer';
|
|
12
|
+
export * from './ExchangeOracleStreamTransformer';
|
|
13
|
+
export * from './ExchangeRestExplorerTransformer';
|
|
14
|
+
export * from './ExchangeSpotStreamTransformer';
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/exchange/transformers/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/exchange/transformers/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAA;AAClD,cAAc,oCAAoC,CAAA;AAClD,cAAc,uCAAuC,CAAA;AACrD,cAAc,qCAAqC,CAAA;AACnD,cAAc,kCAAkC,CAAA;AAChD,cAAc,qCAAqC,CAAA;AACnD,cAAc,+BAA+B,CAAA;AAC7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,kCAAkC,CAAA;AAChD,cAAc,mCAAmC,CAAA;AACjD,cAAc,wCAAwC,CAAA;AACtD,cAAc,mCAAmC,CAAA;AACjD,cAAc,mCAAmC,CAAA;AACjD,cAAc,iCAAiC,CAAA"}
|
|
@@ -10,17 +10,18 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./
|
|
13
|
+
__exportStar(require("./ExchangeAccountStreamTransformer"), exports);
|
|
14
|
+
__exportStar(require("./ExchangeAuctionStreamTransformer"), exports);
|
|
14
15
|
__exportStar(require("./ExchangeDerivativeStreamTransformer"), exports);
|
|
15
|
-
__exportStar(require("./
|
|
16
|
-
__exportStar(require("./ExchangeSpotStreamTransformer"), exports);
|
|
16
|
+
__exportStar(require("./ExchangeExplorerStreamTransformer"), exports);
|
|
17
17
|
__exportStar(require("./ExchangeGrpcAccountTransformer"), exports);
|
|
18
|
-
__exportStar(require("./
|
|
18
|
+
__exportStar(require("./ExchangeGrpcDerivativeTransformer"), exports);
|
|
19
|
+
__exportStar(require("./ExchangeGrpcSpotTransformer"), exports);
|
|
20
|
+
__exportStar(require("./ExchangeGrpcOracleTransformer"), exports);
|
|
19
21
|
__exportStar(require("./ExchangeGrpcAuctionTransformer"), exports);
|
|
20
|
-
__exportStar(require("./ExchangeAuctionStreamTransformer"), exports);
|
|
21
|
-
__exportStar(require("./ExchangeOracleStreamTransformer"), exports);
|
|
22
22
|
__exportStar(require("./ExchangeGrpcExplorerTransformer"), exports);
|
|
23
|
-
__exportStar(require("./ExchangeExplorerStreamTransformer"), exports);
|
|
24
|
-
__exportStar(require("./ExchangeRestExplorerTransformer"), exports);
|
|
25
23
|
__exportStar(require("./ExchangeGrpcInsuranceFundTransformer"), exports);
|
|
24
|
+
__exportStar(require("./ExchangeOracleStreamTransformer"), exports);
|
|
25
|
+
__exportStar(require("./ExchangeRestExplorerTransformer"), exports);
|
|
26
|
+
__exportStar(require("./ExchangeSpotStreamTransformer"), exports);
|
|
26
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/exchange/transformers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/exchange/transformers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qEAAkD;AAClD,qEAAkD;AAClD,wEAAqD;AACrD,sEAAmD;AACnD,mEAAgD;AAChD,sEAAmD;AACnD,gEAA6C;AAC7C,kEAA+C;AAC/C,mEAAgD;AAChD,oEAAiD;AACjD,yEAAsD;AACtD,oEAAiD;AACjD,oEAAiD;AACjD,kEAA+C"}
|
|
@@ -63,17 +63,17 @@ export interface Message {
|
|
|
63
63
|
type: string;
|
|
64
64
|
message: any;
|
|
65
65
|
}
|
|
66
|
-
export interface
|
|
66
|
+
export interface ExplorerTransaction extends Omit<BaseTransaction, 'messages'> {
|
|
67
67
|
memo: string;
|
|
68
68
|
messages: Message[];
|
|
69
69
|
parsedMessages?: Message[];
|
|
70
70
|
}
|
|
71
71
|
export declare type TransactionListItem = {
|
|
72
72
|
key: number;
|
|
73
|
-
list:
|
|
73
|
+
list: ExplorerTransaction[];
|
|
74
74
|
};
|
|
75
|
-
export interface
|
|
76
|
-
txs:
|
|
75
|
+
export interface ExplorerBlockWithTxs extends Omit<BaseBlockWithTxs, 'txs'> {
|
|
76
|
+
txs: ExplorerTransaction[];
|
|
77
77
|
}
|
|
78
78
|
export declare enum ValidatorUptimeStatus {
|
|
79
79
|
Proposed = "proposed",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explorer-rest.d.ts","sourceRoot":"","sources":["../../../../src/client/exchange/types/explorer-rest.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,IAAI,gBAAgB,EAChC,WAAW,IAAI,eAAe,EAC9B,eAAe,EAChB,MAAM,YAAY,CAAA;AAEnB,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,IAAI,EAAE;QACJ,MAAM,EAAE,GAAG,CAAA;QACX,IAAI,EAAE,CAAC,CAAA;KACR,CAAA;CACF;AAED,MAAM,WAAW,kCAAkC;IACjD,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,KAAK,CAAC;QAChB,MAAM,EAAE,MAAM,CAAA;QACd,OAAO,EAAE,MAAM,CAAA;QACf,SAAS,EAAE,MAAM,CAAA;QACjB,QAAQ,EAAE,MAAM,CAAA;KACjB,CAAC,CAAA;IACF,OAAO,EAAE,MAAM,CAAA;IACf,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OAAO,EAAE,GAAG,CAAA;CACb;AAED,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"explorer-rest.d.ts","sourceRoot":"","sources":["../../../../src/client/exchange/types/explorer-rest.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,IAAI,gBAAgB,EAChC,WAAW,IAAI,eAAe,EAC9B,eAAe,EAChB,MAAM,YAAY,CAAA;AAEnB,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,IAAI,EAAE;QACJ,MAAM,EAAE,GAAG,CAAA;QACX,IAAI,EAAE,CAAC,CAAA;KACR,CAAA;CACF;AAED,MAAM,WAAW,kCAAkC;IACjD,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,KAAK,CAAC;QAChB,MAAM,EAAE,MAAM,CAAA;QACd,OAAO,EAAE,MAAM,CAAA;QACf,SAAS,EAAE,MAAM,CAAA;QACjB,QAAQ,EAAE,MAAM,CAAA;KACjB,CAAC,CAAA;IACF,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,UAAU,GAAG,MAAM,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE;QACP,MAAM,EAAE;YACN,MAAM,EAAE,MAAM,CAAA;YACd,KAAK,EAAE,MAAM,CAAA;SACd,EAAE,CAAA;QACH,SAAS,EAAE,MAAM,CAAA;QACjB,KAAK,EAAE,MAAM,CAAA;QACb,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,KAAK,C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AsC;IACrD,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,qBAAqB,CAAA;CAC9B;AAED,MAAM,WAAW,uBACf,SAAQ,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC;IACvC,MAAM,EAAE,qBAAqB,CAAA;CAC9B;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/exchange/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,mBAAmB,CAAA;AAEjC,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,GAAG,CAAA;CACd"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/exchange/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,mBAAmB,CAAA;AAEjC,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,GAAG,CAAA;CACd"}
|
|
@@ -17,6 +17,7 @@ __exportStar(require("./spot"), exports);
|
|
|
17
17
|
__exportStar(require("./spot-rest"), exports);
|
|
18
18
|
__exportStar(require("./account"), exports);
|
|
19
19
|
__exportStar(require("./explorer"), exports);
|
|
20
|
+
__exportStar(require("./explorer-rest"), exports);
|
|
20
21
|
__exportStar(require("./auction"), exports);
|
|
21
22
|
__exportStar(require("./oracle"), exports);
|
|
22
23
|
__exportStar(require("./insurance-funds"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/exchange/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA0B;AAC1B,gDAA6B;AAC7B,qDAAkC;AAClC,yCAAsB;AACtB,8CAA2B;AAC3B,4CAAyB;AACzB,6CAA0B;AAC1B,4CAAyB;AACzB,2CAAwB;AACxB,oDAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/exchange/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA0B;AAC1B,gDAA6B;AAC7B,qDAAkC;AAClC,yCAAsB;AACtB,8CAA2B;AAC3B,4CAAyB;AACzB,6CAA0B;AAC1B,kDAA+B;AAC/B,4CAAyB;AACzB,2CAAwB;AACxB,oDAAiC"}
|
package/dist/local/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/local/index.ts"],"names":[],"mappings":"AACA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/local/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA"}
|
package/dist/local/index.js
CHANGED
|
@@ -11,8 +11,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
// export * from './Network'
|
|
14
|
-
__exportStar(require("./TxInjective"), exports);
|
|
15
|
-
__exportStar(require("./TxService"), exports);
|
|
16
14
|
__exportStar(require("./PrivateKey"), exports);
|
|
17
15
|
__exportStar(require("./PublicKey"), exports);
|
|
18
16
|
//# sourceMappingURL=index.js.map
|
package/dist/local/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/local/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4BAA4B;AAC5B
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/local/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4BAA4B;AAC5B,+CAA4B;AAC5B,8CAA2B"}
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.recoverTypedSignaturePubKey = void 0;
|
|
4
4
|
const ethereumjs_util_1 = require("ethereumjs-util");
|
|
5
5
|
const secp256k1_1 = require("secp256k1");
|
|
6
|
-
const eth_sig_util_1 = require("eth-sig-util");
|
|
6
|
+
const eth_sig_util_1 = require("@metamask/eth-sig-util");
|
|
7
7
|
const recoverTypedSignaturePubKey = (data, signature) => {
|
|
8
8
|
const compressedPubKeyPrefix = Buffer.from('04', 'hex');
|
|
9
|
-
const message = eth_sig_util_1.TypedDataUtils.
|
|
9
|
+
const message = eth_sig_util_1.TypedDataUtils.eip712Hash(data, eth_sig_util_1.SignTypedDataVersion.V4);
|
|
10
10
|
const sigParams = (0, ethereumjs_util_1.fromRpcSig)(signature);
|
|
11
11
|
const publicKey = (0, ethereumjs_util_1.ecrecover)(message, sigParams.v, sigParams.r, sigParams.s);
|
|
12
12
|
const prefixedKey = Buffer.concat([compressedPubKeyPrefix, publicKey]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/utils/transaction.ts"],"names":[],"mappings":";;;AAAA,qDAAuD;AACvD,yCAA4C;AAC5C
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/utils/transaction.ts"],"names":[],"mappings":";;;AAAA,qDAAuD;AACvD,yCAA4C;AAC5C,yDAA6E;AAEtE,MAAM,2BAA2B,GAAG,CACzC,IAAS,EACT,SAAiB,EACT,EAAE;IACV,MAAM,sBAAsB,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IACvD,MAAM,OAAO,GAAG,6BAAc,CAAC,UAAU,CAAC,IAAI,EAAE,mCAAoB,CAAC,EAAE,CAAC,CAAA;IACxE,MAAM,SAAS,GAAG,IAAA,4BAAU,EAAC,SAAS,CAAC,CAAA;IACvC,MAAM,SAAS,GAAG,IAAA,2BAAS,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;IAC3E,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,sBAAsB,EAAE,SAAS,CAAC,CAAC,CAAA;IACtE,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,IAAA,4BAAgB,EAAC,WAAW,CAAC,CAAC,CAAA;IAEhE,OAAO,KAAK,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAA;AAC7C,CAAC,CAAA;AAZY,QAAA,2BAA2B,+BAYvC"}
|
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 Node environment.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.68",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Bojan Angjelkoski",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"@injectivelabs/networks": "^0.5.10",
|
|
41
41
|
"@injectivelabs/token-metadata": "^0.5.28",
|
|
42
42
|
"@injectivelabs/ts-types": "^0.5.4",
|
|
43
|
-
"@injectivelabs/tx-utils": "^0.5.2",
|
|
44
43
|
"@injectivelabs/utils": "^0.5.7",
|
|
44
|
+
"@metamask/eth-sig-util": "^4.0.1",
|
|
45
45
|
"@types/google-protobuf": "^3.15.5",
|
|
46
46
|
"bech32": "^2.0.0",
|
|
47
47
|
"bip32": "^3.0.1",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"snakecase-keys": "^5.4.1",
|
|
59
59
|
"tiny-secp256k1": "^2.2.1"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "e30a89f465772a19c2c09c7ee83b06c6402d2db1"
|
|
62
62
|
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Any } from 'google-protobuf/google/protobuf/any_pb';
|
|
2
|
-
import { TxBody, AuthInfo, SignDoc, TxRaw } from '@injectivelabs/chain-api/cosmos/tx/v1beta1/tx_pb';
|
|
3
|
-
import { Msgs } from '../core/msgs';
|
|
4
|
-
import { BaseAccount } from '../classes/BaseAccount';
|
|
5
|
-
export interface TxInjectiveParams {
|
|
6
|
-
msgs: Msgs | Msgs[];
|
|
7
|
-
memo?: string;
|
|
8
|
-
address: string;
|
|
9
|
-
feePrice?: string;
|
|
10
|
-
feeDenom?: string;
|
|
11
|
-
gasLimit?: number;
|
|
12
|
-
chainId: string;
|
|
13
|
-
baseAccount: BaseAccount;
|
|
14
|
-
}
|
|
15
|
-
export declare class TxInjective {
|
|
16
|
-
tx: TxInjectiveParams;
|
|
17
|
-
signature?: string | Uint8Array;
|
|
18
|
-
constructor(tx: TxInjectiveParams);
|
|
19
|
-
get packedMsgs(): Any[];
|
|
20
|
-
get txBody(): TxBody;
|
|
21
|
-
get authInfo(): AuthInfo;
|
|
22
|
-
get signDoc(): SignDoc;
|
|
23
|
-
get signBytes(): Uint8Array;
|
|
24
|
-
withSignature(signature: string | Uint8Array): this;
|
|
25
|
-
toTxRaw(): TxRaw;
|
|
26
|
-
getTxHash(): string;
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=TxInjective.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TxInjective.d.ts","sourceRoot":"","sources":["../../src/local/TxInjective.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,wCAAwC,CAAA;AAC5D,OAAO,EACL,MAAM,EAIN,QAAQ,EACR,OAAO,EACP,KAAK,EACN,MAAM,kDAAkD,CAAA;AAKzD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAMnC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAGpD,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,WAAW,CAAA;CACzB;AAED,qBAAa,WAAW;IACf,EAAE,EAAE,iBAAiB,CAAA;IAErB,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;gBAE1B,EAAE,EAAE,iBAAiB;IAIjC,IAAI,UAAU,UAcb;IAED,IAAI,MAAM,WAST;IAED,IAAI,QAAQ,aA0CX;IAED,IAAI,OAAO,YAWV;IAED,IAAI,SAAS,eAEZ;IAED,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU;IAM5C,OAAO;IAcP,SAAS;CAMV"}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.TxInjective = void 0;
|
|
7
|
-
const any_pb_1 = require("google-protobuf/google/protobuf/any_pb");
|
|
8
|
-
const tx_pb_1 = require("@injectivelabs/chain-api/cosmos/tx/v1beta1/tx_pb");
|
|
9
|
-
const signing_pb_1 = require("@injectivelabs/chain-api/cosmos/tx/signing/v1beta1/signing_pb");
|
|
10
|
-
const coin_pb_1 = require("@injectivelabs/chain-api/cosmos/base/v1beta1/coin_pb");
|
|
11
|
-
const utils_1 = require("@injectivelabs/utils");
|
|
12
|
-
const crypto_1 = __importDefault(require("crypto"));
|
|
13
|
-
const utils_2 = require("../utils");
|
|
14
|
-
const keys_pb_1 = require("@injectivelabs/chain-api/injective/crypto/v1beta1/ethsecp256k1/keys_pb");
|
|
15
|
-
class TxInjective {
|
|
16
|
-
constructor(tx) {
|
|
17
|
-
this.tx = tx;
|
|
18
|
-
}
|
|
19
|
-
get packedMsgs() {
|
|
20
|
-
const { tx } = this;
|
|
21
|
-
const msgs = Array.isArray(tx.msgs) ? tx.msgs : [tx.msgs];
|
|
22
|
-
const packedMsgs = msgs.map((msg) => {
|
|
23
|
-
const amino = msg.toDirectSign();
|
|
24
|
-
const packedMessage = new any_pb_1.Any();
|
|
25
|
-
packedMessage.setTypeUrl(amino.type);
|
|
26
|
-
packedMessage.setValue(amino.message.serializeBinary());
|
|
27
|
-
return packedMessage;
|
|
28
|
-
});
|
|
29
|
-
return packedMsgs;
|
|
30
|
-
}
|
|
31
|
-
get txBody() {
|
|
32
|
-
const { tx, packedMsgs } = this;
|
|
33
|
-
const txBody = new tx_pb_1.TxBody();
|
|
34
|
-
txBody.setMessagesList(packedMsgs);
|
|
35
|
-
txBody.setMemo(tx.memo || '');
|
|
36
|
-
txBody.setTimeoutHeight(0);
|
|
37
|
-
return txBody;
|
|
38
|
-
}
|
|
39
|
-
get authInfo() {
|
|
40
|
-
const { tx } = this;
|
|
41
|
-
const { baseAccount } = tx;
|
|
42
|
-
// TODO: gas limit based on the message type (lower limit for exchange messages)
|
|
43
|
-
const gasLimit = tx.gasLimit || utils_2.DEFAULT_GAS_LIMIT;
|
|
44
|
-
const feePrice = tx.feePrice || utils_2.DEFAULT_GAS_PRICE;
|
|
45
|
-
const feeDenom = tx.feeDenom || utils_2.DEFAULT_FEE_DENOM;
|
|
46
|
-
const feeAmount = new coin_pb_1.Coin();
|
|
47
|
-
feeAmount.setAmount(new utils_1.BigNumber(gasLimit).times(feePrice).toString());
|
|
48
|
-
feeAmount.setDenom(feeDenom);
|
|
49
|
-
const fee = new tx_pb_1.Fee();
|
|
50
|
-
fee.setGasLimit(gasLimit);
|
|
51
|
-
fee.setAmountList([feeAmount]);
|
|
52
|
-
const publicKey = new keys_pb_1.PubKey();
|
|
53
|
-
publicKey.setKey(baseAccount.pubKey.key);
|
|
54
|
-
const packedPublicKey = new any_pb_1.Any();
|
|
55
|
-
packedPublicKey.setTypeUrl(baseAccount.pubKey.type);
|
|
56
|
-
packedPublicKey.setValue(Buffer.from(publicKey.serializeBinary()).toString('base64'));
|
|
57
|
-
const modeSingleDirect = new tx_pb_1.ModeInfo.Single();
|
|
58
|
-
modeSingleDirect.setMode(signing_pb_1.SignMode.SIGN_MODE_DIRECT);
|
|
59
|
-
const modeInfo = new tx_pb_1.ModeInfo();
|
|
60
|
-
modeInfo.setSingle(modeSingleDirect);
|
|
61
|
-
const signerInfo = new tx_pb_1.SignerInfo();
|
|
62
|
-
signerInfo.setPublicKey(packedPublicKey);
|
|
63
|
-
signerInfo.setModeInfo(modeInfo);
|
|
64
|
-
signerInfo.setSequence(baseAccount.sequence);
|
|
65
|
-
const authInfo = new tx_pb_1.AuthInfo();
|
|
66
|
-
authInfo.setSignerInfosList([signerInfo]);
|
|
67
|
-
authInfo.setFee(fee);
|
|
68
|
-
return authInfo;
|
|
69
|
-
}
|
|
70
|
-
get signDoc() {
|
|
71
|
-
const { tx, txBody, authInfo } = this;
|
|
72
|
-
const { baseAccount } = tx;
|
|
73
|
-
const signDoc = new tx_pb_1.SignDoc();
|
|
74
|
-
signDoc.setBodyBytes(txBody.serializeBinary());
|
|
75
|
-
signDoc.setAuthInfoBytes(authInfo.serializeBinary());
|
|
76
|
-
signDoc.setChainId(tx.chainId);
|
|
77
|
-
signDoc.setAccountNumber(baseAccount.accountNumber);
|
|
78
|
-
return signDoc;
|
|
79
|
-
}
|
|
80
|
-
get signBytes() {
|
|
81
|
-
return this.signDoc.serializeBinary();
|
|
82
|
-
}
|
|
83
|
-
withSignature(signature) {
|
|
84
|
-
this.signature = signature;
|
|
85
|
-
return this;
|
|
86
|
-
}
|
|
87
|
-
toTxRaw() {
|
|
88
|
-
const { signature, txBody, authInfo } = this;
|
|
89
|
-
const txRaw = new tx_pb_1.TxRaw();
|
|
90
|
-
txRaw.setBodyBytes(txBody.serializeBinary());
|
|
91
|
-
txRaw.setAuthInfoBytes(authInfo.serializeBinary());
|
|
92
|
-
if (signature) {
|
|
93
|
-
txRaw.setSignaturesList([signature]);
|
|
94
|
-
}
|
|
95
|
-
return txRaw;
|
|
96
|
-
}
|
|
97
|
-
getTxHash() {
|
|
98
|
-
return crypto_1.default
|
|
99
|
-
.createHash('sha256')
|
|
100
|
-
.update(this.toTxRaw().serializeBinary())
|
|
101
|
-
.digest('hex');
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
exports.TxInjective = TxInjective;
|
|
105
|
-
//# sourceMappingURL=TxInjective.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TxInjective.js","sourceRoot":"","sources":["../../src/local/TxInjective.ts"],"names":[],"mappings":";;;;;;AAAA,mEAA4D;AAC5D,4EAQyD;AACzD,8FAAwF;AACxF,kFAA2E;AAC3E,gDAAgD;AAChD,oDAA2B;AAE3B,oCAIiB;AAEjB,oGAA+F;AAa/F,MAAa,WAAW;IAKtB,YAAY,EAAqB;QAC/B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;IACd,CAAC;IAED,IAAI,UAAU;QACZ,MAAM,EAAE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rC;QAED,OAAO,KAAK,CAAA;IACd,CAAC;IAED,SAAS;QACP,OAAO,gBAAM;aACV,UAAU,CAAC,QAAQ,CAAC;aACpB,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,eAAe,EAAE,CAAC;aACxC,MAAM,CAAC,KAAK,CAAC,CAAA;IAClB,CAAC;CACF;AA3HD,kCA2HC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ServiceClient } from '@injectivelabs/chain-api/cosmos/tx/v1beta1/service_pb_service';
|
|
2
|
-
import { GasInfo, Result, TxResponse } from '@injectivelabs/chain-api/cosmos/base/abci/v1beta1/abci_pb';
|
|
3
|
-
import { TxInjective } from './TxInjective';
|
|
4
|
-
export declare class TxService {
|
|
5
|
-
txService: ServiceClient;
|
|
6
|
-
txInjective: TxInjective;
|
|
7
|
-
constructor({ txInjective, endpoint, }: {
|
|
8
|
-
txInjective: TxInjective;
|
|
9
|
-
endpoint: string;
|
|
10
|
-
});
|
|
11
|
-
simulate(): Promise<{
|
|
12
|
-
result: Result.AsObject;
|
|
13
|
-
gasInfo: GasInfo.AsObject;
|
|
14
|
-
}>;
|
|
15
|
-
broadcast(): Promise<TxResponse.AsObject>;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=TxService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TxService.d.ts","sourceRoot":"","sources":["../../src/local/TxService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,+DAA+D,CAAA;AAM7F,OAAO,EACL,OAAO,EACP,MAAM,EACN,UAAU,EACX,MAAM,2DAA2D,CAAA;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,qBAAa,SAAS;IACb,SAAS,EAAE,aAAa,CAAA;IAExB,WAAW,EAAE,WAAW,CAAA;gBAEnB,EACV,WAAW,EACX,QAAQ,GACT,EAAE;QACD,WAAW,EAAE,WAAW,CAAA;QACxB,QAAQ,EAAE,MAAM,CAAA;KACjB;IAOY,QAAQ,IAAI,OAAO,CAAC;QAC/B,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAA;QACvB,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAA;KAC1B,CAAC;IA4BW,SAAS,IAAI,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC;CA0BvD"}
|
package/dist/local/TxService.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
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.TxService = void 0;
|
|
13
|
-
const grpc_web_node_http_transport_1 = require("@improbable-eng/grpc-web-node-http-transport");
|
|
14
|
-
const service_pb_service_1 = require("@injectivelabs/chain-api/cosmos/tx/v1beta1/service_pb_service");
|
|
15
|
-
const service_pb_1 = require("@injectivelabs/chain-api/cosmos/tx/v1beta1/service_pb");
|
|
16
|
-
class TxService {
|
|
17
|
-
constructor({ txInjective, endpoint, }) {
|
|
18
|
-
this.txInjective = txInjective;
|
|
19
|
-
this.txService = new service_pb_service_1.ServiceClient(endpoint, {
|
|
20
|
-
transport: (0, grpc_web_node_http_transport_1.NodeHttpTransport)(),
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
simulate() {
|
|
24
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
const { txService, txInjective } = this;
|
|
26
|
-
const txRaw = txInjective.toTxRaw();
|
|
27
|
-
const simulateRequest = new service_pb_1.SimulateRequest();
|
|
28
|
-
simulateRequest.setTxBytes(txRaw.serializeBinary());
|
|
29
|
-
try {
|
|
30
|
-
return new Promise((resolve, reject) => txService.simulate(simulateRequest, (error, response) => {
|
|
31
|
-
if (error || !response) {
|
|
32
|
-
return reject(error);
|
|
33
|
-
}
|
|
34
|
-
const result = response.getResult();
|
|
35
|
-
const gasInfo = response.getGasInfo();
|
|
36
|
-
return resolve({
|
|
37
|
-
result: result ? result.toObject() : {},
|
|
38
|
-
gasInfo: gasInfo ? gasInfo.toObject() : {},
|
|
39
|
-
});
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
42
|
-
catch (e) {
|
|
43
|
-
throw new Error(e.message);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
broadcast() {
|
|
48
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
const { txService, txInjective } = this;
|
|
50
|
-
const txRaw = txInjective.toTxRaw();
|
|
51
|
-
const broadcastTxRequest = new service_pb_1.BroadcastTxRequest();
|
|
52
|
-
broadcastTxRequest.setTxBytes(txRaw.serializeBinary());
|
|
53
|
-
broadcastTxRequest.setMode(service_pb_1.BroadcastMode.BROADCAST_MODE_BLOCK);
|
|
54
|
-
try {
|
|
55
|
-
return new Promise((resolve, reject) => txService.broadcastTx(broadcastTxRequest, (error, response) => {
|
|
56
|
-
if (error || !response) {
|
|
57
|
-
return reject(error);
|
|
58
|
-
}
|
|
59
|
-
const txResponse = response.getTxResponse();
|
|
60
|
-
return resolve((txResponse ? txResponse.toObject() : {}));
|
|
61
|
-
}));
|
|
62
|
-
}
|
|
63
|
-
catch (e) {
|
|
64
|
-
throw new Error(e.message);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.TxService = TxService;
|
|
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