Skip to content

Commit

Permalink
fix(app): multiple inputs witness in demo and book-app (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
RetricSu authored Aug 7, 2024
1 parent 64815c0 commit 30937d4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/book-app/lib/ckb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ export async function buildUnlockCKBTransaction(
cellDeps.concat(txCellDeps),
);

const witnessesArray = new Array(collectedInputs.length).fill("0x");
txSkeleton = txSkeleton.update("witnesses", (witnesses) =>
witnesses.push(...witnessesArray),
);

return txSkeleton;
}

Expand Down Expand Up @@ -112,6 +117,11 @@ export async function buildMintTransaction(
txSkeleton = txSkeleton.update("cellDeps", (cellDeps) =>
cellDeps.concat(lockDep, bindingDep),
);

const witnessesArray = new Array(collectedInputs.length).fill("0x");
txSkeleton = txSkeleton.update("witnesses", (witnesses) =>
witnesses.push(...witnessesArray),
);
return { txSkeleton, mintEvent };
}

Expand Down
9 changes: 9 additions & 0 deletions packages/demo/app/lib/ckb.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ export async function buildUnlockCKBTransaction(
txSkeleton = txSkeleton.update("cellDeps", (cellDeps) =>
cellDeps.concat(txCellDeps),
);
const witnessesArray = new Array(collectedInputs.length).fill("0x");
txSkeleton = txSkeleton.update("witnesses", (witnesses) =>
witnesses.push(...witnessesArray),
);

return txSkeleton;
}
Expand Down Expand Up @@ -120,6 +124,11 @@ export async function buildMintTransaction(
txSkeleton = txSkeleton.update("cellDeps", (cellDeps) =>
cellDeps.concat(lockDep, bindingDep),
);

const witnessesArray = new Array(collectedInputs.length).fill("0x");
txSkeleton = txSkeleton.update("witnesses", (witnesses) =>
witnesses.push(...witnessesArray),
);
return { txSkeleton, mintEvent };
}

Expand Down

0 comments on commit 30937d4

Please sign in to comment.