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
When xUDT needs change, it is decided based on the capacity difference between inputs and outputs whether the excess CKB needs to be returned to the sender.
Determine whether a paymaster cell is needed based on the capacity difference between inputs and outputs
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