@btc-vision/transaction 1.0.45 → 1.0.46
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/browser/_version.d.ts +1 -1
- package/browser/index.js +1 -1
- package/build/_version.d.ts +1 -1
- package/build/_version.js +1 -1
- package/package.json +4 -9
- package/src/_version.ts +1 -1
- package/jest.config.ts +0 -52
- package/tests/TransactionBuilder.test.ts +0 -58
- package/tests/contracts/wbtc.wasm +0 -0
package/build/_version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.0.
|
|
1
|
+
export declare const version = "1.0.46";
|
package/build/_version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.0.
|
|
1
|
+
export const version = '1.0.46';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.46",
|
|
4
4
|
"author": "BlobMaster41",
|
|
5
5
|
"description": "OPNet transaction library allows you to create and sign transactions for the OPNet network.",
|
|
6
6
|
"engines": {
|
|
@@ -55,13 +55,12 @@
|
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"watch": "gulp watch",
|
|
58
|
-
"build": "gulp",
|
|
59
|
-
"test": "jest --runInBand",
|
|
58
|
+
"build": "gulp && gulp cjs",
|
|
60
59
|
"setup": "npm npm i && npm run build",
|
|
61
60
|
"browserBuild": "webpack --mode production",
|
|
62
61
|
"cjs": "gulp cjs",
|
|
63
62
|
"docs": "typedoc --out docs --exclude 'src/tests/*.ts' --tsconfig tsconfig.json --readme README.md --name OPNet --plugin typedoc-material-theme --themeColor '#cb9820' --exclude src/tests/test.ts --exclude src/index.ts src",
|
|
64
|
-
"
|
|
63
|
+
"postinstall": "gulp && gulp cjs"
|
|
65
64
|
},
|
|
66
65
|
"devDependencies": {
|
|
67
66
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
@@ -70,17 +69,13 @@
|
|
|
70
69
|
"@babel/preset-flow": "^7.24.1",
|
|
71
70
|
"@babel/preset-react": "^7.24.1",
|
|
72
71
|
"@babel/preset-typescript": "^7.24.1",
|
|
73
|
-
"@jest/types": "^29.6.3",
|
|
74
|
-
"@types/jest": "^29.5.12",
|
|
75
72
|
"@types/node": "^20.11.30",
|
|
76
73
|
"eslint": "^8.57.0",
|
|
77
74
|
"https-browserify": "^1.0.0",
|
|
78
|
-
"jest": "^29.7.0",
|
|
79
75
|
"os-browserify": "^0.3.0",
|
|
80
76
|
"prettier": "^3.3.1",
|
|
81
77
|
"stream-browserify": "^3.0.0",
|
|
82
78
|
"stream-http": "^3.2.0",
|
|
83
|
-
"ts-jest": "^29.1.2",
|
|
84
79
|
"typedoc": "^0.25.13",
|
|
85
80
|
"typedoc-material-theme": "^1.0.2",
|
|
86
81
|
"typescript": "^5.4.5",
|
|
@@ -92,7 +87,7 @@
|
|
|
92
87
|
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
|
|
93
88
|
"@bitcoinerlab/secp256k1": "^1.1.1",
|
|
94
89
|
"@btc-vision/bsi-binary": "^1.0.28",
|
|
95
|
-
"@btc-vision/bsi-bitcoin-rpc": "^1.0.
|
|
90
|
+
"@btc-vision/bsi-bitcoin-rpc": "^1.0.21",
|
|
96
91
|
"@btc-vision/bsi-common": "^1.0.14",
|
|
97
92
|
"@btc-vision/logger": "^1.0.2",
|
|
98
93
|
"assert": "^2.1.0",
|
package/src/_version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.0.
|
|
1
|
+
export const version = '1.0.46';
|
package/jest.config.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { Config } from '@jest/types';
|
|
2
|
-
import { BabelConfig } from 'ts-jest';
|
|
3
|
-
|
|
4
|
-
const esModules = ['chalk', 'supports-color', '@btc-vision/logger', '@btc-vision/common'].join('|');
|
|
5
|
-
|
|
6
|
-
const babelConfig: BabelConfig = {
|
|
7
|
-
presets: ['@babel/preset-env'],
|
|
8
|
-
plugins: [['babel-plugin-transform-import-meta', { module: 'ES6' }]],
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
// @ts-ignore
|
|
12
|
-
const config: Config.InitialOptions = {
|
|
13
|
-
verbose: true,
|
|
14
|
-
rootDir: './',
|
|
15
|
-
transform: {
|
|
16
|
-
'\\.[jt]s?$': [
|
|
17
|
-
'ts-jest',
|
|
18
|
-
{
|
|
19
|
-
useESM: true,
|
|
20
|
-
tsconfig: { allowJs: true },
|
|
21
|
-
babelConfig: babelConfig,
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
modulePathIgnorePatterns: [
|
|
26
|
-
'packages',
|
|
27
|
-
'build',
|
|
28
|
-
'node_modules',
|
|
29
|
-
'data',
|
|
30
|
-
'documents',
|
|
31
|
-
'models',
|
|
32
|
-
'repositories',
|
|
33
|
-
'utils',
|
|
34
|
-
'config',
|
|
35
|
-
],
|
|
36
|
-
testMatch: [
|
|
37
|
-
'<rootPath>/tests/**/*.test.ts',
|
|
38
|
-
'<rootPath>/tests/*.test.ts',
|
|
39
|
-
'<rootDir>/tests/*.test.ts',
|
|
40
|
-
'<rootDir>/tests/**/*.test.ts',
|
|
41
|
-
],
|
|
42
|
-
moduleNameMapper: {
|
|
43
|
-
'^(\\.{1,2}/.*)\\.[jt]s$': '$1',
|
|
44
|
-
},
|
|
45
|
-
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
|
|
46
|
-
moduleDirectories: ['node_modules', 'src', 'build'],
|
|
47
|
-
testEnvironment: 'node',
|
|
48
|
-
transformIgnorePatterns: [`/node_modules/(?!${esModules})`, `/build/`],
|
|
49
|
-
preset: 'ts-jest/presets/js-with-babel',
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export default config;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import 'jest';
|
|
2
|
-
import { Regtest } from '../src/tests/Regtest.js';
|
|
3
|
-
import { Logger } from '@btc-vision/logger';
|
|
4
|
-
import { networks } from 'bitcoinjs-lib';
|
|
5
|
-
import {
|
|
6
|
-
FetchUTXOParams,
|
|
7
|
-
IInteractionParameters,
|
|
8
|
-
OPNetLimitedProvider,
|
|
9
|
-
TransactionFactory,
|
|
10
|
-
UTXO,
|
|
11
|
-
Wallet,
|
|
12
|
-
wBTC,
|
|
13
|
-
} from '../src/index.js';
|
|
14
|
-
|
|
15
|
-
const logger: Logger = new Logger();
|
|
16
|
-
const network: networks.Network = networks.regtest;
|
|
17
|
-
|
|
18
|
-
describe('Transaction Builder', () => {
|
|
19
|
-
const wBtc: wBTC = new wBTC(network);
|
|
20
|
-
|
|
21
|
-
const wallet: Wallet = new Wallet(Regtest.wallet, network);
|
|
22
|
-
logger.log(`Loaded wallet: ${wallet.p2tr} - ${wallet.p2wpkh}`);
|
|
23
|
-
|
|
24
|
-
const utxoManager: OPNetLimitedProvider = new OPNetLimitedProvider('http://localhost:9001');
|
|
25
|
-
const factory: TransactionFactory = new TransactionFactory();
|
|
26
|
-
|
|
27
|
-
/** @test {TransactionBuilder#build} */
|
|
28
|
-
test('should be able to build a transaction', async () => {
|
|
29
|
-
const utxoSetting: FetchUTXOParams = {
|
|
30
|
-
address: wallet.p2wpkh,
|
|
31
|
-
minAmount: 10000n,
|
|
32
|
-
requestedAmount: 100000n,
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const utxos: UTXO[] = await utxoManager.fetchUTXO(utxoSetting);
|
|
36
|
-
console.log(`UTXOs:`, utxos);
|
|
37
|
-
|
|
38
|
-
if (!utxos) {
|
|
39
|
-
throw new Error('No UTXOs found');
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
logger.log(`UTXOs fetched. Count: ${utxos.length}`);
|
|
43
|
-
|
|
44
|
-
const interactionParameters: IInteractionParameters = {
|
|
45
|
-
from: wallet.p2wpkh,
|
|
46
|
-
to: wBtc.getAddress(),
|
|
47
|
-
utxos: utxos,
|
|
48
|
-
signer: wallet.keypair,
|
|
49
|
-
network: network,
|
|
50
|
-
feeRate: 150,
|
|
51
|
-
priorityFee: 500n,
|
|
52
|
-
calldata: Buffer.from('test'),
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const finalTx = factory.signInteraction(interactionParameters);
|
|
56
|
-
console.log(`Transaction:`, finalTx);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
Binary file
|