New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dappql

Package Overview
Dependencies
Maintainers
0
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dappql - npm Package Compare versions

Comparing version 2.0.16 to 2.0.17

24

lib/templates/createContractsCollection.js

@@ -116,10 +116,22 @@ import { writeFileSync } from 'fs';

export type Mutations = keyof Contract['mutations']
const BaseMutation = {
contractName: '{{CONTRACT_NAME}}' as const,
deployAddress,
getAbi: () => abi,
function getMutation<M extends Mutations>(functionName: M) {
return {
contractName: '{{CONTRACT_NAME}}' as const,
functionName,
deployAddress,
argsType: undefined as ExtractArgs<Contract['mutations'][M]> | undefined,
getAbi: () => abi,
}
}
export const mutation = {
${writeMethods.map((m) => `\t\t${m}: {...BaseMutation, functionName: '${m}', argsType: undefined as ExtractArgs<Contract['mutations']['${m}']> | undefined},`).join('\n')}
export const mutation: {
[K in Mutations]: {
contractName: '{{CONTRACT_NAME}}'
deployAddress: Address | undefined
getAbi: () => typeof abi
functionName: K
argsType: ExtractArgs<Contract['mutations'][K]> | undefined
}
} = {
${writeMethods.map((m) => `\t\t${m}: getMutation('${m}'),`).join('\n')}
}

@@ -126,0 +138,0 @@ `

@@ -19,2 +19,11 @@ const typeMap = {

};
export function extractParamsList(funcs) {
const sortedFuncs = funcs.sort((a, b) => (b.inputs?.length || 0) - (a.inputs?.length || 0));
const baseFunc = sortedFuncs[0];
return (baseFunc.inputs?.map((input, i) => ({
name: input.name.replace('_', ''),
type: getSolidityToTsType(input),
isOptional: sortedFuncs.some((f) => (f.inputs?.length || 0) < i + 1),
})) || []);
}
function generateContractTypes(abi) {

@@ -51,10 +60,6 @@ const functions = abi.filter((item) => item.type === 'function');

function generateOverloadedType(name, funcs) {
const sortedFuncs = funcs.sort((a, b) => (b.inputs?.length || 0) - (a.inputs?.length || 0));
const baseFunc = sortedFuncs[0];
const params = baseFunc.inputs
?.map((input, i) => {
const isOptional = sortedFuncs.some((f) => (f.inputs?.length || 0) < i + 1);
return `${input.name.replace('_', '')}${isOptional ? '?' : ''}: ${getSolidityToTsType(input)}`;
})
.join(', ') || '';
const params = extractParamsList(funcs)
.map(({ name, type, isOptional }) => `${name}${isOptional ? '?' : ''}: ${type}`)
.join(', ');
const baseFunc = funcs[0];
const output = baseFunc.outputs && baseFunc.outputs.length === 1

@@ -61,0 +66,0 @@ ? getSolidityToTsType(baseFunc.outputs[0])

{
"name": "dappql",
"version": "2.0.16",
"version": "2.0.17",
"description": "wagmi extension to easily query smart-contracts",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc