@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,153 +1,99 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { molecule } from "@ckb-lumos/codec";
|
|
1
|
+
import { mol } from "@ckb-ccc/core";
|
|
3
2
|
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
{
|
|
8
|
-
Script: blockchain.Script,
|
|
9
|
-
},
|
|
10
|
-
["Script"],
|
|
11
|
-
);
|
|
3
|
+
export const Address = mol.union({
|
|
4
|
+
Script: mol.Script,
|
|
5
|
+
});
|
|
12
6
|
|
|
13
7
|
/**
|
|
14
8
|
* Spore
|
|
15
9
|
*/
|
|
16
|
-
export const CreateSpore =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
["sporeId", "from", "to"],
|
|
31
|
-
);
|
|
32
|
-
export const MeltSpore = molecule.table(
|
|
33
|
-
{
|
|
34
|
-
sporeId: Hash,
|
|
35
|
-
from: Address,
|
|
36
|
-
},
|
|
37
|
-
["sporeId", "from"],
|
|
38
|
-
);
|
|
10
|
+
export const CreateSpore = mol.table({
|
|
11
|
+
sporeId: mol.Hash,
|
|
12
|
+
to: Address,
|
|
13
|
+
dataHash: mol.Hash,
|
|
14
|
+
});
|
|
15
|
+
export const TransferSpore = mol.table({
|
|
16
|
+
sporeId: mol.Hash,
|
|
17
|
+
from: Address,
|
|
18
|
+
to: Address,
|
|
19
|
+
});
|
|
20
|
+
export const MeltSpore = mol.table({
|
|
21
|
+
sporeId: mol.Hash,
|
|
22
|
+
from: Address,
|
|
23
|
+
});
|
|
39
24
|
|
|
40
25
|
/**
|
|
41
26
|
* Cluster
|
|
42
27
|
*/
|
|
43
|
-
export const CreateCluster =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
clusterId: Hash,
|
|
54
|
-
from: Address,
|
|
55
|
-
to: Address,
|
|
56
|
-
},
|
|
57
|
-
["clusterId", "from", "to"],
|
|
58
|
-
);
|
|
28
|
+
export const CreateCluster = mol.table({
|
|
29
|
+
clusterId: mol.Hash,
|
|
30
|
+
to: Address,
|
|
31
|
+
dataHash: mol.Hash,
|
|
32
|
+
});
|
|
33
|
+
export const TransferCluster = mol.table({
|
|
34
|
+
clusterId: mol.Hash,
|
|
35
|
+
from: Address,
|
|
36
|
+
to: Address,
|
|
37
|
+
});
|
|
59
38
|
|
|
60
39
|
/**
|
|
61
40
|
* ClusterProxy
|
|
62
41
|
*/
|
|
63
|
-
export const CreateClusterProxy =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
);
|
|
80
|
-
export const MeltClusterProxy = molecule.table(
|
|
81
|
-
{
|
|
82
|
-
clusterId: Hash,
|
|
83
|
-
clusterProxyId: Hash,
|
|
84
|
-
from: Address,
|
|
85
|
-
},
|
|
86
|
-
["clusterId", "clusterProxyId", "from"],
|
|
87
|
-
);
|
|
42
|
+
export const CreateClusterProxy = mol.table({
|
|
43
|
+
clusterId: mol.Hash,
|
|
44
|
+
clusterProxyId: mol.Hash,
|
|
45
|
+
to: Address,
|
|
46
|
+
});
|
|
47
|
+
export const TransferClusterProxy = mol.table({
|
|
48
|
+
clusterId: mol.Hash,
|
|
49
|
+
clusterProxyId: mol.Hash,
|
|
50
|
+
from: Address,
|
|
51
|
+
to: Address,
|
|
52
|
+
});
|
|
53
|
+
export const MeltClusterProxy = mol.table({
|
|
54
|
+
clusterId: mol.Hash,
|
|
55
|
+
clusterProxyId: mol.Hash,
|
|
56
|
+
from: Address,
|
|
57
|
+
});
|
|
88
58
|
|
|
89
59
|
/**
|
|
90
60
|
* ClusterAgent
|
|
91
61
|
*/
|
|
92
|
-
export const CreateClusterAgent =
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
["clusterId", "from", "to"],
|
|
107
|
-
);
|
|
108
|
-
export const MeltClusterAgent = molecule.table(
|
|
109
|
-
{
|
|
110
|
-
clusterId: Hash,
|
|
111
|
-
from: Address,
|
|
112
|
-
},
|
|
113
|
-
["clusterId", "from"],
|
|
114
|
-
);
|
|
62
|
+
export const CreateClusterAgent = mol.table({
|
|
63
|
+
clusterId: mol.Hash,
|
|
64
|
+
clusterProxyId: mol.Hash,
|
|
65
|
+
to: Address,
|
|
66
|
+
});
|
|
67
|
+
export const TransferClusterAgent = mol.table({
|
|
68
|
+
clusterId: mol.Hash,
|
|
69
|
+
from: Address,
|
|
70
|
+
to: Address,
|
|
71
|
+
});
|
|
72
|
+
export const MeltClusterAgent = mol.table({
|
|
73
|
+
clusterId: mol.Hash,
|
|
74
|
+
from: Address,
|
|
75
|
+
});
|
|
115
76
|
|
|
116
77
|
/**
|
|
117
78
|
* Spore ScriptInfo Actions
|
|
118
79
|
*/
|
|
119
|
-
export const SporeAction =
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
MeltSpore,
|
|
80
|
+
export const SporeAction = mol.union({
|
|
81
|
+
// Spore
|
|
82
|
+
CreateSpore,
|
|
83
|
+
TransferSpore,
|
|
84
|
+
MeltSpore,
|
|
125
85
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
86
|
+
// Cluster
|
|
87
|
+
CreateCluster,
|
|
88
|
+
TransferCluster,
|
|
129
89
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
90
|
+
// ClusterProxy
|
|
91
|
+
CreateClusterProxy,
|
|
92
|
+
TransferClusterProxy,
|
|
93
|
+
MeltClusterProxy,
|
|
134
94
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
[
|
|
141
|
-
"CreateSpore",
|
|
142
|
-
"TransferSpore",
|
|
143
|
-
"MeltSpore",
|
|
144
|
-
"CreateCluster",
|
|
145
|
-
"TransferCluster",
|
|
146
|
-
"CreateClusterProxy",
|
|
147
|
-
"TransferClusterProxy",
|
|
148
|
-
"MeltClusterProxy",
|
|
149
|
-
"CreateClusterAgent",
|
|
150
|
-
"TransferClusterAgent",
|
|
151
|
-
"MeltClusterAgent",
|
|
152
|
-
],
|
|
153
|
-
);
|
|
95
|
+
// ClusterAgent
|
|
96
|
+
CreateClusterAgent,
|
|
97
|
+
TransferClusterAgent,
|
|
98
|
+
MeltClusterAgent,
|
|
99
|
+
});
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { molecule } from "@ckb-lumos/codec";
|
|
1
|
+
import { mol } from "@ckb-ccc/core";
|
|
3
2
|
import { Message } from "./buildingPacket.js";
|
|
4
3
|
|
|
5
|
-
export const SighashAll =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
{
|
|
14
|
-
seal: blockchain.Bytes,
|
|
15
|
-
},
|
|
16
|
-
["seal"],
|
|
17
|
-
);
|
|
4
|
+
export const SighashAll = mol.table({
|
|
5
|
+
seal: mol.Bytes,
|
|
6
|
+
message: Message,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const SighashAllOnly = mol.table({
|
|
10
|
+
seal: mol.Bytes,
|
|
11
|
+
});
|
|
18
12
|
|
|
19
13
|
/**
|
|
20
14
|
* Otx related are not implemented yet, so just placeholders.
|
|
21
15
|
*/
|
|
22
|
-
export const Otx =
|
|
23
|
-
export const OtxStart =
|
|
16
|
+
export const Otx = mol.table({});
|
|
17
|
+
export const OtxStart = mol.table({});
|
|
24
18
|
|
|
25
19
|
export const WitnessLayoutFieldTags = {
|
|
26
20
|
SighashAll: 4278190081,
|
|
@@ -29,7 +23,7 @@ export const WitnessLayoutFieldTags = {
|
|
|
29
23
|
OtxStart: 4278190084,
|
|
30
24
|
} as const;
|
|
31
25
|
|
|
32
|
-
export const WitnessLayout =
|
|
26
|
+
export const WitnessLayout = mol.union(
|
|
33
27
|
{
|
|
34
28
|
SighashAll,
|
|
35
29
|
SighashAllOnly,
|
package/src/codec/spore.ts
CHANGED
|
@@ -1,36 +1,27 @@
|
|
|
1
|
-
import { ccc } from "@ckb-ccc/core";
|
|
2
|
-
import { blockchain } from "@ckb-lumos/base";
|
|
3
|
-
import { molecule } from "@ckb-lumos/codec";
|
|
4
|
-
import { RawString } from "./base.js";
|
|
1
|
+
import { ccc, mol } from "@ckb-ccc/core";
|
|
5
2
|
|
|
6
|
-
export
|
|
7
|
-
{
|
|
8
|
-
contentType: RawString,
|
|
9
|
-
content: blockchain.Bytes,
|
|
10
|
-
clusterId: blockchain.BytesOpt,
|
|
11
|
-
},
|
|
12
|
-
["contentType", "content", "clusterId"],
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
export interface SporeData {
|
|
3
|
+
export interface SporeDataView {
|
|
16
4
|
contentType: string;
|
|
17
5
|
content: ccc.BytesLike;
|
|
18
6
|
clusterId?: ccc.HexLike;
|
|
19
7
|
}
|
|
20
8
|
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
9
|
+
export const SporeData: mol.Codec<SporeDataView> = mol.table({
|
|
10
|
+
contentType: mol.String,
|
|
11
|
+
content: mol.Bytes,
|
|
12
|
+
clusterId: mol.BytesOpt,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export function packRawSporeData(packable: SporeDataView): Uint8Array {
|
|
16
|
+
return ccc.bytesFrom(
|
|
17
|
+
SporeData.encode({
|
|
18
|
+
contentType: packable.contentType,
|
|
19
|
+
content: packable.content,
|
|
20
|
+
clusterId: packable.clusterId,
|
|
21
|
+
}),
|
|
22
|
+
);
|
|
27
23
|
}
|
|
28
24
|
|
|
29
|
-
export function unpackToRawSporeData(unpackable: ccc.BytesLike):
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
contentType: unpacked.contentType,
|
|
33
|
-
content: unpacked.content,
|
|
34
|
-
clusterId: ccc.apply(ccc.hexFrom, unpacked.clusterId),
|
|
35
|
-
};
|
|
25
|
+
export function unpackToRawSporeData(unpackable: ccc.BytesLike): SporeDataView {
|
|
26
|
+
return SporeData.decode(unpackable);
|
|
36
27
|
}
|
package/src/spore/advanced.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { ccc } from "@ckb-ccc/core";
|
|
2
|
-
import { UnpackResult } from "@ckb-lumos/codec";
|
|
1
|
+
import { ccc, mol } from "@ckb-ccc/core";
|
|
3
2
|
import { assembleTransferClusterAction } from "../advanced.js";
|
|
4
3
|
import { assertCluster } from "../cluster/index.js";
|
|
5
|
-
import { Action,
|
|
4
|
+
import { Action, SporeDataView } from "../codec/index.js";
|
|
6
5
|
import { searchOneCellBySigner } from "../helper/index.js";
|
|
7
6
|
|
|
8
7
|
export async function prepareCluster(
|
|
9
8
|
signer: ccc.Signer,
|
|
10
9
|
tx: ccc.Transaction,
|
|
11
|
-
data:
|
|
10
|
+
data: SporeDataView,
|
|
12
11
|
clusterMode?: "lockProxy" | "clusterCell" | "skip",
|
|
13
12
|
scriptInfoHash?: ccc.HexLike,
|
|
14
|
-
): Promise<
|
|
13
|
+
): Promise<mol.EncodableType<typeof Action> | undefined> {
|
|
15
14
|
// skip if the spore is not belong to a cluster
|
|
16
15
|
if (!data.clusterId || clusterMode === "skip") {
|
|
17
16
|
return;
|
package/src/spore/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
assembleTransferSporeAction,
|
|
6
6
|
prepareSporeTransaction,
|
|
7
7
|
} from "../advanced.js";
|
|
8
|
-
import { SporeData, packRawSporeData } from "../codec/index.js";
|
|
8
|
+
import { SporeData, SporeDataView, packRawSporeData } from "../codec/index.js";
|
|
9
9
|
import {
|
|
10
10
|
findSingletonCellByArgs,
|
|
11
11
|
injectOneCapacityCell,
|
|
@@ -73,7 +73,7 @@ export async function assertSpore(
|
|
|
73
73
|
*/
|
|
74
74
|
export async function createSpore(params: {
|
|
75
75
|
signer: ccc.Signer;
|
|
76
|
-
data:
|
|
76
|
+
data: SporeDataView;
|
|
77
77
|
to?: ccc.ScriptLike;
|
|
78
78
|
clusterMode?: "lockProxy" | "clusterCell" | "skip";
|
|
79
79
|
tx?: ccc.TransactionLike;
|
|
@@ -234,3 +234,59 @@ export async function meltSpore(params: {
|
|
|
234
234
|
tx: await prepareSporeTransaction(signer, tx, actions),
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Search on-chain spores under the signer's control, if cluster provided, filter spores belonging to this cluster
|
|
240
|
+
*
|
|
241
|
+
* @param signer the owner of spores
|
|
242
|
+
* @param order the order in creation time of spores
|
|
243
|
+
* @param clusterId the cluster that spores belong to
|
|
244
|
+
* @param scriptInfos the deployed script infos of spores
|
|
245
|
+
* @returns speific spore cells
|
|
246
|
+
*/
|
|
247
|
+
export async function* findSporesBySigner(params: {
|
|
248
|
+
signer: ccc.Signer;
|
|
249
|
+
order?: "asc" | "desc";
|
|
250
|
+
clusterId?: ccc.HexLike;
|
|
251
|
+
scriptInfos?: SporeScriptInfoLike[];
|
|
252
|
+
}): AsyncGenerator<{
|
|
253
|
+
spore: ccc.Cell;
|
|
254
|
+
sporeData: SporeDataView;
|
|
255
|
+
}> {
|
|
256
|
+
const { signer, clusterId, scriptInfos, order } = params;
|
|
257
|
+
for (const scriptInfo of scriptInfos ??
|
|
258
|
+
Object.values(getSporeScriptInfos(signer.client))) {
|
|
259
|
+
if (!scriptInfo) {
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
for await (const spore of signer.findCells(
|
|
263
|
+
{
|
|
264
|
+
script: {
|
|
265
|
+
...scriptInfo,
|
|
266
|
+
args: [],
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
true,
|
|
270
|
+
order,
|
|
271
|
+
10,
|
|
272
|
+
)) {
|
|
273
|
+
try {
|
|
274
|
+
const sporeData = SporeData.decode(spore.outputData);
|
|
275
|
+
if (!clusterId) {
|
|
276
|
+
yield {
|
|
277
|
+
spore,
|
|
278
|
+
sporeData,
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
if (sporeData.clusterId === clusterId) {
|
|
282
|
+
return {
|
|
283
|
+
spore,
|
|
284
|
+
sporeData,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
} catch (e: unknown) {
|
|
288
|
+
throw new Error(`Spore data decode failed: ${(e as Error).toString()}`);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
package/dist/codec/base.d.ts
DELETED
package/dist/codec/base.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/codec/base.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,SAAS,gEAGpB,CAAC"}
|
package/dist/codec/base.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ccc } from "@ckb-ccc/core";
|
|
2
|
-
import { molecule } from "@ckb-lumos/codec";
|
|
3
|
-
/**
|
|
4
|
-
* The codec for packing/unpacking UTF-8 raw strings.
|
|
5
|
-
* Should be packed like so: String.pack('something')
|
|
6
|
-
*/
|
|
7
|
-
export const RawString = molecule.byteVecOf({
|
|
8
|
-
pack: (packable) => ccc.bytesFrom(packable, "utf8"),
|
|
9
|
-
unpack: (unpackable) => ccc.bytesTo(unpackable, "utf8"),
|
|
10
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/codec/base.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,SAAS,gEAGpB,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RawString = void 0;
|
|
4
|
-
const core_1 = require("@ckb-ccc/core");
|
|
5
|
-
const codec_1 = require("@ckb-lumos/codec");
|
|
6
|
-
/**
|
|
7
|
-
* The codec for packing/unpacking UTF-8 raw strings.
|
|
8
|
-
* Should be packed like so: String.pack('something')
|
|
9
|
-
*/
|
|
10
|
-
exports.RawString = codec_1.molecule.byteVecOf({
|
|
11
|
-
pack: (packable) => core_1.ccc.bytesFrom(packable, "utf8"),
|
|
12
|
-
unpack: (unpackable) => core_1.ccc.bytesTo(unpackable, "utf8"),
|
|
13
|
-
});
|
package/src/codec/base.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ccc } from "@ckb-ccc/core";
|
|
2
|
-
import { molecule } from "@ckb-lumos/codec";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The codec for packing/unpacking UTF-8 raw strings.
|
|
6
|
-
* Should be packed like so: String.pack('something')
|
|
7
|
-
*/
|
|
8
|
-
export const RawString = molecule.byteVecOf({
|
|
9
|
-
pack: (packable: string) => ccc.bytesFrom(packable, "utf8"),
|
|
10
|
-
unpack: (unpackable: ccc.BytesLike) => ccc.bytesTo(unpackable, "utf8"),
|
|
11
|
-
});
|