-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8976baf
Showing
9 changed files
with
1,497 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# From https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs#using-the-nodejs-starter-workflow | ||
name: Node.js and Solana CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
# Install Solana | ||
# From https://docs.solana.com/cli/install-solana-cli-tools | ||
- run: sh -c "$(curl -sSfL https://release.solana.com/stable/install)" | ||
|
||
- name: Add to PATH | ||
shell: bash | ||
run: | | ||
echo "~/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH | ||
# DEBUG | ||
- run: echo "DEBUG" | ||
- run: echo $PATH | ||
- run: ls -la ~/.local/share/solana/install/active_release/bin | ||
|
||
# Install everything | ||
- run: npm ci | ||
|
||
- name: Check Solana keygn is installed | ||
run: which solana-keygen | ||
|
||
# Run tests | ||
- run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
src/temp | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Solana node helpers | ||
|
||
## getKeypairFromFile | ||
|
||
Gets a keypair from a file - the format is the same as [Solana CLI](https://docs.solana.com/wallet-guide/file-system-wallet) uses: | ||
|
||
To load the default keypair `~/.config/solana/id.json`, just run: | ||
|
||
``` | ||
const keyPair = await Keypair.fromFile(); | ||
``` | ||
|
||
or to load a specific file: | ||
|
||
``` | ||
const keyPair = await Keypair.fromFile('somefile.json'); | ||
``` | ||
|
||
or using home dir expansion: | ||
|
||
``` | ||
const keyPair = await Keypair.fromFile('~/code/solana/demos/steve.json'); | ||
``` | ||
|
||
## getKeypairFromEnvironment | ||
|
||
Gets a keypair from a secret key stored in an environment variable. This is typically used to load secret keys from [env files](https://stackoverflow.com/questions/68267862/what-is-an-env-or-dotenv-file-exactly). | ||
|
||
## Development | ||
|
||
To run tests | ||
|
||
``` | ||
npm run test | ||
``` | ||
|
||
The tests use the [node native test runner](https://blog.logrocket.com/exploring-node-js-native-test-runner/). |
Oops, something went wrong.