wasm-ast-types 0.14.0 → 0.15.0

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.
@@ -120,10 +120,11 @@ var createExecuteClass = function createExecuteClass(context, className, impleme
120
120
 
121
121
  [].push.apply(blockStmt, [// client/contract set
122
122
  t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('client')), t.identifier('client'))), t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('sender')), t.identifier('sender'))), t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('contractAddress')), t.identifier('contractAddress')))].concat((0, _toConsumableArray2["default"])(bindings)));
123
+ var noImplicitOverride = context.options.client.noImplicitOverride && extendsClassName && context.options.client.execExtendsQuery;
123
124
  return t.exportNamedDeclaration((0, _utils.classDeclaration)(className, [// client
124
- (0, _utils.classProperty)('client', t.tsTypeAnnotation(t.tsTypeReference(t.identifier('SigningCosmWasmClient')))), // sender
125
+ (0, _utils.classProperty)('client', t.tsTypeAnnotation(t.tsTypeReference(t.identifier('SigningCosmWasmClient'))), false, false, noImplicitOverride), // sender
125
126
  (0, _utils.classProperty)('sender', t.tsTypeAnnotation(t.tsStringKeyword())), // contractAddress
126
- (0, _utils.classProperty)('contractAddress', t.tsTypeAnnotation(t.tsStringKeyword())), // constructor
127
+ (0, _utils.classProperty)('contractAddress', t.tsTypeAnnotation(t.tsStringKeyword()), false, false, noImplicitOverride), // constructor
127
128
  t.classMethod('constructor', t.identifier('constructor'), [(0, _utils.typedIdentifier)('client', t.tsTypeAnnotation(t.tsTypeReference(t.identifier('SigningCosmWasmClient')))), (0, _utils.typedIdentifier)('sender', t.tsTypeAnnotation(t.tsStringKeyword())), (0, _utils.typedIdentifier)('contractAddress', t.tsTypeAnnotation(t.tsStringKeyword()))], t.blockStatement(blockStmt))].concat((0, _toConsumableArray2["default"])(methods)), [t.tSExpressionWithTypeArguments(t.identifier(implementsClassName))], extendsClassName ? t.identifier(extendsClassName) : null));
128
129
  };
129
130
 
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _execute_msg_for__empty = _interopRequireDefault(require("../../../../../__fixtures__/sg721/execute_msg_for__empty.json"));
6
+
7
+ var _client = require("../client");
8
+
9
+ var _testUtils = require("../../../test-utils");
10
+
11
+ var ctx = (0, _testUtils.makeContext)(_execute_msg_for__empty["default"]);
12
+ describe('exec', function () {});
13
+ it('Impl, execExtends, noExtendsClass', function () {
14
+ ctx.options.client.noImplicitOverride = false;
15
+ ctx.options.client.execExtendsQuery = true;
16
+ (0, _testUtils.expectCode)((0, _client.createExecuteClass)(ctx, 'SG721Client', 'SG721Instance', null, _execute_msg_for__empty["default"]));
17
+ });
18
+ it('Impl, execExtends, ExtendsClass', function () {
19
+ ctx.options.client.noImplicitOverride = false;
20
+ ctx.options.client.execExtendsQuery = true;
21
+ (0, _testUtils.expectCode)((0, _client.createExecuteClass)(ctx, 'SG721Client', 'SG721Instance', 'ExtendsClassName', _execute_msg_for__empty["default"]));
22
+ });
23
+ it('noImpl, execExtends, ExtendsClass', function () {
24
+ ctx.options.client.noImplicitOverride = true;
25
+ ctx.options.client.execExtendsQuery = true;
26
+ (0, _testUtils.expectCode)((0, _client.createExecuteClass)(ctx, 'SG721Client', 'SG721Instance', 'ExtendsClassName', _execute_msg_for__empty["default"]));
27
+ });
28
+ it('noImpl, noExecExtends, ExtendsClass', function () {
29
+ ctx.options.client.noImplicitOverride = true;
30
+ ctx.options.client.execExtendsQuery = false;
31
+ (0, _testUtils.expectCode)((0, _client.createExecuteClass)(ctx, 'SG721Client', 'SG721Instance', 'ExtendsClassName', _execute_msg_for__empty["default"]));
32
+ });
33
+ it('noImpl, noExecExtends, noExtendsClass', function () {
34
+ ctx.options.client.noImplicitOverride = true;
35
+ ctx.options.client.execExtendsQuery = false;
36
+ (0, _testUtils.expectCode)((0, _client.createExecuteClass)(ctx, 'SG721Client', 'SG721Instance', null, _execute_msg_for__empty["default"]));
37
+ });
@@ -29,7 +29,8 @@ var defaultOptions = {
29
29
  },
30
30
  client: {
31
31
  enabled: true,
32
- execExtendsQuery: true
32
+ execExtendsQuery: true,
33
+ noImplicitOverride: false
33
34
  },
34
35
  recoil: {
35
36
  enabled: false
@@ -125,10 +125,12 @@ var classProperty = function classProperty(name) {
125
125
  var typeAnnotation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
126
126
  var isReadonly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
127
127
  var isStatic = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
128
+ var noImplicitOverride = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
128
129
  var prop = t.classProperty(t.identifier(name));
129
130
  if (isReadonly) prop.readonly = true;
130
131
  if (isStatic) prop["static"] = true;
131
132
  if (typeAnnotation) prop.typeAnnotation = typeAnnotation;
133
+ if (noImplicitOverride) prop.override = true;
132
134
  return prop;
133
135
  };
134
136
 
@@ -71,10 +71,11 @@ export const createExecuteClass = (context, className, implementsClassName, exte
71
71
 
72
72
  [].push.apply(blockStmt, [// client/contract set
73
73
  t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('client')), t.identifier('client'))), t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('sender')), t.identifier('sender'))), t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('contractAddress')), t.identifier('contractAddress'))), ...bindings]);
74
+ const noImplicitOverride = context.options.client.noImplicitOverride && extendsClassName && context.options.client.execExtendsQuery;
74
75
  return t.exportNamedDeclaration(classDeclaration(className, [// client
75
- classProperty('client', t.tsTypeAnnotation(t.tsTypeReference(t.identifier('SigningCosmWasmClient')))), // sender
76
+ classProperty('client', t.tsTypeAnnotation(t.tsTypeReference(t.identifier('SigningCosmWasmClient'))), false, false, noImplicitOverride), // sender
76
77
  classProperty('sender', t.tsTypeAnnotation(t.tsStringKeyword())), // contractAddress
77
- classProperty('contractAddress', t.tsTypeAnnotation(t.tsStringKeyword())), // constructor
78
+ classProperty('contractAddress', t.tsTypeAnnotation(t.tsStringKeyword()), false, false, noImplicitOverride), // constructor
78
79
  t.classMethod('constructor', t.identifier('constructor'), [typedIdentifier('client', t.tsTypeAnnotation(t.tsTypeReference(t.identifier('SigningCosmWasmClient')))), typedIdentifier('sender', t.tsTypeAnnotation(t.tsStringKeyword())), typedIdentifier('contractAddress', t.tsTypeAnnotation(t.tsStringKeyword()))], t.blockStatement(blockStmt)), ...methods], [t.tSExpressionWithTypeArguments(t.identifier(implementsClassName))], extendsClassName ? t.identifier(extendsClassName) : null));
79
80
  };
80
81
  export const createExecuteInterface = (context, className, extendsClassName, execMsg) => {
@@ -0,0 +1,30 @@
1
+ import execute_msg_for__empty from '../../../../../__fixtures__/sg721/execute_msg_for__empty.json';
2
+ import { createExecuteClass } from '../client';
3
+ import { expectCode, makeContext } from '../../../test-utils';
4
+ const ctx = makeContext(execute_msg_for__empty);
5
+ describe('exec', () => {});
6
+ it('Impl, execExtends, noExtendsClass', () => {
7
+ ctx.options.client.noImplicitOverride = false;
8
+ ctx.options.client.execExtendsQuery = true;
9
+ expectCode(createExecuteClass(ctx, 'SG721Client', 'SG721Instance', null, execute_msg_for__empty));
10
+ });
11
+ it('Impl, execExtends, ExtendsClass', () => {
12
+ ctx.options.client.noImplicitOverride = false;
13
+ ctx.options.client.execExtendsQuery = true;
14
+ expectCode(createExecuteClass(ctx, 'SG721Client', 'SG721Instance', 'ExtendsClassName', execute_msg_for__empty));
15
+ });
16
+ it('noImpl, execExtends, ExtendsClass', () => {
17
+ ctx.options.client.noImplicitOverride = true;
18
+ ctx.options.client.execExtendsQuery = true;
19
+ expectCode(createExecuteClass(ctx, 'SG721Client', 'SG721Instance', 'ExtendsClassName', execute_msg_for__empty));
20
+ });
21
+ it('noImpl, noExecExtends, ExtendsClass', () => {
22
+ ctx.options.client.noImplicitOverride = true;
23
+ ctx.options.client.execExtendsQuery = false;
24
+ expectCode(createExecuteClass(ctx, 'SG721Client', 'SG721Instance', 'ExtendsClassName', execute_msg_for__empty));
25
+ });
26
+ it('noImpl, noExecExtends, noExtendsClass', () => {
27
+ ctx.options.client.noImplicitOverride = true;
28
+ ctx.options.client.execExtendsQuery = false;
29
+ expectCode(createExecuteClass(ctx, 'SG721Client', 'SG721Instance', null, execute_msg_for__empty));
30
+ });
@@ -15,7 +15,8 @@ export const defaultOptions = {
15
15
  },
16
16
  client: {
17
17
  enabled: true,
18
- execExtendsQuery: true
18
+ execExtendsQuery: true,
19
+ noImplicitOverride: false
19
20
  },
20
21
  recoil: {
21
22
  enabled: false
@@ -62,11 +62,12 @@ export const classDeclaration = (name, body, implementsExressions = [], superCla
62
62
 
63
63
  return declaration;
64
64
  };
65
- export const classProperty = (name, typeAnnotation = null, isReadonly = false, isStatic = false) => {
65
+ export const classProperty = (name, typeAnnotation = null, isReadonly = false, isStatic = false, noImplicitOverride = false) => {
66
66
  const prop = t.classProperty(t.identifier(name));
67
67
  if (isReadonly) prop.readonly = true;
68
68
  if (isStatic) prop.static = true;
69
69
  if (typeAnnotation) prop.typeAnnotation = typeAnnotation;
70
+ if (noImplicitOverride) prop.override = true;
70
71
  return prop;
71
72
  };
72
73
  export const arrowFunctionExpression = (params, body, returnType, isAsync = false) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wasm-ast-types",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "CosmWasm TypeScript AST generation",
5
5
  "author": "Dan Lynch <pyramation@gmail.com>",
6
6
  "homepage": "https://github.com/pyramation/cosmwasm-typescript-gen/tree/master/packages/wasm-ast-types#readme",
@@ -88,5 +88,5 @@
88
88
  "case": "1.6.3",
89
89
  "deepmerge": "4.2.2"
90
90
  },
91
- "gitHead": "e58a660b6265fc94bdd11f311afe9fac11708c51"
91
+ "gitHead": "ef4b39134cf220c860469ae3cae49aeab91ee80d"
92
92
  }
@@ -414,13 +414,15 @@ export const createExecuteClass = (
414
414
  ...bindings
415
415
  ]);
416
416
 
417
+ const noImplicitOverride = context.options.client.noImplicitOverride && extendsClassName && context.options.client.execExtendsQuery;
418
+
417
419
  return t.exportNamedDeclaration(
418
420
  classDeclaration(className,
419
421
  [
420
422
  // client
421
423
  classProperty('client', t.tsTypeAnnotation(
422
424
  t.tsTypeReference(t.identifier('SigningCosmWasmClient'))
423
- )),
425
+ ), false, false, noImplicitOverride),
424
426
 
425
427
  // sender
426
428
  classProperty('sender', t.tsTypeAnnotation(
@@ -430,7 +432,7 @@ export const createExecuteClass = (
430
432
  // contractAddress
431
433
  classProperty('contractAddress', t.tsTypeAnnotation(
432
434
  t.tsStringKeyword()
433
- )),
435
+ ), false, false, noImplicitOverride),
434
436
 
435
437
  // constructor
436
438
  t.classMethod('constructor',
@@ -0,0 +1,709 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Impl, execExtends, ExtendsClass 1`] = `
4
+ "export class SG721Client extends ExtendsClassName implements SG721Instance {
5
+ client: SigningCosmWasmClient;
6
+ sender: string;
7
+ contractAddress: string;
8
+
9
+ constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
10
+ super(client, contractAddress);
11
+ this.client = client;
12
+ this.sender = sender;
13
+ this.contractAddress = contractAddress;
14
+ this.transferNft = this.transferNft.bind(this);
15
+ this.sendNft = this.sendNft.bind(this);
16
+ this.approve = this.approve.bind(this);
17
+ this.revoke = this.revoke.bind(this);
18
+ this.approveAll = this.approveAll.bind(this);
19
+ this.revokeAll = this.revokeAll.bind(this);
20
+ this.mint = this.mint.bind(this);
21
+ this.burn = this.burn.bind(this);
22
+ }
23
+
24
+ transferNft = async ({
25
+ recipient,
26
+ tokenId
27
+ }: {
28
+ recipient: string;
29
+ tokenId: string;
30
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
31
+ return await this.client.execute(this.sender, this.contractAddress, {
32
+ transfer_nft: {
33
+ recipient,
34
+ token_id: tokenId
35
+ }
36
+ }, fee, memo, funds);
37
+ };
38
+ sendNft = async ({
39
+ contract,
40
+ msg,
41
+ tokenId
42
+ }: {
43
+ contract: string;
44
+ msg: Binary;
45
+ tokenId: string;
46
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
47
+ return await this.client.execute(this.sender, this.contractAddress, {
48
+ send_nft: {
49
+ contract,
50
+ msg,
51
+ token_id: tokenId
52
+ }
53
+ }, fee, memo, funds);
54
+ };
55
+ approve = async ({
56
+ expires,
57
+ spender,
58
+ tokenId
59
+ }: {
60
+ expires?: Expiration;
61
+ spender: string;
62
+ tokenId: string;
63
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
64
+ return await this.client.execute(this.sender, this.contractAddress, {
65
+ approve: {
66
+ expires,
67
+ spender,
68
+ token_id: tokenId
69
+ }
70
+ }, fee, memo, funds);
71
+ };
72
+ revoke = async ({
73
+ spender,
74
+ tokenId
75
+ }: {
76
+ spender: string;
77
+ tokenId: string;
78
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
79
+ return await this.client.execute(this.sender, this.contractAddress, {
80
+ revoke: {
81
+ spender,
82
+ token_id: tokenId
83
+ }
84
+ }, fee, memo, funds);
85
+ };
86
+ approveAll = async ({
87
+ expires,
88
+ operator
89
+ }: {
90
+ expires?: Expiration;
91
+ operator: string;
92
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
93
+ return await this.client.execute(this.sender, this.contractAddress, {
94
+ approve_all: {
95
+ expires,
96
+ operator
97
+ }
98
+ }, fee, memo, funds);
99
+ };
100
+ revokeAll = async ({
101
+ operator
102
+ }: {
103
+ operator: string;
104
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
105
+ return await this.client.execute(this.sender, this.contractAddress, {
106
+ revoke_all: {
107
+ operator
108
+ }
109
+ }, fee, memo, funds);
110
+ };
111
+ mint = async ({
112
+ extension,
113
+ owner,
114
+ tokenId,
115
+ tokenUri
116
+ }: {
117
+ extension: Empty;
118
+ owner: string;
119
+ tokenId: string;
120
+ tokenUri?: string;
121
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
122
+ return await this.client.execute(this.sender, this.contractAddress, {
123
+ mint: {
124
+ extension,
125
+ owner,
126
+ token_id: tokenId,
127
+ token_uri: tokenUri
128
+ }
129
+ }, fee, memo, funds);
130
+ };
131
+ burn = async ({
132
+ tokenId
133
+ }: {
134
+ tokenId: string;
135
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
136
+ return await this.client.execute(this.sender, this.contractAddress, {
137
+ burn: {
138
+ token_id: tokenId
139
+ }
140
+ }, fee, memo, funds);
141
+ };
142
+ }"
143
+ `;
144
+
145
+ exports[`Impl, execExtends, noExtendsClass 1`] = `
146
+ "export class SG721Client implements SG721Instance {
147
+ client: SigningCosmWasmClient;
148
+ sender: string;
149
+ contractAddress: string;
150
+
151
+ constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
152
+ this.client = client;
153
+ this.sender = sender;
154
+ this.contractAddress = contractAddress;
155
+ this.transferNft = this.transferNft.bind(this);
156
+ this.sendNft = this.sendNft.bind(this);
157
+ this.approve = this.approve.bind(this);
158
+ this.revoke = this.revoke.bind(this);
159
+ this.approveAll = this.approveAll.bind(this);
160
+ this.revokeAll = this.revokeAll.bind(this);
161
+ this.mint = this.mint.bind(this);
162
+ this.burn = this.burn.bind(this);
163
+ }
164
+
165
+ transferNft = async ({
166
+ recipient,
167
+ tokenId
168
+ }: {
169
+ recipient: string;
170
+ tokenId: string;
171
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
172
+ return await this.client.execute(this.sender, this.contractAddress, {
173
+ transfer_nft: {
174
+ recipient,
175
+ token_id: tokenId
176
+ }
177
+ }, fee, memo, funds);
178
+ };
179
+ sendNft = async ({
180
+ contract,
181
+ msg,
182
+ tokenId
183
+ }: {
184
+ contract: string;
185
+ msg: Binary;
186
+ tokenId: string;
187
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
188
+ return await this.client.execute(this.sender, this.contractAddress, {
189
+ send_nft: {
190
+ contract,
191
+ msg,
192
+ token_id: tokenId
193
+ }
194
+ }, fee, memo, funds);
195
+ };
196
+ approve = async ({
197
+ expires,
198
+ spender,
199
+ tokenId
200
+ }: {
201
+ expires?: Expiration;
202
+ spender: string;
203
+ tokenId: string;
204
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
205
+ return await this.client.execute(this.sender, this.contractAddress, {
206
+ approve: {
207
+ expires,
208
+ spender,
209
+ token_id: tokenId
210
+ }
211
+ }, fee, memo, funds);
212
+ };
213
+ revoke = async ({
214
+ spender,
215
+ tokenId
216
+ }: {
217
+ spender: string;
218
+ tokenId: string;
219
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
220
+ return await this.client.execute(this.sender, this.contractAddress, {
221
+ revoke: {
222
+ spender,
223
+ token_id: tokenId
224
+ }
225
+ }, fee, memo, funds);
226
+ };
227
+ approveAll = async ({
228
+ expires,
229
+ operator
230
+ }: {
231
+ expires?: Expiration;
232
+ operator: string;
233
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
234
+ return await this.client.execute(this.sender, this.contractAddress, {
235
+ approve_all: {
236
+ expires,
237
+ operator
238
+ }
239
+ }, fee, memo, funds);
240
+ };
241
+ revokeAll = async ({
242
+ operator
243
+ }: {
244
+ operator: string;
245
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
246
+ return await this.client.execute(this.sender, this.contractAddress, {
247
+ revoke_all: {
248
+ operator
249
+ }
250
+ }, fee, memo, funds);
251
+ };
252
+ mint = async ({
253
+ extension,
254
+ owner,
255
+ tokenId,
256
+ tokenUri
257
+ }: {
258
+ extension: Empty;
259
+ owner: string;
260
+ tokenId: string;
261
+ tokenUri?: string;
262
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
263
+ return await this.client.execute(this.sender, this.contractAddress, {
264
+ mint: {
265
+ extension,
266
+ owner,
267
+ token_id: tokenId,
268
+ token_uri: tokenUri
269
+ }
270
+ }, fee, memo, funds);
271
+ };
272
+ burn = async ({
273
+ tokenId
274
+ }: {
275
+ tokenId: string;
276
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
277
+ return await this.client.execute(this.sender, this.contractAddress, {
278
+ burn: {
279
+ token_id: tokenId
280
+ }
281
+ }, fee, memo, funds);
282
+ };
283
+ }"
284
+ `;
285
+
286
+ exports[`noImpl, execExtends, ExtendsClass 1`] = `
287
+ "export class SG721Client extends ExtendsClassName implements SG721Instance {
288
+ override client: SigningCosmWasmClient;
289
+ sender: string;
290
+ override contractAddress: string;
291
+
292
+ constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
293
+ super(client, contractAddress);
294
+ this.client = client;
295
+ this.sender = sender;
296
+ this.contractAddress = contractAddress;
297
+ this.transferNft = this.transferNft.bind(this);
298
+ this.sendNft = this.sendNft.bind(this);
299
+ this.approve = this.approve.bind(this);
300
+ this.revoke = this.revoke.bind(this);
301
+ this.approveAll = this.approveAll.bind(this);
302
+ this.revokeAll = this.revokeAll.bind(this);
303
+ this.mint = this.mint.bind(this);
304
+ this.burn = this.burn.bind(this);
305
+ }
306
+
307
+ transferNft = async ({
308
+ recipient,
309
+ tokenId
310
+ }: {
311
+ recipient: string;
312
+ tokenId: string;
313
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
314
+ return await this.client.execute(this.sender, this.contractAddress, {
315
+ transfer_nft: {
316
+ recipient,
317
+ token_id: tokenId
318
+ }
319
+ }, fee, memo, funds);
320
+ };
321
+ sendNft = async ({
322
+ contract,
323
+ msg,
324
+ tokenId
325
+ }: {
326
+ contract: string;
327
+ msg: Binary;
328
+ tokenId: string;
329
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
330
+ return await this.client.execute(this.sender, this.contractAddress, {
331
+ send_nft: {
332
+ contract,
333
+ msg,
334
+ token_id: tokenId
335
+ }
336
+ }, fee, memo, funds);
337
+ };
338
+ approve = async ({
339
+ expires,
340
+ spender,
341
+ tokenId
342
+ }: {
343
+ expires?: Expiration;
344
+ spender: string;
345
+ tokenId: string;
346
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
347
+ return await this.client.execute(this.sender, this.contractAddress, {
348
+ approve: {
349
+ expires,
350
+ spender,
351
+ token_id: tokenId
352
+ }
353
+ }, fee, memo, funds);
354
+ };
355
+ revoke = async ({
356
+ spender,
357
+ tokenId
358
+ }: {
359
+ spender: string;
360
+ tokenId: string;
361
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
362
+ return await this.client.execute(this.sender, this.contractAddress, {
363
+ revoke: {
364
+ spender,
365
+ token_id: tokenId
366
+ }
367
+ }, fee, memo, funds);
368
+ };
369
+ approveAll = async ({
370
+ expires,
371
+ operator
372
+ }: {
373
+ expires?: Expiration;
374
+ operator: string;
375
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
376
+ return await this.client.execute(this.sender, this.contractAddress, {
377
+ approve_all: {
378
+ expires,
379
+ operator
380
+ }
381
+ }, fee, memo, funds);
382
+ };
383
+ revokeAll = async ({
384
+ operator
385
+ }: {
386
+ operator: string;
387
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
388
+ return await this.client.execute(this.sender, this.contractAddress, {
389
+ revoke_all: {
390
+ operator
391
+ }
392
+ }, fee, memo, funds);
393
+ };
394
+ mint = async ({
395
+ extension,
396
+ owner,
397
+ tokenId,
398
+ tokenUri
399
+ }: {
400
+ extension: Empty;
401
+ owner: string;
402
+ tokenId: string;
403
+ tokenUri?: string;
404
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
405
+ return await this.client.execute(this.sender, this.contractAddress, {
406
+ mint: {
407
+ extension,
408
+ owner,
409
+ token_id: tokenId,
410
+ token_uri: tokenUri
411
+ }
412
+ }, fee, memo, funds);
413
+ };
414
+ burn = async ({
415
+ tokenId
416
+ }: {
417
+ tokenId: string;
418
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
419
+ return await this.client.execute(this.sender, this.contractAddress, {
420
+ burn: {
421
+ token_id: tokenId
422
+ }
423
+ }, fee, memo, funds);
424
+ };
425
+ }"
426
+ `;
427
+
428
+ exports[`noImpl, noExecExtends, ExtendsClass 1`] = `
429
+ "export class SG721Client extends ExtendsClassName implements SG721Instance {
430
+ client: SigningCosmWasmClient;
431
+ sender: string;
432
+ contractAddress: string;
433
+
434
+ constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
435
+ super(client, contractAddress);
436
+ this.client = client;
437
+ this.sender = sender;
438
+ this.contractAddress = contractAddress;
439
+ this.transferNft = this.transferNft.bind(this);
440
+ this.sendNft = this.sendNft.bind(this);
441
+ this.approve = this.approve.bind(this);
442
+ this.revoke = this.revoke.bind(this);
443
+ this.approveAll = this.approveAll.bind(this);
444
+ this.revokeAll = this.revokeAll.bind(this);
445
+ this.mint = this.mint.bind(this);
446
+ this.burn = this.burn.bind(this);
447
+ }
448
+
449
+ transferNft = async ({
450
+ recipient,
451
+ tokenId
452
+ }: {
453
+ recipient: string;
454
+ tokenId: string;
455
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
456
+ return await this.client.execute(this.sender, this.contractAddress, {
457
+ transfer_nft: {
458
+ recipient,
459
+ token_id: tokenId
460
+ }
461
+ }, fee, memo, funds);
462
+ };
463
+ sendNft = async ({
464
+ contract,
465
+ msg,
466
+ tokenId
467
+ }: {
468
+ contract: string;
469
+ msg: Binary;
470
+ tokenId: string;
471
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
472
+ return await this.client.execute(this.sender, this.contractAddress, {
473
+ send_nft: {
474
+ contract,
475
+ msg,
476
+ token_id: tokenId
477
+ }
478
+ }, fee, memo, funds);
479
+ };
480
+ approve = async ({
481
+ expires,
482
+ spender,
483
+ tokenId
484
+ }: {
485
+ expires?: Expiration;
486
+ spender: string;
487
+ tokenId: string;
488
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
489
+ return await this.client.execute(this.sender, this.contractAddress, {
490
+ approve: {
491
+ expires,
492
+ spender,
493
+ token_id: tokenId
494
+ }
495
+ }, fee, memo, funds);
496
+ };
497
+ revoke = async ({
498
+ spender,
499
+ tokenId
500
+ }: {
501
+ spender: string;
502
+ tokenId: string;
503
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
504
+ return await this.client.execute(this.sender, this.contractAddress, {
505
+ revoke: {
506
+ spender,
507
+ token_id: tokenId
508
+ }
509
+ }, fee, memo, funds);
510
+ };
511
+ approveAll = async ({
512
+ expires,
513
+ operator
514
+ }: {
515
+ expires?: Expiration;
516
+ operator: string;
517
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
518
+ return await this.client.execute(this.sender, this.contractAddress, {
519
+ approve_all: {
520
+ expires,
521
+ operator
522
+ }
523
+ }, fee, memo, funds);
524
+ };
525
+ revokeAll = async ({
526
+ operator
527
+ }: {
528
+ operator: string;
529
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
530
+ return await this.client.execute(this.sender, this.contractAddress, {
531
+ revoke_all: {
532
+ operator
533
+ }
534
+ }, fee, memo, funds);
535
+ };
536
+ mint = async ({
537
+ extension,
538
+ owner,
539
+ tokenId,
540
+ tokenUri
541
+ }: {
542
+ extension: Empty;
543
+ owner: string;
544
+ tokenId: string;
545
+ tokenUri?: string;
546
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
547
+ return await this.client.execute(this.sender, this.contractAddress, {
548
+ mint: {
549
+ extension,
550
+ owner,
551
+ token_id: tokenId,
552
+ token_uri: tokenUri
553
+ }
554
+ }, fee, memo, funds);
555
+ };
556
+ burn = async ({
557
+ tokenId
558
+ }: {
559
+ tokenId: string;
560
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
561
+ return await this.client.execute(this.sender, this.contractAddress, {
562
+ burn: {
563
+ token_id: tokenId
564
+ }
565
+ }, fee, memo, funds);
566
+ };
567
+ }"
568
+ `;
569
+
570
+ exports[`noImpl, noExecExtends, noExtendsClass 1`] = `
571
+ "export class SG721Client implements SG721Instance {
572
+ client: SigningCosmWasmClient;
573
+ sender: string;
574
+ contractAddress: string;
575
+
576
+ constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
577
+ this.client = client;
578
+ this.sender = sender;
579
+ this.contractAddress = contractAddress;
580
+ this.transferNft = this.transferNft.bind(this);
581
+ this.sendNft = this.sendNft.bind(this);
582
+ this.approve = this.approve.bind(this);
583
+ this.revoke = this.revoke.bind(this);
584
+ this.approveAll = this.approveAll.bind(this);
585
+ this.revokeAll = this.revokeAll.bind(this);
586
+ this.mint = this.mint.bind(this);
587
+ this.burn = this.burn.bind(this);
588
+ }
589
+
590
+ transferNft = async ({
591
+ recipient,
592
+ tokenId
593
+ }: {
594
+ recipient: string;
595
+ tokenId: string;
596
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
597
+ return await this.client.execute(this.sender, this.contractAddress, {
598
+ transfer_nft: {
599
+ recipient,
600
+ token_id: tokenId
601
+ }
602
+ }, fee, memo, funds);
603
+ };
604
+ sendNft = async ({
605
+ contract,
606
+ msg,
607
+ tokenId
608
+ }: {
609
+ contract: string;
610
+ msg: Binary;
611
+ tokenId: string;
612
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
613
+ return await this.client.execute(this.sender, this.contractAddress, {
614
+ send_nft: {
615
+ contract,
616
+ msg,
617
+ token_id: tokenId
618
+ }
619
+ }, fee, memo, funds);
620
+ };
621
+ approve = async ({
622
+ expires,
623
+ spender,
624
+ tokenId
625
+ }: {
626
+ expires?: Expiration;
627
+ spender: string;
628
+ tokenId: string;
629
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
630
+ return await this.client.execute(this.sender, this.contractAddress, {
631
+ approve: {
632
+ expires,
633
+ spender,
634
+ token_id: tokenId
635
+ }
636
+ }, fee, memo, funds);
637
+ };
638
+ revoke = async ({
639
+ spender,
640
+ tokenId
641
+ }: {
642
+ spender: string;
643
+ tokenId: string;
644
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
645
+ return await this.client.execute(this.sender, this.contractAddress, {
646
+ revoke: {
647
+ spender,
648
+ token_id: tokenId
649
+ }
650
+ }, fee, memo, funds);
651
+ };
652
+ approveAll = async ({
653
+ expires,
654
+ operator
655
+ }: {
656
+ expires?: Expiration;
657
+ operator: string;
658
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
659
+ return await this.client.execute(this.sender, this.contractAddress, {
660
+ approve_all: {
661
+ expires,
662
+ operator
663
+ }
664
+ }, fee, memo, funds);
665
+ };
666
+ revokeAll = async ({
667
+ operator
668
+ }: {
669
+ operator: string;
670
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
671
+ return await this.client.execute(this.sender, this.contractAddress, {
672
+ revoke_all: {
673
+ operator
674
+ }
675
+ }, fee, memo, funds);
676
+ };
677
+ mint = async ({
678
+ extension,
679
+ owner,
680
+ tokenId,
681
+ tokenUri
682
+ }: {
683
+ extension: Empty;
684
+ owner: string;
685
+ tokenId: string;
686
+ tokenUri?: string;
687
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
688
+ return await this.client.execute(this.sender, this.contractAddress, {
689
+ mint: {
690
+ extension,
691
+ owner,
692
+ token_id: tokenId,
693
+ token_uri: tokenUri
694
+ }
695
+ }, fee, memo, funds);
696
+ };
697
+ burn = async ({
698
+ tokenId
699
+ }: {
700
+ tokenId: string;
701
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
702
+ return await this.client.execute(this.sender, this.contractAddress, {
703
+ burn: {
704
+ token_id: tokenId
705
+ }
706
+ }, fee, memo, funds);
707
+ };
708
+ }"
709
+ `;
@@ -0,0 +1,74 @@
1
+ import execute_msg_for__empty from '../../../../../__fixtures__/sg721/execute_msg_for__empty.json';
2
+ import {
3
+ createQueryClass,
4
+ createExecuteClass,
5
+ createExecuteInterface,
6
+ createTypeInterface
7
+ } from '../client'
8
+ import { expectCode, makeContext } from '../../../test-utils';
9
+
10
+ const ctx = makeContext(execute_msg_for__empty);
11
+
12
+ describe('exec', () => {
13
+
14
+ })
15
+
16
+ it('Impl, execExtends, noExtendsClass', () => {
17
+ ctx.options.client.noImplicitOverride = false;
18
+ ctx.options.client.execExtendsQuery = true;
19
+ expectCode(createExecuteClass(
20
+ ctx,
21
+ 'SG721Client',
22
+ 'SG721Instance',
23
+ null,
24
+ execute_msg_for__empty
25
+ ))
26
+ });
27
+
28
+ it('Impl, execExtends, ExtendsClass', () => {
29
+ ctx.options.client.noImplicitOverride = false;
30
+ ctx.options.client.execExtendsQuery = true;
31
+ expectCode(createExecuteClass(
32
+ ctx,
33
+ 'SG721Client',
34
+ 'SG721Instance',
35
+ 'ExtendsClassName',
36
+ execute_msg_for__empty
37
+ ))
38
+ });
39
+
40
+ it('noImpl, execExtends, ExtendsClass', () => {
41
+ ctx.options.client.noImplicitOverride = true;
42
+ ctx.options.client.execExtendsQuery = true;
43
+ expectCode(createExecuteClass(
44
+ ctx,
45
+ 'SG721Client',
46
+ 'SG721Instance',
47
+ 'ExtendsClassName',
48
+ execute_msg_for__empty
49
+ ))
50
+ });
51
+
52
+ it('noImpl, noExecExtends, ExtendsClass', () => {
53
+ ctx.options.client.noImplicitOverride = true;
54
+ ctx.options.client.execExtendsQuery = false;
55
+ expectCode(createExecuteClass(
56
+ ctx,
57
+ 'SG721Client',
58
+ 'SG721Instance',
59
+ 'ExtendsClassName',
60
+ execute_msg_for__empty
61
+ ))
62
+ });
63
+
64
+ it('noImpl, noExecExtends, noExtendsClass', () => {
65
+ ctx.options.client.noImplicitOverride = true;
66
+ ctx.options.client.execExtendsQuery = false;
67
+ expectCode(createExecuteClass(
68
+ ctx,
69
+ 'SG721Client',
70
+ 'SG721Instance',
71
+ null,
72
+ execute_msg_for__empty
73
+ ))
74
+ });
@@ -16,6 +16,7 @@ export interface ReactQueryOptions {
16
16
  export interface TSClientOptions {
17
17
  enabled?: boolean;
18
18
  execExtendsQuery?: boolean;
19
+ noImplicitOverride?: boolean;
19
20
  }
20
21
  export interface MessageComposerOptions {
21
22
  enabled?: boolean;
@@ -70,7 +71,8 @@ export const defaultOptions: RenderOptions = {
70
71
  },
71
72
  client: {
72
73
  enabled: true,
73
- execExtendsQuery: true
74
+ execExtendsQuery: true,
75
+ noImplicitOverride: false,
74
76
  },
75
77
  recoil: {
76
78
  enabled: false
@@ -125,11 +125,18 @@ export const classDeclaration = (name: string, body: any[], implementsExressions
125
125
  };
126
126
 
127
127
 
128
- export const classProperty = (name: string, typeAnnotation: TSTypeAnnotation = null, isReadonly: boolean = false, isStatic: boolean = false) => {
128
+ export const classProperty = (
129
+ name: string,
130
+ typeAnnotation: TSTypeAnnotation = null,
131
+ isReadonly: boolean = false,
132
+ isStatic: boolean = false,
133
+ noImplicitOverride: boolean = false
134
+ ) => {
129
135
  const prop = t.classProperty(t.identifier(name));
130
136
  if (isReadonly) prop.readonly = true;
131
137
  if (isStatic) prop.static = true;
132
138
  if (typeAnnotation) prop.typeAnnotation = typeAnnotation;
139
+ if (noImplicitOverride) prop.override = true;
133
140
  return prop;
134
141
  };
135
142
 
@@ -11,6 +11,7 @@ export interface ReactQueryOptions {
11
11
  export interface TSClientOptions {
12
12
  enabled?: boolean;
13
13
  execExtendsQuery?: boolean;
14
+ noImplicitOverride?: boolean;
14
15
  }
15
16
  export interface MessageComposerOptions {
16
17
  enabled?: boolean;
@@ -43,7 +43,7 @@ export interface Cw4UpdateMembersMutation {
43
43
  }
44
44
  ```
45
45
  */
46
- export declare const createReactQueryMutationArgsInterface: ({ context, ExecuteClient, mutationHookParamsTypeName, useMutationTypeParameter, jsonschema, }: ReactQueryMutationHookInterface) => t.ExportNamedDeclaration;
46
+ export declare const createReactQueryMutationArgsInterface: ({ context, ExecuteClient, mutationHookParamsTypeName, useMutationTypeParameter, jsonschema }: ReactQueryMutationHookInterface) => t.ExportNamedDeclaration;
47
47
  interface ReactQueryMutationHooks {
48
48
  context: RenderContext;
49
49
  execMsg: ExecuteMsg;
@@ -70,7 +70,7 @@ export const useCw4UpdateMembersMutation = ({ client, options }: Omit<Cw4UpdateM
70
70
  )
71
71
  ```
72
72
  */
73
- export declare const createReactQueryMutationHook: ({ context, mutationHookName, mutationHookParamsTypeName, execMethodName, useMutationTypeParameter, hasMsg, }: ReactQueryMutationHook) => t.ExportNamedDeclaration;
73
+ export declare const createReactQueryMutationHook: ({ context, mutationHookName, mutationHookParamsTypeName, execMethodName, useMutationTypeParameter, hasMsg }: ReactQueryMutationHook) => t.ExportNamedDeclaration;
74
74
  interface ReactQueryHookQueryInterface {
75
75
  context: RenderContext;
76
76
  QueryClient: string;
@@ -17,7 +17,7 @@ export declare const bindMethod: (name: string) => t.ExpressionStatement;
17
17
  export declare const typedIdentifier: (name: string, typeAnnotation: TSTypeAnnotation, optional?: boolean) => t.Identifier;
18
18
  export declare const promiseTypeAnnotation: (name: any) => t.TSTypeAnnotation;
19
19
  export declare const classDeclaration: (name: string, body: any[], implementsExressions?: TSExpressionWithTypeArguments[], superClass?: t.Identifier) => t.ClassDeclaration;
20
- export declare const classProperty: (name: string, typeAnnotation?: TSTypeAnnotation, isReadonly?: boolean, isStatic?: boolean) => t.ClassProperty;
20
+ export declare const classProperty: (name: string, typeAnnotation?: TSTypeAnnotation, isReadonly?: boolean, isStatic?: boolean, noImplicitOverride?: boolean) => t.ClassProperty;
21
21
  export declare const arrowFunctionExpression: (params: (t.Identifier | t.Pattern | t.RestElement)[], body: t.BlockStatement, returnType: t.TSTypeAnnotation, isAsync?: boolean) => t.ArrowFunctionExpression;
22
22
  export declare const recursiveNamespace: (names: any, moduleBlockBody: any) => any;
23
23
  export declare const arrayTypeNDimensions: (body: any, n: any) => any;