Closed ShookLyngs closed 3 months ago
Mocked a test for the transfer-all-of-an-rgbpp-xudt-asset
feature with @Dawn-githup:
XTT
, from Alice to Bob41 XTT
500 XTT
The expected result:
500 XTT
to Bob in 2 transactions because each CKB can contain up to 40 RGBPP cells41 XTT
should be excluded during the transfer process, because too much L2 cells have been bound to a single L1 output, while each CKB transaction can include up to 40 RGBPP cellsThe actual transaction groups generated from the process:
- The L1 fees should be paid with the L1 RGBPP outputs because the fee rate is low
Have you tested the case where the BTC transaction requires additional inputs to pay tx fee? @ShookLyngs @Dawn-githup
- The L1 fees should be paid with the L1 RGBPP outputs because the fee rate is low
Have you tested the case where the BTC transaction requires additional inputs to pay tx fee? @ShookLyngs @Dawn-githup
When the fee rate is higher, utxo will be collected from the from address to pay the fee.
[x] Update apps/service
in a separate PR? @ShookLyngs
https://github.com/ckb-cell/rgbpp-sdk/pull/278
[ ] Update https://github.com/ckb-cell/rgbpp-sdk-python @duanyytop
[ ] Prepare integration tests with apps/service
and ckb-cell/rgbpp-sdk-python @Dawn-githup
[ ] Record all the tested transactions @Dawn-githup
@duanyytop and I had a few discussions about the PR:
.env
file for the rgbpp lib is redundant, as all tests in the rgbpp lib are mocked. Can it be removed?My thoughts:
The
.env
file for the rgbpp lib is redundant, as all tests in the rgbpp lib are mocked. Can it be removed?
The btc/ckb lib contain some methods that are not mockable, meaning that when calling the buildRgbppTransferAllTxs
API, actual network requests must be sent. So, while the .env
file can be removed, we still need to provide a default environment so the tests can run as expected. I'm not sure if it's worth it.
I think @duanyytop is concerned about redundant test cases, as there are too many "same pieces of code" in the examples and integration tests. If we add more tests to the rgbpp lib alone, that would increase redundancy.
Personally, I believe the unit tests for the rgbpp library are different from the examples and integration tests because the unit tests allow more room for unexpected cases. However, writing tests for the buildRgbppTransferAllTxs
API is challenging and requires a lot of preparation. Maybe @Dawn-github can write integration tests for the feature, and then we can remove the mocked tests from the rgbpp lib, making the .env
file unnecessary.
Should we keep the rgbpp lib as simple as possible, instead of adding a lot of utilities to it?
Agreed, so I moved most of the utilities from the rgbpp lib to the btc/ckb libs at c492cf3.
Developers may need an example for the transfer-all feature when writing.
Yes, but it would be hard to write a set of examples just to prepare the assets. If we provide only one example for users who already have many assets, it would be much easier. We may add such example in examples/rgbpp/xudt/btc-transfer-all/1-btc-transfer-all.ts
.
Regarding the transfer-all example, we are currently facing an issue: if we use this file to create a BTC account and sign transactions, with createBtcAccount
it won’t support mixed-type addresses when using .env
.
@Flouse @ShookLyngs
Regarding the transfer-all example, we are currently facing an issue: if we use this file to create a BTC account and sign transactions, with
createBtcAccount
it won’t support mixed-type addresses when using.env
.
I think it depends on how complicated the examples need to be. If we're writing a simple example that transfers all XUDT1 from A to B, then a single account is enough. However, if we're writing an example that transfers all XUDT1 from [A, B] to C, then we'll need at least 2 accounts for signing.
It's best to draft a TODO list of the examples first. cc @Flouse @Dawn-githup
It's best to draft a TODO list of the examples first. cc @Flouse @Dawn-githup
https://github.com/ckb-cell/rgbpp-sdk/commit/10f045774d705adbf44b1dcf3bf3ce34866a433b
- This is a simple example using a single account transfer-all
ok, please add an introduction to https://github.com/ckb-cell/rgbpp-sdk/blob/develop/examples/rgbpp/README.md to explain the use case of this example later.
Changes
buildRgbppTransferAllTxs()
API to generate one or more BTC/CKB transaction groups for transferring the entire amount of a specific type of RGBPP XUDT asset from one or more BTC addresses to a recipientsendRgbppTxGroups()
API for sending BTC/CKB transaction groups to theBtcAssetsApi
TODOs
Update examples? (no place for the example)