@teleportdao/bitcoin 1.7.6 → 1.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/bitcoin-wallet-base.d.ts +1 -6
  2. package/dist/bitcoin-wallet-base.d.ts.map +1 -1
  3. package/dist/bitcoin-wallet-base.js +4 -3
  4. package/dist/bitcoin-wallet-base.js.map +1 -1
  5. package/dist/transaction-builder/transaction-builder.d.ts.map +1 -1
  6. package/dist/transaction-builder/transaction-builder.js +1 -1
  7. package/dist/transaction-builder/transaction-builder.js.map +1 -1
  8. package/package.json +4 -4
  9. package/src/bitcoin-interface-ordinal.ts +181 -181
  10. package/src/bitcoin-interface-teleswap.ts +252 -252
  11. package/src/bitcoin-interface-utils.ts +59 -59
  12. package/src/bitcoin-interface.ts +247 -247
  13. package/src/bitcoin-utils.ts +591 -591
  14. package/src/bitcoin-wallet-base.ts +310 -314
  15. package/src/helper/brc20-helper.ts +181 -181
  16. package/src/helper/ordinal-helper.ts +118 -118
  17. package/src/index.ts +15 -15
  18. package/src/ordinal-wallet.ts +738 -738
  19. package/src/sign/index.ts +1 -1
  20. package/src/sign/sign-transaction.ts +108 -108
  21. package/src/teleswap-wallet.ts +152 -152
  22. package/src/transaction-builder/bitcoin-transaction-builder.ts +44 -44
  23. package/src/transaction-builder/index.ts +3 -3
  24. package/src/transaction-builder/ordinal-transaction-builder.ts +147 -147
  25. package/src/transaction-builder/transaction-builder.ts +706 -705
  26. package/src/type.ts +43 -43
  27. package/src/utils/networks.ts +33 -33
  28. package/src/utils/tools.ts +89 -89
  29. package/tsconfig.json +9 -9
  30. package/webpack.config.js +16 -16
  31. package/dist/bitcoin-base.d.ts +0 -93
  32. package/dist/bitcoin-base.d.ts.map +0 -1
  33. package/dist/bitcoin-base.js +0 -236
  34. package/dist/bitcoin-base.js.map +0 -1
  35. package/dist/helper/burn-request-helper.d.ts +0 -7
  36. package/dist/helper/burn-request-helper.d.ts.map +0 -1
  37. package/dist/helper/burn-request-helper.js +0 -26
  38. package/dist/helper/burn-request-helper.js.map +0 -1
  39. package/dist/helper/teleport-request-helper.d.ts +0 -47
  40. package/dist/helper/teleport-request-helper.d.ts.map +0 -1
  41. package/dist/helper/teleport-request-helper.js +0 -146
  42. package/dist/helper/teleport-request-helper.js.map +0 -1
  43. package/dist/teleport-dao-payments.d.ts +0 -76
  44. package/dist/teleport-dao-payments.d.ts.map +0 -1
  45. package/dist/teleport-dao-payments.js +0 -217
  46. package/dist/teleport-dao-payments.js.map +0 -1
@@ -1,314 +1,310 @@
1
- import * as bip39 from "bip39"
2
- import { hdWalletPath } from "@teleportdao/configs"
3
- import { Network, Payment } from "bitcoinjs-lib"
4
- import BIP32Factory from "bip32"
5
- import ecc from "@bitcoinerlab/secp256k1"
6
- import { BitcoinTransactionBuilder } from "./transaction-builder"
7
- import type { BitcoinConnectionInfo } from "./type"
8
-
9
- import type { ExtendedUtxo, SignerInfo, Target } from "./transaction-builder/transaction-builder"
10
- import BitcoinSign from "./sign/sign-transaction"
11
-
12
- import { getPubKeyFromPrivateKeyHex } from "./bitcoin-utils"
13
- import networks from "./utils/networks"
14
- import { BitcoinInterface } from "./bitcoin-interface"
15
-
16
- const bip32 = BIP32Factory(ecc)
17
-
18
- export class BitcoinBaseWallet {
19
- network: Network
20
- hdWalletPath: {
21
- p2pkh: string
22
- p2wpkh: string
23
- "p2sh-p2wpkh": string
24
- p2sh: string
25
- p2wsh: string
26
- "p2sh-p2wsh": string
27
- p2tr: string
28
- }
29
- transactionBuilder: BitcoinTransactionBuilder
30
- btcInterface: BitcoinInterface
31
- signer: BitcoinSign
32
- currentAccount?: string
33
- currentAccountType?: string
34
- privateKey?: Buffer
35
- publicKey?: Buffer
36
- publicKeys?: Buffer[]
37
- addressObj?: Payment
38
- bitcoinAddress: string | undefined
39
- constructor(
40
- networkName: string,
41
- connectionInfo: BitcoinConnectionInfo = {
42
- api: {
43
- provider: "BlockStream",
44
- },
45
- },
46
- ) {
47
- this.network = networks[networkName]
48
- this.hdWalletPath = hdWalletPath.bitcoin
49
-
50
- this.transactionBuilder = new BitcoinTransactionBuilder(
51
- connectionInfo,
52
- networkName,
53
- this.network,
54
- )
55
- this.btcInterface = this.transactionBuilder.btcInterface
56
-
57
- this.signer = new BitcoinSign(this.network)
58
-
59
- this.currentAccount = undefined
60
- this.currentAccountType = undefined
61
-
62
- this.privateKey = undefined
63
- this.publicKey = undefined
64
- // todo multisig
65
- this.publicKeys = []
66
- }
67
-
68
- get signerInfo() {
69
- return this.privateKey
70
- ? {
71
- address: this.bitcoinAddress!,
72
- publicKey: this.publicKey!.toString("hex"),
73
- addressType: this.currentAccountType!,
74
- }
75
- : undefined
76
- }
77
-
78
- createTransactionInputsAndOutputs({
79
- targets,
80
- extendedUtxo,
81
- changeAddress,
82
- feeRate,
83
- }: {
84
- targets: Target[]
85
- extendedUtxo: ExtendedUtxo[]
86
- changeAddress: string
87
- feeRate: number
88
- fullAmount?: boolean
89
- }) {
90
- return this.transactionBuilder.helperHandleInputsAndOutputs({
91
- targets,
92
- extendedUtxo,
93
- changeObject: {
94
- address: changeAddress,
95
- },
96
- feeRate,
97
- })
98
- }
99
-
100
- checkBalanceIsSufficient({
101
- targets,
102
- extendedUtxo,
103
- changeAddress,
104
- feeRate,
105
- fullAmount = false,
106
- }: {
107
- targets: Target[]
108
- extendedUtxo: ExtendedUtxo[]
109
- changeAddress: string
110
- feeRate: number
111
- fullAmount?: boolean
112
- }) {
113
- try {
114
- this.transactionBuilder.helperHandleInputsAndOutputs({
115
- targets,
116
- extendedUtxo,
117
- changeObject: {
118
- address: changeAddress,
119
- },
120
- feeRate,
121
- })
122
- return true
123
- } catch (err) {
124
- return false
125
- }
126
- }
127
-
128
- // todo : not completed
129
- setMultiSigAccount(accountType = "p2sh") {
130
- throw new Error("not supported yet")
131
-
132
- /* eslint-disable no-unreachable */
133
- // todo : not completed
134
- switch (accountType) {
135
- // case 'p2sh':
136
- // this.currentAccount = ''
137
- // break
138
- // case 'p2wsh':
139
- // this.currentAccount = ''
140
- // break
141
- // case 'p2sh-p2wsh':
142
- // this.currentAccount = ''
143
- // break
144
- default:
145
- throw new Error("accountType is incorrect")
146
- }
147
- this.currentAccountType = accountType
148
- }
149
-
150
- setAccountPrivateKey(privateKeyHex: string) {
151
- this.privateKey = Buffer.from(privateKeyHex, "hex")
152
- let publicKey = getPubKeyFromPrivateKeyHex(privateKeyHex, this.network)
153
- this.publicKey = publicKey
154
- }
155
-
156
- setAccountPrivateKeyByMnemonic({
157
- mnemonic,
158
- mnemonicPassword = "",
159
- index = 0,
160
- walletNumber = 0,
161
- addressType = "p2sh-p2wpkh",
162
- }: {
163
- mnemonic: string
164
- mnemonicPassword?: string
165
- index?: number
166
- walletNumber?: number
167
- addressType?: string
168
- }) {
169
- if (!bip39.validateMnemonic(mnemonic)) throw new Error("invalid mnemonic")
170
- const seed = bip39.mnemonicToSeedSync(mnemonic, mnemonicPassword)
171
- const node = bip32.fromSeed(seed)
172
-
173
- let basePath = this.hdWalletPath[addressType as keyof typeof this.hdWalletPath]
174
- if (!basePath) {
175
- throw new Error("incorrect path or addressType")
176
- }
177
- const path = `${basePath}/${walletNumber}`
178
- const account = node.derivePath(path)
179
- const userKeyPair = account.derive(index)
180
- this.setAccountPrivateKey(userKeyPair.privateKey!.toString("hex"))
181
- return this.setAccount(addressType)
182
- }
183
-
184
- setAccountPublicKey(publicKeyHex: string) {
185
- this.publicKey = Buffer.from(publicKeyHex, "hex")
186
- }
187
-
188
- setAccount(accountType = "p2pkh") {
189
- if (!this.publicKey) {
190
- throw new Error("account not initialized")
191
- }
192
- let addressObj = this.transactionBuilder.createAddressObject({
193
- addressType: accountType,
194
- publicKey: this.publicKey,
195
- })
196
- this.currentAccount = addressObj.address
197
- this.currentAccountType = accountType
198
- this.addressObj = addressObj
199
- this.bitcoinAddress = addressObj.address
200
- return addressObj.address
201
- }
202
-
203
- //
204
-
205
- async getExtendedUtxo(input: SignerInfo) {
206
- return this.transactionBuilder.getExtendedUtxo(input)
207
- }
208
-
209
- async send({
210
- receiverAddress,
211
- amount,
212
- fullAmount = false,
213
- speed = "normal",
214
- }: {
215
- receiverAddress: string
216
- amount: number
217
- fullAmount?: boolean
218
- speed?: "normal" | "fast" | "slow"
219
- }) {
220
- if (!this.currentAccount || !this.currentAccountType || !this.publicKey || !this.privateKey) {
221
- throw new Error("account not initialized")
222
- }
223
-
224
- let extendedUtxo = await this.getExtendedUtxo({
225
- address: this.currentAccount,
226
- addressType: this.currentAccountType,
227
- publicKey: this.publicKey.toString("hex"),
228
- })
229
- if (amount - +amount.toFixed() !== 0)
230
- throw new Error("incorrect amount. amount should be in satoshi")
231
- let feeRate = await this.transactionBuilder._getFeeRate(speed)
232
- let unsignedTx = await this.transactionBuilder.processUnsignedTransaction({
233
- extendedUtxo,
234
- targets: [
235
- {
236
- address: receiverAddress,
237
- value: amount,
238
- },
239
- ],
240
- changeAddress: this.currentAccount,
241
- feeRate,
242
- fullAmount,
243
- })
244
- let signedPsbt = await this.signer.signPsbt(unsignedTx, this.privateKey)
245
- let signedTx = this.signer.finalizePsbts([signedPsbt])
246
- let txId = await this.transactionBuilder.sendTx(signedTx)
247
- return txId
248
- }
249
-
250
- async sendSignedPsbt(signedPsbt: string) {
251
- let signedTx = this.signer.finalizePsbts([signedPsbt])
252
- let txId = await this.transactionBuilder.sendTx(signedTx)
253
- return txId
254
- }
255
-
256
- async sendSignedTx(signedTx: string) {
257
- let txId = await this.transactionBuilder.sendTx(signedTx)
258
- return txId
259
- }
260
-
261
- async sendMultiSignedPsbt(signedPsbts: string[] = []) {
262
- let signedTx = this.signer.finalizePsbts(signedPsbts)
263
- let txId = await this.transactionBuilder.sendTx(signedTx)
264
- return txId
265
- }
266
-
267
- async increaseTransactionFeeUnsignedPsbt(
268
- txId: string,
269
- signerInfos: SignerInfo[],
270
- extraExtendedUtxo: ExtendedUtxo[],
271
- changeAddress: string,
272
- staticFeeRate?: number,
273
- ) {
274
- let transaction = await this.btcInterface.apiProvider.getTransaction(txId)
275
-
276
- let extendedUtxo = transaction.vin.map((vi) => ({
277
- signerInfo: signerInfos.find((s) => s.address === vi.address)!,
278
- hash: vi.txId,
279
- value: +vi.value,
280
- index: vi.index,
281
- }))
282
-
283
- if (extendedUtxo.find((x) => !x.signerInfo?.address)) {
284
- throw new Error("signerInfo not match")
285
- }
286
-
287
- let changeIndex = transaction.vout.findIndex((vo) =>
288
- transaction.vin.find((vi) => vo.address === vi.address || vo.address === changeAddress),
289
- )
290
-
291
- const feeRate = staticFeeRate || (await this.transactionBuilder._getFeeRate("fast"))
292
-
293
- let targets = transaction.vout
294
- .filter((_, index) => index !== changeIndex)
295
- .map((vo) =>
296
- vo.address
297
- ? {
298
- address: vo.address,
299
- value: vo.value,
300
- }
301
- : {
302
- script: Buffer.from(vo.script, "hex"),
303
- value: vo.value,
304
- },
305
- )
306
- return this.transactionBuilder.processUnsignedTransaction({
307
- extendedUtxo: [...extendedUtxo, ...extraExtendedUtxo],
308
- targets,
309
- feeRate,
310
- changeAddress: changeIndex >= 0 ? transaction.vout[changeIndex].address : changeAddress,
311
- selectType: "inOrder",
312
- })
313
- }
314
- }
1
+ import * as bip39 from "bip39"
2
+ import { hdWalletPath } from "@teleportdao/configs"
3
+ import { Network, Payment } from "bitcoinjs-lib"
4
+ import BIP32Factory from "bip32"
5
+ import ecc from "@bitcoinerlab/secp256k1"
6
+ import BigNumber from "bignumber.js"
7
+ import { BitcoinTransactionBuilder } from "./transaction-builder"
8
+ import type { BitcoinConnectionInfo } from "./type"
9
+
10
+ import type { ExtendedUtxo, SignerInfo, Target } from "./transaction-builder/transaction-builder"
11
+ import BitcoinSign from "./sign/sign-transaction"
12
+
13
+ import { getPubKeyFromPrivateKeyHex } from "./bitcoin-utils"
14
+ import networks from "./utils/networks"
15
+ import { BitcoinInterface } from "./bitcoin-interface"
16
+
17
+ const bip32 = BIP32Factory(ecc)
18
+
19
+ export class BitcoinBaseWallet {
20
+ network: Network
21
+ hdWalletPath: {
22
+ p2pkh: string
23
+ p2wpkh: string
24
+ "p2sh-p2wpkh": string
25
+ p2sh: string
26
+ p2wsh: string
27
+ "p2sh-p2wsh": string
28
+ p2tr: string
29
+ }
30
+ transactionBuilder: BitcoinTransactionBuilder
31
+ btcInterface: BitcoinInterface
32
+ signer: BitcoinSign
33
+ currentAccount?: string
34
+ currentAccountType?: string
35
+ privateKey?: Buffer
36
+ publicKey?: Buffer
37
+ publicKeys?: Buffer[]
38
+ addressObj?: Payment
39
+ bitcoinAddress: string | undefined
40
+ constructor(
41
+ networkName: string,
42
+ connectionInfo: BitcoinConnectionInfo = {
43
+ api: {
44
+ provider: "BlockStream",
45
+ },
46
+ },
47
+ ) {
48
+ this.network = networks[networkName]
49
+ this.hdWalletPath = hdWalletPath.bitcoin
50
+
51
+ this.transactionBuilder = new BitcoinTransactionBuilder(
52
+ connectionInfo,
53
+ networkName,
54
+ this.network,
55
+ )
56
+ this.btcInterface = this.transactionBuilder.btcInterface
57
+
58
+ this.signer = new BitcoinSign(this.network)
59
+
60
+ this.currentAccount = undefined
61
+ this.currentAccountType = undefined
62
+
63
+ this.privateKey = undefined
64
+ this.publicKey = undefined
65
+ // todo multisig
66
+ this.publicKeys = []
67
+ }
68
+
69
+ get signerInfo() {
70
+ return this.privateKey
71
+ ? {
72
+ address: this.bitcoinAddress!,
73
+ publicKey: this.publicKey!.toString("hex"),
74
+ addressType: this.currentAccountType!,
75
+ }
76
+ : undefined
77
+ }
78
+
79
+ createTransactionInputsAndOutputs({
80
+ targets,
81
+ extendedUtxo,
82
+ changeAddress,
83
+ feeRate,
84
+ }: {
85
+ targets: Target[]
86
+ extendedUtxo: ExtendedUtxo[]
87
+ changeAddress: string
88
+ feeRate: number
89
+ fullAmount?: boolean
90
+ }) {
91
+ return this.transactionBuilder.helperHandleInputsAndOutputs({
92
+ targets,
93
+ extendedUtxo,
94
+ changeObject: {
95
+ address: changeAddress,
96
+ },
97
+ feeRate,
98
+ })
99
+ }
100
+
101
+ checkBalanceIsSufficient({
102
+ targets,
103
+ extendedUtxo,
104
+ changeAddress,
105
+ feeRate,
106
+ fullAmount = false,
107
+ }: {
108
+ targets: Target[]
109
+ extendedUtxo: ExtendedUtxo[]
110
+ changeAddress: string
111
+ feeRate: number
112
+ fullAmount?: boolean
113
+ }) {
114
+ try {
115
+ this.transactionBuilder.helperHandleInputsAndOutputs({
116
+ targets,
117
+ extendedUtxo,
118
+ changeObject: {
119
+ address: changeAddress,
120
+ },
121
+ feeRate,
122
+ })
123
+ return true
124
+ } catch (err) {
125
+ return false
126
+ }
127
+ }
128
+
129
+ // todo : not completed
130
+ setMultiSigAccount(accountType = "p2sh") {
131
+ throw new Error("not supported yet")
132
+
133
+ /* eslint-disable no-unreachable */
134
+ // todo : not completed
135
+ switch (accountType) {
136
+ // case 'p2sh':
137
+ // this.currentAccount = ''
138
+ // break
139
+ // case 'p2wsh':
140
+ // this.currentAccount = ''
141
+ // break
142
+ // case 'p2sh-p2wsh':
143
+ // this.currentAccount = ''
144
+ // break
145
+ default:
146
+ throw new Error("accountType is incorrect")
147
+ }
148
+ this.currentAccountType = accountType
149
+ }
150
+
151
+ setAccountPrivateKey(privateKeyHex: string) {
152
+ this.privateKey = Buffer.from(privateKeyHex, "hex")
153
+ let publicKey = getPubKeyFromPrivateKeyHex(privateKeyHex, this.network)
154
+ this.publicKey = publicKey
155
+ }
156
+
157
+ setAccountPrivateKeyByMnemonic({
158
+ mnemonic,
159
+ mnemonicPassword = "",
160
+ index = 0,
161
+ walletNumber = 0,
162
+ addressType = "p2sh-p2wpkh",
163
+ }: {
164
+ mnemonic: string
165
+ mnemonicPassword?: string
166
+ index?: number
167
+ walletNumber?: number
168
+ addressType?: string
169
+ }) {
170
+ if (!bip39.validateMnemonic(mnemonic)) throw new Error("invalid mnemonic")
171
+ const seed = bip39.mnemonicToSeedSync(mnemonic, mnemonicPassword)
172
+ const node = bip32.fromSeed(seed)
173
+
174
+ let basePath = this.hdWalletPath[addressType as keyof typeof this.hdWalletPath]
175
+ if (!basePath) {
176
+ throw new Error("incorrect path or addressType")
177
+ }
178
+ const path = `${basePath}/${walletNumber}`
179
+ const account = node.derivePath(path)
180
+ const userKeyPair = account.derive(index)
181
+ this.setAccountPrivateKey(userKeyPair.privateKey!.toString("hex"))
182
+ return this.setAccount(addressType)
183
+ }
184
+
185
+ setAccountPublicKey(publicKeyHex: string) {
186
+ this.publicKey = Buffer.from(publicKeyHex, "hex")
187
+ }
188
+
189
+ setAccount(accountType = "p2pkh") {
190
+ if (!this.publicKey) {
191
+ throw new Error("account not initialized")
192
+ }
193
+ let addressObj = this.transactionBuilder.createAddressObject({
194
+ addressType: accountType,
195
+ publicKey: this.publicKey,
196
+ })
197
+ this.currentAccount = addressObj.address
198
+ this.currentAccountType = accountType
199
+ this.addressObj = addressObj
200
+ this.bitcoinAddress = addressObj.address
201
+ return addressObj.address
202
+ }
203
+
204
+ //
205
+
206
+ async getExtendedUtxo(input: SignerInfo) {
207
+ return this.transactionBuilder.getExtendedUtxo(input)
208
+ }
209
+
210
+ async send(
211
+ receiverAddress: string,
212
+ amount: string | number,
213
+ fullAmount = false,
214
+ speed: "normal" | "slow" | "fast" = "normal",
215
+ ) {
216
+ if (!this.currentAccount || !this.currentAccountType || !this.publicKey || !this.privateKey) {
217
+ throw new Error("account not initialized")
218
+ }
219
+
220
+ let extendedUtxo = await this.getExtendedUtxo({
221
+ address: this.currentAccount,
222
+ addressType: this.currentAccountType,
223
+ publicKey: this.publicKey.toString("hex"),
224
+ })
225
+ if (!fullAmount && BigNumber(amount).isEqualTo(0))
226
+ throw new Error("incorrect amount. amount should be in satoshi")
227
+ let feeRate = await this.transactionBuilder._getFeeRate(speed)
228
+ let unsignedTx = await this.transactionBuilder.processUnsignedTransaction({
229
+ extendedUtxo,
230
+ targets: [
231
+ {
232
+ address: receiverAddress,
233
+ value: +amount,
234
+ },
235
+ ],
236
+ changeAddress: this.currentAccount,
237
+ feeRate,
238
+ fullAmount,
239
+ })
240
+ let signedPsbt = await this.signer.signPsbt(unsignedTx, this.privateKey)
241
+ let signedTx = this.signer.finalizePsbts([signedPsbt])
242
+ let txId = await this.transactionBuilder.sendTx(signedTx)
243
+ return txId
244
+ }
245
+
246
+ async sendSignedPsbt(signedPsbt: string) {
247
+ let signedTx = this.signer.finalizePsbts([signedPsbt])
248
+ let txId = await this.transactionBuilder.sendTx(signedTx)
249
+ return txId
250
+ }
251
+
252
+ async sendSignedTx(signedTx: string) {
253
+ let txId = await this.transactionBuilder.sendTx(signedTx)
254
+ return txId
255
+ }
256
+
257
+ async sendMultiSignedPsbt(signedPsbts: string[] = []) {
258
+ let signedTx = this.signer.finalizePsbts(signedPsbts)
259
+ let txId = await this.transactionBuilder.sendTx(signedTx)
260
+ return txId
261
+ }
262
+
263
+ async increaseTransactionFeeUnsignedPsbt(
264
+ txId: string,
265
+ signerInfos: SignerInfo[],
266
+ extraExtendedUtxo: ExtendedUtxo[],
267
+ changeAddress: string,
268
+ staticFeeRate?: number,
269
+ ) {
270
+ let transaction = await this.btcInterface.apiProvider.getTransaction(txId)
271
+
272
+ let extendedUtxo = transaction.vin.map((vi) => ({
273
+ signerInfo: signerInfos.find((s) => s.address === vi.address)!,
274
+ hash: vi.txId,
275
+ value: +vi.value,
276
+ index: vi.index,
277
+ }))
278
+
279
+ if (extendedUtxo.find((x) => !x.signerInfo?.address)) {
280
+ throw new Error("signerInfo not match")
281
+ }
282
+
283
+ let changeIndex = transaction.vout.findIndex((vo) =>
284
+ transaction.vin.find((vi) => vo.address === vi.address || vo.address === changeAddress),
285
+ )
286
+
287
+ const feeRate = staticFeeRate || (await this.transactionBuilder._getFeeRate("fast"))
288
+
289
+ let targets = transaction.vout
290
+ .filter((_, index) => index !== changeIndex)
291
+ .map((vo) =>
292
+ vo.address
293
+ ? {
294
+ address: vo.address,
295
+ value: vo.value,
296
+ }
297
+ : {
298
+ script: Buffer.from(vo.script, "hex"),
299
+ value: vo.value,
300
+ },
301
+ )
302
+ return this.transactionBuilder.processUnsignedTransaction({
303
+ extendedUtxo: [...extendedUtxo, ...extraExtendedUtxo],
304
+ targets,
305
+ feeRate,
306
+ changeAddress: changeIndex >= 0 ? transaction.vout[changeIndex].address : changeAddress,
307
+ selectType: "inOrder",
308
+ })
309
+ }
310
+ }