From a964962a2679de676ad1fb72956a241ac27818cc Mon Sep 17 00:00:00 2001 From: Dean Eigenmann <7621705+decanus@users.noreply.github.com> Date: Sat, 19 Jun 2021 12:57:35 +0200 Subject: [PATCH] Update README.md (#16) --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 530651c..d1e9181 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Weiroll programs consist of a sequence of delegatecalls to library functions in The easiest way to do this is by wrapping ethers.js contract instances: -``` +```javascript const ethersContract = new ethers.Contract(address, abi); const contract = weiroll.Contract.fromEthersContract(ethersContract); ``` @@ -25,26 +25,26 @@ You can repeat this for each library contract you wish to use. A weiroll `Contra ### Planning programs First, instantiate a planner: -``` +```javascript const planner = new weiroll.Planner(); ``` Next, add one or more commands to execute: -``` -const ret = planner.addCommand(contract.func(a, b)); +```javascript +const ret = planner.add(contract.func(a, b)); ``` Return values from one invocation can be used in another one: -``` -planner.addCommand(contract.func2(ret)); +```javascript +planner.add(contract.func2(ret)); ``` -Remember to wrap each call to a contract in `planner.addCommand`. Attempting to pass the result of one contract function directly to another will not work - each one needs to be added to the planner! +Remember to wrap each call to a contract in `planner.add`. Attempting to pass the result of one contract function directly to another will not work - each one needs to be added to the planner! Once you are done planning operations, generate the program: -``` +```javascript const {commands, state} = planner.plan(); ```