Skip to content

Instantly share code, notes, and snippets.

@xiaojay
Created May 23, 2023 03:03
Show Gist options
  • Save xiaojay/12659c6b91f306e8c76dc543e95b2d6d to your computer and use it in GitHub Desktop.
Save xiaojay/12659c6b91f306e8c76dc543e95b2d6d to your computer and use it in GitHub Desktop.
gist used to get stamp contract from arweave gateway
import {WarpFactory, defaultCacheOptions,} from 'warp-contracts';
const contractId = 'TlqASNDLA1Uh8yFiH-BzR_1FDag4s735F3PoUFEv2Mo';
const warp = WarpFactory.forMainnet(defaultCacheOptions, true)
const stamp = warp.contract(contractId).setEvaluationOptions({
allowBigInt: true,
unsafeClient: "skip"
});
async function getState() {
try {
const { sortKey, cachedValue } = await stamp.readState();
console.log(sortKey, cachedValue.errorMessages, cachedValue.state, cachedValue.validity)
} catch (error) {
console.log('readState error:', error, 'contractId:', contractId);
}
}
getState()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment