feat: to make arconnect happy..

This commit is contained in:
ppedziwiatr
2022-04-07 16:02:44 +02:00
parent d845598b0b
commit 07bf8657e3
2 changed files with 7 additions and 5 deletions

View File

@@ -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<State> implements Contract<State> {
// 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');

View File

@@ -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();