@ckb-ccc/spore 1.5.16 → 1.5.18
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 +16 -0
- package/dist/cobuild/index.d.ts +10 -10
- package/dist/cobuild/index.d.ts.map +1 -1
- package/dist/codec/cluster.d.ts +4 -4
- package/dist/codec/cluster.d.ts.map +1 -1
- package/dist/codec/cobuild/buildingPacket.d.ts +218 -218
- package/dist/codec/cobuild/buildingPacket.d.ts.map +1 -1
- package/dist/codec/cobuild/sporeAction.d.ts +132 -132
- package/dist/codec/cobuild/sporeAction.d.ts.map +1 -1
- package/dist/codec/spore.d.ts +2 -2
- package/dist/codec/spore.d.ts.map +1 -1
- package/dist/spore/advanced.d.ts +2 -2
- package/dist/spore/advanced.d.ts.map +1 -1
- package/dist.commonjs/cobuild/index.d.ts +10 -10
- package/dist.commonjs/cobuild/index.d.ts.map +1 -1
- package/dist.commonjs/codec/cluster.d.ts +4 -4
- package/dist.commonjs/codec/cluster.d.ts.map +1 -1
- package/dist.commonjs/codec/cobuild/buildingPacket.d.ts +218 -218
- package/dist.commonjs/codec/cobuild/buildingPacket.d.ts.map +1 -1
- package/dist.commonjs/codec/cobuild/sporeAction.d.ts +132 -132
- package/dist.commonjs/codec/cobuild/sporeAction.d.ts.map +1 -1
- package/dist.commonjs/codec/spore.d.ts +2 -2
- package/dist.commonjs/codec/spore.d.ts.map +1 -1
- package/dist.commonjs/spore/advanced.d.ts +2 -2
- package/dist.commonjs/spore/advanced.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/cobuild/index.ts +10 -10
- package/src/codec/cluster.ts +2 -2
- package/src/codec/spore.ts +1 -1
- package/src/spore/advanced.ts +2 -2
package/src/cobuild/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ccc
|
|
1
|
+
import { ccc } from "@ckb-ccc/core";
|
|
2
2
|
import {
|
|
3
3
|
Action,
|
|
4
4
|
ActionVec,
|
|
@@ -11,7 +11,7 @@ export function assembleCreateSporeAction(
|
|
|
11
11
|
sporeOutput: ccc.CellOutputLike,
|
|
12
12
|
sporeData: ccc.BytesLike,
|
|
13
13
|
scriptInfoHash: ccc.HexLike = DEFAULT_COBUILD_INFO_HASH,
|
|
14
|
-
):
|
|
14
|
+
): ccc.EncodableType<typeof Action> {
|
|
15
15
|
if (!sporeOutput.type) {
|
|
16
16
|
throw new Error("Spore cell must have a type script");
|
|
17
17
|
}
|
|
@@ -39,7 +39,7 @@ export function assembleTransferSporeAction(
|
|
|
39
39
|
sporeInput: ccc.CellOutputLike,
|
|
40
40
|
sporeOutput: ccc.CellOutputLike,
|
|
41
41
|
scriptInfoHash: ccc.HexLike = DEFAULT_COBUILD_INFO_HASH,
|
|
42
|
-
):
|
|
42
|
+
): ccc.EncodableType<typeof Action> {
|
|
43
43
|
if (!sporeInput.type || !sporeOutput.type) {
|
|
44
44
|
throw new Error("Spore cell must have a type script");
|
|
45
45
|
}
|
|
@@ -70,7 +70,7 @@ export function assembleTransferSporeAction(
|
|
|
70
70
|
export function assembleMeltSporeAction(
|
|
71
71
|
sporeInput: ccc.CellOutputLike,
|
|
72
72
|
scriptInfoHash: ccc.HexLike = DEFAULT_COBUILD_INFO_HASH,
|
|
73
|
-
):
|
|
73
|
+
): ccc.EncodableType<typeof Action> {
|
|
74
74
|
if (!sporeInput.type) {
|
|
75
75
|
throw new Error("Spore cell must have a type script");
|
|
76
76
|
}
|
|
@@ -97,7 +97,7 @@ export function assembleCreateClusterAction(
|
|
|
97
97
|
clusterOutput: ccc.CellOutputLike,
|
|
98
98
|
clusterData: ccc.BytesLike,
|
|
99
99
|
scriptInfoHash: ccc.HexLike = DEFAULT_COBUILD_INFO_HASH,
|
|
100
|
-
):
|
|
100
|
+
): ccc.EncodableType<typeof Action> {
|
|
101
101
|
if (!clusterOutput.type) {
|
|
102
102
|
throw new Error("Cluster cell must have a type script");
|
|
103
103
|
}
|
|
@@ -125,7 +125,7 @@ export function assembleTransferClusterAction(
|
|
|
125
125
|
clusterInput: ccc.CellOutputLike,
|
|
126
126
|
clusterOutput: ccc.CellOutputLike,
|
|
127
127
|
scriptInfoHash: ccc.HexLike = DEFAULT_COBUILD_INFO_HASH,
|
|
128
|
-
):
|
|
128
|
+
): ccc.EncodableType<typeof Action> {
|
|
129
129
|
if (!clusterInput.type || !clusterOutput.type) {
|
|
130
130
|
throw new Error("Cluster cell must have a type script");
|
|
131
131
|
}
|
|
@@ -155,7 +155,7 @@ export function assembleTransferClusterAction(
|
|
|
155
155
|
export async function prepareSporeTransaction(
|
|
156
156
|
signer: ccc.Signer,
|
|
157
157
|
txLike: ccc.TransactionLike,
|
|
158
|
-
actions:
|
|
158
|
+
actions: ccc.EncodableType<typeof ActionVec>,
|
|
159
159
|
): Promise<ccc.Transaction> {
|
|
160
160
|
let tx = ccc.Transaction.from(txLike);
|
|
161
161
|
|
|
@@ -171,7 +171,7 @@ export async function prepareSporeTransaction(
|
|
|
171
171
|
|
|
172
172
|
export function unpackCommonCobuildProof(
|
|
173
173
|
data: ccc.HexLike,
|
|
174
|
-
):
|
|
174
|
+
): ccc.EncodableType<typeof WitnessLayout> | undefined {
|
|
175
175
|
try {
|
|
176
176
|
return WitnessLayout.decode(ccc.bytesFrom(data));
|
|
177
177
|
} catch {
|
|
@@ -181,7 +181,7 @@ export function unpackCommonCobuildProof(
|
|
|
181
181
|
|
|
182
182
|
export function extractCobuildActionsFromTx(
|
|
183
183
|
tx: ccc.Transaction,
|
|
184
|
-
):
|
|
184
|
+
): ccc.EncodableType<typeof ActionVec> {
|
|
185
185
|
if (tx.witnesses.length === 0) {
|
|
186
186
|
return [];
|
|
187
187
|
}
|
|
@@ -202,7 +202,7 @@ export function extractCobuildActionsFromTx(
|
|
|
202
202
|
|
|
203
203
|
export function injectCobuild(
|
|
204
204
|
tx: ccc.Transaction,
|
|
205
|
-
actions:
|
|
205
|
+
actions: ccc.EncodableType<typeof ActionVec>,
|
|
206
206
|
): void {
|
|
207
207
|
tx.setWitnessAt(
|
|
208
208
|
Math.max(tx.witnesses.length, tx.inputs.length),
|
package/src/codec/cluster.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface ClusterDataV1View {
|
|
|
5
5
|
description: string;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export const ClusterDataV1:
|
|
8
|
+
export const ClusterDataV1: ccc.Codec<ClusterDataV1View> = mol.table({
|
|
9
9
|
name: mol.String,
|
|
10
10
|
description: mol.String,
|
|
11
11
|
});
|
|
@@ -16,7 +16,7 @@ export interface ClusterDataV2View {
|
|
|
16
16
|
mutantId?: ccc.HexLike;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export const ClusterDataV2:
|
|
19
|
+
export const ClusterDataV2: ccc.Codec<ClusterDataV2View> = mol.table({
|
|
20
20
|
name: mol.String,
|
|
21
21
|
description: mol.String,
|
|
22
22
|
mutantId: mol.BytesOpt,
|
package/src/codec/spore.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface SporeDataView {
|
|
|
6
6
|
clusterId?: ccc.HexLike;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export const SporeData:
|
|
9
|
+
export const SporeData: ccc.Codec<SporeDataView> = mol.table({
|
|
10
10
|
contentType: mol.String,
|
|
11
11
|
content: mol.Bytes,
|
|
12
12
|
clusterId: mol.BytesOpt,
|
package/src/spore/advanced.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ccc
|
|
1
|
+
import { ccc } from "@ckb-ccc/core";
|
|
2
2
|
import { assembleTransferClusterAction } from "../advanced.js";
|
|
3
3
|
import { assertCluster } from "../cluster/index.js";
|
|
4
4
|
import { Action, SporeDataView } from "../codec/index.js";
|
|
@@ -9,7 +9,7 @@ export async function prepareCluster(
|
|
|
9
9
|
data: SporeDataView,
|
|
10
10
|
clusterMode?: "lockProxy" | "clusterCell" | "skip",
|
|
11
11
|
scriptInfoHash?: ccc.HexLike,
|
|
12
|
-
): Promise<
|
|
12
|
+
): Promise<ccc.EncodableType<typeof Action> | undefined> {
|
|
13
13
|
// skip if the spore is not belong to a cluster
|
|
14
14
|
if (!data.clusterId || clusterMode === "skip") {
|
|
15
15
|
return;
|