diff --git a/package.json b/package.json index 482e0c7..192d588 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@centrifuge/sdk", - "version": "0.0.0-alpha.8", + "version": "0.0.0-alpha.9", "description": "", "homepage": "https://github.com/centrifuge/sdk/tree/main#readme", "author": "", diff --git a/src/IndexerQueries/assetTransactions.ts b/src/IndexerQueries/assetTransactions.ts index 8d22a83..5c04d24 100644 --- a/src/IndexerQueries/assetTransactions.ts +++ b/src/IndexerQueries/assetTransactions.ts @@ -14,8 +14,8 @@ export type AssetTransaction = { amount: Currency settlementPrice: Price | null quantity: string | null - principalAmount: Currency | undefined - interestAmount: Currency | undefined + principalAmount: Currency | null + interestAmount: Currency | null hash: string realizedProfitFifo: Currency | undefined unrealizedProfitAtMarketPrice: Currency | undefined @@ -24,6 +24,7 @@ export type AssetTransaction = { metadata: string type: AssetType currentPrice: string | null + name: string } fromAsset?: { id: string @@ -111,10 +112,11 @@ export const assetTransactionsPostProcess = (data: SubqueryAssetTransactions): A const decimals = tx.pool.currency.decimals return { ...tx, + name: tx.asset.name, settlementPrice: tx.settlementPrice ? new Price(tx.settlementPrice) : null, amount: new Currency(tx?.amount ?? 0n, decimals), - principalAmount: tx.principalAmount ? new Currency(tx.principalAmount, decimals) : undefined, - interestAmount: tx.interestAmount ? new Currency(tx.interestAmount, decimals) : undefined, + principalAmount: tx.principalAmount ? new Currency(tx.principalAmount, decimals) : null, + interestAmount: tx.interestAmount ? new Currency(tx.interestAmount, decimals) : null, realizedProfitFifo: tx.realizedProfitFifo ? new Currency(tx.realizedProfitFifo, decimals) : undefined, sumRealizedProfitFifo: tx.asset.sumRealizedProfitFifo ? new Currency(tx.asset.sumRealizedProfitFifo, decimals) diff --git a/src/IndexerQueries/poolFeeTransactions.ts b/src/IndexerQueries/poolFeeTransactions.ts index 17872ab..e930a76 100644 --- a/src/IndexerQueries/poolFeeTransactions.ts +++ b/src/IndexerQueries/poolFeeTransactions.ts @@ -10,7 +10,7 @@ export type PoolFeeTransaction = { timestamp: string blockNumber: string epochNumber: number - amount: Currency + amount: Currency | null } export type SubqueryPoolFeeTransactionType = @@ -30,7 +30,7 @@ export type SubqueryPoolFeeTransaction = { timestamp: string blockNumber: string epochNumber: number - amount: string + amount: string | null poolFee: { feeId: string pool: { @@ -50,7 +50,7 @@ export function poolFeeTransactionPostProcess(data: SubqueryPoolFeeTransaction): timestamp: tx.timestamp, blockNumber: tx.blockNumber, epochNumber: tx.epochNumber, - amount: new Currency(tx.amount, tx.poolFee.pool.currency.decimals), + amount: tx.amount ? new Currency(tx.amount, tx.poolFee.pool.currency.decimals) : null, })) } diff --git a/src/Reports/Processor.ts b/src/Reports/Processor.ts index 7a7b465..bf1f040 100644 --- a/src/Reports/Processor.ts +++ b/src/Reports/Processor.ts @@ -270,7 +270,10 @@ export class Processor { epoch: tx.epochId, transactionType: tx.type, amount: tx.amount, + principalAmount: tx.principalAmount, + interestAmount: tx.interestAmount, transactionHash: tx.hash, + name: tx.asset.name, fromAsset: tx.fromAsset ? { id: tx.fromAsset.id, diff --git a/src/types/reports.ts b/src/types/reports.ts index a92f74c..c675faa 100644 --- a/src/types/reports.ts +++ b/src/types/reports.ts @@ -173,6 +173,9 @@ export type AssetTransactionReport = { epoch: string transactionType: AssetTransactionType amount: Currency + name: string + principalAmount: Currency | null + interestAmount: Currency | null transactionHash: string fromAsset?: { id: string @@ -202,7 +205,7 @@ export type FeeTransactionReport = { type: 'feeTransactions' timestamp: string feeId: string - amount: Currency + amount: Currency | null } export type FeeTransactionReportFilter = {