Skip to content

Commit d679dc6

Browse files
Merge branch '1886-remove-all-but-core-and-thorest-packages' into 1870-request---remove-the-errors-module-design-an-easy-to-extend-error-handling-hierarchy
# Conflicts: # packages/network/src/thor-client/transactions/helpers/delegation-handler.ts
2 parents d343960 + 3207154 commit d679dc6

File tree

987 files changed

+177
-74377
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

987 files changed

+177
-74377
lines changed

.changeset/config.json

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"baseBranch": "main",
99
"updateInternalDependencies": "patch",
1010
"ignore": [
11-
"docs",
1211
"sdk-cloudflare-integration",
1312
"sdk-hardhat-integration",
1413
"sdk-nextjs-integration",

.changeset/funny-masks-cheat.md

-12
This file was deleted.

.changeset/pre.json

+1-6
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,9 @@
22
"mode": "exit",
33
"tag": "latest",
44
"initialVersions": {
5-
"@vechain/sdk-aws-kms-adapter": "1.0.0",
65
"@vechain/sdk-core": "1.0.0",
76
"@vechain/sdk-errors": "1.0.0",
8-
"@vechain/sdk-ethers-adapter": "1.0.0",
9-
"@vechain/sdk-hardhat-plugin": "1.0.0",
10-
"@vechain/sdk-logging": "1.0.0",
11-
"@vechain/sdk-network": "1.0.0",
12-
"@vechain/sdk-rpc-proxy": "1.0.0"
7+
"@vechain/sdk-logging": "1.0.0"
138
},
149
"changesets": []
1510
}

.github/CONTRIBUTING.md

-203
Original file line numberDiff line numberDiff line change
@@ -2,243 +2,40 @@
22

33
## Introduction
44

5-
Thank you for considering contributing to the VeChain SDK project.
6-
This SDK is an important part of the VeChain ecosystem, and your contributions are greatly appreciated.
7-
This document outlines the process and guidelines for contributing.
8-
95
## Getting Started
106

11-
1. Fork the repository on GitHub.
12-
2. Clone your forked repository to your local machine.
13-
3. Install the dependencies by running yarn install.
14-
4. Make your changes are in a new git branch: git checkout -b my-fix-branch master.
15-
167
## Coding Rules
178

18-
To ensure consistency throughout the source code, please adhere to the following rules:
19-
20-
1. Follow the coding style used throughout the project. The project includes an ESLint configuration, so consider installing an ESLint plugin for your text editor for real-time linting.
21-
2. All public API methods must be documented.
22-
3. Write tests for new features and bug fixes.
23-
4. For integration tests using thor-solo, if needed, use a `TEST_ACCOUNT` in order to isolate previous integration tests.
24-
5. Follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for commit messages.
25-
269
## Guidelines for Documentation Updates
2710

28-
Accurate and up-to-date documentation is vital for the usability and maintainability of the vechain-sdk.
29-
We welcome contributions that improve or update the documentation.
30-
3111
### Textual Documentation
3212

33-
1. **Clarity and Accuracy**: Ensure that the documentation is clear, accurate, and easy to understand. Avoid technical jargon where possible, or provide explanations for technical terms.
34-
2. **Consistency**: Follow the existing format and style of the documentation. This includes using the same tense, person, and voice.
35-
3. **Markdown Formatting**: Use Markdown formatting appropriately to improve the readability of the document.
36-
3713
### Diagrams
3814

39-
1. **Updating Diagrams**: In the `docs/diagrams` directory, update diagrams if there are significant changes to the system architecture or if you find any outdated diagrams.
40-
2. **Tools**: Use mermaid markdown diagrams that produce clear, high-quality diagrams.
41-
3. **Documenting Changes**: Include a brief description of what was changed in the diagram and why in your pull request.
42-
4315
## Commenting Guidelines
4416

4517
### Class Commenting
4618

47-
Provide an overview of the class's purpose, how it should be used, and in which subsystem it belongs if applicable.
48-
49-
```typescript
50-
/**
51-
* Represents a statistical utility that provides methods to compute
52-
* common statistical metrics.
53-
*
54-
* @remarks
55-
* This class provides static methods and adheres to the immutability and statelessness principles.
56-
* It is a part of the {@link vechain-sdk#Statistics | Statistics subsystem}.
57-
*/
58-
export class Statistics {
59-
...
60-
}
61-
```
62-
63-
### Method Commenting
64-
65-
Document the purpose, parameters, return values, and usage examples of methods, as well as any exceptions they might throw.
66-
67-
```typescript
68-
/**
69-
* Computes the average of two numbers.
70-
*
71-
* @remarks
72-
* This method is designed for two numbers only and returns the exact arithmetic mean.
73-
* It is a part of the {@link vechain-sdk#Statistics | Statistics subsystem}.
74-
*
75-
* @param x - The first input number.
76-
* @param y - The second input number.
77-
* @returns The arithmetic mean of `x` and `y`.
78-
*
79-
* @example
80-
* ```
81-
* const average = Statistics.getAverage(5, 3);
82-
* console.log(average); // Outputs: 4
83-
* ```
84-
*/
85-
public static getAverage(x: number, y: number): number {
86-
return (x + y) / 2.0;
87-
}
88-
```
89-
90-
### Property Commenting
91-
92-
Explain the purpose of properties and any noteworthy characteristics about them.
93-
94-
```typescript
95-
/**
96-
* The total count of instances created from this class.
97-
*
98-
* @remarks
99-
* This property is static and reflects the total count across all instances.
100-
*/
101-
public static instanceCount: number = 0;
102-
```
103-
10419
### Exception Commenting
10520

106-
Describe under what conditions methods throw exceptions.
107-
108-
```typescript
109-
/**
110-
* Parses a string and returns its integer representation.
111-
*
112-
* @param s - The string to parse.
113-
* @returns The integer representation of the string.
114-
*
115-
* @throws {NumberFormatException}
116-
* Thrown when the provided string does not have a valid integer format.
117-
*/
118-
public static parseInteger(s: string): number {
119-
const result = parseInt(s, 10);
120-
if (isNaN(result)) {
121-
throw new NumberFormatException(`Invalid number format: ${s}`);
122-
}
123-
return result;
124-
}
125-
```
12621
## Tests
12722

128-
Testing is a crucial aspect of maintaining a high-quality codebase in the VeChain SDK project. Tests not only validate the correctness of the code but also ensure that future changes do not inadvertently introduce bugs or regressions. It is imperative that all new features and bug fixes are accompanied by corresponding tests to verify their functionality. Additionally, existing code should have adequate test coverage to maintain its stability over time. We aim for 100% test coverage to guarantee the reliability of the SDK.
129-
13023
### Test Group Tagging
13124

132-
When adding new tests or modifying existing ones, please make use of the `@group` tag to indicate the nature of the test:
133-
134-
- For unit tests, use `@group unit`.
135-
- For integration tests, use `@group integration`.
136-
137-
```typescript
138-
/**
139-
* Bloom filter tests
140-
*
141-
* @NOTE different from ../utils/bloom/bloom.test.ts.
142-
* This tests bloom functionality, not the utils.
143-
* @group unit/bloom
144-
*/
145-
describe('Bloom Filter', () => {
146-
/**
147-
* Test estimate K function
148-
*/
149-
test('Estimate K', () => {
150-
bloomKTestCases.forEach((bloomKTestCase) => {
151-
expect(bloom.calculateK(bloomKTestCase.calculateK)).toBe(
152-
bloomKTestCase.estimatedK
153-
);
154-
});
155-
});
156-
});
157-
```
158-
159-
These tags help us categorize and run specific types of tests when needed. This ensures that our test suite remains well-organized and efficient.
160-
16125
### Test File Naming Convention
16226

163-
When adding new test files, please adhere to the following naming conventions to maintain consistency across the project:
164-
165-
```typescript
166-
/**
167-
* Allowed names for test files
168-
*/
169-
const allowedNames = [
170-
// Unit tests
171-
'.unit.test.ts',
172-
173-
// Integration tests
174-
'.testnet.test.ts',
175-
'.mainnet.test.ts',
176-
'.solo.test.ts',
177-
178-
// Mocks
179-
'.mock.testnet.ts',
180-
'.mock.mainnet.ts',
181-
'.mock.solo.ts'
182-
];
183-
```
184-
18527
## Error handling conventions
18628

187-
Errors handling is delegated to `errors` package.
188-
Follow all code snapshots and convention related to it.
189-
19029
### Input validation
19130

192-
The typical flow to handle errors is the following:
193-
194-
```typescript
195-
import { ErrorClass } from 'vechain-sdk';
196-
197-
function some_function(input: any) {
198-
if(!valid_input(input)) {
199-
throw new ErrorClass('method_name', 'error_message', { error_data });
200-
}
201-
}
202-
```
203-
20431
### Error thrown by a try/catch block
20532

206-
The typical flow to handle errors is the following:
207-
208-
```typescript
209-
import { ErrorClass } from 'vechain-sdk';
210-
211-
// ... Some code before ...
212-
try {
213-
// Some code that an throw errors
214-
} catch (inner_error) {
215-
throw new ErrorClass('method_name', 'error_message', { error_data }, inner_error);
216-
}
217-
// ... Some code after ...
218-
```
219-
22033
## Issues
22134

222-
If you find a bug or want to request a new feature, please open a new issue. When filing a bug report, please provide a clear description of the problem, including the expected behavior and the actual behavior.
223-
22435
## Submitting a Pull Request
22536

226-
Before submitting a pull request, please make sure the following is done:
227-
228-
1. Rebase your branch on the latest main branch.
229-
2. Run the test suite to make sure your changes do not break existing functionality. You can do this by running `yarn test`.
230-
3. Squash your commits into a single commit with a clear message.
231-
4. Push your branch to your fork on GitHub.
232-
5. Open a pull request against the main branch of the vechain-sdk repository.
233-
23437
### Pull Request Review
23538

236-
All submissions, including submissions by project members, require a review. We use GitHub's pull request review feature for this.
237-
23839
## Code of Conduct
23940

240-
We are committed to providing a welcoming and inclusive environment for everyone who contributes to or interacts with the VeChain SDK project. To ensure a positive experience for our community, we have established a [Code of Conduct](CODE_OF_CONDUCT.md) that outlines our expectations for behavior. We encourage all contributors, maintainers, and users to familiarize themselves with this code, as it reflects our commitment to creating a diverse and respectful community. Thank you for helping us maintain a welcoming and collaborative space for all.
241-
24241
## Thank You
243-
244-
Your contributions to open source, large or small, make projects like this possible. Thank you for taking the time to contribute.

.github/workflows/on-pr.yml

+1-14
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,9 @@ jobs:
2929
id: start-solo
3030
run: yarn start-thor-solo
3131

32-
- name: Test docs examples
33-
run: |
34-
yarn test:examples
35-
3632
- name: Stop Thor solo node
3733
id: stop-solo
3834
run: yarn stop-thor-solo
39-
40-
test-apps:
41-
uses: ./.github/workflows/test-apps.yml
42-
secrets: inherit
43-
44-
rpc-proxy:
45-
uses: ./.github/workflows/rpc-proxy.yml
46-
secrets: inherit
4735

4836
install-build:
4937
uses: ./.github/workflows/build-lint.yml
@@ -56,5 +44,4 @@ jobs:
5644
unit-integration-test-browser:
5745
uses: ./.github/workflows/unit-integration-test-browser.yml
5846
secrets: inherit
59-
60-
47+

.github/workflows/on-tag.yml

-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,3 @@ jobs:
1010
uses: ./.github/workflows/publish-sdk.yml
1111
secrets: inherit
1212

13-
rpc-proxy-docker-publish:
14-
uses: ./.github/workflows/rpc-proxy.yml
15-
secrets: inherit

.github/workflows/publish-sdk.yml

+1-38
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,6 @@ jobs:
4949
yarn publish
5050
env:
5151
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
52-
53-
- name: Publish network
54-
run: |
55-
cd packages/network
56-
yarn version --no-git-tag-version --new-version ${{ github.ref_name }}
57-
yarn publish
58-
env:
59-
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
60-
61-
- name: Publish Hardhat Plugin
62-
run: |
63-
cd packages/hardhat-plugin
64-
yarn version --no-git-tag-version --new-version ${{ github.ref_name }}
65-
yarn publish
66-
env:
67-
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
6852

6953
- name: Publish logging
7054
run: |
@@ -73,27 +57,6 @@ jobs:
7357
yarn publish
7458
env:
7559
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
76-
77-
- name: Publish RPC proxy
78-
run: |
79-
cd packages/rpc-proxy
80-
yarn version --no-git-tag-version --new-version ${{ github.ref_name }}
81-
yarn publish
82-
env:
83-
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
8460

85-
- name: Publish Ethers Adapter
86-
run: |
87-
cd packages/ethers-adapter
88-
yarn version --no-git-tag-version --new-version ${{ github.ref_name }}
89-
yarn publish
90-
env:
91-
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
9261

93-
- name: Publish AWS KMS Adapter
94-
run: |
95-
cd packages/aws-kms-adapter
96-
yarn version --no-git-tag-version --new-version ${{ github.ref_name }}
97-
yarn publish
98-
env:
99-
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
62+

0 commit comments

Comments
 (0)