ckb-cell / rgbpp-sdk

Utilities for Bitcoin and RGB++ asset integration
ISC License
52 stars 16 forks source link

Check rgbpp change cell according to capacity of inputs and outputs #162

Closed duanyytop closed 3 months ago

duanyytop commented 3 months ago

Backgroud

Now the SDK determines whether a change cell and a paymaster cell are needed based on the difference in the number of inputs and outputs.

See: https://github.com/ckb-cell/rgbpp-sdk/blob/601741bfd3e23fa624071b767237fe89a8507dd1/packages/ckb/src/rgbpp/btc-transfer.ts#L172

But this is based on the fact that the capacity of the rgbpp cell is just enough to occupy and pay transaction fees, but the reality is not like this. For example, this transaction: https://explorer.nervos.org/transaction/0x5344b7a91d669b5c9e8bb8c5af602ac5860843f626495d34cf33f15845f59cce

Therefore, it is necessary for the SDK to determine whether the excess CKB needs to be returned to the sender and whether a paymaster cell is needed based on the capacity difference between inputs and outputs.

What should we do

TODO

duanyytop commented 3 months ago

https://github.com/ckb-cell/rgbpp-sdk/pull/168