Skip to content

Commit

Permalink
feat(sdk-coin-btc): pass txformat for transfer ordinals
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkaplanbitgo committed Sep 24, 2024
1 parent b83f6f1 commit 6827315
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 6827315

Please sign in to comment.