wasm-ast-types
Advanced tools
Comparing version 0.15.0 to 0.16.0
@@ -187,12 +187,13 @@ "use strict"; | ||
``` | ||
export interface Cw4UpdateMembersMutation { | ||
client: Cw4GroupClient | ||
args: { | ||
tokenId: string | ||
remove: string[] | ||
} | ||
options?: Omit< | ||
UseMutationOptions<ExecuteResult, Error, Pick<Cw4UpdateMembersMutation, 'args'>>, | ||
'mutationFn' | ||
> | ||
export interface Cw721RevokeMutation { | ||
client: Cw721Client; | ||
msg: { | ||
spender: string; | ||
tokenId: string; | ||
}; | ||
args?: { | ||
fee?: number | StdFee | "auto"; | ||
memo?: string; | ||
funds?: Coin[]; | ||
}; | ||
} | ||
@@ -209,3 +210,3 @@ ``` | ||
var body = [(0, _utils.tsPropertySignature)(t.identifier('client'), t.tsTypeAnnotation(t.tsTypeReference(t.identifier(ExecuteClient))), false)]; | ||
var msgType = (0, _types2.getParamsTypeAnnotation)(context, jsonschema); | ||
var msgType = (0, _utils.createTypedObjectParams)(context, jsonschema).typeAnnotation; | ||
@@ -216,5 +217,2 @@ if (msgType) { | ||
context.addUtil('StdFee'); | ||
context.addUtil('Coin'); // fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[] | ||
var optionalArgs = t.tsPropertySignature(t.identifier('args'), t.tsTypeAnnotation( // @ts-ignore:next-line | ||
@@ -221,0 +219,0 @@ t.tsTypeLiteral(_client.FIXED_EXECUTE_PARAMS.map(function (param) { |
import * as t from '@babel/types'; | ||
import { camel, pascal } from 'case'; | ||
import { callExpression, getMessageProperties, identifier, tsObjectPattern, tsPropertySignature } from '../utils'; | ||
import { callExpression, createTypedObjectParams, getMessageProperties, identifier, tsObjectPattern, tsPropertySignature } from '../utils'; | ||
import { omitTypeReference, optionalConditionalExpression, propertySignature, shorthandProperty } from '../utils/babel'; | ||
import { getParamsTypeAnnotation, getPropertyType, getResponseType } from '../utils/types'; | ||
import { getPropertyType, getResponseType } from '../utils/types'; | ||
import { FIXED_EXECUTE_PARAMS } from '../client'; | ||
@@ -157,12 +157,13 @@ export const createReactQueryHooks = ({ | ||
``` | ||
export interface Cw4UpdateMembersMutation { | ||
client: Cw4GroupClient | ||
args: { | ||
tokenId: string | ||
remove: string[] | ||
} | ||
options?: Omit< | ||
UseMutationOptions<ExecuteResult, Error, Pick<Cw4UpdateMembersMutation, 'args'>>, | ||
'mutationFn' | ||
> | ||
export interface Cw721RevokeMutation { | ||
client: Cw721Client; | ||
msg: { | ||
spender: string; | ||
tokenId: string; | ||
}; | ||
args?: { | ||
fee?: number | StdFee | "auto"; | ||
memo?: string; | ||
funds?: Coin[]; | ||
}; | ||
} | ||
@@ -180,3 +181,3 @@ ``` | ||
const body = [tsPropertySignature(t.identifier('client'), t.tsTypeAnnotation(t.tsTypeReference(t.identifier(ExecuteClient))), false)]; | ||
const msgType = getParamsTypeAnnotation(context, jsonschema); | ||
const msgType = createTypedObjectParams(context, jsonschema).typeAnnotation; | ||
@@ -187,5 +188,2 @@ if (msgType) { | ||
context.addUtil('StdFee'); | ||
context.addUtil('Coin'); // fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[] | ||
const optionalArgs = t.tsPropertySignature(t.identifier('args'), t.tsTypeAnnotation( // @ts-ignore:next-line | ||
@@ -192,0 +190,0 @@ t.tsTypeLiteral(FIXED_EXECUTE_PARAMS.map(param => propertySignature(param.name, // @ts-ignore:next-line |
{ | ||
"name": "wasm-ast-types", | ||
"version": "0.15.0", | ||
"version": "0.16.0", | ||
"description": "CosmWasm TypeScript AST generation", | ||
@@ -91,3 +91,3 @@ "author": "Dan Lynch <pyramation@gmail.com>", | ||
}, | ||
"gitHead": "ef4b39134cf220c860469ae3cae49aeab91ee80d" | ||
"gitHead": "9724a2787e6427b62e874ece3b733b5bfa5be2af" | ||
} |
@@ -7,2 +7,3 @@ import type { Expression } from '@babel/types'; | ||
callExpression, | ||
createTypedObjectParams, | ||
getMessageProperties, | ||
@@ -13,2 +14,3 @@ identifier, | ||
} from '../utils'; | ||
import { | ||
@@ -376,12 +378,13 @@ omitTypeReference, | ||
``` | ||
export interface Cw4UpdateMembersMutation { | ||
client: Cw4GroupClient | ||
args: { | ||
tokenId: string | ||
remove: string[] | ||
} | ||
options?: Omit< | ||
UseMutationOptions<ExecuteResult, Error, Pick<Cw4UpdateMembersMutation, 'args'>>, | ||
'mutationFn' | ||
> | ||
export interface Cw721RevokeMutation { | ||
client: Cw721Client; | ||
msg: { | ||
spender: string; | ||
tokenId: string; | ||
}; | ||
args?: { | ||
fee?: number | StdFee | "auto"; | ||
memo?: string; | ||
funds?: Coin[]; | ||
}; | ||
} | ||
@@ -410,15 +413,12 @@ ``` | ||
const msgType: t.TSTypeAnnotation = getParamsTypeAnnotation( | ||
context, | ||
jsonschema | ||
); | ||
const msgType = createTypedObjectParams(context, jsonschema).typeAnnotation as unknown as t.TSTypeAnnotation | ||
if (msgType) { | ||
body.push(t.tsPropertySignature(t.identifier('msg'), msgType)); | ||
body.push( | ||
t.tsPropertySignature( | ||
t.identifier('msg'), | ||
msgType | ||
)); | ||
} | ||
context.addUtil('StdFee'); | ||
context.addUtil('Coin'); | ||
// fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[] | ||
const optionalArgs = t.tsPropertySignature( | ||
@@ -425,0 +425,0 @@ t.identifier('args'), |
Sorry, the diff of this file is not supported yet
590942
8819