# @near-snap/sdk

> ```ts async function main() { const account = await NearSnapAccount.connect('mainnet') const result = await account.executeTransaction({ receiverId: "herewallet.near", actions: [{ type: 'Transfer', params: { deposit: '1' }}] })

Latest version **0.6.0** (published 2023-09-29) · 0 weekly downloads

## Install

```sh
npm install @near-snap/sdk
pnpm add @near-snap/sdk
yarn add @near-snap/sdk
bun add @near-snap/sdk
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.0 |
| Published | 2023-09-29 |
| First published | 2023-07-12 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 107.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Maintainers | near-snap |

## Links

- npm: https://www.npmjs.com/package/@near-snap/sdk
- Repository: https://github.com/here-wallet/near-snap
- Homepage: https://github.com/here-wallet/near-snap#readme
- Issues: https://github.com/here-wallet/near-snap/issues
- npm.io page: https://npm.io/package/@near-snap/sdk

## Dependencies (1)

- [@near-wallet-selector/core](https://npm.io/package/@near-wallet-selector/core.md) ^8.2.0

## Recent versions

- 0.6.0 (latest) — 2023-09-29
- 0.5.0 — 2023-08-08
- 0.4.0 — 2023-07-17
- 0.3.0 — 2023-07-17
- 0.2.2 — 2023-07-15
- 0.2.1 — 2023-07-15
- 0.2.0 — 2023-07-15
- 0.1.0 — 2023-07-12

## README

# Near Snap SDK

```ts
async function main() {
    const account = await NearSnapAccount.connect('mainnet')
    const result = await account.executeTransaction({
        receiverId: "herewallet.near",
        actions: [{ type: 'Transfer', params: { deposit: '1' }}]
    })

    console.log(result[0].transaction_outcome.id)
}
```

## Fully decomposable

It is possible to override the library at any level, this allows you to implement your own logic and cover it with tests

```ts
const rpc = new NearSnapProvider() // low-level, communicate with window.ethereum
const snap = new NearSnap('snap_id', rpc) // communicate with snap api
NearSnapAccount.connect('mainnet', snap) // communicate with snap api and near rpc
```


## Сompatible with near-api-js 

NearSnapAccount simply extends the default near-api-js account class. This allows you not to change your logic to support the Metamask wallet. For example:
```ts
const result = await account.sendMoney("friend.near", "100000")
```

## Сompatible with @near-wallet-selector
You can use the near-wallet-selector format for describing transactions. For example:

```ts
const result = await account.executeTransactions([{
    receiverId: "herewallet.near",
    actions: [{ type: 'Transfer', params: { deposit: '1' }}]
}])
```


## Support free transaction

HERE Wallet provides API for free delegated transactions. This is a very useful feature for new NEAR Protocol users, it allows you to sign a transaction with a completely empty account:

```ts
// if account.delegatedProvider.isCanDelegate return false this method throw DelegateNotAllowed
await account.executeDelegate({
    actions: [{ type: 'Transfer', params: { deposit: '1' }}],
    receiverId: "herewallet.near",
})

// Also executeTransaction method by default firstly try to use executeDelegate
await account.executeTransaction({
    disableDelegate: false, // default: false
    receiverId: "herewallet.near",
    actions: [{ type: 'Transfer', params: { deposit: '1' }}]
})
```

---
_Source: https://npm.io/package/@near-snap/sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
