Skip to content

Commit

Permalink
docs: Reference types
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanmenzel committed Feb 14, 2025
1 parent 0c65b39 commit e35848c
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 9 deletions.
10 changes: 8 additions & 2 deletions docs/api/functions/Account.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

> **Account**(): [`Account`](../type-aliases/Account.md)
Defined in: [packages/algo-ts/src/reference.ts:100](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/reference.ts#L100)
Defined in: [packages/algo-ts/src/reference.ts:106](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/reference.ts#L106)

Create a new account object representing the zero address

### Returns

Expand All @@ -20,14 +22,18 @@ Defined in: [packages/algo-ts/src/reference.ts:100](https://github.com/algorandf

> **Account**(`address`): [`Account`](../type-aliases/Account.md)
Defined in: [packages/algo-ts/src/reference.ts:101](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/reference.ts#L101)
Defined in: [packages/algo-ts/src/reference.ts:111](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/reference.ts#L111)

Create a new account object representing the provided address

### Parameters

#### address

[`bytes`](../type-aliases/bytes.md)

A 32-byte Algorand address

### Returns

[`Account`](../type-aliases/Account.md)
10 changes: 8 additions & 2 deletions docs/api/functions/Application.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

> **Application**(): [`Application`](../type-aliases/Application.md)
Defined in: [packages/algo-ts/src/reference.ts:199](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/reference.ts#L199)
Defined in: [packages/algo-ts/src/reference.ts:219](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/reference.ts#L219)

Creates a new Application object represent the application id 0 (an invalid ID)

### Returns

Expand All @@ -20,14 +22,18 @@ Defined in: [packages/algo-ts/src/reference.ts:199](https://github.com/algorandf

> **Application**(`applicationId`): [`Application`](../type-aliases/Application.md)
Defined in: [packages/algo-ts/src/reference.ts:200](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/reference.ts#L200)
Defined in: [packages/algo-ts/src/reference.ts:224](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/reference.ts#L224)

Creates a new Application object representing the application with the specified id

### Parameters

#### applicationId

[`uint64`](../type-aliases/uint64.md)

The id of the application

### Returns

[`Application`](../type-aliases/Application.md)
10 changes: 8 additions & 2 deletions docs/api/functions/Asset.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

> **Asset**(): [`Asset`](../type-aliases/Asset.md)
Defined in: [packages/algo-ts/src/reference.ts:106](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/reference.ts#L106)
Defined in: [packages/algo-ts/src/reference.ts:119](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/reference.ts#L119)

Creates a new Asset object represent the asset id 0 (an invalid ID)

### Returns

Expand All @@ -20,14 +22,18 @@ Defined in: [packages/algo-ts/src/reference.ts:106](https://github.com/algorandf

> **Asset**(`assetId`): [`Asset`](../type-aliases/Asset.md)
Defined in: [packages/algo-ts/src/reference.ts:107](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/reference.ts#L107)
Defined in: [packages/algo-ts/src/reference.ts:124](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/reference.ts#L124)

Creates a new Asset object representing the asset with the specified id

### Parameters

#### assetId

[`uint64`](../type-aliases/uint64.md)

The id of the asset

### Returns

[`Asset`](../type-aliases/Asset.md)
4 changes: 3 additions & 1 deletion docs/api/type-aliases/Account.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

> **Account**: `object`
Defined in: [packages/algo-ts/src/reference.ts:100](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/reference.ts#L100)
Defined in: [packages/algo-ts/src/reference.ts:106](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/reference.ts#L106)

## Type declaration

Expand All @@ -32,6 +32,8 @@ Account must be an available resource

> `readonly` **bytes**: [`bytes`](bytes.md)
Get the accounts address in bytes

### minBalance

> `readonly` **minBalance**: [`uint64`](uint64.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/api/type-aliases/Application.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

> **Application**: `object`
Defined in: [packages/algo-ts/src/reference.ts:199](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/reference.ts#L199)
Defined in: [packages/algo-ts/src/reference.ts:219](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/reference.ts#L219)

An Application on the Algorand network.

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

> **Asset**: `object`
Defined in: [packages/algo-ts/src/reference.ts:106](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/reference.ts#L106)
Defined in: [packages/algo-ts/src/reference.ts:119](https://github.com/algorandfoundation/puya-ts/blob/main/packages/algo-ts/src/reference.ts#L119)

An Asset on the Algorand network.

Expand Down
24 changes: 24 additions & 0 deletions packages/algo-ts/src/reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { NoImplementation } from './internal/errors'
import { bytes, uint64 } from './primitives'

export type Account = {
/**
* Get the accounts address in bytes
*/
readonly bytes: bytes

/**
Expand Down Expand Up @@ -97,13 +100,27 @@ export type Account = {
isOptedIn(assetOrApp: Asset | Application): boolean
}

/**
* Create a new account object representing the zero address
*/
export function Account(): Account
/**
* Create a new account object representing the provided address
* @param address A 32-byte Algorand address
*/
export function Account(address: bytes): Account
export function Account(address?: bytes): Account {
throw new NoImplementation()
}

/**
* Creates a new Asset object represent the asset id 0 (an invalid ID)
*/
export function Asset(): Asset
/**
* Creates a new Asset object representing the asset with the specified id
* @param assetId The id of the asset
*/
export function Asset(assetId: uint64): Asset
export function Asset(assetId?: uint64): Asset {
throw new NoImplementation()
Expand Down Expand Up @@ -196,7 +213,14 @@ export type Asset = {
frozen(account: Account): boolean
}

/**
* Creates a new Application object represent the application id 0 (an invalid ID)
*/
export function Application(): Application
/**
* Creates a new Application object representing the application with the specified id
* @param applicationId The id of the application
*/
export function Application(applicationId: uint64): Application
export function Application(applicationId?: uint64): Application {
throw new NoImplementation()
Expand Down

0 comments on commit e35848c

Please sign in to comment.