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: add FoxWallet extension #436

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions packages/cosmos-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"@cosmos-kit/exodus": "^2.12.0",
"@cosmos-kit/fin": "^2.13.1",
"@cosmos-kit/frontier": "^2.12.0",
"@cosmos-kit/foxwallet": "^1.0.0",
"@cosmos-kit/galaxy-station": "^2.12.0",
"@cosmos-kit/keplr": "^2.14.1",
"@cosmos-kit/leap": "^2.14.1",
Expand Down
8 changes: 7 additions & 1 deletion packages/cosmos-kit/src/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { wallets as exodusExtension } from '@cosmos-kit/exodus-extension';
import { wallets as tailwindWallet } from '@cosmos-kit/tailwind';
import { wallets as galaxyStationExtension } from '@cosmos-kit/galaxy-station-extension';
import { wallets as cdcwalletExtension } from '@cosmos-kit/cdcwallet-extension';
import { wallets as foxwalletExtension } from '@cosmos-kit/foxwallet-extension';

export type WalletName =
| 'keplr'
Expand All @@ -45,7 +46,8 @@ export type WalletName =
| 'owallet'
| 'exodus'
| 'galaxystation'
| 'cdcwallet';
| 'cdcwallet'
| 'foxwallet';

export type WalletList<
E extends MainWalletBase | null,
Expand Down Expand Up @@ -106,6 +108,7 @@ export const tailwind = createWalletList(tailwindWallet[0], null);
export const owallet = createWalletList(owalletExtension[0], null);
export const galaxystation = createWalletList(galaxyStationExtension[0], null);
export const cdcwallet = createWalletList(cdcwalletExtension[0], null);
export const foxwallet = createWalletList(foxwalletExtension[0], null);

export type SubWalletList = MainWalletBase[] & {
get mobile(): MainWalletBase[];
Expand All @@ -132,6 +135,7 @@ export type AllWalletList = SubWalletList & {
owallet: typeof owallet;
galaxystation: typeof owallet;
cdcwallet: typeof cdcwallet;
foxwallet: typeof foxwallet;
for: (...names: WalletName[]) => SubWalletList;
not: (...names: WalletName[]) => SubWalletList;
};
Expand Down Expand Up @@ -175,6 +179,7 @@ export function createAllWalletList(ws: MainWalletBase[]) {
wallets.owallet = owallet;
wallets.galaxystation = galaxystation;
wallets.cdcwallet = cdcwallet;
wallets.foxwallet = foxwallet;

defineGetters(wallets);

Expand Down Expand Up @@ -226,4 +231,5 @@ export const wallets = createAllWalletList([
...owallet,
...galaxystation,
...cdcwallet,
...foxwallet,
]);
3 changes: 2 additions & 1 deletion packages/docs/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ function MyApp({ Component, pageProps }: AppProps) {
"tailwind",
"owallet",
"galaxystation",
"cdcwallet"
"cdcwallet",
"foxwallet"
),
// ...web3AuthWallets,
]}
Expand Down
43 changes: 43 additions & 0 deletions packages/docs/pages/integrating-wallets/foxwallet.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# How to Add FoxWallet to CosmosKit

There are two packages for foxwallet

- `@cosmos-kit/foxwallet`
- `@cosmos-kit/foxwallet-extension`

`@cosmos-kit/foxwallet` export all available foxwallet wallets, while if you only want to add a particular one, choose `@cosmos-kit/foxwallet-extension`

> Note: all these packages export `wallets` and it's an array of `MainWalletBase`

Take `@cosmos-kit/foxwallet` for example

## add `@cosmos-kit/foxwallet`

```
yarn add @cosmos-kit/foxwallet
```

## import the wallets

```js
import { wallets as foxwallet } from "@cosmos-kit/foxwallet";
```

## add to your provider

```js
function MyCosmosApp({ Component, pageProps }: AppProps) {
return (
<ChainProvider
chains={chains}
assetLists={assets}
wallets={[...foxwallet]}
walletConnectOptions={...} // required if `wallets` contains mobile wallets
>
<Component {...pageProps} />
</ChainProvider>
);
}

export default MyCosmosApp;
```
1 change: 1 addition & 0 deletions packages/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@cosmos-kit/core": "^2.15.0",
"@cosmos-kit/cosmostation": "^2.14.0",
"@cosmos-kit/fin": "^2.13.1",
"@cosmos-kit/foxwallet": "^1.0.0",
"@cosmos-kit/galaxy-station": "^2.12.0",
"@cosmos-kit/ins": "^2.2.0",
"@cosmos-kit/keplr": "^2.14.1",
Expand Down
2 changes: 2 additions & 0 deletions packages/example/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { MainWalletBase } from "@cosmos-kit/core";
import { wallets as cosmostationWallets } from "@cosmos-kit/cosmostation";
import { wallets as exodusWallets } from "@cosmos-kit/exodus";
import { wallets as finWallets } from "@cosmos-kit/fin";
import { wallets as foxWallets } from "@cosmos-kit/foxwallet";
import { wallets as frontierWallets } from "@cosmos-kit/frontier";
import { wallets as galaxyStationWallets } from "@cosmos-kit/galaxy-station";
import { wallets as keplrWallets } from "@cosmos-kit/keplr";
Expand Down Expand Up @@ -113,6 +114,7 @@ function MyApp({ Component, pageProps }: AppProps) {
// ...xdefiWallets,
// ...frontierWallets,
...coin98Wallets,
...foxWallets,
// ...finWallets,
// ...cdcwalletWallets,
]}
Expand Down
4 changes: 4 additions & 0 deletions public/images/logos/wallets/foxwallet.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions wallets/foxwallet-extension/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
7 changes: 7 additions & 0 deletions wallets/foxwallet-extension/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules/
dist/
main/
module/
types/
coverage/
/index.ts
82 changes: 82 additions & 0 deletions wallets/foxwallet-extension/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"plugins": [
"@typescript-eslint",
"simple-import-sort",
"unused-imports"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
// configures both eslint-plugin-prettier and eslint-config-prettier
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"project": "tsconfig.json"
},
"env": {
"es6": true,
"browser": true,
"node": true,
"jest": true
},
"rules": {
"simple-import-sort/imports": 2,
"simple-import-sort/exports": 2,
"prettier/prettier": 2,
"unused-imports/no-unused-imports": 2,
"no-console": 1,
"no-debugger": 2,
"no-alert": 2,
"no-await-in-loop": 0,
"no-prototype-builtins": 0,
"no-return-assign": [
"error",
"except-parens"
],
"no-restricted-syntax": [
2,
"ForInStatement",
"LabeledStatement",
"WithStatement"
],
"no-unused-vars": 0,
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "React|res|next|^_"
}
],
"prefer-const": [
"error",
{
"destructuring": "all"
}
],
"no-unused-expressions": [
2,
{
"allowTaggedTemplates": true
}
],
"comma-dangle": 0,
"jsx-quotes": [
2,
"prefer-double"
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
2,
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": true
}
]
}
}
48 changes: 48 additions & 0 deletions wallets/foxwallet-extension/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# dist
main
module

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

# Editors
.idea

# Lib
lib

# npm package lock
package-lock.json
yarn.lock

# others
.DS_Store
32 changes: 32 additions & 0 deletions wallets/foxwallet-extension/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
*.log
npm-debug.log*

# Coverage directory used by tools like istanbul
coverage
.nyc_output

# Dependency directories
node_modules

# npm package lock
package-lock.json
yarn.lock

# project files
__fixtures__
__tests__
.babelrc
.babelrc.js
.editorconfig
.eslintignore
.eslintrc
.eslintrc.js
.gitignore
.travis.yml
.vscode
CHANGELOG.md
examples
jest.config.js
package.json
src
test
1 change: 1 addition & 0 deletions wallets/foxwallet-extension/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
scripts-prepend-node-path=true
7 changes: 7 additions & 0 deletions wallets/foxwallet-extension/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"useTabs": false
}
8 changes: 8 additions & 0 deletions wallets/foxwallet-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# 1.0.0 (2024-05-09)

**Note:** Version bump only for package @cosmos-kit/core
32 changes: 32 additions & 0 deletions wallets/foxwallet-extension/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
The Clear BSD License

Copyright (c) 2022 CosmosKit Contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted (subject to the limitations in the disclaimer
below) provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.

NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Loading