warp-contracts / warp

An implementation of the Arweave SmartWeave smart contracts protocol.
MIT License
159 stars 44 forks source link

feat: AutoSync connected contracts when syncState #333

Closed twilson63 closed 1 year ago

twilson63 commented 1 year ago

DRE nodes retain latest state of contracts that use readState and internalWrites so that browser-based clients do not have to evaluate every interaction just to do a writeInteraction.

This feature request is to autoSync all connected contracts when a syncState is called.

const warp = WarpFactory.forMainnet();

const contract = await warp
    .contract('pbabEjmdaqOvF-yTkFhs5i2lbmmbC6s4NrUqM_8eAYE')
    .syncState('https://dre-1.warp.cc/contract', {validity: true}); // auto sync all states connected to contract

const {sortKey} = await warp.stateEvaluator.latestAvailableState('pbabEjmdaqOvF-yTkFhs5i2lbmmbC6s4NrUqM_8eAYE');

console.log(sortKey);
ppedziwiatr commented 1 year ago

@twilson63 , thanks for the report - we will try to introduce this feature next week!

ppedziwiatr commented 1 year ago

released in 1.2.55