Skip to content

Commit

Permalink
feat: add "noAssetsApiCache" option in the TxBuilder.payFee() API fro…
Browse files Browse the repository at this point in the history
…m the btc lib
  • Loading branch information
ShookLyngs committed Sep 7, 2024
1 parent ebcefc3 commit e96bca6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/btc/src/transaction/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ export class TxBuilder {
address: string;
publicKey?: string;
changeAddress?: string;
noAssetsApiCache?: boolean;
deductFromOutputs?: boolean;
excludeUtxos?: BaseOutput[];
feeRate?: number;
Expand All @@ -148,7 +149,7 @@ export class TxBuilder {
feeRate: number;
changeIndex: number;
}> {
const { address, publicKey, feeRate, changeAddress, deductFromOutputs, excludeUtxos } = props;
const { address, publicKey, feeRate, changeAddress, noAssetsApiCache, deductFromOutputs, excludeUtxos } = props;
const originalInputs = cloneDeep(this.inputs);
const originalOutputs = cloneDeep(this.outputs);

Expand Down Expand Up @@ -189,6 +190,7 @@ export class TxBuilder {
amount: returnAmount,
fromAddress: address,
fromPublicKey: publicKey,
noAssetsApiCache,
internalCacheKey,
excludeUtxos,
});
Expand All @@ -205,6 +207,7 @@ export class TxBuilder {
targetAmount,
changeAddress,
deductFromOutputs,
noAssetsApiCache,
internalCacheKey,
excludeUtxos,
});
Expand Down Expand Up @@ -239,6 +242,7 @@ export class TxBuilder {
changeAddress?: string;
injectCollected?: boolean;
deductFromOutputs?: boolean;
noAssetsApiCache?: boolean;
internalCacheKey?: string;
excludeUtxos?: BaseOutput[];
}): Promise<{
Expand Down Expand Up @@ -271,7 +275,7 @@ export class TxBuilder {
address: props.address,
targetAmount: _targetAmount,
allowInsufficient: true,
noAssetsApiCache: true,
noAssetsApiCache: props.noAssetsApiCache ?? true,
internalCacheKey: props.internalCacheKey,
minUtxoSatoshi: this.minUtxoSatoshi,
onlyNonRgbppUtxos: this.onlyNonRgbppUtxos,
Expand Down Expand Up @@ -399,12 +403,13 @@ export class TxBuilder {
address: string;
fromAddress: string;
fromPublicKey?: string;
noAssetsApiCache?: boolean;
internalCacheKey?: string;
excludeUtxos?: BaseOutput[];
}): Promise<{
changeIndex: number;
}> {
const { address, fromAddress, fromPublicKey, amount, excludeUtxos, internalCacheKey } = props;
const { address, fromAddress, fromPublicKey, amount, noAssetsApiCache, excludeUtxos, internalCacheKey } = props;

// If any (output.fixed != true) is found in the outputs (search in ASC order),
// return the change value to the first matched output.
Expand Down Expand Up @@ -439,6 +444,7 @@ export class TxBuilder {
changeAddress: address,
injectCollected: true,
deductFromOutputs: false,
noAssetsApiCache,
internalCacheKey,
excludeUtxos,
});
Expand Down

1 comment on commit e96bca6

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New snapshot version of the rgbpp-sdk packages have been released:

Name Version
@rgbpp-sdk/btc 0.0.0-snap-20240907220921
@rgbpp-sdk/ckb 0.0.0-snap-20240907220921
rgbpp 0.0.0-snap-20240907220921
@rgbpp-sdk/service 0.0.0-snap-20240907220921

Please sign in to comment.