-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f712b1d
commit 1027242
Showing
23 changed files
with
578 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { encodeSvgToImgSrc } from "./utils.js"; | ||
|
||
export const REI_SVG = encodeSvgToImgSrc( | ||
'<svg id="layer2" data-name="layer2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 88.24 70.95"><defs><style>.cls-1{fill:url(#linear_9)}.cls-2{fill:rgba(155,84,168,0)}</style><linearGradient id="linear_9" data-name="linear 9" x1="216.98" y1="-423.81" x2="170.95" y2="319.28" gradientTransform="translate(18.94 29.12) scale(.09 -.09)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#01f395"/><stop offset="1" stop-color="#01b56a"/></linearGradient></defs><g id="layer1" data-name="layer1"><g><rect class="cls-2" width="88.24" height="70.95"/><g><path class="cls-1" d="m19.08,0H4.9l49.8,70.95h14.19L19.08,0Z"/><path d="m69.08,44.08c9.93-2.84,16.92-9.85,16.92-21.5v-.2c0-6.18-2.12-11.44-5.87-15.29-4.56-4.45-11.54-7.08-20.46-7.08H24.09l7.97,11.37h26.59c9.22,0,14.7,4.12,14.7,11.72v.2c0,7.19-5.68,11.86-14.6,11.86h-9.98l25.11,35.79h14.37l-19.16-26.87Z"/><path d="m0,20.16l35.64,50.78h14.19L14.19,20.16H0Z"/></g></g></g></svg>', | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"singleQuote": false, | ||
"trailingComma": "all", | ||
"plugins": ["prettier-plugin-organize-imports"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<p align="center"> | ||
<a href="https://app.ckbccc.com/"> | ||
<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 REI Wallet | ||
</h1> | ||
|
||
<p align="center"> | ||
<a href="https://www.npmjs.com/package/@ckb-ccc/rei"><img | ||
alt="NPM Version" src="https://img.shields.io/npm/v/%40ckb-ccc%2Frei" | ||
/></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://app.ckbccc.com/"><img | ||
alt="Demo" src="https://img.shields.io/website?url=https%3A%2F%2Fapp.ckbccc.com%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://app.ckbccc.com/"> | ||
<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://app.ckbccc.com/). It showcases how to use CCC for some basic scenarios in CKB. | ||
|
||
<h3 align="center"> | ||
Read more about CCC on <a href="https://docs.ckbccc.com">our website</a> or <a href="https://github.com/ckb-ecofund/ccc">GitHub Repo</a>. | ||
</h3> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)), | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "commonjs" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "module" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"name": "@ckb-ccc/rei", | ||
"version": "0.0.12-alpha.0", | ||
"description": "CCC - CKBer's Codebase. Common Chains Connector's support for Rei", | ||
"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" | ||
}, | ||
"./barrel": { | ||
"import": "./dist/barrel.js", | ||
"default": "./dist.commonjs/barrel.js" | ||
}, | ||
"./advanced": { | ||
"import": "./dist/advanced.js", | ||
"default": "./dist.commonjs/advanced.js" | ||
}, | ||
"./advancedBarrel": { | ||
"import": "./dist/advancedBarrel.js", | ||
"default": "./dist.commonjs/advancedBarrel.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" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@ckb-ccc/core": "workspace:*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * as ReiA from "./advancedBarrel.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import { ccc } from "@ckb-ccc/core"; | ||
|
||
/** | ||
* Interface representing a provider for interacting with accounts and signing messages. | ||
* @interface | ||
*/ | ||
export interface Provider { | ||
/** | ||
* Sends a request to the provider. | ||
* @type {RequestMethod} | ||
*/ | ||
request: RequestMethod; | ||
|
||
/** | ||
* Adds an event listener to the provider. | ||
* @type {OnMethod} | ||
*/ | ||
on: OnMethod; | ||
|
||
/** | ||
* Checks if rei wallet is connected. | ||
* @returns A promise that resolves to true if connected, false otherwise. | ||
*/ | ||
isConnected(): Promise<boolean>; | ||
|
||
/** | ||
* Removes an event listener from the provider. | ||
* @param {string} eventName - The name of the event to remove the listener from. | ||
* @param {(...args: unknown[]) => unknown} listener - The listener function to remove. | ||
* @returns {Provider} The provider instance. | ||
*/ | ||
off(eventName: string, listener: (...args: unknown[]) => unknown): void; | ||
} | ||
|
||
/** | ||
* Interface representing a method to add event listeners to the provider. | ||
* @interface | ||
*/ | ||
export interface OnMethod { | ||
/** | ||
* Adds an event listener to the provider. | ||
* @param {string} eventName - The name of the event. | ||
* @param {(...args: unknown[]) => unknown} listener - The listener function. | ||
* @returns {Provider} The provider instance. | ||
*/ | ||
(eventName: string, listener: (...args: unknown[]) => unknown): void; | ||
} | ||
|
||
export interface RequestMethod { | ||
/** | ||
* Requests the accounts from the provider. | ||
* @param request - The request object. | ||
* @param request.method - The method name. | ||
* @param request.data - The optional method parameters. | ||
* @returns A promise that resolves to an array of account addresses. | ||
*/ | ||
(request: { | ||
method: "ckb_requestAccounts"; | ||
data?: undefined; | ||
}): Promise<string>; | ||
|
||
/** | ||
* Signs a message with the personal account. | ||
* @param request - The request object. | ||
* @param request.method - The method name. | ||
* @param request.data - The method parameters. | ||
* @returns A promise that resolves to the signed message. | ||
*/ | ||
(request: { | ||
method: "ckb_signMessage"; | ||
data: { message: string }; | ||
}): Promise<ccc.Hex>; | ||
|
||
/** | ||
* Gets the identity of the signer. | ||
* @param request - The request object. | ||
* @param request.method - The method name. | ||
* @returns A promise that resolves to the signed message. | ||
*/ | ||
(request: { method: "ckb_getPublicKey" }): Promise<string>; | ||
|
||
/** | ||
* Get network. | ||
* @param request - The request object. | ||
* @param request.method - The method name. | ||
* @param request.data - The method parameters. | ||
* @returns A promise that resolves to the signed message. | ||
*/ | ||
(request: { | ||
method: "ckb_switchNetwork"; | ||
data: string; | ||
}): Promise<{ type: string; network: string }>; | ||
|
||
/** | ||
* Signs transaction . | ||
* @param request - The request object. | ||
* @param request.method - The method name. | ||
* @param request.data - The method parameters. | ||
* @returns A promise that resolves to the signed message. | ||
*/ | ||
|
||
(request: { method: "ckb_signTransaction"; data: any }): Promise<any>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./signer.js"; | ||
export * from "./signersFactory.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * as Rei from "./barrel.js"; |
Oops, something went wrong.