Skip to content

Commit

Permalink
fix: headings in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mikemaccana authored Jan 9, 2024
1 parent bba5202 commit 4ff79d8
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Eventually most of these will end up in `@solana/web3.js`.
npm i @solana-developers/helpers
```

# helpers for the browser and node.js
## helpers for the browser and node.js

## getCustomErrorMessage()
### getCustomErrorMessage()

Sometimes Solana libaries return an error like:

Expand Down Expand Up @@ -70,7 +70,7 @@ And `errorMessage` will now be:
"This token mint cannot freeze accounts";
```

## requestAndConfirmAirdrop()
### requestAndConfirmAirdrop()

Request and confirm an airdrop in one step. This is built the next future version of web3.js, but we've added it here now for your convenience.

Expand All @@ -84,9 +84,9 @@ const balance = await requestAndConfirmAirdrop(

As soon as the `await` returns, the airdropped tokens will be ready in the address, and the new balance of tokens is returned by requestAndConfirmAirdrop(). This makes `requestAndConfirmAirdrop()` very handy in testing scripts.

# node.js specific helpers
## node.js specific helpers

## getKeypairFromFile()
### getKeypairFromFile()

Gets a keypair from a file - the format must be the same as [Solana CLI](https://docs.solana.com/wallet-guide/file-system-wallet) uses, ie, a JSON array of numbers:

Expand All @@ -108,15 +108,15 @@ or using home dir expansion:
const keyPair = await getKeypairFromFile("~/code/solana/demos/steve.json");
```

## getKeypairFromEnvironment()
### 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).

```typescript
const keyPair = await getKeypairFromEnvironment("SECRET_KEY");
```

## addKeypairToEnvFile()
### addKeypairToEnvFile()

Saves a keypair to the environment file.

Expand All @@ -132,7 +132,7 @@ await addKeypairToEnvFile(testKeypair, "SECRET_KEY", ".env.local");

This will also reload the env file

## requestAndConfirmAirdrop()
### requestAndConfirmAirdrop()

Request and confirm an airdrop in one step. This is built into the next version of web3.js, but we've added it here now for your convenience.

Expand All @@ -146,7 +146,7 @@ await requestAndConfirmAirdrop(

As soon as the `await` returns, the airdropped tokens will be ready in the address. This makes `requestAndConfirmAirdrop()` very handy in testing scripts. Note you may want to check the balance (`const balance = await connection.getBalance(keypair.publicKey);`) to ensure you only use your airdrops when you need them.

### Secret key format
## Secret key format

Secret keys can be read in either the more compact base58 format (`base58.encode(randomKeypair.secretKey);`), like:

Expand Down

0 comments on commit 4ff79d8

Please sign in to comment.