Skip to content
This repository was archived by the owner on Nov 29, 2021. It is now read-only.

Commit 8395ec2

Browse files
committed
feat: add wallet transactions function
1 parent ef6c873 commit 8395ec2

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/clients/repositories/wallet/functions.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { Tokens, Wallet } from "./types";
22
import { HTTPClient, ResponseWithChainMeta } from "../..";
33
import { get, post } from "../network-repository";
44
import { _Params } from "../../http/client";
5+
import { Transaction } from "../transactions/types";
6+
import { PaginationOptions } from "../..";
57

68
export const walletGet = (client: HTTPClient) => (id: string): Promise<ResponseWithChainMeta<Wallet>> =>
79
get<ResponseWithChainMeta<Wallet>>(client)(`wallets/${id}`);
@@ -13,3 +15,9 @@ export const walletTokens = (client: HTTPClient) => (
1315

1416
export const walletSearch = (client: HTTPClient) => (searchQuery: _Params): Promise<ResponseWithChainMeta<Wallet[]>> =>
1517
post<ResponseWithChainMeta<Wallet[]>>(client)("wallets/search", undefined, searchQuery);
18+
19+
export const walletTransactions = (client: HTTPClient) => (
20+
id: string,
21+
pagination: PaginationOptions = {},
22+
): Promise<ResponseWithChainMeta<Transaction[]>> =>
23+
get<ResponseWithChainMeta<Transaction[]>>(client)(`wallets/${id}/transactions`, { ...pagination });

src/clients/uns-client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
transactions,
3232
} from ".";
3333
import { DeepPartial } from "../utils/merge";
34+
import { walletTransactions } from "./repositories";
3435

3536
export class UNSClient {
3637
public http: HTTPClient;
@@ -152,6 +153,7 @@ export class UNSClient {
152153
get: walletGet(this.http),
153154
tokens: walletTokens(this.http),
154155
search: walletSearch(this.http),
156+
transactions: walletTransactions(this.http),
155157
};
156158
}
157159
}

0 commit comments

Comments
 (0)