Skip to content
Open
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
5 changes: 5 additions & 0 deletions .changeset/fastnear-rpc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"omni-bridge-sdk": patch
---

Switch default NEAR RPC from deprecated rpc.near.org to FastNEAR
12 changes: 6 additions & 6 deletions src/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ describe("Config", () => {
it("should set the network to testnet", () => {
setNetwork("testnet")
expect(addresses.near.contract).toBe("omni.n-bridge.testnet")
expect(addresses.near.rpcUrls).toEqual(["https://rpc.testnet.near.org"])
expect(addresses.near.rpcUrls).toEqual(["https://test.rpc.fastnear.com"])
})

it("should set the network to mainnet", () => {
setNetwork("mainnet")
expect(addresses.near.contract).toBe("omni.bridge.near")
expect(addresses.near.rpcUrls).toEqual(["https://rpc.near.org"])
expect(addresses.near.rpcUrls).toEqual(["https://free.rpc.fastnear.com"])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Mainnet RPC behavior remains untested

This assertion checks the new URL string, but it does not exercise the mainnet FastNEAR endpoint or the wallet-selector view calls whose latency motivates the change. The existing live decimals test covers testnet only. A slow or incompatible mainnet endpoint could therefore pass the suite unnoticed; please add coverage for the mainnet RPC path and the relevant wallet-selector calls.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code Fix in Codex

})

it("should return the correct addresses for mainnet", () => {
expect(addresses.arb).toBe("0xd025b38762B4A4E36F0Cde483b86CB13ea00D989")
expect(addresses.base).toBe("0xd025b38762B4A4E36F0Cde483b86CB13ea00D989")
expect(addresses.eth).toBe("0xe00c629afaccb0510995a2b95560e446a24c85b9")
expect(addresses.near.contract).toBe("omni.bridge.near")
expect(addresses.near.rpcUrls).toEqual(["https://rpc.near.org"])
expect(addresses.near.rpcUrls).toEqual(["https://free.rpc.fastnear.com"])
expect(addresses.sol.locker).toBe("dahPEoZGXfyV58JqqH85okdHmpN8U2q8owgPUXSCPxe")
})

Expand All @@ -36,7 +36,7 @@ describe("Config", () => {
expect(addresses.base).toBe("0xa56b860017152cD296ad723E8409Abd6e5D86d4d")
expect(addresses.eth).toBe("0x68a86e0Ea5B1d39F385c1326e4d493526dFe4401")
expect(addresses.near.contract).toBe("omni.n-bridge.testnet")
expect(addresses.near.rpcUrls).toEqual(["https://rpc.testnet.near.org"])
expect(addresses.near.rpcUrls).toEqual(["https://test.rpc.fastnear.com"])
expect(addresses.sol.locker).toBe("862HdJV59Vp83PbcubUnvuXc4EAXP8CDDs6LTxFpunTe")
})

Expand Down Expand Up @@ -67,7 +67,7 @@ describe("Config", () => {
},
})
expect(addresses.near.contract).toBe(customContract)
expect(addresses.near.rpcUrls).toEqual(["https://rpc.near.org"])
expect(addresses.near.rpcUrls).toEqual(["https://free.rpc.fastnear.com"])
})

it("should override BTC RPC URL", () => {
Expand Down Expand Up @@ -98,7 +98,7 @@ describe("Config", () => {
expect(addresses.near.rpcUrls).toEqual(["https://custom.rpc"])

resetConfig()
expect(addresses.near.rpcUrls).toEqual(["https://rpc.near.org"])
expect(addresses.near.rpcUrls).toEqual(["https://free.rpc.fastnear.com"])
})

it("should merge multiple config calls", () => {
Expand Down
4 changes: 2 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const ADDRESSES: Record<NetworkType, ChainAddresses> = {
eth: "0xe00c629afaccb0510995a2b95560e446a24c85b9",
near: {
contract: "omni.bridge.near",
rpcUrls: ["https://rpc.near.org"],
rpcUrls: ["https://free.rpc.fastnear.com"],
},
sol: {
locker: "dahPEoZGXfyV58JqqH85okdHmpN8U2q8owgPUXSCPxe",
Expand Down Expand Up @@ -81,7 +81,7 @@ const ADDRESSES: Record<NetworkType, ChainAddresses> = {
eth: "0x68a86e0Ea5B1d39F385c1326e4d493526dFe4401",
near: {
contract: "omni.n-bridge.testnet",
rpcUrls: ["https://rpc.testnet.near.org"],
rpcUrls: ["https://test.rpc.fastnear.com"],
},
sol: {
locker: "862HdJV59Vp83PbcubUnvuXc4EAXP8CDDs6LTxFpunTe",
Expand Down