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

Feature: integrate CosmosKit #73

Merged
merged 34 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
615a678
implement cosmos kit
steezeburger Dec 6, 2024
5814437
better export
steezeburger Dec 6, 2024
e3c7688
fix some tests, still 1 broken
steezeburger Dec 7, 2024
911dd72
linting, todo, fix value in test env values
steezeburger Dec 7, 2024
cc937d6
fix tests
steezeburger Dec 7, 2024
a65a753
update readme
steezeburger Dec 7, 2024
afc743c
update logo for cosmos wallet button. programmatically select default…
steezeburger Dec 9, 2024
376c5ae
get default chain id programmatically
steezeburger Dec 9, 2024
edecdf0
move opening of wallet modals to hooks
steezeburger Dec 9, 2024
2dea012
create chain objects for cosmoskit to support custom networks and tes…
steezeburger Dec 9, 2024
0e03467
correct type for cosmos assets. add leap wallet. comments.
steezeburger Dec 9, 2024
02d887d
comments, formatting, lints
steezeburger Dec 10, 2024
8e2cda4
use client gotten from cosmoskit to send ibc transfer
steezeburger Dec 10, 2024
3c9fd6b
formatting, linting
steezeburger Dec 10, 2024
dd4c3b2
remove unused deps, formatting
steezeburger Dec 10, 2024
9ada93c
get balance with cosmoskit
steezeburger Dec 10, 2024
bed3a02
attempt tree shaking
steezeburger Dec 10, 2024
d673211
add more packages to wallet chunk
steezeburger Dec 10, 2024
c63999e
fix tests
steezeburger Dec 11, 2024
61f7ee9
small cleanups. formatting. removed unused stuff.
steezeburger Dec 11, 2024
ebf7194
only optimize webpack for builds
steezeburger Dec 11, 2024
5d4b7e6
remove unused keplr-wallet deps
steezeburger Dec 11, 2024
8a7e4da
use correct string for chain name
steezeburger Dec 11, 2024
ffc0b04
fix bug where clearing manual recipient address input would keep cosm…
steezeburger Dec 11, 2024
4784a0a
fix lints
steezeburger Dec 11, 2024
4d34949
recreate keplr types and remove keplr dep as stop gap
steezeburger Dec 12, 2024
4abd49c
fix npm commands
steezeburger Dec 12, 2024
f1380a3
update biome. sort imports. lints
steezeburger Dec 12, 2024
7b06aef
use cosmos instead of ibc
steezeburger Dec 12, 2024
43dbfdd
naming
steezeburger Dec 12, 2024
d10ef7a
comments
steezeburger Dec 12, 2024
be0c1f8
rename KeplerWallet to CosmosWallet
steezeburger Dec 13, 2024
4dfacf2
rename service from ibc to cosmos
steezeburger Dec 13, 2024
700751e
rename ibc stuff to cosmos
steezeburger Dec 13, 2024
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ web/build
# gcloud
gsa-key.json

# ai digest
# ai digest for feeding to LLMs
codebase.md
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,23 @@ the Astria bridge.

## `web` application directory structure

* `config-overrides.js` - used by `react-app-rewired` to override CRA's default
webpack config
* `public/index.html`
* html meta stuff, import styles and fonts
* define React root element
* `src/index.tsx`
* React application setup
* import styles
* ConfigContextProvider is here to provide config to App
* `src/App.tsx`
* main application component
* define routes
* use context providers
* rest of context providers, e.g. notifications, rainbowkit, etc
* `src/setupTests.tsx`
* most jest mocks defined here (some mocks defined in individual test files)
* browser global mocks defined here
* `src/testHelpers.tsx` - helper functions for testing
* `src/components` - More general React components for the app, e.g. Navbar,
Dropdown, CopyToClipboardButton, etc
* `src/config` - Configuration for the web app
Expand All @@ -26,8 +33,8 @@ the Astria bridge.
* `src/config/index.ts` - AppConfig and exports
* `src/features` - Organizes components, contexts, hooks, services, types, and
utils for different features
* `src/features/CosmosWallet` - User for interacting with Keplr wallet
* `src/features/EthWallet` - Used for interacting with EVM wallets
* `src/features/KeplrWallet` - User for interacting with Keplr wallet
* `src/features/Notifications` - Used for displaying notifications and toasts
* `src/pages`
* React components for each page
Expand Down
5 changes: 5 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ mod web

_default:
@just --list

# generate codebase.md that is useful to feed to LLMs
[group('extra')]
ai-digest:
npx ai-digest -i web --show-output-files
4 changes: 2 additions & 2 deletions justfile.codestyle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ lint lang=default_lang:
# lint and fix issues that can be fixed. pass "unsafe" to also apply unsafe fixes.
[group('codestyle')]
lint-ts-apply unsafe='':
cd web; npm run lint-apply{{ if unsafe == "unsafe" { "-unsafe" } else { "" } }}
cd web; npm run lint-apply{{ if unsafe == "unsafe" { "-unsafe" } else { "" } }} && npm run check-apply{{ if unsafe == "unsafe" { "-unsafe" } else { "" } }}

alias l := lint

Expand All @@ -29,7 +29,7 @@ _lint-md:

[no-exit-message]
_lint-ts:
cd web; npm run lint
cd web; npm run lint && npm run check

# Can format 'ts', 'md', or 'all'. Defaults to all
[group('codestyle')]
Expand Down
2 changes: 1 addition & 1 deletion web/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

REACT_APP_ENV=test

REACT_APP_IBC_CHAINS='{"Celestia Mocha-4":{"chainId":"mocha-4","chainName":"Celestia Mocha-4","rpc":"wss://rpc-mocha.pops.one","rest":"https://api-mocha.pops.one","stakeCurrency":{"coinDenom":"TIA","coinMinimalDenom":"utia","coinDecimals":6},"bip44":{"coinType":118},"bech32Config":{"bech32PrefixAccAddr":"celestia","bech32PrefixAccPub":"celestiapub","bech32PrefixConsAddr":"celestiavalcons","bech32PrefixConsPub":"celestiavalconspub","bech32PrefixValAddr":"celestiavaloper","bech32PrefixValPub":"celestiavaloperpub"},"currencies":[{"coinDenom":"TIA","coinMinimalDenom":"utia","coinDecimals":6,"ibcChannel":"channel-128","sequencerBridgeAccount":"astria1d7zjjljc0dsmxa545xkpwxym86g8uvvwhtezcr","iconClass":"i-celestia"},{"coinDenom":"STEEZE","coinMinimalDenom":"usteeze","coinDecimals":6}],"feeCurrencies":[{"coinDenom":"TIA","coinMinimalDenom":"utia","coinDecimals":6,"gasPriceStep":{"low":0.01,"average":0.02,"high":0.1}}],"iconClass":"i-celestia"}}'
REACT_APP_IBC_CHAINS='{"Celestia Mocha-4":{"chainId":"celestia","chainName":"Celestia Mocha-4","rpc":"wss://rpc-mocha.pops.one","rest":"https://api-mocha.pops.one","stakeCurrency":{"coinDenom":"TIA","coinMinimalDenom":"utia","coinDecimals":6},"bip44":{"coinType":118},"bech32Config":{"bech32PrefixAccAddr":"celestia","bech32PrefixAccPub":"celestiapub","bech32PrefixConsAddr":"celestiavalcons","bech32PrefixConsPub":"celestiavalconspub","bech32PrefixValAddr":"celestiavaloper","bech32PrefixValPub":"celestiavaloperpub"},"currencies":[{"coinDenom":"TIA","coinMinimalDenom":"utia","coinDecimals":6,"ibcChannel":"channel-128","sequencerBridgeAccount":"astria1d7zjjljc0dsmxa545xkpwxym86g8uvvwhtezcr","iconClass":"i-celestia"},{"coinDenom":"STEEZE","coinMinimalDenom":"usteeze","coinDecimals":6}],"feeCurrencies":[{"coinDenom":"TIA","coinMinimalDenom":"utia","coinDecimals":6,"gasPriceStep":{"low":0.01,"average":0.02,"high":0.1}}],"iconClass":"i-celestia"}}'
REACT_APP_EVM_CHAINS=''

REACT_APP_BRAND_URL=https://astria.org
Expand Down
71 changes: 68 additions & 3 deletions web/config-overrides.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const webpack = require("webpack");

// For react-app-rewired to override the default webpack configuration
module.exports = function override(config) {
const fallback = config.resolve.fallback || {};
Object.assign(fallback, {
Expand All @@ -12,20 +11,86 @@ module.exports = function override(config) {
string_decoder: false,
});
config.resolve.fallback = fallback;

config.plugins = (config.plugins || []).concat([
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"],
}),
]);

// ignoring hundreds of source map warnings,
// so that the dev server build output is actually clean
config.ignoreWarnings = [
{
module: /node_modules/,
message: /Failed to parse source map/,
},
];

// optimize for build by default but not for local dev server
if (process.env.WEBPACK_OPTIMIZE_FOR_BUILD !== "false") {
// optimization configuration with safer chunking
config.optimization = {
...config.optimization,
usedExports: true,
providedExports: true,
sideEffects: true,
minimize: true,
splitChunks: {
chunks: "all",
maxInitialRequests: 25,
minSize: 20000,
maxSize: 244000,
cacheGroups: {
// main vendor bundle for larger modules
vendor: {
test: /[\\/]node_modules[\\/]/,
name: "vendor",
chunks: "all",
priority: 10,
enforce: true,
},
// separate bundle for react and related packages
react: {
test: /[\\/]node_modules[\\/](react|react-dom|react-router)[\\/]/,
name: "react-vendor",
chunks: "all",
priority: 20,
},
// bundle for wallet-related packages
wallets: {
test: /[\\/]node_modules[\\/](@cosmjs|@rainbow-me|osmojs|@cosmos-kit|chain-registry|ethers|viem|wagmi)[\\/]/,
name: "wallet-vendor",
chunks: "all",
priority: 15,
},
// common code used across multiple components
common: {
name: "common",
minChunks: 2,
chunks: "all",
priority: 5,
reuseExistingChunk: true,
enforce: true,
},
},
},
};

config.module.rules.push({
test: /\.js$/,
include: /node_modules/,
sideEffects: false,
});

config.optimization.concatenateModules = true;

config.cache = {
type: "filesystem",
allowCollectingMemory: true,
buildDependencies: {
config: [__filename],
},
};
}

return config;
};
Loading
Loading