Skip to content

Commit

Permalink
Merge pull request #4937 from BitGo/BTC-1504-pass-through-txformat
Browse files Browse the repository at this point in the history
feat(sdk-coin-btc): pass txformat for transfer ordinals
  • Loading branch information
davidkaplanbitgo authored Sep 24, 2024
2 parents a87b33c + 6827315 commit 92acb70
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions modules/sdk-coin-btc/src/inscriptionBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export class InscriptionBuilder implements IInscriptionBuilder {
signer,
cosigner,
inscriptionConstraints,
txFormat,
}: {
signer: utxolib.bitgo.KeyName;
cosigner: utxolib.bitgo.KeyName;
Expand All @@ -62,6 +63,7 @@ export class InscriptionBuilder implements IInscriptionBuilder {
minInscriptionOutput?: bigint;
maxInscriptionOutput?: bigint;
};
txFormat?: 'psbt' | 'legacy';
},
rootWalletKeys: RootWalletKeys,
outputs: InscriptionOutputs,
Expand Down Expand Up @@ -112,7 +114,7 @@ export class InscriptionBuilder implements IInscriptionBuilder {
}
return {
walletId: this.wallet.id(),
txHex: psbt.getUnsignedTx().toHex(),
txHex: txFormat === 'psbt' ? psbt.toHex() : psbt.getUnsignedTx().toHex(),
txInfo: { unspents: allUnspents },
feeInfo: { fee: Number(outputLayout.layout.feeOutput), feeString: outputLayout.layout.feeOutput.toString() },
};
Expand All @@ -139,6 +141,7 @@ export class InscriptionBuilder implements IInscriptionBuilder {
cosigner = 'bitgo',
inscriptionConstraints = DefaultInscriptionConstraints,
changeAddressType = 'p2wsh',
txFormat = 'psbt',
}: {
signer?: utxolib.bitgo.KeyName;
cosigner?: utxolib.bitgo.KeyName;
Expand All @@ -148,6 +151,7 @@ export class InscriptionBuilder implements IInscriptionBuilder {
maxInscriptionOutput?: bigint;
};
changeAddressType?: utxolib.bitgo.outputScripts.ScriptType2Of3;
txFormat?: 'psbt' | 'legacy';
}
): Promise<PrebuildTransactionResult> {
assert(isSatPoint(satPoint));
Expand All @@ -174,7 +178,7 @@ export class InscriptionBuilder implements IInscriptionBuilder {
return await this.prepareTransferWithExtraInputs(
satPoint,
feeRateSatKB,
{ signer, cosigner, inscriptionConstraints },
{ signer, cosigner, inscriptionConstraints, txFormat },
rootWalletKeys,
outputs,
unspents,
Expand Down

0 comments on commit 92acb70

Please sign in to comment.