feat: subscription plugin poc
feat: subscription plugin
This commit is contained in:
@@ -32,8 +32,7 @@ async function main() {
|
||||
|
||||
try {
|
||||
const warp = WarpFactory
|
||||
.forMainnet({...defaultCacheOptions, inMemory: true})
|
||||
.use(new NlpExtension());
|
||||
.forMainnet({...defaultCacheOptions, inMemory: true});
|
||||
/*const warp = WarpFactory
|
||||
.custom(arweave, {
|
||||
...defaultCacheOptions,
|
||||
@@ -52,12 +51,13 @@ 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 warp.createContract.deploy({
|
||||
const {contractTxId} = await warp.createContract.deploy({
|
||||
wallet,
|
||||
initState: initialState,
|
||||
src: jsContractSrc,
|
||||
});*/
|
||||
});
|
||||
|
||||
console.log(contractTxId);
|
||||
// case 2 - deploy from source, js contract
|
||||
/*const {contractTxId} = await warp.createContract.deployFromSourceTx({
|
||||
wallet,
|
||||
@@ -81,30 +81,33 @@ async function main() {
|
||||
srcTxId: "5wXT-A0iugP9pWEyw-iTbB0plZ_AbmvlNKyBfGS3AUY",
|
||||
});*/
|
||||
|
||||
const contract = warp.contract<any>('QZfrcazIy1xhWhdztArMDSivrM23B0F4tAEFf6XJzt4')
|
||||
.setEvaluationOptions({
|
||||
})
|
||||
.connect(wallet);
|
||||
const contract = warp.contract<any>('OZBvm55O2fmoeotAphv0_4mhcrBspaTyBSDQ-ZmAWwA')
|
||||
.setEvaluationOptions({
|
||||
})
|
||||
.connect(wallet);
|
||||
|
||||
await contract.writeInteraction<any>({
|
||||
function: "train",
|
||||
});
|
||||
await Promise.all([
|
||||
contract.writeInteraction<any>({
|
||||
function: "transfer",
|
||||
target: "M-mpNeJbg9h7mZ-uHaNsa5jwFFRAq0PsTkNWXJ-ojwI",
|
||||
qty: 100
|
||||
}),
|
||||
contract.writeInteraction<any>({
|
||||
function: "transfer",
|
||||
target: "M-mpNeJbg9h7mZ-uHaNsa5jwFFRAq0PsTkNWXJ-ojwI",
|
||||
qty: 100
|
||||
}),
|
||||
contract.writeInteraction<any>({
|
||||
function: "transfer",
|
||||
target: "M-mpNeJbg9h7mZ-uHaNsa5jwFFRAq0PsTkNWXJ-ojwI",
|
||||
qty: 100
|
||||
})
|
||||
]);
|
||||
|
||||
/*await contract.writeInteraction<any>({
|
||||
function: "storeBalance",
|
||||
target: "M-mpNeJbg9h7mZ-uHaNsa5jwFFRAq0PsTkNWXJ-ojwI",
|
||||
});
|
||||
|
||||
await contract.writeInteraction<any>({
|
||||
function: "storeBalance",
|
||||
target: "M-mpNeJbg9h7mZ-uHaNsa5jwFFRAq0PsTkNWXJ-ojwI",
|
||||
});*/
|
||||
|
||||
const {cachedValue} = await contract.readState();
|
||||
/*const {cachedValue} = await contract.readState();
|
||||
|
||||
logger.info("Result");
|
||||
console.dir(cachedValue.state);
|
||||
|
||||
console.dir(cachedValue.state);*/
|
||||
|
||||
} catch (e) {
|
||||
logger.error(e)
|
||||
|
||||
Reference in New Issue
Block a user