Skip to content
This repository was archived by the owner on May 27, 2025. It is now read-only.

Commit a93f14c

Browse files
authored
Merge pull request #265 from ckb-cell/release/0.5.0
Merge release/0.5.0 to main branch
2 parents b802eb1 + 2cf54a0 commit a93f14c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1559
-1988
lines changed

.github/workflows/integration-test.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ name: Integration Tests
44

55
on:
66
workflow_dispatch:
7+
pull_request:
78
# Run integration-tests every day
89
schedule:
910
- cron: '59 0 * * *'
@@ -48,9 +49,9 @@ jobs:
4849
if: ${{ matrix.env_set == 'xudt' }}
4950
run: pnpm run integration:xudt
5051
env:
51-
VITE_SERVICE_URL: https://api.signet.rgbpp.io
52-
VITE_SERVICE_TOKEN: ${{ secrets.SIGNET_SERVICE_TOKEN }}
53-
VITE_SERVICE_ORIGIN: https://api.signet.rgbpp.io
52+
VITE_SERVICE_URL: https://btc-assets-api.testnet.mibao.pro
53+
VITE_SERVICE_TOKEN: ${{ secrets.TESTNET_SERVICE_TOKEN }}
54+
VITE_SERVICE_ORIGIN: https://btc-assets-api.testnet.mibao.pro
5455
INTEGRATION_CKB_PRIVATE_KEY: ${{ secrets.INTEGRATION_CKB_PRIVATE_KEY }}
5556
INTEGRATION_BTC_PRIVATE_KEY: ${{ secrets.INTEGRATION_BTC_PRIVATE_KEY }}
5657

@@ -59,8 +60,8 @@ jobs:
5960
if: ${{ matrix.env_set == 'spore' }}
6061
run: pnpm run integration:spore
6162
env:
62-
VITE_SERVICE_URL: https://api.signet.rgbpp.io
63-
VITE_SERVICE_TOKEN: ${{ secrets.SIGNET_SERVICE_TOKEN }}
64-
VITE_SERVICE_ORIGIN: https://api.signet.rgbpp.io
63+
VITE_SERVICE_URL: https://btc-assets-api.testnet.mibao.pro
64+
VITE_SERVICE_TOKEN: ${{ secrets.TESTNET_SERVICE_TOKEN }}
65+
VITE_SERVICE_ORIGIN: https://btc-assets-api.testnet.mibao.pro
6566
INTEGRATION_CKB_PRIVATE_KEY: ${{ secrets.INTEGRATION_CKB_SPORE_PRIVATE_KEY }}
6667
INTEGRATION_BTC_PRIVATE_KEY: ${{ secrets.INTEGRATION_BTC_SPORE_PRIVATE_KEY }}

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
with:
6767
script: |
6868
const packages = JSON.parse(process.env.PACKAGES)
69-
const packagesTable = packages.map((p) => `| ${p.name} | \`${p.version}\` |`)
69+
const packagesTable = packages.map((p) => `| ${p.name} | \`${p.version}\` |`).join('\n')
7070
const body = ['New official version of the rgbpp-sdk packages have been released:', '| Name | Version |', '| --- | --- |', packagesTable].join('\n')
7171
github.rest.repos.createCommitComment({
7272
commit_sha: context.sha,

.github/workflows/snapshot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
with:
8282
script: |
8383
const packages = JSON.parse(process.env.PACKAGES)
84-
const packagesTable = packages.map((p) => `| ${p.name} | \`${p.version}\` |`)
84+
const packagesTable = packages.map((p) => `| ${p.name} | \`${p.version}\` |`).join('\n')
8585
const body = ['New snapshot version of the rgbpp-sdk packages have been released:', '| Name | Version |', '| --- | --- |', packagesTable].join('\n')
8686
github.rest.repos.createCommitComment({
8787
commit_sha: context.sha,

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,20 @@ This repository offers utilities for Bitcoin and RGB++ asset integration.
88
- [@rgbpp-sdk/ckb](./packages/ckb): Nervos CKB part of the SDK
99
- [@rgbpp-sdk/service](./packages/service): Wrapped interfaces of `Bitcoin/RGB++ Assets Service`
1010

11+
1112
## RGB++ Code Examples
1213

1314
- Find code examples at https://github.com/ckb-cell/rgbpp-sdk/tree/develop/examples/rgbpp
1415

16+
1517
## Related CKB Scripts (Contracts)
16-
- [CKB Bitcoin SPV Type Script](https://github.com/ckb-cell/ckb-bitcoin-spv-contracts/tree/master/contracts/ckb-bitcoin-spv-type-lock): A [type script](https://docs.nervos.org/docs/basics/glossary#type-script) for [Bitcoin SPV](https://bitcoinwiki.org/wiki/simplified-payment-verification) clients which synchronize [Bitcoin](https://bitcoin.org) state into [CKB](https://github.com/nervosnetwork/ckb)
18+
- [CKB Bitcoin SPV Type Script](https://github.com/ckb-cell/ckb-bitcoin-spv-contracts/tree/master/contracts/ckb-bitcoin-spv-type-lock): A [type script](https://docs-old.nervos.org/docs/basics/glossary#type-script) for [Bitcoin SPV](https://bitcoinwiki.org/wiki/simplified-payment-verification) clients which synchronize [Bitcoin](https://bitcoin.org) state into [CKB](https://github.com/nervosnetwork/ckb)
19+
20+
- **RGB++ scripts/contracts**: [RgbppLockScript](https://github.com/ckb-cell/rgbpp/tree/main/contracts/rgbpp-lock) and [BtcTimeLockScript](https://github.com/ckb-cell/rgbpp/tree/main/contracts/btc-time-lock)
21+
* design docs: https://github.com/ckb-cell/RGBPlusPlus-design/blob/main/docs/lockscript-design-prd-en.md
22+
* testnet deployment: https://pudge.explorer.nervos.org/scripts#RGB++
23+
* mainnet deployment: https://explorer.nervos.org/scripts#RGB++
1724

18-
- [RgbppLockScript and BtcTimeLockScript](https://github.com/ckb-cell/rgbpp-sdk/blob/63df2dcd95b1b735b5d235e156e4361a3c87b0ac/packages/ckb/src/constants/index.ts#L12-L206)
19-
* design: https://github.com/ckb-cell/RGBPlusPlus-design/blob/main/docs/light-paper-en.md
20-
* testnet: https://pudge.explorer.nervos.org/scripts#RGB++
21-
* mainnet: https://explorer.nervos.org/scripts#RGB++
2225

2326
## RGB++ Asset Workflow Overview
2427

@@ -50,9 +53,11 @@ This repository offers utilities for Bitcoin and RGB++ asset integration.
5053
2. continuously fetch request from the queue through a **cron job**
5154
3. check whether the **confirmations** of `req.rgbpp_btc_txid` is sufficient
5255
4. generate the **witnesses for RgbppLocks** in the `rgbpp_ckb_tx_virtual`
53-
5. add a **paymaster cell** into `rgbpp_ckb_tx_virtual`.inputs if the CKB capacity is insufficient
56+
5. add a **paymaster cell** into `rgbpp_ckb_tx_virtual` inputs if the CKB capacity is insufficient
5457
1. need to **verify the existence of paymaster UTXO** in the rgbpp_btc_tx
58+
> based on the exchange rates of BTC and CKB, [the paymaster BTC UTXO's value](https://api.rgbpp.io/docs/static/index.html#/RGB%2B%2B/get_rgbpp_v1_paymaster_info) required to subsidize a paymaster CKB cell is approximately: `paymaster_utxo_sats ~= 316 * ${ckb_price} / ${btc_price} * 100000000`
5559
2. sign the paymaster cell and the entire transaction if needed
60+
5661
6. **finalize** the `rgbpp_ckb_tx_virtual` to a `rgbpp_ckb_tx`
5762
7. **broadcast** `rgbpp_ckb_tx` and mark the job as completed upon tx-confirmation
5863

examples/rgbpp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"lint:fix": "tsc && eslint --fix --ext .js,.ts . && prettier --write '**/*.{js,ts}'"
1111
},
1212
"dependencies": {
13-
"@nervosnetwork/ckb-sdk-utils": "^0.109.1",
13+
"@nervosnetwork/ckb-sdk-utils": "0.109.1",
1414
"rgbpp": "workspace:*"
1515
},
1616
"devDependencies": {

examples/rgbpp/spore/launch/2-create-cluster.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ const createCluster = async ({ ownerRgbppLockArgs }: { ownerRgbppLockArgs: strin
5454
const newCkbRawTx = updateCkbTxWithRealBtcTxId({ ckbRawTx, btcTxId, isMainnet });
5555

5656
console.log('The cluster rgbpp lock args: ', newCkbRawTx.outputs[0].lock.args);
57+
console.log('The cluster rgbpp lock args -- btc tx id: ', btcTxId);
58+
console.log('The cluster rgbpp lock args -- btc tx out index: 1');
5759

5860
const ckbTx = await appendCkbTxWitnesses({
5961
ckbRawTx: newCkbRawTx,

examples/rgbpp/spore/launch/3-create-spores.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ const createSpores = async ({ clusterRgbppLockArgs, receivers }: SporeCreatePara
7373
// Update CKB transaction with the real BTC txId
7474
const newCkbRawTx = updateCkbTxWithRealBtcTxId({ ckbRawTx, btcTxId, isMainnet });
7575
console.log('The new cluster rgbpp lock args: ', newCkbRawTx.outputs[0].lock.args);
76+
console.log('The new cluster rgbpp lock args -- btc tx id: ', btcTxId);
77+
console.log('The new cluster rgbpp lock args -- btc tx out index: 1');
7678

7779
const ckbTx = await appendCkbTxWitnesses({
7880
ckbRawTx: newCkbRawTx,

examples/rgbpp/xudt/3-btc-leap-ckb.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const leapFromBtcToCKB = async ({ rgbppLockArgsList, toCkbAddress, xudtTypeArgs,
2626
toCkbAddress,
2727
isMainnet,
2828
btcTestnetType: BTC_TESTNET_TYPE,
29+
// btcConfirmationBlocks: 20, // default value is 6
2930
});
3031

3132
// Save ckbVirtualTxResult
@@ -74,9 +75,9 @@ const leapFromBtcToCKB = async ({ rgbppLockArgsList, toCkbAddress, xudtTypeArgs,
7475

7576
// rgbppLockArgs: outIndexU32 + btcTxId
7677
leapFromBtcToCKB({
77-
rgbppLockArgsList: [buildRgbppLockArgs(1, '6edd4b9327506fab09fb9a0f5e5f35136a6a94bd4c9dd79af04921618fa6c800')],
78-
toCkbAddress: 'ckt1qrfrwcdnvssswdwpn3s9v8fp87emat306ctjwsm3nmlkjg8qyza2cqgqq9kxr7vy7yknezj0vj0xptx6thk6pwyr0sxamv6q',
78+
rgbppLockArgsList: [buildRgbppLockArgs(1, '52148de63ddd4dcd8ba1d2e105d43c62adf6ccd7e7098c24616640cd5e485c03')],
79+
toCkbAddress: 'ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq0e4xk4rmg5jdkn8aams492a7jlg73ue0gc0ddfj',
7980
// Please use your own RGB++ xudt asset's xudtTypeArgs
80-
xudtTypeArgs: '0x1ba116c119d1cfd98a53e9d1a615cf2af2bb87d95515c9d217d367054cfc696b',
81+
xudtTypeArgs: '0x562e4e8a2f64a3e9c24beb4b7dd002d0ad3b842d0cc77924328e36ad114e3ebe',
8182
transferAmount: BigInt(800_0000_0000),
8283
});

examples/rgbpp/xudt/4-unlock-btc-time-cell.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ const unlockBtcTimeCell = async ({ btcTimeCellArgs }: { btcTimeCellArgs: string
3838
// The btcTimeCellArgs is from the outputs[0].lock.args(BTC Time lock args) of the 3-btc-leap-ckb.ts CKB transaction
3939
unlockBtcTimeCell({
4040
btcTimeCellArgs:
41-
'0x7f000000100000005b0000005f0000004b000000100000003000000031000000d23761b364210735c19c60561d213fb3beae2fd6172743719eff6920e020baac011600000000016c61f984f12d3c8a4f649e60acda5deda0b8837c06000000799a0f55202939e6801924c87c66df75932ecf79774370beebe31eaa94b6d8b8',
41+
'0x7d00000010000000590000005d000000490000001000000030000000310000009bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce80114000000f9a9ad51ed14936d33f7bb854aaefa5f47a3ccbd880d0100ffc34d3d23f86df84a23a3b2cf72b45c8a309fec417ab196bee8e7a74483e05f',
4242
});

examples/xudt-on-ckb/2-transfer-xudt.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
calculateTransactionFee,
1313
NoXudtLiveCellError,
1414
fetchTypeIdCellDeps,
15+
getXudtTypeScript,
1516
} from 'rgbpp/ckb';
1617
import { CKB_PRIVATE_KEY, ckbAddress, collector, isMainnet } from './env';
1718

@@ -139,8 +140,7 @@ const XUDT_TOKEN_INFO: RgbppTokenInfo = {
139140
transferXudt({
140141
// The xudtType comes from 1-issue-xudt
141142
xudtType: {
142-
codeHash: '0x25c29dc317811a6f6f3985a7a9ebc4838bd388d19d0feeecf0bcd60f6c0975bb',
143-
hashType: 'type',
143+
...getXudtTypeScript(isMainnet),
144144
args: '0x562e4e8a2f64a3e9c24beb4b7dd002d0ad3b842d0cc77924328e36ad114e3ebe',
145145
},
146146
receivers: [

0 commit comments

Comments
 (0)