ConnectionService
The connection service is the one necessary to communicate with the node and to make any kind of call to it. Most of the methods are used by other services but there are few that may be useful for you app.
Relevant Types
export enum Environments {
Mainnet = "mainnet",
Testnet = "testnet",
}
export type HexString = string;
export type Hexadecimal = string;
export type Hash = HexString;
export type HexNumber = Hexadecimal;
export type PackedSince = string;
export type PackedDao = string;
export type Address = string;
export interface ChainInfo {
chain: string;
median_time: HexNumber;
epoch: HexNumber;
difficulty: HexNumber;
is_initial_block_download: boolean;
alerts: AlertMessage[];
}
export interface AlertMessage {
id: HexNumber;
priority: HexNumber;
notice_until: HexNumber;
message: string;
}
export interface Header {
timestamp: HexNumber;
number: HexNumber;
epoch: HexNumber;
compact_target: HexNumber;
dao: Hash;
hash: Hash;
nonce: HexNumber;
parent_hash: Hash;
proposals_hash: Hash;
transactions_root: Hash;
extra_hash: Hash;
version: HexNumber;
}
export interface CellWithStatus {
cell: {
data: {
content: HexString;
hash: Hash;
};
output: Output;
} | null;
status: "live" | "unknown";
}
export interface TransactionWithStatus {
transaction: Transaction;
tx_status: TxStatus;
}
export interface TxStatus {
block_hash?: Hash;
status: string;
}
export interface Transaction {
cell_deps: CellDep[];
hash?: Hash;
header_deps: Hash[];
inputs: Input[];
outputs: Output[];
outputs_data: HexString[];
version: HexNumber;
witnesses: HexString[];
}
export interface Input {
previous_output: OutPoint;
since: PackedSince;
}
export interface OutPoint {
tx_hash: Hash;
index: HexNumber;
}
export interface Output {
capacity: HexString;
lock: Script;
type?: Script;
}
export interface Script {
code_hash: Hash;
hash_type: HashType;
args: HexString;
}
export type HashType = "type" | "data" | "data1";Static methods
Constructor and class methods
The method getTransactionFromHash can be used but returns a different type of transaction. Better use the WalletService option as it is the same type as getTransactions.
Last updated