diff --git a/.changeset/selfish-lions-trade.md b/.changeset/selfish-lions-trade.md new file mode 100644 index 00000000..700344eb --- /dev/null +++ b/.changeset/selfish-lions-trade.md @@ -0,0 +1,5 @@ +--- +"@rgbpp-sdk/ckb": minor +--- + +refactor: Filter xudt cell whose amount is valid for collector diff --git a/examples/xudt-on-ckb/2-transfer-xudt.ts b/examples/xudt-on-ckb/2-transfer-xudt.ts index 65a20cb5..e9f8ede4 100644 --- a/examples/xudt-on-ckb/2-transfer-xudt.ts +++ b/examples/xudt-on-ckb/2-transfer-xudt.ts @@ -97,7 +97,6 @@ const transferXudt = async ({ xudtType, receivers }: XudtTransferParams) => { outputs.push({ lock: fromLock, - type: xudtType, capacity: append0x(changeCapacity.toString(16)), }); outputsData.push('0x'); diff --git a/packages/ckb/src/collector/index.ts b/packages/ckb/src/collector/index.ts index 89a2641b..032e2290 100644 --- a/packages/ckb/src/collector/index.ts +++ b/packages/ckb/src/collector/index.ts @@ -137,6 +137,9 @@ export class Collector { let sumAmount = BigInt(0); const isRgbppLock = liveCells.length > 0 && isRgbppLockCellIgnoreChain(liveCells[0].output); for (const cell of liveCells) { + if (cell.outputData === '0x') { + continue; + } inputs.push({ previousOutput: { txHash: cell.outPoint.txHash,