Skip to content

Commit

Permalink
feat(sdk): enable RBF
Browse files Browse the repository at this point in the history
  • Loading branch information
kranthicodes committed Jul 14, 2023
1 parent ced3756 commit feeb52d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/sdk/src/inscription/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export type PublishCollectionOptions = {
export type CollectionInscription = {
iid: string;
lim: number;
sri: string;
sri?: string;
};

export type MintFromCollectionOptions = {
Expand Down
12 changes: 8 additions & 4 deletions packages/sdk/src/inscription/instant-buy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ export async function generateBuyerPsbt({
const input: any = {
hash: dummyUtxo.txid,
index: dummyUtxo.n,
nonWitnessUtxo: rawTx.toBuffer()
nonWitnessUtxo: rawTx.toBuffer(),
sequence: 0xfffffffd // Needs to be at least 2 below max int value to be RBF
};

const p2shInputRedeemScript: any = {};
Expand Down Expand Up @@ -262,7 +263,8 @@ export async function generateBuyerPsbt({
const input: any = {
hash: utxo.txid,
index: utxo.n,
nonWitnessUtxo: rawTx.toBuffer()
nonWitnessUtxo: rawTx.toBuffer(),
sequence: 0xfffffffd // Needs to be at least 2 below max int value to be RBF
};

if (pubKeyType === "taproot") {
Expand Down Expand Up @@ -372,7 +374,8 @@ export async function generateDummyUtxos({
const input: any = {
hash: utxo.txid,
index: utxo.n,
nonWitnessUtxo: rawTx.toBuffer()
nonWitnessUtxo: rawTx.toBuffer(),
sequence: 0xfffffffd, // Needs to be at least 2 below max int value to be RBF
};

if (pubKeyType === "taproot") {
Expand Down Expand Up @@ -525,7 +528,8 @@ export async function getSellerInputsOutputs({
const data: any = {
hash: ordUtxo.txid,
index: parseInt(ordUtxo.n),
nonWitnessUtxo: rawTx.toBuffer()
nonWitnessUtxo: rawTx.toBuffer(),
sequence: 0xfffffffd // Needs to be at least 2 below max int value to be RBF
};
const postage = ordUtxo.sats;

Expand Down
1 change: 1 addition & 0 deletions packages/sdk/src/transactions/OrdTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export class OrdTransaction {

try {
psbt.addInput({
sequence: 0xfffffffd, // Needs to be at least 2 below max int value to be RBF
hash: this.#suitableUnspent.txid,
index: parseInt(this.#suitableUnspent.n),
tapInternalKey: Buffer.from(this.#xKey, "hex"),
Expand Down

0 comments on commit feeb52d

Please sign in to comment.