warp-contracts / warp

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

feat: skip unsafe contracts calls #259

Closed ppedziwiatr closed 1 year ago

ppedziwiatr commented 2 years ago

https://github.com/warp-contracts/warp/issues/263

ppedziwiatr commented 1 year ago

1.2.34-beta.3

Example deployment with a manifest:

const {contractTxId, srcTxId} = await warp.deploy({
      wallet,
      initState: initialState,
      src: jsContractSrc,
      evaluationManifest: {
        evaluationOptions: {
          unsafeClient: 'skip',
          internalWrites: true
        }
      }
    });

NOTE: the evaluation options set for the contract that we want to read must match the evaluation options of the manifest. So, in order to read the above contract state:

const contract = warp.contract<any>(contractTxId)
      .setEvaluationOptions({internalWrites: true, unsafeClient: 'skip'})
      .connect(wallet);