Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENG-3615: getOrdinalsFtBalance Improvements #353

Merged
merged 8 commits into from
Jan 22, 2024
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
5 changes: 3 additions & 2 deletions api/ordinals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@
timeout: 30000,
transformResponse: [(data) => parseOrdinalTextContentData(data)],
})
.then((response) => response!.data)

Check warning on line 112 in api/ordinals.ts

View workflow job for this annotation

GitHub Actions / test

Forbidden non-null assertion
.catch((error) => {

Check warning on line 113 in api/ordinals.ts

View workflow job for this annotation

GitHub Actions / test

'error' is defined but never used
return '';
});
}
Expand Down Expand Up @@ -141,17 +141,18 @@
})
.then((response) => {
if (response.data) {
const responseTokensList = response!.data;

Check warning on line 144 in api/ordinals.ts

View workflow job for this annotation

GitHub Actions / test

Forbidden non-null assertion
const tokensList: Array<FungibleToken> = [];
responseTokensList.forEach((responseToken: any) => {

Check warning on line 146 in api/ordinals.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
const token: FungibleToken = {
name: responseToken.ticker,
balance: responseToken.overallBalance,
total_sent: '0',
total_received: '0',
principal: '',
principal: responseToken.ticker?.toUpperCase(),
assetName: '',
ticker: responseToken.ticker,
ticker: responseToken.ticker?.toUpperCase(),

decimals: 0,
image: '',
visible: true,
Expand All @@ -166,7 +167,7 @@
return [];
}
})
.catch((error) => {

Check warning on line 170 in api/ordinals.ts

View workflow job for this annotation

GitHub Actions / test

'error' is defined but never used
return [];
});
}
Expand Down
6 changes: 6 additions & 0 deletions types/api/shared/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,9 @@ export interface ContractCall {
function_signature: string;
function_args: FunctionArg[];
}

export interface BaseToken {
name: string;
ticker?: string;
image?: string;
}
12 changes: 7 additions & 5 deletions types/api/stacks/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import {
uintCV,
} from '@stacks/transactions';
import { StxMempoolTransactionData } from '../../../types';
import { ContractCall, TransactionPostCondition, TransactionStatus, TransactionType } from '../shared/transaction';
import {
BaseToken,
ContractCall,
TransactionPostCondition,
TransactionStatus,
TransactionType } from '../shared/transaction';

export { cvToHex, uintCV };
export type { StacksTransaction, TokenTransferPayload };
Expand Down Expand Up @@ -130,16 +135,13 @@ export type Transfer = {
recipient: string;
};

export type FungibleToken = {
name: string;
export type FungibleToken = BaseToken & {
balance: string;
total_sent: string;
total_received: string;
principal: string;
assetName: string;
ticker?: string;
decimals?: number;
image?: string;
visible?: boolean;
supported?: boolean;
tokenFiatRate?: number | null;
Expand Down
7 changes: 3 additions & 4 deletions types/api/xverse/coins.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
export interface Coin {
import { BaseToken } from "../shared/transaction";

export interface Coin extends BaseToken {
id?: number;
name: string;
contract: string;
description?: string;
ticker?: string;
image?: string;
decimals?: number;
supported?: boolean;
tokenFiatRate?: number | null;
Expand Down
Loading