@teleportdao/bitcoin 2.0.4 → 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 (78) 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.d.ts.map +1 -1
  5. package/dist/bitcoin-interface-teleswap.js +176 -165
  6. package/dist/bitcoin-interface-teleswap.js.map +1 -1
  7. package/dist/bitcoin-interface-utils.d.ts +20 -20
  8. package/dist/bitcoin-interface-utils.js +45 -45
  9. package/dist/bitcoin-interface-wallet.d.ts +28 -28
  10. package/dist/bitcoin-interface-wallet.js +125 -125
  11. package/dist/bitcoin-interface.d.ts +66 -66
  12. package/dist/bitcoin-interface.js +119 -119
  13. package/dist/bitcoin-utils.d.ts +96 -96
  14. package/dist/bitcoin-utils.js +514 -514
  15. package/dist/bitcoin-wallet-base.d.ts +111 -111
  16. package/dist/bitcoin-wallet-base.js +258 -258
  17. package/dist/helper/brc20-helper.d.ts +42 -42
  18. package/dist/helper/brc20-helper.js +127 -127
  19. package/dist/helper/index.d.ts +3 -3
  20. package/dist/helper/index.js +29 -29
  21. package/dist/helper/ordinal-helper.d.ts +12 -12
  22. package/dist/helper/ordinal-helper.js +129 -129
  23. package/dist/helper/teleswap-helper.d.ts +95 -95
  24. package/dist/helper/teleswap-helper.js +186 -186
  25. package/dist/index.d.ts +12 -12
  26. package/dist/index.js +41 -41
  27. package/dist/ordinal-wallet.d.ts +495 -495
  28. package/dist/ordinal-wallet.js +386 -386
  29. package/dist/sign/index.d.ts +1 -1
  30. package/dist/sign/index.js +8 -8
  31. package/dist/sign/sign-transaction.d.ts +12 -12
  32. package/dist/sign/sign-transaction.js +82 -82
  33. package/dist/teleswap-wallet.d.ts +45 -45
  34. package/dist/teleswap-wallet.js +68 -68
  35. package/dist/transaction-builder/bitcoin-transaction-builder.d.ts +9 -9
  36. package/dist/transaction-builder/bitcoin-transaction-builder.js +54 -54
  37. package/dist/transaction-builder/index.d.ts +3 -3
  38. package/dist/transaction-builder/index.js +19 -19
  39. package/dist/transaction-builder/ordinal-transaction-builder.d.ts +63 -63
  40. package/dist/transaction-builder/ordinal-transaction-builder.js +125 -125
  41. package/dist/transaction-builder/transaction-builder.d.ts +223 -223
  42. package/dist/transaction-builder/transaction-builder.js +447 -447
  43. package/dist/type.d.ts +61 -61
  44. package/dist/type.js +2 -2
  45. package/dist/utils/networks.d.ts +5 -5
  46. package/dist/utils/networks.js +53 -53
  47. package/dist/utils/tools.d.ts +18 -18
  48. package/dist/utils/tools.js +74 -74
  49. package/package.json +4 -4
  50. package/src/bitcoin-interface-ordinal.ts +185 -185
  51. package/src/bitcoin-interface-teleswap.ts +251 -237
  52. package/src/bitcoin-interface-utils.ts +60 -60
  53. package/src/bitcoin-interface-wallet.ts +114 -114
  54. package/src/bitcoin-interface.ts +156 -156
  55. package/src/bitcoin-utils.ts +591 -591
  56. package/src/bitcoin-wallet-base.ts +344 -344
  57. package/src/helper/brc20-helper.ts +179 -179
  58. package/src/helper/ordinal-helper.ts +118 -118
  59. package/src/index.ts +15 -15
  60. package/src/ordinal-wallet.ts +659 -659
  61. package/src/sign/index.ts +1 -1
  62. package/src/sign/sign-transaction.ts +108 -108
  63. package/src/teleswap-wallet.ts +133 -133
  64. package/src/transaction-builder/bitcoin-transaction-builder.ts +26 -26
  65. package/src/transaction-builder/index.ts +3 -3
  66. package/src/transaction-builder/ordinal-transaction-builder.ts +139 -139
  67. package/src/transaction-builder/transaction-builder.ts +690 -690
  68. package/src/type.ts +74 -74
  69. package/src/utils/networks.ts +33 -33
  70. package/src/utils/tools.ts +92 -92
  71. package/tsconfig.json +9 -9
  72. package/webpack.config.js +16 -16
  73. package/.tmp/block-parser.ts +0 -58
  74. package/.tmp/check.ts +0 -101
  75. package/.tmp/ordinal-helper.ts +0 -133
  76. package/.tmp/ordinal.ts +0 -25
  77. package/.tmp/psbt/sign-transaction.ts +0 -121
  78. package/.tmp/rbf.ts +0 -45
@@ -1,224 +1,224 @@
1
- /// <reference types="node" />
2
- import * as bitcoin from "bitcoinjs-lib";
3
- export declare const componentBytes: {
4
- bytePerInput: {
5
- p2pkh: number;
6
- p2wpkh: number;
7
- "p2sh-p2wpkh": number;
8
- p2tr: number;
9
- default: number;
10
- };
11
- baseTxBytes: number;
12
- bytePerOutput: {
13
- p2pkh: number;
14
- p2wpkh: number;
15
- p2sh: number;
16
- p2tr: number;
17
- default: number;
18
- max: number;
19
- };
20
- scriptExtraBytes: {
21
- lessThan255: number;
22
- moreThan255: number;
23
- };
24
- };
25
- export declare const DUST = 1000;
26
- export type Utxo = {
27
- hash: string;
28
- value: number;
29
- index: number;
30
- };
31
- export type SignerInfo = {
32
- address: string;
33
- publicKey: string;
34
- addressType: string;
35
- derivationPath?: string;
36
- masterFingerprint?: string;
37
- includeHex?: boolean;
38
- };
39
- export type ExtendedUtxo = {
40
- signerInfo: SignerInfo;
41
- hash: string;
42
- value: number;
43
- index: number;
44
- };
45
- export type TargetAddress = {
46
- address: string;
47
- value: number;
48
- };
49
- export type TargetScript = {
50
- script: Buffer;
51
- value: number;
52
- };
53
- export type Target = TargetAddress | TargetScript;
54
- export type ChangeTarget = TargetAddress & {
55
- bip32Derivation?: {
56
- path: string;
57
- pubkey: Buffer;
58
- masterFingerprint: Buffer;
59
- }[];
60
- };
61
- export type BitcoinJSInputInfo = ExtendedUtxo & {
62
- bip32Derivation?: {
63
- path: string;
64
- pubkey: Buffer;
65
- masterFingerprint: Buffer;
66
- }[];
67
- nonWitnessUtxo?: Buffer;
68
- witnessUtxo?: {
69
- script: Buffer;
70
- value: number;
71
- };
72
- redeemScript?: Buffer;
73
- tapInternalKey?: Buffer;
74
- };
75
- export type ExtendedUnsignedTransaction = {
76
- unsignedTransaction: string;
77
- outputs: Target[];
78
- inputs: {
79
- hash: string;
80
- value: number;
81
- index: number;
82
- signerInfo: SignerInfo;
83
- }[];
84
- fee: number;
85
- change: TargetAddress | undefined;
86
- };
87
- export declare class BaseTransactionBuilder {
88
- testnet: boolean;
89
- network: bitcoin.Network;
90
- maximumNumberOfOutputsInTransaction: number;
91
- feeMin: number;
92
- dustLimit: number;
93
- constructor({ network, testnet, feeMin, dustLimit, maximumNumberOfOutputsInTransaction, }: {
94
- network: bitcoin.Network;
95
- testnet: boolean;
96
- feeMin?: number;
97
- dustLimit?: number;
98
- maximumNumberOfOutputsInTransaction?: number;
99
- });
100
- _getTransactionHex(transactionId: string): Promise<string>;
101
- createAddressObject(input: {
102
- addressType: string;
103
- publicKey: Buffer;
104
- }): bitcoin.payments.Payment;
105
- validateAddress(address: string): boolean;
106
- getOpReturnTarget(dataHex: string): {
107
- script: Buffer;
108
- value: number;
109
- };
110
- calculateTxSize(inputTypes: string[], outputs: {
111
- script?: Buffer;
112
- address?: string;
113
- value: number;
114
- }[], changeAddressType?: string): number;
115
- helperHandleInputsAndOutputs({ targets, extendedUtxo, feeRate, changeObject, selectType, }: {
116
- extendedUtxo: ExtendedUtxo[];
117
- targets: Target[];
118
- feeRate: number;
119
- changeObject?: {
120
- address: string;
121
- publicKey?: string;
122
- addressType?: string;
123
- derivationPath?: string;
124
- masterFingerprint?: string;
125
- };
126
- selectType?: "normal" | "accumulative" | "full" | "inOrder";
127
- }): {
128
- inputs: ExtendedUtxo[];
129
- fee: number;
130
- outputs: Target[];
131
- change: ChangeTarget | undefined;
132
- };
133
- filterAndConvertTxDataToStandardFormat({ extendedUtxo, targets, changeObject, feeRate, selectType, }: {
134
- extendedUtxo: ExtendedUtxo[];
135
- targets: Target[];
136
- feeRate: number;
137
- changeObject?: {
138
- address: string;
139
- publicKey?: string;
140
- addressType?: string;
141
- derivationPath?: string;
142
- masterFingerprint?: string;
143
- };
144
- selectType?: "normal" | "accumulative" | "full" | "inOrder";
145
- }): Promise<{
146
- inputs: (ExtendedUtxo & {
147
- bip32Derivation?: {
148
- path: string;
149
- pubkey: Buffer;
150
- masterFingerprint: Buffer;
151
- }[] | undefined;
152
- nonWitnessUtxo?: Buffer | undefined;
153
- witnessUtxo?: {
154
- script: Buffer;
155
- value: number;
156
- } | undefined;
157
- redeemScript?: Buffer | undefined;
158
- tapInternalKey?: Buffer | undefined;
159
- } & {
160
- signerInfo: SignerInfo;
161
- })[];
162
- outputs: Target[];
163
- change: ChangeTarget | undefined;
164
- fee: number;
165
- feeRate: number;
166
- }>;
167
- convertExtendedUtxoToInputs(baseInputs?: ExtendedUtxo[]): Promise<(ExtendedUtxo & {
168
- bip32Derivation?: {
169
- path: string;
170
- pubkey: Buffer;
171
- masterFingerprint: Buffer;
172
- }[] | undefined;
173
- nonWitnessUtxo?: Buffer | undefined;
174
- witnessUtxo?: {
175
- script: Buffer;
176
- value: number;
177
- } | undefined;
178
- redeemScript?: Buffer | undefined;
179
- tapInternalKey?: Buffer | undefined;
180
- } & {
181
- signerInfo: SignerInfo;
182
- })[]>;
183
- createUnsignedTransaction({ inputs, outputs, change, fee, feeRate, }: {
184
- inputs: BitcoinJSInputInfo[];
185
- outputs: Target[];
186
- change?: ChangeTarget;
187
- fee: number;
188
- feeRate: number;
189
- }): {
190
- unsignedTransaction: string;
191
- outputs: Target[];
192
- inputs: {
193
- hash: string;
194
- value: number;
195
- index: number;
196
- signerInfo: SignerInfo;
197
- }[];
198
- fee: number;
199
- change: ChangeTarget | undefined;
200
- possibleTxId: string | undefined;
201
- };
202
- processUnsignedTransaction({ extendedUtxo, targets, changeAddress, fullAmount, feeRate, selectType, }: {
203
- extendedUtxo: ExtendedUtxo[];
204
- targets: Target[];
205
- feeRate: number;
206
- changeAddress?: string | SignerInfo;
207
- fullAmount?: boolean;
208
- selectType?: "normal" | "accumulative" | "full" | "inOrder";
209
- }): Promise<{
210
- unsignedTransaction: string;
211
- outputs: Target[];
212
- inputs: {
213
- hash: string;
214
- value: number;
215
- index: number;
216
- signerInfo: SignerInfo;
217
- }[];
218
- fee: number;
219
- change: ChangeTarget | undefined;
220
- possibleTxId: string | undefined;
221
- }>;
222
- getUnsignedPsbtTxId(unsignedPsbt: string): string;
223
- }
1
+ /// <reference types="node" />
2
+ import * as bitcoin from "bitcoinjs-lib";
3
+ export declare const componentBytes: {
4
+ bytePerInput: {
5
+ p2pkh: number;
6
+ p2wpkh: number;
7
+ "p2sh-p2wpkh": number;
8
+ p2tr: number;
9
+ default: number;
10
+ };
11
+ baseTxBytes: number;
12
+ bytePerOutput: {
13
+ p2pkh: number;
14
+ p2wpkh: number;
15
+ p2sh: number;
16
+ p2tr: number;
17
+ default: number;
18
+ max: number;
19
+ };
20
+ scriptExtraBytes: {
21
+ lessThan255: number;
22
+ moreThan255: number;
23
+ };
24
+ };
25
+ export declare const DUST = 1000;
26
+ export type Utxo = {
27
+ hash: string;
28
+ value: number;
29
+ index: number;
30
+ };
31
+ export type SignerInfo = {
32
+ address: string;
33
+ publicKey: string;
34
+ addressType: string;
35
+ derivationPath?: string;
36
+ masterFingerprint?: string;
37
+ includeHex?: boolean;
38
+ };
39
+ export type ExtendedUtxo = {
40
+ signerInfo: SignerInfo;
41
+ hash: string;
42
+ value: number;
43
+ index: number;
44
+ };
45
+ export type TargetAddress = {
46
+ address: string;
47
+ value: number;
48
+ };
49
+ export type TargetScript = {
50
+ script: Buffer;
51
+ value: number;
52
+ };
53
+ export type Target = TargetAddress | TargetScript;
54
+ export type ChangeTarget = TargetAddress & {
55
+ bip32Derivation?: {
56
+ path: string;
57
+ pubkey: Buffer;
58
+ masterFingerprint: Buffer;
59
+ }[];
60
+ };
61
+ export type BitcoinJSInputInfo = ExtendedUtxo & {
62
+ bip32Derivation?: {
63
+ path: string;
64
+ pubkey: Buffer;
65
+ masterFingerprint: Buffer;
66
+ }[];
67
+ nonWitnessUtxo?: Buffer;
68
+ witnessUtxo?: {
69
+ script: Buffer;
70
+ value: number;
71
+ };
72
+ redeemScript?: Buffer;
73
+ tapInternalKey?: Buffer;
74
+ };
75
+ export type ExtendedUnsignedTransaction = {
76
+ unsignedTransaction: string;
77
+ outputs: Target[];
78
+ inputs: {
79
+ hash: string;
80
+ value: number;
81
+ index: number;
82
+ signerInfo: SignerInfo;
83
+ }[];
84
+ fee: number;
85
+ change: TargetAddress | undefined;
86
+ };
87
+ export declare class BaseTransactionBuilder {
88
+ testnet: boolean;
89
+ network: bitcoin.Network;
90
+ maximumNumberOfOutputsInTransaction: number;
91
+ feeMin: number;
92
+ dustLimit: number;
93
+ constructor({ network, testnet, feeMin, dustLimit, maximumNumberOfOutputsInTransaction, }: {
94
+ network: bitcoin.Network;
95
+ testnet: boolean;
96
+ feeMin?: number;
97
+ dustLimit?: number;
98
+ maximumNumberOfOutputsInTransaction?: number;
99
+ });
100
+ _getTransactionHex(transactionId: string): Promise<string>;
101
+ createAddressObject(input: {
102
+ addressType: string;
103
+ publicKey: Buffer;
104
+ }): bitcoin.payments.Payment;
105
+ validateAddress(address: string): boolean;
106
+ getOpReturnTarget(dataHex: string): {
107
+ script: Buffer;
108
+ value: number;
109
+ };
110
+ calculateTxSize(inputTypes: string[], outputs: {
111
+ script?: Buffer;
112
+ address?: string;
113
+ value: number;
114
+ }[], changeAddressType?: string): number;
115
+ helperHandleInputsAndOutputs({ targets, extendedUtxo, feeRate, changeObject, selectType, }: {
116
+ extendedUtxo: ExtendedUtxo[];
117
+ targets: Target[];
118
+ feeRate: number;
119
+ changeObject?: {
120
+ address: string;
121
+ publicKey?: string;
122
+ addressType?: string;
123
+ derivationPath?: string;
124
+ masterFingerprint?: string;
125
+ };
126
+ selectType?: "normal" | "accumulative" | "full" | "inOrder";
127
+ }): {
128
+ inputs: ExtendedUtxo[];
129
+ fee: number;
130
+ outputs: Target[];
131
+ change: ChangeTarget | undefined;
132
+ };
133
+ filterAndConvertTxDataToStandardFormat({ extendedUtxo, targets, changeObject, feeRate, selectType, }: {
134
+ extendedUtxo: ExtendedUtxo[];
135
+ targets: Target[];
136
+ feeRate: number;
137
+ changeObject?: {
138
+ address: string;
139
+ publicKey?: string;
140
+ addressType?: string;
141
+ derivationPath?: string;
142
+ masterFingerprint?: string;
143
+ };
144
+ selectType?: "normal" | "accumulative" | "full" | "inOrder";
145
+ }): Promise<{
146
+ inputs: (ExtendedUtxo & {
147
+ bip32Derivation?: {
148
+ path: string;
149
+ pubkey: Buffer;
150
+ masterFingerprint: Buffer;
151
+ }[] | undefined;
152
+ nonWitnessUtxo?: Buffer | undefined;
153
+ witnessUtxo?: {
154
+ script: Buffer;
155
+ value: number;
156
+ } | undefined;
157
+ redeemScript?: Buffer | undefined;
158
+ tapInternalKey?: Buffer | undefined;
159
+ } & {
160
+ signerInfo: SignerInfo;
161
+ })[];
162
+ outputs: Target[];
163
+ change: ChangeTarget | undefined;
164
+ fee: number;
165
+ feeRate: number;
166
+ }>;
167
+ convertExtendedUtxoToInputs(baseInputs?: ExtendedUtxo[]): Promise<(ExtendedUtxo & {
168
+ bip32Derivation?: {
169
+ path: string;
170
+ pubkey: Buffer;
171
+ masterFingerprint: Buffer;
172
+ }[] | undefined;
173
+ nonWitnessUtxo?: Buffer | undefined;
174
+ witnessUtxo?: {
175
+ script: Buffer;
176
+ value: number;
177
+ } | undefined;
178
+ redeemScript?: Buffer | undefined;
179
+ tapInternalKey?: Buffer | undefined;
180
+ } & {
181
+ signerInfo: SignerInfo;
182
+ })[]>;
183
+ createUnsignedTransaction({ inputs, outputs, change, fee, feeRate, }: {
184
+ inputs: BitcoinJSInputInfo[];
185
+ outputs: Target[];
186
+ change?: ChangeTarget;
187
+ fee: number;
188
+ feeRate: number;
189
+ }): {
190
+ unsignedTransaction: string;
191
+ outputs: Target[];
192
+ inputs: {
193
+ hash: string;
194
+ value: number;
195
+ index: number;
196
+ signerInfo: SignerInfo;
197
+ }[];
198
+ fee: number;
199
+ change: ChangeTarget | undefined;
200
+ possibleTxId: string | undefined;
201
+ };
202
+ processUnsignedTransaction({ extendedUtxo, targets, changeAddress, fullAmount, feeRate, selectType, }: {
203
+ extendedUtxo: ExtendedUtxo[];
204
+ targets: Target[];
205
+ feeRate: number;
206
+ changeAddress?: string | SignerInfo;
207
+ fullAmount?: boolean;
208
+ selectType?: "normal" | "accumulative" | "full" | "inOrder";
209
+ }): Promise<{
210
+ unsignedTransaction: string;
211
+ outputs: Target[];
212
+ inputs: {
213
+ hash: string;
214
+ value: number;
215
+ index: number;
216
+ signerInfo: SignerInfo;
217
+ }[];
218
+ fee: number;
219
+ change: ChangeTarget | undefined;
220
+ possibleTxId: string | undefined;
221
+ }>;
222
+ getUnsignedPsbtTxId(unsignedPsbt: string): string;
223
+ }
224
224
  //# sourceMappingURL=transaction-builder.d.ts.map