@ckb-ccc/spore 1.5.12 → 1.5.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @ckb-ccc/spore
2
2
 
3
+ ## 1.5.14
4
+ ### Patch Changes
5
+
6
+
7
+
8
+ - [#324](https://github.com/ckb-devrel/ccc/pull/324) [`3aa4425`](https://github.com/ckb-devrel/ccc/commit/3aa4425c6f7d756ceb464f58716b1a89620e2d5b) Thanks [@ashuralyk](https://github.com/ashuralyk)! - Enable searching manual proxy lock for cluster in LockProxy mode
9
+
10
+ ## 1.5.13
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [[`b371b07`](https://github.com/ckb-devrel/ccc/commit/b371b07e67f295129defc36190741ab4d783dd96)]:
14
+ - @ckb-ccc/core@1.12.2
15
+
3
16
  ## 1.5.12
4
17
  ### Patch Changes
5
18
 
@@ -1 +1 @@
1
- {"version":3,"file":"advanced.d.ts","sourceRoot":"","sources":["../../src/spore/advanced.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE1D,wBAAsB,cAAc,CAClC,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,EAAE,EAAE,GAAG,CAAC,WAAW,EACnB,IAAI,EAAE,aAAa,EACnB,WAAW,CAAC,EAAE,WAAW,GAAG,aAAa,GAAG,MAAM,EAClD,cAAc,CAAC,EAAE,GAAG,CAAC,OAAO,GAC3B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,MAAM,CAAC,GAAG,SAAS,CAAC,CA4DvD"}
1
+ {"version":3,"file":"advanced.d.ts","sourceRoot":"","sources":["../../src/spore/advanced.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE1D,wBAAsB,cAAc,CAClC,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,EAAE,EAAE,GAAG,CAAC,WAAW,EACnB,IAAI,EAAE,aAAa,EACnB,WAAW,CAAC,EAAE,WAAW,GAAG,aAAa,GAAG,MAAM,EAClD,cAAc,CAAC,EAAE,GAAG,CAAC,OAAO,GAC3B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,MAAM,CAAC,GAAG,SAAS,CAAC,CA2EvD"}
@@ -1,3 +1,4 @@
1
+ import { ccc } from "@ckb-ccc/core";
1
2
  import { assembleTransferClusterAction } from "../advanced.js";
2
3
  import { assertCluster } from "../cluster/index.js";
3
4
  export async function prepareCluster(signer, tx, data, clusterMode, scriptInfoHash) {
@@ -13,15 +14,18 @@ export async function prepareCluster(signer, tx, data, clusterMode, scriptInfoHa
13
14
  switch (clusterMode) {
14
15
  case "lockProxy": {
15
16
  const lock = cluster.cellOutput.lock;
16
- if ((await tx.findInputIndexByLock(lock, signer.client)) === undefined) {
17
- // note: We can only search proxy of signer, if any custom logic is in need, developer should get
18
- // the proxy filled in transaction before invoking `createSpore`
19
- await tx.completeInputsAddOne(signer);
17
+ // Ensure a lock-proxy input is present, add one if absent
18
+ let lockProxyInputIndex = await tx.findInputIndexByLock(lock, signer.client);
19
+ if (lockProxyInputIndex === undefined) {
20
+ await tx.completeInputsAddOne(new ccc.SignerCkbScriptReadonly(signer.client, lock));
21
+ lockProxyInputIndex = await tx.findInputIndexByLock(lock, signer.client);
22
+ if (lockProxyInputIndex === undefined) {
23
+ throw new Error("Lock proxy input not found");
24
+ }
20
25
  }
21
- if (tx.outputs.every((output) => output.lock !== lock)) {
22
- tx.addOutput({
23
- lock,
24
- });
26
+ // Add the output only if there's not already one with proxy lock
27
+ if (!tx.outputs.some((output) => output.lock === lock)) {
28
+ tx.addOutput(await tx.getInput(lockProxyInputIndex).getCell(signer.client));
25
29
  }
26
30
  tx.addCellDeps({
27
31
  outPoint: cluster.outPoint,
@@ -1 +1 @@
1
- {"version":3,"file":"advanced.d.ts","sourceRoot":"","sources":["../../src/spore/advanced.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE1D,wBAAsB,cAAc,CAClC,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,EAAE,EAAE,GAAG,CAAC,WAAW,EACnB,IAAI,EAAE,aAAa,EACnB,WAAW,CAAC,EAAE,WAAW,GAAG,aAAa,GAAG,MAAM,EAClD,cAAc,CAAC,EAAE,GAAG,CAAC,OAAO,GAC3B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,MAAM,CAAC,GAAG,SAAS,CAAC,CA4DvD"}
1
+ {"version":3,"file":"advanced.d.ts","sourceRoot":"","sources":["../../src/spore/advanced.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE1D,wBAAsB,cAAc,CAClC,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,EAAE,EAAE,GAAG,CAAC,WAAW,EACnB,IAAI,EAAE,aAAa,EACnB,WAAW,CAAC,EAAE,WAAW,GAAG,aAAa,GAAG,MAAM,EAClD,cAAc,CAAC,EAAE,GAAG,CAAC,OAAO,GAC3B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,MAAM,CAAC,GAAG,SAAS,CAAC,CA2EvD"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.prepareCluster = prepareCluster;
4
+ const core_1 = require("@ckb-ccc/core");
4
5
  const advanced_js_1 = require("../advanced.js");
5
6
  const index_js_1 = require("../cluster/index.js");
6
7
  async function prepareCluster(signer, tx, data, clusterMode, scriptInfoHash) {
@@ -16,15 +17,18 @@ async function prepareCluster(signer, tx, data, clusterMode, scriptInfoHash) {
16
17
  switch (clusterMode) {
17
18
  case "lockProxy": {
18
19
  const lock = cluster.cellOutput.lock;
19
- if ((await tx.findInputIndexByLock(lock, signer.client)) === undefined) {
20
- // note: We can only search proxy of signer, if any custom logic is in need, developer should get
21
- // the proxy filled in transaction before invoking `createSpore`
22
- await tx.completeInputsAddOne(signer);
20
+ // Ensure a lock-proxy input is present, add one if absent
21
+ let lockProxyInputIndex = await tx.findInputIndexByLock(lock, signer.client);
22
+ if (lockProxyInputIndex === undefined) {
23
+ await tx.completeInputsAddOne(new core_1.ccc.SignerCkbScriptReadonly(signer.client, lock));
24
+ lockProxyInputIndex = await tx.findInputIndexByLock(lock, signer.client);
25
+ if (lockProxyInputIndex === undefined) {
26
+ throw new Error("Lock proxy input not found");
27
+ }
23
28
  }
24
- if (tx.outputs.every((output) => output.lock !== lock)) {
25
- tx.addOutput({
26
- lock,
27
- });
29
+ // Add the output only if there's not already one with proxy lock
30
+ if (!tx.outputs.some((output) => output.lock === lock)) {
31
+ tx.addOutput(await tx.getInput(lockProxyInputIndex).getCell(signer.client));
28
32
  }
29
33
  tx.addCellDeps({
30
34
  outPoint: cluster.outPoint,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckb-ccc/spore",
3
- "version": "1.5.12",
3
+ "version": "1.5.14",
4
4
  "description": "CCC - CKBer's Codebase. Common Chains Connector's support for Spore protocol",
5
5
  "author": "ashuralyk <ashuralyk@live.com>",
6
6
  "license": "MIT",
@@ -55,7 +55,7 @@
55
55
  },
56
56
  "dependencies": {
57
57
  "axios": "^1.11.0",
58
- "@ckb-ccc/core": "1.12.1"
58
+ "@ckb-ccc/core": "1.12.2"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "rimraf ./dist && rimraf ./dist.commonjs && tsc && tsc --project tsconfig.commonjs.json && copyfiles -u 2 misc/basedirs/**/* .",
@@ -29,16 +29,31 @@ export async function prepareCluster(
29
29
  case "lockProxy": {
30
30
  const lock = cluster.cellOutput.lock;
31
31
 
32
- if ((await tx.findInputIndexByLock(lock, signer.client)) === undefined) {
33
- // note: We can only search proxy of signer, if any custom logic is in need, developer should get
34
- // the proxy filled in transaction before invoking `createSpore`
35
- await tx.completeInputsAddOne(signer);
36
- }
37
- if (tx.outputs.every((output) => output.lock !== lock)) {
38
- tx.addOutput({
32
+ // Ensure a lock-proxy input is present, add one if absent
33
+ let lockProxyInputIndex = await tx.findInputIndexByLock(
34
+ lock,
35
+ signer.client,
36
+ );
37
+ if (lockProxyInputIndex === undefined) {
38
+ await tx.completeInputsAddOne(
39
+ new ccc.SignerCkbScriptReadonly(signer.client, lock),
40
+ );
41
+ lockProxyInputIndex = await tx.findInputIndexByLock(
39
42
  lock,
40
- });
43
+ signer.client,
44
+ );
45
+ if (lockProxyInputIndex === undefined) {
46
+ throw new Error("Lock proxy input not found");
47
+ }
41
48
  }
49
+
50
+ // Add the output only if there's not already one with proxy lock
51
+ if (!tx.outputs.some((output) => output.lock === lock)) {
52
+ tx.addOutput(
53
+ await tx.getInput(lockProxyInputIndex)!.getCell(signer.client),
54
+ );
55
+ }
56
+
42
57
  tx.addCellDeps({
43
58
  outPoint: cluster.outPoint,
44
59
  depType: "code",