Skip to content

Commit

Permalink
Cookbock setup fix & add missing examples to README (#1447)
Browse files Browse the repository at this point in the history
* fix: documented missing examples & fixed way to run scripts via pnpm

* fix: add dev dependency used in pnpm scripts

---------

Co-authored-by: AlexKushnir1 <alex@alex-Precision-7510>
  • Loading branch information
AlexKushnir1 and AlexKushnir1 authored Jan 28, 2025
1 parent c49fd67 commit 8ad6e73
Show file tree
Hide file tree
Showing 3 changed files with 281 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/cookbook/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@ Collection of common use cases for [`near-api-js`](https://github.com/near/near-
| **TRANSACTIONS** | |
| [Get Transaction Status](./transactions/get-tx-status.ts) | Gets transaction status using a tx hash and associated account/contract ID. |
| [Batch Transactions](./transactions/batch-transactions.ts) | Sign and send multiple [transactions](https://docs.near.org/docs/concepts/transaction). |
| [Meta Transaction](./transactions/meta-transaction.ts) | Sign and send [meta transaction](https://docs.near.org/concepts/abstraction/meta-transactions). |
| [Meta Transaction Relayer](./transactions/meta-transaction-relayer.ts) | Send signed [meta transaction via relayer](https://docs.near.org/build/chain-abstraction/meta-transactions). |
| [Traverse Blocks](./transactions/traverse-blocks.ts) | Find transactions between two block hashes. |
| **UTILS** | |
| [Deploy Contract](./utils/deploy-contract.ts) | Deploys a contract using a pre-compiled .wasm file |
| [Calculate Gas](./utils/calculate-gas.ts) | Calculate [gas burnt](https://docs.near.org/docs/concepts/gas) from any contract call. |
| [Read State w/o Account](./utils/get-state.ts) | Read state of a contract without instantiating an account. |
| [Check Account Existence](./utils/check-account-existence.ts) | Check account existence by finding out the state of the account. |
| [Wrap](./utils/wrap-near.ts) & [Unwrap](./utils/unwrap-near.ts) NEAR | Wrap and unwrap NEAR using the `wrap.near` smart contract. |
| [Verify Signature](./utils/verify-signature.ts) | Verify a key pair signature. |

## Requirements

- [NEAR Account](https://docs.near.org/docs/develop/basics/create-account)
- [Node.js](https://nodejs.org/en/download/package-manager/)
- [pnpm](https://pnpm.io/installation)

## Setup
Expand All @@ -42,5 +45,5 @@ cd packages/cookbook
Example:

```bash
node utils/get-state
pnpm getState
```
1 change: 1 addition & 0 deletions packages/cookbook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"near-api-js": "workspace:*",
"ts-node": "^10.9.2",
"tsconfig": "workspace:*",
"tsx": "^4.19.2",
"typescript": "5.4.5"
}
}
275 changes: 275 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8ad6e73

Please sign in to comment.