-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update @subql deps * Add getBlockSize function * Update changelog --------- Co-authored-by: stwiname <[email protected]> Co-authored-by: Scott Twiname <[email protected]>
- Loading branch information
1 parent
6c22172
commit 9479490
Showing
8 changed files
with
63 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,22 @@ | ||
// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
import { AlgorandBlock } from '@subql/types-algorand'; | ||
import { AlgorandBlock, AlgorandTransaction } from '@subql/types-algorand'; | ||
|
||
export type BlockContent = AlgorandBlock; | ||
|
||
export function getBlockSize(block: BlockContent): number { | ||
return ( | ||
block.transactions?.reduce( | ||
(acc, tx) => acc + countInnerTransactions(tx), | ||
0, | ||
) ?? 0 | ||
); | ||
} | ||
|
||
function countInnerTransactions(tx: AlgorandTransaction): number { | ||
return ( | ||
tx.innerTxns?.reduce((acc, itx) => acc + countInnerTransactions(itx), 1) ?? | ||
1 | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters