Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
signerPubKey.map(
async (
signerPubKey: string
): Promise<[string | null, string]> => {
const regularKeyOwner = await getRegularKeyOwnerByPublicKey(
signerPubKey,
options
);
return [regularKeyOwner, signerPubKey];
}
)
);
})
);
const chunks: string[][] = (await workerpool.Promise.all(
regularKeyOwnerAndPubKeys.map(
(
chunk: [string | null, string][]
): workerpool.Promise => {
return pool.exec(getSignersFromPubKeyAndRegularKeyOwner, [
chunk.map(([regularKeyOwner, signerPubKey]) => {
return {
regularKeyOwner,
signerPubKey
};
}),
networkId
]);
}
)
)) as any; // The bug of workerpool type definition
const workers = {add, hello};
type IWorkers = typeof workers;
pool.proxy().then((proxy) => {
proxy.add(1, 2);
proxy.hello();
});
pool.proxy().then((proxy) => {
proxy.add(1, 2);
proxy.hello();
});
new wp.Promise.CancellationError();
new wp.Promise.TimeoutError();
let promises: wp.Promise = wp.Promise.all([
pool.exec('foo', null),
pool.exec('foo', null),
pool.exec('foo', null)
]);
promises = wp.Promise.all([]);
pool.exec(hello, [])
.then((s: string) => s);
const workers = {add, hello};
type IWorkers = typeof workers;
pool.proxy().then((proxy) => {
proxy.add(1, 2);
proxy.hello();
});
pool.proxy().then((proxy) => {
proxy.add(1, 2);
proxy.hello();
});
new wp.Promise.CancellationError();
new wp.Promise.TimeoutError();
let promises: wp.Promise = wp.Promise.all([
pool.exec('foo', null),
pool.exec('foo', null),
pool.exec('foo', null)
]);
promises = wp.Promise.all([]);
function formatError (err) {
if (err instanceof workerpool.Promise.TimeoutError) {
return 'TimeoutError: Evaluation exceeded maximum duration of ' + TIMEOUT / 1000 + ' seconds';
}
else {
return err.toString();
}
}
function formatError(err) {
if (err instanceof workerpool.Promise.TimeoutError) {
return 'TimeoutError: Evaluation exceeded maximum duration of ' + TIMEOUT / 1000 + ' seconds';
} else {
return err.toString();
}
}
return PlatformAddress.fromPublic(pubKey, {
networkId: tx.unsigned.networkId()
}).toString();
})
);
}
const pool = workerpool.pool({
nodeWorker: "auto"
} as any);
const networkId = txs[0].unsigned.networkId();
const signatureAndMessages = txs.map(tx => ({
signature: tx.signature(),
message: tx.unsigned.unsignedHash().toString()
}));
const signerPubKeys: string[][] = (await workerpool.Promise.all(
_.chunk(signatureAndMessages, 100).map(chunk => {
return pool.exec(getSignerPublicsFromSignatures, [chunk]);
})
)) as any;
const regularKeyOwnerAndPubKeys: [
string | null,
string
][][] = await Promise.all(
signerPubKeys.map(async (signerPubKey: string[]) => {
return Promise.all(
signerPubKey.map(
async (
signerPubKey: string
): Promise<[string | null, string]> => {
const regularKeyOwner = await getRegularKeyOwnerByPublicKey(
signerPubKey,