Skip to content

Commit 6d183dd

Browse files
committed
Remove the tracker query from the tx API
1 parent 0a0843d commit 6d183dd

File tree

4 files changed

+4
-20
lines changed

4 files changed

+4
-20
lines changed

src/models/logic/transaction.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,9 @@ async function getTransactionHashes(params: {
399399
if (params.type != null) {
400400
where.type = { [Sequelize.Op.in]: params.type };
401401
}
402+
if (params.onlySuccessful) {
403+
where.errorHint = null;
404+
}
402405
if (params.includePending !== true) {
403406
where.isPending = false;
404407
}
@@ -435,7 +438,6 @@ export async function getTransactions(params: {
435438
address?: string | null;
436439
assetType?: H160 | null;
437440
type?: string[] | null;
438-
tracker?: H256 | null;
439441
page: number;
440442
itemsPerPage: number;
441443
includePending?: boolean | null;
@@ -516,13 +518,11 @@ export async function getNumberOfEachTransactionType(
516518

517519
function buildQueryForTransactions(params: {
518520
type?: string[] | null;
519-
tracker?: H256 | null;
520521
includePending?: boolean | null;
521522
onlySuccessful?: boolean | null;
522523
}) {
523524
return {
524525
...(params.type ? { type: { [Sequelize.Op.in]: params.type } } : {}),
525-
...(params.tracker ? { tracker: params.tracker.value } : {}),
526526
...(params.onlySuccessful ? { errorHint: null } : {}),
527527
...(params.includePending !== true ? { isPending: false } : {})
528528
/* FIXME: onlyConfirmed, confirmThreshold */

src/routers/transaction.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ export function handle(context: IndexerContext, router: Router) {
4747
* in: query
4848
* required: false
4949
* type: string
50-
* - name: tracker
51-
* description: filter by tracker
52-
* in: query
53-
* required: false
54-
* type: string
5550
* - name: type
5651
* description: filter by type such as mintAsset, transferAsset, etc. Multiple types can be given by comma separating.
5752
* in: query
@@ -113,7 +108,6 @@ export function handle(context: IndexerContext, router: Router) {
113108
const address = req.query.address;
114109
const assetTypeString = req.query.assetType;
115110
const type = req.query.type;
116-
const trackerString = req.query.tracker;
117111
const page = (req.query.page && parseInt(req.query.page, 10)) || 1;
118112
const itemsPerPage =
119113
(req.query.itemsPerPage &&
@@ -126,20 +120,15 @@ export function handle(context: IndexerContext, router: Router) {
126120
req.query.confirmThreshold &&
127121
parseInt(req.query.confirmThreshold, 10);
128122
let assetType;
129-
let tracker;
130123
try {
131124
if (assetTypeString) {
132125
assetType = new H160(assetTypeString);
133126
}
134-
if (trackerString) {
135-
tracker = new H256(trackerString);
136-
}
137127
const txInsts = await TxModel.getTransactions({
138128
address,
139129
assetType,
140130
type:
141131
typeof type === "string" ? type.split(",") : undefined,
142-
tracker,
143132
page,
144133
itemsPerPage,
145134
includePending,

src/routers/validator.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export const platformAddressSchema = Joi.string();
4242
// FIXME: PlatformAddress or AssetAddress
4343
const address = Joi.string();
4444
export const assetTypeSchema = Joi.string().regex(/^(0x)?[0-9a-f]{40}$/);
45-
const tracker = Joi.string().regex(/^(0x)?[0-9a-f]{64}$/);
4645
const type = Joi.string().regex(
4746
new RegExp(`^(${TYPES.join("|")})(,(${TYPES.join("|")}))*$`)
4847
);
@@ -74,7 +73,6 @@ export const paginationSchema = {
7473
export const txSchema = {
7574
address,
7675
assetType: assetTypeSchema,
77-
tracker,
7876
type,
7977
includePending,
8078
onlySuccessful,

test/api/transaction.spec.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,8 @@ describe("transaction-api", function() {
141141

142142
it("api /tx with args", async function() {
143143
const assetType = mintRubyTx.getMintedAsset().assetType;
144-
const tracker = mintRubyTx.tracker().value;
145144
await request(app)
146-
.get(
147-
`/api/tx?assetType=${assetType}&tracker=${tracker}&type=mintAsset`
148-
)
145+
.get(`/api/tx?assetType=${assetType}&type=mintAsset`)
149146
.expect(200)
150147
.expect(res =>
151148
expect(Object.keys(JSON.parse(res.text)).length).equal(1)

0 commit comments

Comments
 (0)