@rsksmart/powpeg-sdk 0.0.1 → 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Rootstock
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/rsksmart/powpeg-sdk/badge)](https://scorecard.dev/viewer/?uri=github.com/rsksmart/powpeg-sdk)
2
+ [![CodeQL](https://github.com/rsksmart/powpeg-sdk/workflows/CodeQL/badge.svg)](https://github.com/rsksmart/powpeg-sdk/actions?query=workflow%3ACodeQL)
3
+
4
+ # powpeg-sdk
5
+ SDK for creating native peg-in and peg-out transactions following the PowPeg protocol.
package/SECURITY.md ADDED
@@ -0,0 +1,140 @@
1
+ # PowPeg SDK Security Process
2
+
3
+ We are committed to conduct our security process in a professional and civil manner. Public shaming, under-reporting or misrepresentation of vulnerabilities will not be tolerated.
4
+
5
+ ## Responsible Disclosure
6
+
7
+ For all security related issues, RootstockLabs has two main points of contact. Reach us at <security@rootstocklabs.com> or refer to our [Bug Bounty Program](https://www.rootstocklabs.com/bug-bounty-program). **Do not open up a GitHub issue if the bug is a security vulnerability**
8
+ **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/rsksmart/powpeg-sdk/issues).
9
+
10
+ ## Vulnerability Handling
11
+
12
+ ### Response Time
13
+
14
+ RootstockLabs will make a best effort to meet the following response times for reported vulnerabilities:
15
+ * Time to first response (from report submit) - 5 business days
16
+ * Time to triage (from report submit) - 7 business days
17
+ * Time to bounty (from triage) - 15 business days
18
+
19
+ We’ll try to keep you informed about our progress throughout the process.
20
+
21
+ ### Disclosure Policy
22
+
23
+ * Follow HackerOne's [disclosure guidelines](https://www.hackerone.com/disclosure-guidelines).
24
+ * Public disclosure of a vulnerability makes it ineligible for a bounty. If the user reports the vulnerability to other security teams (e.g. Ethereum or ETC) but reports to RootstockLabs with considerable delay, then RootstockLabs may reduce or cancel the bounty.
25
+
26
+ For more information check RootstockLabs bounty program policy at [HackerOne](https://hackerone.com/rootstocklabs)
27
+
28
+ ## Public Keys
29
+
30
+ ### Security
31
+
32
+ ```gpg
33
+ -----BEGIN PGP PUBLIC KEY BLOCK-----
34
+ Version: GnuPG v2
35
+ mQINBFoF+z0BEADJNtu4DjEqH3+TzdwNwPfRmHo7hhSBR08wnLfkWmsm3IxgEqdB
36
+ wYU8rMNXpnsiToTjDnCYYacxQR5uUN4MbYvtnKqGbiapZ5EgCDoRMKYKhJwTuAjH
37
+ ju9cPfblwuIG9eLJ7NJ9t/C+07JQQzDolPo3JBzXjeNDMS21YNqiUfHRCIKcTC45
38
+ /ksfX0q5UG0KM0FgYiAYJer0OQp/A2KETzzweXdNTs+KXDuA1ChafQ/3x3efDG+D
39
+ HekfQULToISKMq36F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9EVTR3wRdI7DwJbH1vJCEO1i1RTZBJd3sKhwHtdSXkdOwIWYgnUF2fx
133
+ ermtX1AKDpAKkMumwMMvAFA6ntevmNmdc35LCCq5rMX4ClKVn5+0n5YeAdxH7teZ
134
+ 0FzlNBDmYtdeYWnMXut/ukHO2GWZyXkbfXXXQhezeUQaWuyCfsAuocqHvEtRYoVx
135
+ iZ1WSLgU34q1rcX2abQsHUWRxZmBfKD6RZ15bvlIM99ne2/bDSBETz4KUCIa2WIV
136
+ v0FjOkVKB3PSHj1q4fogldX0Yb55tUa3rX0Rb8QEKInQj8FFPd44XHclv9PTv0OL
137
+ IfHtYt8huvu34FA85HR8wAOPiqvyJ7Oj
138
+ =r7Yf
139
+ -----END PGP PUBLIC KEY BLOCK-----
140
+ ```
@@ -0,0 +1,269 @@
1
+ import { Psbt, networks as networks$1 } from 'bitcoinjs-lib';
2
+ import { ethers } from '@rsksmart/bridges-core-sdk';
3
+ import TrezorConnect from '@trezor/connect-web';
4
+ import { CreateTransactionArg } from '@ledgerhq/hw-app-btc/lib/createTransaction';
5
+
6
+ type FeeLevel = 'slow' | 'average' | 'fast';
7
+ interface BitcoinSigner {
8
+ getNonChangeAddresses(bundleSize: number): Promise<string[]>;
9
+ getChangeAddresses(bundleSize: number): Promise<string[]>;
10
+ signTransaction(psbt: Psbt, inputs?: Utxo[], transactions?: string[]): Promise<string>;
11
+ }
12
+ interface BitcoinDataSource {
13
+ getFeeRate(level: FeeLevel): Promise<number>;
14
+ getTxHex(txId: string): Promise<string>;
15
+ getOutputs(address: string): Promise<Utxo[]>;
16
+ broadcast(hexTx: string): Promise<string>;
17
+ getAddressDetails(address: string): Promise<AddressWithDetails>;
18
+ }
19
+ interface AddressWithDetails {
20
+ address: string;
21
+ balance: number;
22
+ txCount: number;
23
+ }
24
+ interface Utxo {
25
+ address: string;
26
+ txid: string;
27
+ amount: bigint;
28
+ vout: number;
29
+ }
30
+ interface PegoutFeeEstimation {
31
+ bitcoinFee: bigint;
32
+ rootstockFee: bigint;
33
+ }
34
+ declare enum TxType {
35
+ PEGIN = "PEGIN",
36
+ PEGOUT = "PEGOUT"
37
+ }
38
+ declare enum PegoutStatuses {
39
+ RECEIVED = "RECEIVED",
40
+ REJECTED = "REJECTED",
41
+ WAITING_FOR_CONFIRMATION = "WAITING_FOR_CONFIRMATION",
42
+ WAITING_FOR_SIGNATURE = "WAITING_FOR_SIGNATURE",
43
+ SIGNED = "SIGNED",
44
+ NOT_FOUND = "NOT_FOUND",
45
+ PENDING = "PENDING",
46
+ NOT_PEGOUT_TX = "NOT_PEGOUT_TX",
47
+ RELEASE_BTC = "RELEASE_BTC"
48
+ }
49
+ declare enum PeginStatuses {
50
+ NOT_IN_BTC_YET = "NOT_IN_BTC_YET",
51
+ WAITING_CONFIRMATIONS = "WAITING_CONFIRMATIONS",
52
+ NOT_IN_RSK_YET = "NOT_IN_RSK_YET",
53
+ CONFIRMED = "CONFIRMED",
54
+ REJECTED_NO_REFUND = "REJECTED_NO_REFUND",
55
+ REJECTED_REFUND = "REJECTED_REFUND",
56
+ ERROR_NOT_A_PEGIN = "ERROR_NOT_A_PEGIN",
57
+ ERROR_BELOW_MIN = "ERROR_BELOW_MIN",
58
+ ERROR_UNEXPECTED = "ERROR_UNEXPECTED"
59
+ }
60
+ declare const RejectedPegoutReasons: {
61
+ readonly 1: "LOW_AMOUNT";
62
+ readonly 2: "CALLER_CONTRACT";
63
+ readonly 3: "FEE_ABOVE_VALUE";
64
+ };
65
+ type RejectedPegoutReason = (typeof RejectedPegoutReasons)[keyof typeof RejectedPegoutReasons];
66
+ interface PeginTxDetails {
67
+ btc: {
68
+ txId: string;
69
+ creationDate: string;
70
+ federationAddress: string;
71
+ amountTransferred: number;
72
+ fees: number;
73
+ refundAddress: string;
74
+ confirmations: number;
75
+ requiredConfirmation: number;
76
+ btcWTxId: string;
77
+ senderAddress: string;
78
+ };
79
+ rsk: {
80
+ recipientAddress: string;
81
+ };
82
+ status: PeginStatuses;
83
+ }
84
+ interface PegoutTxDetails {
85
+ originatingRskTxHash: string;
86
+ rskTxHash: string;
87
+ rskSenderAddress: string;
88
+ btcRecipientAddress: string;
89
+ valueRequestedInSatoshis: number;
90
+ valueInSatoshisToBeReceived: number;
91
+ feeInSatoshisToBePaid: number;
92
+ status: PegoutStatuses;
93
+ btcRawTransaction: string;
94
+ reason?: RejectedPegoutReason;
95
+ }
96
+ interface PegoutStatusData {
97
+ type: TxType.PEGOUT;
98
+ txDetails: PegoutTxDetails;
99
+ }
100
+ interface PeginStatusData {
101
+ type: TxType.PEGIN;
102
+ txDetails: PeginTxDetails;
103
+ }
104
+ type StatusData = PegoutStatusData | PeginStatusData;
105
+ interface UnsignedPegin {
106
+ psbt: Psbt;
107
+ inputs: Utxo[];
108
+ transactions: string[];
109
+ fee: number;
110
+ }
111
+
112
+ declare const supportedAddressTypes: {
113
+ readonly 'NATIVE SEGWIT': {
114
+ readonly path: "84";
115
+ readonly format: "bech32";
116
+ };
117
+ readonly SEGWIT: {
118
+ readonly path: "49";
119
+ readonly format: "p2sh";
120
+ };
121
+ readonly LEGACY: {
122
+ readonly path: "44";
123
+ readonly format: "legacy";
124
+ };
125
+ };
126
+ declare const networks: {
127
+ readonly TEST: {
128
+ readonly currency: "bitcoin_testnet";
129
+ readonly coin: "1";
130
+ readonly lib: networks$1.Network;
131
+ readonly xpubVersion: 70617039;
132
+ };
133
+ readonly MAIN: {
134
+ readonly currency: "bitcoin";
135
+ readonly coin: "0";
136
+ readonly lib: networks$1.Network;
137
+ readonly xpubVersion: 76067358;
138
+ };
139
+ };
140
+ type AddressType = keyof typeof supportedAddressTypes;
141
+ type Network = keyof typeof networks;
142
+
143
+ declare class PowPegSDK {
144
+ private _bitcoinSigner;
145
+ private _bitcoinDataSource;
146
+ private network;
147
+ private maxBundleSize;
148
+ private burnDustValue;
149
+ private txHeaderSizeInBytes;
150
+ private txOutputSizeInBytes;
151
+ private txInputSizeInBytes;
152
+ private pegInOutputs;
153
+ private powpegRsktHeader;
154
+ private burnDustMaxValue;
155
+ private utxos;
156
+ private changeAddress?;
157
+ private minPeginAmount;
158
+ private peginFeeEstimationInputs;
159
+ private minPegoutAmount;
160
+ private bitcoinJsNetwork;
161
+ private bridge;
162
+ private api;
163
+ private rskProvider;
164
+ private publicNodes;
165
+ /**
166
+ * @param {BitcoinSigner | null} _bitcoinSigner - An instance of a class that implements the BitcoinSigner interface.
167
+ * @param {BitcoinDataSource | null} _bitcoinDataSource - An instance of a class that implements the BitcoinDataSource interface or null if you won't use peg-in operations.
168
+ * @param {Network} network - The network to use. Either 'MAIN' or 'TEST'.
169
+ * @param {string} rpcProviderUrl - URL of either your own Rootstock node, the Rootstock RPC API or a third-party node provider. If not provided, it will default to the Rootstock public node for the specified network.
170
+ * @param {string} apiUrl - The URL of the API to use. If not provided, it will default to the production 2WP API URL for the specified network and use it as BitcoinDataSource.
171
+ * @param {number} maxBundleSize - The maximum number of addresses to ask for while creating a peg-in transaction. Defaults to 10.
172
+ * @param {number} burnDustValue - The value in satoshis to consider as dust to burn. Defaults to 2000.
173
+ */
174
+ constructor(_bitcoinSigner: BitcoinSigner | null, _bitcoinDataSource: BitcoinDataSource | null, network: Network, rpcProviderUrl?: string, apiUrl?: string, maxBundleSize?: number, burnDustValue?: number);
175
+ private get bitcoinSigner();
176
+ private set bitcoinSigner(value);
177
+ private get bitcoinDataSource();
178
+ private getUtxos;
179
+ private getAddressesWithDetails;
180
+ private groupAddressesByUsage;
181
+ private groupAddressesByBalance;
182
+ private initPegin;
183
+ private getRskOutput;
184
+ estimatePeginFee(amount: bigint, feeLevel?: FeeLevel): Promise<number>;
185
+ createPegin(amount: bigint, recipientAddress: string): Promise<Psbt>;
186
+ private selectInputs;
187
+ private validatePeginAmount;
188
+ private calculatePeginFee;
189
+ private calculateFeeAndSelectedInputs;
190
+ fundPegin(psbt: Psbt, feeLevel?: FeeLevel): Promise<{
191
+ psbt: Psbt;
192
+ inputs: Utxo[];
193
+ transactions: string[];
194
+ fee: number;
195
+ }>;
196
+ createAndFundPegin(amount: bigint, recipientAddress: string, signer: BitcoinSigner, feeLevel?: FeeLevel): Promise<UnsignedPegin>;
197
+ private signPegin;
198
+ signAndBroadcastPegin(psbt: Psbt, inputs?: Utxo[], transactions?: string[]): Promise<string>;
199
+ private validateMinimumPegoutAmount;
200
+ private createPegoutTransaction;
201
+ estimatePegoutFees(amount: string, fromAddress?: string): Promise<PegoutFeeEstimation>;
202
+ createPegout(amount: string, senderAccount: string): Promise<{
203
+ tx: {
204
+ from: string;
205
+ to: string;
206
+ value: string;
207
+ };
208
+ rootstockFee: bigint;
209
+ bitcoinFee: bigint;
210
+ }>;
211
+ signAndBroadcastPegout(tx: {
212
+ from: string;
213
+ to: string;
214
+ value: string;
215
+ }, signer: ethers.Signer): Promise<ethers.providers.TransactionReceipt | undefined>;
216
+ getTransactionStatus<T extends TxType>(txHash: string, txType: T): Promise<Extract<PegoutStatusData, {
217
+ type: T;
218
+ }> | Extract<PeginStatusData, {
219
+ type: T;
220
+ }>>;
221
+ }
222
+
223
+ declare class TrezorSigner implements BitcoinSigner {
224
+ private readonly network;
225
+ private _addressType;
226
+ private readonly bitcoinTxVersion;
227
+ private readonly addresses;
228
+ private constructor();
229
+ static init(network?: Network, initOptions?: typeof TrezorConnect.init): Promise<TrezorSigner>;
230
+ static reinit(): Promise<TrezorSigner>;
231
+ set addressType(addressType: AddressType);
232
+ get addressType(): AddressType;
233
+ private getPathPurpose;
234
+ private getPathCoin;
235
+ private getAddresses;
236
+ getChangeAddresses(bundleSize: number): Promise<string[]>;
237
+ getNonChangeAddresses(bundleSize: number): Promise<string[]>;
238
+ private getScriptType;
239
+ private getInputs;
240
+ private getOutputs;
241
+ signTransaction(psbt: Psbt, utxos: Utxo[]): Promise<string>;
242
+ }
243
+
244
+ declare class LedgerSigner implements BitcoinSigner {
245
+ private readonly connection;
246
+ private readonly transport;
247
+ private readonly network;
248
+ private _addressType;
249
+ private readonly addresses;
250
+ private readonly transportService;
251
+ private constructor();
252
+ static init(network?: Network): Promise<LedgerSigner>;
253
+ reinit(): Promise<LedgerSigner>;
254
+ set addressType(addressType: AddressType);
255
+ get addressType(): AddressType;
256
+ private getPathPurpose;
257
+ private getPathCoin;
258
+ private getAddressFormat;
259
+ private getXpubVersion;
260
+ private isSegwit;
261
+ getAddresses(bundleSize: number, change?: boolean): Promise<string[]>;
262
+ getChangeAddresses(bundleSize: number): Promise<string[]>;
263
+ getNonChangeAddresses(bundleSize: number): Promise<string[]>;
264
+ getInputs(inputs: Utxo[], transactions: string[]): CreateTransactionArg['inputs'];
265
+ getOutputScriptHex(psbt: Psbt): string;
266
+ signTransaction(psbt: Psbt, inputs: Utxo[], transactions: string[]): Promise<string>;
267
+ }
268
+
269
+ export { type AddressWithDetails, type BitcoinDataSource, type BitcoinSigner, type FeeLevel, LedgerSigner, type PeginStatusData, PeginStatuses, type PeginTxDetails, type PegoutFeeEstimation, type PegoutStatusData, PegoutStatuses, type PegoutTxDetails, PowPegSDK, type RejectedPegoutReason, RejectedPegoutReasons, type StatusData, TrezorSigner, TxType, type UnsignedPegin, type Utxo };