Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@multiversx/sdk-core",
"version": "14.0.4",
"version": "14.1.0",
"description": "MultiversX SDK for JavaScript and TypeScript",
"author": "MultiversX",
"homepage": "https://multiversx.com",
Expand Down
7 changes: 7 additions & 0 deletions src/networkProviders/apiNetworkProvider.dev.net.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,4 +396,11 @@ describe("ApiNetworkProvider Tests", function () {
const result = await apiProvider.queryContract(query);
assert.equal(result.returnDataParts.length, 0);
});

it("should fetch transactions for an account", async () => {
const transactions = await apiProvider.getTransactions(
Address.newFromBech32("erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th"),
);
assert.isTrue(transactions.length > 0);
});
});
6 changes: 6 additions & 0 deletions src/networkProviders/apiNetworkProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ export class ApiNetworkProvider implements INetworkProvider {
return transaction;
}

async getTransactions(address: Address): Promise<TransactionOnNetwork[]> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As opposed to the python implementation, here we don't support options? Shouldn't we?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add it in the TODO list. If someone needs to do a custom request, they can use doGetGeneric().

const response = await this.doGetGeneric(`accounts/${address.toBech32()}/transactions`);
const transactions = response.map((item: any) => TransactionOnNetwork.fromApiHttpResponse(item.txHash, item));
return transactions;
}

async getTransactionStatus(txHash: string): Promise<TransactionStatus> {
const response = await this.doGetGeneric(`transactions/${txHash}?fields=status`);
const status = new TransactionStatus(response.status);
Expand Down
Loading