@ark-us/wasmx-stargate 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/.DS_Store +0 -0
  2. package/.eslintignore +5 -0
  3. package/.eslintrc.js +108 -0
  4. package/.gitignore +5 -0
  5. package/README.md +22 -0
  6. package/build/encoding.d.ts +12 -0
  7. package/build/encoding.js +25 -0
  8. package/build/encoding.js.map +1 -0
  9. package/build/encoding.spec.d.ts +1 -0
  10. package/build/encoding.spec.js +78 -0
  11. package/build/encoding.spec.js.map +1 -0
  12. package/build/index.d.ts +6 -0
  13. package/build/index.js +18 -0
  14. package/build/index.js.map +1 -0
  15. package/build/modules/index.d.ts +3 -0
  16. package/build/modules/index.js +14 -0
  17. package/build/modules/index.js.map +1 -0
  18. package/build/modules/wasmx/aminomessages.d.ts +49 -0
  19. package/build/modules/wasmx/aminomessages.js +63 -0
  20. package/build/modules/wasmx/aminomessages.js.map +1 -0
  21. package/build/modules/wasmx/aminomessages.spec.d.ts +1 -0
  22. package/build/modules/wasmx/aminomessages.spec.js +209 -0
  23. package/build/modules/wasmx/aminomessages.spec.js.map +1 -0
  24. package/build/modules/wasmx/messages.d.ts +18 -0
  25. package/build/modules/wasmx/messages.js +22 -0
  26. package/build/modules/wasmx/messages.js.map +1 -0
  27. package/build/modules/wasmx/queries.d.ts +42 -0
  28. package/build/modules/wasmx/queries.js +81 -0
  29. package/build/modules/wasmx/queries.js.map +1 -0
  30. package/build/signingwasmxclient.d.ts +160 -0
  31. package/build/signingwasmxclient.js +303 -0
  32. package/build/signingwasmxclient.js.map +1 -0
  33. package/build/tendermintclient.d.ts +3 -0
  34. package/build/tendermintclient.js +9 -0
  35. package/build/tendermintclient.js.map +1 -0
  36. package/build/wasmxclient.d.ts +114 -0
  37. package/build/wasmxclient.js +344 -0
  38. package/build/wasmxclient.js.map +1 -0
  39. package/jasmine-testrunner.js +38 -0
  40. package/karma.conf.js +54 -0
  41. package/package.json +93 -0
  42. package/src/encoding.spec.ts +99 -0
  43. package/src/encoding.ts +21 -0
  44. package/src/index.ts +30 -0
  45. package/src/modules/index.ts +17 -0
  46. package/src/modules/wasmx/aminomessages.spec.ts +222 -0
  47. package/src/modules/wasmx/aminomessages.ts +129 -0
  48. package/src/modules/wasmx/messages.ts +43 -0
  49. package/src/modules/wasmx/queries.ts +134 -0
  50. package/src/signingwasmxclient.ts +577 -0
  51. package/src/tendermintclient.ts +7 -0
  52. package/src/wasmxclient.ts +477 -0
  53. package/tsconfig.eslint.json +9 -0
  54. package/tsconfig.json +12 -0
  55. package/typedoc.js +11 -0
  56. package/webpack.web.config.js +37 -0
  57. package/yarn-error.log +4205 -0
  58. package/yarn.lock +4145 -0
@@ -0,0 +1,303 @@
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.SigningWasmXClient = void 0;
7
+ /* eslint-disable @typescript-eslint/naming-convention */
8
+ const amino_1 = require("@cosmjs/amino");
9
+ const crypto_1 = require("@cosmjs/crypto");
10
+ const encoding_1 = require("@cosmjs/encoding");
11
+ const math_1 = require("@cosmjs/math");
12
+ const proto_signing_1 = require("@cosmjs/proto-signing");
13
+ const stargate_1 = require("@cosmjs/stargate");
14
+ const tendermint_rpc_1 = require("@cosmjs/tendermint-rpc");
15
+ const utils_1 = require("@cosmjs/utils");
16
+ const tx_1 = require("cosmjs-types/cosmos/distribution/v1beta1/tx");
17
+ const tx_2 = require("cosmjs-types/cosmos/staking/v1beta1/tx");
18
+ const signing_1 = require("cosmjs-types/cosmos/tx/signing/v1beta1/signing");
19
+ const tx_3 = require("cosmjs-types/cosmos/tx/v1beta1/tx");
20
+ const wasmxjs_1 = require("@ark-us/wasmxjs");
21
+ const long_1 = __importDefault(require("long"));
22
+ const pako_1 = __importDefault(require("pako"));
23
+ const wasmxclient_1 = require("./wasmxclient");
24
+ const modules_1 = require("./modules");
25
+ function createDeliverTxResponseErrorMessage(result) {
26
+ return `Error when broadcasting tx ${result.transactionHash} at height ${result.height}. Code: ${result.code}; Raw log: ${result.rawLog}`;
27
+ }
28
+ function createDefaultRegistry() {
29
+ return new proto_signing_1.Registry([...stargate_1.defaultRegistryTypes, ...modules_1.wasmTypes]);
30
+ }
31
+ class SigningWasmXClient extends wasmxclient_1.WasmXClient {
32
+ constructor(tmClient, signer, options) {
33
+ super(tmClient);
34
+ const { registry = createDefaultRegistry(), aminoTypes = new stargate_1.AminoTypes({ ...(0, modules_1.createWasmAminoConverters)(), ...(0, stargate_1.createBankAminoConverters)() }), } = options;
35
+ this.registry = registry;
36
+ this.aminoTypes = aminoTypes;
37
+ this.signer = signer;
38
+ this.broadcastTimeoutMs = options.broadcastTimeoutMs;
39
+ this.broadcastPollIntervalMs = options.broadcastPollIntervalMs;
40
+ this.gasPrice = options.gasPrice;
41
+ }
42
+ /**
43
+ * Creates an instance by connecting to the given Tendermint RPC endpoint.
44
+ *
45
+ * For now this uses the Tendermint 0.34 client. If you need Tendermint 0.37
46
+ * support, see `createWithSigner`.
47
+ */
48
+ static async connectWithSigner(endpoint, signer, options = {}) {
49
+ const tmClient = await tendermint_rpc_1.Tendermint34Client.connect(endpoint);
50
+ return SigningWasmXClient.createWithSigner(tmClient, signer, options);
51
+ }
52
+ /**
53
+ * Creates an instance from a manually created Tendermint client.
54
+ * Use this to use `Tendermint37Client` instead of `Tendermint34Client`.
55
+ */
56
+ static async createWithSigner(tmClient, signer, options = {}) {
57
+ return new SigningWasmXClient(tmClient, signer, options);
58
+ }
59
+ /**
60
+ * Creates a client in offline mode.
61
+ *
62
+ * This should only be used in niche cases where you know exactly what you're doing,
63
+ * e.g. when building an offline signing application.
64
+ *
65
+ * When you try to use online functionality with such a signer, an
66
+ * exception will be raised.
67
+ */
68
+ static async offline(signer, options = {}) {
69
+ return new SigningWasmXClient(undefined, signer, options);
70
+ }
71
+ async simulate(signerAddress, messages, memo) {
72
+ const anyMsgs = messages.map((m) => this.registry.encodeAsAny(m));
73
+ const accountFromSigner = (await this.signer.getAccounts()).find((account) => account.address === signerAddress);
74
+ if (!accountFromSigner) {
75
+ throw new Error("Failed to retrieve account from signer");
76
+ }
77
+ const pubkey = (0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey);
78
+ const { sequence } = await this.getSequence(signerAddress);
79
+ const { gasInfo } = await this.forceGetQueryClient().tx.simulate(anyMsgs, memo, pubkey, sequence);
80
+ (0, utils_1.assertDefined)(gasInfo);
81
+ return math_1.Uint53.fromString(gasInfo.gasUsed.toString()).toNumber();
82
+ }
83
+ /** Uploads code and returns a receipt, including the code ID */
84
+ async upload(senderAddress, wasmCode, fee, memo = "") {
85
+ const compressed = pako_1.default.gzip(wasmCode, { level: 9 });
86
+ const storeCodeMsg = {
87
+ typeUrl: "/wasmx.wasmx.MsgStoreCode",
88
+ value: wasmxjs_1.MsgStoreCode.fromPartial({
89
+ sender: senderAddress,
90
+ wasmByteCode: compressed,
91
+ }),
92
+ };
93
+ const result = await this.signAndBroadcast(senderAddress, [storeCodeMsg], fee, memo);
94
+ if ((0, stargate_1.isDeliverTxFailure)(result)) {
95
+ throw new Error(createDeliverTxResponseErrorMessage(result));
96
+ }
97
+ const parsedLogs = stargate_1.logs.parseRawLog(result.rawLog);
98
+ const codeIdAttr = stargate_1.logs.findAttribute(parsedLogs, "store_code", "code_id");
99
+ return {
100
+ originalSize: wasmCode.length,
101
+ originalChecksum: (0, encoding_1.toHex)((0, crypto_1.sha256)(wasmCode)),
102
+ compressedSize: compressed.length,
103
+ compressedChecksum: (0, encoding_1.toHex)((0, crypto_1.sha256)(compressed)),
104
+ codeId: Number.parseInt(codeIdAttr.value, 10),
105
+ logs: parsedLogs,
106
+ height: result.height,
107
+ transactionHash: result.transactionHash,
108
+ events: result.events,
109
+ gasWanted: result.gasWanted,
110
+ gasUsed: result.gasUsed,
111
+ };
112
+ }
113
+ async instantiate(senderAddress, codeId, msg, label, fee, options = {}) {
114
+ const instantiateContractMsg = {
115
+ typeUrl: "/wasmx.wasmx.MsgInstantiateContract",
116
+ value: wasmxjs_1.MsgInstantiateContract.fromPartial({
117
+ sender: senderAddress,
118
+ // @ts-ignore
119
+ codeId: long_1.default.fromString(new math_1.Uint53(codeId).toString()),
120
+ label: label,
121
+ msg: (0, encoding_1.toUtf8)(JSON.stringify(msg)),
122
+ funds: [...(options.funds || [])],
123
+ }),
124
+ };
125
+ const result = await this.signAndBroadcast(senderAddress, [instantiateContractMsg], fee, options.memo);
126
+ if ((0, stargate_1.isDeliverTxFailure)(result)) {
127
+ throw new Error(createDeliverTxResponseErrorMessage(result));
128
+ }
129
+ const parsedLogs = stargate_1.logs.parseRawLog(result.rawLog);
130
+ const contractAddressAttr = stargate_1.logs.findAttribute(parsedLogs, "instantiate", "contract_address");
131
+ return {
132
+ contractAddress: contractAddressAttr.value,
133
+ logs: parsedLogs,
134
+ height: result.height,
135
+ transactionHash: result.transactionHash,
136
+ events: result.events,
137
+ gasWanted: result.gasWanted,
138
+ gasUsed: result.gasUsed,
139
+ };
140
+ }
141
+ async execute(senderAddress, contractAddress, msg, fee, memo = "", funds) {
142
+ const instruction = {
143
+ contractAddress: contractAddress,
144
+ msg: msg,
145
+ funds: funds,
146
+ };
147
+ return this.executeMultiple(senderAddress, [instruction], fee, memo);
148
+ }
149
+ /**
150
+ * Like `execute` but allows executing multiple messages in one transaction.
151
+ */
152
+ async executeMultiple(senderAddress, instructions, fee, memo = "") {
153
+ const msgs = instructions.map((i) => ({
154
+ typeUrl: "/wasmx.wasmx.MsgExecuteContract",
155
+ value: wasmxjs_1.MsgExecuteContract.fromPartial({
156
+ sender: senderAddress,
157
+ contract: i.contractAddress,
158
+ msg: (0, encoding_1.toUtf8)(JSON.stringify(i.msg)),
159
+ funds: [...(i.funds || [])],
160
+ }),
161
+ }));
162
+ const result = await this.signAndBroadcast(senderAddress, msgs, fee, memo);
163
+ if ((0, stargate_1.isDeliverTxFailure)(result)) {
164
+ throw new Error(createDeliverTxResponseErrorMessage(result));
165
+ }
166
+ return {
167
+ logs: stargate_1.logs.parseRawLog(result.rawLog),
168
+ height: result.height,
169
+ transactionHash: result.transactionHash,
170
+ events: result.events,
171
+ gasWanted: result.gasWanted,
172
+ gasUsed: result.gasUsed,
173
+ };
174
+ }
175
+ async sendTokens(senderAddress, recipientAddress, amount, fee, memo = "") {
176
+ const sendMsg = {
177
+ typeUrl: "/cosmos.bank.v1beta1.MsgSend",
178
+ value: {
179
+ fromAddress: senderAddress,
180
+ toAddress: recipientAddress,
181
+ amount: [...amount],
182
+ },
183
+ };
184
+ return this.signAndBroadcast(senderAddress, [sendMsg], fee, memo);
185
+ }
186
+ async delegateTokens(delegatorAddress, validatorAddress, amount, fee, memo = "") {
187
+ const delegateMsg = {
188
+ typeUrl: "/cosmos.staking.v1beta1.MsgDelegate",
189
+ value: tx_2.MsgDelegate.fromPartial({ delegatorAddress: delegatorAddress, validatorAddress, amount }),
190
+ };
191
+ return this.signAndBroadcast(delegatorAddress, [delegateMsg], fee, memo);
192
+ }
193
+ async undelegateTokens(delegatorAddress, validatorAddress, amount, fee, memo = "") {
194
+ const undelegateMsg = {
195
+ typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate",
196
+ value: tx_2.MsgUndelegate.fromPartial({ delegatorAddress: delegatorAddress, validatorAddress, amount }),
197
+ };
198
+ return this.signAndBroadcast(delegatorAddress, [undelegateMsg], fee, memo);
199
+ }
200
+ async withdrawRewards(delegatorAddress, validatorAddress, fee, memo = "") {
201
+ const withdrawDelegatorRewardMsg = {
202
+ typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward",
203
+ value: tx_1.MsgWithdrawDelegatorReward.fromPartial({ delegatorAddress: delegatorAddress, validatorAddress }),
204
+ };
205
+ return this.signAndBroadcast(delegatorAddress, [withdrawDelegatorRewardMsg], fee, memo);
206
+ }
207
+ /**
208
+ * Creates a transaction with the given messages, fee and memo. Then signs and broadcasts the transaction.
209
+ *
210
+ * @param signerAddress The address that will sign transactions using this instance. The signer must be able to sign with this address.
211
+ * @param messages
212
+ * @param fee
213
+ * @param memo
214
+ */
215
+ async signAndBroadcast(signerAddress, messages, fee, memo = "") {
216
+ let usedFee;
217
+ if (fee == "auto" || typeof fee === "number") {
218
+ (0, utils_1.assertDefined)(this.gasPrice, "Gas price must be set in the client options when auto gas is used.");
219
+ const gasEstimation = await this.simulate(signerAddress, messages, memo);
220
+ const multiplier = typeof fee === "number" ? fee : 1.3;
221
+ usedFee = (0, stargate_1.calculateFee)(Math.round(gasEstimation * multiplier), this.gasPrice);
222
+ }
223
+ else {
224
+ usedFee = fee;
225
+ }
226
+ const txRaw = await this.sign(signerAddress, messages, usedFee, memo);
227
+ const txBytes = tx_3.TxRaw.encode(txRaw).finish();
228
+ return this.broadcastTx(txBytes, this.broadcastTimeoutMs, this.broadcastPollIntervalMs);
229
+ }
230
+ async sign(signerAddress, messages, fee, memo, explicitSignerData) {
231
+ let signerData;
232
+ if (explicitSignerData) {
233
+ signerData = explicitSignerData;
234
+ }
235
+ else {
236
+ const { accountNumber, sequence } = await this.getSequence(signerAddress);
237
+ const chainId = await this.getChainId();
238
+ signerData = {
239
+ accountNumber: accountNumber,
240
+ sequence: sequence,
241
+ chainId: chainId,
242
+ };
243
+ }
244
+ return (0, proto_signing_1.isOfflineDirectSigner)(this.signer)
245
+ ? this.signDirect(signerAddress, messages, fee, memo, signerData)
246
+ : this.signAmino(signerAddress, messages, fee, memo, signerData);
247
+ }
248
+ async signAmino(signerAddress, messages, fee, memo, { accountNumber, sequence, chainId }) {
249
+ (0, utils_1.assert)(!(0, proto_signing_1.isOfflineDirectSigner)(this.signer));
250
+ const accountFromSigner = (await this.signer.getAccounts()).find((account) => account.address === signerAddress);
251
+ if (!accountFromSigner) {
252
+ throw new Error("Failed to retrieve account from signer");
253
+ }
254
+ const pubkey = (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey));
255
+ const signMode = signing_1.SignMode.SIGN_MODE_LEGACY_AMINO_JSON;
256
+ const msgs = messages.map((msg) => this.aminoTypes.toAmino(msg));
257
+ const signDoc = (0, amino_1.makeSignDoc)(msgs, fee, chainId, memo, accountNumber, sequence);
258
+ const { signature, signed } = await this.signer.signAmino(signerAddress, signDoc);
259
+ const signedTxBody = {
260
+ typeUrl: "/cosmos.tx.v1beta1.TxBody",
261
+ value: {
262
+ messages: signed.msgs.map((msg) => this.aminoTypes.fromAmino(msg)),
263
+ memo: signed.memo,
264
+ },
265
+ };
266
+ const signedTxBodyBytes = this.registry.encode(signedTxBody);
267
+ const signedGasLimit = math_1.Int53.fromString(signed.fee.gas).toNumber();
268
+ const signedSequence = math_1.Int53.fromString(signed.sequence).toNumber();
269
+ const signedAuthInfoBytes = (0, proto_signing_1.makeAuthInfoBytes)([{ pubkey, sequence: signedSequence }], signed.fee.amount, signedGasLimit, signed.fee.granter, signed.fee.payer, signMode);
270
+ return tx_3.TxRaw.fromPartial({
271
+ bodyBytes: signedTxBodyBytes,
272
+ authInfoBytes: signedAuthInfoBytes,
273
+ signatures: [(0, encoding_1.fromBase64)(signature.signature)],
274
+ });
275
+ }
276
+ async signDirect(signerAddress, messages, fee, memo, { accountNumber, sequence, chainId }) {
277
+ (0, utils_1.assert)((0, proto_signing_1.isOfflineDirectSigner)(this.signer));
278
+ const accountFromSigner = (await this.signer.getAccounts()).find((account) => account.address === signerAddress);
279
+ if (!accountFromSigner) {
280
+ throw new Error("Failed to retrieve account from signer");
281
+ }
282
+ const pubkey = (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey));
283
+ const txBody = {
284
+ typeUrl: "/cosmos.tx.v1beta1.TxBody",
285
+ value: {
286
+ messages: messages,
287
+ memo: memo,
288
+ },
289
+ };
290
+ const txBodyBytes = this.registry.encode(txBody);
291
+ const gasLimit = math_1.Int53.fromString(fee.gas).toNumber();
292
+ const authInfoBytes = (0, proto_signing_1.makeAuthInfoBytes)([{ pubkey, sequence }], fee.amount, gasLimit, fee.granter, fee.payer);
293
+ const signDoc = (0, proto_signing_1.makeSignDoc)(txBodyBytes, authInfoBytes, chainId, accountNumber);
294
+ const { signature, signed } = await this.signer.signDirect(signerAddress, signDoc);
295
+ return tx_3.TxRaw.fromPartial({
296
+ bodyBytes: signed.bodyBytes,
297
+ authInfoBytes: signed.authInfoBytes,
298
+ signatures: [(0, encoding_1.fromBase64)(signature.signature)],
299
+ });
300
+ }
301
+ }
302
+ exports.SigningWasmXClient = SigningWasmXClient;
303
+ //# sourceMappingURL=signingwasmxclient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signingwasmxclient.js","sourceRoot":"","sources":["../src/signingwasmxclient.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAyD;AACzD,yCAAuF;AACvF,2CAAwC;AACxC,+CAA6D;AAC7D,uCAA6C;AAC7C,yDAS+B;AAC/B,+CAiB0B;AAC1B,2DAA0E;AAE1E,yCAAsD;AACtD,oEAAyF;AACzF,+DAAoF;AACpF,4EAA0E;AAC1E,0DAA0D;AAC1D,6CAIyB;AACzB,gDAAwB;AACxB,gDAAwB;AAExB,+CAA4C;AAC5C,uCAOmB;AAmGnB,SAAS,mCAAmC,CAAC,MAAyB;IACpE,OAAO,8BAA8B,MAAM,CAAC,eAAe,cAAc,MAAM,CAAC,MAAM,WAAW,MAAM,CAAC,IAAI,cAAc,MAAM,CAAC,MAAM,EAAE,CAAC;AAC5I,CAAC;AAED,SAAS,qBAAqB;IAC5B,OAAO,IAAI,wBAAQ,CAAC,CAAC,GAAG,+BAAoB,EAAE,GAAG,mBAAS,CAAC,CAAC,CAAC;AAC/D,CAAC;AAUD,MAAa,kBAAmB,SAAQ,yBAAW;IAoDjD,YACE,QAAsC,EACtC,MAAqB,EACrB,OAAkC;QAElC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,MAAM,EACJ,QAAQ,GAAG,qBAAqB,EA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,EACV,QAAQ,EACR,GAAG,CAAC,OAAO,EACX,GAAG,CAAC,KAAK,CACV,CAAC;QACF,MAAM,OAAO,GAAG,IAAA,2BAAW,EAAC,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;QAChF,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACnF,OAAO,UAAK,CAAC,WAAW,CAAC;YACvB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,UAAU,EAAE,CAAC,IAAA,qBAAU,EAAC,SAAS,CAAC,SAAS,CAAC,CAAC;SAC9C,CAAC,CAAC;IACL,CAAC;CACF;AArZD,gDAqZC"}
@@ -0,0 +1,3 @@
1
+ import { Tendermint34Client } from "@cosmjs/tendermint-rpc";
2
+ export declare type TendermintClient = Tendermint34Client;
3
+ export declare function isTendermint34Client(client: TendermintClient): client is Tendermint34Client;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isTendermint34Client = void 0;
4
+ const tendermint_rpc_1 = require("@cosmjs/tendermint-rpc");
5
+ function isTendermint34Client(client) {
6
+ return client instanceof tendermint_rpc_1.Tendermint34Client;
7
+ }
8
+ exports.isTendermint34Client = isTendermint34Client;
9
+ //# sourceMappingURL=tendermintclient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tendermintclient.js","sourceRoot":"","sources":["../src/tendermintclient.ts"],"names":[],"mappings":";;;AAAA,2DAA4D;AAI5D,SAAgB,oBAAoB,CAAC,MAAwB;IAC3D,OAAO,MAAM,YAAY,mCAAkB,CAAC;AAC9C,CAAC;AAFD,oDAEC"}
@@ -0,0 +1,114 @@
1
+ import { Account, AuthExtension, BankExtension, Block, Coin, DeliverTxResponse, IndexedTx, QueryClient, SearchTxFilter, SearchTxQuery, SequenceResponse, TxExtension } from "@cosmjs/stargate";
2
+ import { HttpEndpoint } from "@cosmjs/tendermint-rpc";
3
+ import { TendermintClient } from './tendermintclient';
4
+ import { JsonObject, WasmExtension } from "./modules";
5
+ export interface Code {
6
+ readonly id: number;
7
+ /** Bech32 account address */
8
+ readonly creator: string;
9
+ /** Hex-encoded sha256 hash of the code stored here */
10
+ readonly checksum: string;
11
+ }
12
+ export interface CodeDetails extends Code {
13
+ /** The original Wasm bytes */
14
+ readonly data: Uint8Array;
15
+ }
16
+ export interface Contract {
17
+ readonly address: string;
18
+ readonly codeId: number;
19
+ /** Bech32 account address */
20
+ readonly creator: string;
21
+ readonly label: string;
22
+ readonly ibcPortId: string | undefined;
23
+ }
24
+ export interface ContractCodeHistoryEntry {
25
+ /** The source of this history entry */
26
+ readonly operation: "Genesis" | "Init" | "Migrate";
27
+ readonly codeId: number;
28
+ readonly msg: JsonObject;
29
+ }
30
+ /** Use for testing only */
31
+ export interface PrivateWasmXClient {
32
+ readonly tmClient: TendermintClient | undefined;
33
+ readonly queryClient: (QueryClient & AuthExtension & BankExtension & TxExtension & WasmExtension) | undefined;
34
+ }
35
+ export declare class WasmXClient {
36
+ private readonly tmClient;
37
+ private readonly queryClient;
38
+ private readonly codesCache;
39
+ private chainId;
40
+ /**
41
+ * Creates an instance by connecting to the given Tendermint RPC endpoint.
42
+ *
43
+ * For now this uses the Tendermint 0.34 client. If you need Tendermint 0.37
44
+ * support, see `create`.
45
+ */
46
+ static connect(endpoint: string | HttpEndpoint): Promise<WasmXClient>;
47
+ /**
48
+ * Creates an instance from a manually created Tendermint client.
49
+ * Use this to use `Tendermint37Client` instead of `Tendermint34Client`.
50
+ */
51
+ static create(tmClient: TendermintClient): Promise<WasmXClient>;
52
+ protected constructor(tmClient: TendermintClient | undefined);
53
+ protected getTmClient(): TendermintClient | undefined;
54
+ protected forceGetTmClient(): TendermintClient;
55
+ protected getQueryClient(): (QueryClient & AuthExtension & BankExtension & TxExtension & WasmExtension) | undefined;
56
+ protected forceGetQueryClient(): QueryClient & AuthExtension & BankExtension & TxExtension & WasmExtension;
57
+ getChainId(): Promise<string>;
58
+ getHeight(): Promise<number>;
59
+ getAccount(searchAddress: string): Promise<Account | null>;
60
+ getSequence(address: string): Promise<SequenceResponse>;
61
+ getBlock(height?: number): Promise<Block>;
62
+ getBalance(address: string, searchDenom: string): Promise<Coin>;
63
+ getTx(id: string): Promise<IndexedTx | null>;
64
+ searchTx(query: SearchTxQuery, filter?: SearchTxFilter): Promise<readonly IndexedTx[]>;
65
+ disconnect(): void;
66
+ /**
67
+ * Broadcasts a signed transaction to the network and monitors its inclusion in a block.
68
+ *
69
+ * If broadcasting is rejected by the node for some reason (e.g. because of a CheckTx failure),
70
+ * an error is thrown.
71
+ *
72
+ * If the transaction is not included in a block before the provided timeout, this errors with a `TimeoutError`.
73
+ *
74
+ * If the transaction is included in a block, a `DeliverTxResponse` is returned. The caller then
75
+ * usually needs to check for execution success or failure.
76
+ */
77
+ broadcastTx(tx: Uint8Array, timeoutMs?: number, pollIntervalMs?: number): Promise<DeliverTxResponse>;
78
+ /**
79
+ * getCodes() returns all codes and is just looping through all pagination pages.
80
+ *
81
+ * This is potentially inefficient and advanced apps should consider creating
82
+ * their own query client to handle pagination together with the app's screens.
83
+ */
84
+ getCodes(): Promise<readonly Code[]>;
85
+ getCodeDetails(codeId: number): Promise<CodeDetails>;
86
+ /**
87
+ * getContracts() returns all contract instances for one code and is just looping through all pagination pages.
88
+ *
89
+ * This is potentially inefficient and advanced apps should consider creating
90
+ * their own query client to handle pagination together with the app's screens.
91
+ */
92
+ getContracts(codeId: number): Promise<readonly string[]>;
93
+ /**
94
+ * Throws an error if no contract was found at the address
95
+ */
96
+ getContract(address: string): Promise<Contract>;
97
+ /**
98
+ * Returns the data at the key if present (raw contract dependent storage data)
99
+ * or null if no data at this key.
100
+ *
101
+ * Promise is rejected when contract does not exist.
102
+ */
103
+ queryContractRaw(address: string, key: Uint8Array): Promise<Uint8Array | null>;
104
+ /**
105
+ * Makes a smart query on the contract, returns the parsed JSON document.
106
+ *
107
+ * Promise is rejected when contract does not exist.
108
+ * Promise is rejected for invalid query format.
109
+ * Promise is rejected for invalid response format.
110
+ */
111
+ queryContractSmart(address: string, queryMsg: JsonObject): Promise<JsonObject>;
112
+ queryContractFull(sender: string, address: string, queryMsg: JsonObject, funds: Coin[], dependencies: string[]): Promise<JsonObject>;
113
+ private txsQuery;
114
+ }