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
7 changes: 7 additions & 0 deletions .changeset/fruity-drinks-kick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@ckb-ccc/shell": minor
"@ckb-ccc/did-ckb": patch
---

feat(did-ckb): add did-ckb package for basic did operations

6 changes: 6 additions & 0 deletions .changeset/poor-days-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@ckb-ccc/core": minor
---

feat(core): add known script did ckb

23 changes: 23 additions & 0 deletions packages/core/src/client/clientPublicMainnet.advanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,29 @@ export const MAINNET_SCRIPTS: Record<KnownScript, ScriptInfoLike | undefined> =
},
],
},
[KnownScript.DidCkb]: {
codeHash:
"0x4a06164dc34dccade5afe3e847a97b6db743e79f5477fa3295acf02849c5984a",
hashType: "type",
cellDeps: [
{
cellDep: {
outPoint: {
txHash:
"0xe2f74c56cdc610d2b9fe898a96a80118845f5278605d7f9ad535dad69ae015bf",
index: 0,
},
depType: "code",
},
type: {
codeHash:
"0x00000000000000000000000000000000000000000000000000545950455f4944",
args: "0x55573ef6d78e3ca75170ff476176732309a8b31efe94320a954ded3d75c2cb18",
hashType: "type",
},
},
],
},
[KnownScript.AlwaysSuccess]: {
codeHash:
"0x3b521cc4b552f109d092d8cc468a8048acb53c5952dbe769d2b2f9cf6e47f7f1",
Expand Down
23 changes: 23 additions & 0 deletions packages/core/src/client/clientPublicTestnet.advanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,29 @@ export const TESTNET_SCRIPTS: Record<KnownScript, ScriptInfoLike> =
},
],
},
[KnownScript.DidCkb]: {
codeHash:
"0x510150477b10d6ab551a509b71265f3164e9fd4137fcb5a4322f49f03092c7c5",
hashType: "type",
cellDeps: [
{
cellDep: {
outPoint: {
txHash:
"0x0e7a830e2d5ebd05cd45a55f93f94559edea0ef1237b7233f49f7facfb3d6a6c",
index: 0,
},
depType: "code",
},
type: {
codeHash:
"0x00000000000000000000000000000000000000000000000000545950455f4944",
args: "0x3c27695173b888ed44ddf36f901789014384ad6c05a9137f3db9a0779c141c35",
hashType: "type",
},
},
],
},
[KnownScript.AlwaysSuccess]: {
codeHash:
"0x3b521cc4b552f109d092d8cc468a8048acb53c5952dbe769d2b2f9cf6e47f7f1",
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/client/knownScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export enum KnownScript {
OmniLock = "OmniLock",
NostrLock = "NostrLock",
UniqueType = "UniqueType",
DidCkb = "DidCkb",

// ckb-proxy-locks https://github.com/ckb-devrel/ckb-proxy-locks
AlwaysSuccess = "AlwaysSuccess",
Expand Down
21 changes: 21 additions & 0 deletions packages/did-ckb/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
node_modules/
misc/

*test.js
*test.ts
*test.d.ts
*test.d.ts.map
*spec.js
*spec.ts
*spec.d.ts
*spec.d.ts.map

tsconfig.json
tsconfig.*.json
eslint.config.mjs
.prettierrc
.prettierignore

tsconfig.tsbuildinfo
tsconfig.*.tsbuildinfo
.github/
15 changes: 15 additions & 0 deletions packages/did-ckb/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules/

dist/
dist.commonjs/

.npmignore
.prettierrc
tsconfig.json
eslint.config.mjs
prettier.config.*

tsconfig.tsbuildinfo
.github/

CHANGELOG.md
41 changes: 41 additions & 0 deletions packages/did-ckb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<p align="center">
<a href="https://app.ckbccc.com/">
<img alt="Logo" src="https://raw.githubusercontent.com/ckb-devrel/ccc/master/assets/logoAndText.svg" style="height: 8rem; max-width: 90%; padding: 0.5rem 0;" />
</a>
</p>

<h1 align="center" style="font-size: 48px;">
CCC's Support for DID CKB
</h1>

<p align="center">
<a href="https://www.npmjs.com/package/@ckb-ccc/did-ckb"><img
alt="NPM Version" src="https://img.shields.io/npm/v/%40ckb-ccc%2Fdid-ckb"
/></a>
<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/ckb-devrel/ccc" />
<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/ckb-devrel/ccc/master" />
<img alt="GitHub branch check runs" src="https://img.shields.io/github/check-runs/ckb-devrel/ccc/master" />
<a href="https://live.ckbccc.com/"><img
alt="Playground" src="https://img.shields.io/website?url=https%3A%2F%2Flive.ckbccc.com%2F&label=Playground"
/></a>
<a href="https://app.ckbccc.com/"><img
alt="App" src="https://img.shields.io/website?url=https%3A%2F%2Fapp.ckbccc.com%2F&label=App"
/></a>
<a href="https://docs.ckbccc.com/"><img
alt="Docs" src="https://img.shields.io/website?url=https%3A%2F%2Fdocs.ckbccc.com%2F&label=Docs"
/></a>
</p>

<p align="center">
CCC - CKBers' Codebase is a one-stop solution for your CKB JS/TS ecosystem development.
<br />
Empower yourself with CCC to discover the unlimited potential of CKB.
<br />
Interoperate with wallets from different chain ecosystems.
<br />
Fully enabling CKB's Turing completeness and cryptographic freedom power.
</p>

<h3 align="center">
Read more about CCC on <a href="https://docs.ckbccc.com">our website</a> or <a href="https://github.com/ckb-devrel/ccc">GitHub Repo</a>.
</h3>
62 changes: 62 additions & 0 deletions packages/did-ckb/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",
"@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,
];
3 changes: 3 additions & 0 deletions packages/did-ckb/misc/basedirs/dist.commonjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "commonjs"
}
3 changes: 3 additions & 0 deletions packages/did-ckb/misc/basedirs/dist/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
52 changes: 52 additions & 0 deletions packages/did-ckb/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "@ckb-ccc/did-ckb",
"version": "0.0.0",
"description": "UDT",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The package description is currently "UDT", which appears to be incorrect for a package related to DIDs. To avoid confusion for developers using this package, it should be updated to accurately reflect its functionality. A more descriptive text, such as "CCC's support for DID on CKB", would be more appropriate.

Suggested change
"description": "UDT",
"description": "CCC's support for DID on CKB",

"author": "Hanssen0 <hanssen0@hanssen0.com>",
"license": "MIT",
"private": false,
"homepage": "https://github.com/ckb-devrel/ccc",
"repository": {
"type": "git",
"url": "git://github.com/ckb-devrel/ccc.git"
},
"main": "./dist.commonjs/index.js",
"module": "./dist/index.js",
"exports": {
".": {
"import": "./dist/index.js",
"default": "./dist.commonjs/index.js"
},
"./advanced": {
"import": "./dist/advanced.js",
"default": "./dist.commonjs/advanced.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"
},
"devDependencies": {
"@eslint/js": "^9.34.0",
"@types/node": "^24.3.0",
"copyfiles": "^2.4.1",
"eslint": "^9.34.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.4",
"prettier": "^3.6.2",
"prettier-plugin-organize-imports": "^4.2.0",
"rimraf": "^6.0.1",
"typescript": "^5.9.2",
"typescript-eslint": "^8.41.0"
},
"publishConfig": {
"access": "public"
},
"dependencies": {
"@ckb-ccc/core": "workspace:*",
"@ipld/dag-cbor": "^9.2.5"
},
"packageManager": "pnpm@10.8.1"
}
11 changes: 11 additions & 0 deletions packages/did-ckb/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;
4 changes: 4 additions & 0 deletions packages/did-ckb/src/barrel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from "./codec.js";
export * from "./create.js";
export * from "./destroy.js";
export * from "./transfer.js";
Loading
Loading