Skip to content

Commit

Permalink
[Tests] Adding Unit Tests (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
bh2smith authored Mar 13, 2024
1 parent af1b3a7 commit c798703
Show file tree
Hide file tree
Showing 14 changed files with 4,407 additions and 4,262 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ jobs:
with:
node-version: '20'

- name: Install Dependencies
run: npm install
- name: Install & Build
run: yarn && yarn build

- name: Lint
run: npm run lint
- name: Lint & Test
run: |
yarn lint
yarn test
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"semi": true,
"trailingComma": "es5",
"singleQuote": false,
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"endOfLine": "lf"
}
25 changes: 11 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

NEAR-CA is a TypeScript library that provides an abstraction layer for interacting with the NEAR blockchain. It simplifies the process of performing transactions and managing accounts on NEAR and Ethereum chains.

Intended to be used on server-side applications only. This works best with [Bun](https://bun.sh).
Intended to be used on server-side applications only.

## Features

Expand All @@ -18,17 +18,7 @@ Intended to be used on server-side applications only. This works best with [Bun]
To install NEAR-CA, run the following command:

```bash
bun add near-ca
```

Alternatively,

```bash
npm add near-ca
```

```bash
pnpm add near-ca
yarn add near-ca
```

## Usage
Expand Down Expand Up @@ -63,8 +53,15 @@ await signAndSendTransaction(

## Examples

Each of the following scripts can be run with

```bash
npx ts-node examples/*.ts
```

1. [Mint NFT](./examples/mint-nft.ts)
1. [Send ETH](./examples/send-eth.ts)
2. [Send ETH](./examples/send-eth.ts)
3. [Transfer NFT](./examples/transfer-nft.ts)

## Configuration

Expand All @@ -74,4 +71,4 @@ Before using NEAR-CA, ensure you have the following environment variables set:
- `NEAR_ACCOUNT_PRIVATE_KEY`: Your NEAR account private key.
- `NEAR_MULTICHAIN_CONTRACT`: The NEAR contract that handles multichain operations.

Copy the `.env.example` file and place these values in `.env`
Copy the `.env.example` file and place these values in `.env`
2 changes: 1 addition & 1 deletion examples/send-eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const run = async (): Promise<void> => {
await signAndSendTransaction(
sender,
"0xAA5FcF171dDf9FE59c985A28747e650C2e9069cA",
0.001
0.0001
);
};

Expand Down
4 changes: 4 additions & 0 deletions jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"preset": "ts-jest",
"testEnvironment": "node"
}
Loading

0 comments on commit c798703

Please sign in to comment.