Skip to content

Commit 7ed3e35

Browse files
feat: internal NPM publishing (#243)
* chore: setting up for internal NPM publishing * fix: install step * refactor: publish sdk workflow * refactor: packages naming temporary for internal publishing * refactor: sequential publishing due to package dependencies * refactor: nodes client import * refactor: nodes client import * fix: network dependency in core * chore: idea ide settings * feat: added tests on internal publishing pipeline --------- Co-authored-by: Piero Bassa <pierobassa222@gmail.com>
1 parent 1cbc157 commit 7ed3e35

File tree

97 files changed

+318
-125
lines changed

Some content is hidden

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

97 files changed

+318
-125
lines changed

.github/workflows/publish-sdk.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish NPM package
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
permissions:
9+
contents: read
10+
packages: write
11+
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version-file: .nvmrc
20+
registry-url: 'https://npm.pkg.github.com/'
21+
- run: yarn install
22+
23+
- run: yarn build
24+
25+
- name: Run Unit & Integration tests
26+
run: yarn test
27+
28+
- name: Publish errors
29+
run: |
30+
cd packages/errors
31+
yarn version --no-git-tag-version --new-version ${{ github.ref_name }}
32+
yarn publish
33+
env:
34+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
35+
36+
- name: Publish core
37+
run: |
38+
cd packages/core
39+
yarn version --no-git-tag-version --new-version ${{ github.ref_name }}
40+
yarn publish
41+
env:
42+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
43+
44+
- name: Publish network
45+
run: |
46+
cd packages/network
47+
yarn version --no-git-tag-version --new-version ${{ github.ref_name }}
48+
yarn publish
49+
env:
50+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ junit.xml
1919

2020
# docs
2121
docs/build/*.md
22-
api-docs/
22+
api-docs/
23+
24+
# IDE
25+
.idea

apps/sdk-user/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"build": "rm -rf ./dist && tsup src/index.ts --format cjs,esm --dts"
88
},
99
"dependencies": {
10-
"@vechain-sdk/core": "*",
10+
"@vechainfoundation/vechain-sdk-core": "*",
1111
"typescript": "^5.2.2"
1212
}
1313
}

apps/sdk-user/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { core, mnemonic } from '@vechain-sdk/core';
1+
import { core, mnemonic } from '@vechainfoundation/vechain-sdk-core';
22

33
const phrase = mnemonic.generate();
44
console.log(phrase);

docs/accounts.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Mnemonics represent a standard human-readable approach to generate private keys.
1313
### BIP-39
1414

1515
```typescript { name=bip39, category=example }
16-
import { mnemonic } from '@vechain-sdk/core';
16+
import { mnemonic } from '@vechainfoundation/vechain-sdk-core';
1717
import { expect } from 'expect';
1818

1919
// Generate BIP39 mnemonic words, default to 12 words(128bit strength)
@@ -35,7 +35,7 @@ expect(ok).toBeTruthy();
3535
### BIP-32
3636

3737
```typescript { name=bip32, category=example }
38-
import { mnemonic, HDNode } from '@vechain-sdk/core';
38+
import { mnemonic, HDNode } from '@vechainfoundation/vechain-sdk-core';
3939

4040
// Generate BIP39 mnemonic words, default to 12 words(128bit strength)
4141
const rndMnemonic = mnemonic.generate();
@@ -60,7 +60,7 @@ for (let i = 0; i < 5; i++) {
6060
### From Public Key
6161

6262
```typescript { name=pubkey, category=example }
63-
import { HDNode } from '@vechain-sdk/core';
63+
import { HDNode } from '@vechainfoundation/vechain-sdk-core';
6464

6565
// Create HD node from xpub
6666
const xpub = Buffer.from(
@@ -94,7 +94,7 @@ On the other hand, Keystore is employed for encrypting private keys in accordanc
9494
Through the use of mnemonics and keystore, Vechain SDK ensures secure and user-friendly account handling. Mnemonics allow for easy generation of private keys, while keystore provides an additional layer of protection by encrypting the private keys in a standardized manner as per Ethereum's security practices. These functionalities collectively contribute to a robust and secure approach to managing accounts within the Thor ecosystem.
9595

9696
```typescript { name=keystore, category=example }
97-
import { keystore, secp256k1 } from '@vechain-sdk/core';
97+
import { keystore, secp256k1 } from '@vechainfoundation/vechain-sdk-core';
9898
import { expect } from 'expect';
9999

100100
async function example(): Promise<void> {

docs/bloom-filter.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ It is important to emphasise that the bloom filter's design is intentionally eng
2525
By employing bloom filters in this manner, the VechainThor blockchain significantly reduces the computational burden associated with address and block lookup operations, resulting in improved responsiveness and heightened scalability. This, in turn, positively impacts the overall user experience and facilitates seamless integration with various applications and services built on the blockchain platform.
2626

2727
```typescript { name=bloom, category=example }
28-
import { bloom } from '@vechain-sdk/core';
28+
import { bloom } from '@vechainfoundation/vechain-sdk-core';
2929
import { expect } from 'expect';
3030

3131
// Get best value of k (bits per key)

docs/certificates.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import {
4040
secp256k1,
4141
blake2b256,
4242
addressUtils
43-
} from '@vechain-sdk/core';
43+
} from '@vechainfoundation/vechain-sdk-core';
4444

4545
// In this example we create a certificate and
4646
// sign it, and then call verify to verify the signature

docs/contracts.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
This example showcases the process of building a smart contract transaction using the Vechain SDK.
88

99
```typescript { name=contract-deploy, category=example }
10-
import { buildDeployContractTransaction } from '@vechain-sdk/core';
10+
import { buildDeployContractTransaction } from '@vechainfoundation/vechain-sdk-core';
1111
import { expect } from 'expect';
1212

1313
const contractBytecode =
@@ -20,7 +20,7 @@ expect(transaction.body.clauses[0].data).toEqual(contractBytecode);
2020

2121
### Code Explanation
2222

23-
- The `buildDeployContractTransaction` function from `@vechain-sdk/core` is employed to construct a deploy contract transaction.
23+
- The `buildDeployContractTransaction` function from `@vechainfoundation/vechain-sdk-core` is employed to construct a deploy contract transaction.
2424

2525
- The smart contract bytecode is represented by the `contractBytecode` variable.
2626

@@ -37,7 +37,7 @@ This example provides a practical demonstration of utilizing the Vechain SDK to
3737
This example demonstrates the process of building a transaction to call a function on a deployed smart contract using the Vechain SDK.
3838

3939
```typescript { name=contract-function-call, category=example }
40-
import { networkInfo, buildCallContractTransaction } from '@vechain-sdk/core';
40+
import { networkInfo, buildCallContractTransaction } from '@vechainfoundation/vechain-sdk-core';
4141
import { expect } from 'expect';
4242

4343
const contractABI = JSON.stringify([
@@ -100,7 +100,7 @@ expect(transaction.body.gasPriceCoef).toBeDefined();
100100

101101
- The example involves a smart contract with an ABI (Application Binary Interface) defined in JSON format. The ABI describes the functions and their parameters in the contract.
102102

103-
- The `buildCallContractTransaction` function from `@vechain-sdk/core` is used to create a transaction for calling a specific function on the smart contract.
103+
- The `buildCallContractTransaction` function from `@vechainfoundation/vechain-sdk-core` is used to create a transaction for calling a specific function on the smart contract.
104104

105105
- The function `setValue` is called with an argument of 123, representing the value to be set in the smart contract.
106106

docs/cryptography.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ vechain sdk supports blake2b256 and keccak256 hash functions.
1515
Blake2b256 is a specific type of hash function known for its speed and security. It takes any input data and generates a 256-bit (32-byte) hash value. The blake2b256 part refers to the specific design of the algorithm, and the 256 indicates the length of the resulting hash code. Blake2b256 is widely used in cryptographic applications, blockchain technologies, and secure data storage.
1616

1717
```typescript { name=blake2b256, category=example }
18-
import { blake2b256, type HashInput } from '@vechain-sdk/core';
18+
import { blake2b256, type HashInput } from '@vechainfoundation/vechain-sdk-core';
1919
import { expect } from 'expect';
2020

2121
const toHash: HashInput = 'hello world';
@@ -31,7 +31,7 @@ expect(hash.toString('hex')).toBe(
3131
Keccak256 is another type of hash function, and it's particularly well-known for its use in the blockchain world, specifically in cryptocurrencies like Ethereum. Similar to Blake2b256, Keccak256 also takes input data and generates a 256-bit (32-byte) hash value. The Keccak part refers to the family of algorithms, and again, 256 denotes the length of the output hash code.
3232

3333
```typescript { name=keccak256, category=example }
34-
import { keccak256, type HashInput } from '@vechain-sdk/core';
34+
import { keccak256, type HashInput } from '@vechainfoundation/vechain-sdk-core';
3535
import { expect } from 'expect';
3636

3737
const toHash: HashInput = 'hello world';
@@ -60,7 +60,7 @@ import {
6060
secp256k1,
6161
addressUtils,
6262
type HashInput
63-
} from '@vechain-sdk/core';
63+
} from '@vechainfoundation/vechain-sdk-core';
6464
import { expect } from 'expect';
6565

6666
// Generate a private key

docs/encoding.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Vechain SDK extends its support to handle both Application Binary Interface (ABI
1111
Vechain SDK provides functionality to interact with smart contracts on the VechainThor blockchain using ABI's. An ABI is a standardised interface format that defines the method signatures, input parameters, and output types of smart contract functions. With Vechain SDK, developers can conveniently encode and decode data for interacting with smart contracts, making it easier to call contract functions and process their results.
1212

1313
```typescript { name=abi, category=example }
14-
import { abi } from '@vechain-sdk/core';
14+
import { abi } from '@vechainfoundation/vechain-sdk-core';
1515
import { expect } from 'expect';
1616

1717
// Create a new function
@@ -61,7 +61,7 @@ expect(data).toBe(expected);
6161
The contract interface is used to provide a higher level of abstraction to allow direct interaction with a smart contract. To create a contract interface is necessary to have a compatible smart contract ABI. Vechain SDK provides a full implementation of the Contract interface as well as some methods to encode directly a specific fragment of the smart contract (until now only functions and events fragments are supported). Encoding and decoding are based on the ABI one.
6262

6363
```typescript { name=contract, category=example }
64-
import { contract } from '@vechain-sdk/core';
64+
import { contract } from '@vechainfoundation/vechain-sdk-core';
6565
import { expect } from 'expect';
6666

6767
const contractABI = JSON.stringify([
@@ -114,7 +114,7 @@ RLP is a serialisation technique used on the VechainThor blockchain. It is used
114114
By supporting ABI and RLP encoding handling, Vechain SDK equips developers with the necessary tools to interact with smart contracts and handle data efficiently on the VechainThor blockchain. This further enhances the library's capabilities and contributes to the seamless development of decentralised applications on the platform.
115115

116116
```typescript { name=rlp, category=example }
117-
import { RLP } from '@vechain-sdk/core';
117+
import { RLP } from '@vechainfoundation/vechain-sdk-core';
118118
import { expect } from 'expect';
119119

120120
// Define the profile for tx clause structure

docs/examples/accounts/bip32.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { mnemonic, HDNode } from '@vechain-sdk/core';
1+
import { mnemonic, HDNode } from '@vechainfoundation/vechain-sdk-core';
22

33
// Generate BIP39 mnemonic words, default to 12 words(128bit strength)
44
const rndMnemonic = mnemonic.generate();

docs/examples/accounts/bip39.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { mnemonic } from '@vechain-sdk/core';
1+
import { mnemonic } from '@vechainfoundation/vechain-sdk-core';
22
import { expect } from 'expect';
33

44
// Generate BIP39 mnemonic words, default to 12 words(128bit strength)

docs/examples/accounts/keystore.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { keystore, secp256k1 } from '@vechain-sdk/core';
1+
import { keystore, secp256k1 } from '@vechainfoundation/vechain-sdk-core';
22
import { expect } from 'expect';
33

44
async function example(): Promise<void> {

docs/examples/accounts/pubkey.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { HDNode } from '@vechain-sdk/core';
1+
import { HDNode } from '@vechainfoundation/vechain-sdk-core';
22

33
// Create HD node from xpub
44
const xpub = Buffer.from(

docs/examples/bloom/bloom.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { bloom } from '@vechain-sdk/core';
1+
import { bloom } from '@vechainfoundation/vechain-sdk-core';
22
import { expect } from 'expect';
33

44
// Get best value of k (bits per key)

docs/examples/certificates/sign_verify.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
secp256k1,
55
blake2b256,
66
addressUtils
7-
} from '@vechain-sdk/core';
7+
} from '@vechainfoundation/vechain-sdk-core';
88

99
// In this example we create a certificate and
1010
// sign it, and then call verify to verify the signature

docs/examples/contracts/contract-deploy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { buildDeployContractTransaction } from '@vechain-sdk/core';
1+
import { buildDeployContractTransaction } from '@vechainfoundation/vechain-sdk-core';
22
import { expect } from 'expect';
33

44
const contractBytecode =

docs/examples/contracts/contract-function-call.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { networkInfo, buildCallContractTransaction } from '@vechain-sdk/core';
1+
import { networkInfo, buildCallContractTransaction } from '@vechainfoundation/vechain-sdk-core';
22
import { expect } from 'expect';
33

44
const contractABI = JSON.stringify([

docs/examples/cryptography/blake2b256.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { blake2b256, type HashInput } from '@vechain-sdk/core';
1+
import { blake2b256, type HashInput } from '@vechainfoundation/vechain-sdk-core';
22
import { expect } from 'expect';
33

44
const toHash: HashInput = 'hello world';

docs/examples/cryptography/keccak256.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { keccak256, type HashInput } from '@vechain-sdk/core';
1+
import { keccak256, type HashInput } from '@vechainfoundation/vechain-sdk-core';
22
import { expect } from 'expect';
33

44
const toHash: HashInput = 'hello world';

docs/examples/cryptography/secp256k1.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
secp256k1,
44
addressUtils,
55
type HashInput
6-
} from '@vechain-sdk/core';
6+
} from '@vechainfoundation/vechain-sdk-core';
77
import { expect } from 'expect';
88

99
// Generate a private key

docs/examples/encoding/abi.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { abi } from '@vechain-sdk/core';
1+
import { abi } from '@vechainfoundation/vechain-sdk-core';
22
import { expect } from 'expect';
33

44
// Create a new function

docs/examples/encoding/contract.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { contract } from '@vechain-sdk/core';
1+
import { contract } from '@vechainfoundation/vechain-sdk-core';
22
import { expect } from 'expect';
33

44
const contractABI = JSON.stringify([

docs/examples/encoding/rlp.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { RLP } from '@vechain-sdk/core';
1+
import { RLP } from '@vechainfoundation/vechain-sdk-core';
22
import { expect } from 'expect';
33

44
// Define the profile for tx clause structure

docs/examples/transactions/blockref_expiration.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
type TransactionClause,
88
type TransactionBody,
99
unitsUtils
10-
} from '@vechain-sdk/core';
10+
} from '@vechainfoundation/vechain-sdk-core';
1111
import { expect } from 'expect';
1212

1313
// In this example a transaction is created that

docs/examples/transactions/fee_delegation.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { networkInfo } from '@vechain-sdk/core';
1+
import { networkInfo } from '@vechainfoundation/vechain-sdk-core';
22
import {
33
Transaction,
44
secp256k1,
@@ -9,7 +9,7 @@ import {
99
type TransactionBody,
1010
mnemonic,
1111
unitsUtils
12-
} from '@vechain-sdk/core';
12+
} from '@vechainfoundation/vechain-sdk-core';
1313
import { expect } from 'expect';
1414

1515
// In this example a fee delegated transaction is

docs/examples/transactions/multiple_clauses.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { networkInfo } from '@vechain-sdk/core';
1+
import { networkInfo } from '@vechainfoundation/vechain-sdk-core';
22
import {
33
Transaction,
44
secp256k1,
@@ -7,7 +7,7 @@ import {
77
type TransactionClause,
88
type TransactionBody,
99
unitsUtils
10-
} from '@vechain-sdk/core';
10+
} from '@vechainfoundation/vechain-sdk-core';
1111
import { expect } from 'expect';
1212

1313
// In this example a multiple clause transaction is

docs/examples/transactions/sign_decode.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { networkInfo } from '@vechain-sdk/core';
1+
import { networkInfo } from '@vechainfoundation/vechain-sdk-core';
22
import {
33
Transaction,
44
secp256k1,
@@ -7,7 +7,7 @@ import {
77
type TransactionClause,
88
type TransactionBody,
99
unitsUtils
10-
} from '@vechain-sdk/core';
10+
} from '@vechainfoundation/vechain-sdk-core';
1111
import { expect } from 'expect';
1212

1313
// In this example a simple single clause transaction is

docs/examples/transactions/tx_dependency.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { networkInfo } from '@vechain-sdk/core';
1+
import { networkInfo } from '@vechainfoundation/vechain-sdk-core';
22
import {
33
Transaction,
44
secp256k1,
@@ -7,7 +7,7 @@ import {
77
type TransactionClause,
88
type TransactionBody,
99
unitsUtils
10-
} from '@vechain-sdk/core';
10+
} from '@vechainfoundation/vechain-sdk-core';
1111
import { expect } from 'expect';
1212

1313
// In this example transaction A is created with no dependencies

docs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"build": "find . -name \"*.md\" -type f -maxdepth 1 ! -name \"README.md\" -delete && tsup builddocs.ts && node dist/builddocs.cjs"
99
},
1010
"dependencies": {
11-
"@vechain-sdk/core": "*",
11+
"@vechainfoundation/vechain-sdk-core": "*",
1212
"typescript": "^5.2.2"
1313
},
1414
"devDependencies": {

0 commit comments

Comments
 (0)