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 inkchain support #6323

Merged
merged 22 commits into from
Dec 13, 2024
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Images.xcassets/badges/ethereum.imageset/ethereum.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Images.xcassets/badges/ethereum.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Images.xcassets/badges/ethereum.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "ethereumBadgeDark-1.png",
"filename" : "ethereumBadgeDark.png",
"idiom" : "universal",
"scale" : "1x"
},
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "ethereumBadgeLarge.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "ethereumBadgeLargeDark.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "ethereumBadgeNoShadow.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
23 changes: 23 additions & 0 deletions ios/Images.xcassets/badges/ink.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "ink.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file added ios/Images.xcassets/badges/ink.imageset/ink.png
23 changes: 23 additions & 0 deletions ios/Images.xcassets/badges/inkBadge.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "inkBadge.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
23 changes: 23 additions & 0 deletions ios/Images.xcassets/badges/inkBadgeDark.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "inkBadgeDark.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
23 changes: 23 additions & 0 deletions ios/Images.xcassets/badges/inkBadgeLarge.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "inkBadgeLarge.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "inkBadgeLargeDark.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
23 changes: 23 additions & 0 deletions ios/Images.xcassets/badges/inkBadgeNoShadow.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "inkBadgeNoShadow.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@
"use-deep-compare": "1.1.0",
"use-memo-one": "1.1.1",
"util": "0.10.4",
"viem": "2.9.16",
"viem": "2.21.54",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this bump had a few chains we needed

"vm-browserify": "0.0.4",
"w2t": "3.0.2",
"zeego": "1.10.0",
Expand Down
74 changes: 74 additions & 0 deletions scripts/add_network.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/bin/bash

# Prompt for network details
read -p "Enter the network name (case sensitive): " networkName
read -p "Enter the chain ID (number): " chainId
read -p "Enter the light mode color (hex): " lightColor
read -p "Enter the dark mode color (hex): " darkColor

# Create imagesets
mkdir -p "ios/Images.xcassets/badges/${networkName}.imageset"
mkdir -p "ios/Images.xcassets/badges/${networkName}Badge.imageset"
mkdir -p "ios/Images.xcassets/badges/${networkName}BadgeDark.imageset"
mkdir -p "ios/Images.xcassets/badges/${networkName}BadgeLarge.imageset"
mkdir -p "ios/Images.xcassets/badges/${networkName}BadgeLargeDark.imageset"
mkdir -p "ios/Images.xcassets/badges/${networkName}BadgeNoShadow.imageset"

# Create Contents.json for each imageset
for suffix in "" "Badge" "BadgeDark" "BadgeLarge" "BadgeLargeDark" "BadgeNoShadow"; do
cat > "ios/Images.xcassets/badges/${networkName}${suffix}.imageset/Contents.json" << EOF
{
"images" : [
{
"filename" : "${networkName}${suffix}.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "${networkName}${suffix}@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "${networkName}${suffix}@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
EOF
done

# Update en_US.json
# Using perl for more precise JSON manipulation
perl -i -0pe 's/("explain":\s*{)/$1\n "'$networkName'": {\n "text": "",\n "title": "What'\''s '$networkName'?"\n },/m' src/languages/en_US.json

# Update types.ts
# Add to Network enum
sed -i '' "/export enum Network {/a\\
${networkName} = '${networkName}',
" src/chains/types.ts

# Add to ChainId enum
sed -i '' "/export enum ChainId {/a\\
${networkName} = ${chainId},
" src/chains/types.ts

# Update colors.ts for light mode - look for the first networkColors declaration
sed -i '' "/^ let networkColors = {/a\\
[ChainId.${networkName}]: '${lightColor}',
" src/styles/colors.ts

# Update colors.ts for dark mode - look specifically in the darkMode if block
sed -i '' "/if (darkMode) {/,/^ }/ {
/networkColors = {/a\\
[ChainId.${networkName}]: '${darkColor}',
}" src/styles/colors.ts

echo "Network ${networkName} has been added!"
echo "Note: You'll need to add the actual badge images to the imageset directories"
echo "Don't forget to run prettier to format the modified files"
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@ const BlastBadge = require('@/assets/badges/blast.png');
const BscBadge = require('@/assets/badges/bsc.png');
const DegenBadge = require('@/assets/badges/degen.png');
const EthereumBadge = require('@/assets/badges/ethereum.png');
// const GnosisBadge = require('@/assets/badges/gnosis.png');
// const GravityBadge = require('@/assets/badges/gravity.png');
const InkBadge = require('@/assets/badges/ink.png');
// const LineaBadge = require('@/assets/badges/linea.png');
const OptimismBadge = require('@/assets/badges/optimism.png');
const PolygonBadge = require('@/assets/badges/polygon.png');
// const SankoBadge = require('@/assets/badges/sanko.png');
// const ScrollBadge = require('@/assets/badges/scroll.png');
// const ZksyncBadge = require('@/assets/badges/zksync.png');
const ZoraBadge = require('@/assets/badges/zora.png');

import { ChainId } from '@/state/backendNetworks/types';
Expand All @@ -32,13 +39,20 @@ const networkBadges = {
[ChainId.bsc]: BscBadge,
[ChainId.bscTestnet]: BscBadge,
[ChainId.degen]: DegenBadge,
// [ChainId.gnosis]: GnosisBadge,
// [ChainId.gravity]: GravityBadge,
[ChainId.holesky]: EthereumBadge,
[ChainId.ink]: InkBadge,
// [ChainId.linea]: LineaBadge,
[ChainId.mainnet]: EthereumBadge,
[ChainId.optimism]: OptimismBadge,
[ChainId.optimismSepolia]: OptimismBadge,
[ChainId.polygon]: PolygonBadge,
[ChainId.polygonAmoy]: PolygonBadge,
// [ChainId.sanko]: SankoBadge,
// [ChainId.scroll]: ScrollBadge,
[ChainId.sepolia]: EthereumBadge,
// [ChainId.zksync]: ZksyncBadge,
[ChainId.zora]: ZoraBadge,
[ChainId.zoraSepolia]: ZoraBadge,
};
Expand Down
14 changes: 14 additions & 0 deletions src/__swaps__/screens/Swap/components/AnimatedChainImage.ios.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,15 @@ import BlastBadge from '@/assets/badges/blast.png';
import BscBadge from '@/assets/badges/bsc.png';
import DegenBadge from '@/assets/badges/degen.png';
import EthereumBadge from '@/assets/badges/ethereum.png';
// import GnosisBadge from '@/assets/badges/gnosis.png';
// import GravityBadge from '@/assets/badges/gravity.png';
import InkBadge from '@/assets/badges/ink.png';
// import LineaBadge from '@/assets/badges/linea.png';
import OptimismBadge from '@/assets/badges/optimism.png';
import PolygonBadge from '@/assets/badges/polygon.png';
// import SankoBadge from '@/assets/badges/sanko.png';
// import ScrollBadge from '@/assets/badges/scroll.png';
// import ZksyncBadge from '@/assets/badges/zksync.png';
import ZoraBadge from '@/assets/badges/zora.png';

const networkBadges = {
Expand All @@ -34,13 +41,20 @@ const networkBadges = {
[ChainId.bsc]: Image.resolveAssetSource(BscBadge).uri,
[ChainId.bscTestnet]: Image.resolveAssetSource(BscBadge).uri,
[ChainId.degen]: Image.resolveAssetSource(DegenBadge).uri,
// [ChainId.gnosis]: Image.resolveAssetSource(GnosisBadge).uri,
// [ChainId.gravity]: Image.resolveAssetSource(GravityBadge).uri,
[ChainId.holesky]: Image.resolveAssetSource(EthereumBadge).uri,
[ChainId.ink]: Image.resolveAssetSource(InkBadge).uri,
// [ChainId.linea]: Image.resolveAssetSource(LineaBadge).uri,
[ChainId.mainnet]: Image.resolveAssetSource(EthereumBadge).uri,
[ChainId.optimism]: Image.resolveAssetSource(OptimismBadge).uri,
[ChainId.optimismSepolia]: Image.resolveAssetSource(OptimismBadge).uri,
[ChainId.polygon]: Image.resolveAssetSource(PolygonBadge).uri,
[ChainId.polygonAmoy]: Image.resolveAssetSource(PolygonBadge).uri,
// [ChainId.sanko]: Image.resolveAssetSource(SankoBadge).uri,
// [ChainId.scroll]: Image.resolveAssetSource(ScrollBadge).uri,
[ChainId.sepolia]: Image.resolveAssetSource(EthereumBadge).uri,
// [ChainId.zksync]: Image.resolveAssetSource(ZksyncBadge).uri,
[ChainId.zora]: Image.resolveAssetSource(ZoraBadge).uri,
[ChainId.zoraSepolia]: Image.resolveAssetSource(ZoraBadge).uri,
};
Expand Down
Binary file modified src/assets/badges/apechainBadge.png
Binary file modified src/assets/badges/[email protected]
Binary file modified src/assets/badges/[email protected]
Binary file modified src/assets/badges/apechainBadgeLarge.png
Binary file modified src/assets/badges/[email protected]
Binary file modified src/assets/badges/[email protected]
Binary file modified src/assets/badges/apechainBadgeLargeDark.png
Binary file modified src/assets/badges/[email protected]
Binary file modified src/assets/badges/[email protected]
Binary file modified src/assets/badges/ethereum.png
Binary file modified src/assets/badges/[email protected]
Binary file modified src/assets/badges/[email protected]
Binary file modified src/assets/badges/ethereumBadge.png
Binary file modified src/assets/badges/[email protected]
Binary file modified src/assets/badges/[email protected]
Binary file modified src/assets/badges/ethereumBadgeDark.png
Binary file modified src/assets/badges/[email protected]
Binary file modified src/assets/badges/[email protected]
Binary file added src/assets/badges/ethereumBadgeLarge.png
Binary file added src/assets/badges/[email protected]
Binary file added src/assets/badges/[email protected]
Binary file added src/assets/badges/ethereumBadgeLargeDark.png
Binary file added src/assets/badges/[email protected]
Binary file added src/assets/badges/[email protected]
Binary file added src/assets/badges/ethereumBadgeNoShadow.png
Binary file added src/assets/badges/[email protected]
Binary file added src/assets/badges/[email protected]
Binary file added src/assets/badges/ink.png
Binary file added src/assets/badges/[email protected]
Binary file added src/assets/badges/[email protected]
Binary file added src/assets/badges/inkBadge.png
Binary file added src/assets/badges/[email protected]
Binary file added src/assets/badges/[email protected]
Binary file added src/assets/badges/inkBadgeDark.png
Binary file added src/assets/badges/[email protected]
Binary file added src/assets/badges/[email protected]
Binary file added src/assets/badges/inkBadgeLarge.png
Binary file added src/assets/badges/[email protected]
Binary file added src/assets/badges/[email protected]
Binary file added src/assets/badges/inkBadgeLargeDark.png
Binary file added src/assets/badges/[email protected]
Binary file added src/assets/badges/[email protected]
Binary file added src/assets/badges/inkBadgeNoShadow.png
Binary file added src/assets/badges/[email protected]
Binary file added src/assets/badges/[email protected]
Loading
Loading