diff --git a/examples/data-history-museum/index.ts b/examples/data-history-museum/index.ts index 1cb8807..dd6d21c 100644 --- a/examples/data-history-museum/index.ts +++ b/examples/data-history-museum/index.ts @@ -74,21 +74,21 @@ async function saveDHMTransactions(transactions: TransactionResult[]) { if (t['created-asset-index']) { assets.push({ id: t['created-asset-index'], - name: t['asset-config-transaction'].params.name!, - unit: t['asset-config-transaction'].params['unit-name']!, - mediaUrl: t['asset-config-transaction'].params.url!, + name: t['asset-config-transaction']!.params!.name!, + unit: t['asset-config-transaction']!.params!['unit-name']!, + mediaUrl: t['asset-config-transaction']!.params!.url!, metadata: getArc69Metadata(t), created: new Date(t['round-time']! * 1000).toISOString(), lastModified: new Date(t['round-time']! * 1000).toISOString(), }) } else { - const asset = assets.find((a) => a.id === t['asset-config-transaction']['asset-id']) + const asset = assets.find((a) => a.id === t['asset-config-transaction']!['asset-id']) if (!asset) { // eslint-disable-next-line no-console console.error(t) - throw new Error(`Unable to find existing asset data for ${t['asset-config-transaction']['asset-id']}`) + throw new Error(`Unable to find existing asset data for ${t['asset-config-transaction']!['asset-id']}`) } - if (!t['asset-config-transaction'].params) { + if (!t['asset-config-transaction']!.params) { // Asset was deleted, remove it assets.splice(assets.indexOf(asset), 1) } else { diff --git a/src/subscriptions.ts b/src/subscriptions.ts index 79dd507..005d389 100644 --- a/src/subscriptions.ts +++ b/src/subscriptions.ts @@ -1,5 +1,6 @@ import * as algokit from '@algorandfoundation/algokit-utils' import type { TransactionResult } from '@algorandfoundation/algokit-utils/types/indexer' +import * as msgpack from 'algo-msgpack-with-bigint' import { Algodv2, Indexer, Transaction, encodeAddress } from 'algosdk' import type SearchForTransactions from 'algosdk/dist/types/client/v2/indexer/searchForTransactions' import sha512 from 'js-sha512' @@ -304,7 +305,10 @@ export async function getBlocksBulk(context: { startRound: number; maxRound: num blocks.push( ...(await Promise.all( chunk.map(async (round) => { - return (await client.block(round).do()) as { block: Block } + const response = await client.c.get(`/v2/blocks/${round}`, { format: 'msgpack' }, undefined, undefined, false) + const body = response.body as Uint8Array + const decoded = msgpack.decode(body) as { block: Block } + return decoded }), )), ) diff --git a/src/transform.ts b/src/transform.ts index 2fd8d2d..04f05bf 100644 --- a/src/transform.ts +++ b/src/transform.ts @@ -383,6 +383,7 @@ export function getIndexerTransactionFromAlgodTransaction(t: TransactionInBlock : undefined, } : undefined, + logs: blockTransaction.dt?.lg ? blockTransaction.dt.lg.map((l) => Buffer.from(l, 'utf-8').toString('base64')) : undefined, // todo: do we need any of these? //"close-rewards" //"receiver-rewards" diff --git a/tests/scenarios/transform-complex-txn.spec.ts b/tests/scenarios/transform-complex-txn.spec.ts index e4e0f29..ba0ad30 100644 --- a/tests/scenarios/transform-complex-txn.spec.ts +++ b/tests/scenarios/transform-complex-txn.spec.ts @@ -206,7 +206,7 @@ describe('Complex transaction with many nested inner transactions', () => { "local-state-schema": undefined, "on-completion": "update", }, - "asset-config-transaction": {}, + "asset-config-transaction": undefined, "asset-freeze-transaction": undefined, "asset-transfer-transaction": undefined, "auth-addr": undefined, @@ -223,7 +223,7 @@ describe('Complex transaction with many nested inner transactions', () => { "inner-txns": [ { "application-transaction": undefined, - "asset-config-transaction": {}, + "asset-config-transaction": undefined, "asset-freeze-transaction": undefined, "asset-transfer-transaction": { "amount": 536012365, @@ -248,6 +248,7 @@ describe('Complex transaction with many nested inner transactions', () => { "intra-round-offset": 148, "last-valid": 35214369, "lease": "", + "logs": undefined, "note": "", "payment-transaction": undefined, "rekey-to": undefined, @@ -260,6 +261,11 @@ describe('Complex transaction with many nested inner transactions', () => { "intra-round-offset": 147, "last-valid": 35214369, "lease": "", + "logs": [ + "R2hHHwQAAAAAAAYExYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", + "AAAAAAAAYcKgAAAAAB/ypo2AAAAAAAAAAA==", + "PNaUw7oABCHCpmV8I9qBOd6+0ofCvhDCucm/w74lwoJqwqTdrjUCzpYNwqYAAAAAAAAAAAAAAAAABgTFgAAAAB/ypo2AAAAAAAAAAAAAAA91w7sZdAAAAAAC77+9", + ], "note": "", "payment-transaction": undefined, "rekey-to": undefined,