Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: hyperliquid (998) evm chain #37

Merged
merged 6 commits into from
Jan 3, 2025
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
8 changes: 8 additions & 0 deletions example-next/src/components/Tokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ const tokens: TokenMetadata[] = [
chainId: 'osmosis-1',
isNative: true,
},
{
address: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831',
decimals: 6,
name: 'USDC',
symbol: 'USDC',
chainId: '998',
isNative: false,
},
{
address: ETH_ADDRESS,
decimals: 18,
Expand Down
24 changes: 24 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# @tangled3/react

## 1.16.3

### Patch Changes

- fix trc20 abi

## 1.16.2

### Patch Changes

- fix tron multicall abi

## 1.16.1

### Patch Changes

- fix: add tron token handler

## 1.16.0

### Minor Changes

- feat: add hyperliquid

## 1.15.14

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tangled3/react",
"private": false,
"version": "1.15.14",
"version": "1.16.3",
"type": "module",
"license": "MIT",
"main": "./src/index.ts",
Expand Down
13 changes: 13 additions & 0 deletions packages/react/src/actions/evm/getEVMToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ import { Config, multicall } from '@wagmi/core';
import { Address, erc20Abi } from 'viem';

export const getEVMTokenMetadata = async (address: string, chainId: number, wagmiConfig: Config) => {
if (chainId === 998) {
return {
name: 'USDC',
symbol: 'USDC',
decimals: 6,
};
}
const tokenData = await multicall(wagmiConfig, {
contracts: [
{
Expand Down Expand Up @@ -38,6 +45,12 @@ export const getEVMTokenBalanceAndAllowance = async (
chainId: number,
wagmiConfig: Config,
) => {
if (chainId === 998) {
return {
balance: BigInt(0),
allowance: BigInt(0),
};
}
const calls = [
{
address: address as Address,
Expand Down
28 changes: 28 additions & 0 deletions packages/react/src/chains/evm/hyperliquid.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { EVMChain } from '../../types/index.js';

export const hyperliquid: EVMChain = {
id: 998,
name: 'hyperliquid',
type: 'evm',
nativeCurrency: {
decimals: 6,
name: 'USDC',
symbol: 'USDC',
},
rpcUrls: {
default: {
http: [],
},
},
blockExplorers: {
default: {
name: 'Hyperliquid explorer',
url: 'http://hypurrscan.io/',
},
},
contracts: {
multicall3: {
address: '0xca11bde05977b3631167028862be2a173976ca11',
},
},
};
1 change: 1 addition & 0 deletions packages/react/src/chains/evm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const vanar: EVMChain = { ...vVanar, type: 'evm' } as const;
export const xLayer: EVMChain = { ...vxLayer, type: 'evm' } as const;
export const zkSync: EVMChain = { ...vZkSync, type: 'evm' } as const;
export * from './arthera.js';
export * from './hyperliquid.js';
export * from './nahmii.js';
export * from './nero.js';
export * from './oasisSapphire.js';
Expand Down
Loading
Loading