Skip to content

Commit

Permalink
feat: add transactions prism
Browse files Browse the repository at this point in the history
  • Loading branch information
1160007652 committed Mar 13, 2023
1 parent 7ad0a42 commit 04ef0cb
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 9 deletions.
23 changes: 20 additions & 3 deletions dist/api/transaction/transaction.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/api/transaction/transaction.js.map

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion dist/api/transaction/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,20 @@ export interface ProcessedTxInfoByStaking {
timestamp: number;
tx_hash: string;
}
export interface IPrismData {
asset_type: number[];
lowlevel_data: any[];
nonce: Array<number[] | number>;
receiver: {
Ethereum: string;
};
signer: string;
value: string;
}
export interface ProcessedTxInfoByPrism {
amount: string;
address: string;
data: string;
data: IPrismData;
timestamp: number;
tx_hash: string;
}
Expand Down
13 changes: 11 additions & 2 deletions src/api/transaction/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as Builder from './builder';
import * as helpers from './helpers';
import { processeTxInfoList } from './processor';
import {
IPrismData,
ProcessedTxListByPrismResponseResult,
ProcessedTxListByStakingResponseResult,
ProcessedTxListByStakingUnDelagtionResponseResult,
Expand Down Expand Up @@ -552,7 +553,11 @@ export const getTxnListByPrism = async (
throw new Error('Could not fetch a list of transactions. No response from the server.');
}

return dataResult.response.data;
const items = dataResult.response.data.items.map(item => {
return { ...item, data: JSON.parse(atob(item.data)) as IPrismData };
});

return { ...dataResult.response.data, items };
}

const dataResult = await Network.getTxListByPrismSend(address, page, per_page);
Expand All @@ -561,5 +566,9 @@ export const getTxnListByPrism = async (
throw new Error('Could not fetch a list of transactions. No response from the server.');
}

return dataResult.response.data;
const items = dataResult.response.data.items.map(item => {
return { ...item, data: JSON.parse(atob(item.data)) as IPrismData };
});

return { ...dataResult.response.data, items };
};
13 changes: 12 additions & 1 deletion src/api/transaction/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,21 @@ export interface ProcessedTxInfoByStaking {
tx_hash: string;
}

export interface IPrismData {
asset_type: number[];
lowlevel_data: any[];
nonce: Array<number[] | number>;
receiver: {
Ethereum: string;
};
signer: string;
value: string;
}

export interface ProcessedTxInfoByPrism {
amount: string;
address: string;
data: string;
data: IPrismData;
timestamp: number;
tx_hash: string;
}
Expand Down
2 changes: 1 addition & 1 deletion src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1654,7 +1654,7 @@ async function getTxnListTest() {
// 'fra1lelnp9fthp68xy0nqtlu7h2u6ms45rh4lqu466ns4jxqvdjja3qqz5ae6s',
// 'send',
// );
// console.log(result);
// console.log(JSON.stringify(result, null, 2));
}

// prism();
Expand Down

0 comments on commit 04ef0cb

Please sign in to comment.