@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "redstone-smartweave",
|
||||
"version": "0.4.83",
|
||||
"version": "0.4.84",
|
||||
"description": "An implementation of the SmartWeave smart contract protocol.",
|
||||
"main": "./lib/cjs/index.js",
|
||||
"module": "./lib/esm/index.js",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable */
|
||||
import Arweave from 'arweave';
|
||||
import { GQLNodeInterface, GQLTagInterface } from './gqlResult';
|
||||
import {EvaluationOptions} from "@smartweave/core";
|
||||
import { EvaluationOptions } from '@smartweave/core';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -64,22 +64,24 @@ export class SmartWeaveGlobal {
|
||||
};
|
||||
this.arweave.wallets.getBalance = async (address: string): Promise<string> => {
|
||||
if (!this._activeTx) {
|
||||
throw new Error("Cannot read balance - active tx is not set.");
|
||||
throw new Error('Cannot read balance - active tx is not set.');
|
||||
}
|
||||
if (!this.block.height) {
|
||||
throw new Error("Cannot read balance - block height not set.")
|
||||
throw new Error('Cannot read balance - block height not set.');
|
||||
}
|
||||
console.log(`${evaluationOptions.walletBalanceUrl}block/height/${this.block.height}/wallet/${address}/balance`);
|
||||
|
||||
// http://nyc-1.dev.arweave.net:1984/block/height/914387/wallet/M-mpNeJbg9h7mZ-uHaNsa5jwFFRAq0PsTkNWXJ-ojwI/balance
|
||||
return await fetch(`${evaluationOptions.walletBalanceUrl}block/height/${this.block.height}/wallet/${address}/balance`)
|
||||
return await fetch(
|
||||
`${evaluationOptions.walletBalanceUrl}block/height/${this.block.height}/wallet/${address}/balance`
|
||||
)
|
||||
.then((res) => {
|
||||
return res.ok ? res.text() : Promise.reject(res);
|
||||
})
|
||||
.catch((error) => {
|
||||
throw new Error(`Unable to read wallet balance. ${error.status}. ${error.body?.message}`);
|
||||
});
|
||||
}
|
||||
};
|
||||
this.contract = contract;
|
||||
this.transaction = new Transaction(this);
|
||||
this.block = new Block(this);
|
||||
|
||||
Reference in New Issue
Block a user