@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.
- package/.DS_Store +0 -0
- package/.eslintignore +5 -0
- package/.eslintrc.js +108 -0
- package/.gitignore +5 -0
- package/README.md +22 -0
- package/build/encoding.d.ts +12 -0
- package/build/encoding.js +25 -0
- package/build/encoding.js.map +1 -0
- package/build/encoding.spec.d.ts +1 -0
- package/build/encoding.spec.js +78 -0
- package/build/encoding.spec.js.map +1 -0
- package/build/index.d.ts +6 -0
- package/build/index.js +18 -0
- package/build/index.js.map +1 -0
- package/build/modules/index.d.ts +3 -0
- package/build/modules/index.js +14 -0
- package/build/modules/index.js.map +1 -0
- package/build/modules/wasmx/aminomessages.d.ts +49 -0
- package/build/modules/wasmx/aminomessages.js +63 -0
- package/build/modules/wasmx/aminomessages.js.map +1 -0
- package/build/modules/wasmx/aminomessages.spec.d.ts +1 -0
- package/build/modules/wasmx/aminomessages.spec.js +209 -0
- package/build/modules/wasmx/aminomessages.spec.js.map +1 -0
- package/build/modules/wasmx/messages.d.ts +18 -0
- package/build/modules/wasmx/messages.js +22 -0
- package/build/modules/wasmx/messages.js.map +1 -0
- package/build/modules/wasmx/queries.d.ts +42 -0
- package/build/modules/wasmx/queries.js +81 -0
- package/build/modules/wasmx/queries.js.map +1 -0
- package/build/signingwasmxclient.d.ts +160 -0
- package/build/signingwasmxclient.js +303 -0
- package/build/signingwasmxclient.js.map +1 -0
- package/build/tendermintclient.d.ts +3 -0
- package/build/tendermintclient.js +9 -0
- package/build/tendermintclient.js.map +1 -0
- package/build/wasmxclient.d.ts +114 -0
- package/build/wasmxclient.js +344 -0
- package/build/wasmxclient.js.map +1 -0
- package/jasmine-testrunner.js +38 -0
- package/karma.conf.js +54 -0
- package/package.json +93 -0
- package/src/encoding.spec.ts +99 -0
- package/src/encoding.ts +21 -0
- package/src/index.ts +30 -0
- package/src/modules/index.ts +17 -0
- package/src/modules/wasmx/aminomessages.spec.ts +222 -0
- package/src/modules/wasmx/aminomessages.ts +129 -0
- package/src/modules/wasmx/messages.ts +43 -0
- package/src/modules/wasmx/queries.ts +134 -0
- package/src/signingwasmxclient.ts +577 -0
- package/src/tendermintclient.ts +7 -0
- package/src/wasmxclient.ts +477 -0
- package/tsconfig.eslint.json +9 -0
- package/tsconfig.json +12 -0
- package/typedoc.js +11 -0
- package/webpack.web.config.js +37 -0
- package/yarn-error.log +4205 -0
- package/yarn.lock +4145 -0
|
@@ -0,0 +1,209 @@
|
|
|
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
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
7
|
+
const encoding_1 = require("@cosmjs/encoding");
|
|
8
|
+
const stargate_1 = require("@cosmjs/stargate");
|
|
9
|
+
const long_1 = __importDefault(require("long"));
|
|
10
|
+
const aminomessages_1 = require("./aminomessages");
|
|
11
|
+
describe("AminoTypes", () => {
|
|
12
|
+
describe("toAmino", () => {
|
|
13
|
+
it("works for MsgStoreCode", () => {
|
|
14
|
+
const msg = {
|
|
15
|
+
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
|
16
|
+
wasmByteCode: (0, encoding_1.fromBase64)("WUVMTE9XIFNVQk1BUklORQ=="),
|
|
17
|
+
};
|
|
18
|
+
const aminoMsg = new stargate_1.AminoTypes((0, aminomessages_1.createWasmAminoConverters)()).toAmino({
|
|
19
|
+
typeUrl: "/wasmx.wasmx.MsgStoreCode",
|
|
20
|
+
value: msg,
|
|
21
|
+
});
|
|
22
|
+
const expected = {
|
|
23
|
+
type: "wasmx/MsgStoreCode",
|
|
24
|
+
value: {
|
|
25
|
+
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
|
26
|
+
wasm_byte_code: "WUVMTE9XIFNVQk1BUklORQ==",
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
expect(aminoMsg).toEqual(expected);
|
|
30
|
+
});
|
|
31
|
+
it("works for MsgInstantiateContract", () => {
|
|
32
|
+
// With admin
|
|
33
|
+
{
|
|
34
|
+
const msg = {
|
|
35
|
+
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
codeId: long_1.default.fromString("12345"),
|
|
38
|
+
label: "sticky",
|
|
39
|
+
msg: (0, encoding_1.toUtf8)(`{"foo":"bar"}`),
|
|
40
|
+
funds: (0, stargate_1.coins)(1234, "ucosm"),
|
|
41
|
+
};
|
|
42
|
+
const aminoMsg = new stargate_1.AminoTypes((0, aminomessages_1.createWasmAminoConverters)()).toAmino({
|
|
43
|
+
typeUrl: "/wasmx.wasmx.MsgInstantiateContract",
|
|
44
|
+
value: msg,
|
|
45
|
+
});
|
|
46
|
+
const expected = {
|
|
47
|
+
type: "wasmx/MsgInstantiateContract",
|
|
48
|
+
value: {
|
|
49
|
+
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
|
50
|
+
code_id: "12345",
|
|
51
|
+
label: "sticky",
|
|
52
|
+
msg: { foo: "bar" },
|
|
53
|
+
funds: (0, stargate_1.coins)(1234, "ucosm"),
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
expect(aminoMsg).toEqual(expected);
|
|
57
|
+
}
|
|
58
|
+
// Without admin
|
|
59
|
+
{
|
|
60
|
+
const msg = {
|
|
61
|
+
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
|
62
|
+
// @ts-ignore
|
|
63
|
+
codeId: long_1.default.fromString("12345"),
|
|
64
|
+
label: "sticky",
|
|
65
|
+
msg: (0, encoding_1.toUtf8)(`{"foo":"bar"}`),
|
|
66
|
+
funds: (0, stargate_1.coins)(1234, "ucosm"),
|
|
67
|
+
};
|
|
68
|
+
const aminoMsg = new stargate_1.AminoTypes((0, aminomessages_1.createWasmAminoConverters)()).toAmino({
|
|
69
|
+
typeUrl: "/wasmx.wasmx.MsgInstantiateContract",
|
|
70
|
+
value: msg,
|
|
71
|
+
});
|
|
72
|
+
const expected = {
|
|
73
|
+
type: "wasmx/MsgInstantiateContract",
|
|
74
|
+
value: {
|
|
75
|
+
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
|
76
|
+
code_id: "12345",
|
|
77
|
+
label: "sticky",
|
|
78
|
+
msg: { foo: "bar" },
|
|
79
|
+
funds: (0, stargate_1.coins)(1234, "ucosm"),
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
expect(aminoMsg).toEqual(expected);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
it("works for MsgExecuteContract", () => {
|
|
86
|
+
const msg = {
|
|
87
|
+
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
|
88
|
+
contract: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k",
|
|
89
|
+
msg: (0, encoding_1.toUtf8)(`{"foo":"bar"}`),
|
|
90
|
+
funds: (0, stargate_1.coins)(1234, "ucosm"),
|
|
91
|
+
dependencies: [],
|
|
92
|
+
};
|
|
93
|
+
const aminoMsg = new stargate_1.AminoTypes((0, aminomessages_1.createWasmAminoConverters)()).toAmino({
|
|
94
|
+
typeUrl: "/wasmx.wasmx.MsgExecuteContract",
|
|
95
|
+
value: msg,
|
|
96
|
+
});
|
|
97
|
+
const expected = {
|
|
98
|
+
type: "wasmx/MsgExecuteContract",
|
|
99
|
+
value: {
|
|
100
|
+
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
|
101
|
+
contract: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k",
|
|
102
|
+
msg: { foo: "bar" },
|
|
103
|
+
funds: (0, stargate_1.coins)(1234, "ucosm"),
|
|
104
|
+
dependencies: [],
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
expect(aminoMsg).toEqual(expected);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
describe("fromAmino", () => {
|
|
111
|
+
it("works for MsgStoreCode", () => {
|
|
112
|
+
const aminoMsg = {
|
|
113
|
+
type: "wasmx/MsgStoreCode",
|
|
114
|
+
value: {
|
|
115
|
+
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
|
116
|
+
wasm_byte_code: "WUVMTE9XIFNVQk1BUklORQ==",
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
const msg = new stargate_1.AminoTypes((0, aminomessages_1.createWasmAminoConverters)()).fromAmino(aminoMsg);
|
|
120
|
+
const expectedValue = {
|
|
121
|
+
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
|
122
|
+
wasmByteCode: (0, encoding_1.fromBase64)("WUVMTE9XIFNVQk1BUklORQ=="),
|
|
123
|
+
};
|
|
124
|
+
expect(msg).toEqual({
|
|
125
|
+
typeUrl: "/wasmx.wasmx.MsgStoreCode",
|
|
126
|
+
value: expectedValue,
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
it("works for MsgInstantiateContract", () => {
|
|
130
|
+
// With admin
|
|
131
|
+
{
|
|
132
|
+
const aminoMsg = {
|
|
133
|
+
type: "wasmx/MsgInstantiateContract",
|
|
134
|
+
value: {
|
|
135
|
+
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
|
136
|
+
code_id: "12345",
|
|
137
|
+
label: "sticky",
|
|
138
|
+
msg: { foo: "bar" },
|
|
139
|
+
funds: (0, stargate_1.coins)(1234, "ucosm"),
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
const msg = new stargate_1.AminoTypes((0, aminomessages_1.createWasmAminoConverters)()).fromAmino(aminoMsg);
|
|
143
|
+
const expectedValue = {
|
|
144
|
+
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
|
145
|
+
// @ts-ignore
|
|
146
|
+
codeId: long_1.default.fromString("12345"),
|
|
147
|
+
label: "sticky",
|
|
148
|
+
msg: (0, encoding_1.toUtf8)(`{"foo":"bar"}`),
|
|
149
|
+
funds: (0, stargate_1.coins)(1234, "ucosm"),
|
|
150
|
+
};
|
|
151
|
+
expect(msg).toEqual({
|
|
152
|
+
typeUrl: "/wasmx.wasmx.MsgInstantiateContract",
|
|
153
|
+
value: expectedValue,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
// Without admin
|
|
157
|
+
{
|
|
158
|
+
const aminoMsg = {
|
|
159
|
+
type: "wasmx/MsgInstantiateContract",
|
|
160
|
+
value: {
|
|
161
|
+
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
|
162
|
+
code_id: "12345",
|
|
163
|
+
label: "sticky",
|
|
164
|
+
msg: { foo: "bar" },
|
|
165
|
+
funds: (0, stargate_1.coins)(1234, "ucosm"),
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
const msg = new stargate_1.AminoTypes((0, aminomessages_1.createWasmAminoConverters)()).fromAmino(aminoMsg);
|
|
169
|
+
const expectedValue = {
|
|
170
|
+
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
|
171
|
+
// @ts-ignore
|
|
172
|
+
codeId: long_1.default.fromString("12345"),
|
|
173
|
+
label: "sticky",
|
|
174
|
+
msg: (0, encoding_1.toUtf8)(`{"foo":"bar"}`),
|
|
175
|
+
funds: (0, stargate_1.coins)(1234, "ucosm"),
|
|
176
|
+
};
|
|
177
|
+
expect(msg).toEqual({
|
|
178
|
+
typeUrl: "/wasmx.wasmx.MsgInstantiateContract",
|
|
179
|
+
value: expectedValue,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
it("works for MsgExecuteContract", () => {
|
|
184
|
+
const aminoMsg = {
|
|
185
|
+
type: "wasmx/MsgExecuteContract",
|
|
186
|
+
value: {
|
|
187
|
+
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
|
188
|
+
contract: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k",
|
|
189
|
+
msg: { foo: "bar" },
|
|
190
|
+
funds: (0, stargate_1.coins)(1234, "ucosm"),
|
|
191
|
+
dependencies: [],
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
const msg = new stargate_1.AminoTypes((0, aminomessages_1.createWasmAminoConverters)()).fromAmino(aminoMsg);
|
|
195
|
+
const expectedValue = {
|
|
196
|
+
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
|
197
|
+
contract: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k",
|
|
198
|
+
msg: (0, encoding_1.toUtf8)(`{"foo":"bar"}`),
|
|
199
|
+
funds: (0, stargate_1.coins)(1234, "ucosm"),
|
|
200
|
+
dependencies: [],
|
|
201
|
+
};
|
|
202
|
+
expect(msg).toEqual({
|
|
203
|
+
typeUrl: "/wasmx.wasmx.MsgExecuteContract",
|
|
204
|
+
value: expectedValue,
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
//# sourceMappingURL=aminomessages.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aminomessages.spec.js","sourceRoot":"","sources":["../../../src/modules/wasmx/aminomessages.spec.ts"],"names":[],"mappings":";;;;;AAAA,yDAAyD;AACzD,+CAAsD;AACtD,+CAAqD;AAMrD,gDAAwB;AAExB,mDAKyB;AAEzB,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,QAAQ,CAAC,SAAS,EAA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K,EAAE,aAAa;aACrB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EncodeObject, GeneratedType } from "@cosmjs/proto-signing";
|
|
2
|
+
import { MsgExecuteContract, MsgInstantiateContract, MsgStoreCode } from "@ark-us/wasmxjs";
|
|
3
|
+
export declare const wasmTypes: ReadonlyArray<[string, GeneratedType]>;
|
|
4
|
+
export interface MsgStoreCodeEncodeObject extends EncodeObject {
|
|
5
|
+
readonly typeUrl: "/wasmx.wasmx.MsgStoreCode";
|
|
6
|
+
readonly value: Partial<MsgStoreCode>;
|
|
7
|
+
}
|
|
8
|
+
export declare function isMsgStoreCodeEncodeObject(object: EncodeObject): object is MsgStoreCodeEncodeObject;
|
|
9
|
+
export interface MsgInstantiateContractEncodeObject extends EncodeObject {
|
|
10
|
+
readonly typeUrl: "/wasmx.wasmx.MsgInstantiateContract";
|
|
11
|
+
readonly value: Partial<MsgInstantiateContract>;
|
|
12
|
+
}
|
|
13
|
+
export declare function isMsgInstantiateContractEncodeObject(object: EncodeObject): object is MsgInstantiateContractEncodeObject;
|
|
14
|
+
export interface MsgExecuteContractEncodeObject extends EncodeObject {
|
|
15
|
+
readonly typeUrl: "/wasmx.wasmx.MsgExecuteContract";
|
|
16
|
+
readonly value: Partial<MsgExecuteContract>;
|
|
17
|
+
}
|
|
18
|
+
export declare function isMsgExecuteEncodeObject(object: EncodeObject): object is MsgExecuteContractEncodeObject;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isMsgExecuteEncodeObject = exports.isMsgInstantiateContractEncodeObject = exports.isMsgStoreCodeEncodeObject = exports.wasmTypes = void 0;
|
|
4
|
+
const wasmxjs_1 = require("@ark-us/wasmxjs");
|
|
5
|
+
exports.wasmTypes = [
|
|
6
|
+
["/wasmx.wasmx.MsgExecuteContract", wasmxjs_1.MsgExecuteContract],
|
|
7
|
+
["/wasmx.wasmx.MsgStoreCode", wasmxjs_1.MsgStoreCode],
|
|
8
|
+
["/wasmx.wasmx.MsgInstantiateContract", wasmxjs_1.MsgInstantiateContract],
|
|
9
|
+
];
|
|
10
|
+
function isMsgStoreCodeEncodeObject(object) {
|
|
11
|
+
return object.typeUrl === "/wasmx.wasmx.MsgStoreCode";
|
|
12
|
+
}
|
|
13
|
+
exports.isMsgStoreCodeEncodeObject = isMsgStoreCodeEncodeObject;
|
|
14
|
+
function isMsgInstantiateContractEncodeObject(object) {
|
|
15
|
+
return (object.typeUrl === "/wasmx.wasmx.MsgInstantiateContract");
|
|
16
|
+
}
|
|
17
|
+
exports.isMsgInstantiateContractEncodeObject = isMsgInstantiateContractEncodeObject;
|
|
18
|
+
function isMsgExecuteEncodeObject(object) {
|
|
19
|
+
return object.typeUrl === "/wasmx.wasmx.MsgExecuteContract";
|
|
20
|
+
}
|
|
21
|
+
exports.isMsgExecuteEncodeObject = isMsgExecuteEncodeObject;
|
|
22
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/modules/wasmx/messages.ts"],"names":[],"mappings":";;;AACA,6CAIyB;AAEZ,QAAA,SAAS,GAA2C;IAC/D,CAAC,iCAAiC,EAAE,4BAAkB,CAAC;IACvD,CAAC,2BAA2B,EAAE,sBAAY,CAAC;IAC3C,CAAC,qCAAqC,EAAE,gCAAsB,CAAC;CAChE,CAAC;AAOF,SAAgB,0BAA0B,CAAC,MAAoB;IAC7D,OAAQ,MAAmC,CAAC,OAAO,KAAK,2BAA2B,CAAC;AACtF,CAAC;AAFD,gEAEC;AAOD,SAAgB,oCAAoC,CAClD,MAAoB;IAEpB,OAAO,CACJ,MAA6C,CAAC,OAAO,KAAK,qCAAqC,CACjG,CAAC;AACJ,CAAC;AAND,oFAMC;AAOD,SAAgB,wBAAwB,CAAC,MAAoB;IAC3D,OAAQ,MAAyC,CAAC,OAAO,KAAK,iCAAiC,CAAC;AAClG,CAAC;AAFD,4DAEC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { QueryClient, Coin } from "@cosmjs/stargate";
|
|
2
|
+
import { QueryAllContractStateResponse, QueryCodeResponse, QueryCodesResponse, QueryContractInfoResponse, QueryContractsByCodeResponse, QueryRawContractStateResponse } from "@ark-us/wasmxjs";
|
|
3
|
+
/**
|
|
4
|
+
* An object containing a parsed JSON document. The result of JSON.parse().
|
|
5
|
+
* This doesn't provide any type safety over `any` but expresses intent in the code.
|
|
6
|
+
*
|
|
7
|
+
* This type is returned by `queryContractSmart`.
|
|
8
|
+
*/
|
|
9
|
+
export declare type JsonObject = any;
|
|
10
|
+
export interface WasmExtension {
|
|
11
|
+
readonly wasm: {
|
|
12
|
+
readonly listCodeInfo: (paginationKey?: Uint8Array) => Promise<QueryCodesResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Downloads the original wasm bytecode by code ID.
|
|
15
|
+
*
|
|
16
|
+
* Throws an error if no code with this id
|
|
17
|
+
*/
|
|
18
|
+
readonly getCode: (id: number) => Promise<QueryCodeResponse>;
|
|
19
|
+
readonly listContractsByCodeId: (id: number, paginationKey?: Uint8Array) => Promise<QueryContractsByCodeResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Returns null when contract was not found at this address.
|
|
22
|
+
*/
|
|
23
|
+
readonly getContractInfo: (address: string) => Promise<QueryContractInfoResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Returns all contract state.
|
|
26
|
+
* This is an empty array if no such contract, or contract has no data.
|
|
27
|
+
*/
|
|
28
|
+
readonly getAllContractState: (address: string, paginationKey?: Uint8Array) => Promise<QueryAllContractStateResponse>;
|
|
29
|
+
/**
|
|
30
|
+
* Returns the data at the key if present (unknown decoded json),
|
|
31
|
+
* or null if no data at this (contract address, key) pair
|
|
32
|
+
*/
|
|
33
|
+
readonly queryContractRaw: (address: string, key: Uint8Array) => Promise<QueryRawContractStateResponse>;
|
|
34
|
+
/**
|
|
35
|
+
* Makes a smart query on the contract and parses the response as JSON.
|
|
36
|
+
* Throws error if no such contract exists, the query format is invalid or the response is invalid.
|
|
37
|
+
*/
|
|
38
|
+
readonly queryContractSmart: (address: string, query: JsonObject) => Promise<JsonObject>;
|
|
39
|
+
readonly queryContractFull: (sender: string, address: string, query: JsonObject, funds: Coin[], dependencies: string[]) => Promise<JsonObject>;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export declare function setupWasmExtension(base: QueryClient): WasmExtension;
|
|
@@ -0,0 +1,81 @@
|
|
|
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.setupWasmExtension = void 0;
|
|
7
|
+
const encoding_1 = require("@cosmjs/encoding");
|
|
8
|
+
const stargate_1 = require("@cosmjs/stargate");
|
|
9
|
+
const wasmxjs_1 = require("@ark-us/wasmxjs");
|
|
10
|
+
const long_1 = __importDefault(require("long"));
|
|
11
|
+
function setupWasmExtension(base) {
|
|
12
|
+
const rpc = (0, stargate_1.createProtobufRpcClient)(base);
|
|
13
|
+
// Use this service to get easy typed access to query methods
|
|
14
|
+
// This cannot be used for proof verification
|
|
15
|
+
const queryService = new wasmxjs_1.QueryClientImpl(rpc);
|
|
16
|
+
return {
|
|
17
|
+
wasm: {
|
|
18
|
+
listCodeInfo: async (paginationKey) => {
|
|
19
|
+
const request = {
|
|
20
|
+
pagination: (0, stargate_1.createPagination)(paginationKey),
|
|
21
|
+
};
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
return queryService.codes(request);
|
|
24
|
+
},
|
|
25
|
+
getCode: async (id) => {
|
|
26
|
+
const request = { codeId: long_1.default.fromNumber(id) };
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
return queryService.code(request);
|
|
29
|
+
},
|
|
30
|
+
listContractsByCodeId: async (id, paginationKey) => {
|
|
31
|
+
const request = {
|
|
32
|
+
codeId: long_1.default.fromNumber(id),
|
|
33
|
+
pagination: (0, stargate_1.createPagination)(paginationKey),
|
|
34
|
+
};
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
return queryService.contractsByCode(request);
|
|
37
|
+
},
|
|
38
|
+
getContractInfo: async (address) => {
|
|
39
|
+
const request = { address: address };
|
|
40
|
+
return queryService.contractInfo(request);
|
|
41
|
+
},
|
|
42
|
+
getAllContractState: async (address, paginationKey) => {
|
|
43
|
+
const request = {
|
|
44
|
+
address: address,
|
|
45
|
+
pagination: (0, stargate_1.createPagination)(paginationKey),
|
|
46
|
+
};
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
return queryService.allContractState(request);
|
|
49
|
+
},
|
|
50
|
+
queryContractRaw: async (address, key) => {
|
|
51
|
+
const request = { address: address, queryData: key };
|
|
52
|
+
return queryService.rawContractState(request);
|
|
53
|
+
},
|
|
54
|
+
queryContractSmart: async (address, query) => {
|
|
55
|
+
const request = { address: address, queryData: (0, encoding_1.toUtf8)(JSON.stringify(query)) };
|
|
56
|
+
const { items } = await queryService.allContractState(request);
|
|
57
|
+
return items;
|
|
58
|
+
},
|
|
59
|
+
queryContractFull: async (sender, address, query, funds, dependencies) => {
|
|
60
|
+
const request = { sender: sender, address: address, queryData: (0, encoding_1.toUtf8)(JSON.stringify(query)), funds: funds, dependencies };
|
|
61
|
+
const { data } = await queryService.smartContractCall(request);
|
|
62
|
+
// By convention, smart queries must return a valid JSON document (see https://github.com/CosmWasm/cosmwasm/issues/144)
|
|
63
|
+
let responseText;
|
|
64
|
+
try {
|
|
65
|
+
responseText = (0, encoding_1.fromUtf8)(data);
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
throw new Error(`Could not UTF-8 decode smart query response from contract: ${error}`);
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
return JSON.parse(responseText);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
throw new Error(`Could not JSON parse smart query response from contract: ${error}`);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
exports.setupWasmExtension = setupWasmExtension;
|
|
81
|
+
//# sourceMappingURL=queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/modules/wasmx/queries.ts"],"names":[],"mappings":";;;;;;AAAA,+CAAoD;AACpD,+CAAgG;AAChG,6CAQyB;AACzB,gDAAwB;AAiDxB,SAAgB,kBAAkB,CAAC,IAAiB;IAClD,MAAM,GAAG,GAAG,IAAA,kCAAuB,EAAC,IAAI,CAAC,CAAC;IAC1C,6DAA6D;IAC7D,6CAA6C;IAC7C,MAAM,YAAY,GAAG,IAAI,yBAAe,CAAC,GAAG,CAAC,CAAC;IAE9C,OAAO;QACL,IAAI,EAAE;YACJ,YAAY,EAAE,KAAK,EAAE,aAA0B,EAAE,EAAE;gBACjD,MAAM,OAAO,GAAG;oBACd,UAAU,EAAE,IAAA,2BAAgB,EAAC,aAAa,CAAC;iBAC5C,CAAC;gBACF,aAAa;gBACb,OAAO,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACrC,CAAC;YACD,OAAO,EAAE,KAAK,EAAE,EAAU,EAAE,EAAE;gBAC5B,MAAM,OAAO,GAAG,EAAE,MAAM,EAAE,cAAI,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC;gBAChD,aAAa;gBACb,OAAO,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACpC,CAAC;YACD,qBAAqB,EAAE,KAAK,EAAE,EAAU,EAAE,aAA0B,EAAE,EAAE;gBACtE,MAAM,OAAO,GAAG;oBACd,MAAM,EAAE,cAAI,CAAC,UAAU,CAAC,EAAE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EAAE;gBACrH,MAAM,OAAO,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,IAAA,iBAAM,EAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;gBAC3H,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;gBAC/D,uHAAuH;gBACvH,IAAI,YAAY,CAAC;gBACjB,IAAI;oBACA,YAAY,GAAG,IAAA,mBAAQ,EAAC,IAAI,CAAC,CAAC;iBACjC;gBACD,OAAO,KAAK,EAAE;oBACV,MAAM,IAAI,KAAK,CAAC,8DAA8D,KAAK,EAAE,CAAC,CAAC;iBAC1F;gBACD,IAAI;oBACA,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;iBACnC;gBACD,OAAO,KAAK,EAAE;oBACV,MAAM,IAAI,KAAK,CAAC,4DAA4D,KAAK,EAAE,CAAC,CAAC;iBACxF;YACL,CAAC;SACA;KACF,CAAC;AACJ,CAAC;AAzED,gDAyEC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { EncodeObject, OfflineSigner, Registry } from "@cosmjs/proto-signing";
|
|
2
|
+
import { AminoTypes, Coin, DeliverTxResponse, Event, GasPrice, logs, SignerData, StdFee } from "@cosmjs/stargate";
|
|
3
|
+
import { HttpEndpoint } from "@cosmjs/tendermint-rpc";
|
|
4
|
+
import { TendermintClient } from './tendermintclient';
|
|
5
|
+
import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
|
|
6
|
+
import { WasmXClient } from "./wasmxclient";
|
|
7
|
+
import { JsonObject } from "./modules";
|
|
8
|
+
export interface UploadResult {
|
|
9
|
+
/** Size of the original wasm code in bytes */
|
|
10
|
+
readonly originalSize: number;
|
|
11
|
+
/** A hex encoded sha256 checksum of the original wasm code (that is stored on chain) */
|
|
12
|
+
readonly originalChecksum: string;
|
|
13
|
+
/** Size of the compressed wasm code in bytes */
|
|
14
|
+
readonly compressedSize: number;
|
|
15
|
+
/** A hex encoded sha256 checksum of the compressed wasm code (that stored in the transaction) */
|
|
16
|
+
readonly compressedChecksum: string;
|
|
17
|
+
/** The ID of the code asigned by the chain */
|
|
18
|
+
readonly codeId: number;
|
|
19
|
+
readonly logs: readonly logs.Log[];
|
|
20
|
+
/** Block height in which the transaction is included */
|
|
21
|
+
readonly height: number;
|
|
22
|
+
/** Transaction hash (might be used as transaction ID). Guaranteed to be non-empty upper-case hex */
|
|
23
|
+
readonly transactionHash: string;
|
|
24
|
+
readonly events: readonly Event[];
|
|
25
|
+
readonly gasWanted: number;
|
|
26
|
+
readonly gasUsed: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The options of an .instantiate() call.
|
|
30
|
+
* All properties are optional.
|
|
31
|
+
*/
|
|
32
|
+
export interface InstantiateOptions {
|
|
33
|
+
readonly memo?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The funds that are transferred from the sender to the newly created contract.
|
|
36
|
+
* The funds are transferred as part of the message execution after the contract address is
|
|
37
|
+
* created and before the instantiation message is executed by the contract.
|
|
38
|
+
*
|
|
39
|
+
* Only native tokens are supported.
|
|
40
|
+
*/
|
|
41
|
+
readonly funds?: readonly Coin[];
|
|
42
|
+
/**
|
|
43
|
+
* A bech32 encoded address of an admin account.
|
|
44
|
+
* Caution: an admin has the privilege to upgrade a contract. If this is not desired, do not set this value.
|
|
45
|
+
*/
|
|
46
|
+
readonly admin?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface InstantiateResult {
|
|
49
|
+
/** The address of the newly instantiated contract */
|
|
50
|
+
readonly contractAddress: string;
|
|
51
|
+
readonly logs: readonly logs.Log[];
|
|
52
|
+
/** Block height in which the transaction is included */
|
|
53
|
+
readonly height: number;
|
|
54
|
+
/** Transaction hash (might be used as transaction ID). Guaranteed to be non-empty upper-case hex */
|
|
55
|
+
readonly transactionHash: string;
|
|
56
|
+
readonly events: readonly Event[];
|
|
57
|
+
readonly gasWanted: number;
|
|
58
|
+
readonly gasUsed: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Result type of updateAdmin and clearAdmin
|
|
62
|
+
*/
|
|
63
|
+
export interface ChangeAdminResult {
|
|
64
|
+
readonly logs: readonly logs.Log[];
|
|
65
|
+
/** Block height in which the transaction is included */
|
|
66
|
+
readonly height: number;
|
|
67
|
+
/** Transaction hash (might be used as transaction ID). Guaranteed to be non-empty upper-case hex */
|
|
68
|
+
readonly transactionHash: string;
|
|
69
|
+
readonly events: readonly Event[];
|
|
70
|
+
readonly gasWanted: number;
|
|
71
|
+
readonly gasUsed: number;
|
|
72
|
+
}
|
|
73
|
+
export interface MigrateResult {
|
|
74
|
+
readonly logs: readonly logs.Log[];
|
|
75
|
+
/** Block height in which the transaction is included */
|
|
76
|
+
readonly height: number;
|
|
77
|
+
/** Transaction hash (might be used as transaction ID). Guaranteed to be non-empty upper-case hex */
|
|
78
|
+
readonly transactionHash: string;
|
|
79
|
+
readonly events: readonly Event[];
|
|
80
|
+
readonly gasWanted: number;
|
|
81
|
+
readonly gasUsed: number;
|
|
82
|
+
}
|
|
83
|
+
export interface ExecuteInstruction {
|
|
84
|
+
contractAddress: string;
|
|
85
|
+
msg: JsonObject;
|
|
86
|
+
funds?: readonly Coin[];
|
|
87
|
+
}
|
|
88
|
+
export interface ExecuteResult {
|
|
89
|
+
readonly logs: readonly logs.Log[];
|
|
90
|
+
/** Block height in which the transaction is included */
|
|
91
|
+
readonly height: number;
|
|
92
|
+
/** Transaction hash (might be used as transaction ID). Guaranteed to be non-empty upper-case hex */
|
|
93
|
+
readonly transactionHash: string;
|
|
94
|
+
readonly events: readonly Event[];
|
|
95
|
+
readonly gasWanted: number;
|
|
96
|
+
readonly gasUsed: number;
|
|
97
|
+
}
|
|
98
|
+
export interface SigningWasmXClientOptions {
|
|
99
|
+
readonly registry?: Registry;
|
|
100
|
+
readonly aminoTypes?: AminoTypes;
|
|
101
|
+
readonly broadcastTimeoutMs?: number;
|
|
102
|
+
readonly broadcastPollIntervalMs?: number;
|
|
103
|
+
readonly gasPrice?: GasPrice;
|
|
104
|
+
}
|
|
105
|
+
export declare class SigningWasmXClient extends WasmXClient {
|
|
106
|
+
readonly registry: Registry;
|
|
107
|
+
readonly broadcastTimeoutMs: number | undefined;
|
|
108
|
+
readonly broadcastPollIntervalMs: number | undefined;
|
|
109
|
+
private readonly signer;
|
|
110
|
+
private readonly aminoTypes;
|
|
111
|
+
private readonly gasPrice;
|
|
112
|
+
/**
|
|
113
|
+
* Creates an instance by connecting to the given Tendermint RPC endpoint.
|
|
114
|
+
*
|
|
115
|
+
* For now this uses the Tendermint 0.34 client. If you need Tendermint 0.37
|
|
116
|
+
* support, see `createWithSigner`.
|
|
117
|
+
*/
|
|
118
|
+
static connectWithSigner(endpoint: string | HttpEndpoint, signer: OfflineSigner, options?: SigningWasmXClientOptions): Promise<SigningWasmXClient>;
|
|
119
|
+
/**
|
|
120
|
+
* Creates an instance from a manually created Tendermint client.
|
|
121
|
+
* Use this to use `Tendermint37Client` instead of `Tendermint34Client`.
|
|
122
|
+
*/
|
|
123
|
+
static createWithSigner(tmClient: TendermintClient, signer: OfflineSigner, options?: SigningWasmXClientOptions): Promise<SigningWasmXClient>;
|
|
124
|
+
/**
|
|
125
|
+
* Creates a client in offline mode.
|
|
126
|
+
*
|
|
127
|
+
* This should only be used in niche cases where you know exactly what you're doing,
|
|
128
|
+
* e.g. when building an offline signing application.
|
|
129
|
+
*
|
|
130
|
+
* When you try to use online functionality with such a signer, an
|
|
131
|
+
* exception will be raised.
|
|
132
|
+
*/
|
|
133
|
+
static offline(signer: OfflineSigner, options?: SigningWasmXClientOptions): Promise<SigningWasmXClient>;
|
|
134
|
+
protected constructor(tmClient: TendermintClient | undefined, signer: OfflineSigner, options: SigningWasmXClientOptions);
|
|
135
|
+
simulate(signerAddress: string, messages: readonly EncodeObject[], memo: string | undefined): Promise<number>;
|
|
136
|
+
/** Uploads code and returns a receipt, including the code ID */
|
|
137
|
+
upload(senderAddress: string, wasmCode: Uint8Array, fee: StdFee | "auto" | number, memo?: string): Promise<UploadResult>;
|
|
138
|
+
instantiate(senderAddress: string, codeId: number, msg: JsonObject, label: string, fee: StdFee | "auto" | number, options?: InstantiateOptions): Promise<InstantiateResult>;
|
|
139
|
+
execute(senderAddress: string, contractAddress: string, msg: JsonObject, fee: StdFee | "auto" | number, memo?: string, funds?: readonly Coin[]): Promise<ExecuteResult>;
|
|
140
|
+
/**
|
|
141
|
+
* Like `execute` but allows executing multiple messages in one transaction.
|
|
142
|
+
*/
|
|
143
|
+
executeMultiple(senderAddress: string, instructions: readonly ExecuteInstruction[], fee: StdFee | "auto" | number, memo?: string): Promise<ExecuteResult>;
|
|
144
|
+
sendTokens(senderAddress: string, recipientAddress: string, amount: readonly Coin[], fee: StdFee | "auto" | number, memo?: string): Promise<DeliverTxResponse>;
|
|
145
|
+
delegateTokens(delegatorAddress: string, validatorAddress: string, amount: Coin, fee: StdFee | "auto" | number, memo?: string): Promise<DeliverTxResponse>;
|
|
146
|
+
undelegateTokens(delegatorAddress: string, validatorAddress: string, amount: Coin, fee: StdFee | "auto" | number, memo?: string): Promise<DeliverTxResponse>;
|
|
147
|
+
withdrawRewards(delegatorAddress: string, validatorAddress: string, fee: StdFee | "auto" | number, memo?: string): Promise<DeliverTxResponse>;
|
|
148
|
+
/**
|
|
149
|
+
* Creates a transaction with the given messages, fee and memo. Then signs and broadcasts the transaction.
|
|
150
|
+
*
|
|
151
|
+
* @param signerAddress The address that will sign transactions using this instance. The signer must be able to sign with this address.
|
|
152
|
+
* @param messages
|
|
153
|
+
* @param fee
|
|
154
|
+
* @param memo
|
|
155
|
+
*/
|
|
156
|
+
signAndBroadcast(signerAddress: string, messages: readonly EncodeObject[], fee: StdFee | "auto" | number, memo?: string): Promise<DeliverTxResponse>;
|
|
157
|
+
sign(signerAddress: string, messages: readonly EncodeObject[], fee: StdFee, memo: string, explicitSignerData?: SignerData): Promise<TxRaw>;
|
|
158
|
+
private signAmino;
|
|
159
|
+
private signDirect;
|
|
160
|
+
}
|