feat: add an option to read wallet balance at a given height

This commit is contained in:
ppe
2022-05-09 22:48:43 +02:00
committed by just_ppe
parent 53d644ba09
commit ecf780de25
7 changed files with 65 additions and 17 deletions

View File

@@ -28,11 +28,11 @@ async function main() {
const initialState = fs.readFileSync(path.join(__dirname, 'data/js/token-pst.json'), 'utf8');
// case 1 - full deploy, js contract
const contractTxId = await smartweave.createContract.deploy({
/* const contractTxId = await smartweave.createContract.deploy({
wallet,
initState: initialState,
src: jsContractSrc,
}, true);
}, true);*/
// case 2 - deploy from source, js contract
/*const contractTxId = await smartweave.createContract.deployFromSourceTx({
@@ -57,7 +57,14 @@ async function main() {
srcTxId: "5wXT-A0iugP9pWEyw-iTbB0plZ_AbmvlNKyBfGS3AUY",
}, true);*/
const {state, validity} = await smartweave.contract(contractTxId).readState();
const contract = smartweave.contract("CRMRwP-poSTYI7f9fI-vF0CKaTTJTIl74KQYbnJ4hnE").connect(wallet);
const result = await contract.writeInteraction<any>({
function: "storeBalance",
target: "M-mpNeJbg9h7mZ-uHaNsa5jwFFRAq0PsTkNWXJ-ojwI",
});
//const {state, validity} = await contract.readState();
//logger.info("Result", state);