@ckb-ccc/spore 0.1.0-alpha.4 → 0.1.0
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 +22 -0
- package/dist/cluster/index.d.ts +17 -2
- package/dist/cluster/index.d.ts.map +1 -1
- package/dist/cluster/index.js +40 -1
- package/dist/cobuild/index.d.ts +10 -11
- package/dist/cobuild/index.d.ts.map +1 -1
- package/dist/cobuild/index.js +17 -17
- package/dist/codec/cluster.d.ts +17 -24
- package/dist/codec/cluster.d.ts.map +1 -1
- package/dist/codec/cluster.js +17 -28
- package/dist/codec/cobuild/buildingPacket.d.ts +258 -455
- package/dist/codec/cobuild/buildingPacket.d.ts.map +1 -1
- package/dist/codec/cobuild/buildingPacket.js +27 -38
- package/dist/codec/cobuild/sporeAction.d.ts +532 -257
- package/dist/codec/cobuild/sporeAction.d.ts.map +1 -1
- package/dist/codec/cobuild/sporeAction.js +45 -59
- package/dist/codec/cobuild/witnessLayout.d.ts +113 -30
- package/dist/codec/cobuild/witnessLayout.d.ts.map +1 -1
- package/dist/codec/cobuild/witnessLayout.js +10 -11
- package/dist/codec/spore.d.ts +5 -10
- package/dist/codec/spore.d.ts.map +1 -1
- package/dist/codec/spore.js +9 -17
- package/dist/spore/advanced.d.ts +3 -4
- package/dist/spore/advanced.d.ts.map +1 -1
- package/dist/spore/index.d.ts +20 -2
- package/dist/spore/index.d.ts.map +1 -1
- package/dist/spore/index.js +44 -1
- package/dist.commonjs/cluster/index.d.ts +17 -2
- package/dist.commonjs/cluster/index.d.ts.map +1 -1
- package/dist.commonjs/cluster/index.js +40 -0
- package/dist.commonjs/cobuild/index.d.ts +10 -11
- package/dist.commonjs/cobuild/index.d.ts.map +1 -1
- package/dist.commonjs/cobuild/index.js +17 -17
- package/dist.commonjs/codec/cluster.d.ts +17 -24
- package/dist.commonjs/codec/cluster.d.ts.map +1 -1
- package/dist.commonjs/codec/cluster.js +17 -28
- package/dist.commonjs/codec/cobuild/buildingPacket.d.ts +258 -455
- package/dist.commonjs/codec/cobuild/buildingPacket.d.ts.map +1 -1
- package/dist.commonjs/codec/cobuild/buildingPacket.js +27 -38
- package/dist.commonjs/codec/cobuild/sporeAction.d.ts +532 -257
- package/dist.commonjs/codec/cobuild/sporeAction.d.ts.map +1 -1
- package/dist.commonjs/codec/cobuild/sporeAction.js +45 -59
- package/dist.commonjs/codec/cobuild/witnessLayout.d.ts +113 -30
- package/dist.commonjs/codec/cobuild/witnessLayout.d.ts.map +1 -1
- package/dist.commonjs/codec/cobuild/witnessLayout.js +10 -11
- package/dist.commonjs/codec/spore.d.ts +5 -10
- package/dist.commonjs/codec/spore.d.ts.map +1 -1
- package/dist.commonjs/codec/spore.js +9 -17
- package/dist.commonjs/spore/advanced.d.ts +3 -4
- package/dist.commonjs/spore/advanced.d.ts.map +1 -1
- package/dist.commonjs/spore/index.d.ts +20 -2
- package/dist.commonjs/spore/index.d.ts.map +1 -1
- package/dist.commonjs/spore/index.js +44 -0
- package/package.json +5 -6
- package/src/cluster/index.ts +59 -2
- package/src/cobuild/index.ts +27 -28
- package/src/codec/cluster.ts +51 -56
- package/src/codec/cobuild/buildingPacket.ts +41 -72
- package/src/codec/cobuild/sporeAction.ts +75 -129
- package/src/codec/cobuild/witnessLayout.ts +12 -18
- package/src/codec/spore.ts +18 -27
- package/src/spore/advanced.ts +4 -5
- package/src/spore/index.ts +58 -2
- package/dist/codec/base.d.ts +0 -6
- package/dist/codec/base.d.ts.map +0 -1
- package/dist/codec/base.js +0 -10
- package/dist.commonjs/codec/base.d.ts +0 -6
- package/dist.commonjs/codec/base.d.ts.map +0 -1
- package/dist.commonjs/codec/base.js +0 -13
- package/src/codec/base.ts +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sporeAction.d.ts","sourceRoot":"","sources":["../../../src/codec/cobuild/sporeAction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sporeAction.d.ts","sourceRoot":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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBtB,CAAC"}
|
|
@@ -1,79 +1,77 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Script: blockchain.Script,
|
|
6
|
-
}, ["Script"]);
|
|
1
|
+
import { mol } from "@ckb-ccc/core";
|
|
2
|
+
export const Address = mol.union({
|
|
3
|
+
Script: mol.Script,
|
|
4
|
+
});
|
|
7
5
|
/**
|
|
8
6
|
* Spore
|
|
9
7
|
*/
|
|
10
|
-
export const CreateSpore =
|
|
11
|
-
sporeId: Hash,
|
|
8
|
+
export const CreateSpore = mol.table({
|
|
9
|
+
sporeId: mol.Hash,
|
|
12
10
|
to: Address,
|
|
13
|
-
dataHash: Hash,
|
|
14
|
-
}
|
|
15
|
-
export const TransferSpore =
|
|
16
|
-
sporeId: Hash,
|
|
11
|
+
dataHash: mol.Hash,
|
|
12
|
+
});
|
|
13
|
+
export const TransferSpore = mol.table({
|
|
14
|
+
sporeId: mol.Hash,
|
|
17
15
|
from: Address,
|
|
18
16
|
to: Address,
|
|
19
|
-
}
|
|
20
|
-
export const MeltSpore =
|
|
21
|
-
sporeId: Hash,
|
|
17
|
+
});
|
|
18
|
+
export const MeltSpore = mol.table({
|
|
19
|
+
sporeId: mol.Hash,
|
|
22
20
|
from: Address,
|
|
23
|
-
}
|
|
21
|
+
});
|
|
24
22
|
/**
|
|
25
23
|
* Cluster
|
|
26
24
|
*/
|
|
27
|
-
export const CreateCluster =
|
|
28
|
-
clusterId: Hash,
|
|
25
|
+
export const CreateCluster = mol.table({
|
|
26
|
+
clusterId: mol.Hash,
|
|
29
27
|
to: Address,
|
|
30
|
-
dataHash: Hash,
|
|
31
|
-
}
|
|
32
|
-
export const TransferCluster =
|
|
33
|
-
clusterId: Hash,
|
|
28
|
+
dataHash: mol.Hash,
|
|
29
|
+
});
|
|
30
|
+
export const TransferCluster = mol.table({
|
|
31
|
+
clusterId: mol.Hash,
|
|
34
32
|
from: Address,
|
|
35
33
|
to: Address,
|
|
36
|
-
}
|
|
34
|
+
});
|
|
37
35
|
/**
|
|
38
36
|
* ClusterProxy
|
|
39
37
|
*/
|
|
40
|
-
export const CreateClusterProxy =
|
|
41
|
-
clusterId: Hash,
|
|
42
|
-
clusterProxyId: Hash,
|
|
38
|
+
export const CreateClusterProxy = mol.table({
|
|
39
|
+
clusterId: mol.Hash,
|
|
40
|
+
clusterProxyId: mol.Hash,
|
|
43
41
|
to: Address,
|
|
44
|
-
}
|
|
45
|
-
export const TransferClusterProxy =
|
|
46
|
-
clusterId: Hash,
|
|
47
|
-
clusterProxyId: Hash,
|
|
42
|
+
});
|
|
43
|
+
export const TransferClusterProxy = mol.table({
|
|
44
|
+
clusterId: mol.Hash,
|
|
45
|
+
clusterProxyId: mol.Hash,
|
|
48
46
|
from: Address,
|
|
49
47
|
to: Address,
|
|
50
|
-
}
|
|
51
|
-
export const MeltClusterProxy =
|
|
52
|
-
clusterId: Hash,
|
|
53
|
-
clusterProxyId: Hash,
|
|
48
|
+
});
|
|
49
|
+
export const MeltClusterProxy = mol.table({
|
|
50
|
+
clusterId: mol.Hash,
|
|
51
|
+
clusterProxyId: mol.Hash,
|
|
54
52
|
from: Address,
|
|
55
|
-
}
|
|
53
|
+
});
|
|
56
54
|
/**
|
|
57
55
|
* ClusterAgent
|
|
58
56
|
*/
|
|
59
|
-
export const CreateClusterAgent =
|
|
60
|
-
clusterId: Hash,
|
|
61
|
-
clusterProxyId: Hash,
|
|
57
|
+
export const CreateClusterAgent = mol.table({
|
|
58
|
+
clusterId: mol.Hash,
|
|
59
|
+
clusterProxyId: mol.Hash,
|
|
62
60
|
to: Address,
|
|
63
|
-
}
|
|
64
|
-
export const TransferClusterAgent =
|
|
65
|
-
clusterId: Hash,
|
|
61
|
+
});
|
|
62
|
+
export const TransferClusterAgent = mol.table({
|
|
63
|
+
clusterId: mol.Hash,
|
|
66
64
|
from: Address,
|
|
67
65
|
to: Address,
|
|
68
|
-
}
|
|
69
|
-
export const MeltClusterAgent =
|
|
70
|
-
clusterId: Hash,
|
|
66
|
+
});
|
|
67
|
+
export const MeltClusterAgent = mol.table({
|
|
68
|
+
clusterId: mol.Hash,
|
|
71
69
|
from: Address,
|
|
72
|
-
}
|
|
70
|
+
});
|
|
73
71
|
/**
|
|
74
72
|
* Spore ScriptInfo Actions
|
|
75
73
|
*/
|
|
76
|
-
export const SporeAction =
|
|
74
|
+
export const SporeAction = mol.union({
|
|
77
75
|
// Spore
|
|
78
76
|
CreateSpore,
|
|
79
77
|
TransferSpore,
|
|
@@ -89,16 +87,4 @@ export const SporeAction = molecule.union({
|
|
|
89
87
|
CreateClusterAgent,
|
|
90
88
|
TransferClusterAgent,
|
|
91
89
|
MeltClusterAgent,
|
|
92
|
-
}
|
|
93
|
-
"CreateSpore",
|
|
94
|
-
"TransferSpore",
|
|
95
|
-
"MeltSpore",
|
|
96
|
-
"CreateCluster",
|
|
97
|
-
"TransferCluster",
|
|
98
|
-
"CreateClusterProxy",
|
|
99
|
-
"TransferClusterProxy",
|
|
100
|
-
"MeltClusterProxy",
|
|
101
|
-
"CreateClusterAgent",
|
|
102
|
-
"TransferClusterAgent",
|
|
103
|
-
"MeltClusterAgent",
|
|
104
|
-
]);
|
|
90
|
+
});
|
|
@@ -1,43 +1,126 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const SighashAll:
|
|
3
|
-
seal:
|
|
4
|
-
message:
|
|
5
|
-
actions:
|
|
6
|
-
scriptInfoHash:
|
|
7
|
-
scriptHash:
|
|
8
|
-
data:
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
1
|
+
import { mol } from "@ckb-ccc/core";
|
|
2
|
+
export declare const SighashAll: mol.Codec<mol.EncodableRecord<{
|
|
3
|
+
seal: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
4
|
+
message: mol.Codec<mol.EncodableRecord<{
|
|
5
|
+
actions: mol.Codec<mol.EncodableRecord<{
|
|
6
|
+
scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
7
|
+
scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
8
|
+
data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
9
|
+
}>[], mol.DecodedRecord<{
|
|
10
|
+
scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
11
|
+
scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
12
|
+
data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
13
|
+
}>[]>;
|
|
14
|
+
}>, mol.DecodedRecord<{
|
|
15
|
+
actions: mol.Codec<mol.EncodableRecord<{
|
|
16
|
+
scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
17
|
+
scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
18
|
+
data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
19
|
+
}>[], mol.DecodedRecord<{
|
|
20
|
+
scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
21
|
+
scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
22
|
+
data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
23
|
+
}>[]>;
|
|
24
|
+
}>>;
|
|
25
|
+
}>, mol.DecodedRecord<{
|
|
26
|
+
seal: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
27
|
+
message: mol.Codec<mol.EncodableRecord<{
|
|
28
|
+
actions: mol.Codec<mol.EncodableRecord<{
|
|
29
|
+
scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
30
|
+
scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
31
|
+
data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
32
|
+
}>[], mol.DecodedRecord<{
|
|
33
|
+
scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
34
|
+
scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
35
|
+
data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
36
|
+
}>[]>;
|
|
37
|
+
}>, mol.DecodedRecord<{
|
|
38
|
+
actions: mol.Codec<mol.EncodableRecord<{
|
|
39
|
+
scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
40
|
+
scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
41
|
+
data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
42
|
+
}>[], mol.DecodedRecord<{
|
|
43
|
+
scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
44
|
+
scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
45
|
+
data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
46
|
+
}>[]>;
|
|
47
|
+
}>>;
|
|
48
|
+
}>>;
|
|
49
|
+
export declare const SighashAllOnly: mol.Codec<mol.EncodableRecord<{
|
|
50
|
+
seal: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
51
|
+
}>, mol.DecodedRecord<{
|
|
52
|
+
seal: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
53
|
+
}>>;
|
|
15
54
|
/**
|
|
16
55
|
* Otx related are not implemented yet, so just placeholders.
|
|
17
56
|
*/
|
|
18
|
-
export declare const Otx:
|
|
19
|
-
export declare const OtxStart:
|
|
57
|
+
export declare const Otx: mol.Codec<mol.EncodableRecord<{}>, mol.DecodedRecord<{}>>;
|
|
58
|
+
export declare const OtxStart: mol.Codec<mol.EncodableRecord<{}>, mol.DecodedRecord<{}>>;
|
|
20
59
|
export declare const WitnessLayoutFieldTags: {
|
|
21
60
|
readonly SighashAll: 4278190081;
|
|
22
61
|
readonly SighashAllOnly: 4278190082;
|
|
23
62
|
readonly Otx: 4278190083;
|
|
24
63
|
readonly OtxStart: 4278190084;
|
|
25
64
|
};
|
|
26
|
-
export declare const WitnessLayout:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
message:
|
|
30
|
-
actions:
|
|
31
|
-
scriptInfoHash:
|
|
32
|
-
scriptHash:
|
|
33
|
-
data:
|
|
34
|
-
}
|
|
35
|
-
}
|
|
65
|
+
export declare const WitnessLayout: mol.Codec<{
|
|
66
|
+
type: "SighashAll";
|
|
67
|
+
value: {} & {
|
|
68
|
+
message: {} & {
|
|
69
|
+
actions: mol.EncodableRecord<{
|
|
70
|
+
scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
71
|
+
scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
72
|
+
data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
73
|
+
}>[];
|
|
74
|
+
};
|
|
75
|
+
seal: import("@ckb-ccc/core").BytesLike;
|
|
76
|
+
};
|
|
77
|
+
} | {
|
|
78
|
+
type: "SighashAllOnly";
|
|
79
|
+
value: {} & {
|
|
80
|
+
seal: import("@ckb-ccc/core").BytesLike;
|
|
81
|
+
};
|
|
82
|
+
} | {
|
|
83
|
+
type: "Otx";
|
|
84
|
+
value: {} & {};
|
|
85
|
+
} | {
|
|
86
|
+
type: "OtxStart";
|
|
87
|
+
value: {} & {};
|
|
88
|
+
}, {
|
|
89
|
+
type: "SighashAll";
|
|
90
|
+
value: mol.DecodedRecord<{
|
|
91
|
+
seal: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
92
|
+
message: mol.Codec<mol.EncodableRecord<{
|
|
93
|
+
actions: mol.Codec<mol.EncodableRecord<{
|
|
94
|
+
scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
95
|
+
scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
96
|
+
data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
97
|
+
}>[], mol.DecodedRecord<{
|
|
98
|
+
scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
99
|
+
scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
100
|
+
data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
101
|
+
}>[]>;
|
|
102
|
+
}>, mol.DecodedRecord<{
|
|
103
|
+
actions: mol.Codec<mol.EncodableRecord<{
|
|
104
|
+
scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
105
|
+
scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
106
|
+
data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
107
|
+
}>[], mol.DecodedRecord<{
|
|
108
|
+
scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
109
|
+
scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
110
|
+
data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
111
|
+
}>[]>;
|
|
112
|
+
}>>;
|
|
36
113
|
}>;
|
|
37
|
-
|
|
38
|
-
|
|
114
|
+
} | {
|
|
115
|
+
type: "SighashAllOnly";
|
|
116
|
+
value: mol.DecodedRecord<{
|
|
117
|
+
seal: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
|
|
39
118
|
}>;
|
|
40
|
-
|
|
41
|
-
|
|
119
|
+
} | {
|
|
120
|
+
type: "Otx";
|
|
121
|
+
value: mol.DecodedRecord<{}>;
|
|
122
|
+
} | {
|
|
123
|
+
type: "OtxStart";
|
|
124
|
+
value: mol.DecodedRecord<{}>;
|
|
42
125
|
}>;
|
|
43
126
|
//# sourceMappingURL=witnessLayout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"witnessLayout.d.ts","sourceRoot":"","sources":["../../../src/codec/cobuild/witnessLayout.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"witnessLayout.d.ts","sourceRoot":"","sources":["../../../src/codec/cobuild/witnessLayout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGrB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;GAEzB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,GAAG,2DAAgB,CAAC;AACjC,eAAO,MAAM,QAAQ,2DAAgB,CAAC;AAEtC,eAAO,MAAM,sBAAsB;;;;;CAKzB,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQzB,CAAC"}
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { molecule } from "@ckb-lumos/codec";
|
|
1
|
+
import { mol } from "@ckb-ccc/core";
|
|
3
2
|
import { Message } from "./buildingPacket.js";
|
|
4
|
-
export const SighashAll =
|
|
5
|
-
seal:
|
|
3
|
+
export const SighashAll = mol.table({
|
|
4
|
+
seal: mol.Bytes,
|
|
6
5
|
message: Message,
|
|
7
|
-
}
|
|
8
|
-
export const SighashAllOnly =
|
|
9
|
-
seal:
|
|
10
|
-
}
|
|
6
|
+
});
|
|
7
|
+
export const SighashAllOnly = mol.table({
|
|
8
|
+
seal: mol.Bytes,
|
|
9
|
+
});
|
|
11
10
|
/**
|
|
12
11
|
* Otx related are not implemented yet, so just placeholders.
|
|
13
12
|
*/
|
|
14
|
-
export const Otx =
|
|
15
|
-
export const OtxStart =
|
|
13
|
+
export const Otx = mol.table({});
|
|
14
|
+
export const OtxStart = mol.table({});
|
|
16
15
|
export const WitnessLayoutFieldTags = {
|
|
17
16
|
SighashAll: 4278190081,
|
|
18
17
|
SighashAllOnly: 4278190082,
|
|
19
18
|
Otx: 4278190083,
|
|
20
19
|
OtxStart: 4278190084,
|
|
21
20
|
};
|
|
22
|
-
export const WitnessLayout =
|
|
21
|
+
export const WitnessLayout = mol.union({
|
|
23
22
|
SighashAll,
|
|
24
23
|
SighashAllOnly,
|
|
25
24
|
Otx,
|
package/dist/codec/spore.d.ts
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import { ccc } from "@ckb-ccc/core";
|
|
2
|
-
|
|
3
|
-
export declare const MolSporeData: molecule.ObjectLayoutCodec<{
|
|
4
|
-
contentType: import("@ckb-lumos/codec/lib/base.js").BytesCodec<string, string>;
|
|
5
|
-
content: import("@ckb-lumos/codec/lib/base.js").BytesCodec<string, import("@ckb-lumos/codec").BytesLike>;
|
|
6
|
-
clusterId: molecule.OptionLayoutCodec<import("@ckb-lumos/codec/lib/base.js").BytesCodec<string, import("@ckb-lumos/codec").BytesLike>>;
|
|
7
|
-
}>;
|
|
8
|
-
export interface SporeData {
|
|
1
|
+
import { ccc, mol } from "@ckb-ccc/core";
|
|
2
|
+
export interface SporeDataView {
|
|
9
3
|
contentType: string;
|
|
10
4
|
content: ccc.BytesLike;
|
|
11
5
|
clusterId?: ccc.HexLike;
|
|
12
6
|
}
|
|
13
|
-
export declare
|
|
14
|
-
export declare function
|
|
7
|
+
export declare const SporeData: mol.Codec<SporeDataView>;
|
|
8
|
+
export declare function packRawSporeData(packable: SporeDataView): Uint8Array;
|
|
9
|
+
export declare function unpackToRawSporeData(unpackable: ccc.BytesLike): SporeDataView;
|
|
15
10
|
//# sourceMappingURL=spore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spore.d.ts","sourceRoot":"","sources":["../../src/codec/spore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"spore.d.ts","sourceRoot":"","sources":["../../src/codec/spore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,GAAG,CAAC,SAAS,CAAC;IACvB,SAAS,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACzB;AAED,eAAO,MAAM,SAAS,EAAE,GAAG,CAAC,KAAK,CAAC,aAAa,CAI7C,CAAC;AAEH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,aAAa,GAAG,UAAU,CAQpE;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,GAAG,CAAC,SAAS,GAAG,aAAa,CAE7E"}
|
package/dist/codec/spore.js
CHANGED
|
@@ -1,24 +1,16 @@
|
|
|
1
|
-
import { ccc } from "@ckb-ccc/core";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
content: blockchain.Bytes,
|
|
8
|
-
clusterId: blockchain.BytesOpt,
|
|
9
|
-
}, ["contentType", "content", "clusterId"]);
|
|
1
|
+
import { ccc, mol } from "@ckb-ccc/core";
|
|
2
|
+
export const SporeData = mol.table({
|
|
3
|
+
contentType: mol.String,
|
|
4
|
+
content: mol.Bytes,
|
|
5
|
+
clusterId: mol.BytesOpt,
|
|
6
|
+
});
|
|
10
7
|
export function packRawSporeData(packable) {
|
|
11
|
-
return
|
|
8
|
+
return ccc.bytesFrom(SporeData.encode({
|
|
12
9
|
contentType: packable.contentType,
|
|
13
10
|
content: packable.content,
|
|
14
11
|
clusterId: packable.clusterId,
|
|
15
|
-
});
|
|
12
|
+
}));
|
|
16
13
|
}
|
|
17
14
|
export function unpackToRawSporeData(unpackable) {
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
contentType: unpacked.contentType,
|
|
21
|
-
content: unpacked.content,
|
|
22
|
-
clusterId: ccc.apply(ccc.hexFrom, unpacked.clusterId),
|
|
23
|
-
};
|
|
15
|
+
return SporeData.decode(unpackable);
|
|
24
16
|
}
|
package/dist/spore/advanced.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ccc } from "@ckb-ccc/core";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare function prepareCluster(signer: ccc.Signer, tx: ccc.Transaction, data: SporeData, clusterMode?: "lockProxy" | "clusterCell" | "skip", scriptInfoHash?: ccc.HexLike): Promise<UnpackResult<typeof Action> | undefined>;
|
|
1
|
+
import { ccc, mol } from "@ckb-ccc/core";
|
|
2
|
+
import { Action, SporeDataView } from "../codec/index.js";
|
|
3
|
+
export declare function prepareCluster(signer: ccc.Signer, tx: ccc.Transaction, data: SporeDataView, clusterMode?: "lockProxy" | "clusterCell" | "skip", scriptInfoHash?: ccc.HexLike): Promise<mol.EncodableType<typeof Action> | undefined>;
|
|
5
4
|
//# sourceMappingURL=advanced.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"advanced.d.ts","sourceRoot":"","sources":["../../src/spore/advanced.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,
|
|
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;AAG1D,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,CA0EvD"}
|
package/dist/spore/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ccc } from "@ckb-ccc/core";
|
|
2
|
-
import {
|
|
2
|
+
import { SporeDataView } from "../codec/index.js";
|
|
3
3
|
import { SporeScriptInfo, SporeScriptInfoLike } from "../predefined/index.js";
|
|
4
4
|
export declare function findSpore(client: ccc.Client, args: ccc.HexLike, scripts?: SporeScriptInfoLike[]): Promise<{
|
|
5
5
|
cell: ccc.Cell;
|
|
@@ -29,7 +29,7 @@ export declare function assertSpore(client: ccc.Client, args: ccc.HexLike, scrip
|
|
|
29
29
|
*/
|
|
30
30
|
export declare function createSpore(params: {
|
|
31
31
|
signer: ccc.Signer;
|
|
32
|
-
data:
|
|
32
|
+
data: SporeDataView;
|
|
33
33
|
to?: ccc.ScriptLike;
|
|
34
34
|
clusterMode?: "lockProxy" | "clusterCell" | "skip";
|
|
35
35
|
tx?: ccc.TransactionLike;
|
|
@@ -77,4 +77,22 @@ export declare function meltSpore(params: {
|
|
|
77
77
|
}): Promise<{
|
|
78
78
|
tx: ccc.Transaction;
|
|
79
79
|
}>;
|
|
80
|
+
/**
|
|
81
|
+
* Search on-chain spores under the signer's control, if cluster provided, filter spores belonging to this cluster
|
|
82
|
+
*
|
|
83
|
+
* @param signer the owner of spores
|
|
84
|
+
* @param order the order in creation time of spores
|
|
85
|
+
* @param clusterId the cluster that spores belong to
|
|
86
|
+
* @param scriptInfos the deployed script infos of spores
|
|
87
|
+
* @returns speific spore cells
|
|
88
|
+
*/
|
|
89
|
+
export declare function findSporesBySigner(params: {
|
|
90
|
+
signer: ccc.Signer;
|
|
91
|
+
order?: "asc" | "desc";
|
|
92
|
+
clusterId?: ccc.HexLike;
|
|
93
|
+
scriptInfos?: SporeScriptInfoLike[];
|
|
94
|
+
}): AsyncGenerator<{
|
|
95
|
+
spore: ccc.Cell;
|
|
96
|
+
sporeData: SporeDataView;
|
|
97
|
+
}>;
|
|
80
98
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/spore/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAOpC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/spore/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAOpC,OAAO,EAAa,aAAa,EAAoB,MAAM,mBAAmB,CAAC;AAK/E,OAAO,EACL,eAAe,EACf,mBAAmB,EAGpB,MAAM,wBAAwB,CAAC;AAGhC,wBAAsB,SAAS,CAC7B,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,IAAI,EAAE,GAAG,CAAC,OAAO,EACjB,OAAO,CAAC,EAAE,mBAAmB,EAAE,GAC9B,OAAO,CACN;IACE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC;IACf,UAAU,EAAE,eAAe,CAAC;CAC7B,GACD,SAAS,CACZ,CAMA;AAED,wBAAsB,WAAW,CAC/B,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,IAAI,EAAE,GAAG,CAAC,OAAO,EACjB,OAAO,CAAC,EAAE,mBAAmB,EAAE,GAC9B,OAAO,CAAC;IACT,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC;IACf,UAAU,EAAE,eAAe,CAAC;CAC7B,CAAC,CAQD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,WAAW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G,CAAC,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACrC,GAAG,cAAc,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;CAC1B,CAAC,CAqCD"}
|
package/dist/spore/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ccc } from "@ckb-ccc/core";
|
|
2
2
|
import { assembleCreateSporeAction, assembleMeltSporeAction, assembleTransferSporeAction, prepareSporeTransaction, } from "../advanced.js";
|
|
3
|
-
import { packRawSporeData } from "../codec/index.js";
|
|
3
|
+
import { SporeData, packRawSporeData } from "../codec/index.js";
|
|
4
4
|
import { findSingletonCellByArgs, injectOneCapacityCell, } from "../helper/index.js";
|
|
5
5
|
import { getSporeScriptInfo, getSporeScriptInfos, } from "../predefined/index.js";
|
|
6
6
|
import { prepareCluster } from "./advanced.js";
|
|
@@ -133,3 +133,46 @@ export async function meltSpore(params) {
|
|
|
133
133
|
tx: await prepareSporeTransaction(signer, tx, actions),
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Search on-chain spores under the signer's control, if cluster provided, filter spores belonging to this cluster
|
|
138
|
+
*
|
|
139
|
+
* @param signer the owner of spores
|
|
140
|
+
* @param order the order in creation time of spores
|
|
141
|
+
* @param clusterId the cluster that spores belong to
|
|
142
|
+
* @param scriptInfos the deployed script infos of spores
|
|
143
|
+
* @returns speific spore cells
|
|
144
|
+
*/
|
|
145
|
+
export async function* findSporesBySigner(params) {
|
|
146
|
+
const { signer, clusterId, scriptInfos, order } = params;
|
|
147
|
+
for (const scriptInfo of scriptInfos ??
|
|
148
|
+
Object.values(getSporeScriptInfos(signer.client))) {
|
|
149
|
+
if (!scriptInfo) {
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
for await (const spore of signer.findCells({
|
|
153
|
+
script: {
|
|
154
|
+
...scriptInfo,
|
|
155
|
+
args: [],
|
|
156
|
+
},
|
|
157
|
+
}, true, order, 10)) {
|
|
158
|
+
try {
|
|
159
|
+
const sporeData = SporeData.decode(spore.outputData);
|
|
160
|
+
if (!clusterId) {
|
|
161
|
+
yield {
|
|
162
|
+
spore,
|
|
163
|
+
sporeData,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
if (sporeData.clusterId === clusterId) {
|
|
167
|
+
return {
|
|
168
|
+
spore,
|
|
169
|
+
sporeData,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
catch (e) {
|
|
174
|
+
throw new Error(`Spore data decode failed: ${e.toString()}`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ccc } from "@ckb-ccc/core";
|
|
2
|
-
import {
|
|
2
|
+
import { ClusterDataView } from "../codec/index.js";
|
|
3
3
|
import { SporeScriptInfo, SporeScriptInfoLike } from "../predefined/index.js";
|
|
4
4
|
export declare function findCluster(client: ccc.Client, args: ccc.HexLike, scripts?: SporeScriptInfoLike[]): Promise<{
|
|
5
5
|
cell: ccc.Cell;
|
|
@@ -24,7 +24,7 @@ export declare function assertCluster(client: ccc.Client, args: ccc.HexLike, scr
|
|
|
24
24
|
*/
|
|
25
25
|
export declare function createSporeCluster(params: {
|
|
26
26
|
signer: ccc.Signer;
|
|
27
|
-
data:
|
|
27
|
+
data: ClusterDataView;
|
|
28
28
|
to?: ccc.ScriptLike;
|
|
29
29
|
tx?: ccc.TransactionLike;
|
|
30
30
|
scriptInfo?: SporeScriptInfoLike;
|
|
@@ -53,4 +53,19 @@ export declare function transferSporeCluster(params: {
|
|
|
53
53
|
}): Promise<{
|
|
54
54
|
tx: ccc.Transaction;
|
|
55
55
|
}>;
|
|
56
|
+
/**
|
|
57
|
+
* Search on-chain clusters under the signer's control
|
|
58
|
+
*
|
|
59
|
+
* @param signer the owner of clusters
|
|
60
|
+
* @param order the order in creation time of clusters
|
|
61
|
+
* @param scriptInfos the deployed script infos of clusters
|
|
62
|
+
*/
|
|
63
|
+
export declare function findSporeClustersBySigner(params: {
|
|
64
|
+
signer: ccc.Signer;
|
|
65
|
+
order?: "asc" | "desc";
|
|
66
|
+
scriptInfos?: SporeScriptInfoLike[];
|
|
67
|
+
}): AsyncGenerator<{
|
|
68
|
+
cluster: ccc.Cell;
|
|
69
|
+
clusterData: ClusterDataView;
|
|
70
|
+
}>;
|
|
56
71
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cluster/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAMpC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cluster/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAMpC,OAAO,EAGL,eAAe,EAEhB,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EACL,eAAe,EACf,mBAAmB,EAGpB,MAAM,wBAAwB,CAAC;AAEhC,wBAAsB,WAAW,CAC/B,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,IAAI,EAAE,GAAG,CAAC,OAAO,EACjB,OAAO,CAAC,EAAE,mBAAmB,EAAE,GAC9B,OAAO,CACN;IACE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC;IACf,UAAU,EAAE,eAAe,CAAC;CAC7B,GACD,SAAS,CACZ,CAMA;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,IAAI,EAAE,GAAG,CAAC,OAAO,EACjB,OAAO,CAAC,EAAE,mBAAmB,EAAE,GAC9B,OAAO,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,6 +4,7 @@ exports.findCluster = findCluster;
|
|
|
4
4
|
exports.assertCluster = assertCluster;
|
|
5
5
|
exports.createSporeCluster = createSporeCluster;
|
|
6
6
|
exports.transferSporeCluster = transferSporeCluster;
|
|
7
|
+
exports.findSporeClustersBySigner = findSporeClustersBySigner;
|
|
7
8
|
const core_1 = require("@ckb-ccc/core");
|
|
8
9
|
const advanced_js_1 = require("../advanced.js");
|
|
9
10
|
const index_js_1 = require("../codec/index.js");
|
|
@@ -100,3 +101,42 @@ async function transferSporeCluster(params) {
|
|
|
100
101
|
tx: await (0, advanced_js_1.prepareSporeTransaction)(signer, tx, actions),
|
|
101
102
|
};
|
|
102
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Search on-chain clusters under the signer's control
|
|
106
|
+
*
|
|
107
|
+
* @param signer the owner of clusters
|
|
108
|
+
* @param order the order in creation time of clusters
|
|
109
|
+
* @param scriptInfos the deployed script infos of clusters
|
|
110
|
+
*/
|
|
111
|
+
async function* findSporeClustersBySigner(params) {
|
|
112
|
+
const { signer, order, scriptInfos } = params;
|
|
113
|
+
for (const scriptInfo of scriptInfos ??
|
|
114
|
+
Object.values((0, index_js_3.getClusterScriptInfos)(signer.client))) {
|
|
115
|
+
if (!scriptInfo) {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
for await (const cluster of signer.findCells({
|
|
119
|
+
script: {
|
|
120
|
+
...scriptInfo,
|
|
121
|
+
args: [],
|
|
122
|
+
},
|
|
123
|
+
}, true, order, 10)) {
|
|
124
|
+
let clusterData;
|
|
125
|
+
try {
|
|
126
|
+
clusterData = index_js_1.ClusterData.decode(cluster.outputData);
|
|
127
|
+
}
|
|
128
|
+
catch (_) {
|
|
129
|
+
try {
|
|
130
|
+
clusterData = index_js_1.ClusterDataV1.decode(cluster.outputData);
|
|
131
|
+
}
|
|
132
|
+
catch (e) {
|
|
133
|
+
throw new Error(`Cluster data decode failed: ${e.toString()}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
yield {
|
|
137
|
+
cluster,
|
|
138
|
+
clusterData,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|