# @omni-bridge/near

> NEAR transaction builder for Omni Bridge

Latest version **0.20.0** (published 2026-09-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @omni-bridge/near
pnpm add @omni-bridge/near
yarn add @omni-bridge/near
bun add @omni-bridge/near
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.20.0 |
| Published | 2026-09-21 |
| First published | 2026-01-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 92.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 8 |
| Author | NEAR One |
| Maintainers | karim-nearone, ricky-is |

## Links

- npm: https://www.npmjs.com/package/@omni-bridge/near
- Repository: https://github.com/Near-One/bridge-sdk-js
- Homepage: https://github.com/Near-One/bridge-sdk-js#readme
- Issues: https://github.com/Near-One/bridge-sdk-js/issues
- npm.io page: https://npm.io/package/@omni-bridge/near

## Dependencies (5)

- [near-kit](https://npm.io/package/near-kit.md) ^0.7.0
- [@scure/base](https://npm.io/package/@scure/base.md) ^2.0.0
- [@zorsh/zorsh](https://npm.io/package/@zorsh/zorsh.md) ^0.4.0
- [@noble/hashes](https://npm.io/package/@noble/hashes.md) ^2.0.1
- [@omni-bridge/core](https://npm.io/package/@omni-bridge/core.md) ^0.20.0

## Recent versions

- 0.20.0 (latest) — 2026-09-21
- 0.19.0 — 2026-08-31
- 0.18.0 — 2026-08-11
- 0.17.0 — 2026-08-06
- 0.16.1 — 2026-08-06
- 0.16.0 — 2026-07-24
- 0.15.0 — 2026-07-20
- 0.14.0 — 2026-07-14
- 0.13.0 — 2026-07-14
- 0.12.0 — 2026-07-09
- 0.11.0 — 2026-07-09
- 0.10.0 — 2026-06-23
- 0.9.1 — 2026-06-23
- 0.9.0 — 2026-05-26
- 0.8.1 — 2026-05-20
- … 16 more at https://npm.io/package/@omni-bridge/near/versions

## README

# @omni-bridge/near

NEAR transaction builder for [Omni Bridge](https://github.com/nearone/bridge-sdk-js).

Builds unsigned NEAR transactions that can be signed and sent with your preferred library (near-kit or near-api-js).

## Installation

```bash
npm install @omni-bridge/near @omni-bridge/core
```

## Quick Start

```typescript
import { createBridge } from "@omni-bridge/core"
import { createNearBuilder, toNearKitTransaction } from "@omni-bridge/near"
import { Near } from "near-kit"

// Setup
const bridge = createBridge({ network: "mainnet" })
const nearBuilder = createNearBuilder({ network: "mainnet" })
const near = new Near({ network: "mainnet", privateKey: "ed25519:..." })

// 1. Validate transfer
const validated = await bridge.validateTransfer({
  token: "near:wrap.near",
  amount: 1000000000000000000000000n, // 1 token
  fee: 0n,
  nativeFee: 0n,
  sender: "near:alice.near",
  recipient: "eth:0x1234567890123456789012345678901234567890",
})

// 2. Build unsigned transaction
const unsigned = nearBuilder.buildTransfer(validated, "alice.near")

// 3. Send with near-kit
const result = await toNearKitTransaction(near, unsigned).send()
console.log("TX:", result.transaction.hash)
```

## Using @near-js/*

```typescript
import { createNearBuilder, sendWithNearApiJs } from "@omni-bridge/near"
import { Account } from "@near-js/accounts"
import { JsonRpcProvider } from "@near-js/providers"
import { InMemoryKeyStore } from "@near-js/keystores"
import { KeyPair } from "@near-js/crypto"
import { InMemorySigner } from "@near-js/signers"

const nearBuilder = createNearBuilder({ network: "mainnet" })

const keyStore = new InMemoryKeyStore()
await keyStore.setKey("mainnet", "alice.near", KeyPair.fromString("ed25519:..."))
const provider = new JsonRpcProvider({ url: "https://rpc.mainnet.near.org" })
const signer = new InMemorySigner(keyStore)
const account = new Account({ accountId: "alice.near", provider, signer })

const unsigned = nearBuilder.buildTransfer(validated, "alice.near")
const result = await sendWithNearApiJs(account, unsigned)
```

## API

### Builder

```typescript
const builder = createNearBuilder({ network: "mainnet" | "testnet" })

// Transfers
builder.buildTransfer(validated, signerId)
builder.buildStorageDeposit(signerId, amount)

// Finalization
builder.buildFinalization(params)

// Token registration
builder.buildLogMetadata(token, signerId)
builder.buildDeployToken(chain, proverArgs, signerId, deposit)
builder.buildBindToken(chain, proverArgs, signerId, deposit)

// MPC signing
builder.buildSignTransfer(transferId, feeRecipient, fee, signerId)

// Fast finalization (relayers)
builder.buildFastFinTransfer(params, signerId)

// View calls (RPC handled internally)
await builder.getRequiredStorageDeposit(accountId)
await builder.isTokenStorageRegistered(tokenId)
```

### Shims

```typescript
// near-kit
toNearKitTransaction(near, unsigned)  // Returns TransactionBuilder

// @near-js/*
toNearApiJsActions(unsigned)          // Returns Action[]
sendWithNearApiJs(account, unsigned)  // Sends and returns result
```

## Storage Deposits

Before transferring tokens, check if storage deposit is needed:

```typescript
const required = await builder.getRequiredStorageDeposit("alice.near")
if (required > 0n) {
  const depositTx = builder.buildStorageDeposit("alice.near", required)
  await toNearKitTransaction(near, depositTx).send()
}
```

## License

MIT

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