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

feat: sonic chain #1545

Merged
merged 4 commits into from
Jan 16, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add other package updates
  • Loading branch information
leoslr committed Jan 15, 2025
commit 121f360b3be79c8b6d0a2e65c1b69b4993c3ef19
1 change: 1 addition & 0 deletions packages/currency/src/chains/evm/data/sonic.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const chainId = 146;
2 changes: 2 additions & 0 deletions packages/currency/src/chains/evm/index.ts
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ import * as SepoliaDefinition from './data/sepolia';
import * as ZkSyncEraTestnetDefinition from './data/zksync-era-testnet';
import * as ZkSyncEraDefinition from './data/zksync-era';
import * as BaseDefinition from './data/base';
import * as SonicDefinition from './data/sonic';

export type EvmChain = CurrencyTypes.Chain & {
chainId: number;
@@ -62,4 +63,5 @@ export const chains: Record<CurrencyTypes.EvmChainName, EvmChain> = {
zksynceratestnet: ZkSyncEraTestnetDefinition,
zksyncera: ZkSyncEraDefinition,
base: BaseDefinition,
sonic: SonicDefinition,
};
1 change: 1 addition & 0 deletions packages/currency/src/conversion-aggregators.ts
Original file line number Diff line number Diff line change
@@ -35,6 +35,7 @@ const noConversionNetworks: CurrencyTypes.AggregatorsMap = {
'aurora-testnet': {},
base: {},
celo: {},
sonic: {},
};

/**
6 changes: 6 additions & 0 deletions packages/currency/src/native.ts
Original file line number Diff line number Diff line change
@@ -172,6 +172,12 @@ export const nativeCurrencies: Record<RequestLogicTypes.CURRENCY.ETH, NativeEthC
name: 'Base Ether',
network: 'base',
},
{
symbol: '$S',
decimals: 18,
name: '$S',
network: 'sonic',
},
],
[RequestLogicTypes.CURRENCY.BTC]: [
{
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ const networks: Record<string, ethers.providers.Network> = {
core: { chainId: 1116, name: 'core' },
zksynceratestnet: { chainId: 280, name: 'zksynceratestnet' },
zksyncera: { chainId: 324, name: 'zksyncera' },
sonic: { chainId: 146, name: 'sonic' },
};

/**
@@ -33,6 +34,7 @@ export class MultichainExplorerApiProvider extends ethers.providers.EtherscanPro
super(network, apiKey);
}

// eslint-disable-next-line complexity
getBaseUrl(): string {
switch (this.network.name) {
case 'sokol':
@@ -72,6 +74,10 @@ export class MultichainExplorerApiProvider extends ethers.providers.EtherscanPro
return 'https://goerli.explorer.zksync.io/';
case 'zksyncera':
return 'https://explorer.zksync.io/';
case 'base':
return 'https://api.basescan.org/api';
case 'sonic':
return 'https://api.sonicscan.org/api';
default:
return super.getBaseUrl();
}
1 change: 1 addition & 0 deletions packages/types/src/currency-types.ts
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ export type EvmChainName =
| 'private'
| 'rinkeby' // FIXME: Rinkeby is deprecated
| 'sepolia'
| 'sonic'
| 'ronin'
| 'sokol'
| 'tombchain'
1 change: 1 addition & 0 deletions packages/utils/src/providers.ts
Original file line number Diff line number Diff line change
@@ -53,6 +53,7 @@ const networkRpcs: Record<string, string> = {
zksyncera: 'https://mainnet.era.zksync.io',
sepolia: 'https://rpc.sepolia.org/',
base: 'https://mainnet.base.org/',
sonic: 'https://rpc.soniclabs.com',
};

/**