Skip to content
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
16 changes: 9 additions & 7 deletions src/types/models/account.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
export type Asset = {
unit: string;
quantity: string;
};
import { TransferStatus } from '../requests';

export type AccountBalance = {
asset: string;
Expand All @@ -10,6 +7,12 @@ export type AccountBalance = {
locked: bigint;
};

export type TransferalAsset = {
asset: string;
asset_unit: string;
qty: bigint;
};

export type AccountStream = {
type: 'Account';
sub_type: string;
Expand All @@ -21,16 +24,15 @@ export type AccountBalanceStream = {
balance: AccountBalance[];
};

export type TransferStatus = 'pending' | 'confirmed';

export type TransferalType = 'normal' | 'deposit' | `withdrawal`;

export type TransferDirection = 'incoming' | 'outgoing';

export type TransferalRecord = {
created_at: string;
status: TransferStatus;
assets: Asset[];
assets: TransferalAsset[];
transferal_type: TransferalType;
tx_hash: string;
direction: TransferDirection;
};
11 changes: 10 additions & 1 deletion src/types/requests/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { UTxO } from '@meshsdk/core';
import { TradingSymbol, OrderSide, OrderType } from '../models/order';
import { Asset, TransferStatus } from '../models';
import { TransferalType } from '../models/account';

// SignInRequest to be refactored
export type SignInRequest = {
Expand All @@ -16,6 +16,11 @@ export type SignInRequest = {
// quantity: number;
// };

export type Asset = {
unit: string;
quantity: string;
};

export type BuildDepositTransactionRequest = {
deposit_amount: Asset[];
input_utxos: UTxO[];
Expand All @@ -36,6 +41,7 @@ export type SubmitWithdrawalTransactionRequest = {
export type BuildTransferalTransactionRequest = {
transferal_amount: Asset[];
to_address: string;
transferal_type: TransferalType;
};

export type SubmitTransferalTransactionRequest = {
Expand All @@ -45,6 +51,7 @@ export type SubmitTransferalTransactionRequest = {
export type BuildTransferalRequestTransactionRequest = {
transferal_amount: Asset[];
from_address: string;
transferal_type: TransferalType;
};

export type SubmitTransferalRequestTransactionRequest = {
Expand Down Expand Up @@ -102,6 +109,8 @@ export type GetOrderRecordRequest = {
page?: number; // default number is 1 while number must be between 1 and 1000
};

export type TransferStatus = 'pending' | 'confirmed';

export type GetTransferalRecordsRequest = {
status: TransferStatus; // Must be either 'pending' | 'confirmed'
limit?: number; // default number is 10 while number must be between 1 and 250
Expand Down