injectivejs 1.6.2 → 1.6.4
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 +373 -2
- package/binary.d.ts +1 -1
- package/binary.js +1 -1
- package/cosmos/authz/v1beta1/tx.registry.d.ts +47 -0
- package/cosmos/authz/v1beta1/tx.registry.js +67 -0
- package/cosmos/bank/v1beta1/tx.registry.d.ts +59 -0
- package/cosmos/bank/v1beta1/tx.registry.js +85 -0
- package/cosmos/client.d.ts +13 -0
- package/cosmos/client.js +59 -0
- package/cosmos/distribution/v1beta1/tx.registry.d.ts +95 -0
- package/cosmos/distribution/v1beta1/tx.registry.js +139 -0
- package/cosmos/feegrant/v1beta1/tx.registry.d.ts +47 -0
- package/cosmos/feegrant/v1beta1/tx.registry.js +67 -0
- package/cosmos/gov/v1/tx.registry.d.ts +95 -0
- package/cosmos/gov/v1/tx.registry.js +139 -0
- package/cosmos/gov/v1beta1/tx.registry.d.ts +59 -0
- package/cosmos/gov/v1beta1/tx.registry.js +85 -0
- package/cosmos/group/v1/tx.registry.d.ts +179 -0
- package/cosmos/group/v1/tx.registry.js +265 -0
- package/cosmos/staking/v1beta1/tx.registry.d.ts +95 -0
- package/cosmos/staking/v1beta1/tx.registry.js +139 -0
- package/cosmos/vesting/v1beta1/tx.registry.d.ts +47 -0
- package/cosmos/vesting/v1beta1/tx.registry.js +67 -0
- package/cosmwasm/client.d.ts +16 -0
- package/cosmwasm/client.js +53 -0
- package/cosmwasm/wasm/v1/tx.registry.d.ts +215 -0
- package/cosmwasm/wasm/v1/tx.registry.js +319 -0
- package/esm/binary.js +1 -1
- package/esm/cosmos/authz/v1beta1/tx.registry.js +64 -0
- package/esm/cosmos/bank/v1beta1/tx.registry.js +82 -0
- package/esm/cosmos/client.js +31 -0
- package/esm/cosmos/distribution/v1beta1/tx.registry.js +136 -0
- package/esm/cosmos/feegrant/v1beta1/tx.registry.js +64 -0
- package/esm/cosmos/gov/v1/tx.registry.js +136 -0
- package/esm/cosmos/gov/v1beta1/tx.registry.js +82 -0
- package/esm/cosmos/group/v1/tx.registry.js +262 -0
- package/esm/cosmos/staking/v1beta1/tx.registry.js +136 -0
- package/esm/cosmos/vesting/v1beta1/tx.registry.js +64 -0
- package/esm/cosmwasm/client.js +25 -0
- package/esm/cosmwasm/wasm/v1/tx.registry.js +316 -0
- package/esm/extern.js +1 -1
- package/esm/helper-func-types.js +1 -1
- package/esm/helpers.js +1 -1
- package/esm/ibc/applications/transfer/v1/tx.registry.js +46 -0
- package/esm/ibc/client.js +28 -0
- package/esm/ibc/core/channel/v1/tx.registry.js +352 -0
- package/esm/ibc/core/client/v1/tx.registry.js +136 -0
- package/esm/ibc/core/connection/v1/tx.registry.js +100 -0
- package/esm/injective/auction/v1beta1/tx.registry.js +46 -0
- package/esm/injective/client.js +33 -0
- package/esm/injective/exchange/v1beta1/tx.registry.js +640 -0
- package/esm/injective/insurance/v1beta1/tx.registry.js +82 -0
- package/esm/injective/ocr/v1beta1/tx.registry.js +172 -0
- package/esm/injective/oracle/v1beta1/tx.registry.js +154 -0
- package/esm/injective/peggy/v1/msgs.registry.js +262 -0
- package/esm/injective/permissions/v1beta1/tx.registry.js +136 -0
- package/esm/injective/tokenfactory/v1beta1/tx.registry.js +118 -0
- package/esm/injective/wasmx/v1/tx.registry.js +118 -0
- package/esm/registry.js +1 -1
- package/esm/types.js +1 -1
- package/esm/utf8.js +1 -1
- package/esm/varint.js +1 -1
- package/extern.d.ts +1 -1
- package/extern.js +1 -1
- package/helper-func-types.d.ts +1 -1
- package/helper-func-types.js +1 -1
- package/helpers.d.ts +1 -1
- package/helpers.js +1 -1
- package/ibc/applications/transfer/v1/tx.registry.d.ts +35 -0
- package/ibc/applications/transfer/v1/tx.registry.js +49 -0
- package/ibc/client.d.ts +16 -0
- package/ibc/client.js +56 -0
- package/ibc/core/channel/v1/tx.registry.d.ts +239 -0
- package/ibc/core/channel/v1/tx.registry.js +355 -0
- package/ibc/core/client/v1/tx.registry.d.ts +95 -0
- package/ibc/core/client/v1/tx.registry.js +139 -0
- package/ibc/core/connection/v1/tx.registry.d.ts +71 -0
- package/ibc/core/connection/v1/tx.registry.js +103 -0
- package/injective/auction/v1beta1/tx.registry.d.ts +35 -0
- package/injective/auction/v1beta1/tx.registry.js +49 -0
- package/injective/client.d.ts +16 -0
- package/injective/client.js +61 -0
- package/injective/exchange/v1beta1/tx.registry.d.ts +431 -0
- package/injective/exchange/v1beta1/tx.registry.js +643 -0
- package/injective/insurance/v1beta1/tx.registry.d.ts +59 -0
- package/injective/insurance/v1beta1/tx.registry.js +85 -0
- package/injective/ocr/v1beta1/tx.registry.d.ts +119 -0
- package/injective/ocr/v1beta1/tx.registry.js +175 -0
- package/injective/oracle/v1beta1/tx.registry.d.ts +107 -0
- package/injective/oracle/v1beta1/tx.registry.js +157 -0
- package/injective/peggy/v1/msgs.registry.d.ts +179 -0
- package/injective/peggy/v1/msgs.registry.js +265 -0
- package/injective/permissions/v1beta1/tx.registry.d.ts +95 -0
- package/injective/permissions/v1beta1/tx.registry.js +139 -0
- package/injective/tokenfactory/v1beta1/tx.registry.d.ts +83 -0
- package/injective/tokenfactory/v1beta1/tx.registry.js +121 -0
- package/injective/wasmx/v1/tx.registry.d.ts +83 -0
- package/injective/wasmx/v1/tx.registry.js +121 -0
- package/package.json +6 -6
- package/registry.d.ts +1 -1
- package/registry.js +1 -1
- package/types.d.ts +1 -1
- package/types.js +1 -1
- package/utf8.d.ts +1 -1
- package/utf8.js +1 -1
- package/varint.d.ts +1 -1
- package/varint.js +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# InjectiveJS
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<img src="https://user-images.githubusercontent.com/545047/193426489-d5d3c9a9-d738-43a0-a628-b8b4f1a8034b.png" width="80"
|
|
4
|
+
<img src="https://user-images.githubusercontent.com/545047/193426489-d5d3c9a9-d738-43a0-a628-b8b4f1a8034b.png" width="80"><br />
|
|
5
|
+
Building the future of decentralized exchange
|
|
5
6
|
</p>
|
|
6
7
|
|
|
7
8
|
<p align="center" width="100%">
|
|
@@ -12,7 +13,377 @@
|
|
|
12
13
|
<a href="https://github.com/cosmology-tech/interchainjs/blob/main/LICENSE-Apache"><img height="20" src="https://img.shields.io/badge/license-Apache-blue.svg"></a>
|
|
13
14
|
</p>
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
## install
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npm install injectivejs
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Table of contents
|
|
23
|
+
|
|
24
|
+
- [InjectiveJS](#injectivejs)
|
|
25
|
+
- [Install](#install)
|
|
26
|
+
- [Table of contents](#table-of-contents)
|
|
27
|
+
- [Usage](#usage)
|
|
28
|
+
- [RPC Clients](#rpc-clients)
|
|
29
|
+
- [Tx Helpers](#tx-helpers)
|
|
30
|
+
- Injective
|
|
31
|
+
- [Auction](#auction-messages)
|
|
32
|
+
- [Exchange](#exchange-messages)
|
|
33
|
+
- [Insurance](#insurance-messages)
|
|
34
|
+
- [OCR](#ocr-messages)
|
|
35
|
+
- [Oracle](#oracle-messages)
|
|
36
|
+
- [Peggy](#peggy-messages)
|
|
37
|
+
- Cosmos, CosmWasm, and IBC
|
|
38
|
+
- [CosmWasm](#cosmwasm-messages)
|
|
39
|
+
- [IBC](#ibc-messages)
|
|
40
|
+
- [Cosmos](#cosmos-messages)
|
|
41
|
+
- [Wallets and Signers](#connecting-with-wallets-and-signing-messages)
|
|
42
|
+
- [Stargate Client](#initializing-the-stargate-client)
|
|
43
|
+
- [Creating Signers](#creating-signers)
|
|
44
|
+
- [Broadcasting Messages](#broadcasting-messages)
|
|
45
|
+
- [Advanced Usage](#advanced-usage)
|
|
46
|
+
- [Developing](#developing)
|
|
47
|
+
- [Credits](#credits)
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
|
|
51
|
+
### RPC Clients
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
import { createQueryRpc } from "@interchainjs/cosmos/utils";
|
|
55
|
+
import { createGetAllBalances } from "injectivejs/cosmos/bank/v1beta1/query.rpc.func";
|
|
56
|
+
import { createGetExchangeBalances } from "injectivejs/injective/exchange/v1beta1/query.rpc.func";
|
|
57
|
+
|
|
58
|
+
{ getRpcEndpoint } = useChain("osmosis");
|
|
59
|
+
|
|
60
|
+
const endpoint = await getRpcEndpoint();
|
|
61
|
+
const rpc = createQueryRpc(endpoint);
|
|
62
|
+
|
|
63
|
+
// get the tree shakable helper functions using the rpc client
|
|
64
|
+
const getAllBalances = createGetAllBalances(rpc);
|
|
65
|
+
|
|
66
|
+
// now you can query the cosmos modules
|
|
67
|
+
const balance = await getAllBalances({
|
|
68
|
+
address: "inj1addresshere",
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// you can also query the injective modules
|
|
72
|
+
const getExchangeBalances = createGetExchangeBalances(rpc);
|
|
73
|
+
const exchangeBalance = await getExchangeBalances({});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Tx Helpers
|
|
77
|
+
|
|
78
|
+
For tx messages, there're helper functions to sign and broadcast messages:
|
|
79
|
+
|
|
80
|
+
```js
|
|
81
|
+
import {
|
|
82
|
+
createDeposit,
|
|
83
|
+
createLiquidatePosition,
|
|
84
|
+
createActivateStakeGrant,
|
|
85
|
+
} from "injectivejs/injective/exchange/v1beta1/tx.rpc.func";
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### Auction Messages
|
|
89
|
+
|
|
90
|
+
```js
|
|
91
|
+
import { createBid } from "injectivejs/injective/auction/v1beta1/tx.rpc.func";
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
#### Exchange Messages
|
|
95
|
+
|
|
96
|
+
```js
|
|
97
|
+
import {
|
|
98
|
+
createActivateStakeGrant,
|
|
99
|
+
createAdminUpdateBinaryOptionsMarket,
|
|
100
|
+
createAuthorizeStakeGrants,
|
|
101
|
+
createBatchCancelBinaryOptionsOrders,
|
|
102
|
+
createBatchCancelDerivativeOrders,
|
|
103
|
+
createBatchCancelSpotOrders,
|
|
104
|
+
createBatchCreateDerivativeLimitOrders,
|
|
105
|
+
createBatchCreateSpotLimitOrders,
|
|
106
|
+
createBatchUpdateOrders,
|
|
107
|
+
createCancelBinaryOptionsOrder,
|
|
108
|
+
createCancelDerivativeOrder,
|
|
109
|
+
createCancelSpotOrder,
|
|
110
|
+
createCreateBinaryOptionsLimitOrder,
|
|
111
|
+
createCreateBinaryOptionsMarketOrder,
|
|
112
|
+
createCreateDerivativeLimitOrder,
|
|
113
|
+
createCreateDerivativeMarketOrder,
|
|
114
|
+
createCreateSpotLimitOrder,
|
|
115
|
+
createCreateSpotMarketOrder,
|
|
116
|
+
createDecreasePositionMargin,
|
|
117
|
+
createDeposit,
|
|
118
|
+
createEmergencySettleMarket,
|
|
119
|
+
createExternalTransfer,
|
|
120
|
+
createIncreasePositionMargin,
|
|
121
|
+
createInstantBinaryOptionsMarketLaunch,
|
|
122
|
+
createInstantExpiryFuturesMarketLaunch,
|
|
123
|
+
createInstantPerpetualMarketLaunch,
|
|
124
|
+
createInstantSpotMarketLaunch,
|
|
125
|
+
createLiquidatePosition,
|
|
126
|
+
createPrivilegedExecuteContract,
|
|
127
|
+
createRewardsOptOut,
|
|
128
|
+
createSubaccountTransfer,
|
|
129
|
+
createUpdateDerivativeMarket,
|
|
130
|
+
createUpdateParams,
|
|
131
|
+
createUpdateSpotMarket,
|
|
132
|
+
createWithdraw,
|
|
133
|
+
} from "injectivejs/injective/exchange/v1beta1/tx.rpc.func";
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### Insurance Messages
|
|
137
|
+
|
|
138
|
+
```js
|
|
139
|
+
import {
|
|
140
|
+
createCreateInsuranceFund,
|
|
141
|
+
createRequestRedemption,
|
|
142
|
+
createUnderwrite,
|
|
143
|
+
} from "injectivejs/injective/insurance/v1beta1/tx.rpc.func";
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
#### OCR Messages
|
|
147
|
+
|
|
148
|
+
```js
|
|
149
|
+
import {
|
|
150
|
+
createAcceptPayeeship,
|
|
151
|
+
createCreateFeed,
|
|
152
|
+
createFundFeedRewardPool,
|
|
153
|
+
createSetPayees,
|
|
154
|
+
createTransferPayeeship,
|
|
155
|
+
createTransmit,
|
|
156
|
+
createUpdateFeed,
|
|
157
|
+
createWithdrawFeedRewardPool,
|
|
158
|
+
} from "injectivejs/injective/ocr/v1beta1/tx.rpc.func";
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
#### Oracle Messages
|
|
162
|
+
|
|
163
|
+
```js
|
|
164
|
+
import {
|
|
165
|
+
createRelayBandRates,
|
|
166
|
+
createRelayCoinbaseMessages,
|
|
167
|
+
createRelayPriceFeedPrice,
|
|
168
|
+
createRelayProviderPrices,
|
|
169
|
+
createRelayPythPrices,
|
|
170
|
+
createRelayStorkMessage,
|
|
171
|
+
createRequestBandIBCRates,
|
|
172
|
+
} from "injectivejs/injective/oracle/v1beta1/tx.rpc.func";
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
#### Peggy Messages
|
|
176
|
+
|
|
177
|
+
```js
|
|
178
|
+
import {
|
|
179
|
+
createBlacklistEthereumAddresses,
|
|
180
|
+
createCancelSendToEth,
|
|
181
|
+
createConfirmBatch,
|
|
182
|
+
createDepositClaim,
|
|
183
|
+
createERC20DeployedClaim,
|
|
184
|
+
createRequestBatch,
|
|
185
|
+
createRevokeEthereumBlacklist,
|
|
186
|
+
createSendToEth,
|
|
187
|
+
createSetOrchestratorAddresses,
|
|
188
|
+
createSubmitBadSignatureEvidence,
|
|
189
|
+
createValsetConfirm,
|
|
190
|
+
createValsetUpdateClaim,
|
|
191
|
+
createWithdrawClaim,
|
|
192
|
+
} from "injectivejs/injective/peggy/v1/msgs.rpc.func";
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
#### CosmWasm Messages
|
|
196
|
+
|
|
197
|
+
```js
|
|
198
|
+
import {
|
|
199
|
+
createExecuteContract,
|
|
200
|
+
createClearAdmin,
|
|
201
|
+
createInstantiateContract,
|
|
202
|
+
createInstantiateContract2,
|
|
203
|
+
createMigrateContract,
|
|
204
|
+
createPinCodes,
|
|
205
|
+
createRemoveCodeUploadParamsAddresses,
|
|
206
|
+
createStoreAndInstantiateContract,
|
|
207
|
+
createStoreCode,
|
|
208
|
+
createSudoContract,
|
|
209
|
+
createUnpinCodes,
|
|
210
|
+
createUpdateAdmin,
|
|
211
|
+
createUpdateContractLabel,
|
|
212
|
+
createUpdateInstantiateConfig,
|
|
213
|
+
createAddCodeUploadParamsAddresses,
|
|
214
|
+
createStoreAndMigrateContract,
|
|
215
|
+
} from "injectivejs/cosmwasm/wasm/v1/tx.rpc.func";
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
#### IBC Messages
|
|
219
|
+
|
|
220
|
+
```js
|
|
221
|
+
import { createTransfer } from "injectivejs/ibc/applications/transfer/v1/tx.rpc.func";
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
#### Cosmos Messages
|
|
225
|
+
|
|
226
|
+
```js
|
|
227
|
+
import {
|
|
228
|
+
createFundCommunityPool,
|
|
229
|
+
createCommunityPoolSpend,
|
|
230
|
+
createDepositValidatorRewardsPool,
|
|
231
|
+
} from "injectivejs/cosmos/distribution/v1beta1/tx.rpc.func";
|
|
232
|
+
|
|
233
|
+
import {
|
|
234
|
+
createSend,
|
|
235
|
+
createMultiSend,
|
|
236
|
+
} from "injectivejs/cosmos/bank/v1beta1/tx.rpc.func";
|
|
237
|
+
|
|
238
|
+
import {
|
|
239
|
+
createDelegate,
|
|
240
|
+
createUndelegate,
|
|
241
|
+
createCancelUnbondingDelegation,
|
|
242
|
+
createCreateValidator,
|
|
243
|
+
} from "injectivejs/cosmos/staking/v1beta1/tx.rpc.func";
|
|
244
|
+
|
|
245
|
+
import {
|
|
246
|
+
createDeposit,
|
|
247
|
+
createSubmitProposal,
|
|
248
|
+
createVote,
|
|
249
|
+
createVoteWeighted,
|
|
250
|
+
} from "injectivejs/cosmos/gov/v1beta1/tx.rpc.func";
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Connecting with Wallets and Signing Messages
|
|
254
|
+
|
|
255
|
+
⚡️ For web interfaces, we recommend using [interchain-kit](https://github.com/cosmology-tech/interchain-kit/). Continue below to see how to manually construct signers and clients.
|
|
256
|
+
|
|
257
|
+
Here are the docs on [creating signers](https://github.com/cosmology-tech/interchain-kit/blob/main/packages/core/README.md) in interchain-kit that can be used with Keplr and other wallets.
|
|
258
|
+
|
|
259
|
+
### Initializing the Stargate Client
|
|
260
|
+
|
|
261
|
+
Use `getSigningInjectiveClient` to get your `SigningStargateClient`, with the proto/amino messages full-loaded. No need to manually add amino types, just require and initialize the client:
|
|
262
|
+
|
|
263
|
+
```js
|
|
264
|
+
import { InjSigningClient } from "@interchainjs/injective/signing-client";
|
|
265
|
+
|
|
266
|
+
signingClient = await InjSigningClient.connectWithSigner(
|
|
267
|
+
await getRpcEndpoint(),
|
|
268
|
+
new AminoGenericOfflineSigner(aminoOfflineSigner)
|
|
269
|
+
);
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Creating Signers
|
|
273
|
+
|
|
274
|
+
To broadcast messages, you can create signers with a variety of options:
|
|
275
|
+
|
|
276
|
+
- [interchain-kit](https://github.com/cosmology-tech/interchain-kit/) (recommended)
|
|
277
|
+
- [keplr](https://docs.keplr.app/api/cosmjs.html)
|
|
278
|
+
- [cosmjs](https://gist.github.com/webmaster128/8444d42a7eceeda2544c8a59fbd7e1d9)
|
|
279
|
+
|
|
280
|
+
### Broadcasting Messages
|
|
281
|
+
|
|
282
|
+
When you have your `signing client`, you can broadcast messages:
|
|
283
|
+
|
|
284
|
+
```js
|
|
285
|
+
const msg = {
|
|
286
|
+
typeUrl: MsgSend.typeUrl,
|
|
287
|
+
value: MsgSend.fromPartial({
|
|
288
|
+
amount: [
|
|
289
|
+
{
|
|
290
|
+
denom: "inj",
|
|
291
|
+
amount: "1000",
|
|
292
|
+
},
|
|
293
|
+
],
|
|
294
|
+
toAddress: address,
|
|
295
|
+
fromAddress: address,
|
|
296
|
+
}),
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
const fee: StdFee = {
|
|
300
|
+
amount: [
|
|
301
|
+
{
|
|
302
|
+
denom: "inj",
|
|
303
|
+
amount: "864",
|
|
304
|
+
},
|
|
305
|
+
],
|
|
306
|
+
gas: "86364",
|
|
307
|
+
};
|
|
308
|
+
const response = await stargateClient.signAndBroadcast(address, [msg], fee);
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## Advanced Usage
|
|
312
|
+
|
|
313
|
+
If you want to manually construct a stargate client
|
|
314
|
+
|
|
315
|
+
```js
|
|
316
|
+
import {
|
|
317
|
+
cosmosAminoConverters,
|
|
318
|
+
cosmosProtoRegistry,
|
|
319
|
+
cosmwasmAminoConverters,
|
|
320
|
+
cosmwasmProtoRegistry,
|
|
321
|
+
ibcProtoRegistry,
|
|
322
|
+
ibcAminoConverters,
|
|
323
|
+
injectiveAminoConverters,
|
|
324
|
+
injectiveProtoRegistry
|
|
325
|
+
} from 'injectivejs';
|
|
326
|
+
|
|
327
|
+
const signer: OfflineSigner = /* create your signer (see above) */
|
|
328
|
+
const rpcEndpoint = 'https://rpc.cosmos.directory/injective'; // or another URL
|
|
329
|
+
|
|
330
|
+
const protoRegistry: ReadonlyArray<[string, GeneratedType]> = [
|
|
331
|
+
...cosmosProtoRegistry,
|
|
332
|
+
...cosmwasmProtoRegistry,
|
|
333
|
+
...ibcProtoRegistry,
|
|
334
|
+
...injectiveProtoRegistry
|
|
335
|
+
];
|
|
336
|
+
|
|
337
|
+
const aminoConverters = {
|
|
338
|
+
...cosmosAminoConverters,
|
|
339
|
+
...cosmwasmAminoConverters,
|
|
340
|
+
...ibcAminoConverters,
|
|
341
|
+
...injectiveAminoConverters
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
const registry = new Registry(protoRegistry);
|
|
345
|
+
const aminoTypes = new AminoTypes(aminoConverters);
|
|
346
|
+
|
|
347
|
+
const signingClient = await InjSigningClient.connectWithSigner(rpcEndpoint, signer);
|
|
348
|
+
|
|
349
|
+
signingClient.addEncoders(registry);
|
|
350
|
+
signingClient.addConverters(aminoTypes);
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
## Developing
|
|
354
|
+
|
|
355
|
+
When first cloning the repo:
|
|
356
|
+
|
|
357
|
+
```shell
|
|
358
|
+
yarn
|
|
359
|
+
yarn build:dev
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### Codegen
|
|
363
|
+
|
|
364
|
+
Contract schemas live in `./contracts`, and protos in `./proto`. Look inside of `scripts/inj.telescope.json` and configure the settings for bundling your SDK and contracts into `injectivejs`:
|
|
365
|
+
|
|
366
|
+
```shell
|
|
367
|
+
yarn codegen
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
### Publishing
|
|
371
|
+
|
|
372
|
+
Build the types and then publish:
|
|
373
|
+
|
|
374
|
+
```shell
|
|
375
|
+
yarn build
|
|
376
|
+
yarn publish
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
## Credits
|
|
380
|
+
|
|
381
|
+
🛠 Built by Cosmology — if you like our tools, please consider delegating to [our validator ⚛️](https://cosmology.tech/validator)
|
|
382
|
+
|
|
383
|
+
Code built with the help of these related projects:
|
|
384
|
+
|
|
385
|
+
- [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) for generated CosmWasm contract Typescript classes
|
|
386
|
+
- [@cosmology/telescope](https://github.com/cosmology-tech/telescope) a "babel for the Cosmos", Telescope is a TypeScript Transpiler for Cosmos Protobufs.
|
|
16
387
|
|
|
17
388
|
## License
|
|
18
389
|
|
package/binary.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file and any referenced files were automatically generated by @cosmology/telescope@1.11.
|
|
2
|
+
* This file and any referenced files were automatically generated by @cosmology/telescope@1.11.1
|
|
3
3
|
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
|
|
4
4
|
* and run the transpile command or npm scripts command that is used to regenerate this bundle.
|
|
5
5
|
*/
|
package/binary.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* This file and any referenced files were automatically generated by @cosmology/telescope@1.11.
|
|
3
|
+
* This file and any referenced files were automatically generated by @cosmology/telescope@1.11.1
|
|
4
4
|
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
|
|
5
5
|
* and run the transpile command or npm scripts command that is used to regenerate this bundle.
|
|
6
6
|
*/
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { TelescopeGeneratedType } from "../../../types";
|
|
2
|
+
import { MsgGrant, MsgExec, MsgRevoke } from "./tx";
|
|
3
|
+
export declare const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]>;
|
|
4
|
+
export declare const MessageComposer: {
|
|
5
|
+
encoded: {
|
|
6
|
+
grant(value: MsgGrant): {
|
|
7
|
+
typeUrl: string;
|
|
8
|
+
value: Uint8Array;
|
|
9
|
+
};
|
|
10
|
+
exec(value: MsgExec): {
|
|
11
|
+
typeUrl: string;
|
|
12
|
+
value: Uint8Array;
|
|
13
|
+
};
|
|
14
|
+
revoke(value: MsgRevoke): {
|
|
15
|
+
typeUrl: string;
|
|
16
|
+
value: Uint8Array;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
withTypeUrl: {
|
|
20
|
+
grant(value: MsgGrant): {
|
|
21
|
+
typeUrl: string;
|
|
22
|
+
value: MsgGrant;
|
|
23
|
+
};
|
|
24
|
+
exec(value: MsgExec): {
|
|
25
|
+
typeUrl: string;
|
|
26
|
+
value: MsgExec;
|
|
27
|
+
};
|
|
28
|
+
revoke(value: MsgRevoke): {
|
|
29
|
+
typeUrl: string;
|
|
30
|
+
value: MsgRevoke;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
fromPartial: {
|
|
34
|
+
grant(value: MsgGrant): {
|
|
35
|
+
typeUrl: string;
|
|
36
|
+
value: MsgGrant;
|
|
37
|
+
};
|
|
38
|
+
exec(value: MsgExec): {
|
|
39
|
+
typeUrl: string;
|
|
40
|
+
value: MsgExec;
|
|
41
|
+
};
|
|
42
|
+
revoke(value: MsgRevoke): {
|
|
43
|
+
typeUrl: string;
|
|
44
|
+
value: MsgRevoke;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageComposer = exports.registry = void 0;
|
|
4
|
+
const tx_1 = require("./tx");
|
|
5
|
+
exports.registry = [["/cosmos.authz.v1beta1.MsgGrant", tx_1.MsgGrant], ["/cosmos.authz.v1beta1.MsgExec", tx_1.MsgExec], ["/cosmos.authz.v1beta1.MsgRevoke", tx_1.MsgRevoke]];
|
|
6
|
+
exports.MessageComposer = {
|
|
7
|
+
encoded: {
|
|
8
|
+
grant(value) {
|
|
9
|
+
return {
|
|
10
|
+
typeUrl: "/cosmos.authz.v1beta1.MsgGrant",
|
|
11
|
+
value: tx_1.MsgGrant.encode(value).finish()
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
exec(value) {
|
|
15
|
+
return {
|
|
16
|
+
typeUrl: "/cosmos.authz.v1beta1.MsgExec",
|
|
17
|
+
value: tx_1.MsgExec.encode(value).finish()
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
revoke(value) {
|
|
21
|
+
return {
|
|
22
|
+
typeUrl: "/cosmos.authz.v1beta1.MsgRevoke",
|
|
23
|
+
value: tx_1.MsgRevoke.encode(value).finish()
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
withTypeUrl: {
|
|
28
|
+
grant(value) {
|
|
29
|
+
return {
|
|
30
|
+
typeUrl: "/cosmos.authz.v1beta1.MsgGrant",
|
|
31
|
+
value
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
exec(value) {
|
|
35
|
+
return {
|
|
36
|
+
typeUrl: "/cosmos.authz.v1beta1.MsgExec",
|
|
37
|
+
value
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
revoke(value) {
|
|
41
|
+
return {
|
|
42
|
+
typeUrl: "/cosmos.authz.v1beta1.MsgRevoke",
|
|
43
|
+
value
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
fromPartial: {
|
|
48
|
+
grant(value) {
|
|
49
|
+
return {
|
|
50
|
+
typeUrl: "/cosmos.authz.v1beta1.MsgGrant",
|
|
51
|
+
value: tx_1.MsgGrant.fromPartial(value)
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
exec(value) {
|
|
55
|
+
return {
|
|
56
|
+
typeUrl: "/cosmos.authz.v1beta1.MsgExec",
|
|
57
|
+
value: tx_1.MsgExec.fromPartial(value)
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
revoke(value) {
|
|
61
|
+
return {
|
|
62
|
+
typeUrl: "/cosmos.authz.v1beta1.MsgRevoke",
|
|
63
|
+
value: tx_1.MsgRevoke.fromPartial(value)
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { TelescopeGeneratedType } from "../../../types";
|
|
2
|
+
import { MsgSend, MsgMultiSend, MsgUpdateParams, MsgSetSendEnabled } from "./tx";
|
|
3
|
+
export declare const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]>;
|
|
4
|
+
export declare const MessageComposer: {
|
|
5
|
+
encoded: {
|
|
6
|
+
send(value: MsgSend): {
|
|
7
|
+
typeUrl: string;
|
|
8
|
+
value: Uint8Array;
|
|
9
|
+
};
|
|
10
|
+
multiSend(value: MsgMultiSend): {
|
|
11
|
+
typeUrl: string;
|
|
12
|
+
value: Uint8Array;
|
|
13
|
+
};
|
|
14
|
+
updateParams(value: MsgUpdateParams): {
|
|
15
|
+
typeUrl: string;
|
|
16
|
+
value: Uint8Array;
|
|
17
|
+
};
|
|
18
|
+
setSendEnabled(value: MsgSetSendEnabled): {
|
|
19
|
+
typeUrl: string;
|
|
20
|
+
value: Uint8Array;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
withTypeUrl: {
|
|
24
|
+
send(value: MsgSend): {
|
|
25
|
+
typeUrl: string;
|
|
26
|
+
value: MsgSend;
|
|
27
|
+
};
|
|
28
|
+
multiSend(value: MsgMultiSend): {
|
|
29
|
+
typeUrl: string;
|
|
30
|
+
value: MsgMultiSend;
|
|
31
|
+
};
|
|
32
|
+
updateParams(value: MsgUpdateParams): {
|
|
33
|
+
typeUrl: string;
|
|
34
|
+
value: MsgUpdateParams;
|
|
35
|
+
};
|
|
36
|
+
setSendEnabled(value: MsgSetSendEnabled): {
|
|
37
|
+
typeUrl: string;
|
|
38
|
+
value: MsgSetSendEnabled;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
fromPartial: {
|
|
42
|
+
send(value: MsgSend): {
|
|
43
|
+
typeUrl: string;
|
|
44
|
+
value: MsgSend;
|
|
45
|
+
};
|
|
46
|
+
multiSend(value: MsgMultiSend): {
|
|
47
|
+
typeUrl: string;
|
|
48
|
+
value: MsgMultiSend;
|
|
49
|
+
};
|
|
50
|
+
updateParams(value: MsgUpdateParams): {
|
|
51
|
+
typeUrl: string;
|
|
52
|
+
value: MsgUpdateParams;
|
|
53
|
+
};
|
|
54
|
+
setSendEnabled(value: MsgSetSendEnabled): {
|
|
55
|
+
typeUrl: string;
|
|
56
|
+
value: MsgSetSendEnabled;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageComposer = exports.registry = void 0;
|
|
4
|
+
const tx_1 = require("./tx");
|
|
5
|
+
exports.registry = [["/cosmos.bank.v1beta1.MsgSend", tx_1.MsgSend], ["/cosmos.bank.v1beta1.MsgMultiSend", tx_1.MsgMultiSend], ["/cosmos.bank.v1beta1.MsgUpdateParams", tx_1.MsgUpdateParams], ["/cosmos.bank.v1beta1.MsgSetSendEnabled", tx_1.MsgSetSendEnabled]];
|
|
6
|
+
exports.MessageComposer = {
|
|
7
|
+
encoded: {
|
|
8
|
+
send(value) {
|
|
9
|
+
return {
|
|
10
|
+
typeUrl: "/cosmos.bank.v1beta1.MsgSend",
|
|
11
|
+
value: tx_1.MsgSend.encode(value).finish()
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
multiSend(value) {
|
|
15
|
+
return {
|
|
16
|
+
typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend",
|
|
17
|
+
value: tx_1.MsgMultiSend.encode(value).finish()
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
updateParams(value) {
|
|
21
|
+
return {
|
|
22
|
+
typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParams",
|
|
23
|
+
value: tx_1.MsgUpdateParams.encode(value).finish()
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
setSendEnabled(value) {
|
|
27
|
+
return {
|
|
28
|
+
typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabled",
|
|
29
|
+
value: tx_1.MsgSetSendEnabled.encode(value).finish()
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
withTypeUrl: {
|
|
34
|
+
send(value) {
|
|
35
|
+
return {
|
|
36
|
+
typeUrl: "/cosmos.bank.v1beta1.MsgSend",
|
|
37
|
+
value
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
multiSend(value) {
|
|
41
|
+
return {
|
|
42
|
+
typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend",
|
|
43
|
+
value
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
updateParams(value) {
|
|
47
|
+
return {
|
|
48
|
+
typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParams",
|
|
49
|
+
value
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
setSendEnabled(value) {
|
|
53
|
+
return {
|
|
54
|
+
typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabled",
|
|
55
|
+
value
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
fromPartial: {
|
|
60
|
+
send(value) {
|
|
61
|
+
return {
|
|
62
|
+
typeUrl: "/cosmos.bank.v1beta1.MsgSend",
|
|
63
|
+
value: tx_1.MsgSend.fromPartial(value)
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
multiSend(value) {
|
|
67
|
+
return {
|
|
68
|
+
typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend",
|
|
69
|
+
value: tx_1.MsgMultiSend.fromPartial(value)
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
updateParams(value) {
|
|
73
|
+
return {
|
|
74
|
+
typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParams",
|
|
75
|
+
value: tx_1.MsgUpdateParams.fromPartial(value)
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
setSendEnabled(value) {
|
|
79
|
+
return {
|
|
80
|
+
typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabled",
|
|
81
|
+
value: tx_1.MsgSetSendEnabled.fromPartial(value)
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing";
|
|
2
|
+
import { AminoTypes, SigningStargateClient } from "@cosmjs/stargate";
|
|
3
|
+
import { HttpEndpoint } from "@cosmjs/tendermint-rpc";
|
|
4
|
+
export declare const cosmosAminoConverters: {};
|
|
5
|
+
export declare const cosmosProtoRegistry: ReadonlyArray<[string, GeneratedType]>;
|
|
6
|
+
export declare const getSigningCosmosClientOptions: () => {
|
|
7
|
+
registry: Registry;
|
|
8
|
+
aminoTypes: AminoTypes;
|
|
9
|
+
};
|
|
10
|
+
export declare const getSigningCosmosClient: ({ rpcEndpoint, signer }: {
|
|
11
|
+
rpcEndpoint: string | HttpEndpoint;
|
|
12
|
+
signer: OfflineSigner;
|
|
13
|
+
}) => Promise<SigningStargateClient>;
|