opnet 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/.gitattributes ADDED
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
@@ -0,0 +1,21 @@
1
+ name: Build Package CI
2
+ on:
3
+ push:
4
+ branches: [ "main" ]
5
+
6
+ jobs:
7
+ publish-gpr:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v4
11
+ - uses: actions/setup-node@v4
12
+ with:
13
+ node-version: 21.7.1
14
+ registry-url: https://npm.pkg.github.com/
15
+ scope: '@btc-vision'
16
+ - run: npm install
17
+ - run: npm run build
18
+ - run: npm publish
19
+ env:
20
+ NODE_AUTH_TOKEN: ${{secrets.BuildToken}}
21
+ NPM_TOKEN: ${{secrets.NpmToken}}
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/opnet.iml" filepath="$PROJECT_DIR$/.idea/opnet.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="WEB_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6
+ <excludeFolder url="file://$MODULE_DIR$/build" />
7
+ <excludeFolder url="file://$MODULE_DIR$/cjs" />
8
+ <excludeFolder url="file://$MODULE_DIR$/temp" />
9
+ <excludeFolder url="file://$MODULE_DIR$/tmp" />
10
+ </content>
11
+ <orderEntry type="inheritedJdk" />
12
+ <orderEntry type="sourceFolder" forTests="false" />
13
+ </component>
14
+ </module>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="PrettierConfiguration">
4
+ <option name="myConfigurationMode" value="AUTOMATIC" />
5
+ <option name="myRunOnSave" value="true" />
6
+ </component>
7
+ </project>
@@ -0,0 +1,12 @@
1
+ {
2
+ "printWidth": 100,
3
+ "trailingComma": "all",
4
+ "tabWidth": 4,
5
+ "semi": true,
6
+ "singleQuote": true,
7
+ "quoteProps": "as-needed",
8
+ "bracketSpacing": true,
9
+ "bracketSameLine": true,
10
+ "arrowParens": "always",
11
+ "singleAttributePerLine": true
12
+ }
package/LICENSE.md ADDED
@@ -0,0 +1,16 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2025 to the user BlobMaster41 on GitHub
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
6
+ documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
7
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
8
+ persons to whom the Software is furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
11
+ Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
14
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
15
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # OPNet - Smart Contracts on Bitcoin L1
2
+
3
+ ![Bitcoin](https://img.shields.io/badge/Bitcoin-000?style=for-the-badge&logo=bitcoin&logoColor=white)
4
+ ![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white)
5
+ ![NodeJS](https://img.shields.io/badge/Node%20js-339933?style=for-the-badge&logo=nodedotjs&logoColor=white)
6
+ ![NPM](https://img.shields.io/badge/npm-CB3837?style=for-the-badge&logo=npm&logoColor=white)
7
+ ![Gulp](https://img.shields.io/badge/GULP-%23CF4647.svg?style=for-the-badge&logo=gulp&logoColor=white)
8
+ ![ESLint](https://img.shields.io/badge/ESLint-4B3263?style=for-the-badge&logo=eslint&logoColor=white)
9
+
10
+ [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
11
+
12
+ ## Introduction
13
+
14
+ A complete, compact and simple library for the Bitcoin ecosystem, written in TypeScript. This library is designed to be
15
+ easy to use and understand, while providing a comprehensive set of functions for creating, reading and manipulating
16
+ Bitcoin transactions. This library is designed to be able to manipulate anything related to BSI (Bitcoin Smart
17
+ Inscription), smart contracts, and other Bitcoin-related technologies.
18
+
19
+ ## Getting Started
20
+
21
+ ### Prerequisites
22
+
23
+ - Node.js version 20.x or higher
24
+ - npm (Node Package Manager)
25
+
26
+ ### Installation
27
+
28
+ ```shell
29
+ npm i opnet
30
+ ```
31
+
32
+ #### Development
33
+
34
+ 1. Clone the repository:
35
+ ```bash
36
+ git clone https://github.com/btc-vision/opnet.git
37
+ ```
38
+ 2. Navigate to the repository directory:
39
+ ```bash
40
+ cd bsi-binary
41
+ ```
42
+ 3. Install the required dependencies:
43
+ ```bash
44
+ npm i
45
+ ```
46
+
47
+ ## Usage
48
+
49
+ Refer to the `docs/` directory for detailed guides on how to use the BSI Transaction Builder. Start
50
+ with `getting_started.md` and explore `api_reference.md` for comprehensive information about the functions available.
51
+
52
+ ## Contribution
53
+
54
+ Contributions are welcome! Please read through the `CONTRIBUTING.md` file for guidelines on how to submit issues,
55
+ feature requests, and pull requests. We appreciate your input and encourage you to help us improve the BSI Transaction
56
+ Builder.
57
+
58
+ ## License
59
+
60
+ This project is open source and available under the [MIT License](LICENSE). If you have any suggestions or
61
+ contributions, please feel free to submit a pull request.
File without changes
package/build/index.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ console.log(`The start of everything is the end of something else. The end of everything is the start of something else.`);
package/cjs/index.d.ts ADDED
File without changes
package/cjs/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";
package/gulpfile.js ADDED
@@ -0,0 +1,152 @@
1
+ process.on('uncaughtException', function (err) {
2
+ console.log('Caught exception: ', err);
3
+ });
4
+
5
+ import gulp from 'gulp';
6
+ import gulpcache from 'gulp-cached';
7
+ import logger from 'gulp-logger';
8
+ import ts from 'gulp-typescript';
9
+
10
+ const tsProject = ts.createProject('tsconfig.json');
11
+ const tsProjectCJS = ts.createProject('tsconfig.cjs.json');
12
+
13
+ function onError(e) {
14
+ console.log('Errored', e);
15
+ }
16
+
17
+ async function build() {
18
+ return new Promise(async (resolve) => {
19
+ tsProject
20
+ .src()
21
+ .pipe(gulpcache())
22
+ .pipe(
23
+ logger({
24
+ before: 'Starting...',
25
+ after: 'Project compiled!',
26
+ extname: '.js',
27
+ showChange: true,
28
+ }),
29
+ )
30
+ .pipe(tsProject())
31
+ .on('error', onError)
32
+ .pipe(gulp.dest('build'))
33
+ .on('end', async () => {
34
+ resolve();
35
+ });
36
+ });
37
+ }
38
+
39
+ async function buildCJS() {
40
+ return new Promise(async (resolve) => {
41
+ tsProject
42
+ .src()
43
+ .pipe(gulpcache())
44
+ .pipe(
45
+ logger({
46
+ before: 'Starting...',
47
+ after: 'Project compiled!',
48
+ extname: '.js',
49
+ showChange: true,
50
+ }),
51
+ )
52
+ .pipe(tsProjectCJS())
53
+ .on('error', onError)
54
+ .pipe(gulp.dest('cjs'))
55
+ .on('end', async () => {
56
+ resolve();
57
+ });
58
+ });
59
+ }
60
+
61
+ async function buildProtoYaml() {
62
+ return new Promise(async (resolve) => {
63
+ gulp.src('./src/**/*.yaml')
64
+ .pipe(
65
+ logger({
66
+ before: 'Starting...',
67
+ after: 'Compiled yaml.',
68
+ extname: '.yaml',
69
+ showChange: true,
70
+ }),
71
+ )
72
+ .pipe(gulpcache())
73
+ .pipe(gulp.dest('./build/'))
74
+ .on('end', () => {
75
+ gulp.src('./src/**/*.proto')
76
+ .pipe(
77
+ logger({
78
+ before: 'Starting...',
79
+ after: 'Compiled protobuf.',
80
+ extname: '.proto',
81
+ showChange: true,
82
+ }),
83
+ )
84
+ .pipe(gulp.dest('./build/'))
85
+ .on('end', async () => {
86
+ gulp.src('./src/config/*.conf')
87
+ .pipe(
88
+ logger({
89
+ before: 'Starting...',
90
+ after: 'Compiled conf.',
91
+ extname: '.conf',
92
+ showChange: true,
93
+ }),
94
+ )
95
+ .pipe(gulpcache())
96
+ .pipe(gulp.dest('./build/config'))
97
+ .on('end', async () => {
98
+ resolve();
99
+ });
100
+ });
101
+ });
102
+ });
103
+ }
104
+
105
+ gulp.task('default', async () => {
106
+ await build().catch((e) => {});
107
+ await buildProtoYaml();
108
+
109
+ return true;
110
+ });
111
+
112
+ gulp.task('cjs', async () => {
113
+ await buildCJS().catch((e) => {});
114
+ await buildProtoYaml();
115
+
116
+ return true;
117
+ });
118
+
119
+ gulp.task('watch', () => {
120
+ gulp.watch(
121
+ ['src/**/**/*.ts', 'src/**/*.ts', 'src/**/*.js', 'src/*.ts', 'src/*.js'],
122
+ async (cb) => {
123
+ await build().catch((e) => {
124
+ console.log('Errored 2', e);
125
+ });
126
+
127
+ cb();
128
+ },
129
+ );
130
+
131
+ gulp.watch(
132
+ [
133
+ 'src/components/*.yaml',
134
+ 'src/**/*.yaml',
135
+ 'src/src/*.yaml',
136
+ 'src/*.proto',
137
+ 'src/**/**/*.proto',
138
+ 'src/**/*.proto',
139
+ '*.proto',
140
+ '*.yaml',
141
+ '*.conf',
142
+ 'src/config/*.conf',
143
+ ],
144
+ async (cb) => {
145
+ await buildProtoYaml().catch((e) => {
146
+ console.log('Errored 2', e);
147
+ });
148
+
149
+ cb();
150
+ },
151
+ );
152
+ });
package/jest.config.ts ADDED
@@ -0,0 +1,43 @@
1
+ import type { Config } from '@jest/types';
2
+ import { BabelConfig } from 'ts-jest';
3
+
4
+ const esModules = ['chalk', 'supports-color'].join('|');
5
+
6
+ const babelConfig: BabelConfig = {
7
+ presets: ['@babel/preset-env'],
8
+ plugins: [
9
+ ["babel-plugin-transform-import-meta", { "module": "ES6" }]
10
+ ]
11
+ };
12
+
13
+ // @ts-ignore
14
+ const config: Config.InitialOptions = {
15
+ verbose: true,
16
+ rootDir: './',
17
+ transform: {
18
+ '\\.[jt]s?$': [
19
+ 'ts-jest',
20
+ {
21
+ useESM: true,
22
+ tsconfig: { allowJs: true },
23
+ babelConfig: babelConfig,
24
+ },
25
+ ],
26
+ },
27
+ modulePathIgnorePatterns: ['packages', 'build', 'node_modules', 'data', 'documents', 'models', 'repositories', 'utils', 'config'],
28
+ testMatch: [
29
+ '<rootPath>/tests/**/*.test.ts',
30
+ '<rootPath>/tests/*.test.ts',
31
+ '<rootDir>/tests/**',
32
+ ],
33
+ moduleNameMapper: {
34
+ '^(\\.{1,2}/.*)\\.[jt]s$': '$1',
35
+ },
36
+ moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
37
+ moduleDirectories: ['node_modules', 'src', 'build'],
38
+ testEnvironment: 'node',
39
+ transformIgnorePatterns: [`/node_modules/(?!${esModules})`, `/build/`],
40
+ preset: 'ts-jest/presets/js-with-babel',
41
+ };
42
+
43
+ export default config;
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "type": "module",
3
+ "version": "1.0.0",
4
+ "author": "BlobMaster41",
5
+ "description": "The perfect library for building Bitcoin based applications.",
6
+ "engines": {
7
+ "node": ">=16.0.0"
8
+ },
9
+ "exports": {
10
+ ".": {
11
+ "import": "./build/index.js",
12
+ "require": "./cjs/index.js",
13
+ "types": "./src/index.ts"
14
+ }
15
+ },
16
+ "homepage": "https://opnet.org",
17
+ "keywords": [
18
+ "bitcoin",
19
+ "opnet",
20
+ "btc"
21
+ ],
22
+ "license": "MIT",
23
+ "main": "build/index.js",
24
+ "types": "build/index.d.ts",
25
+ "typings": "build/index.d.ts",
26
+ "module": "build/index.js",
27
+ "name": "opnet",
28
+ "publishConfig": {
29
+ "access": "public",
30
+ "tag": "latest"
31
+ },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git://github.com/bsi-vision/opnet.git"
35
+ },
36
+ "scripts": {
37
+ "watch": "gulp watch",
38
+ "start": "cd build && node index",
39
+ "build": "gulp",
40
+ "test": "jest --runInBand",
41
+ "setup": "npm npm i && npm run build",
42
+ "install": "gulp && gulp cjs"
43
+ },
44
+ "devDependencies": {
45
+ "@babel/preset-env": "^7.24.3",
46
+ "@types/node": "^20.11.30",
47
+ "eslint": "^8.57.0",
48
+ "jest": "^29.7.0",
49
+ "prettier": "^3.2.5",
50
+ "typescript": "^5.4.3",
51
+ "typescript-eslint": "^7.4.0"
52
+ },
53
+ "dependencies": {
54
+ "@jest/types": "^29.6.3",
55
+ "@types/jest": "^29.5.12",
56
+ "babel-plugin-transform-import-meta": "^2.2.1",
57
+ "bitcoinjs-lib": "^6.1.5",
58
+ "gulp": "^4.0.2",
59
+ "gulp-cached": "^1.1.1",
60
+ "gulp-logger": "^0.0.2",
61
+ "gulp-typescript": "^6.0.0-alpha.1",
62
+ "tiny-secp256k1": "^2.2.3",
63
+ "ts-jest": "^29.1.2",
64
+ "ts-node": "^10.9.2"
65
+ },
66
+ "sideEffects": false
67
+ }
package/src/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ /** First commit made to reserve the project name. */
2
+
3
+ console.log(
4
+ `The start of everything is the end of something else. The end of everything is the start of something else.`,
5
+ );
@@ -0,0 +1,35 @@
1
+ {
2
+ "compilerOptions": {
3
+ "declaration": true,
4
+ "noImplicitAny": true,
5
+ "removeComments": true,
6
+ "suppressImplicitAnyIndexErrors": false,
7
+ "preserveConstEnums": true,
8
+ "resolveJsonModule": true,
9
+ "skipLibCheck": true,
10
+ "sourceMap": false,
11
+ "moduleDetection": "force",
12
+ "experimentalDecorators": true,
13
+ "lib": [
14
+ "es6",
15
+ "es2020",
16
+ "es2021",
17
+ "es2022",
18
+ "esnext",
19
+ "webworker",
20
+ "dom",
21
+ "scripthost"
22
+ ],
23
+ "strict": true,
24
+ "strictNullChecks": true,
25
+ "strictFunctionTypes": true,
26
+ "strictBindCallApply": true,
27
+ "strictPropertyInitialization": true,
28
+ "alwaysStrict": true,
29
+ "moduleResolution": "node",
30
+ "allowJs": true,
31
+ "incremental": true,
32
+ "allowSyntheticDefaultImports": true
33
+ },
34
+ "include": ["src/**/*.ts", "src/*", "src/**/*.js", "src/*.ts", "src/*.js", "src/*.cjs"]
35
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "./tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "module": "CommonJS",
5
+ "outDir": "cjs",
6
+ "esModuleInterop": true,
7
+ "target": "esnext"
8
+ }
9
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "module": "esnext",
5
+ "outDir": "build",
6
+ "target": "esnext"
7
+ }
8
+ }