Skip to content

Commit

Permalink
fix(ccc): use completeInputsByCapacity
Browse files Browse the repository at this point in the history
  • Loading branch information
RetricSu committed Oct 23, 2024
1 parent 74e19c0 commit 423668d
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion examples/simple-transfer/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export async function transfer(
});

// Complete missing parts for transaction
await tx.completeInputsAll(signer);
await tx.completeInputsByCapacity(signer);
await tx.completeFeeBy(signer, 1000);
const txHash = await signer.sendTransaction(tx);
console.log(
Expand Down
2 changes: 1 addition & 1 deletion examples/store-data-on-cell/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export async function buildMessageTx(
});

// Complete missing parts for transaction
await tx.completeInputsAll(signer);
await tx.completeInputsByCapacity(signer);
await tx.completeFeeBy(signer, 1000);
const txHash = await signer.sendTransaction(tx);
alert(`The transaction hash is ${txHash}`);
Expand Down
2 changes: 1 addition & 1 deletion examples/xudt/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export async function issueToken(privKey: string, amount: string) {

// additional 0.001 ckb for tx fee
// Complete missing parts for transaction
await tx.completeInputsAll(signer);
await tx.completeInputsByCapacity(signer);
await tx.completeFeeBy(signer, 1000);
const txHash = await signer.sendTransaction(tx);
console.log(
Expand Down
2 changes: 1 addition & 1 deletion website/docs/dapp/create-token.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Next, to complete our `issueToken` function, we just use the `helpers.Transactio
await tx.addCellDepsOfKnownScripts(signer.client, ccc.KnownScript.XUdt);
// additional 0.001 ckb for tx fee
// Complete missing parts for transaction
await tx.completeInputsAll(signer);
await tx.completeInputsByCapacity(signer);
await tx.completeFeeBy(signer, 1000);

...
Expand Down
2 changes: 1 addition & 1 deletion website/docs/dapp/transfer-ckb.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Next, we need to complete the inputs of the transaction.
//....

// Complete missing parts for transaction
await tx.completeInputsAll(signer);
await tx.completeInputsByCapacity(signer);
await tx.completeFeeBy(signer, 1000);
```

Expand Down
2 changes: 1 addition & 1 deletion website/docs/dapp/write-message.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Next, we ask CCC to complete the transaction for us with transaction fee:

```ts
// Complete missing parts for transaction
await tx.completeInputsAll(signer);
await tx.completeInputsByCapacity(signer);
await tx.completeFeeBy(signer, 1000);
```

Expand Down
4 changes: 2 additions & 2 deletions website/docs/sdk-and-devtool/ccc.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ return;
});

// Complete missing parts for transaction
await tx.completeInputsAll(signer);
await tx.completeInputsByCapacity(signer);
// Change all balance to the first output
await tx.completeFeeChangeToOutput(signer, 0, 1000);
const amount = ccc.fixedPointToString(tx.outputs[0].capacity);
Expand Down Expand Up @@ -1396,7 +1396,7 @@ export default function Transfer() {
ccc.KnownScript.NervosDao,
);

await tx.completeInputsAll(signer);
await tx.completeInputsByCapacity(signer);
await tx.completeFeeChangeToOutput(signer, 0, 1000);

const amount = ccc.fixedPointToString(tx.outputs[0].capacity);
Expand Down

0 comments on commit 423668d

Please sign in to comment.