From 3b2e8c16872ee7443cdaf69a724f710f6e055a32 Mon Sep 17 00:00:00 2001 From: S_PONY Date: Thu, 17 Oct 2024 15:48:48 +0800 Subject: [PATCH 1/3] feat: add gate wallet --- public/images/logos/wallets/gatewallet.svg | 1 + wallets/gatewallet-extension/.editorconfig | 12 + wallets/gatewallet-extension/.eslintignore | 7 + wallets/gatewallet-extension/.eslintrc.json | 82 +++++++ wallets/gatewallet-extension/.gitignore | 48 ++++ wallets/gatewallet-extension/.npmignore | 32 +++ wallets/gatewallet-extension/.npmrc | 1 + wallets/gatewallet-extension/.prettierrc.json | 7 + wallets/gatewallet-extension/CHANGELOG.md | 8 + wallets/gatewallet-extension/LICENSE | 33 +++ wallets/gatewallet-extension/README.md | 41 ++++ wallets/gatewallet-extension/index.ts | 2 + wallets/gatewallet-extension/package.json | 68 ++++++ wallets/gatewallet-extension/src/config.ts | 208 ++++++++++++++++++ wallets/gatewallet-extension/src/constant.ts | 2 + .../src/extension/chain-wallet.ts | 7 + .../src/extension/client.ts | 94 ++++++++ .../src/extension/index.ts | 3 + .../src/extension/main-wallet.ts | 24 ++ .../src/extension/registry.ts | 30 +++ .../src/extension/types.ts | 47 ++++ .../src/extension/utils.ts | 51 +++++ .../gatewallet-extension/src/gatewallet.ts | 5 + wallets/gatewallet-extension/src/index.ts | 3 + wallets/gatewallet-extension/tsconfig.json | 9 + wallets/gatewallet/.editorconfig | 12 + wallets/gatewallet/.eslintignore | 7 + wallets/gatewallet/.eslintrc.json | 82 +++++++ wallets/gatewallet/.gitignore | 48 ++++ wallets/gatewallet/.npmignore | 32 +++ wallets/gatewallet/.npmrc | 1 + wallets/gatewallet/.prettierrc.json | 7 + wallets/gatewallet/CHANGELOG.md | 8 + wallets/gatewallet/LICENSE | 33 +++ wallets/gatewallet/README.md | 41 ++++ wallets/gatewallet/index.ts | 2 + wallets/gatewallet/package.json | 58 +++++ wallets/gatewallet/src/index.ts | 3 + wallets/gatewallet/tsconfig.json | 9 + 39 files changed, 1168 insertions(+) create mode 100644 public/images/logos/wallets/gatewallet.svg create mode 100644 wallets/gatewallet-extension/.editorconfig create mode 100644 wallets/gatewallet-extension/.eslintignore create mode 100644 wallets/gatewallet-extension/.eslintrc.json create mode 100644 wallets/gatewallet-extension/.gitignore create mode 100644 wallets/gatewallet-extension/.npmignore create mode 100644 wallets/gatewallet-extension/.npmrc create mode 100644 wallets/gatewallet-extension/.prettierrc.json create mode 100644 wallets/gatewallet-extension/CHANGELOG.md create mode 100644 wallets/gatewallet-extension/LICENSE create mode 100644 wallets/gatewallet-extension/README.md create mode 100644 wallets/gatewallet-extension/index.ts create mode 100644 wallets/gatewallet-extension/package.json create mode 100644 wallets/gatewallet-extension/src/config.ts create mode 100644 wallets/gatewallet-extension/src/constant.ts create mode 100644 wallets/gatewallet-extension/src/extension/chain-wallet.ts create mode 100644 wallets/gatewallet-extension/src/extension/client.ts create mode 100644 wallets/gatewallet-extension/src/extension/index.ts create mode 100644 wallets/gatewallet-extension/src/extension/main-wallet.ts create mode 100644 wallets/gatewallet-extension/src/extension/registry.ts create mode 100644 wallets/gatewallet-extension/src/extension/types.ts create mode 100644 wallets/gatewallet-extension/src/extension/utils.ts create mode 100644 wallets/gatewallet-extension/src/gatewallet.ts create mode 100644 wallets/gatewallet-extension/src/index.ts create mode 100644 wallets/gatewallet-extension/tsconfig.json create mode 100644 wallets/gatewallet/.editorconfig create mode 100644 wallets/gatewallet/.eslintignore create mode 100644 wallets/gatewallet/.eslintrc.json create mode 100644 wallets/gatewallet/.gitignore create mode 100644 wallets/gatewallet/.npmignore create mode 100644 wallets/gatewallet/.npmrc create mode 100644 wallets/gatewallet/.prettierrc.json create mode 100644 wallets/gatewallet/CHANGELOG.md create mode 100644 wallets/gatewallet/LICENSE create mode 100644 wallets/gatewallet/README.md create mode 100644 wallets/gatewallet/index.ts create mode 100644 wallets/gatewallet/package.json create mode 100644 wallets/gatewallet/src/index.ts create mode 100644 wallets/gatewallet/tsconfig.json diff --git a/public/images/logos/wallets/gatewallet.svg b/public/images/logos/wallets/gatewallet.svg new file mode 100644 index 000000000..0cf19ec5e --- /dev/null +++ b/public/images/logos/wallets/gatewallet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/wallets/gatewallet-extension/.editorconfig b/wallets/gatewallet-extension/.editorconfig new file mode 100644 index 000000000..4a7ea3036 --- /dev/null +++ b/wallets/gatewallet-extension/.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/gatewallet-extension/.eslintignore b/wallets/gatewallet-extension/.eslintignore new file mode 100644 index 000000000..91689c308 --- /dev/null +++ b/wallets/gatewallet-extension/.eslintignore @@ -0,0 +1,7 @@ +node_modules/ +dist/ +main/ +module/ +types/ +coverage/ +/index.ts \ No newline at end of file diff --git a/wallets/gatewallet-extension/.eslintrc.json b/wallets/gatewallet-extension/.eslintrc.json new file mode 100644 index 000000000..d95fc326b --- /dev/null +++ b/wallets/gatewallet-extension/.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/gatewallet-extension/.gitignore b/wallets/gatewallet-extension/.gitignore new file mode 100644 index 000000000..a91a2f788 --- /dev/null +++ b/wallets/gatewallet-extension/.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/gatewallet-extension/.npmignore b/wallets/gatewallet-extension/.npmignore new file mode 100644 index 000000000..cc2605fa8 --- /dev/null +++ b/wallets/gatewallet-extension/.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/gatewallet-extension/.npmrc b/wallets/gatewallet-extension/.npmrc new file mode 100644 index 000000000..a21347f1b --- /dev/null +++ b/wallets/gatewallet-extension/.npmrc @@ -0,0 +1 @@ +scripts-prepend-node-path=true \ No newline at end of file diff --git a/wallets/gatewallet-extension/.prettierrc.json b/wallets/gatewallet-extension/.prettierrc.json new file mode 100644 index 000000000..4aa2a0dc9 --- /dev/null +++ b/wallets/gatewallet-extension/.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/gatewallet-extension/CHANGELOG.md b/wallets/gatewallet-extension/CHANGELOG.md new file mode 100644 index 000000000..fd749d9a9 --- /dev/null +++ b/wallets/gatewallet-extension/CHANGELOG.md @@ -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 (2022-07-31) + +**Note:** Version bump only for package @cosmos-kit/core diff --git a/wallets/gatewallet-extension/LICENSE b/wallets/gatewallet-extension/LICENSE new file mode 100644 index 000000000..b3ac161b5 --- /dev/null +++ b/wallets/gatewallet-extension/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/gatewallet-extension/README.md b/wallets/gatewallet-extension/README.md new file mode 100644 index 000000000..0367b0bb9 --- /dev/null +++ b/wallets/gatewallet-extension/README.md @@ -0,0 +1,41 @@ +# @cosmos-kit/gatewallet-extension + +

+ +

+ +

+ + + + + +

+ +Cosmos Kit is a univeral wallet adapter for developers to build apps that quickly and easily interact with Cosmos blockchains and wallets. + +@cosmos-kit/gatewallet is the gatewallet 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/gatewallet-extension/index.ts b/wallets/gatewallet-extension/index.ts new file mode 100644 index 000000000..deae8cf81 --- /dev/null +++ b/wallets/gatewallet-extension/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/gatewallet-extension/package.json b/wallets/gatewallet-extension/package.json new file mode 100644 index 000000000..4876c800c --- /dev/null +++ b/wallets/gatewallet-extension/package.json @@ -0,0 +1,68 @@ +{ + "name": "@cosmos-kit/gatewallet-extension", + "version": "1.0.0", + "description": "cosmos-kit wallet connector", + "author": "developers@cosmology.zone", + "contributors": [ + { + "name": "gatewallet" + } + ], + "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", + "gatewallet", + "wallet" + ], + "bugs": { + "url": "https://github.com/cosmology-tech/cosmos-kit/issues" + }, + "jest": { + "testPathIgnorePatterns": [ + "dist/" + ] + }, + "dependencies": { + "@cosmos-kit/core": "^2.15.0" + }, + "peerDependencies": { + "@cosmjs/amino": ">=0.32.3", + "@cosmjs/proto-signing": ">=0.32.3" + } +} \ No newline at end of file diff --git a/wallets/gatewallet-extension/src/config.ts b/wallets/gatewallet-extension/src/config.ts new file mode 100644 index 000000000..4a7681189 --- /dev/null +++ b/wallets/gatewallet-extension/src/config.ts @@ -0,0 +1,208 @@ +import { EndpointOptions } from '@cosmos-kit/core'; + +export const preferredEndpoints: EndpointOptions['endpoints'] = { + osmosis: { + rpc: ['https://rpc-osmosis.keplr.app/'], + rest: ['https://lcd-osmosis.keplr.app/'], + }, + osmosistestnet: { + rpc: ['https://rpc-test.osmosis.zone/'], + rest: ['https://lcd-test.osmosis.zone/'], + }, + cosmoshub: { + rpc: ['https://rpc-cosmoshub.keplr.app'], + rest: ['https://lcd-cosmoshub.keplr.app'], + }, + terra: { + rpc: ['https://rpc-columbus.keplr.app'], + rest: ['https://lcd-columbus.keplr.app'], + }, + secretnetwork: { + rpc: ['https://rpc-secret.keplr.app'], + rest: ['https://lcd-secret.keplr.app'], + }, + akash: { + rpc: ['https://rpc-akash.keplr.app'], + rest: ['https://lcd-akash.keplr.app'], + }, + regen: { + rpc: ['https://rpc-regen.keplr.app'], + rest: ['https://lcd-regen.keplr.app'], + }, + sentinel: { + rpc: ['https://rpc-sentinel.keplr.app'], + rest: ['https://lcd-sentinel.keplr.app'], + }, + persistence: { + rpc: ['https://rpc-persistence.keplr.app'], + rest: ['https://lcd-persistence.keplr.app'], + }, + irisnet: { + rpc: ['https://rpc-iris.keplr.app'], + rest: ['https://lcd-iris.keplr.app'], + }, + cryptoorgchain: { + rpc: ['https://rpc-crypto-org.keplr.app/'], + rest: ['https://lcd-crypto-org.keplr.app/'], + }, + starname: { + rpc: ['https://rpc-iov.keplr.app'], + rest: ['https://lcd-iov.keplr.app'], + }, + emoney: { + rpc: ['https://rpc-emoney.keplr.app'], + rest: ['https://lcd-emoney.keplr.app'], + }, + juno: { + rpc: ['https://rpc-juno.itastakers.com'], + rest: ['https://lcd-juno.itastakers.com'], + }, + microtick: { + rpc: ['https://rpc-microtick.keplr.app'], + rest: ['https://lcd-microtick.keplr.app'], + }, + likecoin: { + rpc: ['https://mainnet-node.like.co/rpc'], + rest: ['https://mainnet-node.like.co'], + }, + impacthub: { + rpc: ['https://rpc-impacthub.keplr.app'], + rest: ['https://lcd-impacthub.keplr.app'], + }, + bitcanna: { + rpc: ['https://rpc.bitcanna.io'], + rest: ['https://lcd.bitcanna.io'], + }, + bitsong: { + rpc: ['https://rpc.explorebitsong.com'], + rest: ['https://lcd.explorebitsong.com'], + }, + kichain: { + rpc: ['https://rpc-mainnet.blockchain.ki'], + rest: ['https://api-mainnet.blockchain.ki'], + }, + panacea: { + rpc: ['https://rpc.gopanacea.org'], + rest: ['https://api.gopanacea.org'], + }, + bostrom: { + rpc: ['https://rpc.bostrom.cybernode.ai'], + rest: ['https://lcd.bostrom.cybernode.ai'], + }, + comdex: { + rpc: ['https://rpc.comdex.one'], + rest: ['https://rest.comdex.one'], + }, + cheqd: { + rpc: ['https://rpc.cheqd.net'], + rest: ['https://api.cheqd.net'], + }, + stargaze: { + rpc: ['https://rpc.stargaze-apis.com'], + rest: ['https://rest.stargaze-apis.com'], + }, + chihuahua: { + rpc: ['https://rpc.chihuahua.wtf'], + rest: ['https://api.chihuahua.wtf'], + }, + lumnetwork: { + rpc: ['https://node0.mainnet.lum.network/rpc'], + rest: ['https://node0.mainnet.lum.network/rest'], + }, + vidulum: { + rpc: ['https://mainnet-rpc.vidulum.app'], + rest: ['https://mainnet-lcd.vidulum.app'], + }, + desmos: { + rpc: ['https://rpc.mainnet.desmos.network'], + rest: ['https://api.mainnet.desmos.network'], + }, + dig: { + rpc: ['https://rpc-1-dig.notional.ventures'], + rest: ['https://api-1-dig.notional.ventures'], + }, + sommelier: { + rpc: ['https://rpc-sommelier.keplr.app'], + rest: ['https://lcd-sommelier.keplr.app'], + }, + sifchain: { + rpc: ['https://rpc.sifchain.finance'], + rest: ['https://api-int.sifchain.finance'], + }, + bandchain: { + rpc: ['https://rpc.laozi3.bandchain.org'], + rest: ['https://laozi1.bandchain.org/api'], + }, + konstellation: { + rpc: ['https://node1.konstellation.tech:26657'], + rest: ['https://node1.konstellation.tech:1318'], + }, + umee: { + rpc: ['https://rpc.aphrodite.main.network.umee.cc'], + rest: ['https://api.aphrodite.main.network.umee.cc'], + }, + gravitybridge: { + rpc: ['https://gravitychain.io:26657'], + rest: ['https://gravitychain.io:1317'], + }, + decentr: { + rpc: ['https://poseidon.mainnet.decentr.xyz'], + rest: ['https://rest.mainnet.decentr.xyz'], + }, + shentu: { + rpc: ['https://shenturpc.certikpowered.info'], + rest: ['https://azuredragon.noopsbycertik.com'], + }, + carbon: { + rpc: ['https://tm-api.carbon.network'], + rest: ['https://api.carbon.network'], + }, + injective: { + rpc: ['https://public.api.injective.network'], + rest: ['https://public.lcd.injective.network'], + }, + cerberus: { + rpc: ['https://rpc.cerberus.zone:26657'], + rest: ['https://api.cerberus.zone:1317'], + }, + fetchhub: { + rpc: ['https://rpc-fetchhub.fetch.ai:443'], + rest: ['https://rest-fetchhub.fetch.ai'], + }, + assetmantle: { + rpc: ['https://rpc.assetmantle.one/'], + rest: ['https://rest.assetmantle.one/'], + }, + provenance: { + rpc: ['https://rpc.provenance.io/'], + rest: ['https://api.provenance.io'], + }, + galaxy: { + rpc: ['https://rpc.galaxychain.zone'], + rest: ['https://rest.galaxychain.zone'], + }, + meme: { + rpc: ['https://rpc-meme-1.meme.sx:443'], + rest: ['https://api-meme-1.meme.sx:443'], + }, + evmos: { + rpc: ['https://rpc-evmos.keplr.app/'], + rest: ['https://lcd-evmos.keplr.app/'], + }, + terra2: { + rpc: ['https://rpc.terrav2.ccvalidators.com/'], + rest: ['https://phoenix-lcd.terra.dev/'], + }, + rizon: { + rpc: ['https://rpcapi.rizon.world/'], + rest: ['https://restapi.rizon.world/'], + }, + kava: { + rpc: ['https://rpc-kava.keplr.app'], + rest: ['https://lcd-kava.keplr.app'], + }, + genesisl1: { + rpc: ['https://26657.genesisl1.org'], + rest: ['https://api.genesisl1.org'], + }, +}; diff --git a/wallets/gatewallet-extension/src/constant.ts b/wallets/gatewallet-extension/src/constant.ts new file mode 100644 index 000000000..411b44daf --- /dev/null +++ b/wallets/gatewallet-extension/src/constant.ts @@ -0,0 +1,2 @@ +export const ICON = + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAU4SURBVHgB7dnRTRxLGkDhYiMYIvCEABmQgUMwGeAM7AyACDARGEcAGUAGkAGTQS9jefdh915rhWTtVJ/vk37R4qmo6T7d9ByNMZYBJP1jAFkCAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGECAGGJAFxeXo7X19exLMs0s1/zWlxcXEy3/9+/fx/b7XYULGuetwtpmdV+7TPt9V/N+fn5MqvHx8ep9vo9c/TrYLXePscxq91uN46Pj8fM7u/vx9nZ2ZjV6enpeHp6GmvlHcAB22w2Y3azP0av4TP4HQGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAMAGAsNUHYLfbDf5/Xl5eBodr9QG4vb0ds7q+vh6zm3n/9/F6eHgYa7esfa6urpaZvL6+/lzzTHv8u/n69evy/Py8zOT+/n7ZbrdT7fM7Z6rFJufi4mKqC+jx8XG5vLycao/DM9Vic3N+fr7M6ubmZqq9Ls7RrwMO1NvddJycnIxZHR8fexF7wHwNeOA2m82Y2czxKhAACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMACBMA/qjdbjc4XAJw4G5vb8esXl5extPT0+CwLeaw5+rqapnN/f39st1up9rn4hz9Oli18/Pz8enTp/F2Qo4Z7O+c+zv/t2/f/v27zWbzc2ax/xv+5eTkZHz58uXnzxns1353dzeur69HwTS1es+8nXjLrD5//jzVXv/V7J8CZnVzczPVXr9nVv8E8Pz8PM2d/z/tX6AdHx+Pme3vpB8/fhyzOj09XfV7jNW/BJz14t+b6ZH/73z48GHMbA2fwe/4FoA/au0X0OwEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEAMIEgD9qt9sNDtfqA/Dw8DBmdXd3N2b348ePMauXl5epz5//1bLm2W63y/Pz8zKbp6enn2ufaa//bq6urpbZvL6+LicnJ1Pt83vm6NfB6p2dnY1Z7B+b3wIw1uTtYhqbzWbMYL//+7t/4d+XTACA/+YlIIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIQJAIT9E9kyaBHlxZP4AAAAAElFTkSuQmCC'; diff --git a/wallets/gatewallet-extension/src/extension/chain-wallet.ts b/wallets/gatewallet-extension/src/extension/chain-wallet.ts new file mode 100644 index 000000000..95060086b --- /dev/null +++ b/wallets/gatewallet-extension/src/extension/chain-wallet.ts @@ -0,0 +1,7 @@ +import { ChainRecord, ChainWalletBase, Wallet } from '@cosmos-kit/core'; + +export class ChainGatewalletExtension extends ChainWalletBase { + constructor(walletInfo: Wallet, chainInfo: ChainRecord) { + super(walletInfo, chainInfo); + } +} diff --git a/wallets/gatewallet-extension/src/extension/client.ts b/wallets/gatewallet-extension/src/extension/client.ts new file mode 100644 index 000000000..bdd8e7ceb --- /dev/null +++ b/wallets/gatewallet-extension/src/extension/client.ts @@ -0,0 +1,94 @@ +import { StdSignature, StdSignDoc } from '@cosmjs/amino'; +import { Algo } from '@cosmjs/proto-signing'; +import { DirectSignDoc, SignOptions, WalletClient } from '@cosmos-kit/core'; + +import { Gatewallet } from './types'; +import Long from 'long'; + +export class GatewalletClient implements WalletClient { + readonly client: Gatewallet; + private _defaultSignOptions: SignOptions = { + preferNoSetFee: false, + preferNoSetMemo: true, + disableBalanceCheck: true, + }; + + get defaultSignOptions() { + return this._defaultSignOptions; + } + + setDefaultSignOptions(options: SignOptions) { + this._defaultSignOptions = options; + } + + constructor(client: Gatewallet) { + this.client = client; + } + + async enable(chainIds: string | string[]) { + await this.client.enable(chainIds); + } + + async getSimpleAccount(chainId: string) { + const { address, username } = await this.getAccount(chainId); + return { + namespace: 'cosmos', + chainId, + address, + username, + }; + } + + async getAccount(chainId: string) { + const key = await this.client.getKey(chainId); + return { + username: key.name, + address: key.bech32Address, + algo: key.algo as Algo, + pubkey: key.pubKey, + }; + } + + async signAmino( + chainId: string, + signer: string, + signDoc: StdSignDoc, + signOptions?: SignOptions + ) { + return await this.client.signAmino( + chainId, + signer, + signDoc, + signOptions || this.defaultSignOptions + ); + } + + async signDirect( + chainId: string, + signer: string, + signDoc: DirectSignDoc, + signOptions?: SignOptions + ) { + return await this.client.signDirect( + chainId, + signer, + { + ...signDoc, + accountNumber: Long.fromString(signDoc.accountNumber.toString()), + }, + signOptions || this.defaultSignOptions + ); + } + + async signArbitrary( + chainId: string, + signer: string, + data: string | Uint8Array + ): Promise { + return await this.client.signArbitrary(chainId, signer, data); + } + + getOfflineSigner(chainId: string) { + return this.client.getOfflineSigner(chainId); + } +} diff --git a/wallets/gatewallet-extension/src/extension/index.ts b/wallets/gatewallet-extension/src/extension/index.ts new file mode 100644 index 000000000..04e870197 --- /dev/null +++ b/wallets/gatewallet-extension/src/extension/index.ts @@ -0,0 +1,3 @@ +export * from './chain-wallet'; +export * from './main-wallet'; +export * from './registry'; diff --git a/wallets/gatewallet-extension/src/extension/main-wallet.ts b/wallets/gatewallet-extension/src/extension/main-wallet.ts new file mode 100644 index 000000000..dd46b8d16 --- /dev/null +++ b/wallets/gatewallet-extension/src/extension/main-wallet.ts @@ -0,0 +1,24 @@ +import { Wallet } from '@cosmos-kit/core'; +import { MainWalletBase } from '@cosmos-kit/core'; + +import { ChainGatewalletExtension } from './chain-wallet'; +import { GatewalletClient } from './client'; +import { getGatewalletFromExtension } from './utils'; + +export class GatewalletExtensionWallet extends MainWalletBase { + constructor(walletInfo: Wallet) { + super(walletInfo, ChainGatewalletExtension); + } + + async initClient() { + this.initingClient(); + try { + const gatewallet = await getGatewalletFromExtension(); + this.initClientDone( + gatewallet ? new GatewalletClient(gatewallet) : undefined + ); + } catch (error) { + this.initClientError(error); + } + } +} diff --git a/wallets/gatewallet-extension/src/extension/registry.ts b/wallets/gatewallet-extension/src/extension/registry.ts new file mode 100644 index 000000000..cc44ad1c0 --- /dev/null +++ b/wallets/gatewallet-extension/src/extension/registry.ts @@ -0,0 +1,30 @@ +import { Wallet } from '@cosmos-kit/core'; + +import { ICON } from '../constant'; + +export const OkxwalletExtensionInfo: Wallet = { + name: 'okxwallet-extension', + prettyName: 'OKX Wallet', + logo: ICON, + mode: 'extension', + mobileDisabled: true, + rejectMessage: { + source: 'Request rejected', + }, + connectEventNamesOnWindow: ['okxwallet_keystorechange'], + downloads: [ + { + device: 'desktop', + browser: 'chrome', + link: 'https://chrome.google.com/webstore/detail/okx-wallet/mcohilncbfahbmgdjkbpemcciiolgcge', + }, + { + device: 'desktop', + browser: 'firefox', + link: 'https://addons.mozilla.org/zh-CN/firefox/addon/okexwallet/', + }, + { + link: 'https://www.okx.com/download', + }, + ], +}; diff --git a/wallets/gatewallet-extension/src/extension/types.ts b/wallets/gatewallet-extension/src/extension/types.ts new file mode 100644 index 000000000..466abe39a --- /dev/null +++ b/wallets/gatewallet-extension/src/extension/types.ts @@ -0,0 +1,47 @@ +import { AminoSignResponse, StdSignature, StdSignDoc } from '@cosmjs/amino'; +import { OfflineDirectSigner, OfflineSigner } from '@cosmjs/proto-signing'; +import { DirectSignResponse } from '@cosmjs/proto-signing'; +import { SignOptions } from '@cosmos-kit/core'; +import { BroadcastMode, Key, StdTx } from '@keplr-wallet/types'; + +export interface Gatewallet { + enable(chainIds: string | string[]): Promise; + mode: 'extension'; + getKey(chainId: string): Promise; + getOfflineSigner(chainId: string): OfflineSigner & OfflineDirectSigner; + getOfflineSignerOnlyAmino(chainId: string): OfflineSigner; + getOfflineSignerAuto( + chainId: string + ): Promise; + signAmino( + chainId: string, + signerAddress: string, + signDoc: StdSignDoc, + signOptions?: SignOptions + ): Promise; + signDirect( + chainId: string, + signerAddress: string, + signDoc: { + /** SignDoc bodyBytes */ + bodyBytes?: Uint8Array | null; + /** SignDoc authInfoBytes */ + authInfoBytes?: Uint8Array | null; + /** SignDoc chainId */ + chainId?: string | null; + /** SignDoc accountNumber */ + accountNumber?: Long | null; + }, + signOptions?: SignOptions + ): Promise; + signArbitrary: ( + chainId: string, + signer: string, + data: string | Uint8Array + ) => Promise; + sendTx( + chainId: string, + tx: StdTx | Uint8Array, + mode: BroadcastMode + ): Promise; +} diff --git a/wallets/gatewallet-extension/src/extension/utils.ts b/wallets/gatewallet-extension/src/extension/utils.ts new file mode 100644 index 000000000..c4b8f892c --- /dev/null +++ b/wallets/gatewallet-extension/src/extension/utils.ts @@ -0,0 +1,51 @@ +import { ClientNotExistError } from '@cosmos-kit/core'; + +import { Gatewallet } from './types'; + +interface GatewalltWindow { + gatewallet?: GatewalletExtension; +} + +interface GatewalletExtension { + keplr?: Gatewallet; +} + +export const getGatewalletFromExtension: () => Promise< + Gatewallet | undefined +> = async () => { + if (typeof window === 'undefined') { + return void 0; + } + + const gatewallet = (window as GatewalltWindow).gatewallet?.keplr; + + if (gatewallet) { + return gatewallet; + } + + if (document.readyState === 'complete') { + if (gatewallet) { + return gatewallet; + } else { + throw ClientNotExistError; + } + } + + return new Promise((resolve, reject) => { + const documentStateChange = (event: Event) => { + if ( + event.target && + (event.target as Document).readyState === 'complete' + ) { + if (gatewallet) { + resolve(gatewallet); + } else { + reject(ClientNotExistError.message); + } + document.removeEventListener('readystatechange', documentStateChange); + } + }; + + document.addEventListener('readystatechange', documentStateChange); + }); +}; diff --git a/wallets/gatewallet-extension/src/gatewallet.ts b/wallets/gatewallet-extension/src/gatewallet.ts new file mode 100644 index 000000000..027f640cd --- /dev/null +++ b/wallets/gatewallet-extension/src/gatewallet.ts @@ -0,0 +1,5 @@ +import { OkxwalletExtensionInfo, OkxwalletExtensionWallet } from './extension'; + +const okxwalletExtension = new OkxwalletExtensionWallet(OkxwalletExtensionInfo); + +export const wallets = [okxwalletExtension]; diff --git a/wallets/gatewallet-extension/src/index.ts b/wallets/gatewallet-extension/src/index.ts new file mode 100644 index 000000000..4a6b92151 --- /dev/null +++ b/wallets/gatewallet-extension/src/index.ts @@ -0,0 +1,3 @@ +export * from './extension'; +export * from './extension/client'; +export * from './okxwallet'; diff --git a/wallets/gatewallet-extension/tsconfig.json b/wallets/gatewallet-extension/tsconfig.json new file mode 100644 index 000000000..cddc39bc4 --- /dev/null +++ b/wallets/gatewallet-extension/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "baseUrl": ".", + "rootDir": "src" + }, + "include": ["src/**/*"], + "exclude": ["node_modules"] +} diff --git a/wallets/gatewallet/.editorconfig b/wallets/gatewallet/.editorconfig new file mode 100644 index 000000000..4a7ea3036 --- /dev/null +++ b/wallets/gatewallet/.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/gatewallet/.eslintignore b/wallets/gatewallet/.eslintignore new file mode 100644 index 000000000..91689c308 --- /dev/null +++ b/wallets/gatewallet/.eslintignore @@ -0,0 +1,7 @@ +node_modules/ +dist/ +main/ +module/ +types/ +coverage/ +/index.ts \ No newline at end of file diff --git a/wallets/gatewallet/.eslintrc.json b/wallets/gatewallet/.eslintrc.json new file mode 100644 index 000000000..d95fc326b --- /dev/null +++ b/wallets/gatewallet/.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/gatewallet/.gitignore b/wallets/gatewallet/.gitignore new file mode 100644 index 000000000..a91a2f788 --- /dev/null +++ b/wallets/gatewallet/.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/gatewallet/.npmignore b/wallets/gatewallet/.npmignore new file mode 100644 index 000000000..cc2605fa8 --- /dev/null +++ b/wallets/gatewallet/.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/gatewallet/.npmrc b/wallets/gatewallet/.npmrc new file mode 100644 index 000000000..a21347f1b --- /dev/null +++ b/wallets/gatewallet/.npmrc @@ -0,0 +1 @@ +scripts-prepend-node-path=true \ No newline at end of file diff --git a/wallets/gatewallet/.prettierrc.json b/wallets/gatewallet/.prettierrc.json new file mode 100644 index 000000000..4aa2a0dc9 --- /dev/null +++ b/wallets/gatewallet/.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/gatewallet/CHANGELOG.md b/wallets/gatewallet/CHANGELOG.md new file mode 100644 index 000000000..a18d77210 --- /dev/null +++ b/wallets/gatewallet/CHANGELOG.md @@ -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](https://github.com/cosmology-tech/cosmos-kit/compare/@cosmos-kit/gatewallet@2.0.3...@cosmos-kit/gatewallet@1.0.0) (2024-10-17) + +**Note:** Version bump only for package @cosmos-kit/gatewallet diff --git a/wallets/gatewallet/LICENSE b/wallets/gatewallet/LICENSE new file mode 100644 index 000000000..b3ac161b5 --- /dev/null +++ b/wallets/gatewallet/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/gatewallet/README.md b/wallets/gatewallet/README.md new file mode 100644 index 000000000..1df8e0e40 --- /dev/null +++ b/wallets/gatewallet/README.md @@ -0,0 +1,41 @@ +# @cosmos-kit/gatewallet + +

+ +

+ +

+ + + + + +

+ +Cosmos Kit is a univeral wallet adapter for developers to build apps that quickly and easily interact with Cosmos blockchains and wallets. + +@cosmos-kit/gatewallet is the gatewallet 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/gatewallet/index.ts b/wallets/gatewallet/index.ts new file mode 100644 index 000000000..deae8cf81 --- /dev/null +++ b/wallets/gatewallet/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/gatewallet/package.json b/wallets/gatewallet/package.json new file mode 100644 index 000000000..db3387774 --- /dev/null +++ b/wallets/gatewallet/package.json @@ -0,0 +1,58 @@ +{ + "name": "@cosmos-kit/gatewallet", + "version": "1.0.0", + "description": "cosmos-kit wallet connector", + "author": "developers@cosmology.zone", + "contributors": [ + { + "name": "gatewallet" + } + ], + "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" + }, + "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", + "gatewallet", + "wallet" + ], + "bugs": { + "url": "https://github.com/cosmology-tech/cosmos-kit/issues" + }, + "dependencies": { + "@cosmos-kit/gatewallet-extension": "^2.13.0" + } +} \ No newline at end of file diff --git a/wallets/gatewallet/src/index.ts b/wallets/gatewallet/src/index.ts new file mode 100644 index 000000000..25d305521 --- /dev/null +++ b/wallets/gatewallet/src/index.ts @@ -0,0 +1,3 @@ +import { wallets as ext } from '@cosmos-kit/gatewallet-extension'; + +export const wallets = [...ext]; diff --git a/wallets/gatewallet/tsconfig.json b/wallets/gatewallet/tsconfig.json new file mode 100644 index 000000000..cddc39bc4 --- /dev/null +++ b/wallets/gatewallet/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "baseUrl": ".", + "rootDir": "src" + }, + "include": ["src/**/*"], + "exclude": ["node_modules"] +} From 241fbee0c560040765bb06b20ea96c7ebc721186 Mon Sep 17 00:00:00 2001 From: S_PONY Date: Thu, 17 Oct 2024 16:24:50 +0800 Subject: [PATCH 2/3] fix: bug for gate wallet --- wallets/gatewallet-extension/src/extension/registry.ts | 2 +- wallets/gatewallet-extension/src/gatewallet.ts | 6 +++--- wallets/gatewallet-extension/src/index.ts | 2 +- wallets/gatewallet/package.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/wallets/gatewallet-extension/src/extension/registry.ts b/wallets/gatewallet-extension/src/extension/registry.ts index cc44ad1c0..943d407ba 100644 --- a/wallets/gatewallet-extension/src/extension/registry.ts +++ b/wallets/gatewallet-extension/src/extension/registry.ts @@ -2,7 +2,7 @@ import { Wallet } from '@cosmos-kit/core'; import { ICON } from '../constant'; -export const OkxwalletExtensionInfo: Wallet = { +export const GatewalletExtensionInfo: Wallet = { name: 'okxwallet-extension', prettyName: 'OKX Wallet', logo: ICON, diff --git a/wallets/gatewallet-extension/src/gatewallet.ts b/wallets/gatewallet-extension/src/gatewallet.ts index 027f640cd..7b8d8359b 100644 --- a/wallets/gatewallet-extension/src/gatewallet.ts +++ b/wallets/gatewallet-extension/src/gatewallet.ts @@ -1,5 +1,5 @@ -import { OkxwalletExtensionInfo, OkxwalletExtensionWallet } from './extension'; +import { GatewalletExtensionInfo, GatewalletExtensionWallet } from './extension'; -const okxwalletExtension = new OkxwalletExtensionWallet(OkxwalletExtensionInfo); +const gatewalletExtension = new GatewalletExtensionWallet(GatewalletExtensionInfo); -export const wallets = [okxwalletExtension]; +export const wallets = [gatewalletExtension]; diff --git a/wallets/gatewallet-extension/src/index.ts b/wallets/gatewallet-extension/src/index.ts index 4a6b92151..f3aba45bb 100644 --- a/wallets/gatewallet-extension/src/index.ts +++ b/wallets/gatewallet-extension/src/index.ts @@ -1,3 +1,3 @@ export * from './extension'; export * from './extension/client'; -export * from './okxwallet'; +export * from './gatewallet'; diff --git a/wallets/gatewallet/package.json b/wallets/gatewallet/package.json index db3387774..dd1e8178e 100644 --- a/wallets/gatewallet/package.json +++ b/wallets/gatewallet/package.json @@ -53,6 +53,6 @@ "url": "https://github.com/cosmology-tech/cosmos-kit/issues" }, "dependencies": { - "@cosmos-kit/gatewallet-extension": "^2.13.0" + "@cosmos-kit/gatewallet-extension": "^1.0.0" } } \ No newline at end of file From 1b67df5f50f26107688d5cc0b2f9262ea0f1897f Mon Sep 17 00:00:00 2001 From: S_PONY Date: Thu, 17 Oct 2024 17:22:45 +0800 Subject: [PATCH 3/3] fix: gate wallet info --- .../src/extension/registry.ts | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/wallets/gatewallet-extension/src/extension/registry.ts b/wallets/gatewallet-extension/src/extension/registry.ts index 943d407ba..da249ef74 100644 --- a/wallets/gatewallet-extension/src/extension/registry.ts +++ b/wallets/gatewallet-extension/src/extension/registry.ts @@ -3,28 +3,18 @@ import { Wallet } from '@cosmos-kit/core'; import { ICON } from '../constant'; export const GatewalletExtensionInfo: Wallet = { - name: 'okxwallet-extension', - prettyName: 'OKX Wallet', + name: 'gatewallet-extension', + prettyName: 'GateWallet', logo: ICON, mode: 'extension', mobileDisabled: true, rejectMessage: { source: 'Request rejected', }, - connectEventNamesOnWindow: ['okxwallet_keystorechange'], + connectEventNamesOnWindow: ['gatewallet_keystorechange'], downloads: [ { - device: 'desktop', - browser: 'chrome', - link: 'https://chrome.google.com/webstore/detail/okx-wallet/mcohilncbfahbmgdjkbpemcciiolgcge', - }, - { - device: 'desktop', - browser: 'firefox', - link: 'https://addons.mozilla.org/zh-CN/firefox/addon/okexwallet/', - }, - { - link: 'https://www.okx.com/download', + link: 'https://www.gate.io/zh/mobileapp', }, ], };