mirror of
https://github.com/Brotocol-xyz/bro-sdk.git
synced 2026-01-12 06:44:18 +08:00
fix(XLinkSDK): ask change address for brc20/runes peg-in methods
This commit is contained in:
@@ -94,10 +94,13 @@ export interface BridgeFromBRC20Input {
|
||||
toAddressScriptPubKey?: Uint8Array
|
||||
|
||||
inputInscriptionUTXO: UTXOSpendable
|
||||
swapRoute?: SwapRoute_WithMinimumAmountsToReceive_Public
|
||||
|
||||
networkFeeRate: bigint
|
||||
swapRoute?: SwapRoute_WithMinimumAmountsToReceive_Public
|
||||
reselectSpendableNetworkFeeUTXOs: BridgeFromBRC20Input_reselectSpendableNetworkFeeUTXOs
|
||||
networkFeeChangeAddress: string
|
||||
networkFeeChangeAddressScriptPubKey: Uint8Array
|
||||
|
||||
signPsbt: BridgeFromBRC20Input_signPsbtFn
|
||||
sendTransaction: (tx: {
|
||||
hex: string
|
||||
@@ -641,7 +644,7 @@ async function constructBRC20Transaction(
|
||||
const tx = createTransaction(
|
||||
txOptions.inputs,
|
||||
txOptions.recipients.concat({
|
||||
addressScriptPubKey: info.fromAddressScriptPubKey,
|
||||
addressScriptPubKey: info.networkFeeChangeAddressScriptPubKey,
|
||||
satsAmount: txOptions.changeAmount,
|
||||
}),
|
||||
txOptions.opReturnScripts ?? [],
|
||||
@@ -698,8 +701,12 @@ export type PrepareBRC20TransactionInput = KnownRoute_FromBRC20 & {
|
||||
fromAddress: BridgeFromBRC20Input["fromAddress"]
|
||||
toAddress: BridgeFromBRC20Input["toAddress"]
|
||||
inputInscriptionUTXO: BridgeFromBRC20Input["inputInscriptionUTXO"]
|
||||
|
||||
networkFeeRate: BridgeFromBRC20Input["networkFeeRate"]
|
||||
networkFeeChangeAddress: string
|
||||
networkFeeChangeAddressScriptPubKey: Uint8Array
|
||||
reselectSpendableNetworkFeeUTXOs: BridgeFromBRC20Input["reselectSpendableNetworkFeeUTXOs"]
|
||||
|
||||
pegInAddress: BitcoinAddress
|
||||
orderData: Uint8Array
|
||||
bridgeFeeOutput: null | {
|
||||
@@ -796,7 +803,7 @@ export async function prepareBRC20Transaction(
|
||||
},
|
||||
]),
|
||||
],
|
||||
changeAddressScriptPubKey: info.fromAddressScriptPubKey,
|
||||
changeAddressScriptPubKey: info.networkFeeChangeAddressScriptPubKey,
|
||||
feeRate: info.networkFeeRate,
|
||||
reselectSpendableUTXOs: reselectSpendableUTXOsFactory(
|
||||
info.reselectSpendableNetworkFeeUTXOs,
|
||||
|
||||
@@ -105,10 +105,13 @@ export interface BridgeFromRunesInput {
|
||||
|
||||
amount: SDKNumber
|
||||
inputRuneUTXOs: RunesUTXOSpendable[]
|
||||
swapRoute?: SwapRoute_WithMinimumAmountsToReceive_Public
|
||||
|
||||
networkFeeRate: bigint
|
||||
swapRoute?: SwapRoute_WithMinimumAmountsToReceive_Public
|
||||
networkFeeChangeAddress: string
|
||||
networkFeeChangeAddressScriptPubKey: Uint8Array
|
||||
reselectSpendableNetworkFeeUTXOs: BridgeFromRunesInput_reselectSpendableNetworkFeeUTXOs
|
||||
|
||||
signPsbt: BridgeFromRunesInput_signPsbtFn
|
||||
sendTransaction: (tx: {
|
||||
hex: string
|
||||
@@ -587,7 +590,7 @@ async function constructRunesTransaction(
|
||||
const tx = createTransaction(
|
||||
txOptions.inputs,
|
||||
txOptions.recipients.concat({
|
||||
addressScriptPubKey: info.fromAddressScriptPubKey,
|
||||
addressScriptPubKey: info.networkFeeChangeAddressScriptPubKey,
|
||||
satsAmount: txOptions.changeAmount,
|
||||
}),
|
||||
txOptions.opReturnScripts ?? [],
|
||||
@@ -645,8 +648,12 @@ export type PrepareRunesTransactionInput = KnownRoute_FromRunes & {
|
||||
toAddress: BridgeFromRunesInput["toAddress"]
|
||||
amount: BridgeFromRunesInput["amount"]
|
||||
inputRuneUTXOs: BridgeFromRunesInput["inputRuneUTXOs"]
|
||||
|
||||
networkFeeRate: BridgeFromRunesInput["networkFeeRate"]
|
||||
networkFeeChangeAddress: string
|
||||
networkFeeChangeAddressScriptPubKey: Uint8Array
|
||||
reselectSpendableNetworkFeeUTXOs: BridgeFromRunesInput["reselectSpendableNetworkFeeUTXOs"]
|
||||
|
||||
pegInAddress: BitcoinAddress
|
||||
orderData: Uint8Array
|
||||
bridgeFeeOutput: null | {
|
||||
@@ -845,7 +852,7 @@ export async function prepareRunesTransaction(
|
||||
),
|
||||
},
|
||||
],
|
||||
changeAddressScriptPubKey: info.fromAddressScriptPubKey,
|
||||
changeAddressScriptPubKey: info.networkFeeChangeAddressScriptPubKey,
|
||||
feeRate: info.networkFeeRate,
|
||||
opReturnScripts: [runesOpReturnScript],
|
||||
reselectSpendableUTXOs: reselectSpendableUTXOsFactory(
|
||||
|
||||
@@ -58,9 +58,11 @@ export interface EstimateBridgeTransactionFromBRC20Input {
|
||||
toAddressScriptPubKey?: Uint8Array
|
||||
|
||||
inputInscriptionUTXO: UTXOSpendable
|
||||
|
||||
swapRoute?: SwapRoute_WithMinimumAmountsToReceive_Public
|
||||
|
||||
networkFeeRate: bigint
|
||||
networkFeeChangeAddress: string
|
||||
networkFeeChangeAddressScriptPubKey: Uint8Array
|
||||
reselectSpendableNetworkFeeUTXOs: BridgeFromBRC20Input_reselectSpendableNetworkFeeUTXOs
|
||||
}
|
||||
|
||||
|
||||
@@ -59,9 +59,11 @@ export interface EstimateBridgeTransactionFromRunesInput {
|
||||
|
||||
amount: SDKNumber
|
||||
inputRuneUTXOs: RunesUTXOSpendable[]
|
||||
|
||||
swapRoute?: SwapRoute_WithMinimumAmountsToReceive_Public
|
||||
|
||||
networkFeeRate: bigint
|
||||
networkFeeChangeAddress: string
|
||||
networkFeeChangeAddressScriptPubKey: Uint8Array
|
||||
reselectSpendableNetworkFeeUTXOs: BridgeFromRunesInput_reselectSpendableNetworkFeeUTXOs
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user