Skip to content

Commit

Permalink
docs: Update docs for box maybe
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanmenzel committed Feb 21, 2025
1 parent 69abdd7 commit dc6db1e
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 24 deletions.
24 changes: 21 additions & 3 deletions docs/api/arc4/-internal-/classes/StructBase.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[@algorandfoundation/algorand-typescript](../../../README.md) / [arc4](../../README.md) / [\<internal\>](../README.md) / StructBase

# Class: StructBase
# Class: StructBase\<T\>

Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:466](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L466)

Expand All @@ -14,15 +14,19 @@ The base type for arc4 structs

- [`ARC4Encoded`](../../classes/ARC4Encoded.md)

## Type Parameters

**T**

## Constructors

### new StructBase()

> **new StructBase**(): [`StructBase`](StructBase.md)
> **new StructBase**\<`T`\>(): [`StructBase`](StructBase.md)\<`T`\>
#### Returns

[`StructBase`](StructBase.md)
[`StructBase`](StructBase.md)\<`T`\>

#### Inherited from

Expand All @@ -47,3 +51,17 @@ Retrieve the encoded bytes for this type
#### Inherited from

[`ARC4Encoded`](../../classes/ARC4Encoded.md).[`bytes`](../../classes/ARC4Encoded.md#bytes)

***

### native

#### Get Signature

> **get** **native**(): `T`
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:470](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L470)

##### Returns

`T`
6 changes: 3 additions & 3 deletions docs/api/arc4/-internal-/type-aliases/StructConstructor.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

# Type Alias: StructConstructor()

> **StructConstructor**: \<`T`\>(`initial`) => [`StructBase`](../classes/StructBase.md) & [`Readonly`](Readonly.md)\<`T`\> & `object`
> **StructConstructor**: \<`T`\>(`initial`) => [`StructBase`](../classes/StructBase.md)\<`T`\> & [`Readonly`](Readonly.md)\<`T`\>
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:475](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L475)
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:479](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L479)

Type alias for the Struct constructor function

Expand All @@ -20,4 +20,4 @@ Type alias for the Struct constructor function

## Returns

[`StructBase`](../classes/StructBase.md) & [`Readonly`](Readonly.md)\<`T`\> & `object`
[`StructBase`](../classes/StructBase.md)\<`T`\> & [`Readonly`](Readonly.md)\<`T`\>
8 changes: 4 additions & 4 deletions docs/api/arc4/classes/DynamicBytes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Class: DynamicBytes

Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:492](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L492)
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:496](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L496)

A variable length sequence of bytes prefixed with its length expressed as a 2 byte uint

Expand All @@ -24,7 +24,7 @@ A variable length sequence of bytes prefixed with its length expressed as a 2 by

> **new DynamicBytes**(`value`?): [`DynamicBytes`](DynamicBytes.md)
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:500](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L500)
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:504](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L504)

Create a new DynamicBytes instance

Expand Down Expand Up @@ -92,7 +92,7 @@ Returns the current length of this array

> **get** **native**(): [`bytes`](../../index/type-aliases/bytes.md)
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:507](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L507)
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:511](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L511)

Get the native bytes value (excludes the length prefix)

Expand Down Expand Up @@ -151,7 +151,7 @@ The index of the item to retrieve

> **concat**(`other`): [`DynamicBytes`](DynamicBytes.md)
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:515](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L515)
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:519](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L519)

Returns a dynamic bytes object containing all bytes from _this_ and _other_

Expand Down
8 changes: 4 additions & 4 deletions docs/api/arc4/classes/StaticBytes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Class: StaticBytes\<TLength\>

Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:523](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L523)
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:527](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L527)

A fixed length sequence of bytes

Expand All @@ -28,7 +28,7 @@ A fixed length sequence of bytes

> **new StaticBytes**\<`TLength`\>(`value`?): [`StaticBytes`](StaticBytes.md)\<`TLength`\>
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:531](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L531)
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:535](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L535)

Create a new StaticBytes instance

Expand Down Expand Up @@ -96,7 +96,7 @@ Returns the current length of this array

> **get** **native**(): [`bytes`](../../index/type-aliases/bytes.md)
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:538](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L538)
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:542](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L542)

Get the native bytes value

Expand Down Expand Up @@ -155,7 +155,7 @@ The index of the item to retrieve

> **concat**(`other`): [`DynamicBytes`](DynamicBytes.md)
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:546](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L546)
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:550](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L550)

Returns a dynamic bytes object containing all bytes from _this_ and _other_

Expand Down
2 changes: 1 addition & 1 deletion docs/api/arc4/functions/decodeArc4.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

> **decodeArc4**\<`T`\>(`bytes`, `prefix`): `T`
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:565](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L565)
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:569](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L569)

Decode the provided bytes to a native Algorand TypeScript value

Expand Down
2 changes: 1 addition & 1 deletion docs/api/arc4/functions/encodeArc4.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

> **encodeArc4**\<`T`\>(`value`): [`bytes`](../../index/type-aliases/bytes.md)
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:573](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L573)
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:577](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L577)

Encode the provided Algorand TypeScript value as ARC4 bytes

Expand Down
2 changes: 1 addition & 1 deletion docs/api/arc4/functions/interpretAsArc4.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

> **interpretAsArc4**\<`T`\>(`bytes`, `prefix`): `T`
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:556](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L556)
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:560](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L560)

Interpret the provided bytes as an ARC4 encoded type with no validation

Expand Down
2 changes: 1 addition & 1 deletion docs/api/arc4/variables/Struct.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

> `const` **Struct**: [`StructConstructor`](../-internal-/type-aliases/StructConstructor.md)
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:487](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L487)
Defined in: [packages/algo-ts/src/arc4/encoded-types.ts:491](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/arc4/encoded-types.ts#L491)

The base type of arc4 structs

Expand Down
2 changes: 1 addition & 1 deletion docs/api/index/type-aliases/Box.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ The value if the box exists, else the default value

Get the value stored in the box if available, and a boolean indicating if the box exists.

If the box does not exist, the value returned at position 0 is _undocumented_ and should not be relied on to have a specific value.
If the box does not exist, the value returned at position 0 should not be relied on to have a valid value.

#### Returns

Expand Down
2 changes: 1 addition & 1 deletion docs/api/index/type-aliases/BoxMap.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ The length of the box

Get the value of a keyed box if available, and a boolean indicating if the box exists.

If the box does not exist, the value returned at position 0 is _undocumented_ and should not be relied on to have a specific value.
If the box does not exist, the value returned at position 0 should not be relied on to have a valid value.

#### Parameters

Expand Down
2 changes: 1 addition & 1 deletion docs/api/index/type-aliases/BoxRef.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ The value if the box exists, else the default value

Get the value stored in the box if available, and a boolean indicating if the box exists.

If the box does not exist, the value returned at position 0 is _undocumented_ and should not be relied on to have a specific value.
If the box does not exist, the value returned at position 0 will be an empty byte array.

#### Returns

Expand Down
6 changes: 3 additions & 3 deletions packages/algo-ts/src/box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export type Box<TValue> = {
/**
* Get the value stored in the box if available, and a boolean indicating if the box exists.
*
* If the box does not exist, the value returned at position 0 is _undocumented_ and should not be relied on to have a specific value.
* If the box does not exist, the value returned at position 0 should not be relied on to have a valid value.
* @returns A tuple with the first item being the box value, and the second item being a boolean indicating if the box exists.
*/
maybe(): readonly [TValue, boolean]
Expand Down Expand Up @@ -87,7 +87,7 @@ export type BoxMap<TKey, TValue> = {
/**
* Get the value of a keyed box if available, and a boolean indicating if the box exists.
*
* If the box does not exist, the value returned at position 0 is _undocumented_ and should not be relied on to have a specific value.
* If the box does not exist, the value returned at position 0 should not be relied on to have a valid value.
* @param key The key of the box to check
* @returns A tuple with the first item being the box value, and the second item being a boolean indicating if the box exists.
*/
Expand Down Expand Up @@ -186,7 +186,7 @@ export type BoxRef = {
/**
* Get the value stored in the box if available, and a boolean indicating if the box exists.
*
* If the box does not exist, the value returned at position 0 is _undocumented_ and should not be relied on to have a specific value.
* If the box does not exist, the value returned at position 0 will be an empty byte array.
* @returns A tuple with the first item being the box value, and the second item being a boolean indicating if the box exists.
*/
maybe(): readonly [bytes, boolean]
Expand Down

0 comments on commit dc6db1e

Please sign in to comment.