From 42a9487768b675402aa0a79aee2c801cdfb1b66e Mon Sep 17 00:00:00 2001 From: homura Date: Fri, 15 Mar 2024 13:38:08 +0800 Subject: [PATCH 01/18] chore: preview joyid --- examples/joyid/index.html | 16 + examples/joyid/index.tsx | 90 ++++ examples/joyid/joyid.ts | 134 +++++ examples/joyid/lib.ts | 52 ++ examples/joyid/package.json | 26 + examples/joyid/tsconfig.json | 10 + examples/package.json | 2 + examples/pnpm-lock.yaml | 973 +++++++++++++++++++++++++++++++---- 8 files changed, 1202 insertions(+), 101 deletions(-) create mode 100644 examples/joyid/index.html create mode 100644 examples/joyid/index.tsx create mode 100644 examples/joyid/joyid.ts create mode 100644 examples/joyid/lib.ts create mode 100644 examples/joyid/package.json create mode 100644 examples/joyid/tsconfig.json diff --git a/examples/joyid/index.html b/examples/joyid/index.html new file mode 100644 index 000000000..33ced8621 --- /dev/null +++ b/examples/joyid/index.html @@ -0,0 +1,16 @@ + + + + + + + Lumos & JoyID + + +
+ + + diff --git a/examples/joyid/index.tsx b/examples/joyid/index.tsx new file mode 100644 index 000000000..7f03eeb18 --- /dev/null +++ b/examples/joyid/index.tsx @@ -0,0 +1,90 @@ +import React, { useEffect, useState } from "react"; +import ReactDOM from "react-dom"; +import { connect, initConfig, signRawTransaction } from "@joyid/ckb"; +import { buildTransfer, capacityOf, sendTransaction } from "./lib"; +import { formatUnit, parseUnit } from "@ckb-lumos/lumos/utils"; +import { createTransactionFromSkeleton } from "@ckb-lumos/lumos/helpers"; + +initConfig({ network: "testnet" }); + +const App = () => { + const [address, setAddress] = useState(""); + const [balance, setBalance] = useState("-"); + const [transferAddr, setTransferAddr] = useState(""); + const [transferAmount, setTransferAmount] = useState(""); + const [isSendingTx, setIsSendingTx] = useState(false); + const [txHash, setTxHash] = useState(""); + + useEffect(() => { + if (!address) return; + capacityOf(address).then((balance) => setBalance(formatUnit(balance, "ckb") + " CKB")); + }, [address]); + + async function transfer(): Promise { + const unsigned = await buildTransfer({ amount: parseUnit(transferAmount, "ckb"), from: address, to: transferAddr }); + const tx = createTransactionFromSkeleton(unsigned); + // @ts-ignore data2 is not defined in joyid sdk + const signed = await signRawTransaction(tx, address); + const txHash = await sendTransaction(signed); + return txHash; + } + + function onTransfer() { + if (isSendingTx) return; + setIsSendingTx(true); + + transfer() + .then(setTxHash) + .finally(() => setIsSendingTx(false)); + } + + if (!address) { + return ( +
+ +
+ ); + } + + if (!address.startsWith("ckt")) { + alert("The example should only be used in CKB testnet"); + } + + return ( +
+
CKB address: {address}
+
Balance: {balance}
+

Transfer

+
+ + setTransferAmount(e.target.value)} + /> +
+ + setTransferAddr(e.target.value)} + /> +
+ +
+ {txHash && ( + + Check In Explorer + + )} +
+
+ ); +}; + +const app = document.getElementById("root"); +ReactDOM.render(, app); diff --git a/examples/joyid/joyid.ts b/examples/joyid/joyid.ts new file mode 100644 index 000000000..060765b92 --- /dev/null +++ b/examples/joyid/joyid.ts @@ -0,0 +1,134 @@ +import { getJoyIDLockScript, RSA2048_PUBKEY_SIG_LEN } from "@nervina-labs/joyid-sdk"; +import { blockchain, bytes } from "@ckb-lumos/lumos/codec"; +import { registerCustomLockScriptInfos } from "@ckb-lumos/lumos/common-scripts/common"; +import { WitnessArgs, commons, helpers, Script, Cell } from "@ckb-lumos/lumos"; +import { CKBComponents } from "@ckb-lumos/lumos/rpc"; + +export interface CellCollector { + collect(): AsyncIterable; +} + +export interface CellProvider { + uri?: string; + collector(queryOptions: CKBComponents.QueryOptions): CellCollector; +} + +class JoyIDCellCollector { + readonly fromScript: Script; + private readonly cellCollector: CellCollector; + + constructor( + fromAddr: string, + cellProvider: CellProvider, + { queryOptions = {} }: { queryOptions: CKBComponents.QueryOptions } + ) { + if (!cellProvider) { + throw new Error(`cellProvider is required when collecting JoyID-related cells`); + } + + this.fromScript = helpers.parseAddress(fromAddr); + + queryOptions = { + ...queryOptions, + lock: this.fromScript, + type: queryOptions.type || "empty", + }; + + this.cellCollector = cellProvider.collector(queryOptions); + } + + async *collect(): AsyncGenerator { + for await (const inputCell of this.cellCollector.collect()) { + yield inputCell; + } + } +} + +function createJoyIDScriptInfo(): commons.LockScriptInfo { + return { + codeHash: getJoyIDLockScript().codeHash, + hashType: "type", + lockScriptInfo: { + CellCollector: JoyIDCellCollector, + prepareSigningEntries: null, + async setupInputCell(txSkeleton, inputCell, _, options = {}) { + const template = getJoyIDLockScript(); + + const fromScript = inputCell.cellOutput.lock; + asserts(bytes.equal(fromScript.codeHash, template.codeHash), `The input script is not Unipass script`); + // add inputCell to txSkeleton + txSkeleton = txSkeleton.update("inputs", (inputs) => inputs.push(inputCell)); + + const output: Cell = { + cellOutput: { + capacity: inputCell.cellOutput.capacity, + lock: inputCell.cellOutput.lock, + type: inputCell.cellOutput.type, + }, + data: inputCell.data, + }; + + txSkeleton = txSkeleton.update("outputs", (outputs) => { + return outputs.push(output); + }); + + const since = options.since; + if (since) { + txSkeleton = txSkeleton.update("inputSinces", (inputSinces) => { + return inputSinces.set(txSkeleton.get("inputs").size - 1, since); + }); + } + + txSkeleton = txSkeleton.update("witnesses", (witnesses) => { + return witnesses.push("0x"); + }); + + if (!template) { + throw new Error(`UNIPASS script not defined in config!`); + } + + // add cell dep + txSkeleton = helpers.addCellDep(txSkeleton, { + outPoint: { + txHash: "0x4dcf3f3b09efac8995d6cbee87c5345e812d310094651e0c3d9a730f32dc9263", + index: "0x0", + }, + depType: "depGroup", + }); + + // add witness + /* + * Modify the skeleton, so the first witness of the fromAddress script group + * has a WitnessArgs construct with 85-byte zero filled values. While this + * is not required, it helps in transaction fee estimation. + */ + const firstIndex = txSkeleton + .get("inputs") + .findIndex((input) => + bytes.equal(blockchain.Script.pack(input.cellOutput.lock), blockchain.Script.pack(fromScript)) + ); + if (firstIndex !== -1) { + while (firstIndex >= txSkeleton.get("witnesses").size) { + txSkeleton = txSkeleton.update("witnesses", (witnesses) => witnesses.push("0x")); + } + let witness: string = txSkeleton.get("witnesses").get(firstIndex)!; + const newWitnessArgs: WitnessArgs = { + lock: bytes.hexify(new Uint8Array(RSA2048_PUBKEY_SIG_LEN)), + }; + witness = bytes.hexify(blockchain.WitnessArgs.pack(newWitnessArgs)); + txSkeleton = txSkeleton.update("witnesses", (witnesses) => witnesses.set(firstIndex, witness)); + } + + return txSkeleton; + }, + }, + }; +} + +function asserts(condition: unknown, message = "Assert failed"): asserts condition { + if (!condition) { + throw new Error(message); + } +} + +registerCustomLockScriptInfos([createJoyIDScriptInfo()]); diff --git a/examples/joyid/lib.ts b/examples/joyid/lib.ts new file mode 100644 index 000000000..4d42b896a --- /dev/null +++ b/examples/joyid/lib.ts @@ -0,0 +1,52 @@ +import { BI, config, Indexer, RPC, helpers, commons, Transaction, Hash, BIish } from "@ckb-lumos/lumos"; +import "./joyid"; + +export const CONFIG = config.predefined.AGGRON4; +config.initializeConfig(CONFIG); +const CKB_RPC_URL = "https://testnet.ckb.dev/rpc"; +const rpc = new RPC(CKB_RPC_URL); +const indexer = new Indexer(CKB_RPC_URL); + +export function asyncSleep(ms: number): Promise { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +export interface TransferOptions { + from: string; + to: string; + amount: BIish; +} + +export async function buildTransfer(options: TransferOptions) { + let txSkeleton = helpers.TransactionSkeleton({ cellProvider: indexer }); + const fromScript = helpers.parseAddress(options.from); + const fromAddress = helpers.encodeToAddress(fromScript, { config: CONFIG }); + const toScript = helpers.parseAddress(options.to); + const toAddress = helpers.encodeToAddress(toScript, { config: CONFIG }); + txSkeleton = await commons.common.transfer( + txSkeleton, + [fromAddress], + toAddress, + options.amount, + undefined, + undefined, + { config: CONFIG } + ); + txSkeleton = await commons.common.payFee(txSkeleton, [fromAddress], 1000, undefined, { config: CONFIG }); + return txSkeleton; +} + +export async function sendTransaction(tx: Transaction): Promise { + return rpc.sendTransaction(tx, "passthrough"); +} + +export async function capacityOf(address: string): Promise { + const collector = indexer.collector({ + lock: helpers.parseAddress(address), + }); + let balance = BI.from(0); + for await (const cell of collector.collect()) { + balance = balance.add(cell.cellOutput.capacity); + } + return balance; +} diff --git a/examples/joyid/package.json b/examples/joyid/package.json new file mode 100644 index 000000000..12c5ff558 --- /dev/null +++ b/examples/joyid/package.json @@ -0,0 +1,26 @@ +{ + "private": true, + "name": "@lumos-examples/joyid", + "version": "0.21.0-next.0", + "description": "", + "main": "index.js", + "scripts": { + "start": "parcel index.html", + "lint": "tsc --noEmit" + }, + "keywords": [], + "author": "", + "license": "MIT", + "dependencies": { + "@ckb-lumos/lumos": "canary", + "@types/react": "^18.0.25", + "@types/react-dom": "^18.0.9", + "@joyid/ckb": "^0.0.4", + "@nervina-labs/joyid-sdk": "^0.3.0", + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "parcel": "^2.9.3" + } +} diff --git a/examples/joyid/tsconfig.json b/examples/joyid/tsconfig.json new file mode 100644 index 000000000..db6e00f7f --- /dev/null +++ b/examples/joyid/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "lib": ["dom"], + "jsx": "react", + "module": "CommonJS", + "skipLibCheck": true, + "esModuleInterop": true, + "target": "ES2020" + } +} diff --git a/examples/package.json b/examples/package.json index 37019283a..6e78fc81a 100644 --- a/examples/package.json +++ b/examples/package.json @@ -7,7 +7,9 @@ "@parcel/config-default": "^2.8.0", "@parcel/transformer-js": "^2.8.0", "@parcel/transformer-react-refresh-wrap": "^2.8.0", + "assert": "^2.0.0", "buffer": "^5.5.0", + "constants-browserify": "^1.0.0", "crypto-browserify": "^3.12.0", "events": "^3.1.0", "path-browserify": "^1.0.0", diff --git a/examples/pnpm-lock.yaml b/examples/pnpm-lock.yaml index fbafbc039..f2ad7bd86 100644 --- a/examples/pnpm-lock.yaml +++ b/examples/pnpm-lock.yaml @@ -17,9 +17,15 @@ importers: '@parcel/transformer-react-refresh-wrap': specifier: ^2.8.0 version: 2.8.0(@parcel/core@2.9.3) + assert: + specifier: ^2.0.0 + version: 2.1.0 buffer: specifier: ^5.5.0 version: 5.5.0 + constants-browserify: + specifier: ^1.0.0 + version: 1.0.0 crypto-browserify: specifier: ^3.12.0 version: 3.12.0 @@ -39,13 +45,13 @@ importers: ../packages/base: dependencies: '@ckb-lumos/bi': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../bi '@ckb-lumos/codec': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../codec '@ckb-lumos/toolkit': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../toolkit '@types/blake2b': specifier: ^2.1.0 @@ -76,19 +82,19 @@ importers: ../packages/ckb-indexer: dependencies: '@ckb-lumos/base': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../base '@ckb-lumos/bi': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../bi '@ckb-lumos/codec': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../codec '@ckb-lumos/rpc': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../rpc '@ckb-lumos/toolkit': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../toolkit cross-fetch: specifier: ^3.1.5 @@ -98,7 +104,7 @@ importers: version: 3.3.0 devDependencies: '@ckb-lumos/testkit': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../testkit '@types/lodash.uniqby': specifier: ^4.7.7 @@ -125,7 +131,7 @@ importers: ../packages/codec: dependencies: '@ckb-lumos/bi': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../bi devDependencies: escape-string-regexp: @@ -138,25 +144,25 @@ importers: ../packages/common-scripts: dependencies: '@ckb-lumos/base': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../base '@ckb-lumos/bi': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../bi '@ckb-lumos/codec': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../codec '@ckb-lumos/config-manager': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../config-manager '@ckb-lumos/helpers': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../helpers '@ckb-lumos/rpc': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../rpc '@ckb-lumos/toolkit': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../toolkit bech32: specifier: ^2.0.0 @@ -169,10 +175,10 @@ importers: version: 4.3.0 devDependencies: '@ckb-lumos/debugger': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../debugger '@ckb-lumos/hd': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../hd '@types/keccak': specifier: ^3.0.1 @@ -187,16 +193,16 @@ importers: ../packages/config-manager: dependencies: '@ckb-lumos/base': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../base '@ckb-lumos/bi': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../bi '@ckb-lumos/codec': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../codec '@ckb-lumos/rpc': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../rpc '@types/deep-freeze-strict': specifier: ^1.1.0 @@ -208,22 +214,22 @@ importers: ../packages/debugger: dependencies: '@ckb-lumos/base': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../base '@ckb-lumos/bi': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../bi '@ckb-lumos/codec': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../codec '@ckb-lumos/config-manager': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../config-manager '@ckb-lumos/helpers': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../helpers '@ckb-lumos/rpc': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../rpc '@types/download': specifier: ^8.0.1 @@ -245,55 +251,55 @@ importers: version: 3.0.0 devDependencies: '@ckb-lumos/common-scripts': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../common-scripts '@ckb-lumos/experiment-tx-assembler': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../experiment-tx-assembler '@ckb-lumos/hd': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../hd ../packages/e2e-test: dependencies: '@ckb-lumos/base': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../base '@ckb-lumos/bi': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../bi '@ckb-lumos/ckb-indexer': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../ckb-indexer '@ckb-lumos/codec': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../codec '@ckb-lumos/common-scripts': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../common-scripts '@ckb-lumos/config-manager': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../config-manager '@ckb-lumos/hd': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../hd '@ckb-lumos/helpers': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../helpers '@ckb-lumos/light-client': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../light-client '@ckb-lumos/rpc': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../rpc '@ckb-lumos/runner': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../runner '@ckb-lumos/toolkit': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../toolkit '@ckb-lumos/utils': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../utils '@types/kill-port': specifier: ^2.0.0 @@ -306,7 +312,7 @@ importers: version: 2.0.1 devDependencies: '@ckb-lumos/testkit': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../testkit '@types/request': specifier: ^2.48.8 @@ -327,28 +333,28 @@ importers: ../packages/experiment-tx-assembler: dependencies: '@ckb-lumos/base': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../base '@ckb-lumos/bi': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../bi '@ckb-lumos/config-manager': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../config-manager '@ckb-lumos/helpers': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../helpers '@ckb-lumos/toolkit': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../toolkit ../packages/hd: dependencies: '@ckb-lumos/base': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../base '@ckb-lumos/bi': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../bi bn.js: specifier: ^5.1.3 @@ -379,22 +385,22 @@ importers: ../packages/hd-cache: dependencies: '@ckb-lumos/base': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../base '@ckb-lumos/bi': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../bi '@ckb-lumos/ckb-indexer': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../ckb-indexer '@ckb-lumos/config-manager': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../config-manager '@ckb-lumos/hd': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../hd '@ckb-lumos/rpc': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../rpc immutable: specifier: ^4.3.0 @@ -410,19 +416,19 @@ importers: ../packages/helpers: dependencies: '@ckb-lumos/base': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../base '@ckb-lumos/bi': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../bi '@ckb-lumos/codec': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../codec '@ckb-lumos/config-manager': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../config-manager '@ckb-lumos/toolkit': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../toolkit bech32: specifier: ^2.0.0 @@ -434,13 +440,13 @@ importers: ../packages/light-client: dependencies: '@ckb-lumos/base': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../base '@ckb-lumos/ckb-indexer': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../ckb-indexer '@ckb-lumos/rpc': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../rpc cross-fetch: specifier: ^3.1.5 @@ -450,7 +456,7 @@ importers: version: 3.3.0 devDependencies: '@ckb-lumos/testkit': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../testkit '@types/request': specifier: ^2.48.8 @@ -468,49 +474,49 @@ importers: ../packages/lumos: dependencies: '@ckb-lumos/base': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../base '@ckb-lumos/bi': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../bi '@ckb-lumos/ckb-indexer': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../ckb-indexer '@ckb-lumos/codec': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../codec '@ckb-lumos/common-scripts': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../common-scripts '@ckb-lumos/config-manager': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../config-manager '@ckb-lumos/hd': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../hd '@ckb-lumos/helpers': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../helpers '@ckb-lumos/light-client': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../light-client '@ckb-lumos/rpc': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../rpc '@ckb-lumos/toolkit': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../toolkit '@ckb-lumos/transaction-manager': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../transaction-manager ../packages/molecule: dependencies: '@ckb-lumos/bi': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../bi '@ckb-lumos/codec': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../codec '@types/moo': specifier: ^0.5.9 @@ -535,7 +541,7 @@ importers: version: 3.0.2 devDependencies: '@ckb-lumos/base': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../base jsbi: specifier: ^4.1.0 @@ -544,10 +550,10 @@ importers: ../packages/rpc: dependencies: '@ckb-lumos/base': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../base '@ckb-lumos/bi': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../bi abort-controller: specifier: ^3.0.0 @@ -575,7 +581,7 @@ importers: ../packages/runner: dependencies: '@ckb-lumos/utils': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../utils '@ltd/j-toml': specifier: ^1.38.0 @@ -611,16 +617,16 @@ importers: ../packages/testkit: dependencies: '@ckb-lumos/base': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../base '@ckb-lumos/bi': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../bi '@ckb-lumos/codec': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../codec '@ckb-lumos/rpc': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../rpc '@types/body-parser': specifier: ^1.19.1 @@ -657,7 +663,7 @@ importers: ../packages/toolkit: dependencies: '@ckb-lumos/bi': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../bi devDependencies: '@babel/plugin-proposal-export-namespace-from': @@ -670,19 +676,19 @@ importers: ../packages/transaction-manager: dependencies: '@ckb-lumos/base': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../base '@ckb-lumos/ckb-indexer': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../ckb-indexer '@ckb-lumos/codec': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../codec '@ckb-lumos/rpc': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../rpc '@ckb-lumos/toolkit': - specifier: 0.22.0-next.4 + specifier: 0.22.0-next.5 version: link:../toolkit immutable: specifier: ^4.3.0 @@ -768,6 +774,34 @@ importers: specifier: 5.0.4 version: 5.0.4 + joyid: + dependencies: + '@ckb-lumos/lumos': + specifier: canary + version: link:../../packages/lumos + '@joyid/ckb': + specifier: ^0.0.4 + version: 0.0.4 + '@nervina-labs/joyid-sdk': + specifier: ^0.3.0 + version: 0.3.0 + '@types/react': + specifier: ^18.0.25 + version: 18.0.25 + '@types/react-dom': + specifier: ^18.0.9 + version: 18.0.9 + react: + specifier: ^18.2.0 + version: 18.2.0 + react-dom: + specifier: ^18.2.0 + version: 18.2.0(react@18.2.0) + devDependencies: + parcel: + specifier: ^2.9.3 + version: 2.9.3 + misc: dependencies: '@ckb-lumos/lumos': @@ -1295,6 +1329,321 @@ packages: resolution: {integrity: sha512-pWfNQaCwmFFGkbQMVHpDeMZJD7LThPfxqZJyZg0PRke6P6pwHKx2fZoXXEryqmwA1RwsvQ99S/FesQMLmcEVfw==} dev: false + /@ethersproject/abi@5.7.0: + resolution: {integrity: sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==} + dependencies: + '@ethersproject/address': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/constants': 5.7.0 + '@ethersproject/hash': 5.7.0 + '@ethersproject/keccak256': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/properties': 5.7.0 + '@ethersproject/strings': 5.7.0 + dev: false + + /@ethersproject/abstract-provider@5.7.0: + resolution: {integrity: sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==} + dependencies: + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/networks': 5.7.1 + '@ethersproject/properties': 5.7.0 + '@ethersproject/transactions': 5.7.0 + '@ethersproject/web': 5.7.1 + dev: false + + /@ethersproject/abstract-signer@5.7.0: + resolution: {integrity: sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==} + dependencies: + '@ethersproject/abstract-provider': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/properties': 5.7.0 + dev: false + + /@ethersproject/address@5.7.0: + resolution: {integrity: sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==} + dependencies: + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/keccak256': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/rlp': 5.7.0 + dev: false + + /@ethersproject/base64@5.7.0: + resolution: {integrity: sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==} + dependencies: + '@ethersproject/bytes': 5.7.0 + dev: false + + /@ethersproject/basex@5.7.0: + resolution: {integrity: sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw==} + dependencies: + '@ethersproject/bytes': 5.7.0 + '@ethersproject/properties': 5.7.0 + dev: false + + /@ethersproject/bignumber@5.7.0: + resolution: {integrity: sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==} + dependencies: + '@ethersproject/bytes': 5.7.0 + '@ethersproject/logger': 5.7.0 + bn.js: 5.2.1 + dev: false + + /@ethersproject/bytes@5.7.0: + resolution: {integrity: sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==} + dependencies: + '@ethersproject/logger': 5.7.0 + dev: false + + /@ethersproject/constants@5.7.0: + resolution: {integrity: sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==} + dependencies: + '@ethersproject/bignumber': 5.7.0 + dev: false + + /@ethersproject/contracts@5.7.0: + resolution: {integrity: sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==} + dependencies: + '@ethersproject/abi': 5.7.0 + '@ethersproject/abstract-provider': 5.7.0 + '@ethersproject/abstract-signer': 5.7.0 + '@ethersproject/address': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/constants': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/properties': 5.7.0 + '@ethersproject/transactions': 5.7.0 + dev: false + + /@ethersproject/hash@5.7.0: + resolution: {integrity: sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==} + dependencies: + '@ethersproject/abstract-signer': 5.7.0 + '@ethersproject/address': 5.7.0 + '@ethersproject/base64': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/keccak256': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/properties': 5.7.0 + '@ethersproject/strings': 5.7.0 + dev: false + + /@ethersproject/hdnode@5.7.0: + resolution: {integrity: sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg==} + dependencies: + '@ethersproject/abstract-signer': 5.7.0 + '@ethersproject/basex': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/pbkdf2': 5.7.0 + '@ethersproject/properties': 5.7.0 + '@ethersproject/sha2': 5.7.0 + '@ethersproject/signing-key': 5.7.0 + '@ethersproject/strings': 5.7.0 + '@ethersproject/transactions': 5.7.0 + '@ethersproject/wordlists': 5.7.0 + dev: false + + /@ethersproject/json-wallets@5.7.0: + resolution: {integrity: sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g==} + dependencies: + '@ethersproject/abstract-signer': 5.7.0 + '@ethersproject/address': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/hdnode': 5.7.0 + '@ethersproject/keccak256': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/pbkdf2': 5.7.0 + '@ethersproject/properties': 5.7.0 + '@ethersproject/random': 5.7.0 + '@ethersproject/strings': 5.7.0 + '@ethersproject/transactions': 5.7.0 + aes-js: 3.0.0 + scrypt-js: 3.0.1 + dev: false + + /@ethersproject/keccak256@5.7.0: + resolution: {integrity: sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==} + dependencies: + '@ethersproject/bytes': 5.7.0 + js-sha3: 0.8.0 + dev: false + + /@ethersproject/logger@5.7.0: + resolution: {integrity: sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==} + dev: false + + /@ethersproject/networks@5.7.1: + resolution: {integrity: sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==} + dependencies: + '@ethersproject/logger': 5.7.0 + dev: false + + /@ethersproject/pbkdf2@5.7.0: + resolution: {integrity: sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw==} + dependencies: + '@ethersproject/bytes': 5.7.0 + '@ethersproject/sha2': 5.7.0 + dev: false + + /@ethersproject/properties@5.7.0: + resolution: {integrity: sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==} + dependencies: + '@ethersproject/logger': 5.7.0 + dev: false + + /@ethersproject/providers@5.7.2: + resolution: {integrity: sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg==} + dependencies: + '@ethersproject/abstract-provider': 5.7.0 + '@ethersproject/abstract-signer': 5.7.0 + '@ethersproject/address': 5.7.0 + '@ethersproject/base64': 5.7.0 + '@ethersproject/basex': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/constants': 5.7.0 + '@ethersproject/hash': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/networks': 5.7.1 + '@ethersproject/properties': 5.7.0 + '@ethersproject/random': 5.7.0 + '@ethersproject/rlp': 5.7.0 + '@ethersproject/sha2': 5.7.0 + '@ethersproject/strings': 5.7.0 + '@ethersproject/transactions': 5.7.0 + '@ethersproject/web': 5.7.1 + bech32: 1.1.4 + ws: 7.4.6 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + + /@ethersproject/random@5.7.0: + resolution: {integrity: sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ==} + dependencies: + '@ethersproject/bytes': 5.7.0 + '@ethersproject/logger': 5.7.0 + dev: false + + /@ethersproject/rlp@5.7.0: + resolution: {integrity: sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==} + dependencies: + '@ethersproject/bytes': 5.7.0 + '@ethersproject/logger': 5.7.0 + dev: false + + /@ethersproject/sha2@5.7.0: + resolution: {integrity: sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw==} + dependencies: + '@ethersproject/bytes': 5.7.0 + '@ethersproject/logger': 5.7.0 + hash.js: 1.1.7 + dev: false + + /@ethersproject/signing-key@5.7.0: + resolution: {integrity: sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==} + dependencies: + '@ethersproject/bytes': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/properties': 5.7.0 + bn.js: 5.2.1 + elliptic: 6.5.4 + hash.js: 1.1.7 + dev: false + + /@ethersproject/solidity@5.7.0: + resolution: {integrity: sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA==} + dependencies: + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/keccak256': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/sha2': 5.7.0 + '@ethersproject/strings': 5.7.0 + dev: false + + /@ethersproject/strings@5.7.0: + resolution: {integrity: sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==} + dependencies: + '@ethersproject/bytes': 5.7.0 + '@ethersproject/constants': 5.7.0 + '@ethersproject/logger': 5.7.0 + dev: false + + /@ethersproject/transactions@5.7.0: + resolution: {integrity: sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==} + dependencies: + '@ethersproject/address': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/constants': 5.7.0 + '@ethersproject/keccak256': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/properties': 5.7.0 + '@ethersproject/rlp': 5.7.0 + '@ethersproject/signing-key': 5.7.0 + dev: false + + /@ethersproject/units@5.7.0: + resolution: {integrity: sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==} + dependencies: + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/constants': 5.7.0 + '@ethersproject/logger': 5.7.0 + dev: false + + /@ethersproject/wallet@5.7.0: + resolution: {integrity: sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==} + dependencies: + '@ethersproject/abstract-provider': 5.7.0 + '@ethersproject/abstract-signer': 5.7.0 + '@ethersproject/address': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/hash': 5.7.0 + '@ethersproject/hdnode': 5.7.0 + '@ethersproject/json-wallets': 5.7.0 + '@ethersproject/keccak256': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/properties': 5.7.0 + '@ethersproject/random': 5.7.0 + '@ethersproject/signing-key': 5.7.0 + '@ethersproject/transactions': 5.7.0 + '@ethersproject/wordlists': 5.7.0 + dev: false + + /@ethersproject/web@5.7.1: + resolution: {integrity: sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==} + dependencies: + '@ethersproject/base64': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/properties': 5.7.0 + '@ethersproject/strings': 5.7.0 + dev: false + + /@ethersproject/wordlists@5.7.0: + resolution: {integrity: sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA==} + dependencies: + '@ethersproject/bytes': 5.7.0 + '@ethersproject/hash': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/properties': 5.7.0 + '@ethersproject/strings': 5.7.0 + dev: false + /@isaacs/cliui@8.0.2: resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} engines: {node: '>=12'} @@ -1563,6 +1912,10 @@ packages: chalk: 4.1.2 dev: true + /@joyid/ckb@0.0.4: + resolution: {integrity: sha512-n80r8VfwiPxpZzni1qZYWZXY7MxTTW6oGuhF6PAmZ0bLbly00zC4gFshxv+Pxa28mpil+ynS+oiyRF5jyMsNlQ==} + dev: false + /@jridgewell/gen-mapping@0.3.3: resolution: {integrity: sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==} engines: {node: '>=6.0.0'} @@ -1768,6 +2121,62 @@ packages: dev: true optional: true + /@nervina-labs/joyid-sdk@0.3.0: + resolution: {integrity: sha512-cw6yPqZsObIVO97VJDb8oIJq6K+OwPOa/QLFJCPTvxBuc3akmEaFtB70Jrc1igQgkPPS5BXcLC2P5WGH/U8bqA==} + dependencies: + '@nervosnetwork/ckb-sdk-core': 0.103.1 + '@nervosnetwork/ckb-sdk-utils': 0.103.1 + '@nervosnetwork/ckb-types': 0.103.1 + axios: 0.27.2 + bn.js: 4.12.0 + camelcase-keys: 7.0.2 + convert-keys: 1.3.4 + elliptic: 6.5.4 + ethers: 5.7.2 + fast-sha256: 1.3.0 + js-sha3: 0.8.0 + node-rsa: 1.1.1 + transitivePeerDependencies: + - bufferutil + - debug + - utf-8-validate + dev: false + + /@nervosnetwork/ckb-sdk-core@0.103.1: + resolution: {integrity: sha512-LeNwId3GaQILVpnY1zfNBY897XQJPODKeP6d7w6tww9anu0jSxrvXVxGMDTTn3Yz5mixzBgpFGo4SXRrH0eiaQ==} + dependencies: + '@nervosnetwork/ckb-sdk-rpc': 0.103.1 + '@nervosnetwork/ckb-sdk-utils': 0.103.1 + '@nervosnetwork/ckb-types': 0.103.1 + tslib: 2.3.1 + transitivePeerDependencies: + - debug + dev: false + + /@nervosnetwork/ckb-sdk-rpc@0.103.1: + resolution: {integrity: sha512-n3V/5Be7PilyHXUcR6yAiwanMcuZNLfslu9A84OpfB22hlkwIv7OFG/JvFNack/cANPfChRAWB+VWiYGwSON/A==} + dependencies: + '@nervosnetwork/ckb-sdk-utils': 0.103.1 + axios: 0.21.4 + tslib: 2.3.1 + transitivePeerDependencies: + - debug + dev: false + + /@nervosnetwork/ckb-sdk-utils@0.103.1: + resolution: {integrity: sha512-OzpFNKkOOqYWDHDjPf11uOfOf8EQOEstOBxVtyFjrGEx3B9FwsGxItlHYeuTfpFkHF2Ut+G9M3X71w8h/IApdQ==} + dependencies: + '@nervosnetwork/ckb-types': 0.103.1 + bech32: 2.0.0 + elliptic: 6.5.4 + jsbi: 3.1.3 + tslib: 2.3.1 + dev: false + + /@nervosnetwork/ckb-types@0.103.1: + resolution: {integrity: sha512-gGRR1VvUS/KRq2ChhXHPiHpgyLYazPM2R8lK87shQI82Gp2/m6k1HVDeNR5XOYwQ3YmBbxHGQtQr/kMq7DUlZA==} + dev: false + /@noble/hashes@1.3.3: resolution: {integrity: sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==} engines: {node: '>= 16'} @@ -3637,6 +4046,10 @@ packages: engines: {node: '>= 10.0.0'} dev: false + /aes-js@3.0.0: + resolution: {integrity: sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==} + dev: false + /ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} dependencies: @@ -3726,15 +4139,30 @@ packages: resolution: {integrity: sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==} dependencies: safer-buffer: 2.1.2 - dev: true /assert-plus@1.0.0: resolution: {integrity: sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==} engines: {node: '>=0.8'} dev: true + /assert@2.1.0: + resolution: {integrity: sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw==} + dependencies: + call-bind: 1.0.2 + is-nan: 1.3.2 + object-is: 1.1.6 + object.assign: 4.1.5 + util: 0.12.5 + dev: true + /asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + + /available-typed-arrays@1.0.7: + resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} + engines: {node: '>= 0.4'} + dependencies: + possible-typed-array-names: 1.0.0 dev: true /aws-sign2@0.7.0: @@ -3745,6 +4173,23 @@ packages: resolution: {integrity: sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==} dev: true + /axios@0.21.4: + resolution: {integrity: sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==} + dependencies: + follow-redirects: 1.15.6 + transitivePeerDependencies: + - debug + dev: false + + /axios@0.27.2: + resolution: {integrity: sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==} + dependencies: + follow-redirects: 1.15.6 + form-data: 4.0.0 + transitivePeerDependencies: + - debug + dev: false + /babel-jest@28.1.3(@babel/core@7.16.0): resolution: {integrity: sha512-epUaPOEWMk3cWX0M/sPvCHHCe9fMFAa/9hXEgKP8nFfNl/jlGkE9ucq9NqkZGXLDduCJYS0UvSlPUwC0S+rH6Q==} engines: {node: ^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0} @@ -3838,6 +4283,10 @@ packages: tweetnacl: 0.14.5 dev: true + /bech32@1.1.4: + resolution: {integrity: sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==} + dev: false + /bech32@2.0.0: resolution: {integrity: sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==} @@ -3929,7 +4378,6 @@ packages: /bn.js@5.2.1: resolution: {integrity: sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==} - dev: true /body-parser@1.19.0: resolution: {integrity: sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==} @@ -4162,11 +4610,32 @@ packages: function-bind: 1.1.1 get-intrinsic: 1.2.1 + /call-bind@1.0.7: + resolution: {integrity: sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==} + engines: {node: '>= 0.4'} + dependencies: + es-define-property: 1.0.0 + es-errors: 1.3.0 + function-bind: 1.1.2 + get-intrinsic: 1.2.4 + set-function-length: 1.2.2 + dev: true + /callsites@3.1.0: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} dev: true + /camelcase-keys@7.0.2: + resolution: {integrity: sha512-Rjs1H+A9R+Ig+4E/9oyB66UC5Mj9Xq3N//vcLf2WzgdTi/3gUu3Z9KoqmlrEG4VuuLK8wJHofxzdQXz/knhiYg==} + engines: {node: '>=12'} + dependencies: + camelcase: 6.3.0 + map-obj: 4.3.0 + quick-lru: 5.1.1 + type-fest: 1.4.0 + dev: false + /camelcase@5.3.1: resolution: {integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==} engines: {node: '>=6'} @@ -4175,7 +4644,6 @@ packages: /camelcase@6.3.0: resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} engines: {node: '>=10'} - dev: true /caniuse-lite@1.0.30001509: resolution: {integrity: sha512-2uDDk+TRiTX5hMcUYT/7CSyzMZxjfGu0vAUjS2g0LSD8UoXOv0LtpH4LxGMemsiPq6LCVIUjNwVM0erkOkGCDA==} @@ -4281,7 +4749,6 @@ packages: engines: {node: '>= 0.8'} dependencies: delayed-stream: 1.0.0 - dev: true /commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} @@ -4303,6 +4770,10 @@ packages: /concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + /constants-browserify@1.0.0: + resolution: {integrity: sha512-xFxOwqIzR/e1k1gLiWEophSCMqXcwVHIH7akf7b/vxcUeGunlj3hvZaaqxwHsTgn+IndtkQJgSztIDWeumWJDQ==} + dev: true + /content-disposition@0.5.4: resolution: {integrity: sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==} engines: {node: '>= 0.6'} @@ -4313,6 +4784,15 @@ packages: resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==} engines: {node: '>= 0.6'} + /convert-keys@1.3.4: + resolution: {integrity: sha512-+ltki+EUagotW/x7r+15nuHyk4nzcSkBk1lZpmbHjscF2E9ZmNErgV7K18LNshB0qglECcsnwy29ODlJ0pI0KA==} + dependencies: + lodash.camelcase: 4.3.0 + lodash.forown: 4.4.0 + lodash.isplainobject: 4.0.6 + lodash.snakecase: 4.1.1 + dev: false + /convert-source-map@1.9.0: resolution: {integrity: sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==} dev: true @@ -4553,10 +5033,27 @@ packages: engines: {node: '>=0.10.0'} dev: true + /define-data-property@1.1.4: + resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==} + engines: {node: '>= 0.4'} + dependencies: + es-define-property: 1.0.0 + es-errors: 1.3.0 + gopd: 1.0.1 + dev: true + + /define-properties@1.2.1: + resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} + engines: {node: '>= 0.4'} + dependencies: + define-data-property: 1.1.4 + has-property-descriptors: 1.0.2 + object-keys: 1.1.1 + dev: true + /delayed-stream@1.0.0: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} - dev: true /depd@1.1.2: resolution: {integrity: sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==} @@ -4776,6 +5273,18 @@ packages: stackframe: 1.3.4 dev: false + /es-define-property@1.0.0: + resolution: {integrity: sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==} + engines: {node: '>= 0.4'} + dependencies: + get-intrinsic: 1.2.4 + dev: true + + /es-errors@1.3.0: + resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} + engines: {node: '>= 0.4'} + dev: true + /escalade@3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} @@ -4808,6 +5317,44 @@ packages: resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} engines: {node: '>= 0.6'} + /ethers@5.7.2: + resolution: {integrity: sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==} + dependencies: + '@ethersproject/abi': 5.7.0 + '@ethersproject/abstract-provider': 5.7.0 + '@ethersproject/abstract-signer': 5.7.0 + '@ethersproject/address': 5.7.0 + '@ethersproject/base64': 5.7.0 + '@ethersproject/basex': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/constants': 5.7.0 + '@ethersproject/contracts': 5.7.0 + '@ethersproject/hash': 5.7.0 + '@ethersproject/hdnode': 5.7.0 + '@ethersproject/json-wallets': 5.7.0 + '@ethersproject/keccak256': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/networks': 5.7.1 + '@ethersproject/pbkdf2': 5.7.0 + '@ethersproject/properties': 5.7.0 + '@ethersproject/providers': 5.7.2 + '@ethersproject/random': 5.7.0 + '@ethersproject/rlp': 5.7.0 + '@ethersproject/sha2': 5.7.0 + '@ethersproject/signing-key': 5.7.0 + '@ethersproject/solidity': 5.7.0 + '@ethersproject/strings': 5.7.0 + '@ethersproject/transactions': 5.7.0 + '@ethersproject/units': 5.7.0 + '@ethersproject/wallet': 5.7.0 + '@ethersproject/web': 5.7.1 + '@ethersproject/wordlists': 5.7.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + /event-target-shim@5.0.1: resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==} engines: {node: '>=6'} @@ -4939,6 +5486,10 @@ packages: resolution: {integrity: sha512-8EZzEP0eKkEEVX+drtd9mtuQ+/QrlfW/5MlwcwK5Nds6EkZ/tRzEexkzUY2mIssnAyVLT+TKHuRXmFNNXYUd6g==} dev: false + /fast-sha256@1.3.0: + resolution: {integrity: sha512-n11RGP/lrWEFI/bWdygLxhI+pVeo1ZYIVwvvPkW7azl/rOy+F3HYRZ2K5zeE9mmkhQppyv9sQFx0JM9UabnpPQ==} + dev: false + /fast-shallow-equal@1.0.0: resolution: {integrity: sha512-HPtaa38cPgWvaCFmRNhlc6NG7pv6NUHqjPgVAkWGoB9mQMwYB27/K0CvOM5Czy+qpT3e8XJ6Q4aPAnzpNpzNaw==} dev: false @@ -5038,6 +5589,22 @@ packages: path-exists: 4.0.0 dev: true + /follow-redirects@1.15.6: + resolution: {integrity: sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==} + engines: {node: '>=4.0'} + peerDependencies: + debug: '*' + peerDependenciesMeta: + debug: + optional: true + dev: false + + /for-each@0.3.3: + resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} + dependencies: + is-callable: 1.2.7 + dev: true + /foreground-child@3.1.1: resolution: {integrity: sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==} engines: {node: '>=14'} @@ -5068,6 +5635,15 @@ packages: mime-types: 2.1.35 dev: true + /form-data@4.0.0: + resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} + engines: {node: '>= 6'} + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + mime-types: 2.1.35 + dev: false + /forwarded@0.2.0: resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} engines: {node: '>= 0.6'} @@ -5101,6 +5677,10 @@ packages: /function-bind@1.1.1: resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==} + /function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + dev: true + /gensync@1.0.0-beta.2: resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} engines: {node: '>=6.9.0'} @@ -5119,6 +5699,17 @@ packages: has-proto: 1.0.1 has-symbols: 1.0.3 + /get-intrinsic@1.2.4: + resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==} + engines: {node: '>= 0.4'} + dependencies: + es-errors: 1.3.0 + function-bind: 1.1.2 + has-proto: 1.0.1 + has-symbols: 1.0.3 + hasown: 2.0.2 + dev: true + /get-package-type@0.1.0: resolution: {integrity: sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==} engines: {node: '>=8.0.0'} @@ -5198,6 +5789,12 @@ packages: type-fest: 0.20.2 dev: true + /gopd@1.0.1: + resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} + dependencies: + get-intrinsic: 1.2.1 + dev: true + /got@8.3.2: resolution: {integrity: sha512-qjUJ5U/hawxosMryILofZCkm3C84PLJS/0grRIpjAwu+Lkxxj5cxeCU25BG0/3mDSpXKTyZr8oh8wIgLaH0QCw==} engines: {node: '>=4'} @@ -5250,6 +5847,12 @@ packages: engines: {node: '>=8'} dev: true + /has-property-descriptors@1.0.2: + resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} + dependencies: + es-define-property: 1.0.0 + dev: true + /has-proto@1.0.1: resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} engines: {node: '>= 0.4'} @@ -5268,6 +5871,13 @@ packages: has-symbol-support-x: 1.4.2 dev: false + /has-tostringtag@1.0.2: + resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} + engines: {node: '>= 0.4'} + dependencies: + has-symbols: 1.0.3 + dev: true + /has@1.0.3: resolution: {integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==} engines: {node: '>= 0.4.0'} @@ -5289,6 +5899,13 @@ packages: inherits: 2.0.4 minimalistic-assert: 1.0.1 + /hasown@2.0.2: + resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} + engines: {node: '>= 0.4'} + dependencies: + function-bind: 1.1.2 + dev: true + /hdkey@2.1.0: resolution: {integrity: sha512-i9Wzi0Dy49bNS4tXXeGeu0vIcn86xXdPQUpEYg+SO1YiO8HtomjmmRMaRyqL0r59QfcD4PfVbSF3qmsWFwAemA==} dependencies: @@ -5477,10 +6094,23 @@ packages: resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} engines: {node: '>= 0.10'} + /is-arguments@1.1.1: + resolution: {integrity: sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.2 + has-tostringtag: 1.0.2 + dev: true + /is-arrayish@0.2.1: resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} dev: true + /is-callable@1.2.7: + resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} + engines: {node: '>= 0.4'} + dev: true + /is-core-module@2.12.1: resolution: {integrity: sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==} dependencies: @@ -5500,6 +6130,13 @@ packages: engines: {node: '>=6'} dev: true + /is-generator-function@1.0.10: + resolution: {integrity: sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==} + engines: {node: '>= 0.4'} + dependencies: + has-tostringtag: 1.0.2 + dev: true + /is-glob@4.0.3: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} engines: {node: '>=0.10.0'} @@ -5511,6 +6148,14 @@ packages: resolution: {integrity: sha512-6BEnpVn1rcf3ngfmViLM6vjUjGErbdrL4rwlv+u1NO1XO8kqT4YGL8+19Q+Z/bas8tY90BTWMk2+fW1g6hQjbA==} dev: true + /is-nan@1.3.2: + resolution: {integrity: sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.2 + define-properties: 1.2.1 + dev: true + /is-natural-number@4.0.1: resolution: {integrity: sha512-Y4LTamMe0DDQIIAlaer9eKebAlDSV6huy+TWhJVPlzZh2o4tRP5SQWFlLn5N0To4mDD22/qdOq+veo1cSISLgQ==} dev: false @@ -5544,6 +6189,13 @@ packages: engines: {node: '>=8'} dev: true + /is-typed-array@1.1.13: + resolution: {integrity: sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==} + engines: {node: '>= 0.4'} + dependencies: + which-typed-array: 1.1.15 + dev: true + /is-typedarray@1.0.0: resolution: {integrity: sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==} dev: true @@ -6099,6 +6751,10 @@ packages: resolution: {integrity: sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==} dev: true + /js-sha3@0.8.0: + resolution: {integrity: sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==} + dev: false + /js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -6122,6 +6778,10 @@ packages: argparse: 2.0.1 dev: true + /jsbi@3.1.3: + resolution: {integrity: sha512-nBJqA0C6Qns+ZxurbEoIR56wyjiUszpNy70FHvxO5ervMoCbZVE3z3kxr5nKGhlxr/9MhKTSUBs7cAwwuf3g9w==} + dev: false + /jsbi@4.1.0: resolution: {integrity: sha512-384Z4keIsJtYpnVggsxaB255MZctILbxv+ihtwoWPF7KNOlYHn1LFpRnUw5qsAspUAA2+I7qzjVJxVYtHVjxNw==} @@ -6347,6 +7007,14 @@ packages: p-locate: 4.1.0 dev: true + /lodash.camelcase@4.3.0: + resolution: {integrity: sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==} + dev: false + + /lodash.forown@4.4.0: + resolution: {integrity: sha512-xcpca6BCshoe5SFSrQOoV8FBEbNzcBa6QQYmtv48eEFNzdwQLkHkcWSaBlecHhyHb1BUk1xqFdXoiSLJkt/w5w==} + dev: false + /lodash.get@4.4.2: resolution: {integrity: sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==} dev: true @@ -6355,6 +7023,14 @@ packages: resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==} dev: false + /lodash.isplainobject@4.0.6: + resolution: {integrity: sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==} + dev: false + + /lodash.snakecase@4.1.1: + resolution: {integrity: sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==} + dev: false + /lodash.uniqby@4.7.0: resolution: {integrity: sha512-e/zcLx6CSbmaEgFHCA7BnoQKyCtKMxnuWrJygbwPs/AIn+IMKl66L8/s+wBUn5LRw2pZx3bUHibiV1b6aTWIww==} dev: true @@ -6426,6 +7102,11 @@ packages: tmpl: 1.0.5 dev: true + /map-obj@4.3.0: + resolution: {integrity: sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==} + engines: {node: '>=8'} + dev: false + /md5.js@1.3.5: resolution: {integrity: sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==} dependencies: @@ -6675,6 +7356,12 @@ packages: resolution: {integrity: sha512-QzsYKWhXTWx8h1kIvqfnC++o0pEmpRQA/aenALsL2F4pqNVr7YzcdMlDij5WBnwftRbJCNJL/O7zdKaxKPHqgQ==} dev: true + /node-rsa@1.1.1: + resolution: {integrity: sha512-Jd4cvbJMryN21r5HgxQOpMEqv+ooke/korixNNK3mGqfGJmy0M77WDDzo/05969+OkMy3XW1UuZsSmW9KQm7Fw==} + dependencies: + asn1: 0.2.6 + dev: false + /normalize-path@3.0.0: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'} @@ -6723,6 +7410,29 @@ packages: /object-inspect@1.12.3: resolution: {integrity: sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==} + /object-is@1.1.6: + resolution: {integrity: sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + define-properties: 1.2.1 + dev: true + + /object-keys@1.1.1: + resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} + engines: {node: '>= 0.4'} + dev: true + + /object.assign@4.1.5: + resolution: {integrity: sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + define-properties: 1.2.1 + has-symbols: 1.0.3 + object-keys: 1.1.1 + dev: true + /on-finished@2.3.0: resolution: {integrity: sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==} engines: {node: '>= 0.8'} @@ -6977,6 +7687,11 @@ packages: find-up: 4.1.0 dev: true + /possible-typed-array-names@1.0.0: + resolution: {integrity: sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==} + engines: {node: '>= 0.4'} + dev: true + /postcss-value-parser@4.2.0: resolution: {integrity: sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==} dev: true @@ -7123,6 +7838,11 @@ packages: strict-uri-encode: 1.1.0 dev: false + /quick-lru@5.1.1: + resolution: {integrity: sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==} + engines: {node: '>=10'} + dev: false + /railroad-diagrams@1.0.0: resolution: {integrity: sha512-cz93DjNeLY0idrCNOH6PviZGRN9GJhsdm9hpn1YCS879fj4W+x5IFJhhkRZcwVgMmFF7R82UA/7Oh+R8lLZg6A==} dev: false @@ -7465,6 +8185,18 @@ packages: transitivePeerDependencies: - supports-color + /set-function-length@1.2.2: + resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} + engines: {node: '>= 0.4'} + dependencies: + define-data-property: 1.1.4 + es-errors: 1.3.0 + function-bind: 1.1.2 + get-intrinsic: 1.2.4 + gopd: 1.0.1 + has-property-descriptors: 1.0.2 + dev: true + /set-harmonic-interval@1.0.1: resolution: {integrity: sha512-AhICkFV84tBP1aWqPwLZqFvAwqEoVA9kxNMniGEUvzOlm4vLmOFLiTT3UZ6bziJTy4bOVpzWGTfSCbmaayGx8g==} engines: {node: '>=6.9'} @@ -7981,6 +8713,11 @@ packages: engines: {node: '>=10'} dev: true + /type-fest@1.4.0: + resolution: {integrity: sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==} + engines: {node: '>=10'} + dev: false + /type-is@1.6.18: resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} engines: {node: '>= 0.6'} @@ -8046,6 +8783,16 @@ packages: /util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + /util@0.12.5: + resolution: {integrity: sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==} + dependencies: + inherits: 2.0.4 + is-arguments: 1.1.1 + is-generator-function: 1.0.10 + is-typed-array: 1.1.13 + which-typed-array: 1.1.15 + dev: true + /utility-types@3.10.0: resolution: {integrity: sha512-O11mqxmi7wMKCo6HKFt5AhO4BwY3VV68YU07tgxfz8zJTIxr4BpsezN49Ffwy9j3ZpwwJp4fkRwjRzq3uWE6Rg==} engines: {node: '>= 4'} @@ -8115,6 +8862,17 @@ packages: webidl-conversions: 3.0.1 dev: false + /which-typed-array@1.1.15: + resolution: {integrity: sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==} + engines: {node: '>= 0.4'} + dependencies: + available-typed-arrays: 1.0.7 + call-bind: 1.0.7 + for-each: 0.3.3 + gopd: 1.0.1 + has-tostringtag: 1.0.2 + dev: true + /which@2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} engines: {node: '>= 8'} @@ -8156,6 +8914,19 @@ packages: signal-exit: 3.0.7 dev: true + /ws@7.4.6: + resolution: {integrity: sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==} + engines: {node: '>=8.3.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + dev: false + /xtend@4.0.2: resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} engines: {node: '>=0.4'} From 198de22adde10827c4f4f2d263eb974cb21d4b76 Mon Sep 17 00:00:00 2001 From: homura Date: Fri, 15 Mar 2024 16:01:09 +0800 Subject: [PATCH 02/18] chore: upgrade joyid ckb sdk --- examples/joyid/joyid.ts | 20 +- examples/joyid/package.json | 3 +- examples/pnpm-lock.yaml | 551 +----------------------------------- 3 files changed, 18 insertions(+), 556 deletions(-) diff --git a/examples/joyid/joyid.ts b/examples/joyid/joyid.ts index 060765b92..03259d14f 100644 --- a/examples/joyid/joyid.ts +++ b/examples/joyid/joyid.ts @@ -1,8 +1,8 @@ -import { getJoyIDLockScript, RSA2048_PUBKEY_SIG_LEN } from "@nervina-labs/joyid-sdk"; import { blockchain, bytes } from "@ckb-lumos/lumos/codec"; import { registerCustomLockScriptInfos } from "@ckb-lumos/lumos/common-scripts/common"; import { WitnessArgs, commons, helpers, Script, Cell } from "@ckb-lumos/lumos"; import { CKBComponents } from "@ckb-lumos/lumos/rpc"; +import { getJoyIDLockScript, getJoyIDCellDep } from "@joyid/ckb"; export interface CellCollector { collect(): AsyncIterable; @@ -46,16 +46,16 @@ class JoyIDCellCollector { function createJoyIDScriptInfo(): commons.LockScriptInfo { return { - codeHash: getJoyIDLockScript().codeHash, + codeHash: getJoyIDLockScript(false).codeHash, hashType: "type", lockScriptInfo: { CellCollector: JoyIDCellCollector, prepareSigningEntries: null, async setupInputCell(txSkeleton, inputCell, _, options = {}) { - const template = getJoyIDLockScript(); + const template = getJoyIDLockScript(false); const fromScript = inputCell.cellOutput.lock; - asserts(bytes.equal(fromScript.codeHash, template.codeHash), `The input script is not Unipass script`); + asserts(bytes.equal(fromScript.codeHash, template.codeHash), `The input script is not JoyID script`); // add inputCell to txSkeleton txSkeleton = txSkeleton.update("inputs", (inputs) => inputs.push(inputCell)); @@ -84,17 +84,11 @@ function createJoyIDScriptInfo(): commons.LockScriptInfo { }); if (!template) { - throw new Error(`UNIPASS script not defined in config!`); + throw new Error(`JoyID script not defined in config!`); } // add cell dep - txSkeleton = helpers.addCellDep(txSkeleton, { - outPoint: { - txHash: "0x4dcf3f3b09efac8995d6cbee87c5345e812d310094651e0c3d9a730f32dc9263", - index: "0x0", - }, - depType: "depGroup", - }); + txSkeleton = helpers.addCellDep(txSkeleton, getJoyIDCellDep(false)); // add witness /* @@ -113,7 +107,7 @@ function createJoyIDScriptInfo(): commons.LockScriptInfo { } let witness: string = txSkeleton.get("witnesses").get(firstIndex)!; const newWitnessArgs: WitnessArgs = { - lock: bytes.hexify(new Uint8Array(RSA2048_PUBKEY_SIG_LEN)), + lock: "0x", }; witness = bytes.hexify(blockchain.WitnessArgs.pack(newWitnessArgs)); txSkeleton = txSkeleton.update("witnesses", (witnesses) => witnesses.set(firstIndex, witness)); diff --git a/examples/joyid/package.json b/examples/joyid/package.json index 12c5ff558..81ed9b0ef 100644 --- a/examples/joyid/package.json +++ b/examples/joyid/package.json @@ -15,8 +15,7 @@ "@ckb-lumos/lumos": "canary", "@types/react": "^18.0.25", "@types/react-dom": "^18.0.9", - "@joyid/ckb": "^0.0.4", - "@nervina-labs/joyid-sdk": "^0.3.0", + "@joyid/ckb": "^0.0.6", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/examples/pnpm-lock.yaml b/examples/pnpm-lock.yaml index f2ad7bd86..71bae9327 100644 --- a/examples/pnpm-lock.yaml +++ b/examples/pnpm-lock.yaml @@ -780,11 +780,8 @@ importers: specifier: canary version: link:../../packages/lumos '@joyid/ckb': - specifier: ^0.0.4 - version: 0.0.4 - '@nervina-labs/joyid-sdk': - specifier: ^0.3.0 - version: 0.3.0 + specifier: ^0.0.6 + version: 0.0.6 '@types/react': specifier: ^18.0.25 version: 18.0.25 @@ -1329,321 +1326,6 @@ packages: resolution: {integrity: sha512-pWfNQaCwmFFGkbQMVHpDeMZJD7LThPfxqZJyZg0PRke6P6pwHKx2fZoXXEryqmwA1RwsvQ99S/FesQMLmcEVfw==} dev: false - /@ethersproject/abi@5.7.0: - resolution: {integrity: sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==} - dependencies: - '@ethersproject/address': 5.7.0 - '@ethersproject/bignumber': 5.7.0 - '@ethersproject/bytes': 5.7.0 - '@ethersproject/constants': 5.7.0 - '@ethersproject/hash': 5.7.0 - '@ethersproject/keccak256': 5.7.0 - '@ethersproject/logger': 5.7.0 - '@ethersproject/properties': 5.7.0 - '@ethersproject/strings': 5.7.0 - dev: false - - /@ethersproject/abstract-provider@5.7.0: - resolution: {integrity: sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==} - dependencies: - '@ethersproject/bignumber': 5.7.0 - '@ethersproject/bytes': 5.7.0 - '@ethersproject/logger': 5.7.0 - '@ethersproject/networks': 5.7.1 - '@ethersproject/properties': 5.7.0 - '@ethersproject/transactions': 5.7.0 - '@ethersproject/web': 5.7.1 - dev: false - - /@ethersproject/abstract-signer@5.7.0: - resolution: {integrity: sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==} - dependencies: - '@ethersproject/abstract-provider': 5.7.0 - '@ethersproject/bignumber': 5.7.0 - '@ethersproject/bytes': 5.7.0 - '@ethersproject/logger': 5.7.0 - '@ethersproject/properties': 5.7.0 - dev: false - - /@ethersproject/address@5.7.0: - resolution: {integrity: sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==} - dependencies: - '@ethersproject/bignumber': 5.7.0 - '@ethersproject/bytes': 5.7.0 - '@ethersproject/keccak256': 5.7.0 - '@ethersproject/logger': 5.7.0 - '@ethersproject/rlp': 5.7.0 - dev: false - - /@ethersproject/base64@5.7.0: - resolution: {integrity: sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==} - dependencies: - '@ethersproject/bytes': 5.7.0 - dev: false - - /@ethersproject/basex@5.7.0: - resolution: {integrity: sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw==} - dependencies: - '@ethersproject/bytes': 5.7.0 - '@ethersproject/properties': 5.7.0 - dev: false - - /@ethersproject/bignumber@5.7.0: - resolution: {integrity: sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==} - dependencies: - '@ethersproject/bytes': 5.7.0 - '@ethersproject/logger': 5.7.0 - bn.js: 5.2.1 - dev: false - - /@ethersproject/bytes@5.7.0: - resolution: {integrity: sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==} - dependencies: - '@ethersproject/logger': 5.7.0 - dev: false - - /@ethersproject/constants@5.7.0: - resolution: {integrity: sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==} - dependencies: - '@ethersproject/bignumber': 5.7.0 - dev: false - - /@ethersproject/contracts@5.7.0: - resolution: {integrity: sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==} - dependencies: - '@ethersproject/abi': 5.7.0 - '@ethersproject/abstract-provider': 5.7.0 - '@ethersproject/abstract-signer': 5.7.0 - '@ethersproject/address': 5.7.0 - '@ethersproject/bignumber': 5.7.0 - '@ethersproject/bytes': 5.7.0 - '@ethersproject/constants': 5.7.0 - '@ethersproject/logger': 5.7.0 - '@ethersproject/properties': 5.7.0 - '@ethersproject/transactions': 5.7.0 - dev: false - - /@ethersproject/hash@5.7.0: - resolution: {integrity: sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==} - dependencies: - '@ethersproject/abstract-signer': 5.7.0 - '@ethersproject/address': 5.7.0 - '@ethersproject/base64': 5.7.0 - '@ethersproject/bignumber': 5.7.0 - '@ethersproject/bytes': 5.7.0 - '@ethersproject/keccak256': 5.7.0 - '@ethersproject/logger': 5.7.0 - '@ethersproject/properties': 5.7.0 - '@ethersproject/strings': 5.7.0 - dev: false - - /@ethersproject/hdnode@5.7.0: - resolution: {integrity: sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg==} - dependencies: - '@ethersproject/abstract-signer': 5.7.0 - '@ethersproject/basex': 5.7.0 - '@ethersproject/bignumber': 5.7.0 - '@ethersproject/bytes': 5.7.0 - '@ethersproject/logger': 5.7.0 - '@ethersproject/pbkdf2': 5.7.0 - '@ethersproject/properties': 5.7.0 - '@ethersproject/sha2': 5.7.0 - '@ethersproject/signing-key': 5.7.0 - '@ethersproject/strings': 5.7.0 - '@ethersproject/transactions': 5.7.0 - '@ethersproject/wordlists': 5.7.0 - dev: false - - /@ethersproject/json-wallets@5.7.0: - resolution: {integrity: sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g==} - dependencies: - '@ethersproject/abstract-signer': 5.7.0 - '@ethersproject/address': 5.7.0 - '@ethersproject/bytes': 5.7.0 - '@ethersproject/hdnode': 5.7.0 - '@ethersproject/keccak256': 5.7.0 - '@ethersproject/logger': 5.7.0 - '@ethersproject/pbkdf2': 5.7.0 - '@ethersproject/properties': 5.7.0 - '@ethersproject/random': 5.7.0 - '@ethersproject/strings': 5.7.0 - '@ethersproject/transactions': 5.7.0 - aes-js: 3.0.0 - scrypt-js: 3.0.1 - dev: false - - /@ethersproject/keccak256@5.7.0: - resolution: {integrity: sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==} - dependencies: - '@ethersproject/bytes': 5.7.0 - js-sha3: 0.8.0 - dev: false - - /@ethersproject/logger@5.7.0: - resolution: {integrity: sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==} - dev: false - - /@ethersproject/networks@5.7.1: - resolution: {integrity: sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==} - dependencies: - '@ethersproject/logger': 5.7.0 - dev: false - - /@ethersproject/pbkdf2@5.7.0: - resolution: {integrity: sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw==} - dependencies: - '@ethersproject/bytes': 5.7.0 - '@ethersproject/sha2': 5.7.0 - dev: false - - /@ethersproject/properties@5.7.0: - resolution: {integrity: sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==} - dependencies: - '@ethersproject/logger': 5.7.0 - dev: false - - /@ethersproject/providers@5.7.2: - resolution: {integrity: sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg==} - dependencies: - '@ethersproject/abstract-provider': 5.7.0 - '@ethersproject/abstract-signer': 5.7.0 - '@ethersproject/address': 5.7.0 - '@ethersproject/base64': 5.7.0 - '@ethersproject/basex': 5.7.0 - '@ethersproject/bignumber': 5.7.0 - '@ethersproject/bytes': 5.7.0 - '@ethersproject/constants': 5.7.0 - '@ethersproject/hash': 5.7.0 - '@ethersproject/logger': 5.7.0 - '@ethersproject/networks': 5.7.1 - '@ethersproject/properties': 5.7.0 - '@ethersproject/random': 5.7.0 - '@ethersproject/rlp': 5.7.0 - '@ethersproject/sha2': 5.7.0 - '@ethersproject/strings': 5.7.0 - '@ethersproject/transactions': 5.7.0 - '@ethersproject/web': 5.7.1 - bech32: 1.1.4 - ws: 7.4.6 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - dev: false - - /@ethersproject/random@5.7.0: - resolution: {integrity: sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ==} - dependencies: - '@ethersproject/bytes': 5.7.0 - '@ethersproject/logger': 5.7.0 - dev: false - - /@ethersproject/rlp@5.7.0: - resolution: {integrity: sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==} - dependencies: - '@ethersproject/bytes': 5.7.0 - '@ethersproject/logger': 5.7.0 - dev: false - - /@ethersproject/sha2@5.7.0: - resolution: {integrity: sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw==} - dependencies: - '@ethersproject/bytes': 5.7.0 - '@ethersproject/logger': 5.7.0 - hash.js: 1.1.7 - dev: false - - /@ethersproject/signing-key@5.7.0: - resolution: {integrity: sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==} - dependencies: - '@ethersproject/bytes': 5.7.0 - '@ethersproject/logger': 5.7.0 - '@ethersproject/properties': 5.7.0 - bn.js: 5.2.1 - elliptic: 6.5.4 - hash.js: 1.1.7 - dev: false - - /@ethersproject/solidity@5.7.0: - resolution: {integrity: sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA==} - dependencies: - '@ethersproject/bignumber': 5.7.0 - '@ethersproject/bytes': 5.7.0 - '@ethersproject/keccak256': 5.7.0 - '@ethersproject/logger': 5.7.0 - '@ethersproject/sha2': 5.7.0 - '@ethersproject/strings': 5.7.0 - dev: false - - /@ethersproject/strings@5.7.0: - resolution: {integrity: sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==} - dependencies: - '@ethersproject/bytes': 5.7.0 - '@ethersproject/constants': 5.7.0 - '@ethersproject/logger': 5.7.0 - dev: false - - /@ethersproject/transactions@5.7.0: - resolution: {integrity: sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==} - dependencies: - '@ethersproject/address': 5.7.0 - '@ethersproject/bignumber': 5.7.0 - '@ethersproject/bytes': 5.7.0 - '@ethersproject/constants': 5.7.0 - '@ethersproject/keccak256': 5.7.0 - '@ethersproject/logger': 5.7.0 - '@ethersproject/properties': 5.7.0 - '@ethersproject/rlp': 5.7.0 - '@ethersproject/signing-key': 5.7.0 - dev: false - - /@ethersproject/units@5.7.0: - resolution: {integrity: sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==} - dependencies: - '@ethersproject/bignumber': 5.7.0 - '@ethersproject/constants': 5.7.0 - '@ethersproject/logger': 5.7.0 - dev: false - - /@ethersproject/wallet@5.7.0: - resolution: {integrity: sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==} - dependencies: - '@ethersproject/abstract-provider': 5.7.0 - '@ethersproject/abstract-signer': 5.7.0 - '@ethersproject/address': 5.7.0 - '@ethersproject/bignumber': 5.7.0 - '@ethersproject/bytes': 5.7.0 - '@ethersproject/hash': 5.7.0 - '@ethersproject/hdnode': 5.7.0 - '@ethersproject/json-wallets': 5.7.0 - '@ethersproject/keccak256': 5.7.0 - '@ethersproject/logger': 5.7.0 - '@ethersproject/properties': 5.7.0 - '@ethersproject/random': 5.7.0 - '@ethersproject/signing-key': 5.7.0 - '@ethersproject/transactions': 5.7.0 - '@ethersproject/wordlists': 5.7.0 - dev: false - - /@ethersproject/web@5.7.1: - resolution: {integrity: sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==} - dependencies: - '@ethersproject/base64': 5.7.0 - '@ethersproject/bytes': 5.7.0 - '@ethersproject/logger': 5.7.0 - '@ethersproject/properties': 5.7.0 - '@ethersproject/strings': 5.7.0 - dev: false - - /@ethersproject/wordlists@5.7.0: - resolution: {integrity: sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA==} - dependencies: - '@ethersproject/bytes': 5.7.0 - '@ethersproject/hash': 5.7.0 - '@ethersproject/logger': 5.7.0 - '@ethersproject/properties': 5.7.0 - '@ethersproject/strings': 5.7.0 - dev: false - /@isaacs/cliui@8.0.2: resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} engines: {node: '>=12'} @@ -1912,8 +1594,8 @@ packages: chalk: 4.1.2 dev: true - /@joyid/ckb@0.0.4: - resolution: {integrity: sha512-n80r8VfwiPxpZzni1qZYWZXY7MxTTW6oGuhF6PAmZ0bLbly00zC4gFshxv+Pxa28mpil+ynS+oiyRF5jyMsNlQ==} + /@joyid/ckb@0.0.6: + resolution: {integrity: sha512-V7SfcWJ3hWrbxibHkRYxd7rXViLLJYSxuDg2/KQikEQMPYHW/FtFLO8EWNOa8a/rMBjJ7EhYKcUxiGAAq8ecRQ==} dev: false /@jridgewell/gen-mapping@0.3.3: @@ -2121,62 +1803,6 @@ packages: dev: true optional: true - /@nervina-labs/joyid-sdk@0.3.0: - resolution: {integrity: sha512-cw6yPqZsObIVO97VJDb8oIJq6K+OwPOa/QLFJCPTvxBuc3akmEaFtB70Jrc1igQgkPPS5BXcLC2P5WGH/U8bqA==} - dependencies: - '@nervosnetwork/ckb-sdk-core': 0.103.1 - '@nervosnetwork/ckb-sdk-utils': 0.103.1 - '@nervosnetwork/ckb-types': 0.103.1 - axios: 0.27.2 - bn.js: 4.12.0 - camelcase-keys: 7.0.2 - convert-keys: 1.3.4 - elliptic: 6.5.4 - ethers: 5.7.2 - fast-sha256: 1.3.0 - js-sha3: 0.8.0 - node-rsa: 1.1.1 - transitivePeerDependencies: - - bufferutil - - debug - - utf-8-validate - dev: false - - /@nervosnetwork/ckb-sdk-core@0.103.1: - resolution: {integrity: sha512-LeNwId3GaQILVpnY1zfNBY897XQJPODKeP6d7w6tww9anu0jSxrvXVxGMDTTn3Yz5mixzBgpFGo4SXRrH0eiaQ==} - dependencies: - '@nervosnetwork/ckb-sdk-rpc': 0.103.1 - '@nervosnetwork/ckb-sdk-utils': 0.103.1 - '@nervosnetwork/ckb-types': 0.103.1 - tslib: 2.3.1 - transitivePeerDependencies: - - debug - dev: false - - /@nervosnetwork/ckb-sdk-rpc@0.103.1: - resolution: {integrity: sha512-n3V/5Be7PilyHXUcR6yAiwanMcuZNLfslu9A84OpfB22hlkwIv7OFG/JvFNack/cANPfChRAWB+VWiYGwSON/A==} - dependencies: - '@nervosnetwork/ckb-sdk-utils': 0.103.1 - axios: 0.21.4 - tslib: 2.3.1 - transitivePeerDependencies: - - debug - dev: false - - /@nervosnetwork/ckb-sdk-utils@0.103.1: - resolution: {integrity: sha512-OzpFNKkOOqYWDHDjPf11uOfOf8EQOEstOBxVtyFjrGEx3B9FwsGxItlHYeuTfpFkHF2Ut+G9M3X71w8h/IApdQ==} - dependencies: - '@nervosnetwork/ckb-types': 0.103.1 - bech32: 2.0.0 - elliptic: 6.5.4 - jsbi: 3.1.3 - tslib: 2.3.1 - dev: false - - /@nervosnetwork/ckb-types@0.103.1: - resolution: {integrity: sha512-gGRR1VvUS/KRq2ChhXHPiHpgyLYazPM2R8lK87shQI82Gp2/m6k1HVDeNR5XOYwQ3YmBbxHGQtQr/kMq7DUlZA==} - dev: false - /@noble/hashes@1.3.3: resolution: {integrity: sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==} engines: {node: '>= 16'} @@ -4046,10 +3672,6 @@ packages: engines: {node: '>= 10.0.0'} dev: false - /aes-js@3.0.0: - resolution: {integrity: sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==} - dev: false - /ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} dependencies: @@ -4139,6 +3761,7 @@ packages: resolution: {integrity: sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==} dependencies: safer-buffer: 2.1.2 + dev: true /assert-plus@1.0.0: resolution: {integrity: sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==} @@ -4157,6 +3780,7 @@ packages: /asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + dev: true /available-typed-arrays@1.0.7: resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} @@ -4173,23 +3797,6 @@ packages: resolution: {integrity: sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==} dev: true - /axios@0.21.4: - resolution: {integrity: sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==} - dependencies: - follow-redirects: 1.15.6 - transitivePeerDependencies: - - debug - dev: false - - /axios@0.27.2: - resolution: {integrity: sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==} - dependencies: - follow-redirects: 1.15.6 - form-data: 4.0.0 - transitivePeerDependencies: - - debug - dev: false - /babel-jest@28.1.3(@babel/core@7.16.0): resolution: {integrity: sha512-epUaPOEWMk3cWX0M/sPvCHHCe9fMFAa/9hXEgKP8nFfNl/jlGkE9ucq9NqkZGXLDduCJYS0UvSlPUwC0S+rH6Q==} engines: {node: ^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0} @@ -4283,10 +3890,6 @@ packages: tweetnacl: 0.14.5 dev: true - /bech32@1.1.4: - resolution: {integrity: sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==} - dev: false - /bech32@2.0.0: resolution: {integrity: sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==} @@ -4378,6 +3981,7 @@ packages: /bn.js@5.2.1: resolution: {integrity: sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==} + dev: true /body-parser@1.19.0: resolution: {integrity: sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==} @@ -4626,16 +4230,6 @@ packages: engines: {node: '>=6'} dev: true - /camelcase-keys@7.0.2: - resolution: {integrity: sha512-Rjs1H+A9R+Ig+4E/9oyB66UC5Mj9Xq3N//vcLf2WzgdTi/3gUu3Z9KoqmlrEG4VuuLK8wJHofxzdQXz/knhiYg==} - engines: {node: '>=12'} - dependencies: - camelcase: 6.3.0 - map-obj: 4.3.0 - quick-lru: 5.1.1 - type-fest: 1.4.0 - dev: false - /camelcase@5.3.1: resolution: {integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==} engines: {node: '>=6'} @@ -4644,6 +4238,7 @@ packages: /camelcase@6.3.0: resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} engines: {node: '>=10'} + dev: true /caniuse-lite@1.0.30001509: resolution: {integrity: sha512-2uDDk+TRiTX5hMcUYT/7CSyzMZxjfGu0vAUjS2g0LSD8UoXOv0LtpH4LxGMemsiPq6LCVIUjNwVM0erkOkGCDA==} @@ -4749,6 +4344,7 @@ packages: engines: {node: '>= 0.8'} dependencies: delayed-stream: 1.0.0 + dev: true /commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} @@ -4784,15 +4380,6 @@ packages: resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==} engines: {node: '>= 0.6'} - /convert-keys@1.3.4: - resolution: {integrity: sha512-+ltki+EUagotW/x7r+15nuHyk4nzcSkBk1lZpmbHjscF2E9ZmNErgV7K18LNshB0qglECcsnwy29ODlJ0pI0KA==} - dependencies: - lodash.camelcase: 4.3.0 - lodash.forown: 4.4.0 - lodash.isplainobject: 4.0.6 - lodash.snakecase: 4.1.1 - dev: false - /convert-source-map@1.9.0: resolution: {integrity: sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==} dev: true @@ -5054,6 +4641,7 @@ packages: /delayed-stream@1.0.0: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} + dev: true /depd@1.1.2: resolution: {integrity: sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==} @@ -5317,44 +4905,6 @@ packages: resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} engines: {node: '>= 0.6'} - /ethers@5.7.2: - resolution: {integrity: sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==} - dependencies: - '@ethersproject/abi': 5.7.0 - '@ethersproject/abstract-provider': 5.7.0 - '@ethersproject/abstract-signer': 5.7.0 - '@ethersproject/address': 5.7.0 - '@ethersproject/base64': 5.7.0 - '@ethersproject/basex': 5.7.0 - '@ethersproject/bignumber': 5.7.0 - '@ethersproject/bytes': 5.7.0 - '@ethersproject/constants': 5.7.0 - '@ethersproject/contracts': 5.7.0 - '@ethersproject/hash': 5.7.0 - '@ethersproject/hdnode': 5.7.0 - '@ethersproject/json-wallets': 5.7.0 - '@ethersproject/keccak256': 5.7.0 - '@ethersproject/logger': 5.7.0 - '@ethersproject/networks': 5.7.1 - '@ethersproject/pbkdf2': 5.7.0 - '@ethersproject/properties': 5.7.0 - '@ethersproject/providers': 5.7.2 - '@ethersproject/random': 5.7.0 - '@ethersproject/rlp': 5.7.0 - '@ethersproject/sha2': 5.7.0 - '@ethersproject/signing-key': 5.7.0 - '@ethersproject/solidity': 5.7.0 - '@ethersproject/strings': 5.7.0 - '@ethersproject/transactions': 5.7.0 - '@ethersproject/units': 5.7.0 - '@ethersproject/wallet': 5.7.0 - '@ethersproject/web': 5.7.1 - '@ethersproject/wordlists': 5.7.0 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - dev: false - /event-target-shim@5.0.1: resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==} engines: {node: '>=6'} @@ -5486,10 +5036,6 @@ packages: resolution: {integrity: sha512-8EZzEP0eKkEEVX+drtd9mtuQ+/QrlfW/5MlwcwK5Nds6EkZ/tRzEexkzUY2mIssnAyVLT+TKHuRXmFNNXYUd6g==} dev: false - /fast-sha256@1.3.0: - resolution: {integrity: sha512-n11RGP/lrWEFI/bWdygLxhI+pVeo1ZYIVwvvPkW7azl/rOy+F3HYRZ2K5zeE9mmkhQppyv9sQFx0JM9UabnpPQ==} - dev: false - /fast-shallow-equal@1.0.0: resolution: {integrity: sha512-HPtaa38cPgWvaCFmRNhlc6NG7pv6NUHqjPgVAkWGoB9mQMwYB27/K0CvOM5Czy+qpT3e8XJ6Q4aPAnzpNpzNaw==} dev: false @@ -5589,16 +5135,6 @@ packages: path-exists: 4.0.0 dev: true - /follow-redirects@1.15.6: - resolution: {integrity: sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==} - engines: {node: '>=4.0'} - peerDependencies: - debug: '*' - peerDependenciesMeta: - debug: - optional: true - dev: false - /for-each@0.3.3: resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} dependencies: @@ -5635,15 +5171,6 @@ packages: mime-types: 2.1.35 dev: true - /form-data@4.0.0: - resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} - engines: {node: '>= 6'} - dependencies: - asynckit: 0.4.0 - combined-stream: 1.0.8 - mime-types: 2.1.35 - dev: false - /forwarded@0.2.0: resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} engines: {node: '>= 0.6'} @@ -6751,10 +6278,6 @@ packages: resolution: {integrity: sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==} dev: true - /js-sha3@0.8.0: - resolution: {integrity: sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==} - dev: false - /js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -6778,10 +6301,6 @@ packages: argparse: 2.0.1 dev: true - /jsbi@3.1.3: - resolution: {integrity: sha512-nBJqA0C6Qns+ZxurbEoIR56wyjiUszpNy70FHvxO5ervMoCbZVE3z3kxr5nKGhlxr/9MhKTSUBs7cAwwuf3g9w==} - dev: false - /jsbi@4.1.0: resolution: {integrity: sha512-384Z4keIsJtYpnVggsxaB255MZctILbxv+ihtwoWPF7KNOlYHn1LFpRnUw5qsAspUAA2+I7qzjVJxVYtHVjxNw==} @@ -7007,14 +6526,6 @@ packages: p-locate: 4.1.0 dev: true - /lodash.camelcase@4.3.0: - resolution: {integrity: sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==} - dev: false - - /lodash.forown@4.4.0: - resolution: {integrity: sha512-xcpca6BCshoe5SFSrQOoV8FBEbNzcBa6QQYmtv48eEFNzdwQLkHkcWSaBlecHhyHb1BUk1xqFdXoiSLJkt/w5w==} - dev: false - /lodash.get@4.4.2: resolution: {integrity: sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==} dev: true @@ -7023,14 +6534,6 @@ packages: resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==} dev: false - /lodash.isplainobject@4.0.6: - resolution: {integrity: sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==} - dev: false - - /lodash.snakecase@4.1.1: - resolution: {integrity: sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==} - dev: false - /lodash.uniqby@4.7.0: resolution: {integrity: sha512-e/zcLx6CSbmaEgFHCA7BnoQKyCtKMxnuWrJygbwPs/AIn+IMKl66L8/s+wBUn5LRw2pZx3bUHibiV1b6aTWIww==} dev: true @@ -7102,11 +6605,6 @@ packages: tmpl: 1.0.5 dev: true - /map-obj@4.3.0: - resolution: {integrity: sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==} - engines: {node: '>=8'} - dev: false - /md5.js@1.3.5: resolution: {integrity: sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==} dependencies: @@ -7356,12 +6854,6 @@ packages: resolution: {integrity: sha512-QzsYKWhXTWx8h1kIvqfnC++o0pEmpRQA/aenALsL2F4pqNVr7YzcdMlDij5WBnwftRbJCNJL/O7zdKaxKPHqgQ==} dev: true - /node-rsa@1.1.1: - resolution: {integrity: sha512-Jd4cvbJMryN21r5HgxQOpMEqv+ooke/korixNNK3mGqfGJmy0M77WDDzo/05969+OkMy3XW1UuZsSmW9KQm7Fw==} - dependencies: - asn1: 0.2.6 - dev: false - /normalize-path@3.0.0: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'} @@ -7838,11 +7330,6 @@ packages: strict-uri-encode: 1.1.0 dev: false - /quick-lru@5.1.1: - resolution: {integrity: sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==} - engines: {node: '>=10'} - dev: false - /railroad-diagrams@1.0.0: resolution: {integrity: sha512-cz93DjNeLY0idrCNOH6PviZGRN9GJhsdm9hpn1YCS879fj4W+x5IFJhhkRZcwVgMmFF7R82UA/7Oh+R8lLZg6A==} dev: false @@ -8713,11 +8200,6 @@ packages: engines: {node: '>=10'} dev: true - /type-fest@1.4.0: - resolution: {integrity: sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==} - engines: {node: '>=10'} - dev: false - /type-is@1.6.18: resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} engines: {node: '>= 0.6'} @@ -8914,19 +8396,6 @@ packages: signal-exit: 3.0.7 dev: true - /ws@7.4.6: - resolution: {integrity: sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==} - engines: {node: '>=8.3.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: ^5.0.2 - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - dev: false - /xtend@4.0.2: resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} engines: {node: '>=0.4'} From b11f4d06513a3329984e5057534f2fbbfb1e0ac8 Mon Sep 17 00:00:00 2001 From: homura Date: Fri, 15 Mar 2024 21:24:02 +0800 Subject: [PATCH 03/18] chore: reproducing subkey bug --- examples/joyid/constants.ts | 230 ++++++++++++++++++++++++++++++++++++ examples/joyid/index.tsx | 16 ++- examples/joyid/joyid.ts | 73 +++++++++--- 3 files changed, 300 insertions(+), 19 deletions(-) create mode 100644 examples/joyid/constants.ts diff --git a/examples/joyid/constants.ts b/examples/joyid/constants.ts new file mode 100644 index 000000000..5dafbd868 --- /dev/null +++ b/examples/joyid/constants.ts @@ -0,0 +1,230 @@ +import { CKBComponents } from "@ckb-lumos/lumos/rpc"; + +const TestnetInfo = { + JoyIDLockScript: { + codeHash: "0xd23761b364210735c19c60561d213fb3beae2fd6172743719eff6920e020baac", + hashType: "type", + args: "", + } as CKBComponents.Script, + + JoyIDLockDep: { + outPoint: { + txHash: "0x4dcf3f3b09efac8995d6cbee87c5345e812d310094651e0c3d9a730f32dc9263", + index: "0x0", + }, + depType: "depGroup", + } as CKBComponents.CellDep, + + CotaTypeScript: { + codeHash: "0x89cd8003a0eaf8e65e0c31525b7d1d5c1becefd2ea75bb4cff87810ae37764d8", + hashType: "type", + args: "0x", + } as CKBComponents.Script, + + CotaTypeDep: { + outPoint: { + txHash: "0x636a786001f87cb615acfcf408be0f9a1f077001f0bbc75ca54eadfe7e221713", + index: "0x0", + }, + depType: "depGroup", + } as CKBComponents.CellDep, + + DexLockScript: { + codeHash: "0x493510d54e815611a643af97b5ac93bfbb45ddc2aae0f2dceffaf3408b4fcfcd", + hashType: "type", + args: "", + } as CKBComponents.Script, + + DexLockDep: { + outPoint: { + txHash: "0xc17040a3723df8f27c344d5e86e254f1d27e1181a5484cb3722416ef09d246ec", + index: "0x0", + }, + depType: "code", + } as CKBComponents.CellDep, + + XUDTTypeScript: { + codeHash: "0x25c29dc317811a6f6f3985a7a9ebc4838bd388d19d0feeecf0bcd60f6c0975bb", + hashType: "type", + args: "", + } as CKBComponents.Script, + + XUDTTypeDep: { + outPoint: { + txHash: "0xbf6fb538763efec2a70a6a3dcb7242787087e1030c4e7d86585bc63a9d337f5f", + index: "0x0", + }, + depType: "code", + } as CKBComponents.CellDep, + + SUDTTypeScript: { + codeHash: "0xc5e5dcf215925f7ef4dfaf5f4b4f105bc321c02776d6e7d52a1db3fcd9d011a4", + hashType: "type", + args: "", + } as CKBComponents.Script, + + SUDTTypeDep: { + outPoint: { + txHash: "0xe12877ebd2c3c364dc46c5c992bcfaf4fee33fa13eebdf82c591fc9825aab769", + index: "0x0", + }, + depType: "code", + } as CKBComponents.CellDep, + + SporeTypeScript: { + codeHash: "0x5e063b4c0e7abeaa6a428df3b693521a3050934cf3b0ae97a800d1bc31449398", + hashType: "data1", + args: "", + } as CKBComponents.Script, + + SporeTypeDep: { + outPoint: { + txHash: "0x06995b9fc19461a2bf9933e57b69af47a20bf0a5bc6c0ffcb85567a2c733f0a1", + index: "0x0", + }, + depType: "code", + } as CKBComponents.CellDep, + + MNftTypeScript: { + codeHash: "0xb1837b5ad01a88558731953062d1f5cb547adf89ece01e8934a9f0aeed2d959f", + hashType: "type", + args: "", + } as CKBComponents.Script, + + MNftTypeDep: { + outPoint: { + txHash: "0xf11ccb6079c1a4b3d86abe2c574c5db8d2fd3505fdc1d5970b69b31864a4bd1c", + index: "0x2", + }, + depType: "code", + } as CKBComponents.CellDep, +}; + +const MainnetInfo = { + JoyIDLockScript: { + codeHash: "0xd00c84f0ec8fd441c38bc3f87a371f547190f2fcff88e642bc5bf54b9e318323", + hashType: "type", + args: "", + } as CKBComponents.Script, + + JoyIDLockDep: { + outPoint: { + txHash: "0xf05188e5f3a6767fc4687faf45ba5f1a6e25d3ada6129dae8722cb282f262493", + index: "0x0", + }, + depType: "depGroup", + } as CKBComponents.CellDep, + + CotaTypeScript: { + codeHash: "0x1122a4fb54697cf2e6e3a96c9d80fd398a936559b90954c6e88eb7ba0cf652df", + hashType: "type", + args: "0x", + } as CKBComponents.Script, + + CotaTypeDep: { + outPoint: { + txHash: "0xabaa25237554f0d6c586dc010e7e85e6870bcfd9fb8773257ecacfbe1fd738a0", + index: "0x0", + }, + depType: "depGroup", + } as CKBComponents.CellDep, + + DexLockScript: { + codeHash: "0xab0ede4350a201bd615892044ea9edf12180189572e49a7ff3f78cce179ae09f", + hashType: "type", + args: "", + } as CKBComponents.Script, + + DexLockDep: { + outPoint: { + txHash: "0xaab4fef7338c7108d4d2507c29122768126f9303f173db9f6ef59b9af84186b7", + index: "0x0", + }, + depType: "code", + } as CKBComponents.CellDep, + + XUDTTypeScript: { + codeHash: "0x50bd8d6680b8b9cf98b73f3c08faf8b2a21914311954118ad6609be6e78a1b95", + hashType: "data1", + args: "", + } as CKBComponents.Script, + + XUDTTypeDep: { + outPoint: { + txHash: "0xc07844ce21b38e4b071dd0e1ee3b0e27afd8d7532491327f39b786343f558ab7", + index: "0x0", + }, + depType: "code", + } as CKBComponents.CellDep, + + SUDTTypeScript: { + codeHash: "0x5e7a36a77e68eecc013dfa2fe6a23f3b6c344b04005808694ae6dd45eea4cfd5", + hashType: "type", + args: "", + } as CKBComponents.Script, + + SUDTTypeDep: { + outPoint: { + txHash: "0xc7813f6a415144643970c2e88e0bb6ca6a8edc5dd7c1022746f628284a9936d5", + index: "0x0", + }, + depType: "code", + } as CKBComponents.CellDep, + + SporeTypeScript: { + codeHash: "0x4a4dce1df3dffff7f8b2cd7dff7303df3b6150c9788cb75dcf6747247132b9f5", + hashType: "data1", + args: "", + } as CKBComponents.Script, + + SporeTypeDep: { + outPoint: { + txHash: "0x96b198fb5ddbd1eed57ed667068f1f1e55d07907b4c0dbd38675a69ea1b69824", + index: "0x0", + }, + depType: "code", + } as CKBComponents.CellDep, + + MNftTypeScript: { + codeHash: "0x2b24f0d644ccbdd77bbf86b27c8cca02efa0ad051e447c212636d9ee7acaaec9", + hashType: "type", + args: "", + } as CKBComponents.Script, + + MNftTypeDep: { + outPoint: { + txHash: "0x5dce8acab1750d4790059f22284870216db086cb32ba118ee5e08b97dc21d471", + index: "0x2", + }, + depType: "code", + } as CKBComponents.CellDep, +}; + +export const getJoyIDLockScript = (isMainnet: boolean) => + isMainnet ? MainnetInfo.JoyIDLockScript : TestnetInfo.JoyIDLockScript; +export const getJoyIDCellDep = (isMainnet: boolean) => + isMainnet ? MainnetInfo.JoyIDLockDep : TestnetInfo.JoyIDLockDep; + +export const getCotaTypeScript = (isMainnet: boolean) => + isMainnet ? MainnetInfo.CotaTypeScript : TestnetInfo.CotaTypeScript; +export const getCotaCellDep = (isMainnet: boolean) => (isMainnet ? MainnetInfo.CotaTypeDep : TestnetInfo.CotaTypeDep); + +export const getDexLockScript = (isMainnet: boolean) => + isMainnet ? MainnetInfo.DexLockScript : TestnetInfo.DexLockScript; +export const getDexCellDep = (isMainnet: boolean) => (isMainnet ? MainnetInfo.DexLockDep : TestnetInfo.DexLockDep); + +export const getXudtTypeScript = (isMainnet: boolean) => + isMainnet ? MainnetInfo.XUDTTypeScript : TestnetInfo.XUDTTypeScript; +export const getXudtDep = (isMainnet: boolean) => (isMainnet ? MainnetInfo.XUDTTypeDep : TestnetInfo.XUDTTypeDep); + +export const getSudtTypeScript = (isMainnet: boolean) => + isMainnet ? MainnetInfo.SUDTTypeScript : TestnetInfo.SUDTTypeScript; +export const getSudtDep = (isMainnet: boolean) => (isMainnet ? MainnetInfo.SUDTTypeDep : TestnetInfo.SUDTTypeDep); + +export const getSporeTypeScript = (isMainnet: boolean) => + isMainnet ? MainnetInfo.SporeTypeScript : TestnetInfo.SporeTypeScript; +export const getSporeDep = (isMainnet: boolean) => (isMainnet ? MainnetInfo.SporeTypeDep : TestnetInfo.SporeTypeDep); + +export const getMNftTypeScript = (isMainnet: boolean) => + isMainnet ? MainnetInfo.MNftTypeScript : TestnetInfo.MNftTypeScript; +export const getMNftDep = (isMainnet: boolean) => (isMainnet ? MainnetInfo.MNftTypeDep : TestnetInfo.MNftTypeDep); diff --git a/examples/joyid/index.tsx b/examples/joyid/index.tsx index 7f03eeb18..1f71a691f 100644 --- a/examples/joyid/index.tsx +++ b/examples/joyid/index.tsx @@ -4,6 +4,8 @@ import { connect, initConfig, signRawTransaction } from "@joyid/ckb"; import { buildTransfer, capacityOf, sendTransaction } from "./lib"; import { formatUnit, parseUnit } from "@ckb-lumos/lumos/utils"; import { createTransactionFromSkeleton } from "@ckb-lumos/lumos/helpers"; +import { registerCustomLockScriptInfos } from "@ckb-lumos/lumos/common-scripts/common"; +import { createJoyIDScriptInfo } from "./joyid"; initConfig({ network: "testnet" }); @@ -20,13 +22,21 @@ const App = () => { capacityOf(address).then((balance) => setBalance(formatUnit(balance, "ckb") + " CKB")); }, [address]); + async function onConnect() { + const connection = await connect(); + registerCustomLockScriptInfos([createJoyIDScriptInfo({ connection })]); + setAddress(connection.address); + } + async function transfer(): Promise { const unsigned = await buildTransfer({ amount: parseUnit(transferAmount, "ckb"), from: address, to: transferAddr }); const tx = createTransactionFromSkeleton(unsigned); + + console.log("signRawTransaction: ", JSON.stringify(tx)); // @ts-ignore data2 is not defined in joyid sdk const signed = await signRawTransaction(tx, address); - const txHash = await sendTransaction(signed); - return txHash; + console.log("signed transaction: ", JSON.stringify(signed)); + return sendTransaction(signed); } function onTransfer() { @@ -41,7 +51,7 @@ const App = () => { if (!address) { return (
- +
); } diff --git a/examples/joyid/joyid.ts b/examples/joyid/joyid.ts index 03259d14f..63d371120 100644 --- a/examples/joyid/joyid.ts +++ b/examples/joyid/joyid.ts @@ -1,8 +1,8 @@ import { blockchain, bytes } from "@ckb-lumos/lumos/codec"; -import { registerCustomLockScriptInfos } from "@ckb-lumos/lumos/common-scripts/common"; -import { WitnessArgs, commons, helpers, Script, Cell } from "@ckb-lumos/lumos"; +import { WitnessArgs, commons, helpers, Script, Cell, utils } from "@ckb-lumos/lumos"; import { CKBComponents } from "@ckb-lumos/lumos/rpc"; -import { getJoyIDLockScript, getJoyIDCellDep } from "@joyid/ckb"; +import { getJoyIDLockScript, getJoyIDCellDep, Aggregator, getConfig, connect } from "@joyid/ckb"; +import { getCotaTypeScript } from "./constants"; export interface CellCollector { collect(): AsyncIterable; @@ -44,7 +44,9 @@ class JoyIDCellCollector { } } -function createJoyIDScriptInfo(): commons.LockScriptInfo { +type Connection = Awaited>; + +export function createJoyIDScriptInfo(config: { connection: Connection }): commons.LockScriptInfo { return { codeHash: getJoyIDLockScript(false).codeHash, hashType: "type", @@ -79,17 +81,10 @@ function createJoyIDScriptInfo(): commons.LockScriptInfo { }); } - txSkeleton = txSkeleton.update("witnesses", (witnesses) => { - return witnesses.push("0x"); - }); - if (!template) { throw new Error(`JoyID script not defined in config!`); } - // add cell dep - txSkeleton = helpers.addCellDep(txSkeleton, getJoyIDCellDep(false)); - // add witness /* * Modify the skeleton, so the first witness of the fromAddress script group @@ -105,11 +100,59 @@ function createJoyIDScriptInfo(): commons.LockScriptInfo { while (firstIndex >= txSkeleton.get("witnesses").size) { txSkeleton = txSkeleton.update("witnesses", (witnesses) => witnesses.push("0x")); } - let witness: string = txSkeleton.get("witnesses").get(firstIndex)!; - const newWitnessArgs: WitnessArgs = { + + const connection = config.connection; + console.log("JoyID config: ", getConfig()); + console.log("JoyID connection: ", connection); + + const lock = helpers.parseAddress(connection.address); + + // will change if the connection.keyType is a sub_key + let newWitnessArgs: WitnessArgs = { lock: "0x", }; - witness = bytes.hexify(blockchain.WitnessArgs.pack(newWitnessArgs)); + + if (connection.keyType === "sub_key") { + const aggregator = new Aggregator("https://cota.nervina.dev/aggregator"); + + const pubkeyHash = bytes.bytify(utils.ckbHash("0x" + connection.pubkey)).slice(0, 20); + + const { unlock_entry: unlockEntry } = await aggregator.generateSubkeyUnlockSmt({ + // TODO TBD + alg_index: 1, + pubkey_hash: bytes.hexify(pubkeyHash), + lock_script: bytes.hexify(blockchain.Script.pack(lock)), + }); + newWitnessArgs = { + lock: "0x", + inputType: "0x", + outputType: "0x" + unlockEntry, + }; + + const cotaType = getCotaTypeScript(getConfig().network === "mainnet"); + const cotaCollector = txSkeleton.get("cellProvider").collector({ lock: lock, type: cotaType }); + + let cotaCells: Cell[] = []; + for await (const cotaCell of cotaCollector.collect()) { + cotaCells.push(cotaCell); + } + + if (!cotaCells || cotaCells.length === 0) { + throw new Error("Cota cell doesn't exist"); + } + const cotaCell = cotaCells[0]; + const cotaCellDep: CKBComponents.CellDep = { + outPoint: cotaCell.outPoint, + depType: "code", + }; + + // note: COTA cell MUST put first + txSkeleton = helpers.addCellDep(txSkeleton, cotaCellDep); + } + + txSkeleton = helpers.addCellDep(txSkeleton, getJoyIDCellDep(false)); + + const witness = bytes.hexify(blockchain.WitnessArgs.pack(newWitnessArgs)); txSkeleton = txSkeleton.update("witnesses", (witnesses) => witnesses.set(firstIndex, witness)); } @@ -124,5 +167,3 @@ function asserts(condition: unknown, message = "Assert failed"): asserts conditi throw new Error(message); } } - -registerCustomLockScriptInfos([createJoyIDScriptInfo()]); From 6d333ec565dee37d93b20331611efff83bb11a12 Mon Sep 17 00:00:00 2001 From: homura Date: Mon, 18 Mar 2024 21:34:24 +0800 Subject: [PATCH 04/18] feat: support joyid --- packages/joyid/README.md | 31 +++ packages/joyid/package.json | 60 ++++++ packages/joyid/src/constants.ts | 82 +++++++ packages/joyid/src/index.ts | 1 + packages/joyid/src/script-info.ts | 264 +++++++++++++++++++++++ packages/joyid/tests/script-info.test.ts | 191 ++++++++++++++++ packages/joyid/tsconfig.json | 8 + packages/joyid/typedoc.json | 4 + pnpm-lock.yaml | 42 +++- 9 files changed, 672 insertions(+), 11 deletions(-) create mode 100644 packages/joyid/README.md create mode 100644 packages/joyid/package.json create mode 100644 packages/joyid/src/constants.ts create mode 100644 packages/joyid/src/index.ts create mode 100644 packages/joyid/src/script-info.ts create mode 100644 packages/joyid/tests/script-info.test.ts create mode 100644 packages/joyid/tsconfig.json create mode 100644 packages/joyid/typedoc.json diff --git a/packages/joyid/README.md b/packages/joyid/README.md new file mode 100644 index 000000000..4003a95cf --- /dev/null +++ b/packages/joyid/README.md @@ -0,0 +1,31 @@ +# `@ckb-lumos/joyid` + +A module for working with JoyID. + +> Note: JoyID does not support working with other lock scripts in a transaction yet. + +## Usage + +To use `@ckb-lumos/joyid`, the `@joyid/ckb` package must be installed. + +```sh +npm install @joyid/ckb #@0.0.6 +``` + +```js +import { createJoyIDScriptInfo, getDefualtConfig } from "@ckb-lumos/joyid"; +import { connect } from "@joyid/ckb"; +import { registerCustomLockScriptInfos } from "@ckb-lumos/lumos/common-scripts/common"; + +// step 1. connect to JoyID +const connection = await connect(); + +// step 2. create JoyID script info, we can use the helper function getDefaultConfig to generate a default config +const joyIDScriptInfo = createJoyIDScriptInfo( + connection, + getDefaultConfig(false /* isMainnet */) +); + +// step 3. register JoyID script info into Lumos +registerCustomLockScriptInfos(joyIDScriptInfo); +``` diff --git a/packages/joyid/package.json b/packages/joyid/package.json new file mode 100644 index 000000000..371a9532b --- /dev/null +++ b/packages/joyid/package.json @@ -0,0 +1,60 @@ +{ + "name": "@ckb-lumos/joyid", + "version": "0.22.0-next.5", + "description": "Working with JoyID", + "author": "", + "homepage": "https://github.com/ckb-js/lumos#readme", + "license": "MIT", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "engines": { + "node": ">=12.0.0" + }, + "directories": { + "lib": "lib", + "test": "tests" + }, + "files": [ + "lib", + "src" + ], + "dependencies": { + "@ckb-lumos/base": "0.22.0-next.5", + "@ckb-lumos/codec": "0.22.0-next.5", + "@ckb-lumos/config-manager": "0.22.0-next.5", + "@ckb-lumos/common-scripts": "0.22.0-next.5", + "@ckb-lumos/helpers": "0.22.0-next.5" + }, + "peerDependencies": { + "@ckb-lumos/bi": "0.22.0-next.5", + "@joyid/ckb": "0.0.6", + "sinon": "^15.0.4" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ckb-js/lumos.git" + }, + "scripts": { + "fmt": "prettier --write \"{src,tests,examples}/**/*.ts\" package.json", + "lint": "eslint -c ../../.eslintrc.js \"{src,tests,examples}/**/*.ts\"", + "test": "c8 --reporter=cobertura --reporter=html --clean -o coverage ava **/*.test.ts --timeout=2m", + "build": "pnpm run build:types && pnpm run build:js", + "build:types": "tsc --declaration --emitDeclarationOnly", + "build:js": "babel --root-mode upward src --out-dir lib --extensions .ts -s", + "clean": "rm -rf lib" + }, + "bugs": { + "url": "https://github.com/ckb-js/lumos/issues" + }, + "ava": { + "extensions": [ + "ts" + ], + "require": [ + "ts-node/register" + ] + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/joyid/src/constants.ts b/packages/joyid/src/constants.ts new file mode 100644 index 000000000..7bac78105 --- /dev/null +++ b/packages/joyid/src/constants.ts @@ -0,0 +1,82 @@ +// https://github.com/duanyytop/joyid-sdk-js/blob/4629f5158a5f54f00d765832d2d78fb20bb7c64b/src/constants/index.ts +import { CellDep, Script } from "@ckb-lumos/base"; + +const TestnetInfo = { + JoyIDLockScript: { + codeHash: + "0xd23761b364210735c19c60561d213fb3beae2fd6172743719eff6920e020baac", + hashType: "type", + args: "", + } as Script, + + JoyIDLockDep: { + outPoint: { + txHash: + "0x4dcf3f3b09efac8995d6cbee87c5345e812d310094651e0c3d9a730f32dc9263", + index: "0x0", + }, + depType: "depGroup", + } as CellDep, + + CotaTypeScript: { + codeHash: + "0x89cd8003a0eaf8e65e0c31525b7d1d5c1becefd2ea75bb4cff87810ae37764d8", + hashType: "type", + args: "0x", + } as Script, + + CotaTypeDep: { + outPoint: { + txHash: + "0x636a786001f87cb615acfcf408be0f9a1f077001f0bbc75ca54eadfe7e221713", + index: "0x0", + }, + depType: "depGroup", + } as CellDep, +}; + +const MainnetInfo = { + JoyIDLockScript: { + codeHash: + "0xd00c84f0ec8fd441c38bc3f87a371f547190f2fcff88e642bc5bf54b9e318323", + hashType: "type", + args: "", + } as Script, + + JoyIDLockDep: { + outPoint: { + txHash: + "0xf05188e5f3a6767fc4687faf45ba5f1a6e25d3ada6129dae8722cb282f262493", + index: "0x0", + }, + depType: "depGroup", + } as CellDep, + + CotaTypeScript: { + codeHash: + "0x1122a4fb54697cf2e6e3a96c9d80fd398a936559b90954c6e88eb7ba0cf652df", + hashType: "type", + args: "0x", + } as Script, + + CotaTypeDep: { + outPoint: { + txHash: + "0xabaa25237554f0d6c586dc010e7e85e6870bcfd9fb8773257ecacfbe1fd738a0", + index: "0x0", + }, + depType: "depGroup", + } as CellDep, +}; + +export const getJoyIDLockScript = (isMainnet = false): Script => + isMainnet ? MainnetInfo.JoyIDLockScript : TestnetInfo.JoyIDLockScript; + +export const getJoyIDCellDep = (isMainnet = false): CellDep => + isMainnet ? MainnetInfo.JoyIDLockDep : TestnetInfo.JoyIDLockDep; + +export const getCotaTypeScript = (isMainnet = false): Script => + isMainnet ? MainnetInfo.CotaTypeScript : TestnetInfo.CotaTypeScript; + +export const getCotaCellDep = (isMainnet = false): CellDep => + isMainnet ? MainnetInfo.CotaTypeDep : TestnetInfo.CotaTypeDep; diff --git a/packages/joyid/src/index.ts b/packages/joyid/src/index.ts new file mode 100644 index 000000000..5bcfe716d --- /dev/null +++ b/packages/joyid/src/index.ts @@ -0,0 +1 @@ +export { createJoyIDScriptInfo, getDefaultConfig } from "./script-info"; diff --git a/packages/joyid/src/script-info.ts b/packages/joyid/src/script-info.ts new file mode 100644 index 000000000..1e08d7362 --- /dev/null +++ b/packages/joyid/src/script-info.ts @@ -0,0 +1,264 @@ +import { + Cell, + QueryOptions, + Script, + WitnessArgs, + blockchain, + CellCollector, + CellProvider, + utils, + Address, + CellDep, + HexString, + HashType, +} from "@ckb-lumos/base"; +import { bytes } from "@ckb-lumos/codec"; +import { parseAddress } from "@ckb-lumos/helpers"; +import { Aggregator, getJoyIDCellDep, getJoyIDLockScript } from "@joyid/ckb"; +import { + FromInfo, + LockScriptInfo, + parseFromInfo, +} from "@ckb-lumos/common-scripts"; +import { addCellDep } from "@ckb-lumos/common-scripts/lib/helper"; +import { getCotaTypeScript } from "./constants"; +import { Config, getConfig, predefined } from "@ckb-lumos/config-manager"; + +export class JoyIDCellCollector { + readonly fromScript: Script; + private readonly cellCollector: CellCollector; + + constructor( + private fromInfo: FromInfo, + cellProvider: CellProvider, + { + queryOptions = {}, + config = getConfig(), + }: { queryOptions?: QueryOptions; config?: Config } + ) { + if (!cellProvider) { + throw new Error( + `cellProvider is required when collecting JoyID-related cells` + ); + } + + if (typeof fromInfo !== "string") { + throw new Error(`Only the address FromInfo is supported`); + } + + const { fromScript } = parseFromInfo(fromInfo, { config }); + this.fromScript = fromScript; + + queryOptions = { + ...queryOptions, + lock: this.fromScript, + type: queryOptions.type || "empty", + data: queryOptions.data || "0x", + }; + + this.cellCollector = cellProvider.collector(queryOptions); + } + + async *collect(): AsyncGenerator { + const joyIdMainnetCodeHash = getJoyIDLockScript(true).codeHash; + const joyIdTestnetCodeHash = getJoyIDLockScript(false).codeHash; + if ( + !bytes.equal(this.fromScript.codeHash, joyIdMainnetCodeHash) && + !bytes.equal(this.fromScript.codeHash, joyIdTestnetCodeHash) + ) { + return; + } + + for await (const inputCell of this.cellCollector.collect()) { + yield inputCell; + } + } +} + +type HexStringWithout0x = string; + +export type Connection = { + pubkey: HexStringWithout0x; + // ckb address + address: Address; + keyType: "main_key" | "sub_key" | string; +}; + +export type JoyIDScriptInfoConfig = { + aggregator: Pick; + cellDeps: CellDep[]; + joyIdLockScriptTemplate: { codeHash: HexString; hashType: HashType }; + cotaTypeScriptTemplate: { codeHash: HexString; hashType: HashType }; +}; + +/* c8 ignore next 9*/ +export function getDefaultConfig(isMainnet: boolean): JoyIDScriptInfoConfig { + return { + // TODO the mainnet URL is unknown + aggregator: new Aggregator("https://cota.nervina.dev/aggregator"), + cellDeps: [getJoyIDCellDep(isMainnet)], + joyIdLockScriptTemplate: getJoyIDLockScript(isMainnet), + cotaTypeScriptTemplate: getCotaTypeScript(isMainnet), + }; +} + +export function createJoyIDScriptInfo( + connection: Connection, + config: JoyIDScriptInfoConfig +): LockScriptInfo { + const { + joyIdLockScriptTemplate, + cotaTypeScriptTemplate, + cellDeps: joyIdCellDeps, + aggregator, + } = config; + + asserts( + connection.keyType === "main_key" || connection.keyType === "sub_key", + `Unsupported keyType: ${connection.keyType}, only support main_key or sub_key` + ); + + return { + codeHash: joyIdLockScriptTemplate.codeHash, + hashType: "type", + lockScriptInfo: { + CellCollector: JoyIDCellCollector, + prepareSigningEntries: () => { + throw new Error( + "JoyID doesn't support prepareSigningEntries, please do not mix JoyID locks with other locks in a transaction" + ); + }, + async setupInputCell(txSkeleton, inputCell, _, options = {}) { + const fromScript = inputCell.cellOutput.lock; + asserts( + bytes.equal(fromScript.codeHash, joyIdLockScriptTemplate.codeHash), + `The input script is not JoyID script` + ); + // add inputCell to txSkeleton + txSkeleton = txSkeleton.update("inputs", (inputs) => + inputs.push(inputCell) + ); + + const output: Cell = { + cellOutput: { + capacity: inputCell.cellOutput.capacity, + lock: inputCell.cellOutput.lock, + type: inputCell.cellOutput.type, + }, + data: inputCell.data, + }; + + txSkeleton = txSkeleton.update("outputs", (outputs) => + outputs.push(output) + ); + + const since = options.since; + if (since) { + txSkeleton = txSkeleton.update("inputSinces", (inputSinces) => { + return inputSinces.set(txSkeleton.get("inputs").size - 1, since); + }); + } + + const firstIndex = txSkeleton + .get("inputs") + .findIndex((input) => + bytes.equal( + blockchain.Script.pack(input.cellOutput.lock), + blockchain.Script.pack(fromScript) + ) + ); + if (firstIndex !== -1) { + while (firstIndex >= txSkeleton.get("witnesses").size) { + txSkeleton = txSkeleton.update("witnesses", (witnesses) => + witnesses.push("0x") + ); + } + + const lock = parseAddressAuto(connection.address); + + // will change if the connection.keyType is a sub_key + let newWitnessArgs: WitnessArgs = { + lock: "0x", + }; + + if (connection.keyType === "sub_key") { + const pubkeyHash = bytes + .bytify(utils.ckbHash("0x" + connection.pubkey)) + .slice(0, 20); + + const { unlock_entry: unlockEntry } = + await aggregator.generateSubkeyUnlockSmt({ + alg_index: 1, + pubkey_hash: bytes.hexify(pubkeyHash), + lock_script: bytes.hexify(blockchain.Script.pack(lock)), + }); + newWitnessArgs = { + lock: "0x", + outputType: "0x" + unlockEntry, + }; + + const cellProvider = txSkeleton.get("cellProvider"); + asserts( + cellProvider != null, + "Cell provider is missing while collecting CoTA cell" + ); + + const cotaCollector = cellProvider.collector({ + lock: lock, + type: { ...cotaTypeScriptTemplate, args: "0x" }, + }); + + const cotaCells: Cell[] = []; + for await (const cotaCell of cotaCollector.collect()) { + cotaCells.push(cotaCell); + } + + if (!cotaCells || cotaCells.length === 0) { + throw new Error("Cota cell doesn't exist"); + } + + cotaCells.forEach((cotaCell) => { + const outPoint = cotaCell.outPoint; + asserts(outPoint != null); + // note: COTA cell MUST put first + txSkeleton = addCellDep(txSkeleton, { + outPoint, + depType: "code", + }); + }); + } + + joyIdCellDeps.forEach((item) => { + txSkeleton = addCellDep(txSkeleton, item); + }); + + const witness = bytes.hexify( + blockchain.WitnessArgs.pack(newWitnessArgs) + ); + txSkeleton = txSkeleton.update("witnesses", (witnesses) => + witnesses.set(firstIndex, witness) + ); + } + + return txSkeleton; + }, + }, + }; +} + +function asserts( + condition: unknown, + message = "Assert failed" +): asserts condition { + if (!condition) { + throw new Error(message); + } +} + +function parseAddressAuto(address: string): Script { + const config = address.startsWith("ckt") + ? predefined.AGGRON4 + : predefined.LINA; + + return parseAddress(address, { config }); +} diff --git a/packages/joyid/tests/script-info.test.ts b/packages/joyid/tests/script-info.test.ts new file mode 100644 index 000000000..9cc97e4f8 --- /dev/null +++ b/packages/joyid/tests/script-info.test.ts @@ -0,0 +1,191 @@ +import test from "ava"; +import { createJoyIDScriptInfo } from "../src"; +import { + Connection, + JoyIDCellCollector, + JoyIDScriptInfoConfig, +} from "../src/script-info"; +import { BytesLike, bytes } from "@ckb-lumos/codec"; +import { randomBytes } from "node:crypto"; +import { encodeToAddress, TransactionSkeleton } from "@ckb-lumos/helpers"; +import { + Cell, + CellDep, + CellProvider, + OutPoint, + QueryOptions, + Script, +} from "@ckb-lumos/base"; +import { common } from "@ckb-lumos/common-scripts"; +import { parseUnit } from "@ckb-lumos/bi"; +import { getJoyIDLockScript } from "@joyid/ckb"; +import { getCotaTypeScript } from "../src/constants"; +import { spy } from "sinon"; + +const joyIdLockScriptTemplate = getJoyIDLockScript(true); +const cotaTypeScriptTemplate = getCotaTypeScript(true); + +const joyidCellDep: CellDep = { + outPoint: mockOutPoint(), + depType: "depGroup", +}; + +const config = { + cellDeps: [joyidCellDep], + joyIdLockScriptTemplate: joyIdLockScriptTemplate, + cotaTypeScriptTemplate: cotaTypeScriptTemplate, + aggregator: mockAggregator(), +}; + +const joyidLock = { ...joyIdLockScriptTemplate, args: "0x01" }; +const address = encodeToAddress(joyidLock); +const cotaType = { ...cotaTypeScriptTemplate, args: "0x01" }; + +// a cota cell is required when the connection is in sub_key mode +const cotaCell: Cell = { + cellOutput: { lock: joyidLock, type: cotaType, capacity: "0x0" }, + data: "0x", + outPoint: mockOutPoint(), +}; + +test("setup JoyID cell with a main_key connection", async (t) => { + const info = createJoyIDScriptInfo( + { keyType: "main_key", address: address, pubkey: "" }, + config + ); + + const cotaCellProvider = mockCellProvider([cotaCell]); + let txSkeleton = TransactionSkeleton({ + cellProvider: cotaCellProvider, + }); + + txSkeleton = await info.lockScriptInfo.setupInputCell(txSkeleton, { + outPoint: mockOutPoint(), + cellOutput: { capacity: "0x0", lock: joyidLock }, + data: "0x", + }); + + t.deepEqual(txSkeleton.get("cellDeps").toArray(), [joyidCellDep]); + t.deepEqual(txSkeleton.get("inputs").size, 1); + t.deepEqual(txSkeleton.get("outputs").size, 1); +}); + +test("setup JoyID cell with a sub_key connection", async (t) => { + const info = createJoyIDScriptInfo( + { keyType: "sub_key", address: address, pubkey: "" }, + config + ); + + const cotaCellProvider = mockCellProvider([cotaCell]); + let txSkeleton = TransactionSkeleton({ + cellProvider: cotaCellProvider, + }); + + txSkeleton = await info.lockScriptInfo.setupInputCell(txSkeleton, { + outPoint: mockOutPoint(), + cellOutput: { capacity: "0x0", lock: joyidLock }, + data: "0x", + }); + + t.deepEqual(txSkeleton.get("cellDeps").toArray(), [ + { depType: "code", outPoint: cotaCell.outPoint }, + joyidCellDep, + ]); + t.deepEqual(txSkeleton.get("inputs").size, 1); + t.deepEqual(txSkeleton.get("outputs").size, 1); +}); + +test("transfer via built-in JoyIDCellCollecot", async (t) => { + const connection: Connection = { + keyType: "main_key", + address: address, + pubkey: "", + }; + + const info = createJoyIDScriptInfo(connection, config); + common.registerCustomLockScriptInfos([info]); + + const collectedCell: Cell = { + cellOutput: { + lock: joyidLock, + capacity: parseUnit("10000", "ckb").toHexString(), + }, + data: "0x", + outPoint: mockOutPoint(), + }; + + const collect = (queryOptions: QueryOptions) => { + t.is(queryOptions.type, "empty"); + return [collectedCell]; + }; + + let txSkeleton = TransactionSkeleton({ + cellProvider: mockCellProvider(collect), + }); + const toAddress = mockScript(); + + const joyIdCollectSpy = spy(JoyIDCellCollector.prototype, "collect"); + + txSkeleton = await common.transfer( + txSkeleton, + [address], + encodeToAddress(toAddress), + 100 * 10 ** 8, + undefined, + undefined + ); + + t.deepEqual(txSkeleton.inputs.get(0), collectedCell); + t.true(joyIdCollectSpy.called === true); +}); + +function mockAggregator( + entry: BytesLike = randomBytes(32) +): JoyIDScriptInfoConfig["aggregator"] { + return { + generateSubkeyUnlockSmt: async () => ({ + unlock_entry: Buffer.from(bytes.bytify(entry)).toString("hex"), + block_number: 0n, + }), + }; +} + +function mockOutPoint(): OutPoint { + return { + txHash: randomHex(32), + index: randomHex(8), + }; +} + +function mockCellProvider( + cellsOrCollect: Cell[] | ((queryOptions: QueryOptions) => Cell[]) +): CellProvider { + return { + collector: (queryOptions) => { + const collected = Array.isArray(cellsOrCollect) + ? cellsOrCollect + : cellsOrCollect(queryOptions); + + let i = 0; + return { + collect: async function* () { + while (i < cellsOrCollect.length) { + yield collected[i++]; + } + }, + }; + }, + }; +} + +function randomHex(byteLength: number) { + return bytes.hexify(randomBytes(byteLength)); +} + +function mockScript(): Script { + return { + codeHash: randomHex(32), + hashType: "type", + args: randomHex(20), + }; +} diff --git a/packages/joyid/tsconfig.json b/packages/joyid/tsconfig.json new file mode 100644 index 000000000..a60a686a2 --- /dev/null +++ b/packages/joyid/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "lib", + "skipLibCheck": true + }, + "include": ["src"] +} diff --git a/packages/joyid/typedoc.json b/packages/joyid/typedoc.json new file mode 100644 index 000000000..f593f276c --- /dev/null +++ b/packages/joyid/typedoc.json @@ -0,0 +1,4 @@ +{ + "extends": ["../../typedoc.base.json"], + "entryPoints": ["src/index.ts"] +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bc6b2217f..6680bfa3f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -515,6 +515,33 @@ importers: specifier: ^4.3.0 version: 4.3.0 + packages/joyid: + dependencies: + '@ckb-lumos/base': + specifier: 0.22.0-next.5 + version: link:../base + '@ckb-lumos/bi': + specifier: 0.22.0-next.5 + version: link:../bi + '@ckb-lumos/codec': + specifier: 0.22.0-next.5 + version: link:../codec + '@ckb-lumos/common-scripts': + specifier: 0.22.0-next.5 + version: link:../common-scripts + '@ckb-lumos/config-manager': + specifier: 0.22.0-next.5 + version: link:../config-manager + '@ckb-lumos/helpers': + specifier: 0.22.0-next.5 + version: link:../helpers + '@joyid/ckb': + specifier: 0.0.6 + version: 0.0.6 + sinon: + specifier: ^15.0.4 + version: 15.0.4 + packages/light-client: dependencies: '@ckb-lumos/base': @@ -5161,6 +5188,10 @@ packages: '@types/yargs': 17.0.24 chalk: 4.1.2 + /@joyid/ckb@0.0.6: + resolution: {integrity: sha512-V7SfcWJ3hWrbxibHkRYxd7rXViLLJYSxuDg2/KQikEQMPYHW/FtFLO8EWNOa8a/rMBjJ7EhYKcUxiGAAq8ecRQ==} + dev: false + /@jridgewell/gen-mapping@0.3.3: resolution: {integrity: sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==} engines: {node: '>=6.0.0'} @@ -5576,19 +5607,16 @@ packages: resolution: {integrity: sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==} dependencies: type-detect: 4.0.8 - dev: true /@sinonjs/commons@3.0.0: resolution: {integrity: sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==} dependencies: type-detect: 4.0.8 - dev: true /@sinonjs/fake-timers@10.0.2: resolution: {integrity: sha512-SwUDyjWnah1AaNl7kxsa7cfLhlTYoiyhDAIgyh+El30YvXs/o7OLXpYH88Zdhyx9JExKrmHDJ+10bwIcY80Jmw==} dependencies: '@sinonjs/commons': 2.0.0 - dev: true /@sinonjs/fake-timers@7.1.2: resolution: {integrity: sha512-iQADsW4LBMISqZ6Ci1dupJL9pprqwcVFTcOsEmQOEhW+KLCVn/Y4Jrvg2k19fIHCp+iFprriYPTdRcQR8NbUPg==} @@ -5608,11 +5636,9 @@ packages: '@sinonjs/commons': 2.0.0 lodash.get: 4.4.2 type-detect: 4.0.8 - dev: true /@sinonjs/text-encoding@0.7.2: resolution: {integrity: sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==} - dev: true /@slorber/remark-comment@1.0.0: resolution: {integrity: sha512-RCE24n7jsOj1M0UPvIQCHTe7fI0sFL4S2nwKVWwHyVr/wI/H8GosgsJGyhnsZoGFnD/P2hLf1mSbrrgSLN93NA==} @@ -9060,7 +9086,6 @@ packages: /diff@5.1.0: resolution: {integrity: sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==} engines: {node: '>=0.3.1'} - dev: true /diffie-hellman@5.0.3: resolution: {integrity: sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==} @@ -12417,7 +12442,6 @@ packages: /just-extend@4.2.1: resolution: {integrity: sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==} - dev: true /keccak@3.0.1: resolution: {integrity: sha512-epq90L9jlFWCW7+pQa6JOnKn2Xgl2mtI664seYR6MHskvI9agt7AnDqmAlp9TqU4/caMYbA08Hi5DMZAl5zdkA==} @@ -12644,7 +12668,6 @@ packages: /lodash.get@4.4.2: resolution: {integrity: sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==} - dev: true /lodash.isequal@4.5.0: resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==} @@ -13721,7 +13744,6 @@ packages: '@sinonjs/text-encoding': 0.7.2 just-extend: 4.2.1 path-to-regexp: 1.8.0 - dev: true /no-case@3.0.4: resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==} @@ -16184,7 +16206,6 @@ packages: diff: 5.1.0 nise: 5.1.4 supports-color: 7.2.0 - dev: true /sirv@2.0.3: resolution: {integrity: sha512-O9jm9BsID1P+0HOi81VpXPoDxYP374pkOLzACAoyUQ/3OUVndNpsz6wMnY2z+yOxzbllCKZrM+9QrWsv4THnyA==} @@ -17044,7 +17065,6 @@ packages: /type-detect@4.0.8: resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} engines: {node: '>=4'} - dev: true /type-fest@0.13.1: resolution: {integrity: sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==} From 2165265158aadf65c92e8652f765ee16e38a51ee Mon Sep 17 00:00:00 2001 From: homura Date: Mon, 18 Mar 2024 21:35:35 +0800 Subject: [PATCH 05/18] chore: omnilock example typo --- examples/omni-lock-unisat/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/omni-lock-unisat/README.md b/examples/omni-lock-unisat/README.md index 1be68d270..ef71d22c3 100644 --- a/examples/omni-lock-unisat/README.md +++ b/examples/omni-lock-unisat/README.md @@ -10,12 +10,12 @@ can use MetaMask as a signer. This example will show how to use Lumos to send a ``` npm run build -cd examples/omni-lock- +cd examples/omni-lock-unisat npm start ``` ## Links -- [MetaMask](https://unisat.io/) - A crypto wallet for Bitcoin +- [UniSat](https://unisat.io/) - A crypto wallet for Bitcoin - [Nervos Faucet](https://faucet.nervos.org/) - Claim Nervos testnet CKB - [Omnilock](https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0042-omnilock/0042-omnilock.md) - Omnilock intro From 0d11a98695093a8e8347d1d3ca36fb1904f1e6bf Mon Sep 17 00:00:00 2001 From: homura Date: Mon, 18 Mar 2024 21:37:16 +0800 Subject: [PATCH 06/18] chore: unnecessary coverage in child package --- packages/joyid/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/joyid/package.json b/packages/joyid/package.json index 371a9532b..589611f29 100644 --- a/packages/joyid/package.json +++ b/packages/joyid/package.json @@ -37,7 +37,7 @@ "scripts": { "fmt": "prettier --write \"{src,tests,examples}/**/*.ts\" package.json", "lint": "eslint -c ../../.eslintrc.js \"{src,tests,examples}/**/*.ts\"", - "test": "c8 --reporter=cobertura --reporter=html --clean -o coverage ava **/*.test.ts --timeout=2m", + "test": "ava **/*.test.ts --timeout=2m", "build": "pnpm run build:types && pnpm run build:js", "build:types": "tsc --declaration --emitDeclarationOnly", "build:js": "babel --root-mode upward src --out-dir lib --extensions .ts -s", From 2969a4a8eb01ea724ed9d52777dbb7220bf428a4 Mon Sep 17 00:00:00 2001 From: homura Date: Mon, 18 Mar 2024 21:41:33 +0800 Subject: [PATCH 07/18] feat: update joyid aggregator url --- packages/joyid/src/script-info.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/joyid/src/script-info.ts b/packages/joyid/src/script-info.ts index 1e08d7362..dd43fb189 100644 --- a/packages/joyid/src/script-info.ts +++ b/packages/joyid/src/script-info.ts @@ -93,9 +93,14 @@ export type JoyIDScriptInfoConfig = { /* c8 ignore next 9*/ export function getDefaultConfig(isMainnet: boolean): JoyIDScriptInfoConfig { + // https://github.com/nervina-labs/cota-sdk-js/blob/f80d04ea532d72cfe7410ea45af6dc583e140edf/README.md?plain=1#L46-L52 + const aggregatorUrl = isMainnet + ? "https://cota.nervina.dev/mainnet-aggregator" + : "https://cota.nervina.dev/aggregator"; + return { // TODO the mainnet URL is unknown - aggregator: new Aggregator("https://cota.nervina.dev/aggregator"), + aggregator: new Aggregator(aggregatorUrl), cellDeps: [getJoyIDCellDep(isMainnet)], joyIdLockScriptTemplate: getJoyIDLockScript(isMainnet), cotaTypeScriptTemplate: getCotaTypeScript(isMainnet), From 3ed5be6cd885772c52e776b3e992bf886a10ef3f Mon Sep 17 00:00:00 2001 From: homura Date: Mon, 18 Mar 2024 21:42:23 +0800 Subject: [PATCH 08/18] chore(examples): example for joyid package --- examples/joyid/README.md | 12 ++ examples/joyid/constants.ts | 230 ------------------------------------ examples/joyid/index.tsx | 4 +- examples/joyid/joyid.ts | 169 -------------------------- examples/joyid/lib.ts | 1 - examples/joyid/package.json | 1 + examples/pnpm-lock.yaml | 45 ++++--- 7 files changed, 45 insertions(+), 417 deletions(-) create mode 100644 examples/joyid/README.md delete mode 100644 examples/joyid/constants.ts delete mode 100644 examples/joyid/joyid.ts diff --git a/examples/joyid/README.md b/examples/joyid/README.md new file mode 100644 index 000000000..6e902831f --- /dev/null +++ b/examples/joyid/README.md @@ -0,0 +1,12 @@ +# Lumos Works with JoyID + +[JoyID](https://joy.id/) is a universal account protocol. This example will show how to use Lumos to work with JoyID by a simple CKB transfer transaction. + +## Quick Start + +> We should [build](..) Lumos project first before starting this example. + +``` +pnpm install +pnpm start +``` diff --git a/examples/joyid/constants.ts b/examples/joyid/constants.ts deleted file mode 100644 index 5dafbd868..000000000 --- a/examples/joyid/constants.ts +++ /dev/null @@ -1,230 +0,0 @@ -import { CKBComponents } from "@ckb-lumos/lumos/rpc"; - -const TestnetInfo = { - JoyIDLockScript: { - codeHash: "0xd23761b364210735c19c60561d213fb3beae2fd6172743719eff6920e020baac", - hashType: "type", - args: "", - } as CKBComponents.Script, - - JoyIDLockDep: { - outPoint: { - txHash: "0x4dcf3f3b09efac8995d6cbee87c5345e812d310094651e0c3d9a730f32dc9263", - index: "0x0", - }, - depType: "depGroup", - } as CKBComponents.CellDep, - - CotaTypeScript: { - codeHash: "0x89cd8003a0eaf8e65e0c31525b7d1d5c1becefd2ea75bb4cff87810ae37764d8", - hashType: "type", - args: "0x", - } as CKBComponents.Script, - - CotaTypeDep: { - outPoint: { - txHash: "0x636a786001f87cb615acfcf408be0f9a1f077001f0bbc75ca54eadfe7e221713", - index: "0x0", - }, - depType: "depGroup", - } as CKBComponents.CellDep, - - DexLockScript: { - codeHash: "0x493510d54e815611a643af97b5ac93bfbb45ddc2aae0f2dceffaf3408b4fcfcd", - hashType: "type", - args: "", - } as CKBComponents.Script, - - DexLockDep: { - outPoint: { - txHash: "0xc17040a3723df8f27c344d5e86e254f1d27e1181a5484cb3722416ef09d246ec", - index: "0x0", - }, - depType: "code", - } as CKBComponents.CellDep, - - XUDTTypeScript: { - codeHash: "0x25c29dc317811a6f6f3985a7a9ebc4838bd388d19d0feeecf0bcd60f6c0975bb", - hashType: "type", - args: "", - } as CKBComponents.Script, - - XUDTTypeDep: { - outPoint: { - txHash: "0xbf6fb538763efec2a70a6a3dcb7242787087e1030c4e7d86585bc63a9d337f5f", - index: "0x0", - }, - depType: "code", - } as CKBComponents.CellDep, - - SUDTTypeScript: { - codeHash: "0xc5e5dcf215925f7ef4dfaf5f4b4f105bc321c02776d6e7d52a1db3fcd9d011a4", - hashType: "type", - args: "", - } as CKBComponents.Script, - - SUDTTypeDep: { - outPoint: { - txHash: "0xe12877ebd2c3c364dc46c5c992bcfaf4fee33fa13eebdf82c591fc9825aab769", - index: "0x0", - }, - depType: "code", - } as CKBComponents.CellDep, - - SporeTypeScript: { - codeHash: "0x5e063b4c0e7abeaa6a428df3b693521a3050934cf3b0ae97a800d1bc31449398", - hashType: "data1", - args: "", - } as CKBComponents.Script, - - SporeTypeDep: { - outPoint: { - txHash: "0x06995b9fc19461a2bf9933e57b69af47a20bf0a5bc6c0ffcb85567a2c733f0a1", - index: "0x0", - }, - depType: "code", - } as CKBComponents.CellDep, - - MNftTypeScript: { - codeHash: "0xb1837b5ad01a88558731953062d1f5cb547adf89ece01e8934a9f0aeed2d959f", - hashType: "type", - args: "", - } as CKBComponents.Script, - - MNftTypeDep: { - outPoint: { - txHash: "0xf11ccb6079c1a4b3d86abe2c574c5db8d2fd3505fdc1d5970b69b31864a4bd1c", - index: "0x2", - }, - depType: "code", - } as CKBComponents.CellDep, -}; - -const MainnetInfo = { - JoyIDLockScript: { - codeHash: "0xd00c84f0ec8fd441c38bc3f87a371f547190f2fcff88e642bc5bf54b9e318323", - hashType: "type", - args: "", - } as CKBComponents.Script, - - JoyIDLockDep: { - outPoint: { - txHash: "0xf05188e5f3a6767fc4687faf45ba5f1a6e25d3ada6129dae8722cb282f262493", - index: "0x0", - }, - depType: "depGroup", - } as CKBComponents.CellDep, - - CotaTypeScript: { - codeHash: "0x1122a4fb54697cf2e6e3a96c9d80fd398a936559b90954c6e88eb7ba0cf652df", - hashType: "type", - args: "0x", - } as CKBComponents.Script, - - CotaTypeDep: { - outPoint: { - txHash: "0xabaa25237554f0d6c586dc010e7e85e6870bcfd9fb8773257ecacfbe1fd738a0", - index: "0x0", - }, - depType: "depGroup", - } as CKBComponents.CellDep, - - DexLockScript: { - codeHash: "0xab0ede4350a201bd615892044ea9edf12180189572e49a7ff3f78cce179ae09f", - hashType: "type", - args: "", - } as CKBComponents.Script, - - DexLockDep: { - outPoint: { - txHash: "0xaab4fef7338c7108d4d2507c29122768126f9303f173db9f6ef59b9af84186b7", - index: "0x0", - }, - depType: "code", - } as CKBComponents.CellDep, - - XUDTTypeScript: { - codeHash: "0x50bd8d6680b8b9cf98b73f3c08faf8b2a21914311954118ad6609be6e78a1b95", - hashType: "data1", - args: "", - } as CKBComponents.Script, - - XUDTTypeDep: { - outPoint: { - txHash: "0xc07844ce21b38e4b071dd0e1ee3b0e27afd8d7532491327f39b786343f558ab7", - index: "0x0", - }, - depType: "code", - } as CKBComponents.CellDep, - - SUDTTypeScript: { - codeHash: "0x5e7a36a77e68eecc013dfa2fe6a23f3b6c344b04005808694ae6dd45eea4cfd5", - hashType: "type", - args: "", - } as CKBComponents.Script, - - SUDTTypeDep: { - outPoint: { - txHash: "0xc7813f6a415144643970c2e88e0bb6ca6a8edc5dd7c1022746f628284a9936d5", - index: "0x0", - }, - depType: "code", - } as CKBComponents.CellDep, - - SporeTypeScript: { - codeHash: "0x4a4dce1df3dffff7f8b2cd7dff7303df3b6150c9788cb75dcf6747247132b9f5", - hashType: "data1", - args: "", - } as CKBComponents.Script, - - SporeTypeDep: { - outPoint: { - txHash: "0x96b198fb5ddbd1eed57ed667068f1f1e55d07907b4c0dbd38675a69ea1b69824", - index: "0x0", - }, - depType: "code", - } as CKBComponents.CellDep, - - MNftTypeScript: { - codeHash: "0x2b24f0d644ccbdd77bbf86b27c8cca02efa0ad051e447c212636d9ee7acaaec9", - hashType: "type", - args: "", - } as CKBComponents.Script, - - MNftTypeDep: { - outPoint: { - txHash: "0x5dce8acab1750d4790059f22284870216db086cb32ba118ee5e08b97dc21d471", - index: "0x2", - }, - depType: "code", - } as CKBComponents.CellDep, -}; - -export const getJoyIDLockScript = (isMainnet: boolean) => - isMainnet ? MainnetInfo.JoyIDLockScript : TestnetInfo.JoyIDLockScript; -export const getJoyIDCellDep = (isMainnet: boolean) => - isMainnet ? MainnetInfo.JoyIDLockDep : TestnetInfo.JoyIDLockDep; - -export const getCotaTypeScript = (isMainnet: boolean) => - isMainnet ? MainnetInfo.CotaTypeScript : TestnetInfo.CotaTypeScript; -export const getCotaCellDep = (isMainnet: boolean) => (isMainnet ? MainnetInfo.CotaTypeDep : TestnetInfo.CotaTypeDep); - -export const getDexLockScript = (isMainnet: boolean) => - isMainnet ? MainnetInfo.DexLockScript : TestnetInfo.DexLockScript; -export const getDexCellDep = (isMainnet: boolean) => (isMainnet ? MainnetInfo.DexLockDep : TestnetInfo.DexLockDep); - -export const getXudtTypeScript = (isMainnet: boolean) => - isMainnet ? MainnetInfo.XUDTTypeScript : TestnetInfo.XUDTTypeScript; -export const getXudtDep = (isMainnet: boolean) => (isMainnet ? MainnetInfo.XUDTTypeDep : TestnetInfo.XUDTTypeDep); - -export const getSudtTypeScript = (isMainnet: boolean) => - isMainnet ? MainnetInfo.SUDTTypeScript : TestnetInfo.SUDTTypeScript; -export const getSudtDep = (isMainnet: boolean) => (isMainnet ? MainnetInfo.SUDTTypeDep : TestnetInfo.SUDTTypeDep); - -export const getSporeTypeScript = (isMainnet: boolean) => - isMainnet ? MainnetInfo.SporeTypeScript : TestnetInfo.SporeTypeScript; -export const getSporeDep = (isMainnet: boolean) => (isMainnet ? MainnetInfo.SporeTypeDep : TestnetInfo.SporeTypeDep); - -export const getMNftTypeScript = (isMainnet: boolean) => - isMainnet ? MainnetInfo.MNftTypeScript : TestnetInfo.MNftTypeScript; -export const getMNftDep = (isMainnet: boolean) => (isMainnet ? MainnetInfo.MNftTypeDep : TestnetInfo.MNftTypeDep); diff --git a/examples/joyid/index.tsx b/examples/joyid/index.tsx index 1f71a691f..410218207 100644 --- a/examples/joyid/index.tsx +++ b/examples/joyid/index.tsx @@ -5,7 +5,7 @@ import { buildTransfer, capacityOf, sendTransaction } from "./lib"; import { formatUnit, parseUnit } from "@ckb-lumos/lumos/utils"; import { createTransactionFromSkeleton } from "@ckb-lumos/lumos/helpers"; import { registerCustomLockScriptInfos } from "@ckb-lumos/lumos/common-scripts/common"; -import { createJoyIDScriptInfo } from "./joyid"; +import { createJoyIDScriptInfo, getDefaultConfig } from "@ckb-lumos/joyid"; initConfig({ network: "testnet" }); @@ -24,7 +24,7 @@ const App = () => { async function onConnect() { const connection = await connect(); - registerCustomLockScriptInfos([createJoyIDScriptInfo({ connection })]); + registerCustomLockScriptInfos([createJoyIDScriptInfo(connection, getDefaultConfig(false))]); setAddress(connection.address); } diff --git a/examples/joyid/joyid.ts b/examples/joyid/joyid.ts deleted file mode 100644 index 63d371120..000000000 --- a/examples/joyid/joyid.ts +++ /dev/null @@ -1,169 +0,0 @@ -import { blockchain, bytes } from "@ckb-lumos/lumos/codec"; -import { WitnessArgs, commons, helpers, Script, Cell, utils } from "@ckb-lumos/lumos"; -import { CKBComponents } from "@ckb-lumos/lumos/rpc"; -import { getJoyIDLockScript, getJoyIDCellDep, Aggregator, getConfig, connect } from "@joyid/ckb"; -import { getCotaTypeScript } from "./constants"; - -export interface CellCollector { - collect(): AsyncIterable; -} - -export interface CellProvider { - uri?: string; - collector(queryOptions: CKBComponents.QueryOptions): CellCollector; -} - -class JoyIDCellCollector { - readonly fromScript: Script; - private readonly cellCollector: CellCollector; - - constructor( - fromAddr: string, - cellProvider: CellProvider, - { queryOptions = {} }: { queryOptions: CKBComponents.QueryOptions } - ) { - if (!cellProvider) { - throw new Error(`cellProvider is required when collecting JoyID-related cells`); - } - - this.fromScript = helpers.parseAddress(fromAddr); - - queryOptions = { - ...queryOptions, - lock: this.fromScript, - type: queryOptions.type || "empty", - }; - - this.cellCollector = cellProvider.collector(queryOptions); - } - - async *collect(): AsyncGenerator { - for await (const inputCell of this.cellCollector.collect()) { - yield inputCell; - } - } -} - -type Connection = Awaited>; - -export function createJoyIDScriptInfo(config: { connection: Connection }): commons.LockScriptInfo { - return { - codeHash: getJoyIDLockScript(false).codeHash, - hashType: "type", - lockScriptInfo: { - CellCollector: JoyIDCellCollector, - prepareSigningEntries: null, - async setupInputCell(txSkeleton, inputCell, _, options = {}) { - const template = getJoyIDLockScript(false); - - const fromScript = inputCell.cellOutput.lock; - asserts(bytes.equal(fromScript.codeHash, template.codeHash), `The input script is not JoyID script`); - // add inputCell to txSkeleton - txSkeleton = txSkeleton.update("inputs", (inputs) => inputs.push(inputCell)); - - const output: Cell = { - cellOutput: { - capacity: inputCell.cellOutput.capacity, - lock: inputCell.cellOutput.lock, - type: inputCell.cellOutput.type, - }, - data: inputCell.data, - }; - - txSkeleton = txSkeleton.update("outputs", (outputs) => { - return outputs.push(output); - }); - - const since = options.since; - if (since) { - txSkeleton = txSkeleton.update("inputSinces", (inputSinces) => { - return inputSinces.set(txSkeleton.get("inputs").size - 1, since); - }); - } - - if (!template) { - throw new Error(`JoyID script not defined in config!`); - } - - // add witness - /* - * Modify the skeleton, so the first witness of the fromAddress script group - * has a WitnessArgs construct with 85-byte zero filled values. While this - * is not required, it helps in transaction fee estimation. - */ - const firstIndex = txSkeleton - .get("inputs") - .findIndex((input) => - bytes.equal(blockchain.Script.pack(input.cellOutput.lock), blockchain.Script.pack(fromScript)) - ); - if (firstIndex !== -1) { - while (firstIndex >= txSkeleton.get("witnesses").size) { - txSkeleton = txSkeleton.update("witnesses", (witnesses) => witnesses.push("0x")); - } - - const connection = config.connection; - console.log("JoyID config: ", getConfig()); - console.log("JoyID connection: ", connection); - - const lock = helpers.parseAddress(connection.address); - - // will change if the connection.keyType is a sub_key - let newWitnessArgs: WitnessArgs = { - lock: "0x", - }; - - if (connection.keyType === "sub_key") { - const aggregator = new Aggregator("https://cota.nervina.dev/aggregator"); - - const pubkeyHash = bytes.bytify(utils.ckbHash("0x" + connection.pubkey)).slice(0, 20); - - const { unlock_entry: unlockEntry } = await aggregator.generateSubkeyUnlockSmt({ - // TODO TBD - alg_index: 1, - pubkey_hash: bytes.hexify(pubkeyHash), - lock_script: bytes.hexify(blockchain.Script.pack(lock)), - }); - newWitnessArgs = { - lock: "0x", - inputType: "0x", - outputType: "0x" + unlockEntry, - }; - - const cotaType = getCotaTypeScript(getConfig().network === "mainnet"); - const cotaCollector = txSkeleton.get("cellProvider").collector({ lock: lock, type: cotaType }); - - let cotaCells: Cell[] = []; - for await (const cotaCell of cotaCollector.collect()) { - cotaCells.push(cotaCell); - } - - if (!cotaCells || cotaCells.length === 0) { - throw new Error("Cota cell doesn't exist"); - } - const cotaCell = cotaCells[0]; - const cotaCellDep: CKBComponents.CellDep = { - outPoint: cotaCell.outPoint, - depType: "code", - }; - - // note: COTA cell MUST put first - txSkeleton = helpers.addCellDep(txSkeleton, cotaCellDep); - } - - txSkeleton = helpers.addCellDep(txSkeleton, getJoyIDCellDep(false)); - - const witness = bytes.hexify(blockchain.WitnessArgs.pack(newWitnessArgs)); - txSkeleton = txSkeleton.update("witnesses", (witnesses) => witnesses.set(firstIndex, witness)); - } - - return txSkeleton; - }, - }, - }; -} - -function asserts(condition: unknown, message = "Assert failed"): asserts condition { - if (!condition) { - throw new Error(message); - } -} diff --git a/examples/joyid/lib.ts b/examples/joyid/lib.ts index 4d42b896a..5f06ef122 100644 --- a/examples/joyid/lib.ts +++ b/examples/joyid/lib.ts @@ -1,5 +1,4 @@ import { BI, config, Indexer, RPC, helpers, commons, Transaction, Hash, BIish } from "@ckb-lumos/lumos"; -import "./joyid"; export const CONFIG = config.predefined.AGGRON4; config.initializeConfig(CONFIG); diff --git a/examples/joyid/package.json b/examples/joyid/package.json index 81ed9b0ef..34be1cc57 100644 --- a/examples/joyid/package.json +++ b/examples/joyid/package.json @@ -13,6 +13,7 @@ "license": "MIT", "dependencies": { "@ckb-lumos/lumos": "canary", + "@ckb-lumos/joyid": "canary", "@types/react": "^18.0.25", "@types/react-dom": "^18.0.9", "@joyid/ckb": "^0.0.6", diff --git a/examples/pnpm-lock.yaml b/examples/pnpm-lock.yaml index 71bae9327..81bc51acc 100644 --- a/examples/pnpm-lock.yaml +++ b/examples/pnpm-lock.yaml @@ -437,6 +437,33 @@ importers: specifier: ^4.3.0 version: 4.3.0 + ../packages/joyid: + dependencies: + '@ckb-lumos/base': + specifier: 0.22.0-next.5 + version: link:../base + '@ckb-lumos/bi': + specifier: 0.22.0-next.5 + version: link:../bi + '@ckb-lumos/codec': + specifier: 0.22.0-next.5 + version: link:../codec + '@ckb-lumos/common-scripts': + specifier: 0.22.0-next.5 + version: link:../common-scripts + '@ckb-lumos/config-manager': + specifier: 0.22.0-next.5 + version: link:../config-manager + '@ckb-lumos/helpers': + specifier: 0.22.0-next.5 + version: link:../helpers + '@joyid/ckb': + specifier: 0.0.6 + version: 0.0.6 + sinon: + specifier: ^15.0.4 + version: 15.0.4 + ../packages/light-client: dependencies: '@ckb-lumos/base': @@ -776,6 +803,9 @@ importers: joyid: dependencies: + '@ckb-lumos/joyid': + specifier: canary + version: link:../../packages/joyid '@ckb-lumos/lumos': specifier: canary version: link:../../packages/lumos @@ -3123,19 +3153,16 @@ packages: resolution: {integrity: sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==} dependencies: type-detect: 4.0.8 - dev: true /@sinonjs/commons@3.0.0: resolution: {integrity: sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==} dependencies: type-detect: 4.0.8 - dev: true /@sinonjs/fake-timers@10.3.0: resolution: {integrity: sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==} dependencies: '@sinonjs/commons': 3.0.0 - dev: true /@sinonjs/fake-timers@9.1.2: resolution: {integrity: sha512-BPS4ynJW/o92PUR4wgriz2Ud5gpST5vz6GQfMixEDK0Z8ZCUv2M7SkBLykH56T++Xs+8ln9zTGbOvNGIe02/jw==} @@ -3149,11 +3176,9 @@ packages: '@sinonjs/commons': 2.0.0 lodash.get: 4.4.2 type-detect: 4.0.8 - dev: true /@sinonjs/text-encoding@0.7.2: resolution: {integrity: sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==} - dev: true /@swc/core-darwin-arm64@1.3.67: resolution: {integrity: sha512-zCT2mCkOBVNf5uJDcQ3A9KDoO1OEaGdfjsRTZTo7sejDd9AXLfJg+xgyCBBrK2jNS/uWcT21IvSv3LqKp4K8pA==} @@ -4697,7 +4722,6 @@ packages: /diff@5.1.0: resolution: {integrity: sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==} engines: {node: '>=0.3.1'} - dev: true /diffie-hellman@5.0.3: resolution: {integrity: sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==} @@ -5372,7 +5396,6 @@ packages: /has-flag@4.0.0: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} - dev: true /has-property-descriptors@1.0.2: resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} @@ -5729,7 +5752,6 @@ packages: /isarray@0.0.1: resolution: {integrity: sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==} - dev: true /isarray@1.0.0: resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==} @@ -6356,7 +6378,6 @@ packages: /just-extend@4.2.1: resolution: {integrity: sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==} - dev: true /keccak@3.0.1: resolution: {integrity: sha512-epq90L9jlFWCW7+pQa6JOnKn2Xgl2mtI664seYR6MHskvI9agt7AnDqmAlp9TqU4/caMYbA08Hi5DMZAl5zdkA==} @@ -6528,7 +6549,6 @@ packages: /lodash.get@4.4.2: resolution: {integrity: sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==} - dev: true /lodash.isequal@4.5.0: resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==} @@ -6788,7 +6808,6 @@ packages: '@sinonjs/text-encoding': 0.7.2 just-extend: 4.2.1 path-to-regexp: 1.8.0 - dev: true /nock@13.2.9: resolution: {integrity: sha512-1+XfJNYF1cjGB+TKMWi29eZ0b82QOvQs2YoLNzbpWGqFMtRQHTa57osqdGj4FrFPgkO4D4AZinzUJR9VvW3QUA==} @@ -7105,7 +7124,6 @@ packages: resolution: {integrity: sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==} dependencies: isarray: 0.0.1 - dev: true /path-type@4.0.0: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} @@ -7763,7 +7781,6 @@ packages: diff: 5.1.0 nise: 5.1.4 supports-color: 7.2.0 - dev: true /sisteransi@1.0.5: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} @@ -8005,7 +8022,6 @@ packages: engines: {node: '>=8'} dependencies: has-flag: 4.0.0 - dev: true /supports-color@8.1.1: resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} @@ -8188,7 +8204,6 @@ packages: /type-detect@4.0.8: resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} engines: {node: '>=4'} - dev: true /type-fest@0.20.2: resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==} From c7f98628384a66e82b4f879cbbeca6d327436e88 Mon Sep 17 00:00:00 2001 From: homura Date: Tue, 19 Mar 2024 10:04:01 +0800 Subject: [PATCH 09/18] chore: imrpove grammar Co-authored-by: Chen Yu Signed-off-by: homura --- examples/joyid/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/joyid/README.md b/examples/joyid/README.md index 6e902831f..5ab07eff2 100644 --- a/examples/joyid/README.md +++ b/examples/joyid/README.md @@ -1,6 +1,6 @@ # Lumos Works with JoyID -[JoyID](https://joy.id/) is a universal account protocol. This example will show how to use Lumos to work with JoyID by a simple CKB transfer transaction. +[JoyID](https://joy.id/) is a universal account protocol. This example shows how to use Lumos to work with JoyID by a simple CKB transfer transaction. ## Quick Start From e60803ad82b4f77760f693ffb67dc6f02a77e50e Mon Sep 17 00:00:00 2001 From: homura Date: Tue, 19 Mar 2024 11:16:44 +0800 Subject: [PATCH 10/18] refactor(joyid): comment for customizing script info --- commitlint.config.js | 1 + packages/joyid/src/script-info.ts | 34 ++++++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/commitlint.config.js b/commitlint.config.js index 54fecde56..414ae5141 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -23,6 +23,7 @@ const scopeEnumValues = [ "runner", "e2e-test", "molecule", + "joyid", ]; const Configuration = { extends: ["@commitlint/config-conventional"], diff --git a/packages/joyid/src/script-info.ts b/packages/joyid/src/script-info.ts index dd43fb189..61ca7472f 100644 --- a/packages/joyid/src/script-info.ts +++ b/packages/joyid/src/script-info.ts @@ -91,7 +91,11 @@ export type JoyIDScriptInfoConfig = { cotaTypeScriptTemplate: { codeHash: HexString; hashType: HashType }; }; -/* c8 ignore next 9*/ +/* c8 ignore start */ +/** + * get the builtin mainnet or testnet config to {@link createJoyIDScriptInfo} + * @param isMainnet + */ export function getDefaultConfig(isMainnet: boolean): JoyIDScriptInfoConfig { // https://github.com/nervina-labs/cota-sdk-js/blob/f80d04ea532d72cfe7410ea45af6dc583e140edf/README.md?plain=1#L46-L52 const aggregatorUrl = isMainnet @@ -99,14 +103,38 @@ export function getDefaultConfig(isMainnet: boolean): JoyIDScriptInfoConfig { : "https://cota.nervina.dev/aggregator"; return { - // TODO the mainnet URL is unknown aggregator: new Aggregator(aggregatorUrl), cellDeps: [getJoyIDCellDep(isMainnet)], joyIdLockScriptTemplate: getJoyIDLockScript(isMainnet), cotaTypeScriptTemplate: getCotaTypeScript(isMainnet), }; } - +/* c8 ignore end */ + +/** + * create a JoyID ScriptInfo to register it to common-scripts + * @example + * + * import { connect } from "@joyid/ckb" + * import { registerCustomLockScriptInfos } from "@ckb-lumos/lumos/common-scripts/common" + * + * // connect to JoyID + * const connection = await connect() + * + * // create JoyID ScriptInfo + * const joyIDScriptInfo = createJoyIDScriptInfo( + * connection, + * getJoyIDScriptInfo(true), + * // or you can override it by demand + * // {...getJoyIDScriptInfo(true), aggregator: new Aggregator('/path/to/aggreagator')} + * ) + * + * // register the ScriptInfo into the common-scripts + * registerCustomLockScriptInfos(joyIDScriptInfo) + * + * @param connection the JoyID connection + * @param config {@link getDefaultConfig} + */ export function createJoyIDScriptInfo( connection: Connection, config: JoyIDScriptInfoConfig From 69b1be3e31626bb2789fcce84c2017affded7c2e Mon Sep 17 00:00:00 2001 From: homura Date: Tue, 19 Mar 2024 11:24:32 +0800 Subject: [PATCH 11/18] chore(joyid): ignore the built files --- packages/joyid/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 packages/joyid/.gitignore diff --git a/packages/joyid/.gitignore b/packages/joyid/.gitignore new file mode 100644 index 000000000..a65b41774 --- /dev/null +++ b/packages/joyid/.gitignore @@ -0,0 +1 @@ +lib From f76fe522b5015288e853b2204e3d12e2aa3edfa9 Mon Sep 17 00:00:00 2001 From: homura Date: Tue, 19 Mar 2024 20:05:20 +0800 Subject: [PATCH 12/18] chore: publish to npm --- .github/workflows/experimental-joyid.yml | 48 ++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/experimental-joyid.yml diff --git a/.github/workflows/experimental-joyid.yml b/.github/workflows/experimental-joyid.yml new file mode 100644 index 000000000..0d77b3f71 --- /dev/null +++ b/.github/workflows/experimental-joyid.yml @@ -0,0 +1,48 @@ +name: Canary +on: + push: + branches: + - experimental-joyid + +permissions: + contents: write + +jobs: + canary: + runs-on: ubuntu-latest + steps: + - name: Clone repository + uses: actions/checkout@v3 + + - name: Install dependencies + uses: ./.github/actions/install-deps + + - name: Setup .npmrc file + uses: actions/setup-node@v3 + with: + registry-url: "https://registry.npmjs.org" + + - name: Experimental release + run: | + npx changeset pre exit || true + npx changeset version --snapshot experimental-joyid-$(git log -1 --pretty=format:%h) + pnpm -r publish --no-git-checks --tag experimental-joyid + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Generate commit comment + id: commit-comment + run: | + result="$(node scripts/canary-commit-comment.cjs)" + delimiter="$(openssl rand -hex 8)" + echo "result<<$delimiter" >> $GITHUB_OUTPUT + echo "$result" >> $GITHUB_OUTPUT + echo "$delimiter" >> $GITHUB_OUTPUT + + - name: Create commit comment + uses: peter-evans/commit-comment@v2 + with: + body: ${{ steps.commit-comment.outputs.result }} + token: ${{ secrets.GITHUB_TOKEN }} From 8f13cf9bd5e7757ec7523904aee9e29e5c12b5de Mon Sep 17 00:00:00 2001 From: homura Date: Tue, 19 Mar 2024 20:13:52 +0800 Subject: [PATCH 13/18] fix: incorrect dependencies --- packages/joyid/package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/joyid/package.json b/packages/joyid/package.json index 589611f29..f96fdfbe3 100644 --- a/packages/joyid/package.json +++ b/packages/joyid/package.json @@ -26,8 +26,10 @@ "@ckb-lumos/helpers": "0.22.0-next.5" }, "peerDependencies": { + "@joyid/ckb": "0.0.6" + }, + "devDependencies": { "@ckb-lumos/bi": "0.22.0-next.5", - "@joyid/ckb": "0.0.6", "sinon": "^15.0.4" }, "repository": { From 53188ec2c823625521f0950ed5968b876197337e Mon Sep 17 00:00:00 2001 From: homura Date: Tue, 19 Mar 2024 20:16:23 +0800 Subject: [PATCH 14/18] chore: update lock file --- pnpm-lock.yaml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6680bfa3f..c29f6adfb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -520,9 +520,6 @@ importers: '@ckb-lumos/base': specifier: 0.22.0-next.5 version: link:../base - '@ckb-lumos/bi': - specifier: 0.22.0-next.5 - version: link:../bi '@ckb-lumos/codec': specifier: 0.22.0-next.5 version: link:../codec @@ -538,6 +535,10 @@ importers: '@joyid/ckb': specifier: 0.0.6 version: 0.0.6 + devDependencies: + '@ckb-lumos/bi': + specifier: 0.22.0-next.5 + version: link:../bi sinon: specifier: ^15.0.4 version: 15.0.4 @@ -5607,16 +5608,19 @@ packages: resolution: {integrity: sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==} dependencies: type-detect: 4.0.8 + dev: true /@sinonjs/commons@3.0.0: resolution: {integrity: sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==} dependencies: type-detect: 4.0.8 + dev: true /@sinonjs/fake-timers@10.0.2: resolution: {integrity: sha512-SwUDyjWnah1AaNl7kxsa7cfLhlTYoiyhDAIgyh+El30YvXs/o7OLXpYH88Zdhyx9JExKrmHDJ+10bwIcY80Jmw==} dependencies: '@sinonjs/commons': 2.0.0 + dev: true /@sinonjs/fake-timers@7.1.2: resolution: {integrity: sha512-iQADsW4LBMISqZ6Ci1dupJL9pprqwcVFTcOsEmQOEhW+KLCVn/Y4Jrvg2k19fIHCp+iFprriYPTdRcQR8NbUPg==} @@ -5636,9 +5640,11 @@ packages: '@sinonjs/commons': 2.0.0 lodash.get: 4.4.2 type-detect: 4.0.8 + dev: true /@sinonjs/text-encoding@0.7.2: resolution: {integrity: sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==} + dev: true /@slorber/remark-comment@1.0.0: resolution: {integrity: sha512-RCE24n7jsOj1M0UPvIQCHTe7fI0sFL4S2nwKVWwHyVr/wI/H8GosgsJGyhnsZoGFnD/P2hLf1mSbrrgSLN93NA==} @@ -9086,6 +9092,7 @@ packages: /diff@5.1.0: resolution: {integrity: sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==} engines: {node: '>=0.3.1'} + dev: true /diffie-hellman@5.0.3: resolution: {integrity: sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==} @@ -12442,6 +12449,7 @@ packages: /just-extend@4.2.1: resolution: {integrity: sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==} + dev: true /keccak@3.0.1: resolution: {integrity: sha512-epq90L9jlFWCW7+pQa6JOnKn2Xgl2mtI664seYR6MHskvI9agt7AnDqmAlp9TqU4/caMYbA08Hi5DMZAl5zdkA==} @@ -12668,6 +12676,7 @@ packages: /lodash.get@4.4.2: resolution: {integrity: sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==} + dev: true /lodash.isequal@4.5.0: resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==} @@ -13744,6 +13753,7 @@ packages: '@sinonjs/text-encoding': 0.7.2 just-extend: 4.2.1 path-to-regexp: 1.8.0 + dev: true /no-case@3.0.4: resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==} @@ -16206,6 +16216,7 @@ packages: diff: 5.1.0 nise: 5.1.4 supports-color: 7.2.0 + dev: true /sirv@2.0.3: resolution: {integrity: sha512-O9jm9BsID1P+0HOi81VpXPoDxYP374pkOLzACAoyUQ/3OUVndNpsz6wMnY2z+yOxzbllCKZrM+9QrWsv4THnyA==} @@ -17065,6 +17076,7 @@ packages: /type-detect@4.0.8: resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} engines: {node: '>=4'} + dev: true /type-fest@0.13.1: resolution: {integrity: sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==} From 08e22ca3e5e145dfbe26467397a6a4cf1f072341 Mon Sep 17 00:00:00 2001 From: homura Date: Tue, 16 Apr 2024 23:06:38 +0800 Subject: [PATCH 15/18] chore: update deps --- packages/joyid/package.json | 16 ++++++++-------- pnpm-lock.yaml | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/joyid/package.json b/packages/joyid/package.json index f96fdfbe3..2161e0419 100644 --- a/packages/joyid/package.json +++ b/packages/joyid/package.json @@ -1,8 +1,8 @@ { "name": "@ckb-lumos/joyid", - "version": "0.22.0-next.5", + "version": "0.22.2", "description": "Working with JoyID", - "author": "", + "author": "Homura ", "homepage": "https://github.com/ckb-js/lumos#readme", "license": "MIT", "main": "lib/index.js", @@ -19,17 +19,17 @@ "src" ], "dependencies": { - "@ckb-lumos/base": "0.22.0-next.5", - "@ckb-lumos/codec": "0.22.0-next.5", - "@ckb-lumos/config-manager": "0.22.0-next.5", - "@ckb-lumos/common-scripts": "0.22.0-next.5", - "@ckb-lumos/helpers": "0.22.0-next.5" + "@ckb-lumos/base": "0.22.2", + "@ckb-lumos/codec": "0.22.2", + "@ckb-lumos/config-manager": "0.22.2", + "@ckb-lumos/common-scripts": "0.22.2", + "@ckb-lumos/helpers": "0.22.2" }, "peerDependencies": { "@joyid/ckb": "0.0.6" }, "devDependencies": { - "@ckb-lumos/bi": "0.22.0-next.5", + "@ckb-lumos/bi": "0.22.2", "sinon": "^15.0.4" }, "repository": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8c6678cf0..e6963acb0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -518,26 +518,26 @@ importers: packages/joyid: dependencies: '@ckb-lumos/base': - specifier: 0.22.0-next.5 + specifier: 0.22.2 version: link:../base '@ckb-lumos/codec': - specifier: 0.22.0-next.5 + specifier: 0.22.2 version: link:../codec '@ckb-lumos/common-scripts': - specifier: 0.22.0-next.5 + specifier: 0.22.2 version: link:../common-scripts '@ckb-lumos/config-manager': - specifier: 0.22.0-next.5 + specifier: 0.22.2 version: link:../config-manager '@ckb-lumos/helpers': - specifier: 0.22.0-next.5 + specifier: 0.22.2 version: link:../helpers '@joyid/ckb': specifier: 0.0.6 version: 0.0.6 devDependencies: '@ckb-lumos/bi': - specifier: 0.22.0-next.5 + specifier: 0.22.2 version: link:../bi sinon: specifier: ^15.0.4 From a2ee43f9583108994835a4bac641bb01ea945644 Mon Sep 17 00:00:00 2001 From: homura Date: Mon, 29 Apr 2024 16:03:53 +0800 Subject: [PATCH 16/18] refactor(joyid): avoid magick number --- packages/joyid/src/script-info.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/joyid/src/script-info.ts b/packages/joyid/src/script-info.ts index 61ca7472f..bc137ac60 100644 --- a/packages/joyid/src/script-info.ts +++ b/packages/joyid/src/script-info.ts @@ -214,10 +214,12 @@ export function createJoyIDScriptInfo( lock: "0x", }; + const BLAKE160_LENGTH = 20; if (connection.keyType === "sub_key") { + //https://github.com/nervina-labs/ckb-dex-sdk/blob/b34c0b98e63ae1cfadcc9f9430a8d2a606f77a15/src/order/cancel.ts#L117C33-L117C41 const pubkeyHash = bytes .bytify(utils.ckbHash("0x" + connection.pubkey)) - .slice(0, 20); + .slice(0, BLAKE160_LENGTH); const { unlock_entry: unlockEntry } = await aggregator.generateSubkeyUnlockSmt({ From 570900a277b69e04dcd4290fd947ca3309b5597d Mon Sep 17 00:00:00 2001 From: homura Date: Tue, 30 Apr 2024 00:54:49 +0800 Subject: [PATCH 17/18] chore(examples): use the npm default version --- examples/cardano-lock-namiwallet/package.json | 3 +-- examples/joyid/package.json | 2 +- examples/pw-lock-metamask/package.json | 2 +- examples/secp256k1-multisig-transfer/package.json | 2 +- examples/secp256k1-transfer/package.json | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/examples/cardano-lock-namiwallet/package.json b/examples/cardano-lock-namiwallet/package.json index 4e4039c73..0873ac33b 100644 --- a/examples/cardano-lock-namiwallet/package.json +++ b/examples/cardano-lock-namiwallet/package.json @@ -1,8 +1,7 @@ { "private": true, "name": "@lumos-examples/cardano-lock-namiwallet", - "version": "0.21.0-next.0", - "description": "", + "description": "1.0.0", "main": "index.js", "scripts": { "start": "parcel index.html", diff --git a/examples/joyid/package.json b/examples/joyid/package.json index 34be1cc57..b019e2170 100644 --- a/examples/joyid/package.json +++ b/examples/joyid/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@lumos-examples/joyid", - "version": "0.21.0-next.0", + "version": "1.0.0", "description": "", "main": "index.js", "scripts": { diff --git a/examples/pw-lock-metamask/package.json b/examples/pw-lock-metamask/package.json index 45c0f01dd..1afc5ff33 100644 --- a/examples/pw-lock-metamask/package.json +++ b/examples/pw-lock-metamask/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@lumos-examples/pw-lock-metamask", - "version": "0.21.0-next.0", + "version": "1.0.0", "description": "", "main": "index.js", "scripts": { diff --git a/examples/secp256k1-multisig-transfer/package.json b/examples/secp256k1-multisig-transfer/package.json index 8e637724a..27606a60e 100644 --- a/examples/secp256k1-multisig-transfer/package.json +++ b/examples/secp256k1-multisig-transfer/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@lumos-examples/secp256k1-multisig-transfer", - "version": "0.21.0-next.0", + "version": "1.0.0", "description": "", "main": "index.js", "scripts": { diff --git a/examples/secp256k1-transfer/package.json b/examples/secp256k1-transfer/package.json index 9e750b2d5..b8cb97327 100644 --- a/examples/secp256k1-transfer/package.json +++ b/examples/secp256k1-transfer/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@lumos-examples/secp256k1-transfer", - "version": "0.21.0-next.0", + "version": "1.0.0", "description": "", "main": "index.js", "scripts": { From bd2447b0abbd74726520ca0874f3ba703d586a83 Mon Sep 17 00:00:00 2001 From: homura Date: Tue, 30 Apr 2024 00:56:39 +0800 Subject: [PATCH 18/18] feat(joyid): support joyid --- .changeset/tall-toes-sort.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/tall-toes-sort.md diff --git a/.changeset/tall-toes-sort.md b/.changeset/tall-toes-sort.md new file mode 100644 index 000000000..9a3dd44bd --- /dev/null +++ b/.changeset/tall-toes-sort.md @@ -0,0 +1,5 @@ +--- +"@ckb-lumos/joyid": minor +--- + +feat: support joyid