From 32d832a21ca04b0f84b43307383c3c83c0cbcd0a Mon Sep 17 00:00:00 2001 From: Joe Polny Date: Fri, 15 Nov 2024 13:29:13 -0500 Subject: [PATCH] String vs Bytes, importing --- MIGRATION.md | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/MIGRATION.md b/MIGRATION.md index 1282668..44f6be8 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -17,11 +17,12 @@ These are changes to the way things are named, but the functionality remains the These are minor changes to the syntax of the language/API. -| TEALScript | PuyaTS | Notes | -| ------------------------------------------ | ---------------------------------------- | ------------------------------------------------------------------------------------------------ | -| `this.boxRef.create(boxSize)` | `this.boxRef.create({ size: boxSize })` | The size option is now a property of the create method | -| Explcicit method return types are required | Implicit method return types are allowed | | -| `verify...Txn` | `assertMatch` | `assertMatch` accepts any object. This means, however, that txn types must be explicitly checked | +| TEALScript | PuyaTS | Notes | +| ----------------------------------------------- | -------------------------------------------- | ------------------------------------------------------------------------------------------------ | +| `this.boxRef.create(boxSize)` | `this.boxRef.create({ size: boxSize })` | The size option is now a property of the create method | +| Explcicit method return types are required | Implicit method return types are allowed | | +| `verify...Txn` | `assertMatch` | `assertMatch` accepts any object. This means, however, that txn types must be explicitly checked | +| Methods, classes, and types are in global scope | Methods, classes, and types must be imported | | ## Major Changes @@ -121,3 +122,19 @@ const y = UintN<64>(x); ``` ### String vs Bytes + +#### TEALScript + +In TEALScript, bytes and strings are the same type and can be used interchangeably. + +```ts +assert(swapAsset.assetName === "SWAP"); +``` + +#### PuyaTS + +In PuyaTS, bytes and strings are distinct types. Most functions acccept `bytes | string`, but outputs will always be `bytes` + +```ts +assert(swapAsset.assetName === Bytes("SWAP")); +```