Comparing version 2.0.13 to 2.0.14
@@ -18,3 +18,10 @@ import { writeFileSync } from 'fs'; | ||
const hasRead = !!readMethods.length; | ||
const hasWrite = !!contract.abi.find((a) => a.type === 'function' && (a.stateMutability === 'nonpayable' || a.stateMutability === 'payable')); | ||
const writeMethods = contract.abi | ||
.filter((a) => a.type === 'function' && (a.stateMutability === 'nonpayable' || a.stateMutability === 'payable')) | ||
.reduce((acc, a) => { | ||
if (acc.includes(a.name)) | ||
return acc; | ||
return [...acc, a.name]; | ||
}, []); | ||
const hasWrite = !!writeMethods.length; | ||
const content = `/* Autogenerated file. Do not edit manually. */ | ||
@@ -110,3 +117,3 @@ /* tslint:disable */ | ||
export type Mutations = keyof Contract['mutations'] | ||
export function mutation<M extends Mutations>(functionName: M) { | ||
function getMutation<M extends Mutations>(functionName: M) { | ||
return { | ||
@@ -119,3 +126,8 @@ contractName: '{{CONTRACT_NAME}}' as const, | ||
} | ||
}` | ||
} | ||
export const mutation = { | ||
${writeMethods.map((m) => `\t\t${m}: getMutation('${m}'),`).join('\n')} | ||
} | ||
` | ||
: ''} | ||
@@ -122,0 +134,0 @@ `.replaceAll('{{CONTRACT_NAME}}', contract.contractName); |
{ | ||
"name": "dappql", | ||
"version": "2.0.13", | ||
"version": "2.0.14", | ||
"description": "wagmi extension to easily query smart-contracts", | ||
@@ -48,3 +48,2 @@ "main": "./lib/index.js", | ||
"clean": "rm -rf ./node_modules && rm -rf ./lib && rm -rf ./.turbo", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"dev": "pnpm exec tsc -b -w", | ||
@@ -51,0 +50,0 @@ "build": "pnpm exec tsc -b", |
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
14087
341
0