@ckbfs/api 2.0.10 → 2.0.12

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.
@@ -222,7 +222,7 @@ async function prepareAppendV3Transaction(options) {
222
222
  const combinedContent = Buffer.concat(contentChunks);
223
223
  const newChecksum = await (0, checksum_1.updateChecksum)(previousChecksum, combinedContent);
224
224
  // Calculate the actual witness indices where our content is placed
225
- const contentStartIndex = from?.witnesses.length || witnessStartIndex || 0;
225
+ const contentStartIndex = witnessStartIndex || from?.witnesses.length || 1;
226
226
  // Create CKBFS v3 witnesses with backlink info
227
227
  const ckbfsWitnesses = (0, witness_1.createChunkedCKBFSV3Witnesses)(contentChunks, {
228
228
  previousTxHash,
@@ -351,11 +351,10 @@ async function createAppendV3Transaction(signer, options) {
351
351
  await preTx.completeInputsByCapacity(signer);
352
352
  }
353
353
  const witnesses = [];
354
- var witnessOffsetIndex = 0;
354
+ var witnessOffsetIndex = 1;
355
355
  // add empty witness for signer if ckbfs's lock is the same as signer's lock
356
356
  if (address.script.hash() === lock.hash()) {
357
357
  witnesses.push("0x");
358
- witnessOffsetIndex = 1;
359
358
  }
360
359
  // add ckbfs witnesses (skip the first witness which is for signing)
361
360
  witnesses.push(...preTx.witnesses.slice(witnessOffsetIndex));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckbfs/api",
3
- "version": "2.0.10",
3
+ "version": "2.0.12",
4
4
  "description": "SDK for CKBFS protocol on CKB",
5
5
  "license": "MIT",
6
6
  "author": "Code Monad<code@lab-11.org>",
@@ -366,7 +366,7 @@ export async function prepareAppendV3Transaction(
366
366
  const newChecksum = await updateChecksum(previousChecksum, combinedContent);
367
367
 
368
368
  // Calculate the actual witness indices where our content is placed
369
- const contentStartIndex = from?.witnesses.length || witnessStartIndex || 0;
369
+ const contentStartIndex = witnessStartIndex || from?.witnesses.length || 1;
370
370
 
371
371
  // Create CKBFS v3 witnesses with backlink info
372
372
  const ckbfsWitnesses = createChunkedCKBFSV3Witnesses(contentChunks, {
@@ -520,11 +520,10 @@ export async function createAppendV3Transaction(
520
520
  }
521
521
 
522
522
  const witnesses: any = [];
523
- var witnessOffsetIndex = 0;
523
+ var witnessOffsetIndex = 1;
524
524
  // add empty witness for signer if ckbfs's lock is the same as signer's lock
525
525
  if (address.script.hash() === lock.hash()) {
526
526
  witnesses.push("0x");
527
- witnessOffsetIndex = 1;
528
527
  }
529
528
  // add ckbfs witnesses (skip the first witness which is for signing)
530
529
  witnesses.push(...preTx.witnesses.slice(witnessOffsetIndex));