Skip to content

Commit

Permalink
chore: added get_transfers
Browse files Browse the repository at this point in the history
  • Loading branch information
dafuga committed Sep 23, 2023
1 parent 22e74a8 commit 40ab9d6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/endpoints/v2.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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<any> {
const queryParams = new URLSearchParams(params as any).toString();
return this.client.call({
path: `/v2/history/get_transfers?${queryParams}`,
method: 'GET',
// responseType: V2.GetTransfersResponse,
});
}
}
8 changes: 8 additions & 0 deletions test/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
})
})
})

0 comments on commit 40ab9d6

Please sign in to comment.