Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testcase for issues with YLVpmhSq5JmLltfg6R-5fL04rIRPrlSU22f6RQ6VyYE … #92

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions _scripts/test-case.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Arweave from 'arweave';
import { readContract } from '../src';

async function main() {
const arweave = Arweave.init({
host: 'arweave.net', // Hostname or IP address for a Arweave host
port: 443, // Port
protocol: 'https', // Network protocol http or https
timeout: 60000, // Network request timeouts in milliseconds
logging: false // Enable network request logging
});
const contractTxId = 'YLVpmhSq5JmLltfg6R-5fL04rIRPrlSU22f6RQ6VyYE';

const { state, validity } = await readContract(arweave, contractTxId);
}

main().catch((e) => {
console.error(e);
});
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"ts-node": "^10.2.1",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"typescript": "^4.3.4"
"typescript": "^4.3.4",
"ts-node": "^10.2.1"
}
}
13 changes: 13 additions & 0 deletions src/contract-read.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,19 @@ export async function readContract(

state = result.state;

// console.log('State before await', state);
console.log('Regulator account before await:', {
balance: state.accounts.regulator.balance,
vaults: state.accounts.regulator.vaults,
});
await (async () => Promise.resolve());
console.log('\nRegulator account after await:', {
balance: state.accounts.regulator.balance,
vaults: state.accounts.regulator.vaults,
});
// console.log('\n\nState after await', state);
process.exit(0);

const settings = state.settings ? new Map(state.settings) : new Map();

const evolve: string = state.evolve || settings.get('evolve');
Expand Down