Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public static getKey(options: GetCallableHelperOptions = { bindThis: false }): string {
const bindThis = options.bindThis || false;
const overwriteThis = options.overwriteThis || false;
return stringify({ bindThis, overwriteThis });
}
export async function resolveDependencies(dependencies: Dependencies): Promise {
const key = stringify(dependencies);
const resolved = resolutionCache.get(key);
if (resolved !== undefined) {
return resolved;
}
const result = new Resolver().resolve(dependencies);
result.catch((err) => {
editorLogger.error({ name: 'resolve_dependencies_final_error', err });
cache.del(key);
});
resolutionCache.set(key, result);
return result;
}
cacheKeyFn: (value) => stringify(value.request),
},
public static getKey(options: InvokeCallHelperOptions = { bindThis: false, noArgs: false }): string {
const bindThis = options.bindThis || false;
const overwriteThis = options.overwriteThis || false;
const noArgs = options.noArgs || false;
return stringify({ bindThis, overwriteThis, noArgs });
}
readonly abiPath: string;
readonly sourceMapsPath: string;
readonly networksDefinition: SmartContractNetworksDefinition;
}) => {
const relativeTypes = getRelativeImport(createContractPath, typesPath);
const smartContract = getSmartContractName(name);
const relativeABI = getRelativeImport(createContractPath, abiPath);
const relativeSourceMaps = getRelativeImport(createContractPath, sourceMapsPath);
const abiName = getABIName(name);
return {
js: `import { ${abiName} } from '${relativeABI}';
import { sourceMaps } from '${relativeSourceMaps}';
const definition = {
networks: ${stringify(networksDefinition, undefined, 2)},
abi: ${abiName},
sourceMaps,
};
export const ${getCreateSmartContractName(name)} = (
client,
) => client.smartContract(definition);
`,
ts: `
import { Client } from '@neo-one/client';
import { ${smartContract} } from '${relativeTypes}';
import { ${abiName} } from '${relativeABI}';
import { sourceMaps } from '${relativeSourceMaps}';
const definition = {
networks: ${stringify(networksDefinition, undefined, 2)},
export const genABI = (name: string, abi: ABI) => ({
js: `export const ${getABIName(name)} = ${stringify(abi, undefined, 2)};`,
ts: `import { ABI } from '@neo-one/client';
export const ${getABIName(name)}: ABI;
`,
});
const liveChanges = (args: RequestArgs, messageID: string) => {
const options = args[0];
const key = stringify(options);
let changesIn = allChanges.get(key);
if (changesIn === undefined) {
changesIn = db.changes(options);
allChanges.set(key, changesIn);
}
const changes = changesIn;
allChangesUsers.set(key, getChangesUserCount(key) + 1);
const onChange = (change: any) => {
postMessage('update', messageID, change);
};
const onComplete = (change: any) => {
sendSuccess(messageID, change);
removeChanges(messageID);