-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: algod to indexer txn mapping (#108)
* fix: algod to indexer txn mapping - Add uintName field - Fix base64 encode - Add extraProgramPages field * chore: lint * chore: fix tests * chore: PR feedback
- Loading branch information
1 parent
fab9187
commit c91f1fd
Showing
5 changed files
with
139 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { AlgorandClient } from '@algorandfoundation/algokit-utils' | ||
import { TransactionType } from 'algosdk' | ||
import { describe, expect, it } from 'vitest' | ||
import { GetSubscribedTransactions } from '../transactions' | ||
|
||
describe('Application create transaction', () => { | ||
const txnId = 'ZCQ5OCGWV253DIN5XVJTFNWVVTOQ6PYOUI3KH7ORQISLN4PEXIGQ' | ||
const roundNumber = 31171197n | ||
const algorand = AlgorandClient.mainNet() | ||
|
||
it('Can have an app create transaction subscribed correctly from indexer', async () => { | ||
const indexerTxns = await GetSubscribedTransactions( | ||
{ | ||
filters: { | ||
type: TransactionType.appl, | ||
}, | ||
roundsToSync: 1, | ||
currentRound: roundNumber + 1n, | ||
syncBehaviour: 'catchup-with-indexer', | ||
watermark: roundNumber - 1n, | ||
}, | ||
algorand, | ||
) | ||
|
||
const txn = indexerTxns.subscribedTransactions.find((txn) => txn.id === txnId) | ||
expect(txn).toBeDefined() | ||
expect(txn!.createdApplicationIndex).toBe(1167143153n) | ||
}) | ||
|
||
it('Can have an app create transaction subscribed correctly from algod', async () => { | ||
const algodTxns = await GetSubscribedTransactions( | ||
{ | ||
filters: { | ||
type: TransactionType.appl, | ||
}, | ||
roundsToSync: 1, | ||
currentRound: roundNumber + 1n, | ||
syncBehaviour: 'sync-oldest', | ||
watermark: roundNumber - 1n, | ||
}, | ||
algorand, | ||
) | ||
|
||
const txn = algodTxns.subscribedTransactions.find((txn) => txn.id === txnId) | ||
expect(txn).toBeDefined() | ||
expect(txn!.createdApplicationIndex).toBe(1167143153n) | ||
}) | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { AlgorandClient } from '@algorandfoundation/algokit-utils' | ||
import { TransactionType } from 'algosdk' | ||
import { describe, expect, it } from 'vitest' | ||
import { getSubscribedTransactionForDiff } from '../subscribed-transactions' | ||
import { GetSubscribedTransactions } from '../transactions' | ||
|
||
describe('Asset config transaction', () => { | ||
const txnId = 'QHMYTRW27O7KYP6W3SMC3HP55DN5IL2H7Z27T2YDCNFCLXOVFOJQ' | ||
const roundNumber = 44322184n | ||
const algorand = AlgorandClient.mainNet() | ||
|
||
const expectedAssetCreateData = { | ||
assetId: 0n, | ||
params: { | ||
creator: 'ATPVJYGEGP5H6GCZ4T6CG4PK7LH5OMWXHLXZHDPGO7RO6T3EHWTF6UUY6E', | ||
decimals: 6, | ||
total: 2000000000000000n, | ||
clawback: 'ATPVJYGEGP5H6GCZ4T6CG4PK7LH5OMWXHLXZHDPGO7RO6T3EHWTF6UUY6E', | ||
defaultFrozen: false, | ||
freeze: 'ATPVJYGEGP5H6GCZ4T6CG4PK7LH5OMWXHLXZHDPGO7RO6T3EHWTF6UUY6E', | ||
manager: 'ATPVJYGEGP5H6GCZ4T6CG4PK7LH5OMWXHLXZHDPGO7RO6T3EHWTF6UUY6E', | ||
name: 'Fry Node', | ||
nameB64: 'RnJ5IE5vZGU=', | ||
reserve: 'ATPVJYGEGP5H6GCZ4T6CG4PK7LH5OMWXHLXZHDPGO7RO6T3EHWTF6UUY6E', | ||
unitName: 'fNODE', | ||
unitNameB64: 'Zk5PREU=', | ||
url: 'https://frynetworks.com/', | ||
urlB64: 'aHR0cHM6Ly9mcnluZXR3b3Jrcy5jb20v', | ||
}, | ||
} | ||
|
||
it('Can have an asset create with uint name transaction subscribed correctly from indexer', async () => { | ||
const indexerTxns = await GetSubscribedTransactions( | ||
{ | ||
filters: { | ||
type: TransactionType.acfg, | ||
}, | ||
roundsToSync: 1, | ||
currentRound: roundNumber + 1n, | ||
syncBehaviour: 'catchup-with-indexer', | ||
watermark: roundNumber - 1n, | ||
}, | ||
algorand, | ||
) | ||
|
||
const txn = indexerTxns.subscribedTransactions.find((txn) => txn.id === txnId) | ||
expect(txn).toBeDefined() | ||
expect(getSubscribedTransactionForDiff(txn!).assetConfigTransaction).toMatchObject(expectedAssetCreateData) | ||
}) | ||
|
||
it('Can have an asset create with uint name transaction subscribed correctly from algod', async () => { | ||
const algodTxns = await GetSubscribedTransactions( | ||
{ | ||
filters: { | ||
type: TransactionType.acfg, | ||
}, | ||
roundsToSync: 1, | ||
currentRound: roundNumber + 1n, | ||
syncBehaviour: 'sync-oldest', | ||
watermark: roundNumber - 1n, | ||
}, | ||
algorand, | ||
) | ||
|
||
const txn = algodTxns.subscribedTransactions.find((txn) => txn.id === txnId) | ||
expect(txn).toBeDefined() | ||
expect(getSubscribedTransactionForDiff(txn!).assetConfigTransaction).toMatchObject(expectedAssetCreateData) | ||
}) | ||
}) |
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