@cryptorubic/web3 1.3.0 → 1.3.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.
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
# web3
|
|
1
|
+
# web3
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cryptorubic/web3",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@ethersproject/bignumber": "^5.8.0",
|
|
6
6
|
"@mysten/sui": "^1.24.0",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"axios": "*",
|
|
15
15
|
"bignumber.js": "9.1.2",
|
|
16
16
|
"bitcoin-address-validation": "^2.2.3",
|
|
17
|
+
"bitcoinjs-lib": "^7.0.1",
|
|
17
18
|
"bs58": "^6.0.0",
|
|
18
19
|
"crc-32": "^1.2.2",
|
|
19
20
|
"js-base64": "^3.7.8",
|
|
@@ -10,6 +10,7 @@ import { Web3PrimitiveType } from '../../../utils/models/primitive-types';
|
|
|
10
10
|
import { ContractMulticallResponse } from '../models/web3-public-models/contract-multicall-response';
|
|
11
11
|
import { MethodData } from '../models/web3-public-models/method-data';
|
|
12
12
|
import { TxStatus } from '../models/web3-public-models/tx-status';
|
|
13
|
+
import { PsbtTxInput } from 'bitcoinjs-lib';
|
|
13
14
|
export declare class BitcoinAdapter extends AbstractAdapter<BtcWallet, BtcWallet, BitcoinBlockchainName> {
|
|
14
15
|
private readonly httpClient;
|
|
15
16
|
readonly signer: BitcoinAdapterSigner;
|
|
@@ -35,4 +36,5 @@ export declare class BitcoinAdapter extends AbstractAdapter<BtcWallet, BtcWallet
|
|
|
35
36
|
getPublicKeyFromWallet(): Promise<string>;
|
|
36
37
|
transfer(recipient: string, amount: string, fromAddress: string, memo?: string, options?: BasicSendTransactionOptions): Promise<string>;
|
|
37
38
|
sendPsbtTransaction(psbt: string, userAddress: string, inputIndexes: number[], options?: BasicSendTransactionOptions): Promise<string>;
|
|
39
|
+
parseInputsFromPsbtHex(psbtHex: string): PsbtTxInput[];
|
|
38
40
|
}
|
|
@@ -6,6 +6,7 @@ const bignumber_js_1 = require("bignumber.js");
|
|
|
6
6
|
const abstract_adapter_1 = require("../common/abstract-adapter");
|
|
7
7
|
const bitcoin_adapter_signer_1 = require("./signer/bitcoin-adapter-signer");
|
|
8
8
|
const tx_status_1 = require("../models/web3-public-models/tx-status");
|
|
9
|
+
const bitcoinjs_lib_1 = require("bitcoinjs-lib");
|
|
9
10
|
class BitcoinAdapter extends abstract_adapter_1.AbstractAdapter {
|
|
10
11
|
get public() {
|
|
11
12
|
throw new Error('public property is not set in BitcoinAdapter.');
|
|
@@ -161,5 +162,16 @@ class BitcoinAdapter extends abstract_adapter_1.AbstractAdapter {
|
|
|
161
162
|
throw new Error('Failed to sign psbt transaction');
|
|
162
163
|
}
|
|
163
164
|
}
|
|
165
|
+
parseInputsFromPsbtHex(psbtHex) {
|
|
166
|
+
try {
|
|
167
|
+
const psbt = bitcoinjs_lib_1.Psbt.fromHex(psbtHex, {
|
|
168
|
+
network: bitcoinjs_lib_1.networks.bitcoin
|
|
169
|
+
});
|
|
170
|
+
return psbt.txInputs;
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
throw new Error('Failed to parse inputs from raw psbt transaction');
|
|
174
|
+
}
|
|
175
|
+
}
|
|
164
176
|
}
|
|
165
177
|
exports.BitcoinAdapter = BitcoinAdapter;
|