diff --git a/src/endpoints/v2.ts b/src/endpoints/v2.ts index 2b339be..6221902 100644 --- a/src/endpoints/v2.ts +++ b/src/endpoints/v2.ts @@ -1,4 +1,4 @@ -import { APIClient, Asset, Checksum256Type, Int64Type, NameType, PublicKeyType } from "@wharfkit/antelope" +import { APIClient, Asset, Checksum256Type, Int64Type, NameType, PublicKeyType, TimePointType, UInt64Type } from "@wharfkit/antelope" import { V2 } from "../types" export class HyperionV2APIClient { @@ -208,4 +208,22 @@ export class HyperionV2HistoryAPIClient { responseType: V2.GetTransactionResponse, }) } + + async get_transfers(params: { + from?: NameType; + to?: NameType; + symbol?: NameType; + contract?: NameType; + skip?: UInt64Type; + limit?: UInt64Type; + after?: TimePointType; + before?: TimePointType; + }): Promise { + const queryParams = new URLSearchParams(params as any).toString(); + return this.client.call({ + path: `/v2/history/get_transfers?${queryParams}`, + method: 'GET', + // responseType: V2.GetTransfersResponse, + }); + } } diff --git a/test/api.ts b/test/api.ts index 544f424..726c725 100644 --- a/test/api.ts +++ b/test/api.ts @@ -152,6 +152,14 @@ suite('Hyperion API', function () { assert.instanceOf(response.creator, Name); assert.equal(String(response.creator), "gqyqi.waa"); }) + + test('get_transfers', async function () { + const response = await hyperion.v2.history.get_transfers({ from: 'teamgreymass' }); + + assert.isArray(response.transfers); + assert.equal(response.transfers.length, 10); + assert.instanceOf(response.transfers[0].from, Name); + }) }) }) })