in src/debugAdapter/configurationReader.ts [332:396]
function astToNetworkOptions(node: ESTree.ObjectExpression): INetworkOption {
const options: INetworkOption = {
network_id: '*',
};
const id = findProperty(node, 'network_id');
if (id && id.value.type === 'Literal' &&
(typeof id.value.value === 'string' || typeof id.value.value === 'number')) {
options.network_id = id.value.value;
}
const port = findProperty(node, 'port');
if (port && port.value.type === 'Literal' && typeof port.value.value === 'number') {
options.port = port.value.value;
}
const host = findProperty(node, 'host');
if (host && host.value.type === 'Literal' && typeof host.value.value === 'string') {
options.host = host.value.value;
}
const websockets = findProperty(node, 'websockets');
if (websockets && websockets.value.type === 'Literal' && typeof websockets.value.value === 'boolean') {
options.websockets = websockets.value.value;
}
const gas = findProperty(node, 'gas');
if (gas && gas.value.type === 'Literal' && typeof gas.value.value === 'number') {
options.gas = gas.value.value;
}
const gasPrice = findProperty(node, 'gasPrice');
if (gasPrice && gasPrice.value.type === 'Literal' && typeof gasPrice.value.value === 'number') {
options.gasPrice = gasPrice.value.value;
}
const from = findProperty(node, 'from');
if (from && from.value.type === 'Literal' && typeof from.value.value === 'string') {
options.from = from.value.value;
}
const skipDryRun = findProperty(node, 'skipDryRun');
if (skipDryRun && skipDryRun.value.type === 'Literal' && typeof skipDryRun.value.value === 'boolean') {
options.skipDryRun = skipDryRun.value.value;
}
const timeoutBlocks = findProperty(node, 'timeoutBlocks');
if (timeoutBlocks && timeoutBlocks.value.type === 'Literal' && typeof timeoutBlocks.value.value === 'number') {
options.timeoutBlocks = timeoutBlocks.value.value;
}
const provider = findProperty(node, 'provider');
if (provider && provider.value.type === 'FunctionExpression') {
const hdWalletProvider: IFound = walk.findNodeAt(provider, null, null, isHDWalletProvider);
if (hdWalletProvider && hdWalletProvider.node.type === 'NewExpression') {
options.provider = astToHDWalletProvider(hdWalletProvider.node);
}
}
if (provider && provider.value.type === 'NewExpression') {
options.provider = astToHDWalletProvider(provider.value);
}
return options;
}