diff --git a/packages/cosmos-kit/src/wallets.ts b/packages/cosmos-kit/src/wallets.ts index c4f5b2202..cebfe191a 100644 --- a/packages/cosmos-kit/src/wallets.ts +++ b/packages/cosmos-kit/src/wallets.ts @@ -8,6 +8,7 @@ import { wallets as frontierExtension } from '@cosmos-kit/frontier-extension'; import { wallets as keplrExtension } from '@cosmos-kit/keplr-extension'; import { wallets as keplrMobile } from '@cosmos-kit/keplr-mobile'; import { wallets as owalletExtension } from '@cosmos-kit/owallet-extension'; +import { wallets as owalletMobile } from '@cosmos-kit/owallet-mobile'; import { wallets as leapExtension } from '@cosmos-kit/leap-extension'; import { wallets as leapMobile } from '@cosmos-kit/leap-mobile'; import { wallets as leapMetamaskCosmosSnap } from '@cosmos-kit/leap-metamask-cosmos-snap'; @@ -79,7 +80,6 @@ export function createWalletList< } export const keplr = createWalletList(keplrExtension[0], keplrMobile[0]); - export const cosmostation = createWalletList( cosmostationExtension[0], cosmostationMobile[0] @@ -103,7 +103,7 @@ export const coin98 = createWalletList(coin98Extension[0], null); export const compass = createWalletList(compassExtension[0], null); export const exodus = createWalletList(exodusExtension[0], null); export const tailwind = createWalletList(tailwindWallet[0], null); -export const owallet = createWalletList(owalletExtension[0], null); +export const owallet = createWalletList(owalletExtension[0], owalletMobile[0]); export const galaxystation = createWalletList(galaxyStationExtension[0], null); export const cdcwallet = createWalletList(cdcwalletExtension[0], null); @@ -130,7 +130,7 @@ export type AllWalletList = SubWalletList & { exodus: typeof exodus; tailwind: typeof tailwind; owallet: typeof owallet; - galaxystation: typeof owallet; + galaxystation: typeof galaxystation; cdcwallet: typeof cdcwallet; for: (...names: WalletName[]) => SubWalletList; not: (...names: WalletName[]) => SubWalletList; diff --git a/packages/example/pages/_app.tsx b/packages/example/pages/_app.tsx index f6f533cf2..64ff293d4 100644 --- a/packages/example/pages/_app.tsx +++ b/packages/example/pages/_app.tsx @@ -45,7 +45,11 @@ import { RootLayout } from "../components/layout"; // import { useTheme } from "@interchain-ui/react"; function MyApp({ Component, pageProps }: AppProps) { - const defaultWallets: MainWalletBase[] = [...keplrWallets, ...leapWallets]; + const defaultWallets: MainWalletBase[] = [ + ...keplrWallets, + ...leapWallets, + ...owalletWallets, + ]; const [wallets, setWallets] = useState(defaultWallets); const [loadingWallets, setLoadingWallet] = useState(false); // const web3AuthWallets = useMemo( @@ -94,9 +98,10 @@ function MyApp({ Component, pageProps }: AppProps) { assetLists={[]} wallets={[ // ...wallets, + ...owalletWallets, ...keplrWallets, ...leapWallets, - // ...owalletWallets, + // ...ninjiWallets, // ...snapWallet, // ...ledgerWallets, diff --git a/packages/example/pages/wallet-manager/main-wallets.tsx b/packages/example/pages/wallet-manager/main-wallets.tsx index c23b15b53..bc642a4a2 100644 --- a/packages/example/pages/wallet-manager/main-wallets.tsx +++ b/packages/example/pages/wallet-manager/main-wallets.tsx @@ -1,23 +1,27 @@ import { WalletManager, Logger } from "@cosmos-kit/core"; -import { useMemo, useState } from 'react' +import { useMemo, useState } from "react"; import { wallets as leapWallets } from "@cosmos-kit/leap"; import { wallets as stationWallets } from "@cosmos-kit/station"; import { wallets as keplrWallets } from "@cosmos-kit/keplr"; +import { wallets as oWallets } from "@cosmos-kit/owallet"; import { assets } from "chain-registry"; import { Button } from "components/button"; export default () => { const walletManager = useMemo(() => { return new WalletManager( - ["cosmoshub", "juno", "stargaze"], [ - keplrWallets[0], leapWallets[0], stationWallets[0] - ], new Logger('NONE'), false, - undefined, undefined, assets + ["cosmoshub", "juno", "stargaze"], + [keplrWallets[0], leapWallets[0], oWallets[0], stationWallets[0]], + new Logger("NONE"), + false, + undefined, + undefined, + assets ); - }, []) + }, []); - const [_, forceUpdate] = useState(0) + const [_, forceUpdate] = useState(0); - const mainWallets = walletManager.mainWallets + const mainWallets = walletManager.mainWallets; return (
@@ -25,38 +29,77 @@ export default () => { - - - - - + + + + + - {mainWallets.map(mainWallet => { - const chainWallets = mainWallet.getChainWalletList(false) + {mainWallets.map((mainWallet) => { + const chainWallets = mainWallet.getChainWalletList(false); return chainWallets.map((w, index) => { return ( {index === 0 && ( <> - - - + )} - - + + - ) - }) + ); + }); })}
WalletConnectDisconnectChainAddress + Wallet + + Connect + + Disconnect + + Chain + + Address +
{w.walletName} - + + {w.walletName} - + + + + {w.chainName}{w.address} + {w.chainName} + + {w.address} +
-
- ) -} + + ); +}; diff --git a/packages/example/pages/wallet-manager/wallet-manager.tsx b/packages/example/pages/wallet-manager/wallet-manager.tsx index c4ca3be32..5403fe291 100644 --- a/packages/example/pages/wallet-manager/wallet-manager.tsx +++ b/packages/example/pages/wallet-manager/wallet-manager.tsx @@ -1,9 +1,10 @@ import { WalletManager, Logger } from "@cosmos-kit/core"; -import { useMemo, useState } from 'react' +import { useMemo, useState } from "react"; import { wallets as leapWallets } from "@cosmos-kit/leap"; import { wallets as stationWallets } from "@cosmos-kit/station"; import { wallets as coin98Wallets } from "@cosmos-kit/coin98"; import { wallets as keplrWallets } from "@cosmos-kit/keplr"; +import { wallets as oWallets } from "@cosmos-kit/owallet"; import { assets } from "chain-registry"; import { Button } from "components/button"; import { AccountData } from "@cosmjs/proto-signing"; @@ -11,110 +12,172 @@ import { AccountData } from "@cosmjs/proto-signing"; export default () => { const walletManager = useMemo(() => { return new WalletManager( - ["cosmoshub", "juno", "stargaze"], [ - keplrWallets[0], leapWallets[0], stationWallets[0], coin98Wallets[0] - ], new Logger('NONE'), false, - undefined, undefined, assets + ["cosmoshub", "juno", "stargaze"], + [ + keplrWallets[0], + oWallets[0], + leapWallets[0], + stationWallets[0], + coin98Wallets[0], + ], + new Logger("NONE"), + false, + undefined, + undefined, + assets ); - }, []) + }, []); - const [_, forceUpdate] = useState(0) + const [_, forceUpdate] = useState(0); return (
-        {JSON.stringify({
-          activeRepos: walletManager.activeRepos,
-
-        }, null, 2)}
+        {JSON.stringify(
+          {
+            activeRepos: walletManager.activeRepos,
+          },
+          null,
+          2
+        )}
       
Main Wallets
- +
- {walletManager.mainWallets.map(mw => { - return mw.getChainWalletList(false).map(cw => { + {walletManager.mainWallets.map((mw) => { + return mw.getChainWalletList(false).map((cw) => { cw.callbacks = { - beforeConnect: () => console.log('beforeConnect'), - beforeDisconnect: () => console.log('beforeDisconnect'), - afterConnect: () => forceUpdate(i => i + 1), - afterDisconnect: () => forceUpdate(i => i + 1) - } + beforeConnect: () => console.log("beforeConnect"), + beforeDisconnect: () => console.log("beforeDisconnect"), + afterConnect: () => forceUpdate((i) => i + 1), + afterDisconnect: () => forceUpdate((i) => i + 1), + }; - const [account, setAccount] = useState(undefined) + const [account, setAccount] = useState( + undefined + ); const getAddress = async () => { - await cw.initOfflineSigner() - const account = await cw.offlineSigner?.getAccounts() - setAccount(account) - } + await cw.initOfflineSigner(); + const account = await cw.offlineSigner?.getAccounts(); + setAccount(account); + }; return ( - - - + + + + + - - - - ) - }) + ); + }); })} -
{mw.walletName}{cw.chainName} - - - + + {mw.walletName} + + {cw.chainName} + + + + + {cw.state}{cw.message} + {account?.[0]?.address} {cw.state}{cw.message}{account?.[0]?.address}
+
Wallet Repo
- {walletManager.walletRepos.map(wr => { - - - + {walletManager.walletRepos.map((wr) => { return ( <> - - + + - {wr.wallets.map(w => { - - const [account, setAccount] = useState(undefined) + {wr.wallets.map((w) => { + const [account, setAccount] = useState< + AccountData[] | undefined + >(undefined); const getAddress = async () => { - await w.initOfflineSigner() - const account = await w.offlineSigner?.getAccounts() + await w.initOfflineSigner(); + const account = await w.offlineSigner?.getAccounts(); if (account) { - setAccount(account) + setAccount(account); } - } - + }; return ( - - - + + + - - - - - ) - }) - } + + + + ); + })} - ) + ); })}
current: {wr.current?.walletName}{'client'} + current: {wr.current?.walletName} + {"client"}
{w.chainName}{w.walletName} - - - + + {w.chainName} + + {w.walletName} + + + + + + {w.state} {w.state}{w.message}{account?.[0]?.address}
+ {w.message} + + {account?.[0]?.address} +
-
) - - - -} + + ); +}; diff --git a/packages/example/pages/wallet-manager/wallet-operate.tsx b/packages/example/pages/wallet-manager/wallet-operate.tsx index 2f49891a1..ecc4d82f4 100644 --- a/packages/example/pages/wallet-manager/wallet-operate.tsx +++ b/packages/example/pages/wallet-manager/wallet-operate.tsx @@ -3,6 +3,7 @@ import { useMemo, useState } from "react"; import { wallets as leapWallets } from "@cosmos-kit/leap"; import { wallets as stationWallets } from "@cosmos-kit/station"; import { wallets as keplrWallets } from "@cosmos-kit/keplr"; +import { wallets as oWallets } from "@cosmos-kit/owallet"; import { assets } from "chain-registry"; import { Button } from "components/button"; import { SigningStargateClient } from "@cosmjs/stargate"; @@ -11,7 +12,7 @@ export default () => { const walletManager = useMemo(() => { return new WalletManager( ["cosmoshub", "juno", "stargaze"], - [keplrWallets[0], leapWallets[0], stationWallets[0]], + [keplrWallets[0], oWallets[0], leapWallets[0], stationWallets[0]], new Logger("NONE"), false, undefined, @@ -20,19 +21,17 @@ export default () => { ); }, []); - const wallet = walletManager .getWalletRepo("juno") .getWallet("keplr-extension"); - const [accounts, setAccounts] = useState(undefined); - const [signingStargateClient, setSigningStargateClient] = - useState(undefined); + const [signingStargateClient, setSigningStargateClient] = useState< + SigningStargateClient | undefined + >(undefined); const [_, forceUpdate] = useState(0); - const connect = async () => { try { await wallet?.connect(); @@ -84,9 +83,7 @@ export default () => { } catch (error) { console.error(error); } - } - - + }; return (
@@ -108,7 +105,6 @@ export default () => { */}
-

status:{wallet?.state}

address:{wallet?.address}

walletState:{wallet?.walletStatus}

diff --git a/packages/example/pages/wallet-manager/wallet-repo.tsx b/packages/example/pages/wallet-manager/wallet-repo.tsx index 5dbec44a5..bf11dd77e 100644 --- a/packages/example/pages/wallet-manager/wallet-repo.tsx +++ b/packages/example/pages/wallet-manager/wallet-repo.tsx @@ -1,23 +1,27 @@ import { WalletManager, Logger } from "@cosmos-kit/core"; -import { useMemo, useState } from 'react' +import { useMemo, useState } from "react"; import { wallets as leapWallets } from "@cosmos-kit/leap"; import { wallets as stationWallets } from "@cosmos-kit/station"; import { wallets as keplrWallets } from "@cosmos-kit/keplr"; +import { wallets as oWallets } from "@cosmos-kit/owallet"; import { assets } from "chain-registry"; import { Button } from "components/button"; export default () => { const walletManager = useMemo(() => { return new WalletManager( - ["cosmoshub", "juno", "stargaze"], [ - keplrWallets[0], leapWallets[0], stationWallets[0], - ], new Logger('NONE'), false, - undefined, undefined, assets + ["cosmoshub", "juno", "stargaze"], + [keplrWallets[0], oWallets[0], leapWallets[0], stationWallets[0]], + new Logger("NONE"), + false, + undefined, + undefined, + assets ); - }, []) + }, []); - const [_, forceUpdate] = useState(0) + const [_, forceUpdate] = useState(0); - const walletRepo = walletManager.getWalletRepo('juno') + const walletRepo = walletManager.getWalletRepo("juno"); return (
@@ -25,40 +29,90 @@ export default () => { - - - - - - - - + + + + + + + + {walletRepo.wallets.map((w, index) => { return ( - {index === 0 && } - {index === 0 && } - + {index === 0 && ( + + )} + {index === 0 && ( + + )} + + + + - - - - ) - }) - } + ); + })}
ChainCurrent Chain WalletWalletConnectDisconnectStateAddressDownload Link + Chain + + Current Chain Wallet + + Wallet + + Connect + + Disconnect + + State + + Address + + Download Link +
{w.chainName}{walletRepo?.current?.walletName}-{walletRepo.current?.chainName}{w.walletName} + {w.chainName} + + {walletRepo?.current?.walletName}- + {walletRepo.current?.chainName} + - + {w.walletName} - + + + + + {w.walletStatus} + + address:{w.address} + + {w.downloadInfo?.link} {w.walletStatus}address:{w.address}{w.downloadInfo?.link}
-
- - ) - -} + + ); +}; diff --git a/packages/example/pages/wallet-manager/wallet-repos.tsx b/packages/example/pages/wallet-manager/wallet-repos.tsx index 9815f12c7..4bbe1a0dc 100644 --- a/packages/example/pages/wallet-manager/wallet-repos.tsx +++ b/packages/example/pages/wallet-manager/wallet-repos.tsx @@ -1,21 +1,25 @@ import { WalletManager, Logger } from "@cosmos-kit/core"; -import { useMemo, useState } from 'react' +import { useMemo, useState } from "react"; import { wallets as leapWallets } from "@cosmos-kit/leap"; import { wallets as stationWallets } from "@cosmos-kit/station"; import { wallets as keplrWallets } from "@cosmos-kit/keplr"; +import { wallets as oWallets } from "@cosmos-kit/owallet"; import { assets } from "chain-registry"; import { Button } from "components/button"; export default () => { const walletManager = useMemo(() => { return new WalletManager( - ["cosmoshub", "juno", "stargaze"], [ - keplrWallets[0], leapWallets[0], stationWallets[0] - ], new Logger('NONE'), false, - undefined, undefined, assets + ["cosmoshub", "juno", "stargaze"], + [keplrWallets[0], oWallets[0], leapWallets[0], stationWallets[0]], + new Logger("NONE"), + false, + undefined, + undefined, + assets ); - }, []) + }, []); - const [_, forceUpdate] = useState(0) + const [_, forceUpdate] = useState(0); return (
@@ -23,39 +27,91 @@ export default () => { - - - - - - - - + + + + + + + + - {walletManager.walletRepos.map(wr => { + {walletManager.walletRepos.map((wr) => { return wr.wallets.map((w, index) => { return ( - {index === 0 && } - {index === 0 && } - + {index === 0 && ( + + )} + {index === 0 && ( + + )} + + + + - - - - ) - }) + ); + }); })}
ChainCurrent Chain WalletWalletConnectDisconnectStateAddressDownload Link + Chain + + Current Chain Wallet + + Wallet + + Connect + + Disconnect + + State + + Address + + Download Link +
{w.chainName}{wr?.current?.walletName}-{wr.current?.chainName}{w.walletName} + {w.chainName} + + {wr?.current?.walletName}-{wr.current?.chainName} + - + {w.walletName} - + + + + + {w.walletStatus} + + address:{w.address} + + {w.downloadInfo?.link} {w.walletStatus}address:{w.address}{w.downloadInfo?.link}
-
- ) -} + + ); +}; diff --git a/wallets/owallet-mobile/.editorconfig b/wallets/owallet-mobile/.editorconfig new file mode 100644 index 000000000..4a7ea3036 --- /dev/null +++ b/wallets/owallet-mobile/.editorconfig @@ -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 diff --git a/wallets/owallet-mobile/.eslintignore b/wallets/owallet-mobile/.eslintignore new file mode 100644 index 000000000..91689c308 --- /dev/null +++ b/wallets/owallet-mobile/.eslintignore @@ -0,0 +1,7 @@ +node_modules/ +dist/ +main/ +module/ +types/ +coverage/ +/index.ts \ No newline at end of file diff --git a/wallets/owallet-mobile/.eslintrc.json b/wallets/owallet-mobile/.eslintrc.json new file mode 100644 index 000000000..d95fc326b --- /dev/null +++ b/wallets/owallet-mobile/.eslintrc.json @@ -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 + } + ] + } +} \ No newline at end of file diff --git a/wallets/owallet-mobile/.gitignore b/wallets/owallet-mobile/.gitignore new file mode 100644 index 000000000..a91a2f788 --- /dev/null +++ b/wallets/owallet-mobile/.gitignore @@ -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 diff --git a/wallets/owallet-mobile/.npmignore b/wallets/owallet-mobile/.npmignore new file mode 100644 index 000000000..cc2605fa8 --- /dev/null +++ b/wallets/owallet-mobile/.npmignore @@ -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 \ No newline at end of file diff --git a/wallets/owallet-mobile/.npmrc b/wallets/owallet-mobile/.npmrc new file mode 100644 index 000000000..a21347f1b --- /dev/null +++ b/wallets/owallet-mobile/.npmrc @@ -0,0 +1 @@ +scripts-prepend-node-path=true \ No newline at end of file diff --git a/wallets/owallet-mobile/.prettierrc.json b/wallets/owallet-mobile/.prettierrc.json new file mode 100644 index 000000000..4aa2a0dc9 --- /dev/null +++ b/wallets/owallet-mobile/.prettierrc.json @@ -0,0 +1,7 @@ +{ + "trailingComma": "es5", + "tabWidth": 2, + "semi": true, + "singleQuote": true, + "useTabs": false +} \ No newline at end of file diff --git a/wallets/owallet-mobile/CHANGELOG.md b/wallets/owallet-mobile/CHANGELOG.md new file mode 100644 index 000000000..e4d87c4d4 --- /dev/null +++ b/wallets/owallet-mobile/CHANGELOG.md @@ -0,0 +1,4 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. diff --git a/wallets/owallet-mobile/LICENSE b/wallets/owallet-mobile/LICENSE new file mode 100644 index 000000000..b3ac161b5 --- /dev/null +++ b/wallets/owallet-mobile/LICENSE @@ -0,0 +1,33 @@ +The Clear BSD License + +Copyright (c) 2024 Cosmos Kit Contributors +Copyright (c) 2024 Interweb, Inc. +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. diff --git a/wallets/owallet-mobile/README.md b/wallets/owallet-mobile/README.md new file mode 100644 index 000000000..a70ac5687 --- /dev/null +++ b/wallets/owallet-mobile/README.md @@ -0,0 +1,40 @@ +# @cosmos-kit/owallet-mobile + +

+ +

+ +

+ + + + + +

+ +Cosmos Kit is a univeral wallet adapter for developers to build apps that quickly and easily interact with Cosmos blockchains and wallets. + +@cosmos-kit/owallet-mobile is the OWallet integration for Cosmos Kit. + +## Related + +Checkout these related projects: + +* [@cosmology/telescope](https://github.com/cosmology-tech/telescope) Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. +* [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. +* [chain-registry](https://github.com/cosmology-tech/chain-registry) Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. +* [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit) Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. +* [create-cosmos-app](https://github.com/cosmology-tech/create-cosmos-app) Set up a modern Cosmos app by running one command. +* [interchain-ui](https://github.com/cosmology-tech/interchain-ui) The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. +* [starship](https://github.com/cosmology-tech/starship) Unified Testing and Development for the Interchain. + +## Credits + +🛠 Built by Cosmology — if you like our tools, please consider delegating to [our validator ⚛️](https://cosmology.zone/validator) + + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/wallets/owallet-mobile/index.ts b/wallets/owallet-mobile/index.ts new file mode 100644 index 000000000..deae8cf81 --- /dev/null +++ b/wallets/owallet-mobile/index.ts @@ -0,0 +1,2 @@ +// not for module, but for local development.. +export * from './src'; \ No newline at end of file diff --git a/wallets/owallet-mobile/package.json b/wallets/owallet-mobile/package.json new file mode 100644 index 000000000..f8164ea0a --- /dev/null +++ b/wallets/owallet-mobile/package.json @@ -0,0 +1,79 @@ +{ + "name": "@cosmos-kit/owallet-mobile", + "version": "2.14.1", + "description": "cosmos-kit wallet connector", + "author": "defi@orai.io", + "contributors": [ + { + "name": "Toan Dang" + }, + { + "name": "Tu Pham " + }, + { + "name": "Son Lai" + }, + { + "name": "Hau Nguyen" + }, + { + "name": "Tu Chu" + } + ], + "homepage": "https://github.com/cosmology-tech/cosmos-kit#readme", + "license": "SEE LICENSE IN LICENSE", + "main": "cjs/index.js", + "module": "esm/index.js", + "types": "cjs/index.d.ts", + "directories": { + "lib": "src", + "test": "__tests__" + }, + "files": [ + "cjs", + "esm", + "!CHANGELOG.md", + "!LICENSE" + ], + "scripts": { + "build:cjs": "yarn tsc -p tsconfig.json --outDir cjs --module commonjs || true", + "build:esm": "yarn tsc -p tsconfig.json --outDir esm --module es2022 || true", + "clean:cjs": "rimraf cjs", + "clean:esm": "rimraf esm", + "clean": "npm run clean:cjs && npm run clean:esm", + "build": "npm run clean && npm run build:cjs && npm run build:esm", + "prepare": "npm run build", + "lint": "eslint --ext .tsx,.ts .", + "format": "eslint --ext .tsx,.ts --fix .", + "test": "jest", + "test:watch": "jest --watch", + "test:debug": "node --inspect node_modules/.bin/jest --runInBand" + }, + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "https://github.com/cosmology-tech/cosmos-kit" + }, + "keywords": [ + "cosmos", + "cosmos-kit", + "owallet", + "wallet" + ], + "bugs": { + "url": "https://github.com/cosmology-tech/cosmos-kit/issues" + }, + "jest": { + "testPathIgnorePatterns": [ + "dist/" + ] + }, + "dependencies": { + "@chain-registry/keplr": "1.68.2", + "@cosmos-kit/core": "^2.13.1", + "@cosmos-kit/walletconnect": "^2.10.1" + }, + "gitHead": "2b5f2de5d9ed1580be4137736dfc6cce779679d1" +} diff --git a/wallets/owallet-mobile/src/constant.ts b/wallets/owallet-mobile/src/constant.ts new file mode 100644 index 000000000..541cbbf2a --- /dev/null +++ b/wallets/owallet-mobile/src/constant.ts @@ -0,0 +1,2 @@ +export const ICON = + 'data:image/png;base64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RodW1iOjpJbWFnZTo6SGVpZ2h0ADk3NtegyXoAAAAXdEVYdFRodW1iOjpJbWFnZTo6V2lkdGgAOTc2RFGZJwAAABl0RVh0VGh1bWI6Ok1pbWV0eXBlAGltYWdlL3BuZz+yVk4AAAAXdEVYdFRodW1iOjpNVGltZQAxNjU0MjM0NTkzdaoxgAAAABJ0RVh0VGh1bWI6OlNpemUAMzg3MDBCLEwASgAAADx0RVh0VGh1bWI6OlVSSQBmaWxlOi8vLi4vbW9iaWxlL3NyYy9hc3NldHMvbG9nby9zcGxhc2gtaW1hZ2UucG5nbhCtKgAAAABJRU5ErkJggg=='; diff --git a/wallets/owallet-mobile/src/index.ts b/wallets/owallet-mobile/src/index.ts new file mode 100644 index 000000000..747b1dff6 --- /dev/null +++ b/wallets/owallet-mobile/src/index.ts @@ -0,0 +1,2 @@ +export * from './owallet'; +export * from './wallet-connect'; diff --git a/wallets/owallet-mobile/src/owallet.ts b/wallets/owallet-mobile/src/owallet.ts new file mode 100644 index 000000000..8327c9b43 --- /dev/null +++ b/wallets/owallet-mobile/src/owallet.ts @@ -0,0 +1,5 @@ +import { owalletMobileInfo, OWalletMobileWallet } from './wallet-connect'; + +const owalletMobile = new OWalletMobileWallet(owalletMobileInfo); + +export const wallets = [owalletMobile]; diff --git a/wallets/owallet-mobile/src/wallet-connect/chain-wallet.ts b/wallets/owallet-mobile/src/wallet-connect/chain-wallet.ts new file mode 100644 index 000000000..fd2800a18 --- /dev/null +++ b/wallets/owallet-mobile/src/wallet-connect/chain-wallet.ts @@ -0,0 +1,9 @@ +import { ChainRecord, Wallet } from '@cosmos-kit/core'; +import { ChainWC } from '@cosmos-kit/walletconnect'; +import { OWalletClient } from './client'; + +export class ChainOWalletMobile extends ChainWC { + constructor(walletInfo: Wallet, chainInfo: ChainRecord) { + super(walletInfo, chainInfo, OWalletClient); + } +} diff --git a/wallets/owallet-mobile/src/wallet-connect/client.ts b/wallets/owallet-mobile/src/wallet-connect/client.ts new file mode 100644 index 000000000..084709254 --- /dev/null +++ b/wallets/owallet-mobile/src/wallet-connect/client.ts @@ -0,0 +1,8 @@ +import { Wallet } from '@cosmos-kit/core'; +import { WCClient } from '@cosmos-kit/walletconnect'; + +export class OWalletClient extends WCClient { + constructor(walletInfo: Wallet) { + super(walletInfo); + } +} diff --git a/wallets/owallet-mobile/src/wallet-connect/index.ts b/wallets/owallet-mobile/src/wallet-connect/index.ts new file mode 100644 index 000000000..883beafac --- /dev/null +++ b/wallets/owallet-mobile/src/wallet-connect/index.ts @@ -0,0 +1,3 @@ +export * from './chain-wallet' +export * from './main-wallet' +export * from './registry' diff --git a/wallets/owallet-mobile/src/wallet-connect/main-wallet.ts b/wallets/owallet-mobile/src/wallet-connect/main-wallet.ts new file mode 100644 index 000000000..f09865ea6 --- /dev/null +++ b/wallets/owallet-mobile/src/wallet-connect/main-wallet.ts @@ -0,0 +1,15 @@ +import { EndpointOptions, Wallet } from '@cosmos-kit/core'; +import { WCWallet } from '@cosmos-kit/walletconnect'; + +import { ChainOWalletMobile } from './chain-wallet'; +import { OWalletClient } from './client'; + +export class OWalletMobileWallet extends WCWallet { + constructor( + walletInfo: Wallet, + preferredEndpoints?: EndpointOptions['endpoints'] + ) { + super(walletInfo, ChainOWalletMobile, OWalletClient); + this.preferredEndpoints = preferredEndpoints; + } +} diff --git a/wallets/owallet-mobile/src/wallet-connect/registry.ts b/wallets/owallet-mobile/src/wallet-connect/registry.ts new file mode 100644 index 000000000..5a684c8e8 --- /dev/null +++ b/wallets/owallet-mobile/src/wallet-connect/registry.ts @@ -0,0 +1,61 @@ +import { OS, Wallet } from '@cosmos-kit/core'; + +import { ICON } from '../constant'; + +export const owalletMobileInfo: Wallet = { + name: 'owallet-mobile', + prettyName: 'OWallet Mobile', + logo: ICON, + mode: 'wallet-connect', + mobileDisabled: () => + 'owallet' in window && /OWalletMobile/i.test(navigator.userAgent), + rejectMessage: { + source: 'Request rejected', + }, + downloads: [ + { + device: 'mobile', + os: 'android', + link: 'https://play.google.com/store/apps/details?id=com.io.owallet', + }, + { + device: 'mobile', + os: 'ios', + link: 'https://apps.apple.com/app/owallet/id1626035069', + }, + { + link: 'https://owallet.io/', + }, + ], + connectEventNamesOnWindow: ['keplr_keystorechange'], + + walletconnect: { + name: 'OWallet', + projectId: + '5a2b2db3d2ed90458a41d2a0c5e4bd28ec67b6fa272b0e201cc8508dc3d4be87', + encoding: 'base64', + mobile: { + native: { + ios: 'owallet:', + android: 'intent:', + }, + }, + formatNativeUrl: ( + appUrl: string, + wcUri: string, + os: OS | undefined, + _name: string + ): string => { + const plainAppUrl = appUrl.split(':')[0]; + const encodedWcUrl = encodeURIComponent(wcUri); + switch (os) { + case 'ios': + return `${plainAppUrl}://wcV2?${encodedWcUrl}`; + case 'android': + return `intent://wcV2?${encodedWcUrl}#Intent;package=com.io.owallet;scheme=owallet;end;`; + default: + return `${plainAppUrl}://wcV2?${encodedWcUrl}`; + } + }, + }, +}; diff --git a/wallets/owallet-mobile/src/wallet-connect/types.ts b/wallets/owallet-mobile/src/wallet-connect/types.ts new file mode 100644 index 000000000..9819c274c --- /dev/null +++ b/wallets/owallet-mobile/src/wallet-connect/types.ts @@ -0,0 +1,8 @@ +export interface OWalletAccount { + address: string; + algo: string; + bech32Address: string; + isNanoLedger: boolean; + name: string; + pubKey: string; +} diff --git a/wallets/owallet-mobile/tsconfig.json b/wallets/owallet-mobile/tsconfig.json new file mode 100644 index 000000000..cddc39bc4 --- /dev/null +++ b/wallets/owallet-mobile/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "baseUrl": ".", + "rootDir": "src" + }, + "include": ["src/**/*"], + "exclude": ["node_modules"] +} diff --git a/wallets/owallet/package.json b/wallets/owallet/package.json index 91f6f9ada..301114ffe 100644 --- a/wallets/owallet/package.json +++ b/wallets/owallet/package.json @@ -65,6 +65,7 @@ "url": "https://github.com/cosmology-tech/cosmos-kit/issues" }, "dependencies": { - "@cosmos-kit/owallet-extension": "^2.14.1" + "@cosmos-kit/owallet-extension": "^2.14.1", + "@cosmos-kit/owallet-mobile": "^2.14.1" } } diff --git a/wallets/owallet/src/index.ts b/wallets/owallet/src/index.ts index b1e221777..e2063851a 100644 --- a/wallets/owallet/src/index.ts +++ b/wallets/owallet/src/index.ts @@ -1,3 +1,4 @@ import { wallets as ext } from '@cosmos-kit/owallet-extension'; +import { wallets as mobile } from '@cosmos-kit/owallet-mobile'; -export const wallets = [...ext]; +export const wallets = [...ext, ...mobile];