@ckbfs/api 2.0.2 → 2.0.3

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.
@@ -2,6 +2,10 @@ import {
2
2
  getFileContentFromChainByIdentifierV3,
3
3
  saveFileFromChainByIdentifierV3,
4
4
  ProtocolVersion,
5
+ CKBFSData,
6
+ getCKBFSScriptConfig,
7
+ NetworkType,
8
+ resolveCKBFSCell,
5
9
  } from '../src/index';
6
10
  import { ClientPublicTestnet } from '@ckb-ccc/core';
7
11
 
@@ -14,7 +18,7 @@ const client = new ClientPublicTestnet(); // Use testnet
14
18
  async function retrieveFileByTypeIdV3Example() {
15
19
  try {
16
20
  // Example TypeID (replace with actual TypeID from a v3 published file)
17
- const typeId = "0xc387111856be837b1f358d49a9d7e4461dc18244c2b7b59f9012617b1c09d7be";
21
+ const typeId = "0x32d5f0b09f85a64143e91847b6167d8e952ea3026db92068cada45f4478dd814";
18
22
 
19
23
  console.log(`Retrieving CKBFS v3 file by TypeID: ${typeId}`);
20
24
 
@@ -106,7 +110,7 @@ async function retrieveAndSaveFileV3Example() {
106
110
  async function retrieveFileByURIV3Example() {
107
111
  try {
108
112
  // Example CKBFS URI (replace with actual URI)
109
- const ckbfsUri = "ckbfs://c387111856be837b1f358d49a9d7e4461dc18244c2b7b59f9012617b1c09d7be";
113
+ const ckbfsUri = "ckbfs://d52d8536d3498bd68fa1e235f7e090c2d047154e22fcea5cfa54ccb58c236eb3";
110
114
 
111
115
  console.log(`Retrieving CKBFS v3 file by URI: ${ckbfsUri}`);
112
116
 
@@ -145,7 +149,7 @@ async function retrieveFileByURIV3Example() {
145
149
  async function retrieveFileByOutPointV3Example() {
146
150
  try {
147
151
  // Example OutPoint URI (replace with actual transaction hash and index)
148
- const outPointUri = "ckbfs://1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdefi0";
152
+ const outPointUri = "ckbfs://1cc22be7489f64bda7cbc3a9227a94640394dc99f98181b1c3b1243d24897972i0";
149
153
 
150
154
  console.log(`Retrieving CKBFS v3 file by OutPoint: ${outPointUri}`);
151
155
 
@@ -169,6 +173,7 @@ async function retrieveFileByOutPointV3Example() {
169
173
  console.log(`Content type: ${fileData.contentType}`);
170
174
  console.log(`Size: ${fileData.size} bytes`);
171
175
  console.log(`Checksum: ${fileData.checksum}`);
176
+ console.log(`Content: ${fileData.content}`);
172
177
 
173
178
  return fileData;
174
179
  } catch (error) {
@@ -202,10 +207,10 @@ async function main() {
202
207
  console.log('');
203
208
 
204
209
  // Uncomment to test different retrieval methods:
205
- await retrieveFileByTypeIdV3Example();
210
+ //await retrieveFileByTypeIdV3Example();
206
211
  // await retrieveAndSaveFileV3Example();
207
212
  await retrieveFileByURIV3Example();
208
- // await retrieveFileByOutPointV3Example();
213
+ //await retrieveFileByOutPointV3Example();
209
214
 
210
215
  console.log('Retrieval example structure completed successfully!');
211
216
  console.log('Update the identifiers and uncomment methods to test.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckbfs/api",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "SDK for CKBFS protocol on CKB",
5
5
  "license": "MIT",
6
6
  "author": "Code Monad<code@lab-11.org>",
package/src/index.ts CHANGED
@@ -67,6 +67,7 @@ import {
67
67
  getFileContentFromChainV3,
68
68
  getFileContentFromChainByIdentifierV3,
69
69
  saveFileFromChainByIdentifierV3,
70
+ resolveCKBFSCell
70
71
  } from "./utils/file";
71
72
  import {
72
73
  createCKBFSWitness,
@@ -1049,6 +1050,7 @@ export {
1049
1050
  createChunkedCKBFSV3Witnesses,
1050
1051
  extractCKBFSV3WitnessContent,
1051
1052
  isCKBFSV3Witness,
1053
+ resolveCKBFSCell,
1052
1054
  CKBFSV3WitnessOptions,
1053
1055
 
1054
1056
  // Molecule definitions
package/src/utils/file.ts CHANGED
@@ -510,7 +510,7 @@ export function parseIdentifier(identifier: string): ParsedIdentifier {
510
510
  * @param options Optional configuration for network, version, and useTypeID
511
511
  * @returns Promise resolving to the found cell and transaction info, or null if not found
512
512
  */
513
- async function resolveCKBFSCell(
513
+ export async function resolveCKBFSCell(
514
514
  client: any,
515
515
  identifier: string,
516
516
  options: {