@teleportdao/bitcoin 1.6.1 → 1.7.1

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 (129) hide show
  1. package/.tmp/check.ts +101 -0
  2. package/.tmp/psbt/sign-transaction.ts +121 -0
  3. package/.tmp/rbf.ts +45 -0
  4. package/dist/bitcoin-interface-ordinal.d.ts +109 -0
  5. package/dist/bitcoin-interface-ordinal.d.ts.map +1 -0
  6. package/dist/bitcoin-interface-ordinal.js +141 -0
  7. package/dist/bitcoin-interface-ordinal.js.map +1 -0
  8. package/dist/bitcoin-interface-teleswap.d.ts +148 -0
  9. package/dist/bitcoin-interface-teleswap.d.ts.map +1 -0
  10. package/dist/bitcoin-interface-teleswap.js +179 -0
  11. package/dist/bitcoin-interface-teleswap.js.map +1 -0
  12. package/dist/bitcoin-interface-utils.d.ts.map +1 -1
  13. package/dist/bitcoin-interface-utils.js.map +1 -1
  14. package/dist/bitcoin-interface.d.ts +45 -333
  15. package/dist/bitcoin-interface.d.ts.map +1 -1
  16. package/dist/bitcoin-interface.js +68 -202
  17. package/dist/bitcoin-interface.js.map +1 -1
  18. package/dist/bitcoin-utils.d.ts +12 -59
  19. package/dist/bitcoin-utils.d.ts.map +1 -1
  20. package/dist/bitcoin-utils.js +61 -61
  21. package/dist/bitcoin-utils.js.map +1 -1
  22. package/dist/{bitcoin-base.d.ts → bitcoin-wallet-base.d.ts} +9 -9
  23. package/dist/bitcoin-wallet-base.d.ts.map +1 -0
  24. package/dist/{bitcoin-base.js → bitcoin-wallet-base.js} +15 -14
  25. package/dist/bitcoin-wallet-base.js.map +1 -0
  26. package/dist/helper/brc20-helper.d.ts +43 -0
  27. package/dist/helper/brc20-helper.d.ts.map +1 -0
  28. package/dist/helper/brc20-helper.js +129 -0
  29. package/dist/helper/brc20-helper.js.map +1 -0
  30. package/dist/helper/index.d.ts +4 -0
  31. package/dist/helper/index.d.ts.map +1 -0
  32. package/dist/helper/index.js +30 -0
  33. package/dist/helper/index.js.map +1 -0
  34. package/dist/helper/ordinal-helper.d.ts +13 -0
  35. package/dist/helper/ordinal-helper.d.ts.map +1 -0
  36. package/dist/helper/ordinal-helper.js +127 -0
  37. package/dist/helper/ordinal-helper.js.map +1 -0
  38. package/dist/helper/teleswap-helper.d.ts +84 -0
  39. package/dist/helper/teleswap-helper.d.ts.map +1 -0
  40. package/dist/helper/teleswap-helper.js +181 -0
  41. package/dist/helper/teleswap-helper.js.map +1 -0
  42. package/dist/index.d.ts +8 -3
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +8 -3
  45. package/dist/index.js.map +1 -1
  46. package/dist/ordinal-wallet.d.ts +536 -0
  47. package/dist/ordinal-wallet.d.ts.map +1 -0
  48. package/dist/ordinal-wallet.js +448 -0
  49. package/dist/ordinal-wallet.js.map +1 -0
  50. package/dist/sign/sign-transaction.d.ts +2 -4
  51. package/dist/sign/sign-transaction.d.ts.map +1 -1
  52. package/dist/sign/sign-transaction.js +26 -22
  53. package/dist/sign/sign-transaction.js.map +1 -1
  54. package/dist/teleswap-wallet.d.ts +54 -0
  55. package/dist/teleswap-wallet.d.ts.map +1 -0
  56. package/dist/teleswap-wallet.js +87 -0
  57. package/dist/teleswap-wallet.js.map +1 -0
  58. package/dist/transaction-builder/bitcoin-transaction-builder.d.ts +2 -20
  59. package/dist/transaction-builder/bitcoin-transaction-builder.d.ts.map +1 -1
  60. package/dist/transaction-builder/bitcoin-transaction-builder.js +5 -4
  61. package/dist/transaction-builder/bitcoin-transaction-builder.js.map +1 -1
  62. package/dist/transaction-builder/index.d.ts +2 -1
  63. package/dist/transaction-builder/index.d.ts.map +1 -1
  64. package/dist/transaction-builder/index.js +2 -6
  65. package/dist/transaction-builder/index.js.map +1 -1
  66. package/dist/transaction-builder/ordinal-transaction-builder.d.ts +63 -0
  67. package/dist/transaction-builder/ordinal-transaction-builder.d.ts.map +1 -0
  68. package/dist/transaction-builder/ordinal-transaction-builder.js +131 -0
  69. package/dist/transaction-builder/ordinal-transaction-builder.js.map +1 -0
  70. package/dist/transaction-builder/transaction-builder.d.ts +10 -7
  71. package/dist/transaction-builder/transaction-builder.d.ts.map +1 -1
  72. package/dist/transaction-builder/transaction-builder.js +18 -9
  73. package/dist/transaction-builder/transaction-builder.js.map +1 -1
  74. package/dist/type.d.ts +43 -0
  75. package/dist/type.d.ts.map +1 -0
  76. package/dist/type.js +3 -0
  77. package/dist/type.js.map +1 -0
  78. package/dist/utils/tools.d.ts +4 -4
  79. package/dist/utils/tools.d.ts.map +1 -1
  80. package/dist/utils/tools.js +8 -5
  81. package/dist/utils/tools.js.map +1 -1
  82. package/package.json +6 -9
  83. package/src/bitcoin-interface-ordinal.ts +181 -0
  84. package/src/bitcoin-interface-teleswap.ts +255 -0
  85. package/src/bitcoin-interface-utils.ts +1 -1
  86. package/src/bitcoin-interface.ts +99 -303
  87. package/src/bitcoin-utils.ts +65 -90
  88. package/src/{bitcoin-base.ts → bitcoin-wallet-base.ts} +24 -19
  89. package/src/helper/brc20-helper.ts +181 -0
  90. package/src/helper/index.ts +3 -0
  91. package/src/helper/ordinal-helper.ts +118 -0
  92. package/src/helper/teleswap-helper.ts +300 -0
  93. package/src/index.ts +11 -3
  94. package/src/ordinal-wallet.ts +738 -0
  95. package/src/sign/sign-transaction.ts +42 -33
  96. package/src/teleswap-wallet.ts +155 -0
  97. package/src/transaction-builder/bitcoin-transaction-builder.ts +7 -24
  98. package/src/transaction-builder/index.ts +2 -1
  99. package/src/transaction-builder/ordinal-transaction-builder.ts +147 -0
  100. package/src/transaction-builder/transaction-builder.ts +33 -15
  101. package/src/type.ts +43 -0
  102. package/src/utils/tools.ts +17 -11
  103. package/tsconfig.json +1 -2
  104. package/dist/bitcoin-base.d.ts.map +0 -1
  105. package/dist/bitcoin-base.js.map +0 -1
  106. package/dist/bitcoin-utils-2.d.ts +0 -2
  107. package/dist/bitcoin-utils-2.d.ts.map +0 -1
  108. package/dist/bitcoin-utils-2.js +0 -13
  109. package/dist/bitcoin-utils-2.js.map +0 -1
  110. package/dist/bundle.js +0 -17
  111. package/dist/helper/burn-request-helper.d.ts +0 -7
  112. package/dist/helper/burn-request-helper.d.ts.map +0 -1
  113. package/dist/helper/burn-request-helper.js +0 -26
  114. package/dist/helper/burn-request-helper.js.map +0 -1
  115. package/dist/helper/teleport-request-helper.d.ts +0 -47
  116. package/dist/helper/teleport-request-helper.d.ts.map +0 -1
  117. package/dist/helper/teleport-request-helper.js +0 -146
  118. package/dist/helper/teleport-request-helper.js.map +0 -1
  119. package/dist/mempool-space.d.ts +0 -69
  120. package/dist/mempool-space.d.ts.map +0 -1
  121. package/dist/mempool-space.js +0 -266
  122. package/dist/mempool-space.js.map +0 -1
  123. package/dist/teleport-dao-payments.d.ts +0 -76
  124. package/dist/teleport-dao-payments.d.ts.map +0 -1
  125. package/dist/teleport-dao-payments.js +0 -217
  126. package/dist/teleport-dao-payments.js.map +0 -1
  127. package/src/helper/burn-request-helper.js +0 -27
  128. package/src/helper/teleport-request-helper.js +0 -181
  129. package/src/teleport-dao-payments.ts +0 -347
package/.tmp/check.ts ADDED
@@ -0,0 +1,101 @@
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
+ })()
@@ -0,0 +1,121 @@
1
+ import { Psbt, crypto, Network } from "bitcoinjs-lib"
2
+ // import BIP32Factory from "bip32"
3
+ import ecc from "@bitcoinerlab/secp256k1"
4
+ import * as bitcoinEcPair from "bitcoinjs-ecpair"
5
+ const ECPair = bitcoinEcPair.ECPair
6
+
7
+ function tapTweakHash(pubKey: Buffer, h?: Buffer) {
8
+ return crypto.taggedHash("TapTweak", Buffer.concat(h ? [pubKey, h] : [pubKey]))
9
+ }
10
+
11
+ function tweakSigner(
12
+ privateKey: Buffer,
13
+ opts = {} as {
14
+ [key: string]: Buffer
15
+ },
16
+ network: Network,
17
+ ) {
18
+ let newPrv = privateKey
19
+ let keyPair = ECPair.fromPrivateKey(privateKey, {
20
+ network: network,
21
+ compressed: true,
22
+ })
23
+
24
+ if (!keyPair.privateKey) throw new Error("private key not exist")
25
+
26
+ if (keyPair.publicKey.toString("hex").startsWith("03")) {
27
+ newPrv = ecc.privateNegate(keyPair.privateKey) as Buffer
28
+ }
29
+
30
+ const tweakedPrivateKey = ecc.privateAdd(
31
+ newPrv,
32
+ tapTweakHash(Buffer.from(keyPair.publicKey.toString("hex").slice(2), "hex"), opts?.tweakHash),
33
+ )
34
+ if (!tweakedPrivateKey) {
35
+ throw new Error("Invalid tweaked private key!")
36
+ }
37
+
38
+ return ECPair.fromPrivateKey(Buffer.from(tweakedPrivateKey), {
39
+ network: network,
40
+ })
41
+ }
42
+
43
+ class BitcoinLikeSignTransaction {
44
+ network: Network
45
+ constructor(network: Network) {
46
+ this.network = network
47
+ }
48
+
49
+ async signPsbt(
50
+ unsignedPsbt: {
51
+ unsignedTransaction: string
52
+ },
53
+ privateKey: Buffer,
54
+ ) {
55
+ const { network } = this
56
+ const keyPair = ECPair.fromPrivateKey(privateKey, {
57
+ network,
58
+ compressed: true,
59
+ })
60
+ const psbt = Psbt.fromBase64(unsignedPsbt.unsignedTransaction, {
61
+ network,
62
+ })
63
+
64
+ let numberOfInputs = psbt.inputCount
65
+
66
+ for (let i = 0; i < numberOfInputs; i += 1) {
67
+ let type = psbt.getInputType(i)
68
+ if (type === "nonstandard") {
69
+ let a = tweakSigner(privateKey, undefined, this.network)
70
+ await psbt.signInputAsync(i, a)
71
+ } else {
72
+ await psbt.signInputAsync(i, keyPair)
73
+ }
74
+ }
75
+
76
+ // psbt.signAllInputs(keyPair)
77
+ const partialSigendPsbt = psbt.toBase64()
78
+ return partialSigendPsbt
79
+ }
80
+
81
+ finalizePsbts(psbtsBase64: string[] = []) {
82
+ const finals = psbtsBase64.map((psbtBase64) =>
83
+ Psbt.fromBase64(psbtBase64, { network: this.network }),
84
+ )
85
+ const psbt =
86
+ finals.length === 1 ? finals[0] : new Psbt({ network: this.network }).combine(...finals)
87
+
88
+ let newPsbt = new Psbt({ network: this.network })
89
+ newPsbt.addOutputs(psbt.txOutputs)
90
+
91
+ // newPsbt.addInputs(
92
+ // psbt.txInputs.map((txIn, i) => ({
93
+ // ...txIn,
94
+ // partialSig: psbt.data.inputs[i].partialSig,
95
+ // witnessUtxo: psbt.data.inputs[i].witnessUtxo,
96
+ // })),
97
+ // )
98
+ newPsbt.addInputs(
99
+ psbt.txInputs.map((txIn, i) => ({
100
+ ...txIn,
101
+ ...psbt.data.inputs[i],
102
+ })),
103
+ ).addInput
104
+
105
+ psbt.finalizeAllInputs()
106
+
107
+ for (let i = 0; i < psbt.txInputs.length; i += 1) {
108
+ // console.log(psbt.data.inputs[i])
109
+ }
110
+
111
+ newPsbt.finalizeAllInputs()
112
+
113
+ let finalizeTx = newPsbt.extractTransaction()
114
+ // console.log(finalizeTx.getId())
115
+
116
+ // console.log(finalizeTx.ins, finalizeTx.outs)
117
+ return finalizeTx.toHex()
118
+ }
119
+ }
120
+
121
+ export default BitcoinLikeSignTransaction
package/.tmp/rbf.ts ADDED
@@ -0,0 +1,45 @@
1
+ import { sleep } from "../dist/utils/tools"
2
+ import { BitcoinBase, TeleportDaoPayment, TransferRequest } from "@teleportdao/bitcoin"
3
+ import { parseRawTransaction } from "../dist/bitcoin-utils"
4
+ require("dotenv").config()
5
+ ;(async () => {
6
+ let btc = new TeleportDaoPayment("bitcoin_testnet", {
7
+ api: {
8
+ enabled: true,
9
+ provider: "MempoolSpace",
10
+ },
11
+ })
12
+ btc.setAccountPrivateKeyByMnemonic({
13
+ mnemonic: process.env.ACCOUNT__MNEMONIC!,
14
+ index: 2,
15
+ addressType: "p2wpkh",
16
+ })
17
+
18
+ console.log(btc.bitcoinAddress)
19
+ let balance = await btc.btcInterface.getBalance(btc.bitcoinAddress!)
20
+
21
+ console.log(balance)
22
+
23
+ let txId = await btc.send({
24
+ receiverAddress: btc.bitcoinAddress!,
25
+ fullAmount: true,
26
+ amount: 0,
27
+ })
28
+
29
+ console.log(txId)
30
+ await sleep(5_000)
31
+
32
+ // const txId = "a4335df47c09cc983d0ba56373212b86c266ea434bb87d610ae5c892da79e1b7"
33
+
34
+ let unsigned = await btc.increaseTransactionFeeUnsignedPsbt(
35
+ txId,
36
+ [btc.signerInfo!],
37
+ [],
38
+ btc.bitcoinAddress!,
39
+ 5,
40
+ )
41
+ let signedPsbt = await btc.signer.signPsbt(unsigned, btc.privateKey!)
42
+ let txIdNew = await btc.sendSignedPsbt(signedPsbt)
43
+
44
+ console.log(txIdNew)
45
+ })()
@@ -0,0 +1,109 @@
1
+ import { bitcoin as bitcoinProviders } from "@teleportdao/providers";
2
+ import { BitcoinInterface } from "./bitcoin-interface";
3
+ import { Transaction, BitcoinConnectionInfo } from "./type";
4
+ import type { SignerInfo } from "./transaction-builder";
5
+ export declare class BitcoinInterfaceOrdinal extends BitcoinInterface {
6
+ unisat: bitcoinProviders.UniSat;
7
+ constructor(connectionInfo: BitcoinConnectionInfo, networkName: string, uniSatToken: string);
8
+ getInscriptionWithRetry(inscriptionId: string, { numberOfRetry, sleepTime }?: {
9
+ numberOfRetry?: number | undefined;
10
+ sleepTime?: number | undefined;
11
+ }): Promise<bitcoinProviders.UnisatInscription | null>;
12
+ getTransactionBrc20TransferInfo(transaction: {
13
+ txId: string;
14
+ vout: {
15
+ address: string | null;
16
+ script: string;
17
+ value: number;
18
+ }[];
19
+ vin: {
20
+ txId: string;
21
+ index: number;
22
+ address?: string | null;
23
+ script?: string | null;
24
+ value?: number | null;
25
+ }[];
26
+ }): Promise<{
27
+ txId: string;
28
+ receiver: string;
29
+ index: number;
30
+ brc20: {
31
+ op: string;
32
+ tick: string;
33
+ lim: string;
34
+ amt: string;
35
+ decimal: string;
36
+ };
37
+ inscription: bitcoinProviders.UnisatInscription;
38
+ }[]>;
39
+ convertToBrc20WrapRequest(transaction: Transaction, lockerAddress: string): Promise<{
40
+ transaction: Transaction;
41
+ request: {
42
+ status: boolean;
43
+ data?: import("./helper/brc20-helper").WrapOpReturnAndType | undefined;
44
+ dataOutputIndex?: number | undefined;
45
+ lockerFeeValue?: number | undefined;
46
+ lockerFeeOutputIndex?: number | undefined;
47
+ brc20OutputIndex?: number | undefined;
48
+ brc20OutputValue?: number | undefined;
49
+ message?: string | undefined;
50
+ code?: string | undefined;
51
+ };
52
+ lockerAddress: string;
53
+ lockerLockingScript: string;
54
+ }>;
55
+ getBrc20WrapRequests(addresses: string[], startblockNumber: number, endBlockNumber: number): Promise<{
56
+ requests: {
57
+ brc20: {
58
+ op: string;
59
+ tick: string;
60
+ lim: string;
61
+ amt: string;
62
+ decimal: string;
63
+ };
64
+ transaction: Transaction;
65
+ request: {
66
+ status: boolean;
67
+ data?: import("./helper/brc20-helper").WrapOpReturnAndType | undefined;
68
+ dataOutputIndex?: number | undefined;
69
+ lockerFeeValue?: number | undefined;
70
+ lockerFeeOutputIndex?: number | undefined;
71
+ brc20OutputIndex?: number | undefined;
72
+ brc20OutputValue?: number | undefined;
73
+ message?: string | undefined;
74
+ code?: string | undefined;
75
+ };
76
+ lockerAddress: string;
77
+ lockerLockingScript: string;
78
+ }[];
79
+ invalidRequests: {
80
+ transaction: Transaction;
81
+ request: {
82
+ status: boolean;
83
+ data?: import("./helper/brc20-helper").WrapOpReturnAndType | undefined;
84
+ dataOutputIndex?: number | undefined;
85
+ lockerFeeValue?: number | undefined;
86
+ lockerFeeOutputIndex?: number | undefined;
87
+ brc20OutputIndex?: number | undefined;
88
+ brc20OutputValue?: number | undefined;
89
+ message?: string | undefined;
90
+ code?: string | undefined;
91
+ };
92
+ lockerAddress: string;
93
+ lockerLockingScript: string;
94
+ }[];
95
+ }>;
96
+ getBTCUtxo(address: string, signerInfo: SignerInfo): Promise<{
97
+ hash: string;
98
+ index: number;
99
+ value: number;
100
+ signerInfo: SignerInfo;
101
+ }[]>;
102
+ getInscriptionUtxo(address: string, signerInfo: SignerInfo): Promise<{
103
+ hash: string;
104
+ index: number;
105
+ value: number;
106
+ signerInfo: SignerInfo;
107
+ }[]>;
108
+ }
109
+ //# sourceMappingURL=bitcoin-interface-ordinal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bitcoin-interface-ordinal.d.ts","sourceRoot":"","sources":["../src/bitcoin-interface-ordinal.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAA;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAKvD,qBAAa,uBAAwB,SAAQ,gBAAgB;IAC3D,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAA;gBACnB,cAAc,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IASrF,uBAAuB,CAC3B,aAAa,EAAE,MAAM,EACrB,EAAE,aAAiB,EAAE,SAAiB,EAAE;;;KAAK;IAkBzC,+BAA+B,CAAC,WAAW,EAAE;QACjD,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE;YACJ,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;YACtB,MAAM,EAAE,MAAM,CAAA;YACd,KAAK,EAAE,MAAM,CAAA;SACd,EAAE,CAAA;QACH,GAAG,EAAE;YACH,IAAI,EAAE,MAAM,CAAA;YACZ,KAAK,EAAE,MAAM,CAAA;YACb,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;YACvB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;YACtB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;SACtB,EAAE,CAAA;KACJ;cAES,MAAM;kBACF,MAAM;eACT,MAAM;eACN;YACL,EAAE,EAAE,MAAM,CAAA;YACV,IAAI,EAAE,MAAM,CAAA;YACZ,GAAG,EAAE,MAAM,CAAA;YACX,GAAG,EAAE,MAAM,CAAA;YACX,OAAO,EAAE,MAAM,CAAA;SAChB;qBACY,iBAAiB,iBAAiB;;IA2B7C,yBAAyB,CAAC,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM;;;;;;;;;;;;;;;;IAezE,oBAAoB,CACxB,SAAS,EAAE,MAAM,EAAE,EACnB,gBAAgB,EAAE,MAAM,EACxB,cAAc,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgDlB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU;;;;;;IAWlD,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU;;;;;;CAUjE"}
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.BitcoinInterfaceOrdinal = void 0;
16
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
17
+ const providers_1 = require("@teleportdao/providers");
18
+ const bitcoin_interface_1 = require("./bitcoin-interface");
19
+ const tools_1 = require("./utils/tools");
20
+ const brc20_helper_1 = require("./helper/brc20-helper");
21
+ class BitcoinInterfaceOrdinal extends bitcoin_interface_1.BitcoinInterface {
22
+ constructor(connectionInfo, networkName, uniSatToken) {
23
+ super(connectionInfo, networkName);
24
+ this.unisat = new providers_1.bitcoin.UniSat({
25
+ token: uniSatToken,
26
+ }, networkName.includes("testnet"));
27
+ }
28
+ getInscriptionWithRetry(inscriptionId, { numberOfRetry = 5, sleepTime = 20000 } = {}) {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ let count = 0;
31
+ while (count <= numberOfRetry) {
32
+ try {
33
+ let inscription = yield this.unisat.getInscriptionInfo(inscriptionId);
34
+ if (inscription === null || inscription === void 0 ? void 0 : inscription.brc20) {
35
+ return inscription;
36
+ }
37
+ }
38
+ catch (e) {
39
+ console.log(e.message);
40
+ }
41
+ yield (0, tools_1.sleep)(sleepTime + count * 5000);
42
+ count += 1;
43
+ }
44
+ return null;
45
+ });
46
+ }
47
+ getTransactionBrc20TransferInfo(transaction) {
48
+ var _a;
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ let txBrc20s = [];
51
+ for (let x = 0; x < transaction.vout.length - 1; x += 1) {
52
+ if (!transaction.vout[x].address) {
53
+ return [];
54
+ }
55
+ let inscription = yield this.unisat.getInscriptionInfo(`${transaction.vin[x].txId}i${transaction.vin[x].index}`);
56
+ const brc20 = ((_a = inscription === null || inscription === void 0 ? void 0 : inscription.brc20) === null || _a === void 0 ? void 0 : _a.op) === "transfer" ? inscription.brc20 : undefined;
57
+ if (brc20 && inscription) {
58
+ txBrc20s.push({
59
+ txId: transaction.txId,
60
+ receiver: transaction.vout[x].address,
61
+ index: x,
62
+ inscription,
63
+ brc20,
64
+ });
65
+ }
66
+ else {
67
+ return [];
68
+ }
69
+ }
70
+ return txBrc20s;
71
+ });
72
+ }
73
+ convertToBrc20WrapRequest(transaction, lockerAddress) {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ let { vout } = transaction;
76
+ let request = (0, brc20_helper_1.checkAndParseBrc20Request)(vout, lockerAddress);
77
+ let lockerLockingScript = transaction.addressScript ||
78
+ this.convertAddressToScript(lockerAddress).script.toString("hex");
79
+ return {
80
+ transaction,
81
+ request,
82
+ lockerAddress,
83
+ lockerLockingScript,
84
+ };
85
+ });
86
+ }
87
+ getBrc20WrapRequests(addresses, startblockNumber, endBlockNumber) {
88
+ var _a, _b, _c, _d, _e, _f, _g;
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ let transactions = yield this.getMultipleBlocksTransactions(addresses, startblockNumber, endBlockNumber || (yield this.getLatestBlockNumber()));
91
+ let requests = [];
92
+ let invalidRequests = [];
93
+ for (let inputTx of transactions) {
94
+ let data = yield this.convertToBrc20WrapRequest(inputTx, inputTx.address);
95
+ if (data.request.status) {
96
+ let inscription = yield this.getInscriptionWithRetry(`${inputTx.vin[0].txId}i${inputTx.vin[0].index}`);
97
+ const brc20 = ((_a = inscription === null || inscription === void 0 ? void 0 : inscription.brc20) === null || _a === void 0 ? void 0 : _a.op) === "transfer" ? inscription.brc20 : undefined;
98
+ if (!brc20) {
99
+ invalidRequests.push(Object.assign(Object.assign({}, data), { message: `invalid brc20 -> ${(_b = inscription === null || inscription === void 0 ? void 0 : inscription.brc20) === null || _b === void 0 ? void 0 : _b.op}:${(_c = inscription === null || inscription === void 0 ? void 0 : inscription.brc20) === null || _c === void 0 ? void 0 : _c.amt}` }));
100
+ }
101
+ else if (!(0, bignumber_js_1.default)(brc20.amt)
102
+ .multipliedBy(1e18)
103
+ .isEqualTo(((_d = data.request.data) === null || _d === void 0 ? void 0 : _d.inputAmount) || 0)) {
104
+ invalidRequests.push(Object.assign(Object.assign({}, data), { message: `invalid brc20 amount -> ${(_e = inscription === null || inscription === void 0 ? void 0 : inscription.brc20) === null || _e === void 0 ? void 0 : _e.op}:${(_f = inscription === null || inscription === void 0 ? void 0 : inscription.brc20) === null || _f === void 0 ? void 0 : _f.amt}:${(_g = data.request.data) === null || _g === void 0 ? void 0 : _g.inputAmount}` }));
105
+ }
106
+ else {
107
+ requests.push(Object.assign(Object.assign({}, data), { brc20 }));
108
+ }
109
+ }
110
+ else if (data.request.code !== "NO_OP_RETURN") {
111
+ invalidRequests.push(data);
112
+ }
113
+ }
114
+ return { requests, invalidRequests };
115
+ });
116
+ }
117
+ getBTCUtxo(address, signerInfo) {
118
+ var _a;
119
+ return __awaiter(this, void 0, void 0, function* () {
120
+ return providers_1.bitcoin.UniSat.convertToNormalUtxo(((_a = (yield this.unisat.getBTCUtxo(address))) === null || _a === void 0 ? void 0 : _a.utxo) || []).map(({ txId, index, value }) => ({
121
+ hash: txId,
122
+ index,
123
+ value,
124
+ signerInfo,
125
+ }));
126
+ });
127
+ }
128
+ getInscriptionUtxo(address, signerInfo) {
129
+ var _a;
130
+ return __awaiter(this, void 0, void 0, function* () {
131
+ return providers_1.bitcoin.UniSat.convertToNormalUtxo(((_a = (yield this.unisat.getInscriptionUtxo(address))) === null || _a === void 0 ? void 0 : _a.utxo) || []).map(({ txId, index, value }) => ({
132
+ hash: txId,
133
+ index,
134
+ value,
135
+ signerInfo,
136
+ }));
137
+ });
138
+ }
139
+ }
140
+ exports.BitcoinInterfaceOrdinal = BitcoinInterfaceOrdinal;
141
+ //# sourceMappingURL=bitcoin-interface-ordinal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bitcoin-interface-ordinal.js","sourceRoot":"","sources":["../src/bitcoin-interface-ordinal.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAAoC;AACpC,sDAAoE;AACpE,2DAAsD;AAItD,yCAAqC;AACrC,wDAAiE;AAEjE,MAAa,uBAAwB,SAAQ,oCAAgB;IAE3D,YAAY,cAAqC,EAAE,WAAmB,EAAE,WAAmB;QACzF,KAAK,CAAC,cAAc,EAAE,WAAW,CAAC,CAAA;QAClC,IAAI,CAAC,MAAM,GAAG,IAAI,mBAAgB,CAAC,MAAM,CACvC;YACE,KAAK,EAAE,WAAW;SACnB,EACD,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,CAChC,CAAA;IACH,CAAC;IACK,uBAAuB,CAC3B,aAAqB,EACrB,EAAE,aAAa,GAAG,CAAC,EAAE,SAAS,GAAG,KAAK,EAAE,GAAG,EAAE;;YAE7C,I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rC;IAEK,UAAU,CAAC,OAAe,EAAE,UAAsB;;;YACtD,OAAO,mBAAgB,CAAC,MAAM,CAAC,mBAAmB,CAChD,CAAA,MAAA,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,0CAAE,IAAI,KAAI,EAAE,CACpD,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;gBACjC,IAAI,EAAE,IAAI;gBACV,KAAK;gBACL,KAAK;gBACL,UAAU;aACX,CAAC,CAAC,CAAA;;KACJ;IAEK,kBAAkB,CAAC,OAAe,EAAE,UAAsB;;;YAC9D,OAAO,mBAAgB,CAAC,MAAM,CAAC,mBAAmB,CAChD,CAAA,MAAA,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,0CAAE,IAAI,KAAI,EAAE,CAC5D,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;gBACjC,IAAI,EAAE,IAAI;gBACV,KAAK;gBACL,KAAK;gBACL,UAAU;aACX,CAAC,CAAC,CAAA;;KACJ;CACF;AA3KD,0DA2KC"}
@@ -0,0 +1,148 @@
1
+ import { bitcoin } from "@teleportdao/providers";
2
+ import { UnwrapInfo, WrapOpReturnWithType } from "./helper/teleswap-helper";
3
+ import BitcoinInterface from "./bitcoin-interface";
4
+ import { Transaction } from "./type";
5
+ export type ValidWrapRequest = {
6
+ transaction: bitcoin.Types.ConfirmedTransaction & {
7
+ address?: string;
8
+ addressScript?: string;
9
+ merkleProof?: Transaction["merkleProof"];
10
+ };
11
+ request: {
12
+ status: boolean;
13
+ data: WrapOpReturnWithType;
14
+ value: number;
15
+ valueOutputIndex: number;
16
+ };
17
+ lockerAddress: string;
18
+ lockerLockingScript: string;
19
+ };
20
+ export type InValidWrapRequest = {
21
+ transaction: bitcoin.Types.ConfirmedTransaction & {
22
+ address?: string;
23
+ addressScript?: string;
24
+ merkleProof?: Transaction["merkleProof"];
25
+ };
26
+ request: {
27
+ status: boolean;
28
+ message: string;
29
+ code: string;
30
+ };
31
+ lockerAddress: string;
32
+ lockerLockingScript: string;
33
+ };
34
+ export type UnwrapRequest = {
35
+ burnInfo: UnwrapInfo | undefined;
36
+ lockerAddress: string;
37
+ lockerLockingScript: string;
38
+ };
39
+ export declare class BitcoinInterfaceTeleswap extends BitcoinInterface {
40
+ getHexBlockHeaders(startBlockNumber: number, endBlockNumber: number): Promise<{
41
+ hexBlockHeaders: string;
42
+ fromBlockNumber: number;
43
+ toBlockNumber: number;
44
+ difficulty: string | null;
45
+ }[]>;
46
+ getWrapRequests(addresses: string[], startblockNumber: number, endBlockNumber: number): Promise<{
47
+ requests: ValidWrapRequest[];
48
+ invalidRequests: InValidWrapRequest[];
49
+ }>;
50
+ getMempoolWrapRequests(addresses: string[]): Promise<{
51
+ requests: {
52
+ transaction: bitcoin.Types.ConfirmedTransaction & {
53
+ address?: string | undefined;
54
+ addressScript?: string | undefined;
55
+ merkleProof?: {
56
+ intermediateNodes: string;
57
+ transactionIndex: number;
58
+ } | undefined;
59
+ };
60
+ request: {
61
+ status: boolean;
62
+ message: string;
63
+ code: string;
64
+ data?: undefined;
65
+ value?: undefined;
66
+ valueOutputIndex?: undefined;
67
+ } | {
68
+ status: true;
69
+ data: WrapOpReturnWithType;
70
+ value: number;
71
+ valueOutputIndex: number;
72
+ message?: undefined;
73
+ code?: undefined;
74
+ };
75
+ lockerAddress: string;
76
+ lockerLockingScript: string;
77
+ }[];
78
+ invalidRequests: {
79
+ transaction: bitcoin.Types.ConfirmedTransaction & {
80
+ address?: string | undefined;
81
+ addressScript?: string | undefined;
82
+ merkleProof?: {
83
+ intermediateNodes: string;
84
+ transactionIndex: number;
85
+ } | undefined;
86
+ };
87
+ request: {
88
+ status: boolean;
89
+ message: string;
90
+ code: string;
91
+ data?: undefined;
92
+ value?: undefined;
93
+ valueOutputIndex?: undefined;
94
+ };
95
+ lockerAddress: string;
96
+ lockerLockingScript: string;
97
+ }[];
98
+ }>;
99
+ getWrapRequestByTx(inputTransaction: {
100
+ txId: string;
101
+ } | (bitcoin.Types.ConfirmedTransaction & {
102
+ address?: string;
103
+ addressScript?: string;
104
+ merkleProof?: Transaction["merkleProof"];
105
+ }), lockerAddress: string, minTeleporterFeeAmount?: number): Promise<{
106
+ transaction: bitcoin.Types.ConfirmedTransaction & {
107
+ address?: string | undefined;
108
+ addressScript?: string | undefined;
109
+ merkleProof?: Transaction["merkleProof"];
110
+ };
111
+ request: {
112
+ status: boolean;
113
+ message: string;
114
+ code: string;
115
+ data?: undefined;
116
+ value?: undefined;
117
+ valueOutputIndex?: undefined;
118
+ } | {
119
+ status: true;
120
+ data: WrapOpReturnWithType;
121
+ value: number;
122
+ valueOutputIndex: number;
123
+ message?: undefined;
124
+ code?: undefined;
125
+ };
126
+ lockerAddress: string;
127
+ lockerLockingScript: string;
128
+ }>;
129
+ getLockersUnWrapTransactions(addresses: string[], startBlockNumber: number, endBlockNumber: number): Promise<{
130
+ transaction: Transaction;
131
+ burnInfo: UnwrapInfo | undefined;
132
+ lockerAddress: string;
133
+ lockerLockingScript: string;
134
+ }[]>;
135
+ getLockersUnwrapMEmpoolTransactions(addresses: string[], startBlockNumber: number, endBlockNumber: number): Promise<{
136
+ transaction: Transaction;
137
+ burnInfo: UnwrapInfo | undefined;
138
+ lockerAddress: string;
139
+ lockerLockingScript: string;
140
+ }[]>;
141
+ getTransactionUnwrapInfoByTx(transaction: {
142
+ txId: any;
143
+ vout?: any;
144
+ vin?: any;
145
+ addressScript?: any;
146
+ }, lockerAddress: string): Promise<UnwrapRequest | undefined>;
147
+ }
148
+ //# sourceMappingURL=bitcoin-interface-teleswap.d.ts.map