UNPKG

@skalenetwork/bite

Version:

TS Library to interact with BITE protocol

124 lines (118 loc) 4.31 kB
/** * @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 helper.ts * @copyright SKALE Labs 2025-Present */ interface CommitteeInfo { commonBLSPublicKey: string; epochId: number; } /** * @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; gasLimit?: 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>; /** * Encrypt a hex-encoded message using BLS public key for CTX. * @param message - Hex string (with or without 0x). * @param ctxSubmitterAddress - Smart Contract Address for aadTE. */ encryptMessageForCTX(message: string, ctxSubmitterAddress: string): Promise<string>; /** * Encrypt a transaction object using BLS public key and provided committees info. * @param tx - The transaction to encrypt. * @param committees - The committees info object. */ static encryptTransactionWithCommitteeInfo(tx: Transaction, committees: CommitteeInfo[]): Promise<Transaction>; /** * Fetch the committees info from the configured endpoint. */ getCommitteesInfo(): Promise<CommitteeInfo[]>; /** * 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 };