Connection
A connection to a fullnode JSON RPC endpoint
Constructor Summary
Public Constructor | ||
public |
constructor(endpoint: string) Establish a JSON RPC connection |
Method Summary
Public Methods | ||
public |
async confirmTransaction(signature: TransactionSignature): Promise<boolean> Confirm the transaction identified by the specified signature |
|
public |
async getAccountInfo(publicKey: PublicKey): Promise<AccountInfo> Fetch all the account info for the specified public key |
|
public |
async getBalance(publicKey: PublicKey): Promise<number> Fetch the balance for the specified public key |
|
public |
async getLastId(): Promise<TransactionId> Fetch the identifier to the latest transaction on the network |
|
public |
async getSignatureStatus(signature: TransactionSignature): Promise<SignatureStatus> Fetch the current transaction count of the network |
|
public |
async getTransactionCount(): Promise<number> Fetch the current transaction count of the network |
|
public |
onAccountChange(publicKey: PublicKey, callback: AccountChangeCallback): number Register a callback to be invoked whenever the specified account changes |
|
public |
async removeAccountChangeListener(id: number): Promise<void> Deregister an account notification callback |
|
public |
async requestAirdrop(to: PublicKey, amount: number): Promise<TransactionSignature> Request an allocation of tokens to the specified account |
|
public |
async sendRawTransaction(rawTransaction: Buffer): Promise<TransactionSignature> Send a transaction that has already been signed and serialized into the wire format |
|
public |
async sendTransaction(transaction: Transaction, signers: ...Array<Account>): Promise<TransactionSignature> Sign and send a transaction |
Public Constructors
Public Methods
public async confirmTransaction(signature: TransactionSignature): Promise<boolean> source
Confirm the transaction identified by the specified signature
Params:
Name | Type | Attribute | Description |
signature | TransactionSignature |
public async getAccountInfo(publicKey: PublicKey): Promise<AccountInfo> source
Fetch all the account info for the specified public key
Params:
Name | Type | Attribute | Description |
publicKey | PublicKey |
public async getBalance(publicKey: PublicKey): Promise<number> source
Fetch the balance for the specified public key
Params:
Name | Type | Attribute | Description |
publicKey | PublicKey |
public async getLastId(): Promise<TransactionId> source
Fetch the identifier to the latest transaction on the network
public async getSignatureStatus(signature: TransactionSignature): Promise<SignatureStatus> source
Fetch the current transaction count of the network
Params:
Name | Type | Attribute | Description |
signature | TransactionSignature |
public async getTransactionCount(): Promise<number> source
Fetch the current transaction count of the network
public onAccountChange(publicKey: PublicKey, callback: AccountChangeCallback): number source
Register a callback to be invoked whenever the specified account changes
Params:
Name | Type | Attribute | Description |
publicKey | PublicKey | Public key of the account to monitor |
|
callback | AccountChangeCallback | Function to invoke whenever the account is changed |
public async removeAccountChangeListener(id: number): Promise<void> source
Deregister an account notification callback
Params:
Name | Type | Attribute | Description |
id | number | subscription id to deregister |
public async requestAirdrop(to: PublicKey, amount: number): Promise<TransactionSignature> source
Request an allocation of tokens to the specified account
public async sendRawTransaction(rawTransaction: Buffer): Promise<TransactionSignature> source
Send a transaction that has already been signed and serialized into the wire format
Params:
Name | Type | Attribute | Description |
rawTransaction | Buffer |
public async sendTransaction(transaction: Transaction, signers: ...Array<Account>): Promise<TransactionSignature> source
Sign and send a transaction
Params:
Name | Type | Attribute | Description |
transaction | Transaction | ||
signers | ...Array<Account> |