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: rewrite spore-sdk in ccc #43

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
6 changes: 6 additions & 0 deletions .changeset/dirty-knives-develop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@ckb-ccc/spore": minor
"@ckb-ccc/core": minor
---

add spore package and some known scripts
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ coverage
packages/*/dist*

.vscode
.env

*.DS_Store
4 changes: 1 addition & 3 deletions packages/connector-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ For non-developers, you can also [try CCC's app now here](https://app.ckbccc.com
Before using the Connector, wrap your UI with the CCC Provider:

```tsx
<ccc.Provider>
{/* Your application */}
</ccc.Provider>
<ccc.Provider>{/* Your application */}</ccc.Provider>
```

Check [the document for @ckb-ccc/connector-react](https://docs.ckbccc.com/modules/_ckb_ccc_connector_react.index.ccc.html) for more information.
Expand Down
2 changes: 1 addition & 1 deletion packages/connector-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@
"peerDependencies": {
"react": ">=16"
}
}
}
2 changes: 2 additions & 0 deletions packages/core/src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export enum KnownScript {
SingleUseLock = "SingleUseLock",
OutputTypeProxyLock = "OutputTypeProxyLock",
NervosDao = "NervosDao",
TypeBurn = "TypeBurn",
LockProxy = "LockProxy",
}

/**
Expand Down
34 changes: 34 additions & 0 deletions packages/core/src/client/clientPublicMainnet.advanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,4 +271,38 @@ export const MAINNET_SCRIPTS: Record<
},
],
},
[KnownScript.TypeBurn]: {
codeHash:
"0xff78bae0abf17d7a404c0be0f9ad9c9185b3f88dcc60403453d5ba8e1f22f53a",
hashType: "data1",
cellDeps: [
{
cellDep: {
outPoint: {
txHash:
"0x10d63a996157d32c01078058000052674ca58d15f921bec7f1dcdac2160eb66b",
index: 5,
},
depType: "code",
},
},
],
},
[KnownScript.LockProxy]: {
codeHash:
"0x5d41e32e224c15f152b7e6529100ebeac83b162f5f692a5365774dad2c1a1d02",
hashType: "data1",
cellDeps: [
{
cellDep: {
outPoint: {
txHash:
"0x10d63a996157d32c01078058000052674ca58d15f921bec7f1dcdac2160eb66b",
index: 3,
},
depType: "code",
},
},
],
},
});
34 changes: 34 additions & 0 deletions packages/core/src/client/clientPublicTestnet.advanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,4 +282,38 @@ export const TESTNET_SCRIPTS: Record<
},
],
},
[KnownScript.TypeBurn]: {
codeHash:
"0xff78bae0abf17d7a404c0be0f9ad9c9185b3f88dcc60403453d5ba8e1f22f53a",
hashType: "data1",
cellDeps: [
{
cellDep: {
outPoint: {
txHash:
"0xb4f171c9c9caf7401f54a8e56225ae21d95032150a87a4678eac3f66a3137b93",
index: 5,
},
depType: "code",
},
},
],
},
[KnownScript.LockProxy]: {
codeHash:
"0x5d41e32e224c15f152b7e6529100ebeac83b162f5f692a5365774dad2c1a1d02",
hashType: "data1",
cellDeps: [
{
cellDep: {
outPoint: {
txHash:
"0xb4f171c9c9caf7401f54a8e56225ae21d95032150a87a4678eac3f66a3137b93",
index: 3,
},
depType: "code",
},
},
],
},
});
2 changes: 1 addition & 1 deletion packages/joy-id/src/evm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class EvmSigner extends ccc.SignerEvm {
return {
redirectURL: location.href,
joyidAppURL:
this._appUri ?? this.client.addressPrefix === "ckb"
(this._appUri ?? this.client.addressPrefix === "ckb")
? "https://app.joy.id"
: "https://testnet.joyid.dev",
requestNetwork: `ethereum`,
Expand Down
2 changes: 1 addition & 1 deletion packages/joy-id/src/nostr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class NostrSigner extends ccc.SignerNostr {
return {
redirectURL: location.href,
joyidAppURL:
this._appUri ?? this.client.addressPrefix === "ckb"
(this._appUri ?? this.client.addressPrefix === "ckb")
? "https://app.joy.id"
: "https://testnet.joyid.dev",
requestNetwork: "nostr",
Expand Down
12 changes: 12 additions & 0 deletions packages/spore/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
node_modules/
misc/

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

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

dist/
dist.commoonjs/

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

tsconfig.tsbuildinfo
.github/
5 changes: 5 additions & 0 deletions packages/spore/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": false,
"trailingComma": "all",
"plugins": ["prettier-plugin-organize-imports"]
}
45 changes: 45 additions & 0 deletions packages/spore/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<p align="center">
<a href="https://ckbccc-demo.vercel.app/">
<img alt="Logo" src="https://raw.githubusercontent.com/ckb-ecofund/ccc/master/assets/logo.svg" width="20%" />
</a>
</p>

<h1 align="center" style="font-size: 48px;">
CCC's support for Spore protocol
</h1>

<p align="center">
<a href="https://www.npmjs.com/package/@ckb-ccc/okx"><img
alt="NPM Version" src="https://img.shields.io/npm/v/%40ckb-ccc%2Fokx"
/></a>
<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/ckb-ecofund/ccc" />
<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/ckb-ecofund/ccc/master" />
<img alt="GitHub deployments" src="https://img.shields.io/github/deployments/ckb-ecofund/ccc/production" />
<a href="https://ckbccc-demo.vercel.app/"><img
alt="Demo" src="https://img.shields.io/website?url=https%3A%2F%2Fckbccc-demo.vercel.app%2F&label=Demo"
/></a>
</p>

<p align="center">
"CCC - CKBers' Codebase" is the next step of "Common Chains Connector".
<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>

## Preview

<p align="center">
<a href="https://ckbccc-demo.vercel.app/">
<img src="https://raw.githubusercontent.com/ckb-ecofund/ccc/master/assets/preview.png" width="30%" />
</a>
</p>

This project is still under active development, and we are looking forward to your feedback. [Try its demo now here](https://ckbccc-demo.vercel.app/). It showcases how to use CCC for some basic scenarios in CKB.

<h3 align="center">
Read more about CCC on its <a href="https://github.com/ckb-ecofund/ccc">GitHub Repo</a>.
</h3>
29 changes: 29 additions & 0 deletions packages/spore/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// @ts-check

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

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

export default tseslint.config({
files: ["./src/**/*.ts"],
extends: [
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
],
rules: {
"@typescript-eslint/require-await": "off",
"@typescript-eslint/no-redundant-type-constituents": "off",
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/unbound-method": ["error", { "ignoreStatic": true }],
},
plugins: { prettier: eslintPluginPrettierRecommended },
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: dirname(fileURLToPath(import.meta.url)),
},
},
});
3 changes: 3 additions & 0 deletions packages/spore/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/spore/misc/basedirs/dist/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
53 changes: 53 additions & 0 deletions packages/spore/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "@ckb-ccc/spore",
"version": "0.0.12-alpha.1",
"description": "CCC - CKBer's Codebase. Common Chains Connector's support for Spore protocol",
"author": "Hanssen0 <hanssen0@hanssen0.com>",
"license": "MIT",
"private": false,
"homepage": "https://github.com/ckb-ecofund/ccc",
"repository": {
"type": "git",
"url": "git://github.com/ckb-ecofund/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": {
"build": "rimraf ./dist && rimraf ./dist.commonjs && tsc && tsc --project tsconfig.commonjs.json && copyfiles -u 2 misc/basedirs/**/* .",
"lint": "eslint",
"format": "prettier --write . && eslint --fix"
},
"devDependencies": {
"@eslint/js": "^9.1.1",
"copyfiles": "^2.4.1",
"eslint": "^9.1.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.2.5",
"prettier-plugin-organize-imports": "^3.2.4",
"rimraf": "^5.0.5",
"typescript": "^5.4.5",
"typescript-eslint": "^7.7.0",
"vitest": "^1.6.0",
"dotenv": "^16.4.5"
},
"publishConfig": {
"access": "public"
},
"dependencies": {
"@ckb-ccc/core": "workspace:*",
"@ckb-lumos/base": "^0.24.0-next.1",
"@ckb-lumos/codec": "^0.24.0-next.1",
"axios": "^1.7.7"
}
}
Loading