Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/bright-clouds-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@omni-bridge/core": minor
"@omni-bridge/evm": minor
"@omni-bridge/starknet": minor
"@omni-bridge/sdk": minor
---

Add Abstract (Abs) and Starknet (Strk) chain support with builder configs,
address mappings, and the new `@omni-bridge/starknet` transaction builder package.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
![Status](https://img.shields.io/badge/Status-Beta-blue)
![License](https://img.shields.io/badge/License-MIT-green)

TypeScript SDK for cross-chain token transfers via the [Omni Bridge](https://github.com/Near-one/omni-bridge) protocol. Transfer tokens between Ethereum, NEAR, Solana, Base, Arbitrum, Polygon, BNB Chain, Bitcoin, and Zcash.
TypeScript SDK for cross-chain token transfers via the [Omni Bridge](https://github.com/Near-one/omni-bridge) protocol. Transfer tokens between Ethereum, NEAR, Solana, Base, Arbitrum, Polygon, BNB Chain, Abstract, Starknet, Bitcoin, and Zcash.

## Install

Expand Down Expand Up @@ -54,6 +54,8 @@ base:0x1234... → Base
arb:0x1234... → Arbitrum
near:alice.near → NEAR
sol:ABC123... → Solana
abs:0x1234... → Abstract
strk:0x1234... → Starknet
btc:bc1q... → Bitcoin
```

Expand All @@ -64,7 +66,7 @@ This makes it unambiguous which chain an address belongs to, which is essential
| Package | Description |
| --------------------- | ---------------------------------------------- |
| `@omni-bridge/core` | Validation, types, configuration, API client |
| `@omni-bridge/evm` | Ethereum, Base, Arbitrum, Polygon, BNB Chain |
| `@omni-bridge/evm` | Ethereum, Base, Arbitrum, Polygon, BNB Chain, Abstract |
| `@omni-bridge/near` | NEAR Protocol |
| `@omni-bridge/solana` | Solana |
| `@omni-bridge/btc` | Bitcoin, Zcash |
Expand Down
76 changes: 73 additions & 3 deletions bun.lock

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion docs/core-concepts/omni-addresses.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ The SDK uses a unified address format called OmniAddress. It's simple: a chain p
| Solana | `sol:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` |
| Bitcoin | `btc:bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh` |
| Zcash | `zec:t1Rv4exT7bqhZqi2j7xz8bUHDMxwosrjADU` |
| Abstract | `abs:0x1234567890123456789012345678901234567890` |
| Starknet | `strk:0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7` |

## Chain Prefixes

Expand All @@ -36,6 +38,8 @@ The SDK uses a unified address format called OmniAddress. It's simple: a chain p
| `sol` | Solana | — |
| `btc` | Bitcoin | — |
| `zec` | Zcash | — |
| `abs` | Abstract | 2741 |
| `strk` | Starknet | — |

## Tokens Use The Same Format

Expand Down Expand Up @@ -98,7 +102,9 @@ enum ChainKind {
Bnb = 5,
Btc = 6,
Zcash = 7,
Pol = 8
Pol = 8,
Abs = 9,
Strk = 10
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://mintlify.com/docs.json",
"theme": "mint",
"name": "Omni Bridge SDK",
"description": "TypeScript SDK for cross-chain token transfers via the Omni Bridge protocol. Transfer tokens between Ethereum, NEAR, Solana, Base, Arbitrum, Polygon, BNB Chain, Bitcoin, and Zcash.",
"description": "TypeScript SDK for cross-chain token transfers via the Omni Bridge protocol. Transfer tokens between Ethereum, NEAR, Solana, Base, Arbitrum, Polygon, BNB Chain, Abstract, Starknet, Bitcoin, and Zcash.",
"colors": {
"primary": "#6366F1",
"light": "#818CF8",
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ Now that you understand the pattern, pick the guide for your source chain:

<CardGroup cols={2}>
<Card title="EVM Chains" icon="ethereum" href="/guides/evm">
Ethereum, Base, Arbitrum, Polygon, BNB
Ethereum, Base, Arbitrum, Polygon, BNB, Abstract
</Card>
<Card title="NEAR" icon="circle-nodes" href="/guides/near">
NEAR Protocol
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/advanced/manual-finalization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The proof type and wait time depends on the source:
|--------|------------|-----------|
| NEAR | MPC Signature | ~1-5 min |
| Ethereum | Merkle Proof | ~15-20 min |
| L2s (Base, Arb, etc.) | Wormhole VAA | ~1 min |
| L2s (Base, Arb, Abs, etc.) | Wormhole VAA | ~1 min |
| Solana | Wormhole VAA | ~15 sec |

## When is Finalization Ready?
Expand Down Expand Up @@ -155,7 +155,7 @@ await toNearKitTransaction(near, tx).send()

### L2s (Wormhole VAA)

Base, Arbitrum, Polygon, and BNB use Wormhole:
Base, Arbitrum, Polygon, BNB, and Abstract use Wormhole:

```typescript
import { getWormholeVaa } from "@omni-bridge/core"
Expand Down
5 changes: 3 additions & 2 deletions docs/guides/evm.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: EVM Chains
description: Bridge tokens from Ethereum, Base, Arbitrum, Polygon, and BNB Chain
description: Bridge tokens from Ethereum, Base, Arbitrum, Polygon, BNB Chain, and Abstract
---

This guide covers bridging from any EVM chain. The process is identical — you just change the `chain` parameter.
Expand All @@ -15,7 +15,7 @@ const bridge = createBridge({ network: "mainnet" })

// Pick your chain
const evm = createEvmBuilder({ network: "mainnet", chain: ChainKind.Eth })
// Or: ChainKind.Base, ChainKind.Arb, ChainKind.Pol, ChainKind.Bnb
// Or: ChainKind.Base, ChainKind.Arb, ChainKind.Pol, ChainKind.Bnb, ChainKind.Abs
```

## Complete Transfer
Expand Down Expand Up @@ -213,6 +213,7 @@ try {
| Arbitrum | `Arb` | `arb:` | 42161 | 421614 |
| Polygon | `Pol` | `pol:` | 137 | 80002 (Amoy) |
| BNB Chain | `Bnb` | `bnb:` | 56 | 97 |
| Abstract | `Abs` | `abs:` | 2741 | 11124 |

## Next Steps

Expand Down
7 changes: 5 additions & 2 deletions docs/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The SDK is **library agnostic**. It returns plain transaction objects that work

<CardGroup cols={3}>
<Card title="EVM" icon="ethereum">
Ethereum, Base, Arbitrum, Polygon, BNB Chain
Ethereum, Base, Arbitrum, Polygon, BNB Chain, Abstract
</Card>
<Card title="NEAR" icon="circle-nodes">
NEAR Protocol
Expand All @@ -31,6 +31,9 @@ The SDK is **library agnostic**. It returns plain transaction objects that work
<Card title="Bitcoin" icon="bitcoin">
Bitcoin, Zcash
</Card>
<Card title="Starknet" icon="bolt">
Starknet
</Card>
</CardGroup>

## Packages
Expand All @@ -51,7 +54,7 @@ npm install @omni-bridge/core @omni-bridge/near
| Package | What it's for |
|---------|---------------|
| `@omni-bridge/core` | Validation, types, API client (always needed) |
| `@omni-bridge/evm` | Ethereum, Base, Arbitrum, Polygon, BNB |
| `@omni-bridge/evm` | Ethereum, Base, Arbitrum, Polygon, BNB, Abstract |
| `@omni-bridge/near` | NEAR Protocol |
| `@omni-bridge/solana` | Solana |
| `@omni-bridge/btc` | Bitcoin, Zcash |
Expand Down
9 changes: 7 additions & 2 deletions docs/reference/core.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,8 @@ type OmniAddress =
| `btc:${string}`
| `zec:${string}`
| `pol:${string}`
| `abs:${string}`
| `strk:${string}`
```

**Examples:**
Expand All @@ -970,6 +972,8 @@ enum ChainKind {
Btc = 6,
Zcash = 7,
Pol = 8,
Abs = 9,
Strk = 10,
}
```

Expand All @@ -980,7 +984,7 @@ enum ChainKind {
Chain prefix strings used in OmniAddress format.

```typescript
type ChainPrefix = "eth" | "near" | "sol" | "arb" | "base" | "bnb" | "btc" | "zec" | "pol"
type ChainPrefix = "eth" | "near" | "sol" | "arb" | "base" | "bnb" | "btc" | "zec" | "pol" | "abs" | "strk"
```

---
Expand Down Expand Up @@ -1466,6 +1470,7 @@ type EvmChainKind =
| ChainKind.Arb
| ChainKind.Bnb
| ChainKind.Pol
| ChainKind.Abs
```

---
Expand Down Expand Up @@ -1576,7 +1581,7 @@ function isEvmChain(chain: ChainKind): chain is EvmChainKind
**Parameters:**
- `chain` - The `ChainKind` enum value

**Returns:** `true` if the chain is EVM-compatible (Eth, Base, Arb, Bnb, Pol)
**Returns:** `true` if the chain is EVM-compatible (Eth, Base, Arb, Bnb, Pol, Abs)

```typescript
import { isEvmChain, ChainKind } from "@omni-bridge/core"
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/evm.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "@omni-bridge/evm"
description: EVM transaction builder for Ethereum, Base, Arbitrum, Polygon, and BNB Chain
description: EVM transaction builder for Ethereum, Base, Arbitrum, Polygon, BNB Chain, and Abstract
---

## Import
Expand Down Expand Up @@ -38,7 +38,7 @@ function createEvmBuilder(config: EvmBuilderConfig): EvmBuilder
</ResponseField>

<ResponseField name="chain" type="EvmChainKind" required>
The EVM chain to build transactions for. One of: `ChainKind.Eth`, `ChainKind.Base`, `ChainKind.Arb`, `ChainKind.Pol`, `ChainKind.Bnb`
The EVM chain to build transactions for. One of: `ChainKind.Eth`, `ChainKind.Base`, `ChainKind.Arb`, `ChainKind.Pol`, `ChainKind.Bnb`, `ChainKind.Abs`
</ResponseField>
</Expandable>
</ResponseField>
Expand Down Expand Up @@ -506,7 +506,7 @@ async function getEvmProof(
</ResponseField>

<ResponseField name="chain" type="EvmChainKind" required>
The EVM chain where the transaction occurred. One of: `ChainKind.Eth`, `ChainKind.Base`, `ChainKind.Arb`, `ChainKind.Pol`, `ChainKind.Bnb`
The EVM chain where the transaction occurred. One of: `ChainKind.Eth`, `ChainKind.Base`, `ChainKind.Arb`, `ChainKind.Pol`, `ChainKind.Bnb`, `ChainKind.Abs`
</ResponseField>

<ResponseField name="network" type="Network" required>
Expand Down
6 changes: 6 additions & 0 deletions packages/core/src/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ function chainKindToApiChain(chain: ChainKind): Chain {
[ChainKind.Btc]: "Btc",
[ChainKind.Zcash]: "Zcash",
[ChainKind.Pol]: "Pol",
[ChainKind.Abs]: "Abs",
[ChainKind.Strk]: "Strk",
}
return mapping[chain]
}
Expand All @@ -141,6 +143,10 @@ function getContractAddress(addresses: ChainAddresses, chain: ChainKind): string
return addresses.bnb.bridge
case ChainKind.Pol:
return addresses.pol.bridge
case ChainKind.Abs:
return addresses.abs.bridge
case ChainKind.Strk:
return addresses.strk.bridge
case ChainKind.Near:
return addresses.near.contract
case ChainKind.Sol:
Expand Down
14 changes: 14 additions & 0 deletions packages/core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,22 @@ export interface ZcashAddresses {
zcashToken: string
}

export interface StarknetAddresses {
bridge: string
}

export interface ChainAddresses {
eth: EvmAddresses
arb: EvmAddresses
base: EvmAddresses
bnb: EvmAddresses
pol: EvmAddresses
abs: EvmAddresses
near: NearAddresses
sol: SolanaAddresses
btc: BtcAddresses
zcash: ZcashAddresses
strk: StarknetAddresses
}

const MAINNET_ADDRESSES: ChainAddresses = {
Expand All @@ -56,6 +62,7 @@ const MAINNET_ADDRESSES: ChainAddresses = {
base: { bridge: "0xd025b38762B4A4E36F0Cde483b86CB13ea00D989" },
bnb: { bridge: "0x073C8a225c8Cf9d3f9157F5C1a1DbE02407f5720" },
pol: { bridge: "0xd025b38762B4A4E36F0Cde483b86CB13ea00D989" },
abs: { bridge: "0xd2490A00bDB97C1EDE4fdf207CFE2664AFB9C20D" },
near: {
contract: "omni.bridge.near",
rpcUrls: ["https://free.rpc.fastnear.com"],
Expand All @@ -82,6 +89,7 @@ const MAINNET_ADDRESSES: ChainAddresses = {
zcashConnector: "zcash-connector.bridge.near",
zcashToken: "nzec.bridge.near",
},
strk: { bridge: "0x05f9a4a841dfb7bb3cde33073b2450fe45dcd407fb6c0985a274b0e943ad8598" },
}

const TESTNET_ADDRESSES: ChainAddresses = {
Expand All @@ -90,6 +98,7 @@ const TESTNET_ADDRESSES: ChainAddresses = {
base: { bridge: "0xa56b860017152cD296ad723E8409Abd6e5D86d4d" },
bnb: { bridge: "0x7Fd1E9F9ed48ebb64476ba9E06e5F1a90e31DA74" },
pol: { bridge: "0xEC81aFc3485a425347Ac03316675e58a680b283A" },
abs: { bridge: "0x5C79627d2cD753d45B41839d187619f99c7B8D78" },
near: {
contract: "omni.n-bridge.testnet",
rpcUrls: ["https://test.rpc.fastnear.com"],
Expand All @@ -116,6 +125,9 @@ const TESTNET_ADDRESSES: ChainAddresses = {
zcashConnector: "zcash_connector.n-bridge.testnet",
zcashToken: "nzcash.n-bridge.testnet",
},
strk: {
bridge: "0x02830785fd87b181c5391819f4a5e6a0b2d76c49d92b7f748a2433495eead162",
},
}

const ADDRESSES: Record<Network, ChainAddresses> = {
Expand All @@ -135,13 +147,15 @@ export const EVM_CHAIN_IDS: Record<Network, Record<string, number>> = {
base: 8453,
bnb: 56,
pol: 137,
abs: 2741,
},
testnet: {
eth: 11155111, // Sepolia
arb: 421614, // Arbitrum Sepolia
base: 84532, // Base Sepolia
bnb: 97, // BSC Testnet
pol: 80002, // Polygon Amoy
abs: 11124, // Abstract Testnet
},
}

Expand Down
17 changes: 16 additions & 1 deletion packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export enum ChainKind {
Btc = 6,
Zcash = 7,
Pol = 8,
Abs = 9,
Strk = 10,
}

// Network configuration
Expand All @@ -29,6 +31,8 @@ export type OmniAddress =
| `btc:${string}`
| `zec:${string}`
| `pol:${string}`
| `abs:${string}`
| `strk:${string}`

// Common type aliases
export type U128 = bigint
Expand Down Expand Up @@ -135,4 +139,15 @@ export interface BtcUnsignedTransaction {
}

// Chain prefix type for address parsing
export type ChainPrefix = "eth" | "near" | "sol" | "arb" | "base" | "bnb" | "btc" | "zec" | "pol"
export type ChainPrefix =
| "eth"
| "near"
| "sol"
| "arb"
| "base"
| "bnb"
| "btc"
| "zec"
| "pol"
| "abs"
| "strk"
8 changes: 7 additions & 1 deletion packages/core/src/utils/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const CHAIN_PREFIX_MAP: Record<ChainPrefix, ChainKind> = {
btc: ChainKind.Btc,
zec: ChainKind.Zcash,
pol: ChainKind.Pol,
abs: ChainKind.Abs,
strk: ChainKind.Strk,
}

// Mapping from ChainKind to prefix
Expand All @@ -29,6 +31,8 @@ const CHAIN_KIND_PREFIX_MAP: Record<ChainKind, ChainPrefix> = {
[ChainKind.Btc]: "btc",
[ChainKind.Zcash]: "zec",
[ChainKind.Pol]: "pol",
[ChainKind.Abs]: "abs",
[ChainKind.Strk]: "strk",
}

// Valid chain prefixes
Expand Down Expand Up @@ -84,6 +88,7 @@ export type EvmChainKind =
| ChainKind.Arb
| ChainKind.Bnb
| ChainKind.Pol
| ChainKind.Abs

/**
* Checks if a chain is an EVM-compatible chain
Expand All @@ -94,7 +99,8 @@ export function isEvmChain(chain: ChainKind): chain is EvmChainKind {
chain === ChainKind.Base ||
chain === ChainKind.Arb ||
chain === ChainKind.Bnb ||
chain === ChainKind.Pol
chain === ChainKind.Pol ||
chain === ChainKind.Abs
)
}

Expand Down
Loading
Loading