Skip to content

Algo Builder v3.0.0

Compare
Choose a tag to compare
@robert-zaremba robert-zaremba released this 21 Dec 23:37
· 375 commits to master since this release

This is our next major release which is focused on AVM v1.0 (TEALv5) full support and many improvements requested by the community.

Improvements

  • TEALv5 support in @algo-builder/runtime AVM 1.0:
    • Cover, Uncover opcodes
    • Loads, Stores opcodes
    • Extract, Extract3 opcodes
    • ExtractUint16, ExtractUint32, ExtractUint64 opcodes
    • Txn, Global fields
    • Added application account (a smart contract now has an escrow account). Updated checkpoint structure to store applicationAccount while running algob scripts.
    • Support Inner Transactions: Payment, AssetTransfer, AssetFreeze, AssetRevoke, AssetDeploy, AssetModify, AssetDelete.
    • Support Pooled opcode budget
    • Txnas, Gtxnas, Gtxnsas, Args, Log (logs are stored in txReceipt)
  • Update all transaction functions (eg. executeTx, addAsset, addApp ..etc) to return a transaction receipt. Add runtime.getTxReceipt in @algo-builder/runtime to query transaction info.
  • Add Asset Name to assetDefinition in @algo-builder/runtime.

  • Updated App, Asset counters in runtime from 0, to 8. This means that the newly created App/Asset Index will be 9 (instead of 1).

  • Added runtime.loadLogic(..) function (similar to deployer.loadLogic API) which simplifies the testing and script flow (we can use the same code in tests and scripts). User should do the following migration:

    // from
    const daoFundLsigProg = getProgram("dao-fund-lsig.py", scInitParam);
    daoFundLsig = runtime.createLsigAccount(daoFundLsigProg, []);
    
    // to (mute logs)
    daoFundLsig = runtime.loadLogic("dao-fund-lsig.py", scInitParam, false);

    For information about loading checkpoint(s) data using @algo-builder/web in a webapp, read here.

  • Added WallectConnectSession class to create & manage wallect connect session. User can use session.executeTransaction() to execute algob transactions using wallet connect.

  • Updated getProgram, loadLogic to pass an optional argument: logs (true/false). By default logs will be displayed on console during compilation.

    // logs == false
    const daoFundLsigProg = getProgram("dao-fund-lsig.py", {}, false);
  • Updated deployer.deployApp(...) & deployer.updateApp(...) to take one more optional parameter: appName. This will also save in a checkpoint the compiled app by name.

  • deployer.updateApp() and runtime.updateApp take one more optional argument: scTmplParams: SCParams to be compatible with deployApp and be able to use template parameters.

  • Added new function getAppByName(name: string) to query checkpoint information by app name.

  • Added deployer.loadLogicFromCache to load a logic signature from already compiled TEAL codes (stored in artifacts/cache, for eg during deployer.fundLsig). This avoid re-compilation (and passing scTmplParams) each time(s) user wants to load an lsig.

  • Updated TealDbg method to load already compiled TEAL code from artifacts/cache. Compilation is forced only when a) TEAL is not cached OR b) scInitParam (template parameters) are passed with tealFile.

  • Adding @algo-builder/web.status.getAssetHolding function which queries account asset holding.

Infrastructure

  • Updated private-net setup, sandbox & indexer scripts to run in dev mode.

Breaking changes

@algo-builder/runtime:

  • Renamed Runtime.getLogicSig to Runtime.createLsigAccount #506.

  • runtime.addAsset(..), runtime.addApp(..) return a tx receipt object, which contains the newly created appID/assetID.

    • Migration: Example code:
    // from
    const appID = runtime.addApp(flags, {}, approvalProgram, clearProgram);
    
    // to
    const receipt = runtime.addApp(flags, {}, approvalProgram, clearProgram);
    const appID = receipt.appID;
  • getProgram is moved to @algo-builder/runtime from @algo-builder/algob.

  • runtime.addAsset, runtime.addAssetDef and runtime.addApp are deprecated.
    Please use runtime.deployASA, runtime.deployASADef and runtime.deployAdd instead of the above functions.

  • Update runtime.deloyApp to be compatible with deployer.deployApp.

  • balanceOf in @algo-builder/algob package now return amount (number) of asset account holding and won't print them. If the account does not hold an asset it will return 0. To query asset holding, please use a new @algo-builder/web.status.getAssetHolding function.

  • Updated deployer.deployApp to pass scTmplParams (smart contract template parameters).

Bug Fixes

  • Fix bug substring3 opcode pop wrong order /#505, contribution: @vuvth.
  • Fix bug: runtime.optinToApp updating state even after opt-in fails. Reported by @patrick