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.
// Providing an environment and address returns a boolean indicating:// true address is Blake160, Blake160Multisig, ACP, Onepass// false address is of another kind or invalidstatic isAddress(network: Environments, address: string): boolean;
This is probably the most useful method in this service for anyone using the sdk.
Constructor and class methods
We have omitted some of the methods for simplicity and because they should not be used outside of its context.
// ckbUrl is the url of the node rpc// indexerUrl is the url of the node indexer// env is the environment of the nodeconstructor(ckbUrl: string, indexerUrl: string, env: Environments);// Returns info of the blockchain connected by the rpcasync getBlockchainInfo(): Promise<ChainInfo>;// Gets latest block header in the blockchainasync getCurrentBlockHeader(): Promise<Header>;// Gets a block header from its hashasync getBlockHeaderFromHash(blockHash: string): Promise<Header>;// Get a block header from its hex numberasync getBlockHeaderFromNumber(blockNumber: string): Promise<Header>;// Gets a cell by its out pointasync getCell(outPoint: OutPoint): Promise<CellWithStatus>;// Gets a transaction with status from a hash// Useful for when the transaction is still not committed// For transactions that fave not finished you should set useMap = false to not receive the same!async getTransactionFromHash(transactionHash: string, useMap =true): Promise<TransactionWithStatus>;// Get current environmentgetEnvironment(): Environments;// Gets rpc. Useful if you want to use methods not implemented here// Check @ckb-lumos rpc class implementation for all the methodsgetRPC(): RPC;// Gets indexer. Useful if you want to use methods not implemented here// Check @ckb-lumos indexer class implementation for all the methodsgetIndexer(): IndexerType;// Get current ckb urlgetCKBUrl(): string;// Get current indexer urlgetIndexerUrl(): string;// Generates an address from a lock scriptgetAddressFromLock(lock: Script): string;// Gets the locks script from an addressgetLockFromAddress(address: string): Script;// Providing an address returns a boolean indicating:// true address is Blake160, Blake160Multisig, ACP, Onepass// false address is of another kind or invalidisAddress(address: string): boolean;
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.