@ickb/sdk
Version:
iCKB SDK built on top of CCC
51 lines • 1.91 kB
TypeScript
import { ccc } from "@ckb-ccc/core";
import { CapacityManager, SmartTransaction, type ValueComponents } from "@ickb/utils";
import { type LogicManager, type OwnedOwnerManager } from "@ickb/core";
import { Info, OrderManager, Ratio, type OrderCell, type OrderGroup } from "@ickb/order";
import { getConfig } from "./constants.js";
export declare class IckbSdk {
private readonly ownedOwner;
private readonly ickbLogic;
private readonly order;
private readonly capacity;
private readonly bots;
constructor(ownedOwner: OwnedOwnerManager, ickbLogic: LogicManager, order: OrderManager, capacity: CapacityManager, bots: ccc.Script[]);
static from(...args: Parameters<typeof getConfig>): IckbSdk;
static estimate(isCkb2Udt: boolean, amounts: ValueComponents, system: SystemState, options?: {
fee?: ccc.Num;
feeBase?: ccc.Num;
}): {
convertedAmount: ccc.FixedPoint;
ckbFee: ccc.FixedPoint;
info: Info;
maturity: ccc.Num | undefined;
};
static maturity(o: OrderCell | {
info: Info;
amounts: ValueComponents;
}, system: SystemState): bigint | undefined;
request(tx: SmartTransaction, user: ccc.Signer | ccc.Script, info: Info, amounts: ValueComponents): Promise<void>;
collect(tx: SmartTransaction, groups: OrderGroup[], options?: {
isFulfilledOnly?: boolean;
}): void;
getL1State(client: ccc.Client, locks: ccc.Script[]): Promise<{
system: SystemState;
user: {
orders: OrderGroup[];
};
}>;
private getCkb;
}
export interface SystemState {
feeRate: ccc.Num;
tip: ccc.ClientBlockHeader;
exchangeRatio: Ratio;
orderPool: OrderCell[];
ckbAvailable: ccc.FixedPoint;
ckbMaturing: CkbCumulative[];
}
export interface CkbCumulative {
ckbCumulative: ccc.FixedPoint;
maturity: ccc.Num;
}
//# sourceMappingURL=sdk.d.ts.map