bam-ticketing-sdk
Version:
SDK for B.A.M Ticketing API
60 lines • 2.49 kB
TypeScript
import { AxiosInstance } from 'axios';
import { Digest, KeyPair, TxStatus, SignedDigest, TransactionProposalPayload, BlockchainFunctionParams } from './types';
import { HealthStatus } from '../common/types';
/**
* Service class for blockchain transactions.
*/
export declare class BlockchainService {
readonly client: AxiosInstance;
readonly version: string;
constructor(client: AxiosInstance, version: string);
/**
* Returns true if the service is reachable
*
* @returns Services' online status
*/
health(): Promise<HealthStatus>;
/**
* This is the first step in committing data to the blockchain.
* Creates a new proposal which need to be signed with the private key.
*
* @param proposal New proposal data
* @returns Digest hash of the proposal
*/
createProposal(proposal: TransactionProposalPayload): Promise<Digest>;
/**
* This is the second step in committing data to the blockchain.
* Submits the proposal signature so that it can be endorsed.
* It is signed with the user's private key.
*
* @param proposal Proposal's digest and signature
* @returns Transaction (tx) digest, used in the commit transaction step
*/
createTransaction(proposal: SignedDigest): Promise<Digest>;
/**
* Third and final step in creating a transaction.
* Commits a transaction. Once a proposal is submitted,
* signed and endorsed it can be committed as a transaction to the blockchain.
*
* @param tx Signed transaction
* @returns Status of the transaction
*/
commitTransaction(tx: SignedDigest): Promise<TxStatus>;
/**
* Creates a proposal, signs it and commits it to the blockchain.
*
* @param proposal Transaction proposal containing the bc function and arguments
* @param keys Private key and certificate to sign the intermediate steps
* @returns Transaction commit status
*/
sendTransaction(proposal: BlockchainFunctionParams, keys: KeyPair): Promise<TxStatus>;
/**
* Sends online transaction to the blockchain service.
*
* @param proposal Transaction proposal containing the bc function and arguments
* @param keys Private key and certificate for which the transaction should be invoked.
* @returns Response from the chaincode.
*/
sendOnlineTransaction(proposal: BlockchainFunctionParams, keys: KeyPair): Promise<any>;
}
//# sourceMappingURL=service.d.ts.map