@teleportdao/bitcoin 1.7.21 → 1.8.4
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.
- package/.tmp/ordinal-helper.ts +133 -0
- package/.tmp/ordinal.ts +25 -0
- package/.tmp/rbf.ts +27 -24
- package/dist/bitcoin-base.d.ts +93 -0
- package/dist/bitcoin-base.d.ts.map +1 -0
- package/dist/bitcoin-base.js +236 -0
- package/dist/bitcoin-base.js.map +1 -0
- package/dist/helper/brc20-helper.d.ts +1 -1
- package/dist/helper/brc20-helper.d.ts.map +1 -1
- package/dist/helper/brc20-helper.js +2 -3
- package/dist/helper/brc20-helper.js.map +1 -1
- package/dist/helper/burn-request-helper.d.ts +7 -0
- package/dist/helper/burn-request-helper.d.ts.map +1 -0
- package/dist/helper/burn-request-helper.js +26 -0
- package/dist/helper/burn-request-helper.js.map +1 -0
- package/dist/helper/teleport-request-helper.d.ts +47 -0
- package/dist/helper/teleport-request-helper.d.ts.map +1 -0
- package/dist/helper/teleport-request-helper.js +146 -0
- package/dist/helper/teleport-request-helper.js.map +1 -0
- package/dist/teleport-dao-payments.d.ts +76 -0
- package/dist/teleport-dao-payments.d.ts.map +1 -0
- package/dist/teleport-dao-payments.js +217 -0
- package/dist/teleport-dao-payments.js.map +1 -0
- package/package.json +4 -4
- package/src/bitcoin-interface-ordinal.ts +181 -181
- package/src/bitcoin-interface-teleswap.ts +252 -252
- package/src/bitcoin-interface-utils.ts +60 -60
- package/src/bitcoin-interface.ts +241 -241
- package/src/bitcoin-utils.ts +591 -591
- package/src/bitcoin-wallet-base.ts +310 -310
- package/src/helper/brc20-helper.ts +179 -181
- package/src/helper/ordinal-helper.ts +118 -118
- package/src/index.ts +15 -15
- package/src/ordinal-wallet.ts +738 -738
- package/src/sign/index.ts +1 -1
- package/src/sign/sign-transaction.ts +108 -108
- package/src/teleswap-wallet.ts +155 -155
- package/src/transaction-builder/bitcoin-transaction-builder.ts +44 -44
- package/src/transaction-builder/index.ts +3 -3
- package/src/transaction-builder/ordinal-transaction-builder.ts +147 -147
- package/src/transaction-builder/transaction-builder.ts +706 -706
- package/src/type.ts +48 -48
- package/src/utils/networks.ts +33 -33
- package/src/utils/tools.ts +90 -90
- package/tsconfig.json +9 -9
- package/webpack.config.js +16 -16
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import * as bitcoin from "bitcoinjs-lib"
|
|
2
|
+
import ecc from "@bitcoinerlab/secp256k1"
|
|
3
|
+
|
|
4
|
+
bitcoin.initEccLib(ecc)
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line consistent-return
|
|
7
|
+
export function createAddressObjectByScriptNoType(
|
|
8
|
+
script: Buffer,
|
|
9
|
+
network: bitcoin.Network = bitcoin.networks.bitcoin,
|
|
10
|
+
) {
|
|
11
|
+
let addressObject: bitcoin.payments.Payment
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
addressObject = bitcoin.payments.p2pkh({
|
|
15
|
+
output: script,
|
|
16
|
+
network,
|
|
17
|
+
})
|
|
18
|
+
if (addressObject.address) {
|
|
19
|
+
return {
|
|
20
|
+
addressObject,
|
|
21
|
+
addressType: "p2pkh",
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
} catch (err) {
|
|
25
|
+
/* empty */
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
addressObject = bitcoin.payments.p2wpkh({
|
|
30
|
+
output: script,
|
|
31
|
+
network,
|
|
32
|
+
})
|
|
33
|
+
if (addressObject.address) {
|
|
34
|
+
return {
|
|
35
|
+
addressObject,
|
|
36
|
+
addressType: "p2wpkh",
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
} catch (err) {
|
|
40
|
+
/* empty */
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
addressObject = bitcoin.payments.p2sh({
|
|
45
|
+
output: script,
|
|
46
|
+
network,
|
|
47
|
+
})
|
|
48
|
+
if (addressObject.address) {
|
|
49
|
+
return {
|
|
50
|
+
addressObject,
|
|
51
|
+
addressType: "p2sh",
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
} catch (err) {
|
|
55
|
+
/* empty */
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
addressObject = bitcoin.payments.p2wsh({
|
|
60
|
+
output: script,
|
|
61
|
+
network,
|
|
62
|
+
})
|
|
63
|
+
if (addressObject.address) {
|
|
64
|
+
return {
|
|
65
|
+
addressObject,
|
|
66
|
+
addressType: "p2wsh",
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
} catch (err) {
|
|
70
|
+
/* empty */
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
addressObject = bitcoin.payments.p2tr({
|
|
75
|
+
output: script,
|
|
76
|
+
network,
|
|
77
|
+
})
|
|
78
|
+
if (addressObject.address) {
|
|
79
|
+
return {
|
|
80
|
+
addressObject,
|
|
81
|
+
addressType: "p2tr",
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
} catch (err) {
|
|
85
|
+
/* empty */
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function splitBuffer(buffer: Buffer, partLength: number) {
|
|
90
|
+
const parts: Buffer[] = []
|
|
91
|
+
for (let i = 0; i < buffer.length; i += partLength) {
|
|
92
|
+
const part = buffer.subarray(i, i + partLength)
|
|
93
|
+
parts.push(part)
|
|
94
|
+
}
|
|
95
|
+
return parts
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function getOrdinalScript(
|
|
99
|
+
file: { buffer: Buffer; type: string },
|
|
100
|
+
internalPublicKeyHex: string,
|
|
101
|
+
) {
|
|
102
|
+
let bufferParts = splitBuffer(file.buffer, 520)
|
|
103
|
+
// const splittedFileHex = bufferParts.map((part) => part.toString("hex")).join(" ")
|
|
104
|
+
// const script = `${internalPublicKeyHex} OP_CHECKSIG OP_FALSE OP_IF ${ORDINAL_ORD_HEX} 00000000000000000000 ${fileTypeHex} OP_0 ${splittedFileHex} OP_ENDIF`
|
|
105
|
+
|
|
106
|
+
// ? bitcoinjs-lib converts "OP_PUSH 1" to "0x51" instead of "0x0101" as required by the ordinal protocol
|
|
107
|
+
// ? so we push 00000000000000000000 instead of 1 and then replace 0a00000000000000000000 with 0101
|
|
108
|
+
let leafScript = bitcoin.script.compile([
|
|
109
|
+
Buffer.from(internalPublicKeyHex, "hex"),
|
|
110
|
+
bitcoin.opcodes.OP_CHECKSIG,
|
|
111
|
+
bitcoin.opcodes.OP_FALSE,
|
|
112
|
+
bitcoin.opcodes.OP_IF,
|
|
113
|
+
Buffer.from("ord", "utf8"),
|
|
114
|
+
// instead of 1 we push 00000000000000000000
|
|
115
|
+
Buffer.from("00000000000000000000", "hex"),
|
|
116
|
+
//
|
|
117
|
+
Buffer.from(file.type!, "utf8"),
|
|
118
|
+
bitcoin.opcodes.OP_0,
|
|
119
|
+
...bufferParts,
|
|
120
|
+
bitcoin.opcodes.OP_ENDIF,
|
|
121
|
+
])
|
|
122
|
+
|
|
123
|
+
leafScript = Buffer.from(
|
|
124
|
+
leafScript.toString("hex").replace("0a00000000000000000000", "0101"),
|
|
125
|
+
"hex",
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
return leafScript
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function toXOnly(pubKey: Buffer) {
|
|
132
|
+
return pubKey.length === 32 ? pubKey : pubKey.subarray(1, 33)
|
|
133
|
+
}
|
package/.tmp/ordinal.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { OrdinalWallet } from "../"
|
|
2
|
+
import getAndDecryptAccount from "@teleportdao/teleswap-nodes/src/config/account"
|
|
3
|
+
|
|
4
|
+
require("dotenv").config()
|
|
5
|
+
|
|
6
|
+
import blockchainConfig from "@teleportdao/teleswap-nodes/src/config/blockchain.config"
|
|
7
|
+
;(async () => {
|
|
8
|
+
const account = await getAndDecryptAccount()
|
|
9
|
+
|
|
10
|
+
let btc = new OrdinalWallet("bitcoin", "", blockchainConfig.sourceNetwork.connection)
|
|
11
|
+
btc.setAccountPrivateKeyByMnemonic({
|
|
12
|
+
mnemonic: account.mnemonic,
|
|
13
|
+
index: 2,
|
|
14
|
+
addressType: "p2wpkh",
|
|
15
|
+
})
|
|
16
|
+
const x = btc.transactionBuilder.createOrdinalAddress(
|
|
17
|
+
{
|
|
18
|
+
buffer: Buffer.from("Hello World", "utf8"),
|
|
19
|
+
type: "text/plain",
|
|
20
|
+
},
|
|
21
|
+
btc.publicKey!,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
console.log(x)
|
|
25
|
+
})()
|
package/.tmp/rbf.ts
CHANGED
|
@@ -1,42 +1,45 @@
|
|
|
1
|
-
import blockchainConfig from "@teleportdao/teleswap-nodes/src/config/blockchain.config"
|
|
2
|
-
import getAndDecryptAccount from "@teleportdao/teleswap-nodes/src/config/account"
|
|
3
1
|
import { sleep } from "../dist/utils/tools"
|
|
4
|
-
import {
|
|
2
|
+
import { BitcoinBase, TeleportDaoPayment, TransferRequest } from "@teleportdao/bitcoin"
|
|
5
3
|
import { parseRawTransaction } from "../dist/bitcoin-utils"
|
|
6
|
-
|
|
7
4
|
require("dotenv").config()
|
|
8
5
|
;(async () => {
|
|
9
|
-
let btc = new
|
|
6
|
+
let btc = new TeleportDaoPayment("bitcoin_testnet", {
|
|
10
7
|
api: {
|
|
8
|
+
enabled: true,
|
|
11
9
|
provider: "MempoolSpace",
|
|
12
10
|
},
|
|
13
11
|
})
|
|
14
|
-
|
|
15
|
-
const account = await getAndDecryptAccount()
|
|
16
12
|
btc.setAccountPrivateKeyByMnemonic({
|
|
17
|
-
mnemonic:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
addressType: "p2tr",
|
|
13
|
+
mnemonic: process.env.ACCOUNT__MNEMONIC!,
|
|
14
|
+
index: 2,
|
|
15
|
+
addressType: "p2wpkh",
|
|
21
16
|
})
|
|
22
17
|
|
|
23
18
|
console.log(btc.bitcoinAddress)
|
|
19
|
+
let balance = await btc.btcInterface.getBalance(btc.bitcoinAddress!)
|
|
24
20
|
|
|
25
|
-
|
|
21
|
+
console.log(balance)
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
btc.transactionBuilder.getOpReturnTarget("0x0101010101"),
|
|
32
|
-
btc.transactionBuilder.getOpReturnTarget("0x0202020202"),
|
|
33
|
-
],
|
|
34
|
-
changeAddress: btc.bitcoinAddress!,
|
|
35
|
-
fullAmount: false,
|
|
23
|
+
let txId = await btc.send({
|
|
24
|
+
receiverAddress: btc.bitcoinAddress!,
|
|
25
|
+
fullAmount: true,
|
|
26
|
+
amount: 0,
|
|
36
27
|
})
|
|
37
28
|
|
|
38
|
-
const signedTx = await btc.signer.signPsbt(unsignedTx, btc.privateKey!)
|
|
39
|
-
const txId = await btc.sendSignedPsbt(signedTx)
|
|
40
|
-
|
|
41
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)
|
|
42
45
|
})()
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import TransactionBuilder, { BitcoinConnectionInfo } from "./transaction-builder/bitcoin-transaction-builder";
|
|
3
|
+
import type { ExtendedUtxo, SignerInfo, Target } from "./transaction-builder/transaction-builder";
|
|
4
|
+
import BitcoinSign from "./sign/sign-transaction";
|
|
5
|
+
import { Network, Payment } from "bitcoinjs-lib";
|
|
6
|
+
import { BitcoinInterface } from "./bitcoin-interface";
|
|
7
|
+
declare class BitcoinBase {
|
|
8
|
+
network: Network;
|
|
9
|
+
hdWalletPath: {
|
|
10
|
+
p2pkh: string;
|
|
11
|
+
p2wpkh: string;
|
|
12
|
+
"p2sh-p2wpkh": string;
|
|
13
|
+
p2sh: string;
|
|
14
|
+
p2wsh: string;
|
|
15
|
+
"p2sh-p2wsh": string;
|
|
16
|
+
p2tr: string;
|
|
17
|
+
};
|
|
18
|
+
transactionBuilder: TransactionBuilder;
|
|
19
|
+
btcInterface: BitcoinInterface;
|
|
20
|
+
signer: BitcoinSign;
|
|
21
|
+
currentAccount?: string;
|
|
22
|
+
currentAccountType?: string;
|
|
23
|
+
privateKey?: Buffer;
|
|
24
|
+
publicKey?: Buffer;
|
|
25
|
+
publicKeys?: Buffer[];
|
|
26
|
+
addressObj?: Payment;
|
|
27
|
+
bitcoinAddress: string | undefined;
|
|
28
|
+
constructor(networkName: string, connectionInfo?: BitcoinConnectionInfo);
|
|
29
|
+
get signerInfo(): {
|
|
30
|
+
address: string;
|
|
31
|
+
publicKey: string;
|
|
32
|
+
addressType: string;
|
|
33
|
+
} | undefined;
|
|
34
|
+
createTransactionInputsAndOutputs({ targets, extendedUtxo, changeAddress, feeRate, }: {
|
|
35
|
+
targets: Target[];
|
|
36
|
+
extendedUtxo: ExtendedUtxo[];
|
|
37
|
+
changeAddress: string;
|
|
38
|
+
feeRate: number;
|
|
39
|
+
fullAmount?: boolean;
|
|
40
|
+
}): {
|
|
41
|
+
inputs: ExtendedUtxo[];
|
|
42
|
+
fee: number;
|
|
43
|
+
outputs: Target[];
|
|
44
|
+
change: import("./transaction-builder/transaction-builder").ChangeTarget | undefined;
|
|
45
|
+
};
|
|
46
|
+
checkBalanceIsSufficient({ targets, extendedUtxo, changeAddress, feeRate, fullAmount, }: {
|
|
47
|
+
targets: Target[];
|
|
48
|
+
extendedUtxo: ExtendedUtxo[];
|
|
49
|
+
changeAddress: string;
|
|
50
|
+
feeRate: number;
|
|
51
|
+
fullAmount?: boolean;
|
|
52
|
+
}): boolean;
|
|
53
|
+
setMultiSigAccount(accountType?: string): void;
|
|
54
|
+
setAccountPrivateKey(privateKeyHex: string): void;
|
|
55
|
+
setAccountPublicKey(publicKeyHex: string): void;
|
|
56
|
+
setAccountPrivateKeyByMnemonic({ mnemonic, mnemonicPassword, index, walletNumber, addressType, }: {
|
|
57
|
+
mnemonic: string;
|
|
58
|
+
mnemonicPassword?: string;
|
|
59
|
+
index?: number;
|
|
60
|
+
walletNumber?: number;
|
|
61
|
+
addressType?: string;
|
|
62
|
+
}): string | undefined;
|
|
63
|
+
setAccount(accountType?: string): string | undefined;
|
|
64
|
+
getExtendedUtxo(input: SignerInfo): Promise<{
|
|
65
|
+
signerInfo: SignerInfo;
|
|
66
|
+
hash: string;
|
|
67
|
+
value: number;
|
|
68
|
+
index: number;
|
|
69
|
+
}[]>;
|
|
70
|
+
send({ receiverAddress, amount, fullAmount, speed, }: {
|
|
71
|
+
receiverAddress: string;
|
|
72
|
+
amount: number;
|
|
73
|
+
fullAmount?: boolean;
|
|
74
|
+
speed?: "normal" | "fast" | "slow";
|
|
75
|
+
}): Promise<string>;
|
|
76
|
+
sendSignedPsbt(signedPsbt: string): Promise<string>;
|
|
77
|
+
sendSignedTx(signedTx: string): Promise<string>;
|
|
78
|
+
sendMultiSignedPsbt(signedPsbts?: string[]): Promise<string>;
|
|
79
|
+
increaseTransactionFeeUnsignedPsbt(txId: string, signerInfos: SignerInfo[], extraExtendedUtxo: ExtendedUtxo[], changeAddress: string, staticFeeRate?: number): Promise<{
|
|
80
|
+
unsignedTransaction: string;
|
|
81
|
+
outputs: Target[];
|
|
82
|
+
inputs: {
|
|
83
|
+
hash: string;
|
|
84
|
+
value: number;
|
|
85
|
+
index: number;
|
|
86
|
+
signerInfo: SignerInfo;
|
|
87
|
+
}[];
|
|
88
|
+
fee: number;
|
|
89
|
+
change: import("./transaction-builder/transaction-builder").ChangeTarget | undefined;
|
|
90
|
+
}>;
|
|
91
|
+
}
|
|
92
|
+
export { BitcoinBase };
|
|
93
|
+
//# sourceMappingURL=bitcoin-base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitcoin-base.d.ts","sourceRoot":"","sources":["../src/bitcoin-base.ts"],"names":[],"mappings":";AAAA,OAAO,kBAAkB,EAAE,EACzB,qBAAqB,EACtB,MAAM,mDAAmD,CAAA;AAE1D,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAA;AACjG,OAAO,WAAW,MAAM,yBAAyB,CAAA;AAMjD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAQ,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAOtD,cAAM,WAAW;IACf,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE;QACZ,KAAK,EAAE,MAAM,CAAA;QACb,MAAM,EAAE,MAAM,CAAA;QACd,aAAa,EAAE,MAAM,CAAA;QACrB,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,MAAM,CAAA;QACb,YAAY,EAAE,MAAM,CAAA;QACpB,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD,kBAAkB,EAAE,kBAAkB,CAAA;IACtC,YAAY,EAAE,gBAAgB,CAAA;IAC9B,MAAM,EAAE,WAAW,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,cA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AM,CAAA;QACd,UAAU,CAAC,EAAE,OAAO,CAAA;QACpB,KAAK,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAA;KACnC;IA+BK,cAAc,CAAC,UAAU,EAAE,MAAM;IAMjC,YAAY,CAAC,QAAQ,EAAE,MAAM;IAK7B,mBAAmB,CAAC,WAAW,GAAE,MAAM,EAAO;IAM9C,kCAAkC,CACtC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,UAAU,EAAE,EACzB,iBAAiB,EAAE,YAAY,EAAE,EACjC,aAAa,EAAE,MAAM,EACrB,aAAa,CAAC,EAAE,MAAM;;;;;;;;;;;;CAyCzB;AACD,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.BitcoinBase = void 0;
|
|
39
|
+
const bitcoin_transaction_builder_1 = __importDefault(require("./transaction-builder/bitcoin-transaction-builder"));
|
|
40
|
+
const sign_transaction_1 = __importDefault(require("./sign/sign-transaction"));
|
|
41
|
+
const bip39 = __importStar(require("bip39"));
|
|
42
|
+
const configs_1 = require("@teleportdao/configs");
|
|
43
|
+
const bitcoin_utils_1 = require("./bitcoin-utils");
|
|
44
|
+
const networks_1 = __importDefault(require("./utils/networks"));
|
|
45
|
+
const bip32_1 = __importDefault(require("bip32"));
|
|
46
|
+
const secp256k1_1 = __importDefault(require("@bitcoinerlab/secp256k1"));
|
|
47
|
+
const bip32 = (0, bip32_1.default)(secp256k1_1.default);
|
|
48
|
+
class BitcoinBase {
|
|
49
|
+
constructor(networkName, connectionInfo = {
|
|
50
|
+
api: {
|
|
51
|
+
enabled: true,
|
|
52
|
+
provider: "BlockStream",
|
|
53
|
+
},
|
|
54
|
+
}) {
|
|
55
|
+
this.network = networks_1.default[networkName];
|
|
56
|
+
this.hdWalletPath = configs_1.hdWalletPath.bitcoin;
|
|
57
|
+
this.transactionBuilder = new bitcoin_transaction_builder_1.default(connectionInfo, networkName, this.network);
|
|
58
|
+
this.btcInterface = this.transactionBuilder.btcInterface;
|
|
59
|
+
this.signer = new sign_transaction_1.default(this.network);
|
|
60
|
+
this.currentAccount = undefined;
|
|
61
|
+
this.currentAccountType = undefined;
|
|
62
|
+
this.privateKey = undefined;
|
|
63
|
+
this.publicKey = undefined;
|
|
64
|
+
this.publicKeys = [];
|
|
65
|
+
}
|
|
66
|
+
get signerInfo() {
|
|
67
|
+
return this.privateKey
|
|
68
|
+
? {
|
|
69
|
+
address: this.bitcoinAddress,
|
|
70
|
+
publicKey: this.publicKey.toString("hex"),
|
|
71
|
+
addressType: this.currentAccountType,
|
|
72
|
+
}
|
|
73
|
+
: undefined;
|
|
74
|
+
}
|
|
75
|
+
createTransactionInputsAndOutputs({ targets, extendedUtxo, changeAddress, feeRate, }) {
|
|
76
|
+
return this.transactionBuilder.helperHandleInputsAndOutputs({
|
|
77
|
+
targets,
|
|
78
|
+
extendedUtxo,
|
|
79
|
+
changeObject: {
|
|
80
|
+
address: changeAddress,
|
|
81
|
+
},
|
|
82
|
+
feeRate,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
checkBalanceIsSufficient({ targets, extendedUtxo, changeAddress, feeRate, fullAmount = false, }) {
|
|
86
|
+
try {
|
|
87
|
+
this.transactionBuilder.helperHandleInputsAndOutputs({
|
|
88
|
+
targets,
|
|
89
|
+
extendedUtxo,
|
|
90
|
+
changeObject: {
|
|
91
|
+
address: changeAddress,
|
|
92
|
+
},
|
|
93
|
+
feeRate,
|
|
94
|
+
});
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
setMultiSigAccount(accountType = "p2sh") {
|
|
102
|
+
switch (accountType) {
|
|
103
|
+
default:
|
|
104
|
+
throw new Error("accountType is incorrect");
|
|
105
|
+
}
|
|
106
|
+
this.currentAccountType = accountType;
|
|
107
|
+
}
|
|
108
|
+
setAccountPrivateKey(privateKeyHex) {
|
|
109
|
+
this.privateKey = Buffer.from(privateKeyHex, "hex");
|
|
110
|
+
let publicKey = (0, bitcoin_utils_1.getPubKeyFromPrivateKeyHex)(privateKeyHex, this.network);
|
|
111
|
+
this.publicKey = publicKey;
|
|
112
|
+
}
|
|
113
|
+
setAccountPublicKey(publicKeyHex) {
|
|
114
|
+
this.publicKey = Buffer.from(publicKeyHex, "hex");
|
|
115
|
+
}
|
|
116
|
+
setAccountPrivateKeyByMnemonic({ mnemonic, mnemonicPassword = "", index = 0, walletNumber = 0, addressType = "p2sh-p2wpkh", }) {
|
|
117
|
+
if (!bip39.validateMnemonic(mnemonic))
|
|
118
|
+
throw new Error("invalid mnemonic");
|
|
119
|
+
const seed = bip39.mnemonicToSeedSync(mnemonic, mnemonicPassword);
|
|
120
|
+
const node = bip32.fromSeed(seed);
|
|
121
|
+
let basePath = this.hdWalletPath[addressType];
|
|
122
|
+
if (!basePath) {
|
|
123
|
+
throw new Error("incorrect path or addressType");
|
|
124
|
+
}
|
|
125
|
+
const path = `${basePath}/${walletNumber}`;
|
|
126
|
+
const account = node.derivePath(path);
|
|
127
|
+
const userKeyPair = account.derive(index);
|
|
128
|
+
this.setAccountPrivateKey(userKeyPair.privateKey.toString("hex"));
|
|
129
|
+
return this.setAccount(addressType);
|
|
130
|
+
}
|
|
131
|
+
setAccount(accountType = "p2pkh") {
|
|
132
|
+
if (!this.publicKey) {
|
|
133
|
+
throw new Error("account not initialized");
|
|
134
|
+
}
|
|
135
|
+
let addressObj = this.transactionBuilder.createAddressObject({
|
|
136
|
+
addressType: accountType,
|
|
137
|
+
publicKey: this.publicKey,
|
|
138
|
+
});
|
|
139
|
+
this.currentAccount = addressObj.address;
|
|
140
|
+
this.currentAccountType = accountType;
|
|
141
|
+
this.addressObj = addressObj;
|
|
142
|
+
this.bitcoinAddress = addressObj.address;
|
|
143
|
+
return addressObj.address;
|
|
144
|
+
}
|
|
145
|
+
getExtendedUtxo(input) {
|
|
146
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
+
return this.transactionBuilder.getExtendedUtxo(input);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
send({ receiverAddress, amount, fullAmount = false, speed = "normal", }) {
|
|
151
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
152
|
+
if (!this.currentAccount || !this.currentAccountType || !this.publicKey || !this.privateKey) {
|
|
153
|
+
throw new Error("account not initialized");
|
|
154
|
+
}
|
|
155
|
+
let extendedUtxo = yield this.getExtendedUtxo({
|
|
156
|
+
address: this.currentAccount,
|
|
157
|
+
addressType: this.currentAccountType,
|
|
158
|
+
publicKey: this.publicKey.toString("hex"),
|
|
159
|
+
});
|
|
160
|
+
if (amount - +amount.toFixed() !== 0)
|
|
161
|
+
throw new Error("incorrect amount. amount should be in satoshi");
|
|
162
|
+
let feeRate = yield this.transactionBuilder._getFeeRate(speed);
|
|
163
|
+
let unsignedTx = yield this.transactionBuilder.processUnsignedTransaction({
|
|
164
|
+
extendedUtxo,
|
|
165
|
+
targets: [
|
|
166
|
+
{
|
|
167
|
+
address: receiverAddress,
|
|
168
|
+
value: amount,
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
changeAddress: this.currentAccount,
|
|
172
|
+
feeRate,
|
|
173
|
+
fullAmount,
|
|
174
|
+
});
|
|
175
|
+
let signedPsbt = yield this.signer.signPsbt(unsignedTx, this.privateKey);
|
|
176
|
+
let signedTx = this.signer.finalizePsbts([signedPsbt]);
|
|
177
|
+
let txId = yield this.transactionBuilder.sendTx(signedTx);
|
|
178
|
+
return txId;
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
sendSignedPsbt(signedPsbt) {
|
|
182
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
183
|
+
let signedTx = this.signer.finalizePsbts([signedPsbt]);
|
|
184
|
+
let txId = yield this.transactionBuilder.sendTx(signedTx);
|
|
185
|
+
return txId;
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
sendSignedTx(signedTx) {
|
|
189
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
190
|
+
let txId = yield this.transactionBuilder.sendTx(signedTx);
|
|
191
|
+
return txId;
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
sendMultiSignedPsbt(signedPsbts = []) {
|
|
195
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
196
|
+
let signedTx = this.signer.finalizePsbts(signedPsbts);
|
|
197
|
+
let txId = yield this.transactionBuilder.sendTx(signedTx);
|
|
198
|
+
return txId;
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
increaseTransactionFeeUnsignedPsbt(txId, signerInfos, extraExtendedUtxo, changeAddress, staticFeeRate) {
|
|
202
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
203
|
+
let transaction = yield this.btcInterface.getTransaction(txId);
|
|
204
|
+
let extendedUtxo = transaction.vin.map((vi) => ({
|
|
205
|
+
signerInfo: signerInfos.find((s) => s.address === vi.address),
|
|
206
|
+
hash: vi.txId,
|
|
207
|
+
value: +vi.value,
|
|
208
|
+
index: vi.index,
|
|
209
|
+
}));
|
|
210
|
+
if (extendedUtxo.find((x) => { var _a; return !((_a = x.signerInfo) === null || _a === void 0 ? void 0 : _a.address); })) {
|
|
211
|
+
throw new Error("signerInfo not match");
|
|
212
|
+
}
|
|
213
|
+
let changeIndex = transaction.vout.findIndex((vo) => transaction.vin.find((vi) => vo.address === vi.address || vo.address === changeAddress));
|
|
214
|
+
const feeRate = staticFeeRate || (yield this.transactionBuilder._getFeeRate("fast"));
|
|
215
|
+
let targets = transaction.vout
|
|
216
|
+
.filter((_, index) => index !== changeIndex)
|
|
217
|
+
.map((vo) => vo.address
|
|
218
|
+
? {
|
|
219
|
+
address: vo.address,
|
|
220
|
+
value: vo.value,
|
|
221
|
+
}
|
|
222
|
+
: {
|
|
223
|
+
script: Buffer.from(vo.script, "hex"),
|
|
224
|
+
value: vo.value,
|
|
225
|
+
});
|
|
226
|
+
return this.transactionBuilder.processUnsignedTransaction({
|
|
227
|
+
extendedUtxo: [...extendedUtxo, ...extraExtendedUtxo],
|
|
228
|
+
targets,
|
|
229
|
+
feeRate,
|
|
230
|
+
changeAddress: changeIndex >= 0 ? transaction.vout[changeIndex].address : changeAddress,
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
exports.BitcoinBase = BitcoinBase;
|
|
236
|
+
//# sourceMappingURL=bitcoin-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitcoin-base.js","sourceRoot":"","sources":["../src/bitcoin-base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oHAE0D;AAG1D,+EAAiD;AAEjD,6CAA8B;AAC9B,kDAAmD;AACnD,mDAA4D;AAC5D,gEAAuC;AAIvC,kDAAgC;AAChC,wEAAyC;AAEzC,MAAM,KAAK,GAAG,IAAA,eAAY,EAAC,mBAAG,CAAC,CAAA;AAE/B,MAAM,WAAW;IAqBf,YACE,WAAmB,EACnB,iBAAwC;QACtC,GAAG,EAAE;YACH,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,aAAa;SACxB;KACF;QAED,IAAI,CAAC,OAAO,GAAG,kBAAQ,CAAC,WAAW,CAAC,CAAA;QACpC,IAAI,CAAC,YAAY,GAAG,sBAAY,CAAC,OAAO,CAAA;QAExC,IAAI,CAAC,kBAAkB,GAAG,IAAI,qCAAkB,CAAC,cAAc,EAAE,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;QAC3F,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,kBAAkB,CAAC,YAAY,CAAA;QAExD,IAAI,CAAC,MAAM,GAAG,IAAI,0BAAW,CAAC,IAAI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a,IAAI,CAAC,MAAM,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAA;YAEpF,IAAI,OAAO,GAAG,WAAW,CAAC,IAAI;iBAC3B,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,WAAW,CAAC;iBAC3C,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CACV,EAAE,CAAC,OAAO;gBACR,CAAC,CAAC;oBACE,OAAO,EAAE,EAAE,CAAC,OAAO;oBACnB,KAAK,EAAE,EAAE,CAAC,KAAK;iBAChB;gBACH,CAAC,CAAC;oBACE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;oBACrC,KAAK,EAAE,EAAE,CAAC,KAAK;iBAChB,CACN,CAAA;YACH,OAAO,IAAI,CAAC,kBAAkB,CAAC,0BAA0B,CAAC;gBACxD,YAAY,EAAE,CAAC,GAAG,YAAY,EAAE,GAAG,iBAAiB,CAAC;gBACrD,OAAO;gBACP,OAAO;gBACP,aAAa,EAAE,WAAW,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa;aACxF,CAAC,CAAA;QACJ,CAAC;KAAA;CACF;AACQ,kCAAW"}
|
|
@@ -9,7 +9,7 @@ export type WrapOpReturn = {
|
|
|
9
9
|
thirdPartyId?: number;
|
|
10
10
|
};
|
|
11
11
|
export type WrapOpReturnAndType = WrapOpReturn & {
|
|
12
|
-
requestType: "wrap" | "
|
|
12
|
+
requestType: "wrap" | "wrapAndSwap";
|
|
13
13
|
};
|
|
14
14
|
export declare function generateBrc2OpReturn({ chainId, appId, brc20TokenId, inputAmount, recipientAddress, thirdPartyId, isExchange, outputToken, outputAmount, }: WrapOpReturn & {
|
|
15
15
|
isExchange?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brc20-helper.d.ts","sourceRoot":"","sources":["../../src/helper/brc20-helper.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,MAAM,CAAA;IACpB,gBAAgB,EAAE,MAAM,CAAA;IACxB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AACD,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG;IAC/C,WAAW,EAAE,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"brc20-helper.d.ts","sourceRoot":"","sources":["../../src/helper/brc20-helper.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,MAAM,CAAA;IACpB,gBAAgB,EAAE,MAAM,CAAA;IACxB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AACD,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG;IAC/C,WAAW,EAAE,MAAM,GAAG,aAAa,CAAA;CACpC,CAAA;AAID,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,KAAK,EACL,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,YAAgB,EAChB,UAAkB,EAClB,WAAW,EACX,YAAY,GACb,EAAE,YAAY,GAAG;IAChB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,UAiBA;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM;;;;;;;;;;EA8B9C;AAuCD,wBAAgB,yBAAyB,CACvC,KAAK,EAAE;IACL,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;CACd,EAAE,EACH,OAAO,EAAE,MAAM,GACd;IACD,MAAM,EAAE,OAAO,CAAA;IACf,IAAI,CAAC,EAAE,mBAAmB,CAAA;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CA0CA"}
|
|
@@ -69,11 +69,10 @@ function parseBrc20RawRequest(opReturnData) {
|
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
let appId = Number(`0x${appIdHex}`);
|
|
72
|
-
let requestType = Object.keys(brc20WrapRequests).find((key) =>
|
|
73
|
-
appId <= brc20WrapRequests[key].appIdRange[1]);
|
|
72
|
+
let requestType = Object.keys(brc20WrapRequests).find((key) => brc20WrapRequests[key].appIds.includes(appId));
|
|
74
73
|
switch (requestType) {
|
|
75
74
|
case "wrap":
|
|
76
|
-
case "
|
|
75
|
+
case "wrapAndSwap":
|
|
77
76
|
return parseBrc20OpReturn(data);
|
|
78
77
|
default:
|
|
79
78
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brc20-helper.js","sourceRoot":"","sources":["../../src/helper/brc20-helper.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAoC;AACpC,kDAA4C;AAgB5C,MAAM,iBAAiB,GAAG,eAAK,CAAC,YAAY,CAAA;AAE5C,SAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,KAAK,EACL,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,YAAY,GAAG,CAAC,EAChB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AoB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;YACtF,OAAO;gBACL,MAAM,EAAE,IAAI;gBACZ,IAAI,EAAE,YAAY,CAAC,IAAK;gBACxB,eAAe,EAAE,kBAAkB;gBACnC,cAAc;gBACd,oBAAoB;gBACpB,gBAAgB,EAAE,CAAC;gBACnB,gBAAgB,EAAE,aAAa,CAAC,KAAK;aACtC,CAAA;SACF;QACD,OAAO,YAAY,CAAA;KACpB;IACD,OAAO;QACL,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,8CAA8C;QACvD,IAAI,EAAE,cAAc;KACrB,CAAA;AACH,CAAC;AA3DD,8DA2DC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"burn-request-helper.d.ts","sourceRoot":"","sources":["../../src/helper/burn-request-helper.js"],"names":[],"mappings":"AAAA;;;;;SAsBC"}
|