Skip to content

Commit

Permalink
fix(react): sui native address
Browse files Browse the repository at this point in the history
  • Loading branch information
jayeshbhole-rp committed Dec 18, 2024
1 parent 53f7029 commit 66ac98b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
6 changes: 6 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @tangled3/react

## 1.15.13

### Patch Changes

- fix sui native token address

## 1.15.12

### 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.12",
"version": "1.15.13",
"type": "module",
"license": "MIT",
"main": "./src/index.ts",
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/actions/getToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ParsedAccountData, PublicKey } from '@solana/web3.js';
import { getBalance } from '@wagmi/core';
import { Address as EVMAddress } from 'viem';
import { trc20Abi } from '../constants/abi/trc20.js';
import { ETH_ADDRESS, SOL_ADDRESS } from '../constants/index.js';
import { ETH_ADDRESS, SOL_ADDRESS, SUI_ADDRESS } from '../constants/index.js';
import { TokenMetadata } from '../hooks/useToken.js';
import {
ChainData,
Expand Down Expand Up @@ -139,8 +139,8 @@ export const getTokenMetadata = async ({ token, chain, config }: GetTokenMetadat
}

if (chain.type === 'sui') {
if (areTokensEqual(token, ETH_ADDRESS)) {
return { ...chain.nativeCurrency, address: ETH_ADDRESS, chainId: chain.id, isNative: true };
if (areTokensEqual(token, SUI_ADDRESS)) {
return { ...chain.nativeCurrency, address: SUI_ADDRESS, chainId: chain.id, isNative: true };
}

let res;
Expand Down
5 changes: 5 additions & 0 deletions packages/react/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ export const CHAIN_TYPE_LABEL: Record<ChainType, string> = {
*/
export const ETH_ADDRESS = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee';

/**
* The native SUI address.
*/
export const SUI_ADDRESS = '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI';

/**
* The native SOL address.
*/
Expand Down

0 comments on commit 66ac98b

Please sign in to comment.