From 07bf8657e3bf260bcd360dd9fa716032246e1ab5 Mon Sep 17 00:00:00 2001 From: ppedziwiatr Date: Thu, 7 Apr 2022 16:02:44 +0200 Subject: [PATCH] feat: to make arconnect happy.. --- src/contract/HandlerBasedContract.ts | 4 ++-- tools/bundle.ts | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/contract/HandlerBasedContract.ts b/src/contract/HandlerBasedContract.ts index 8bbbf2b..4621016 100644 --- a/src/contract/HandlerBasedContract.ts +++ b/src/contract/HandlerBasedContract.ts @@ -33,7 +33,7 @@ import { import { TransactionStatusResponse } from 'arweave/node/transactions'; import { NetworkInfoInterface } from 'arweave/node/network'; import stringify from 'safe-stable-stringify'; -import { createHash } from 'crypto'; +import * as crypto from 'crypto'; /** * An implementation of {@link Contract} that is backwards compatible with current style @@ -677,7 +677,7 @@ export class HandlerBasedContract implements Contract { // note: cannot reuse: // "The Hash object can not be used again after hash.digest() method has been called. // Multiple calls will cause an error to be thrown." - const hash = createHash('sha256'); + const hash = crypto.createHash('sha256'); hash.update(jsonState); return hash.digest('hex'); diff --git a/tools/bundle.ts b/tools/bundle.ts index 4af71f5..0ccf4c6 100644 --- a/tools/bundle.ts +++ b/tools/bundle.ts @@ -28,10 +28,10 @@ async function main() { logging: false // Enable network request logging }); + const redstoneLoader = new RedstoneGatewayInteractionsLoader('http://localhost:5666', {notCorrupted: true}); + const smartweave = SmartWeaveNodeFactory.memCachedBased(arweave) - .setInteractionsLoader( - new RedstoneGatewayInteractionsLoader('http://localhost:5666', { notCorrupted: true }) - ) + .setInteractionsLoader(redstoneLoader) .setDefinitionLoader( new RedstoneGatewayContractDefinitionLoader('http://localhost:5666', arweave, new MemCache()) ) @@ -63,6 +63,8 @@ async function main() { console.log(result); + //console.log(await redstoneLoader.load("33F0QHcb22W7LwWR1iRC8Az1ntZG09XQ03YWuw2ABqA", 0, 1_000_000)); + // UjZsNC0t5Ex7TjU8FIGLZcn_b3Af9OoNBuVmTAgp2_U /*const result1 = await token.readState();