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