Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
68 changes: 68 additions & 0 deletions packages/core/src/client/clientPublicMainnet.advanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,4 +457,72 @@ export const MAINNET_SCRIPTS: Record<KnownScript, ScriptInfoLike | undefined> =
},
],
},
[KnownScript.RgbppLock]: {
codeHash:
"0xbc6c568a1a0d0a09f6844dc9d74ddb4343c32143ff25f727c59edf4fb72d6936",
hashType: "type",
cellDeps: [
{
cellDep: {
outPoint: {
txHash:
"0xcb4d9f9726e66306bfda6359d39d3bea8b4e5345d0f95f26a3e51626ebe82a63",
index: 0,
},
depType: "code",
},
type: {
codeHash:
"0x00000000000000000000000000000000000000000000000000545950455f4944",
hashType: "type",
args: "0x68ad3d9e0bb9ea841a5d1fcd600137bd3f45401e759e353121f26cd0d981452f",
},
},
// Rgbpp lock config cell dep
{
cellDep: {
outPoint: {
txHash:
"0xcb4d9f9726e66306bfda6359d39d3bea8b4e5345d0f95f26a3e51626ebe82a63",
index: 1,
},
depType: "code",
},
},
],
},
[KnownScript.BtcTimeLock]: {
codeHash:
"0x70d64497a075bd651e98ac030455ea200637ee325a12ad08aff03f1a117e5a62",
hashType: "type",
cellDeps: [
{
cellDep: {
outPoint: {
txHash:
"0x3d1c26b966504b09253ad84173bf3baa7b8135c5ff520c32cf70b631c1d08b9b",
index: 0,
},
depType: "code",
},
type: {
codeHash:
"0x00000000000000000000000000000000000000000000000000545950455f4944",
hashType: "type",
args: "0x44b8253ae18e913a2845b0d548eaf6b3ba1099ed26835888932a754194028a8a",
},
},
// btc time lock config cell dep
{
cellDep: {
outPoint: {
txHash:
"0x3d1c26b966504b09253ad84173bf3baa7b8135c5ff520c32cf70b631c1d08b9b",
index: 1,
},
depType: "code",
},
},
],
},
});
68 changes: 68 additions & 0 deletions packages/core/src/client/clientPublicTestnet.advanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,4 +469,72 @@ export const TESTNET_SCRIPTS: Record<KnownScript, ScriptInfoLike> =
},
],
},
[KnownScript.RgbppLock]: {
codeHash:
"0x61ca7a4796a4eb19ca4f0d065cb9b10ddcf002f10f7cbb810c706cb6bb5c3248",
hashType: "type",
cellDeps: [
{
cellDep: {
outPoint: {
txHash:
"0x0d1567da0979f78b297d5311442669fbd1bd853c8be324c5ab6da41e7a1ed6e5",
index: 0,
},
depType: "code",
},
type: {
codeHash:
"0x00000000000000000000000000000000000000000000000000545950455f4944",
hashType: "type",
args: "0xa3bc8441df149def76cfe15fec7b1e51d949548bc27fb7a75e9d4b3ef1c12c7f",
},
},
// Rgbpp lock config cell dep for Bitcoin Testnet3
{
cellDep: {
outPoint: {
txHash:
"0x0d1567da0979f78b297d5311442669fbd1bd853c8be324c5ab6da41e7a1ed6e5",
index: 1,
},
depType: "code",
},
},
],
},
[KnownScript.BtcTimeLock]: {
codeHash:
"0x00cdf8fab0f8ac638758ebf5ea5e4052b1d71e8a77b9f43139718621f6849326",
hashType: "type",
cellDeps: [
{
cellDep: {
outPoint: {
txHash:
"0x8fb747ff0416a43e135c583b028f98c7b81d3770551b196eb7ba1062dd9acc94",
index: 0,
},
depType: "code",
},
type: {
codeHash:
"0x00000000000000000000000000000000000000000000000000545950455f4944",
hashType: "type",
args: "0xc9828585e6dd2afacb9e6e8ca7deb0975121aabee5c7983178a45509ffaec984",
},
},
// btc time lock config cell dep for Bitcoin Testnet3
{
cellDep: {
outPoint: {
txHash:
"0x8fb747ff0416a43e135c583b028f98c7b81d3770551b196eb7ba1062dd9acc94",
index: 1,
},
depType: "code",
},
},
],
},
});
4 changes: 4 additions & 0 deletions packages/core/src/client/knownScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ export enum KnownScript {
TypeBurnLock = "TypeBurnLock",
EasyToDiscoverType = "EasyToDiscoverType",
TimeLock = "TimeLock",

// RGB++ related scripts (default using Bitcoin Testnet3)
RgbppLock = "RgbppLock",
BtcTimeLock = "BtcTimeLock",
}
33 changes: 33 additions & 0 deletions packages/rgbpp/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Dependencies
node_modules
.pnp
.pnp.js

# Testing
coverage
__snapshots__

# Production
build
dist
lib

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

# Debug logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# IDE
.idea
.vscode

# Cache
.cache
.eslintcache
5 changes: 5 additions & 0 deletions packages/rgbpp/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": false,
"trailingComma": "all",
"plugins": ["prettier-plugin-organize-imports"]
}
62 changes: 62 additions & 0 deletions packages/rgbpp/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// @ts-check

import eslint from "@eslint/js";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
import tseslint from "typescript-eslint";

import { dirname } from "path";
import { fileURLToPath } from "url";

export default [
...tseslint.config({
files: ["**/*.ts"],
extends: [
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
],
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{
args: "all",
argsIgnorePattern: "^_",
caughtErrors: "all",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
varsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
"@typescript-eslint/unbound-method": ["error", { ignoreStatic: true }],
"@typescript-eslint/no-unsafe-member-access": "off",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Disabling @typescript-eslint/no-unsafe-member-access is highly discouraged as it can hide potential runtime errors by allowing member access on any types without checks. This undermines the benefits of TypeScript's type safety. It's better to handle any types explicitly (e.g., with type guards or assertions) or, if necessary, disable the rule on a case-by-case basis with an inline comment explaining why it's safe. Consider re-enabling this rule or setting it to "warn" to avoid introducing bugs.

Suggested change
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-member-access": "warn",

"@typescript-eslint/require-await": "off",
"@typescript-eslint/only-throw-error": [
"error",
{
allowThrowingAny: true,
allowThrowingUnknown: true,
allowRethrowing: true,
},
],
"@typescript-eslint/prefer-promise-reject-errors": [
"error",
{
allowThrowingAny: true,
allowThrowingUnknown: true,
},
],
"no-empty": "off",
"prefer-const": [
"error",
{ ignoreReadBeforeAssign: true, destructuring: "all" },
],
},
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: dirname(fileURLToPath(import.meta.url)),
},
},
}),
eslintPluginPrettierRecommended,
];
60 changes: 60 additions & 0 deletions packages/rgbpp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"name": "@ckb-ccc/rgbpp",
"version": "1.0.0",
"description": "RGB++ for CKB",
"types": "dist/index.d.ts",
"source": "src/index.ts",
"type": "module",
"main": "dist.commonjs/index.js",
"module": "dist/index.js",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist.commonjs/index.js",
"default": "./dist.commonjs/index.js"
}
},
"scripts": {
"test": "jest",
"build": "rimraf ./dist && rimraf ./dist.commonjs && tsc && tsc --project tsconfig.commonjs.json && copyfiles -u 2 misc/basedirs/**/* .",
"lint": "eslint ./src",
"format": "prettier --write . && eslint --fix ./src"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@ckb-ccc/spore": "workspace:*",
"@ckb-ccc/udt": "workspace:*",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UDT imported, reasonable, where is it used?

"@eslint/js": "^9.34.0",
"@exact-realty/multipart-parser": "^1.0.13",
"@types/jest": "^29.5.14",
"@types/lodash": "^4.17.14",
"@types/node": "^22.10.6",
"copyfiles": "^2.4.1",
"dotenv": "^16.4.7",
"eslint": "^9.34.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.4",
"jest": "^29.7.0",
"prettier": "^3.6.2",
"prettier-plugin-organize-imports": "^4.2.0",
"rimraf": "^6.0.1",
"ts-jest": "^29.2.5",
"tsx": "^4.20.6",
"typescript": "^5.7.3",
"typescript-eslint": "^8.41.0"
},
"dependencies": {
"@bitcoinerlab/secp256k1": "1.1.1",
"@ckb-ccc/core": "workspace:*",
"@ckb-lumos/base": "^0.23.0",
"@ckb-lumos/bi": "^0.23.0",
"@ckb-lumos/codec": "^0.23.0",
"bip32": "4.0.0",
"bitcoinjs-lib": "6.1.6",
"ecpair": "2.1.0",
"js-sha256": "^0.11.0",
"lodash": "^4.17.21"
}
}
11 changes: 11 additions & 0 deletions packages/rgbpp/prettier.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* @see https://prettier.io/docs/configuration
* @type {import("prettier").Config}
*/
const config = {
singleQuote: false,
trailingComma: "all",
plugins: [require.resolve("prettier-plugin-organize-imports")],
};

module.exports = config;
Comment on lines +1 to +11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This Prettier configuration file (prettier.config.cjs) seems redundant because a .prettierrc file with similar settings already exists in the same directory. Having multiple configuration files for the same tool can be confusing and lead to inconsistencies. It's recommended to consolidate into a single configuration file. Please consider removing this file and keeping only .prettierrc.

Loading