Skip to content

Commit

Permalink
feat: add additional data to block metadata (#84)
Browse files Browse the repository at this point in the history
- Add additional fields and data to BlockMetadata
- Make all the Block related hash strings base64 encoded
- Change block timestamp to represent in seconds since epoch rather than ISO8601 format.
- Omit keys from block or transaction data when their values are undefined.

BREAKING CHANGES
- `timestamp` in `BlockMetadata` is now an epoch seconds number, rather than an ISO8601 string to match other timestamps.
- `hash` and `previousBlockHash` in `BlockMetadata` are now base64 encoded strings, rather than base32 encoded strings. This matches the format used in the indexer api.
---------

Co-authored-by: Neil Campbell <[email protected]>
  • Loading branch information
negar-abbasi and neilcampbell authored Jul 5, 2024
1 parent 7b3a893 commit 1633a09
Show file tree
Hide file tree
Showing 32 changed files with 725 additions and 289 deletions.
10 changes: 5 additions & 5 deletions docs/code/enums/types_subscription.BalanceChangeRole.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Account was creating an asset and holds the full asset supply

#### Defined in

[types/subscription.ts:95](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/subscription.ts#L95)
[types/subscription.ts:135](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/subscription.ts#L135)

___

Expand All @@ -39,7 +39,7 @@ A balance change with this role will always have a 0 amount and use the asset ma

#### Defined in

[types/subscription.ts:99](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/subscription.ts#L99)
[types/subscription.ts:139](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/subscription.ts#L139)

___

Expand All @@ -51,7 +51,7 @@ Account was having an asset amount closed to it

#### Defined in

[types/subscription.ts:93](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/subscription.ts#L93)
[types/subscription.ts:133](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/subscription.ts#L133)

___

Expand All @@ -63,7 +63,7 @@ Account was receiving a transaction

#### Defined in

[types/subscription.ts:91](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/subscription.ts#L91)
[types/subscription.ts:131](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/subscription.ts#L131)

___

Expand All @@ -75,4 +75,4 @@ Account was sending a transaction (sending asset and/or spending fee if asset `0

#### Defined in

[types/subscription.ts:89](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/subscription.ts#L89)
[types/subscription.ts:129](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/subscription.ts#L129)
58 changes: 55 additions & 3 deletions docs/code/interfaces/types_block.Block.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ https://github.com/algorand/go-algorand/blob/master/data/bookkeeping/block.go#L3
- [frac](types_block.Block.md#frac)
- [gen](types_block.Block.md#gen)
- [gh](types_block.Block.md#gh)
- [nextbefore](types_block.Block.md#nextbefore)
- [nextproto](types_block.Block.md#nextproto)
- [nextswitch](types_block.Block.md#nextswitch)
- [nextyes](types_block.Block.md#nextyes)
- [prev](types_block.Block.md#prev)
- [proto](types_block.Block.md#proto)
- [rate](types_block.Block.md#rate)
Expand Down Expand Up @@ -62,7 +66,7 @@ ___

### frac

**frac**: `number`
**frac**: `number` \| `bigint`

The number of leftover MicroAlgos after the distribution of RewardsRate/rewardUnits
MicroAlgos for every reward unit in the next round.
Expand Down Expand Up @@ -97,6 +101,54 @@ Genesis hash to which this block belongs.

___

### nextbefore

`Optional` **nextbefore**: `number`

Deadline round for this protocol upgrade (No votes will be considered after this round).

#### Defined in

[types/block.ts:140](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L140)

___

### nextproto

`Optional` **nextproto**: `string`

The next proposed protocol version.

#### Defined in

[types/block.ts:132](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L132)

___

### nextswitch

`Optional` **nextswitch**: `number`

Round on which the protocol upgrade will take effect.

#### Defined in

[types/block.ts:144](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L144)

___

### nextyes

`Optional` **nextyes**: `number`

Number of blocks which approved the protocol upgrade.

#### Defined in

[types/block.ts:136](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L136)

___

### prev

**prev**: `Uint8Array`
Expand All @@ -123,7 +175,7 @@ ___

### rate

**rate**: `number`
`Optional` **rate**: `number`

The number of new MicroAlgos added to the participation stake from rewards at the next round.

Expand Down Expand Up @@ -241,4 +293,4 @@ The transactions within the block.

#### Defined in

[types/block.ts:130](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L130)
[types/block.ts:148](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L148)
24 changes: 12 additions & 12 deletions docs/code/interfaces/types_block.BlockTransaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Asset closing amount in decimal units

#### Defined in

[types/block.ts:147](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L147)
[types/block.ts:165](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L165)

___

Expand All @@ -49,7 +49,7 @@ App ID when an app is created by the transaction

#### Defined in

[types/block.ts:145](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L145)
[types/block.ts:163](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L163)

___

Expand All @@ -61,7 +61,7 @@ Algo closing amount in microAlgos

#### Defined in

[types/block.ts:149](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L149)
[types/block.ts:167](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L167)

___

Expand All @@ -73,7 +73,7 @@ Asset ID when an asset is created by the transaction

#### Defined in

[types/block.ts:143](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L143)
[types/block.ts:161](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L161)

___

Expand All @@ -85,7 +85,7 @@ The eval deltas for the block

#### Defined in

[types/block.ts:141](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L141)
[types/block.ts:159](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L159)

___

Expand All @@ -97,7 +97,7 @@ Has genesis hash

#### Defined in

[types/block.ts:153](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L153)
[types/block.ts:171](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L171)

___

Expand All @@ -109,7 +109,7 @@ Has genesis id

#### Defined in

[types/block.ts:151](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L151)
[types/block.ts:169](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L169)

___

Expand All @@ -121,7 +121,7 @@ Logic signature

#### Defined in

[types/block.ts:157](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L157)
[types/block.ts:175](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L175)

___

Expand All @@ -133,7 +133,7 @@ Transaction multisig signature

#### Defined in

[types/block.ts:159](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L159)
[types/block.ts:177](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L177)

___

Expand All @@ -145,7 +145,7 @@ The signer, if signing with a different key than the Transaction type `from` pro

#### Defined in

[types/block.ts:161](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L161)
[types/block.ts:179](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L179)

___

Expand All @@ -157,7 +157,7 @@ Transaction ED25519 signature

#### Defined in

[types/block.ts:155](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L155)
[types/block.ts:173](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L173)

___

Expand All @@ -169,4 +169,4 @@ The encoded transaction data

#### Defined in

[types/block.ts:139](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L139)
[types/block.ts:157](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L157)
8 changes: 4 additions & 4 deletions docs/code/interfaces/types_block.BlockTransactionEvalDelta.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The delta of global state, keyed by key

#### Defined in

[types/block.ts:201](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L201)
[types/block.ts:219](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L219)

___

Expand All @@ -37,7 +37,7 @@ Inner transactions

#### Defined in

[types/block.ts:207](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L207)
[types/block.ts:225](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L225)

___

Expand All @@ -49,7 +49,7 @@ The delta of local state keyed by account ID offset in [txn.Sender, ...txn.Accou

#### Defined in

[types/block.ts:203](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L203)
[types/block.ts:221](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L221)

___

Expand All @@ -61,4 +61,4 @@ Logs

#### Defined in

[types/block.ts:205](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L205)
[types/block.ts:223](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L223)
6 changes: 3 additions & 3 deletions docs/code/interfaces/types_block.BlockValueDelta.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ DeltaAction is an enum of actions that may be performed when applying a delta to

#### Defined in

[types/block.ts:217](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L217)
[types/block.ts:235](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L235)

___

Expand All @@ -39,7 +39,7 @@ Bytes value

#### Defined in

[types/block.ts:220](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L220)
[types/block.ts:238](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L238)

___

Expand All @@ -51,4 +51,4 @@ Uint64 value

#### Defined in

[types/block.ts:223](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L223)
[types/block.ts:241](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L241)
8 changes: 4 additions & 4 deletions docs/code/interfaces/types_block.LogicSig.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Arguments passed into the logic signature

#### Defined in

[types/block.ts:175](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L175)
[types/block.ts:193](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L193)

___

Expand All @@ -41,7 +41,7 @@ Logic sig code

#### Defined in

[types/block.ts:169](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L169)
[types/block.ts:187](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L187)

___

Expand All @@ -53,7 +53,7 @@ Multisig signature for delegated operations

#### Defined in

[types/block.ts:173](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L173)
[types/block.ts:191](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L191)

___

Expand All @@ -65,4 +65,4 @@ ED25519 signature for delegated operations

#### Defined in

[types/block.ts:171](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L171)
[types/block.ts:189](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L189)
6 changes: 3 additions & 3 deletions docs/code/interfaces/types_block.MultisigSig.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Sub-signatures

#### Defined in

[types/block.ts:187](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L187)
[types/block.ts:205](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L205)

___

Expand All @@ -40,7 +40,7 @@ Multisig threshold

#### Defined in

[types/block.ts:185](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L185)
[types/block.ts:203](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L203)

___

Expand All @@ -52,4 +52,4 @@ Multisig version

#### Defined in

[types/block.ts:183](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L183)
[types/block.ts:201](https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/src/types/block.ts#L201)
Loading

0 comments on commit 1633a09

Please sign in to comment.