@ckboost/booster
Version:
Liquidity provider toolkit for CKBoost - Create and manage ck-token liquidity pools on Internet Computer
142 lines (137 loc) • 4.49 kB
TypeScript
import { Principal } from '@dfinity/principal';
import { ActorMethod } from '@dfinity/agent';
/**
* ckTestBTCBooster - Clean interface for CKBoost operations
* Handles only the CKBoost-specific functionality from your working script
*/
declare class ckTestBTCBooster {
private actor;
private agent;
private identity;
private ledgerActor;
constructor(mnemonics: string, host?: string);
/**
* Create identity from mnemonics (your exact logic)
*/
private createIdentityFromMnemonics;
/**
* Initialize - now uses built-in IDL factory
*/
initialize(): Promise<void>;
/**
* Create ICRC-1 ledger actor (your exact logic)
*/
private createLedgerActor;
/**
* Register as booster
*/
registerBoosterAccount(): Promise<Result_1>;
/**
* Get booster account
*/
getBoosterAccount(principal?: Principal): Promise<[] | [BoosterAccount]>;
/**
* Update booster deposit
*/
updateBoosterDeposit(principal: Principal, amount: bigint): Promise<Result_1>;
/**
* Get pending boost requests
*/
getPendingBoostRequests(): Promise<BoostRequest[]>;
/**
* Accept boost request
*/
acceptBoostRequest(requestId: bigint): Promise<string>;
/**
* Transfer ckTESTBTC (your exact logic)
*/
transferCKTESTBTC(transferArgs: any): Promise<any>;
/**
* Get ckTESTBTC balance
*/
getCKTESTBTCBalance(account: any): Promise<any>;
/**
* Get current principal
*/
getPrincipal(): Promise<Principal>;
/**
* Get backend canister principal
*/
getBackendCanisterPrincipal(): Principal;
/**
* Get ledger canister principal
*/
getLedgerCanisterPrincipal(): Principal;
/**
* Convert BTC to satoshis
*/
btcToSatoshis(btcAmount: number): bigint;
/**
* Convert satoshis to BTC
*/
satoshisToBTC(satoshis: bigint): number;
}
type Amount = bigint;
type BoostId = bigint;
interface BoostRequest {
'id' : BoostId,
'status' : BoostStatus,
'receivedBTC' : Amount,
'confirmationsRequired' : bigint,
'owner' : Principal,
'maxFeePercentage' : number,
'createdAt' : Timestamp,
'subaccount' : Subaccount,
'booster' : [] | [Principal],
'updatedAt' : Timestamp,
'btcAddress' : [] | [string],
'amount' : Amount,
'preferredBooster' : [] | [Principal],
}
type BoostStatus = { 'active' : null } |
{ 'cancelled' : null } |
{ 'pending' : null } |
{ 'completed' : null };
interface BoosterAccount {
'availableBalance' : Amount,
'owner' : Principal,
'createdAt' : Timestamp,
'subaccount' : Subaccount,
'updatedAt' : Timestamp,
'totalDeposited' : Amount,
}
interface Main {
'acceptBoostRequest' : ActorMethod<[BoostId], string>,
'checkBTCDeposit' : ActorMethod<[BoostId], Result>,
'getAllBoostRequests' : ActorMethod<[], Array<BoostRequest>>,
'getAllBoosterAccounts' : ActorMethod<[], Array<BoosterAccount>>,
'getBoostRequest' : ActorMethod<[BoostId], [] | [BoostRequest]>,
'getBoostRequestBTCAddress' : ActorMethod<[BoostId], Result_2>,
'getBoosterAccount' : ActorMethod<[Principal], [] | [BoosterAccount]>,
'getCanisterPrincipal' : ActorMethod<[], Principal>,
'getDirectBTCAddress' : ActorMethod<[], string>,
'getPendingBoostRequests' : ActorMethod<[], Array<BoostRequest>>,
'getUserBoostRequests' : ActorMethod<[Principal], Array<BoostRequest>>,
'registerBoostRequest' : ActorMethod<
[Amount, number, bigint, [] | [Principal]],
Result
>,
'registerBoosterAccount' : ActorMethod<[], Result_1>,
'updateBoosterDeposit' : ActorMethod<[Principal, Amount], Result_1>,
'updateReceivedBTC' : ActorMethod<[BoostId, Amount], Result>,
'withdrawBoosterFunds' : ActorMethod<[Amount], string>,
}
type Result = { 'ok' : BoostRequest } |
{ 'err' : string };
type Result_1 = { 'ok' : BoosterAccount } |
{ 'err' : string };
type Result_2 = { 'ok' : string } |
{ 'err' : string };
type Subaccount = Uint8Array | number[];
type Timestamp = bigint;
interface _SERVICE extends Main {}
declare const ckTESTBTC_CANISTER_IDS: {
readonly CKBOOST_BACKEND: "75egi-7qaaa-aaaao-qj6ma-cai";
readonly CKTESTBTC_LEDGER: "mc6ru-gyaaa-aaaar-qaaaq-cai";
};
export { type BoostRequest as ckTESTBTCBoostRequest, type BoosterAccount as ckTESTBTCBoosterAccount, type Result as ckTESTBTCResult, type Result_1 as ckTESTBTCResult_1, type _SERVICE as ckTESTBTCService, ckTESTBTC_CANISTER_IDS, ckTestBTCBooster };