@ckb-ccc/core 0.0.4-alpha.0 → 0.0.4-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ <h1 align="center" style="font-size: 64px;">
2
+ CCC
3
+ </h1>
4
+
5
+ <p align="center">
6
+ <img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/ckb-ecofund/ccc">
7
+ <img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/ckb-ecofund/ccc/master">
8
+ <img alt="GitHub deployments" src="https://img.shields.io/github/deployments/ckb-ecofund/ccc/production">
9
+ <img alt="Demo" src="https://img.shields.io/website?url=https%3A%2F%2Fckbccc-demo.vercel.app%2F&label=Demo">
10
+ </p>
11
+
12
+ <p align="center">
13
+ "Common Chains Connector" is where CCC begins.
14
+ <br />
15
+ CCC helps you to interoperate wallets from different chain ecosystems with CKB,
16
+ <br />
17
+ fully enabling CKB's cryptographic freedom power.
18
+ </p>
19
+
20
+ ## Preview
21
+
22
+ <p align="center">
23
+ <a href="https://ckbccc-demo.vercel.app/">
24
+ <img src="https://raw.githubusercontent.com/ckb-ecofund/ccc/master/assets/preview.png" width="30%" />
25
+ </a>
26
+ </p>
27
+
28
+ 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/).
29
+
30
+ <h3 align="center">
31
+ Read more about CCC on its <a href="https://github.com/ckb-ecofund/ccc">GitHub Repo</a>.
32
+ </h3>
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@ckb-ccc/core",
3
- "version": "0.0.4-alpha.0",
3
+ "version": "0.0.4-alpha.1",
4
4
  "description": "Common Chains Connector Core",
5
5
  "author": "Hanssen0 <hanssen0@hanssen0.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
8
- "homepage": "https://github.com/Hanssen0/ccc",
8
+ "homepage": "https://github.com/ckb-ecofund/ccc",
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "git://github.com/Hanssen0/ccc.git"
11
+ "url": "git://github.com/ckb-ecofund/ccc.git"
12
12
  },
13
13
  "main": "dist/index.js",
14
14
  "exports": {
@@ -47,5 +47,5 @@
47
47
  "buffer": "^6.0.3",
48
48
  "cross-fetch": "^4.0.0"
49
49
  },
50
- "gitHead": "e49045ed4b2778c92d6f49b79c17125245141a21"
50
+ "gitHead": "7dab1a1d6e3e380b26f43d0d0308bd4da1617029"
51
51
  }
@@ -1,8 +1,8 @@
1
1
  import { bech32, bech32m } from "bech32";
2
- import { hashTypeFromBytes } from "../ckb";
2
+ import { Script, hashTypeFromBytes } from "../ckb";
3
3
  import { Client, KnownScript } from "../client";
4
4
  import { hexFrom } from "../hex";
5
- import { type AddressLike } from "./index";
5
+ import { type Address } from "./index";
6
6
 
7
7
  export function addressPayloadFromString(address: string): {
8
8
  prefix: string;
@@ -42,7 +42,7 @@ export async function addressFromPayload(
42
42
  format: AddressFormat,
43
43
  payload: number[],
44
44
  client: Client,
45
- ): Promise<AddressLike> {
45
+ ): Promise<Address> {
46
46
  if (format === AddressFormat.Full) {
47
47
  if (payload.length < 32 + 1) {
48
48
  throw new Error(
@@ -51,11 +51,11 @@ export async function addressFromPayload(
51
51
  }
52
52
 
53
53
  return {
54
- script: {
54
+ script: Script.from({
55
55
  codeHash: hexFrom(payload.slice(0, 32)),
56
56
  hashType: hashTypeFromBytes(payload.slice(32, 33)),
57
57
  args: hexFrom(payload.slice(33)),
58
- },
58
+ }),
59
59
  prefix,
60
60
  };
61
61
  }
@@ -68,11 +68,11 @@ export async function addressFromPayload(
68
68
  }
69
69
 
70
70
  return {
71
- script: {
71
+ script: Script.from({
72
72
  codeHash: hexFrom(payload.slice(0, 32)),
73
73
  hashType: "data",
74
74
  args: hexFrom(payload.slice(32)),
75
- },
75
+ }),
76
76
  prefix,
77
77
  };
78
78
  }
@@ -85,11 +85,11 @@ export async function addressFromPayload(
85
85
  }
86
86
 
87
87
  return {
88
- script: {
88
+ script: Script.from({
89
89
  codeHash: hexFrom(payload.slice(0, 32)),
90
90
  hashType: "type",
91
91
  args: hexFrom(payload.slice(32)),
92
- },
92
+ }),
93
93
  prefix,
94
94
  };
95
95
  }
@@ -112,10 +112,10 @@ export async function addressFromPayload(
112
112
  }
113
113
 
114
114
  return {
115
- script: {
115
+ script: Script.from({
116
116
  ...(await client.getKnownScript(script)),
117
117
  args: hexFrom(payload.slice(1)),
118
- },
118
+ }),
119
119
  prefix,
120
120
  };
121
121
  }
@@ -45,9 +45,7 @@ export class Address {
45
45
  );
46
46
  }
47
47
 
48
- return Address.from(
49
- await addressFromPayload(prefix, format, payload, client),
50
- );
48
+ return addressFromPayload(prefix, format, payload, client);
51
49
  }
52
50
 
53
51
  static async fromScript(