Skip to content
This repository was archived by the owner on May 27, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/large-nails-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rgbpp-sdk/ckb": minor
---

refactor: Collect all RGB++ inputs without isMax parameter
3 changes: 2 additions & 1 deletion packages/ckb/src/collector/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export class Collector {
const changeCapacity = config?.minCapacity ?? MIN_CAPACITY;
const inputs: CKBComponents.CellInput[] = [];
let sumInputsCapacity = BigInt(0);
const isRgbppLock = liveCells.length > 0 && isRgbppLockCellIgnoreChain(liveCells[0].output);
for (const cell of liveCells) {
inputs.push({
previousOutput: {
Expand All @@ -119,7 +120,7 @@ export class Collector {
since: '0x0',
});
sumInputsCapacity += BigInt(cell.output.capacity);
if (sumInputsCapacity >= needCapacity + changeCapacity + fee && !config?.isMax) {
if (sumInputsCapacity >= needCapacity + changeCapacity + fee && !isRgbppLock) {
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ckb/src/rgbpp/launch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const genRgbppLaunchCkbVirtualTx = async ({
const infoCellCapacity = calculateRgbppTokenInfoCellCapacity(rgbppTokenInfo, isMainnet);

const txFee = MAX_FEE;
const { inputs, sumInputsCapacity } = collector.collectInputs(emptyCells, infoCellCapacity, txFee, { isMax: true });
const { inputs, sumInputsCapacity } = collector.collectInputs(emptyCells, infoCellCapacity, txFee);

let rgbppCellCapacity = sumInputsCapacity - infoCellCapacity;
const outputs: CKBComponents.CellOutput[] = [
Expand Down
1 change: 0 additions & 1 deletion packages/ckb/src/types/collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export interface CollectUdtResult extends CollectResult {
}

export interface CollectConfig {
isMax?: boolean;
minCapacity?: bigint;
errMsg?: string;
}