Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const verifyStorage = async (hash: string): Promise => {
const storageItems = await toArray(AsyncIterableX.from(oneProvider.iterStorage(scriptHashToAddress(hash))));
const storageItemChunks = _.chunk(storageItems, BATCH_SIZE);
const storageItemCount = storageItems.length;
let totalEqual = 0;
let count = 0;
for (const chunk of storageItemChunks) {
await Promise.all(
chunk.map(async (itemIn) => {
count += 1;
let [currentItem, testItem] = await Promise.all([
getStorage(oneRPCURL, itemIn),
getStorage(testRPCURL, itemIn),
]);
if (!isEqual(currentItem, testItem)) {
await new Promise((resolve) => setTimeout(resolve, 5000));