Skip to content
This repository was archived by the owner on May 27, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
63df2dc
Merge pull request #156 from ckb-cell/bump/0.1.0
duanyytop May 9, 2024
13aca67
feat: Add rgbpp root package
duanyytop May 9, 2024
5206cdf
docs: update README related to assets-api (#158)
Flouse May 9, 2024
816ff05
feat: Add sub path for rgbpp package
duanyytop May 9, 2024
0caba5a
feat: export basic apis/types of btc/service in rgbpp
ShookLyngs May 9, 2024
05059ed
feat: define sub paths of rgbpp
ShookLyngs May 9, 2024
217cc77
Update README.md
duanyytop May 9, 2024
2c42c80
refactor: Collect all rgbpp inputs without isMax
duanyytop May 9, 2024
c0aaa61
chore: Upgrade vite version
duanyytop May 9, 2024
a9b9796
chore: Update changeset
duanyytop May 9, 2024
9d203cb
Merge pull request #160 from ckb-cell/refactor/collect-all-rgbpp-inputs
duanyytop May 9, 2024
3faa0fd
Merge pull request #161 from ckb-cell/fix/security-alert
duanyytop May 9, 2024
664b13f
feat: export BtcAssetsApiError in rgbpp/index.ts
ShookLyngs May 10, 2024
d8d1f89
docs: Remove rgbpp package from README
duanyytop May 10, 2024
db1cdf1
fix: Update sub path for related packages
duanyytop May 10, 2024
20215e1
chore: Update changeset
duanyytop May 10, 2024
7abf72b
chore: link rgbpp version as other @rgbpp-sdk/* packages
ShookLyngs May 10, 2024
58f8dff
refactor: use "workspace:*" as comparator for @rgbpp-sdk/* dependencies
ShookLyngs May 10, 2024
8231d8c
chore: update pnpm-lock.yaml
ShookLyngs May 10, 2024
6650d72
Merge pull request #157 from ckb-cell/feat/rgbpp-package
duanyytop May 10, 2024
d37cf5b
fix: message of INSUFFICIENT_UTXO error when collected < targetAmount…
ShookLyngs May 11, 2024
601741b
chore: rename env vars "SERVICE_*" -> "BTC_SERVICE_*" (#164)
ShookLyngs May 11, 2024
9332adb
fix: Check rgbpp capacity for change and paymaster cell
duanyytop May 11, 2024
e59322e
style: replace all "void 0" to "undefined"
ShookLyngs May 10, 2024
84ee5ad
feat: Add checkCkbTxInputsCapacitySufficient function
duanyytop May 13, 2024
bf7fa04
refactor: check paymaster output requirement with API from ckb lib
ShookLyngs May 13, 2024
5365ced
Merge pull request #165 from ckb-cell/style/remove-void-0
ShookLyngs May 13, 2024
66cd1f6
Merge pull request #168 from ckb-cell/fix/check-rgbpp-capacity-enough
Flouse May 14, 2024
97f3ce2
refactor: Move xudt examples to signle package
duanyytop May 8, 2024
b684a87
refactor: Create example-core package
duanyytop May 8, 2024
544f939
refactor: Create xudt example package
duanyytop May 8, 2024
d3ec6b5
refactor: Use env variables for rgbpp xudt examples
duanyytop May 8, 2024
65a92fd
refactor: Use env veriables for rgbpp spore examples
duanyytop May 8, 2024
fc19f96
refactor: Update btc package export
duanyytop May 8, 2024
1d33bae
refactor: Move spore transfer and leap to examples-core
duanyytop May 8, 2024
03fafb2
refactor: Update examples packages
duanyytop May 8, 2024
afa698f
refactor: Update examples directory and readme
duanyytop May 9, 2024
fee3415
refactor: Update examples with new rgbpp packages
duanyytop May 9, 2024
e0da8da
docs: Update examples readme
duanyytop May 10, 2024
55edb5d
refactor: Remove example rgbpp utils
duanyytop May 10, 2024
bc34d9a
feat: Import rgbpp package v0.1.0 for examples
duanyytop May 10, 2024
dd89848
feat: Export RawClusterData and RawSporeData from ckb package
duanyytop May 10, 2024
002d3f4
refactor: Update examples variable names
duanyytop May 10, 2024
c918f26
style: Remove semicolon of .env.example
duanyytop May 11, 2024
d9a2769
Update examples/xudt/.env.example
duanyytop May 14, 2024
ec6fde2
refactor: Update xudt examples and readme
duanyytop May 14, 2024
3610f7c
refactor: improve readability of "if statement" in service requests
ShookLyngs May 14, 2024
4c68107
refactor: improve readability of the service fetch params
ShookLyngs May 14, 2024
a3e4a81
chore: set service tests timeout to 20 sec
ShookLyngs May 14, 2024
5c39b45
refactor: add notes to TxBuilder.payFee() related functions, and simp…
ShookLyngs May 15, 2024
1d5a952
feat: Build ckb raw tx for spore creation
duanyytop May 15, 2024
1d58dd5
chore: Add changeset
duanyytop May 15, 2024
2712209
refactor: Check spore type for spore transfer and leap
duanyytop May 15, 2024
64c4312
chore: Add changeset
duanyytop May 15, 2024
ee982b1
fix example annotation typo
duanyytop May 15, 2024
18a1c38
refactor: Rename buildAppendingIssuerCellToSporesCreateTx parameter name
duanyytop May 15, 2024
e4da0c0
Merge pull request #172 from ckb-cell/refactor/check-spore-type
duanyytop May 15, 2024
752f623
chore: Use btc testnet address for example
duanyytop May 16, 2024
ba21cac
Merge pull request #159 from ckb-cell/refactor/clean-examples
duanyytop May 16, 2024
ce21ad3
refactor: Move secp256k1 cell dep to signing stage
duanyytop May 16, 2024
9d084ef
Merge pull request #171 from ckb-cell/feat/build-spore-creatation-uns…
duanyytop May 16, 2024
8cfc06e
refactor(rgbpp-sdk/ckb): Update ckb cell fields size (#174)
duanyytop May 16, 2024
4987022
fix: export NetworkType/AddressType as enums instead of types in rgbpp
ShookLyngs May 16, 2024
632608b
Merge pull request #175 from ckb-cell/ref/service-readability-changes
Flouse May 17, 2024
3afadc8
docs(FAQ): no protocol prefix and port suffix in the access token's `…
Flouse May 17, 2024
2939f20
Merge pull request #177 from ckb-cell/fix/export-btc-enum
ShookLyngs May 17, 2024
2b63c0f
feat: Increase the max length of rgbpp inputs to 40
duanyytop May 17, 2024
5e0e817
chore: Add changeset
duanyytop May 17, 2024
f4776ea
chore: update changelog format
ShookLyngs May 17, 2024
b09f30d
feat: add no_cache params to btc/rgbpp service api
ahonn May 20, 2024
9f9daa9
chore: add changeset
ahonn May 20, 2024
d1df59a
test: update getBtcTransactions() with after_txid test
ahonn May 20, 2024
b994ea4
Merge pull request #181 from ckb-cell/feat/service-no-cache-param
ShookLyngs May 20, 2024
4e529b6
Merge pull request #180 from ckb-cell/chore/changelog-format
ShookLyngs May 20, 2024
5edaaf1
Merge pull request #179 from ckb-cell/feat/increase-rgbpp-inputs-length
duanyytop May 21, 2024
f5e66f7
fix: missing await in the changelog format file
ShookLyngs May 21, 2024
564812c
Merge pull request #182 from ckb-cell/fix/changelog-await
ShookLyngs May 21, 2024
eee6d89
Merge pull request #176 from ckb-cell/ref/notes-to-pay-fee
Flouse May 22, 2024
685cf34
docs: add no_cache param to service readme
ShookLyngs May 21, 2024
8a8e11b
feat: support internal query data caching in TxBuilder.payFee()
ShookLyngs May 21, 2024
64857f4
fix: Update spore creation tx rgbpp inputs length
duanyytop May 23, 2024
211592b
Merge pull request #185 from ckb-cell/fix/spore-inputs-length-error
duanyytop May 23, 2024
7f928ec
refactor: remove "noUtxosCache" in pay fee related methods, and set t…
ShookLyngs May 23, 2024
4fcf4fa
fix(rgbpp-sdk/ckb): Update rgbpp witnesses for btc batch transfer tx …
duanyytop May 23, 2024
22a0a27
chore: simplify snapshot/release workflow and trigger branches (#186)
ShookLyngs May 23, 2024
f0c8d49
docs: Add more annotations and logs for spore examples (#188)
duanyytop May 23, 2024
d896829
fix: Remove xudt type from ckb change cell
duanyytop May 24, 2024
994be05
refactor: Remove xudt cell without amount data
duanyytop May 24, 2024
299b404
chore: Add changeset
duanyytop May 24, 2024
f247319
chore: fix snapshot versioning and always add a temp changeset to pre…
ShookLyngs May 24, 2024
e4371a1
Merge pull request #190 from ckb-cell/fix/xudt-example-change-error
duanyytop May 24, 2024
092e316
refactor: "noUtxosCache" -> "noAssetsApiCache", "cacheKey" -> "intern…
ShookLyngs May 24, 2024
98469c5
Merge pull request #184 from ckb-cell/feat/query-data-cache
Flouse May 24, 2024
a8598e3
refactor(examples): Save ckbVirtualTxResult locally
Dawn-githup May 24, 2024
6e1b54b
test: Create integration tests for xUDT workflow (#169)
Dawn-githup May 25, 2024
c1a9729
chore: define and use CkbVirtualTxResultType in saveCkbVirtualTxResult
Dawn-githup May 26, 2024
f4d18fa
Merge pull request #193 from ckb-cell/feat/save-ckbvirtualtx-result
Flouse May 26, 2024
ef597c1
Bump RGB++ SDK to v0.2.0 (#194)
ShookLyngs May 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 130 additions & 0 deletions .changeset/changelog-format.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
// @ts-check
/**
* Based on the following format:
* - https://github.com/changesets/changesets/blob/main/packages/changelog-github/src/index.ts
* - https://github.com/stylelint/stylelint/blob/main/.changeset/changelog-stylelint.cjs
*/

const { getInfo, getInfoFromPullRequest } = require('@changesets/get-github-info');

/**
* @type {import('@changesets/types').ChangelogFunctions}
*/
const changelogFunctions = {
async getReleaseLine(changeset, _type, options) {
if (!options || !options.repo) {
throw new Error(
'Please provide a repo to this changelog generator like this:\n"changelog": ["@changesets/changelog-github", { "repo": "org/repo" }]',
);
}

/**
* @type {number | undefined}
*/
let prFromSummary;
/**
* @type {string | undefined}
*/
let commitFromSummary;
/**
* @type {string[]}
*/
let usersFromSummary = [];

const replacedChangelog = changeset.summary
.replace(/^\s*(?:pr|pull|pull\s+request):\s*#?(\d+)/im, (_, pr) => {
let num = Number(pr);
if (!isNaN(num)) {
prFromSummary = num;
}
return '';
})
.replace(/^\s*commit:\s*([^\s]+)/im, (_, commit) => {
commitFromSummary = commit;
return '';
})
.replace(/^\s*(?:author|user):\s*@?([^\s]+)/gim, (_, user) => {
usersFromSummary.push(user);
return '';
})
.trim();

const [firstLine, ...futureLines] = replacedChangelog
.split('\n')
.map((l) => l.trimRight());

const links = await (async () => {
if (prFromSummary !== undefined) {
let { links } = await getInfoFromPullRequest({
repo: options.repo,
pull: prFromSummary,
});
if (commitFromSummary) {
const shortCommitId = commitFromSummary.slice(0, 7);
links = {
...links,
commit: `[\`${shortCommitId}\`](https://github.com/${options.repo}/commit/${commitFromSummary})`,
};
}
return links;
}
const commitToFetchFrom = commitFromSummary || changeset.commit;
if (commitToFetchFrom) {
let { links } = await getInfo({
repo: options.repo,
commit: commitToFetchFrom,
});
return links;
}
return {
commit: null,
pull: null,
user: null,
};
})();

const users = usersFromSummary.length
? usersFromSummary
.map((userFromSummary) => `[@${userFromSummary}](https://github.com/${userFromSummary})`)
.join(', ')
: links.user;

const pull = links.pull !== null ? links.pull : '';
const commit = links.commit !== null ? links.commit : '';
const prefix = pull || commit ? `${pull || commit}:` : '';
const mention = users !== null ? `(${users})` : users;
const fullFirstLine = `${prefix} ${firstLine} ${mention}`;
const futureLinesText = futureLines.map((l) => ` ${l}`).join('\n');

return `\n\n - ${fullFirstLine}\n${futureLinesText}`;
},
async getDependencyReleaseLine(changesets, deps, options) {
if (!options.repo) {
throw new Error(
'Please provide a repo to this changelog generator like this:\n"changelog": ["@changesets/changelog-github", { "repo": "org/repo" }]',
);
}
if (deps.length === 0) {
return '';
}

const commits = await Promise.all(
changesets.map(async (cs) => {
if (cs.commit) {
let { links } = await getInfo({
repo: options.repo,
commit: cs.commit,
});
return links.commit;
}
}),
);

const changesetLink = `- Updated dependencies [${commits.join(', ')}]:`;
const updatedDeps = deps.map((dep) => ` - ${dep.name}@${dep.newVersion}`);

return [changesetLink, ...updatedDeps].join('\n');
},
};

module.exports = changelogFunctions;
6 changes: 3 additions & 3 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "ckb-cell/rgbpp-sdk" }],
"changelog": ["./changelog-format.cjs", { "repo": "ckb-cell/rgbpp-sdk" }],
"commit": false,
"fixed": [["@rgbpp-sdk/*"]],
"fixed": [["@rgbpp-sdk/*", "rgbpp"]],
"linked": [],
"access": "public",
"baseBranch": "main",
"baseBranch": "origin/main",
"updateInternalDependencies": "patch",
"ignore": []
}
44 changes: 44 additions & 0 deletions .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Test the entire process of RGBPP to ensure the proper functioning of the rgbpp-sdk package.

name: Integration Tests

on:
workflow_dispatch:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout rgbpp-sdk
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x

- uses: pnpm/action-setup@v3
name: Install -g pnpm
with:
version: 8
run_install: false

- name: Install dependencies
run: pnpm i

- name: Build packages
run: pnpm run build:packages

- name: Run integration:xudt script
working-directory: ./tests/rgbpp
run: pnpm run integration:xudt
env:
VITE_SERVICE_URL: ${{ secrets.SERVICE_URL }}
VITE_SERVICE_TOKEN: ${{ secrets.SERVICE_TOKEN }}
VITE_SERVICE_ORIGIN: ${{ secrets.SERVICE_ORIGIN }}
INTEGRATION_CKB_PRIVATE_KEY: ${{ secrets.INTEGRATION_CKB_PRIVATE_KEY }}
INTEGRATION_BTC_PRIVATE_KEY: ${{ secrets.INTEGRATION_BTC_PRIVATE_KEY }}
19 changes: 12 additions & 7 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
workflow_dispatch:
push:
branches:
- main
- develop

concurrency: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -47,22 +46,28 @@ jobs:
- name: Install dependencies
run: pnpm i

- name: Clear cache
run: pnpm run clean:packages

- name: Build packages
run: pnpm run build:packages

- name: Version packages
- name: Add snapshot changeset (ensure at least has a changeset)
run: |
cat << EOF > ".changeset/snap-release-changeset.md"
---
"@rgbpp-sdk/btc": patch
---
Add temp changeset for snapshot releases
EOF

- name: Version packages to "0.0.0-snap-{timestamp}"
run: npx changeset version --snapshot snap
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to npm (ignore GitHub)
- name: Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: npx changeset publish --snapshot --tag snap
publish: npx changeset publish --no-git-tag --snapshot --tag snap
createGithubReleases: false
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ jobs:
- name: Run tests for packages
run: pnpm run test:packages
env:
VITE_SERVICE_URL: ${{ secrets.SERVICE_URL }}
VITE_SERVICE_TOKEN: ${{ secrets.SERVICE_TOKEN }}
VITE_SERVICE_ORIGIN: ${{ secrets.SERVICE_ORIGIN }}
VITE_BTC_SERVICE_URL: ${{ secrets.SERVICE_URL }}
VITE_BTC_SERVICE_TOKEN: ${{ secrets.SERVICE_TOKEN }}
VITE_BTC_SERVICE_ORIGIN: ${{ secrets.SERVICE_ORIGIN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
.env.development.local
.env.production.local
.env.test.local
.env
**/.npmrc

# logs
Expand All @@ -40,3 +41,4 @@ yarn-error.log*
devbox.json
devbox.lock
.envrc

28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This repository offers utilities for Bitcoin and RGB++ asset integration.

- [@rgbpp-sdk/btc](./packages/btc): Bitcoin part of the SDK
- [@rgbpp-sdk/ckb](./packages/ckb): Nervos CKB part of the SDK
- [@rgbpp-sdk/service](./packages/service): A wrapped class to interact with `Bitcoin/RGB++ Assets Service`
- [@rgbpp-sdk/service](./packages/service): Wrapped interfaces of `Bitcoin/RGB++ Assets Service`

## RGB++ Code Examples

Expand All @@ -15,7 +15,7 @@ This repository offers utilities for Bitcoin and RGB++ asset integration.
## Related CKB Scripts (Contracts)
- [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)

- [RgbppLockScript and BtcTimeLockScript](https://github.com/ckb-cell/rgbpp-sdk/blob/cf25ea014d4e0fc24723df8eea8bd61f59e1060a/packages/ckb/src/constants/index.ts#L11-L121)
- [RgbppLockScript and BtcTimeLockScript](https://github.com/ckb-cell/rgbpp-sdk/blob/63df2dcd95b1b735b5d235e156e4361a3c87b0ac/packages/ckb/src/constants/index.ts#L12-L206)
* design: https://github.com/ckb-cell/RGBPlusPlus-design/blob/main/docs/light-paper-en.md
* testnet: https://pudge.explorer.nervos.org/scripts#RGB++
* mainnet: https://explorer.nervos.org/scripts#RGB++
Expand All @@ -36,29 +36,35 @@ This repository offers utilities for Bitcoin and RGB++ asset integration.
2. **[BTC → CKB](https://github.com/ckb-cell/rgbpp-sdk/blob/develop/packages/ckb/README.md#rgb-spore-leap-from-btc-to-ckb)**
3. **[CKB → BTC](https://github.com/ckb-cell/rgbpp-sdk/blob/develop/packages/ckb/README.md#rgb-spore-leap-from-ckb-to-btc)** *(isomorphic rgbpp_btc_tx is not required in this workflow)*

> [!IMPORTANT]
> [!IMPORTANT]
> It's recommended to save the `rgbpp_ckb_tx_virtual` locally in case you need it in the future.

2. **Creation of `rgbpp_btc_tx` through [@rgbpp-sdk/btc](https://github.com/ckb-cell/rgbpp-sdk/tree/develop/packages/btc)**
1. construct isomorphic rgbpp_btc_tx based on rgbpp_ckb_tx_virtual and rgbpp commitment
2. sign and broadcast rgbpp_btc_tx to obtain `rgbpp_btc_txid`
1. construct isomorphic `rgbpp_btc_tx` based on `rgbpp_ckb_tx_virtual` and rgbpp commitment
2. sign and broadcast `rgbpp_btc_tx` to obtain `rgbpp_btc_txid`

3. JoyID or dApp sends `rgbpp_btc_txid` and `rgbpp_ckb_tx_virtual` to RGB++ CKB transaction Queue (API Endpoint: `/rgbpp/v1/transaction/ckb-tx`)

4. `RGB++ CKB transaction Queue` will process the following things:
1. **verify** the received requests
2. continuously fetch request from the queue through a **cron job**
3. check whether the **confirmations** of req.rgbpp_btc_txid is sufficient
4. generate the **witnesses for RgbppLocks** in the rgbpp_ckb_tx_virtual
5. add a **paymaster cell** into rgbpp_ckb_tx_virtual.inputs if the CKB capacity is insufficient
3. check whether the **confirmations** of `req.rgbpp_btc_txid` is sufficient
4. generate the **witnesses for RgbppLocks** in the `rgbpp_ckb_tx_virtual`
5. add a **paymaster cell** into `rgbpp_ckb_tx_virtual`.inputs if the CKB capacity is insufficient
1. need to **verify the existence of paymaster UTXO** in the rgbpp_btc_tx
2. sign the paymaster cell and the entire transaction if needed
6. **finalize** the rgbpp_ckb_tx_virtual to a rgbpp_ckb_tx
7. **broadcast** rgbpp_ckb_tx and mark the job as completed upon tx-confirmation
6. **finalize** the `rgbpp_ckb_tx_virtual` to a `rgbpp_ckb_tx`
7. **broadcast** `rgbpp_ckb_tx` and mark the job as completed upon tx-confirmation

### Notes

- The RGB++ CKB transaction Queue is designed to streamline the transaction workflow. Developers have the option to implement its features by themselves without limitation.
- `Bitcoin/RGB++ Assets Service` is designed to streamline the transaction workflow. Developers have the option to implement its features by themselves without limitation.


## FAQ

### How to get an access token of Bitcoin/RGB++ Assets Service?
See [Generate a JSON Web Token (JWT) for Bitcoin/RGB++ Assets Service](./packages/service/README.md#get-an-access-token)


## License
Expand Down
4 changes: 2 additions & 2 deletions apps/next/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
NEXT_PUBLIC_SERVICE_URL=
NEXT_PUBLIC_SERVICE_TOKEN=
NEXT_PUBLIC_BTC_SERVICE_URL=
NEXT_PUBLIC_BTC_SERVICE_TOKEN=
4 changes: 2 additions & 2 deletions apps/next/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export default function Home() {
const networkType = NetworkType.TESTNET;

const service = BtcAssetsApi.fromToken(
process.env.NEXT_PUBLIC_SERVICE_URL!,
process.env.NEXT_PUBLIC_SERVICE_TOKEN!,
process.env.NEXT_PUBLIC_BTC_SERVICE_URL!,
process.env.NEXT_PUBLIC_BTC_SERVICE_TOKEN!,
);
const source = new DataSource(service, networkType);

Expand Down
4 changes: 2 additions & 2 deletions apps/vite/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VITE_SERVICE_URL=
VITE_SERVICE_TOKEN=
VITE_BTC_SERVICE_URL=
VITE_BTC_SERVICE_TOKEN=
2 changes: 1 addition & 1 deletion apps/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"typescript": "^5.2.2",
"vite": "^5.1.4",
"vite": "^5.2.11",
"vite-plugin-node-polyfills": "^0.21.0"
}
}
5 changes: 4 additions & 1 deletion apps/vite/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ function App() {
async function send() {
const networkType = NetworkType.TESTNET;

const service = BtcAssetsApi.fromToken(import.meta.env.VITE_SERVICE_URL!, import.meta.env.VITE_SERVICE_TOKEN!);
const service = BtcAssetsApi.fromToken(
import.meta.env.VITE_BTC_SERVICE_URL!,
import.meta.env.VITE_BTC_SERVICE_TOKEN!,
);
const source = new DataSource(service, networkType);

const psbt = await sendBtc({
Expand Down
29 changes: 29 additions & 0 deletions examples/rgbpp/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# True for CKB and BTC Mainnet and false for CKB and BTC Testnet, the default value is false
IS_MAINNET=false

# CKB Variables

# The CKB secp256k1 private key whose format is 32bytes hex string with 0x prefix
CKB_SECP256K1_PRIVATE_KEY=0x-private-key

# CKB node url which should be matched with IS_MAINNET
CKB_NODE_URL=https://testnet.ckb.dev/rpc

# CKB indexer url which should be matched with IS_MAINNET
CKB_INDEXER_URL=https://testnet.ckb.dev/indexer


# BTC Variables

# The BTC private key whose format is 32bytes hex string without 0x prefix
BTC_PRIVATE_KEY=private-key

# The BTC assets api url which should be matched with IS_MAINNET
VITE_BTC_SERVICE_URL=https://btc-assets-api.testnet.mibao.pro

# The BTC assets api token which should be matched with IS_MAINNET
# To get an access token, please refer to https://github.com/ckb-cell/rgbpp-sdk/tree/develop/packages/service#get-an-access-token
VITE_BTC_SERVICE_TOKEN=

# The BTC assets api origin which should be matched with IS_MAINNET
VITE_BTC_SERVICE_ORIGIN=https://btc-test.app
Loading