@teleportdao/bitcoin 2.0.5 → 2.0.7

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 (76) hide show
  1. package/dist/bitcoin-interface-ordinal.d.ts +108 -108
  2. package/dist/bitcoin-interface-ordinal.js +140 -140
  3. package/dist/bitcoin-interface-teleswap.d.ts +101 -101
  4. package/dist/bitcoin-interface-teleswap.js +176 -176
  5. package/dist/bitcoin-interface-utils.d.ts +20 -20
  6. package/dist/bitcoin-interface-utils.js +45 -45
  7. package/dist/bitcoin-interface-wallet.d.ts +28 -28
  8. package/dist/bitcoin-interface-wallet.js +125 -125
  9. package/dist/bitcoin-interface.d.ts +66 -66
  10. package/dist/bitcoin-interface.js +119 -119
  11. package/dist/bitcoin-utils.d.ts +96 -96
  12. package/dist/bitcoin-utils.js +514 -514
  13. package/dist/bitcoin-wallet-base.d.ts +111 -111
  14. package/dist/bitcoin-wallet-base.js +258 -258
  15. package/dist/helper/brc20-helper.d.ts +42 -42
  16. package/dist/helper/brc20-helper.js +127 -127
  17. package/dist/helper/index.d.ts +3 -3
  18. package/dist/helper/index.js +29 -29
  19. package/dist/helper/ordinal-helper.d.ts +12 -12
  20. package/dist/helper/ordinal-helper.js +129 -129
  21. package/dist/helper/teleswap-helper.d.ts +95 -95
  22. package/dist/helper/teleswap-helper.js +186 -186
  23. package/dist/index.d.ts +12 -12
  24. package/dist/index.js +41 -41
  25. package/dist/ordinal-wallet.d.ts +495 -495
  26. package/dist/ordinal-wallet.js +386 -386
  27. package/dist/sign/index.d.ts +1 -1
  28. package/dist/sign/index.js +8 -8
  29. package/dist/sign/sign-transaction.d.ts +12 -12
  30. package/dist/sign/sign-transaction.js +82 -82
  31. package/dist/teleswap-wallet.d.ts +45 -45
  32. package/dist/teleswap-wallet.js +68 -68
  33. package/dist/transaction-builder/bitcoin-transaction-builder.d.ts +9 -9
  34. package/dist/transaction-builder/bitcoin-transaction-builder.js +54 -54
  35. package/dist/transaction-builder/index.d.ts +3 -3
  36. package/dist/transaction-builder/index.js +19 -19
  37. package/dist/transaction-builder/ordinal-transaction-builder.d.ts +63 -63
  38. package/dist/transaction-builder/ordinal-transaction-builder.js +125 -125
  39. package/dist/transaction-builder/transaction-builder.d.ts +223 -223
  40. package/dist/transaction-builder/transaction-builder.js +447 -447
  41. package/dist/type.d.ts +61 -61
  42. package/dist/type.js +2 -2
  43. package/dist/utils/networks.d.ts +5 -5
  44. package/dist/utils/networks.js +53 -53
  45. package/dist/utils/tools.d.ts +18 -18
  46. package/dist/utils/tools.js +74 -74
  47. package/package.json +4 -4
  48. package/src/bitcoin-interface-ordinal.ts +185 -185
  49. package/src/bitcoin-interface-teleswap.ts +251 -251
  50. package/src/bitcoin-interface-utils.ts +60 -60
  51. package/src/bitcoin-interface-wallet.ts +114 -114
  52. package/src/bitcoin-interface.ts +156 -156
  53. package/src/bitcoin-utils.ts +591 -591
  54. package/src/bitcoin-wallet-base.ts +344 -344
  55. package/src/helper/brc20-helper.ts +179 -179
  56. package/src/helper/ordinal-helper.ts +118 -118
  57. package/src/index.ts +15 -15
  58. package/src/ordinal-wallet.ts +659 -659
  59. package/src/sign/index.ts +1 -1
  60. package/src/sign/sign-transaction.ts +108 -108
  61. package/src/teleswap-wallet.ts +133 -133
  62. package/src/transaction-builder/bitcoin-transaction-builder.ts +26 -26
  63. package/src/transaction-builder/index.ts +3 -3
  64. package/src/transaction-builder/ordinal-transaction-builder.ts +139 -139
  65. package/src/transaction-builder/transaction-builder.ts +690 -690
  66. package/src/type.ts +74 -74
  67. package/src/utils/networks.ts +33 -33
  68. package/src/utils/tools.ts +92 -92
  69. package/tsconfig.json +9 -9
  70. package/webpack.config.js +16 -16
  71. package/.tmp/block-parser.ts +0 -58
  72. package/.tmp/check.ts +0 -101
  73. package/.tmp/ordinal-helper.ts +0 -133
  74. package/.tmp/ordinal.ts +0 -25
  75. package/.tmp/psbt/sign-transaction.ts +0 -121
  76. package/.tmp/rbf.ts +0 -45
package/src/type.ts CHANGED
@@ -1,74 +1,74 @@
1
- export type Transaction = {
2
- txId: string
3
- version: number
4
- locktime: number
5
- blockNumber: number
6
- blockHash: string
7
- merkleProof?: {
8
- intermediateNodes: string
9
- transactionIndex: number
10
- }
11
- vout: {
12
- address?: string
13
- script: string
14
- value: number
15
- }[]
16
- vin: {
17
- txId: string
18
- index: number
19
- address?: string
20
- script?: string
21
- value?: number
22
- }[]
23
- address: string
24
- addressScript: string
25
- }
26
-
27
- export type UtxoConnectionInfo = {
28
- token?: string
29
- provider: "BlockStream" | "MempoolSpace" | "NowNodes" | "Unisat" | "TeleportDao"
30
- }
31
-
32
- export type BTCTokenConnectionInfo = {
33
- token?: string
34
- provider: "Unisat" | "TeleportDao"
35
- }
36
-
37
- export type APIConnectionInfo = {
38
- provider: "BlockStream" | "MempoolSpace"
39
- }
40
-
41
- export type RPCConnectionInfo = {
42
- url: string
43
- headers?: {
44
- [key: string]: string
45
- }
46
- auth?: {
47
- username: string
48
- password: string
49
- }
50
- }
51
-
52
- export type BitcoinWalletConnectionInfo = {
53
- utxo?: UtxoConnectionInfo
54
- // rpc used for getRawTransaction in transaction builder if set (optional)
55
- rpc?: RPCConnectionInfo
56
- }
57
- export type BitcoinWalletInterfaceConnectionInfo = {
58
- api?: APIConnectionInfo
59
- // if utxo is not provided, it will use the same provider as the api
60
- // rpc used for getRawTransaction in transaction builder if set (optional)
61
- utxo?: UtxoConnectionInfo
62
- }
63
-
64
- export type BitcoinInterfaceConnectionInfo = BitcoinWalletInterfaceConnectionInfo & {
65
- rpc?: RPCConnectionInfo
66
- }
67
-
68
- export type BitcoinNodeConnectionInfo = BitcoinWalletInterfaceConnectionInfo & {
69
- rpc: RPCConnectionInfo
70
- }
71
-
72
- export type BitcoinTokenNodeConnectionInfo = BitcoinNodeConnectionInfo & {
73
- // btcToken: BTCTokenConnectionInfo
74
- }
1
+ export type Transaction = {
2
+ txId: string
3
+ version: number
4
+ locktime: number
5
+ blockNumber: number
6
+ blockHash: string
7
+ merkleProof?: {
8
+ intermediateNodes: string
9
+ transactionIndex: number
10
+ }
11
+ vout: {
12
+ address?: string
13
+ script: string
14
+ value: number
15
+ }[]
16
+ vin: {
17
+ txId: string
18
+ index: number
19
+ address?: string
20
+ script?: string
21
+ value?: number
22
+ }[]
23
+ address: string
24
+ addressScript: string
25
+ }
26
+
27
+ export type UtxoConnectionInfo = {
28
+ token?: string
29
+ provider: "BlockStream" | "MempoolSpace" | "NowNodes" | "Unisat" | "TeleportDao"
30
+ }
31
+
32
+ export type BTCTokenConnectionInfo = {
33
+ token?: string
34
+ provider: "Unisat" | "TeleportDao"
35
+ }
36
+
37
+ export type APIConnectionInfo = {
38
+ provider: "BlockStream" | "MempoolSpace"
39
+ }
40
+
41
+ export type RPCConnectionInfo = {
42
+ url: string
43
+ headers?: {
44
+ [key: string]: string
45
+ }
46
+ auth?: {
47
+ username: string
48
+ password: string
49
+ }
50
+ }
51
+
52
+ export type BitcoinWalletConnectionInfo = {
53
+ utxo?: UtxoConnectionInfo
54
+ // rpc used for getRawTransaction in transaction builder if set (optional)
55
+ rpc?: RPCConnectionInfo
56
+ }
57
+ export type BitcoinWalletInterfaceConnectionInfo = {
58
+ api?: APIConnectionInfo
59
+ // if utxo is not provided, it will use the same provider as the api
60
+ // rpc used for getRawTransaction in transaction builder if set (optional)
61
+ utxo?: UtxoConnectionInfo
62
+ }
63
+
64
+ export type BitcoinInterfaceConnectionInfo = BitcoinWalletInterfaceConnectionInfo & {
65
+ rpc?: RPCConnectionInfo
66
+ }
67
+
68
+ export type BitcoinNodeConnectionInfo = BitcoinWalletInterfaceConnectionInfo & {
69
+ rpc: RPCConnectionInfo
70
+ }
71
+
72
+ export type BitcoinTokenNodeConnectionInfo = BitcoinNodeConnectionInfo & {
73
+ // btcToken: BTCTokenConnectionInfo
74
+ }
@@ -1,33 +1,33 @@
1
- import * as bitcoinLib from "bitcoinjs-lib"
2
-
3
- const networks: {
4
- [key: string]: bitcoinLib.Network
5
- } = {
6
- bitcoin: bitcoinLib.networks.bitcoin,
7
- bitcoin_testnet: bitcoinLib.networks.testnet,
8
-
9
- litecoin: {
10
- messagePrefix: "\x19Litecoin Signed Message:\n",
11
- bech32: "ltc",
12
- bip32: {
13
- public: 0x0488b21e,
14
- private: 0x0488ade4,
15
- },
16
- pubKeyHash: 0x30,
17
- scriptHash: 0x32,
18
- wif: 0xb0,
19
- },
20
- litecoin_testnet: {
21
- messagePrefix: "\x18Litecoin Signed Message:\n",
22
- bech32: "tltc",
23
- bip32: {
24
- public: 0x043587cf,
25
- private: 0x04358394,
26
- },
27
- pubKeyHash: 0x6f,
28
- scriptHash: 0x3a, // old 0xc4 -> 2 deprecated
29
- wif: 0xef,
30
- },
31
- }
32
-
33
- export default networks
1
+ import * as bitcoinLib from "bitcoinjs-lib"
2
+
3
+ const networks: {
4
+ [key: string]: bitcoinLib.Network
5
+ } = {
6
+ bitcoin: bitcoinLib.networks.bitcoin,
7
+ bitcoin_testnet: bitcoinLib.networks.testnet,
8
+
9
+ litecoin: {
10
+ messagePrefix: "\x19Litecoin Signed Message:\n",
11
+ bech32: "ltc",
12
+ bip32: {
13
+ public: 0x0488b21e,
14
+ private: 0x0488ade4,
15
+ },
16
+ pubKeyHash: 0x30,
17
+ scriptHash: 0x32,
18
+ wif: 0xb0,
19
+ },
20
+ litecoin_testnet: {
21
+ messagePrefix: "\x18Litecoin Signed Message:\n",
22
+ bech32: "tltc",
23
+ bip32: {
24
+ public: 0x043587cf,
25
+ private: 0x04358394,
26
+ },
27
+ pubKeyHash: 0x6f,
28
+ scriptHash: 0x3a, // old 0xc4 -> 2 deprecated
29
+ wif: 0xef,
30
+ },
31
+ }
32
+
33
+ export default networks
@@ -1,92 +1,92 @@
1
- import axios from "axios"
2
-
3
- function sleep(ms: number) {
4
- // eslint-disable-next-line no-promise-executor-return
5
- return new Promise((resolve) => setTimeout(resolve, ms))
6
- }
7
-
8
- async function runWithRetries<T>(
9
- action: () => Promise<T>,
10
- config: {
11
- maxTries?: number
12
- retrySleep?: number
13
- } = {
14
- maxTries: 2,
15
- retrySleep: 1000,
16
- },
17
- ): Promise<T> {
18
- const maxTries = config.maxTries ?? 2
19
- const retrySleep = config.retrySleep ?? 1000
20
- const trace = new Error().stack?.split("\n").slice(5).join("\n")
21
-
22
- let lastError: any
23
- for (let count = 0; count < maxTries; count += 1) {
24
- try {
25
- return await action()
26
- } catch (error: any) {
27
- error.message += `\n${trace}`
28
- console.log(`Attempt ${count + 1} failed: ${error.message}`)
29
- lastError = error
30
- if (count < maxTries - 1) {
31
- await sleep(retrySleep)
32
- }
33
- }
34
- }
35
-
36
- throw lastError || new Error(`Function failed after ${maxTries} retries: ${lastError?.message}`)
37
- }
38
-
39
- function getRandomInteger(min: number, max: number) {
40
- return Math.floor(Math.random() * (max - min)) + min
41
- }
42
-
43
- function getAxiosInstance({
44
- baseUrl,
45
- timeout = 10000,
46
- headers = {},
47
- auth,
48
- }: {
49
- baseUrl: string
50
- timeout?: number
51
- headers?: { [key: string]: string }
52
- auth?: {
53
- username: string
54
- password: string
55
- }
56
- }) {
57
- let host = baseUrl
58
- let instance
59
-
60
- instance = axios.create({
61
- baseURL: host,
62
- timeout,
63
- auth,
64
- headers: {
65
- ...headers,
66
- },
67
- })
68
-
69
- // Add a response interceptor
70
- instance.interceptors.response.use(
71
- (response) => response,
72
- (error) => {
73
- // todo : fix this part
74
- if (error.response) {
75
- const serviceError = new Error(
76
- JSON.stringify({ data: error.response.data, message: error.message }),
77
- )
78
- return Promise.reject(serviceError)
79
- }
80
-
81
- if (error.request) {
82
- const serviceError = new Error(error.message)
83
- return Promise.reject(serviceError)
84
- }
85
- return Promise.reject(error)
86
- },
87
- )
88
-
89
- return instance
90
- }
91
-
92
- export { sleep, runWithRetries, getRandomInteger, getAxiosInstance }
1
+ import axios from "axios"
2
+
3
+ function sleep(ms: number) {
4
+ // eslint-disable-next-line no-promise-executor-return
5
+ return new Promise((resolve) => setTimeout(resolve, ms))
6
+ }
7
+
8
+ async function runWithRetries<T>(
9
+ action: () => Promise<T>,
10
+ config: {
11
+ maxTries?: number
12
+ retrySleep?: number
13
+ } = {
14
+ maxTries: 2,
15
+ retrySleep: 1000,
16
+ },
17
+ ): Promise<T> {
18
+ const maxTries = config.maxTries ?? 2
19
+ const retrySleep = config.retrySleep ?? 1000
20
+ const trace = new Error().stack?.split("\n").slice(5).join("\n")
21
+
22
+ let lastError: any
23
+ for (let count = 0; count < maxTries; count += 1) {
24
+ try {
25
+ return await action()
26
+ } catch (error: any) {
27
+ error.message += `\n${trace}`
28
+ console.log(`Attempt ${count + 1} failed: ${error.message}`)
29
+ lastError = error
30
+ if (count < maxTries - 1) {
31
+ await sleep(retrySleep)
32
+ }
33
+ }
34
+ }
35
+
36
+ throw lastError || new Error(`Function failed after ${maxTries} retries: ${lastError?.message}`)
37
+ }
38
+
39
+ function getRandomInteger(min: number, max: number) {
40
+ return Math.floor(Math.random() * (max - min)) + min
41
+ }
42
+
43
+ function getAxiosInstance({
44
+ baseUrl,
45
+ timeout = 10000,
46
+ headers = {},
47
+ auth,
48
+ }: {
49
+ baseUrl: string
50
+ timeout?: number
51
+ headers?: { [key: string]: string }
52
+ auth?: {
53
+ username: string
54
+ password: string
55
+ }
56
+ }) {
57
+ let host = baseUrl
58
+ let instance
59
+
60
+ instance = axios.create({
61
+ baseURL: host,
62
+ timeout,
63
+ auth,
64
+ headers: {
65
+ ...headers,
66
+ },
67
+ })
68
+
69
+ // Add a response interceptor
70
+ instance.interceptors.response.use(
71
+ (response) => response,
72
+ (error) => {
73
+ // todo : fix this part
74
+ if (error.response) {
75
+ const serviceError = new Error(
76
+ JSON.stringify({ data: error.response.data, message: error.message }),
77
+ )
78
+ return Promise.reject(serviceError)
79
+ }
80
+
81
+ if (error.request) {
82
+ const serviceError = new Error(error.message)
83
+ return Promise.reject(serviceError)
84
+ }
85
+ return Promise.reject(error)
86
+ },
87
+ )
88
+
89
+ return instance
90
+ }
91
+
92
+ export { sleep, runWithRetries, getRandomInteger, getAxiosInstance }
package/tsconfig.json CHANGED
@@ -1,9 +1,9 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "rootDir": "src" /* Specify the root folder within your source files. */,
5
- "outDir": "dist" /* Specify an output folder for all emitted files. */
6
- },
7
- "include": ["src"],
8
- "exclude": ["node_modules", "dist"]
9
- }
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": "src" /* Specify the root folder within your source files. */,
5
+ "outDir": "dist" /* Specify an output folder for all emitted files. */
6
+ },
7
+ "include": ["src"],
8
+ "exclude": ["node_modules", "dist"]
9
+ }
package/webpack.config.js CHANGED
@@ -1,16 +1,16 @@
1
- const path = require("path")
2
- // const webpack = require("webpack")
3
-
4
- module.exports = {
5
- mode: "production",
6
- entry: "./dist/index.js",
7
- output: {
8
- filename: "bundle.js",
9
- path: path.resolve(__dirname, "dist"),
10
- libraryTarget: "umd", // Module type
11
- globalObject: "this", // Fix for universal module definition
12
- },
13
- performance: {
14
- hints: false,
15
- },
16
- }
1
+ const path = require("path")
2
+ // const webpack = require("webpack")
3
+
4
+ module.exports = {
5
+ mode: "production",
6
+ entry: "./dist/index.js",
7
+ output: {
8
+ filename: "bundle.js",
9
+ path: path.resolve(__dirname, "dist"),
10
+ libraryTarget: "umd", // Module type
11
+ globalObject: "this", // Fix for universal module definition
12
+ },
13
+ performance: {
14
+ hints: false,
15
+ },
16
+ }
@@ -1,58 +0,0 @@
1
- import blockchainConfig from "@teleportdao/teleswap-nodes/src/config/blockchain.config"
2
- import { BitcoinInterface } from "../src"
3
- import { parseRawTransaction } from "../src/bitcoin-utils"
4
-
5
- async function start() {
6
- const btcInterface = new BitcoinInterface(
7
- blockchainConfig.sourceNetwork.connection,
8
- blockchainConfig.sourceNetwork.name,
9
- )
10
-
11
- // const txs = await btcInterface.getMultipleBlocksTransactions(
12
- // ["3QMbvA6PhMSJAhr4Usr7JxVC6LuxQJqNKa"],
13
- // 862571,
14
- // 862572,
15
- // [
16
- // {
17
- // txId: "7fc88095bf4a8722295b51615965b46b5f429ebe18c38d7d7746a8c00b58b724",
18
- // index: 2,
19
- // value: 546,
20
- // script: "a914f89ef33376877ad6d01bf5e23bc263f9553bb2d587",
21
- // address: "3QMbvA6PhMSJAhr4Usr7JxVC6LuxQJqNKa",
22
- // },
23
- // {
24
- // txId: "49daf17deab7e8ecfd9eacb4d0476a5dbca7a333cc9aee94e208d718870743e7",
25
- // index: 2,
26
- // value: 546,
27
- // script: "a914f89ef33376877ad6d01bf5e23bc263f9553bb2d587",
28
- // address: "3QMbvA6PhMSJAhr4Usr7JxVC6LuxQJqNKa",
29
- // },
30
- // {
31
- // txId: "3ac54d4ff0c8e971658b3a20a9f75d912795da2fd83b94465a2cafad3b25f3ef",
32
- // index: 2,
33
- // value: 546,
34
- // script: "a914f89ef33376877ad6d01bf5e23bc263f9553bb2d587",
35
- // address: "3QMbvA6PhMSJAhr4Usr7JxVC6LuxQJqNKa",
36
- // },
37
- // {
38
- // txId: "49f4fc74c20ea50e2ce6d2c9b3bcfdcbba600a1f691d20bfb4f39b77170bd2e6",
39
- // index: 3,
40
- // value: 35637,
41
- // script: "a914f89ef33376877ad6d01bf5e23bc263f9553bb2d587",
42
- // address: "3QMbvA6PhMSJAhr4Usr7JxVC6LuxQJqNKa",
43
- // },
44
- // ],
45
- // )
46
- const a = await btcInterface.getRequestProof({
47
- txId: "4a24b07a9faa9929153d544fd1cbb0f83f5b7eb43977a88b8c1c2b704fa112af",
48
- })
49
- console.log(JSON.stringify(a, null, 2))
50
-
51
- // console.log(
52
- // txs.filter(
53
- // (t, i) => !txs.find((tt, ii) => t.txId === tt.txId && t.address === tt.address && ii < i),
54
- // ),
55
- // )
56
- }
57
-
58
- start()
package/.tmp/check.ts DELETED
@@ -1,101 +0,0 @@
1
- import { BitcoinBase, TeleportDaoPayment, TransferRequest } from "@teleportdao/bitcoin"
2
- import { parseRawTransaction } from "../dist/bitcoin-utils"
3
- ;(async () => {
4
- const testnet = true
5
- let address = "tb1psfytxls4urhycq63xjrfmseq73wwuql2syn3n8398rqkyf5m3z8shy5sl7"
6
- let btc = new TeleportDaoPayment("bitcoin_testnet")
7
- let deadline = Math.ceil(new Date().getTime() / 1000 + 3600)
8
- let transferRequest: TransferRequest = {
9
- changeAddress: address,
10
- lockerAddress: testnet
11
- ? "2MzQA2boKkWPkooDkN9dKfqzFndSvjHw5kg"
12
- : "3CAQAw7m95axbY761Xq8d9DADhjNaX9b8o",
13
- amount: +(0.0001 * 1e8).toFixed(),
14
- recipientAddress: "0x7C124a845BC48D957748661452dc996FF487B252",
15
- percentageFee: 4, // 2 bytes in satoshi
16
-
17
- chainId: 3,
18
- appId: 0,
19
- speed: 0, // 1 byte
20
-
21
- // exchange
22
- isExchange: false,
23
- exchangeTokenAddress: undefined,
24
- outputAmount: undefined,
25
- isFixedToken: false,
26
- deadline,
27
- feeSpeed: "normal",
28
- }
29
-
30
- let extendedUtxo = await btc.transactionBuilder.getExtendedUtxo({
31
- address: address,
32
- addressType: "p2tr",
33
- publicKey: "021f6adece8789d520aaea90a2ca9faff45bdd2dca02fd819815673953dc674d54",
34
- includeHex: false,
35
- })
36
- console.log(extendedUtxo.reduce((a, b) => a + b.value, 0) / 1e8)
37
- extendedUtxo = extendedUtxo.filter((u) => u.value > 145 * 68)
38
- console.log(extendedUtxo.reduce((a, b) => a + b.value, 0) / 1e8)
39
- console.log(extendedUtxo.length)
40
-
41
- // const extendedUtxo = [
42
- // {
43
- // hash: "1a69625b1fe4392e4130f30fa1e6794dd8b81f54bc9d7ccf7a3479d8ccf419a6",
44
- // value: 99787,
45
- // index: 1,
46
- // signerInfo: {
47
- // address: "tb1psfytxls4urhycq63xjrfmseq73wwuql2syn3n8398rqkyf5m3z8shy5sl7",
48
- // publicKey: "021f6adece8789d520aaea90a2ca9faff45bdd2dca02fd819815673953dc674d54",
49
- // addressType: "p2tr",
50
- // },
51
- // },
52
- // {
53
- // hash: "93f0b41f26480068a219a8620313f6fa146f076e4ef03ab781638965a2a1c7c4",
54
- // value: 8000,
55
- // index: 1,
56
- // signerInfo: {
57
- // address: "tb1psfytxls4urhycq63xjrfmseq73wwuql2syn3n8398rqkyf5m3z8shy5sl7",
58
- // publicKey: "021f6adece8789d520aaea90a2ca9faff45bdd2dca02fd819815673953dc674d54",
59
- // addressType: "p2tr",
60
- // },
61
- // },
62
- // {
63
- // hash: "6c666a7036fdff9f4c1cce2f9233eac3c4b56601cdc5ea82554b8af90e962ced",
64
- // value: 8000,
65
- // index: 1,
66
- // signerInfo: {
67
- // address: "tb1psfytxls4urhycq63xjrfmseq73wwuql2syn3n8398rqkyf5m3z8shy5sl7",
68
- // publicKey: "021f6adece8789d520aaea90a2ca9faff45bdd2dca02fd819815673953dc674d54",
69
- // addressType: "p2tr",
70
- // },
71
- // },
72
- // {
73
- // hash: "2437ddbde4bb469c5c1f8dcb09959962a9e844ba9b56420bb5391fb29f50400c",
74
- // value: 8000,
75
- // index: 0,
76
- // signerInfo: {
77
- // address: "tb1psfytxls4urhycq63xjrfmseq73wwuql2syn3n8398rqkyf5m3z8shy5sl7",
78
- // publicKey: "021f6adece8789d520aaea90a2ca9faff45bdd2dca02fd819815673953dc674d54",
79
- // addressType: "p2tr",
80
- // },
81
- // },
82
- // ]
83
-
84
- // normal transfer
85
- // let tx = await btc.transactionBuilder.processUnsignedTransaction({
86
- // extendedUtxo,
87
- // targets: [{
88
- // address: addressObj.address!,
89
- // value: 0.0001 * 1e8
90
- // }],
91
- // feeRate:1,
92
- // changeAddress: addressObj.address!
93
- // })
94
-
95
- let tx = await btc.getBitcoinToEthUnsignedPsbt({
96
- ...transferRequest,
97
- extendedUtxo,
98
- })
99
-
100
- console.log("tx", tx)
101
- })()