Skip to content

Commit c5087dd

Browse files
committed
UintN -> Uint
1 parent 7c775fd commit c5087dd

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

docs/tealscript-migration.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -383,10 +383,10 @@ add(a: uint64, b: uint64): uint64 {
383383
}
384384
```
385385

386-
#### UintN types
386+
#### Uint types
387387

388388
TEALScript supports typed numeric literals for most common uint types, such as `uint8`, `uint16`, `uint256`, etc. In Algorand TypeScript,
389-
the UintN constructors must be used.
389+
the Uint constructors must be used.
390390

391391
##### TEALScript
392392

@@ -401,19 +401,19 @@ addOne(n: uint256): uint256 {
401401
##### Algorand TypeScript
402402

403403
```ts
404-
addOne(n: UintN256): UintN256 {
405-
// Need to explicitly use UintN256 constructor to get uint256 and use bigint to perform arithmetic
404+
addOne(n: Uint256): Uint256 {
405+
// Need to explicitly use Uint256 constructor to get uint256 and use bigint to perform arithmetic
406406
const one = 1n;
407-
const sum = new UintN256(n.native + one + one);
407+
const sum = new Uint256(n.native + one + one);
408408
return sum;
409409
}
410410
```
411411

412412
#### Math and Overflows
413413

414414
In TEALScript, overflow checks do not occur until the value is encoded (returned, logged, put into an array/object). In Algorand TypeScript,
415-
overflow checking occurs whenever the `UintN` constructor is used. Since overflow checking is fairly expensive, it is recommended to not use
416-
the `UintN` type until it needs to be encoded.
415+
overflow checking occurs whenever the `Uint` constructor is used. Since overflow checking is fairly expensive, it is recommended to not use
416+
the `Uint` type until it needs to be encoded.
417417

418418
##### TEALScript
419419

@@ -431,12 +431,12 @@ addToNumber(n: uint8) {
431431
##### Algorand TypeScript
432432

433433
```ts
434-
addToNumber(n: UintN8) {
434+
addToNumber(n: Uint8) {
435435
// Use biguint for intermediate values which can go up to u512
436436
const x: biguint = 255
437437
const sum: biguint = BigUint(n.bytes) + x
438438

439-
return new UintN8(sum - x)
439+
return new Uint8(sum - x)
440440
}
441441
```
442442

@@ -456,8 +456,8 @@ convertNumber(n: uint64): uint8 {
456456
##### Algorand TypeScript
457457

458458
```ts
459-
convertNumber(n: uint64): UintN8 {
460-
return new UintN8(n)
459+
convertNumber(n: uint64): Uint8 {
460+
return new Uint8(n)
461461
}
462462
```
463463

0 commit comments

Comments
 (0)