ggez-banking-sdk
Version:
A Node.js package to handle GGEZ Banking API endpoints, Simplify the process of managing CRUD operations with this efficient and easy-to-use package.
150 lines (149 loc) • 3.77 kB
TypeScript
import { ChainType } from "../constants";
import { IBaseResult } from "./commonInterface";
export interface ICoin {
amount: string;
denom: string;
}
interface IAuthentication {
type: number;
code: string;
}
interface IBaseRequest {
info: {
account_id: number;
chain_type: ChainType;
};
authentication: IAuthentication[];
}
interface IBaseResponse {
info: {
user_id: number;
account_id: number;
program_id: number;
chain_address: string;
validator_address: string;
memo: string;
type: number;
chain_type: number;
client_date: string;
server_date: string;
date_utc: string;
source_time_zone: string;
source_id: string;
};
authentication: IAuthentication[];
fee?: ICoin;
result: IBaseResult;
}
export interface ISend {
address: string;
coins: ICoin[];
}
export interface IMultiSend {
recipients: ISend[];
}
export interface IDelegation {
validator_address: string;
coin: ICoin;
}
export interface ISendTransaction {
transaction_data: {
send: ISend;
multi_send?: undefined;
delegate?: undefined;
undelegate?: undefined;
};
}
export interface IMultiSendTransaction {
transaction_data: {
send?: undefined;
multi_send: IMultiSend;
delegate?: undefined;
undelegate?: undefined;
};
}
export interface IDelegateTransaction {
transaction_data: {
send?: undefined;
multi_send?: undefined;
delegate: IDelegation;
undelegate?: undefined;
};
}
export interface IUndelegateTransaction {
transaction_data: {
send?: undefined;
multi_send?: undefined;
delegate?: undefined;
undelegate: IDelegation;
};
}
export interface IBlockchainSendRequest extends IBaseRequest {
transaction_data: {
send: ISend;
multi_send?: undefined;
delegate?: undefined;
undelegate?: undefined;
};
}
export interface IBlockchainMultiSendRequest extends IBaseRequest {
transaction_data: {
send?: undefined;
multi_send: IMultiSend;
delegate?: undefined;
undelegate?: undefined;
};
}
export interface IBlockchainDelegateRequest extends IBaseRequest {
transaction_data: {
send?: undefined;
multi_send?: undefined;
delegate: IDelegation;
undelegate?: undefined;
};
}
export interface IBlockchainUndelegateRequest extends IBaseRequest {
transaction_data: {
send?: undefined;
multi_send?: undefined;
delegate?: undefined;
undelegate: IDelegation;
};
}
export interface IBlockchainSendResponse extends IBaseResponse {
transaction_data: {
send: ISend;
multi_send: null;
delegate: null;
undelegate: null;
};
}
export interface IBlockchainMultiSendResponse extends IBaseResponse {
transaction_data: {
send: null;
multi_send: IMultiSend;
delegate: null;
undelegate: null;
};
}
export interface IBlockchainDelegateResponse extends IBaseResponse {
transaction_data: {
send: null;
multi_send: null;
delegate: IDelegation;
undelegate: null;
};
}
export interface IBlockchainUndelegateResponse extends IBaseResponse {
transaction_data: {
send: null;
multi_send: null;
delegate: null;
undelegate: IDelegation;
};
}
export type IBlockchainRequestData = IBlockchainSendRequest | IBlockchainMultiSendRequest | IBlockchainDelegateRequest | IBlockchainUndelegateRequest;
export type IBlockchainResponseData = IBaseResponse & {
fee: ICoin | null;
};
export {};