@skalenetwork/bite
Version:
TS Library to interact with BITE protocol
84 lines (80 loc) • 2.81 kB
text/typescript
/**
* @license
* SKALE bite.ts
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
interface Transaction {
to: string;
data: string;
}
/**
* @license
* SKALE libte-ts
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* @file bite.ts
* @copyright SKALE Labs 2025-Present
*/
declare class BITE {
private readonly providerURL;
constructor(providerURL: string);
/**
* Encrypt a hex-encoded message using BLS public key.
* @param message - Hex string (with or without 0x).
*/
encryptMessage(message: string): Promise<string>;
/**
* Encrypt a transaction object using BLS public key.
* @param tx - The transaction to encrypt.
*/
encryptTransaction(tx: Transaction): Promise<Transaction>;
/**
* Fetch the common BLS public key from the configured endpoint.
*/
getCommonPublicKey(): Promise<string>;
/**
* Get decrypted transaction data using the configured endpoint.
* @param transactionHash - The hash of the transaction.
*/
getDecryptedTransactionData(transactionHash: string): Promise<string>;
}
declare class BITEMockup {
/**
* Simulates encryption of a hex-encoded message
*
* @param message - Hex string (with or without 0x).
*/
encryptMessage(message: string): Promise<string>;
/**
* Simulates encryption of a transaction object
*
* @param tx - The transaction to encrypt.
*/
encryptTransaction(tx: Transaction): Promise<Transaction>;
}
export { BITE, BITEMockup, type Transaction };