Skip to content

Commit

Permalink
Merge branch 'main' into neox-t4
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom authored Dec 21, 2024
2 parents 1869bf5 + 569a325 commit ca3c424
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/flat-penguins-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"viem": patch
---

Added Neo X Mainnet.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
{
"name": "import * from 'viem/chains'",
"path": "./src/_esm/chains/index.js",
"limit": "42 kB",
"limit": "45 kB",
"import": "*"
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/actions/public/getBlockNumber.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test('behavior: caches blockNumber within cacheTime', async () => {
vi.useFakeTimers()

const a = await getBlockNumber(client, { cacheTime })
mine(client, { blocks: 1 })
await mine(client, { blocks: 1 })

vi.advanceTimersByTime(cacheTime / 2)
const b = await getBlockNumber(client)
Expand Down
22 changes: 22 additions & 0 deletions src/chains/definitions/neoxMainnet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { defineChain } from '../../utils/chain/defineChain.js'

export const neoxMainnet = /*#__PURE__*/ defineChain({
id: 47763,
name: 'Neo X Mainnet',
nativeCurrency: { name: 'Gas', symbol: 'GAS', decimals: 18 },
rpcUrls: {
default: {
http: [
'https://mainnet-1.rpc.banelabs.org',
'https://mainnet-2.rpc.banelabs.org',
],
},
},
blockExplorers: {
default: {
name: 'Neo X - Explorer',
url: 'https://xexplorer.neo.org',
},
},
testnet: false,
})
1 change: 1 addition & 0 deletions src/chains/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ export { nahmii } from './definitions/nahmii.js'
export { nautilus } from './definitions/nautilus.js'
export { neonDevnet } from './definitions/neonDevnet.js'
export { neonMainnet } from './definitions/neonMainnet.js'
export { neoxMainnet } from './definitions/neoxMainnet.js'
export { neoxT4 } from './definitions/neoxT4.js'
export { nexi } from './definitions/nexi.js'
export { nexilix } from './definitions/nexilix.js'
Expand Down
12 changes: 6 additions & 6 deletions src/utils/rpc/http.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('request', () => {
{
"id": 1,
"jsonrpc": "2.0",
"result": "anvil/v0.2.0",
"result": "anvil/v0.3.0",
}
`)
})
Expand All @@ -41,7 +41,7 @@ describe('request', () => {
{
"id": 3,
"jsonrpc": "2.0",
"result": "anvil/v0.2.0",
"result": "anvil/v0.3.0",
}
`)
})
Expand Down Expand Up @@ -421,12 +421,12 @@ describe('http (batch)', () => {
{
"id": 93,
"jsonrpc": "2.0",
"result": "anvil/v0.2.0",
"result": "anvil/v0.3.0",
},
{
"id": 94,
"jsonrpc": "2.0",
"result": "anvil/v0.2.0",
"result": "anvil/v0.3.0",
},
]
`)
Expand All @@ -447,7 +447,7 @@ describe('http (batch)', () => {
{
"id": 96,
"jsonrpc": "2.0",
"result": "anvil/v0.2.0",
"result": "anvil/v0.3.0",
},
{
"error": {
Expand All @@ -473,7 +473,7 @@ describe('http (batch)', () => {
{
"id": 99,
"jsonrpc": "2.0",
"result": "anvil/v0.2.0",
"result": "anvil/v0.3.0",
},
{
"error": {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/rpc/ipc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('request', () => {
expect(version).toMatchInlineSnapshot(`
{
"jsonrpc": "2.0",
"result": "anvil/v0.2.0",
"result": "anvil/v0.3.0",
}
`)
expect(rpcClient.requests.size).toBe(0)
Expand Down Expand Up @@ -588,7 +588,7 @@ describe('requestAsync', () => {
expect(version).toMatchInlineSnapshot(`
{
"jsonrpc": "2.0",
"result": "anvil/v0.2.0",
"result": "anvil/v0.3.0",
}
`)
expect(client.requests.size).toBe(0)
Expand Down
4 changes: 2 additions & 2 deletions src/utils/rpc/webSocket.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('request', () => {
expect(version).toMatchInlineSnapshot(`
{
"jsonrpc": "2.0",
"result": "anvil/v0.2.0",
"result": "anvil/v0.3.0",
}
`)
expect(socketClient.requests.size).toBe(0)
Expand Down Expand Up @@ -590,7 +590,7 @@ describe('requestAsync', () => {
expect(version).toMatchInlineSnapshot(`
{
"jsonrpc": "2.0",
"result": "anvil/v0.2.0",
"result": "anvil/v0.3.0",
}
`)
expect(client.requests.size).toBe(0)
Expand Down

0 comments on commit ca3c424

Please sign in to comment.