Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ckb|example): Export buildRgbppTransferTx from rgbpp package and update L1 transfer example #216

Merged
merged 8 commits into from
Jun 7, 2024

Conversation

duanyytop
Copy link
Collaborator

@duanyytop duanyytop commented Jun 3, 2024

Changes

  • Export buildRgbppTransferTx from rgbpp package to generate CKB virtual TX and BTC tx to be signed
  • Update L1 transfer example with the function buildRgbppTransferTx

Function Signature

const buildRgbppTransferTx = async ({
  ckb: {
    collector,
    xudtTypeArgs,
    rgbppLockArgsList,
    transferAmount,
    ckbFeeRate,
  },
  btc: {
    fromBtcAddress,
    toBtcAddress,
    btcDataSource,
    fromPubkey,
    feeRate
  },
  isMainnet,
}: RgbppTransferTxParams): Promise<RgbppTransferTxResult>

The collector and btcDataSource will be constructed in the rgbpp-sdk-service with some necessary variables from the environment. The necessary request and response for the L1 transfer in the rgbpp-sdk-service are as follows:

interface RgbppTransferReq {
  // The transferred RGB++ xUDT type script args
  xudtTypeArgs: string;           
  // The rgbpp assets cell lock script args array whose data structure is: out_index | btc_tx_id
  rgbppLockArgsList: string[];   
  // The xUDT amount to be transferred
  transferAmount: Hex;     
  // The sender BTC address       
  fromBtcAddress: string;     
  // The receiver BTC address
  toBtcAddress: string;     
}

interface RgbppTransferResp {
  // The JSON string for the `BtcTransferVirtualTxResult`
  ckbVirtualTxResult: string;    
  // The BTC PSBT hex string which can be used to construct Bitcoin PSBT
  btcPsbtHex: Hex;           
}

Related PR

packages/rgbpp/src/rgbpp/types.ts Outdated Show resolved Hide resolved
@duanyytop duanyytop requested a review from ShookLyngs June 4, 2024 06:00
Flouse
Flouse previously approved these changes Jun 6, 2024
@Flouse Flouse enabled auto-merge June 6, 2024 09:04
packages/rgbpp/src/rgbpp/types.ts Outdated Show resolved Hide resolved
packages/rgbpp/src/rgbpp/types.ts Outdated Show resolved Hide resolved
ShookLyngs
ShookLyngs previously approved these changes Jun 6, 2024
packages/rgbpp/src/rgbpp/types.ts Outdated Show resolved Hide resolved
packages/rgbpp/src/rgbpp/types.ts Outdated Show resolved Hide resolved
ShookLyngs
ShookLyngs previously approved these changes Jun 6, 2024
Flouse
Flouse previously approved these changes Jun 6, 2024
@duanyytop duanyytop dismissed stale reviews from Flouse and ShookLyngs via 4893d8f June 6, 2024 14:30
@duanyytop duanyytop force-pushed the feat/rgbpp-package-l1-transfer branch from 42699bd to 4893d8f Compare June 6, 2024 14:30
@duanyytop
Copy link
Collaborator Author

I fixed the conflicts between this branch and develop branch and then it needs to be reviewed again.

@duanyytop duanyytop requested a review from ShookLyngs June 7, 2024 01:51
@Flouse Flouse added this pull request to the merge queue Jun 7, 2024
Merged via the queue into develop with commit 06dc871 Jun 7, 2024
1 of 2 checks passed
@Flouse Flouse deleted the feat/rgbpp-package-l1-transfer branch June 7, 2024 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants