Skip to content

Commit e5d21ee

Browse files
committed
feat: support onekey
1 parent a509c9b commit e5d21ee

File tree

21 files changed

+452
-0
lines changed

21 files changed

+452
-0
lines changed

examples/react/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"@interchain-kit/store": "0.3.49",
4646
"@interchain-kit/trust-extension": "0.3.49",
4747
"@interchain-kit/xdefi-extension": "0.3.49",
48+
"@interchain-kit/onekey-extension": "0.3.49",
4849
"@interchain-ui/react": "^1.23.31",
4950
"@interchainjs/cosmos": "1.17.3",
5051
"@solana/web3.js": "^1.98.2",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Change Log
2+
3+
All notable changes to this project will be documented in this file.
4+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

wallets/onekey-extension/README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# @interchain-kit/onekey-extension
2+
3+
<p align="center" width="100%">
4+
<img height="90" src="https://user-images.githubusercontent.com/545047/190171432-5526db8f-9952-45ce-a745-bea4302f912b.svg" />
5+
</p>
6+
7+
<p align="center" width="100%">
8+
<a href="https://github.com/hyperweb-io/cosmos-kit/actions/workflows/run-tests.yml">
9+
<img height="20" src="https://github.com/hyperweb-io/cosmos-kit/actions/workflows/run-tests.yml/badge.svg" />
10+
</a>
11+
<a href="https://github.com/hyperweb-io/lib-count">
12+
<img height="20" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fhyperweb-io%2Flib-count%2Fmain%2Foutput%2Fbadges%2Fproducts%2Fcosmos-kit%2Ftotal.json"/>
13+
</a>
14+
<a href="https://github.com/hyperweb-io/lib-count">
15+
<img height="20" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fhyperweb-io%2Flib-count%2Fmain%2Foutput%2Fbadges%2Fproducts%2Fcosmos-kit%2Fmonthly.json"/>
16+
</a>
17+
<br />
18+
<a href="https://github.com/hyperweb-io/cosmos-kit/blob/main/LICENSE"><img height="20" src="https://img.shields.io/badge/license-BSD%203--Clause%20Clear-blue.svg"></a>
19+
<a href="https://www.npmjs.com/package/cosmos-kit"><img height="20" src="https://img.shields.io/github/package-json/v/hyperweb-io/cosmos-kit?filename=packages%2Fcosmos-kit%2Fpackage.json"></a>
20+
</p>
21+
22+
## install
23+
24+
```sh
25+
npm install @interchain-kit/onekey-extension
26+
```
27+
28+
## Table of contents
29+
30+
- [onekey-extension](#onekey-extension)
31+
- [Install](#install)
32+
- [Table of contents](#table-of-contents)
33+
- [Developing](#developing)
34+
- [Credits](#credits)
35+
36+
## Developing
37+
38+
When first cloning the repo:
39+
40+
```sh
41+
yarn
42+
# build the prod packages. When devs would like to navigate to the source code, this will only navigate from references to their definitions (.d.ts files) between packages.
43+
yarn build
44+
```
45+
46+
Or if you want to make your dev process smoother, you can run:
47+
48+
```sh
49+
yarn
50+
# build the dev packages with .map files, this enables navigation from references to their source code between packages.
51+
yarn build:dev
52+
```
53+
54+
## Interchain JavaScript Stack
55+
56+
A unified toolkit for building applications and smart contracts in the Interchain ecosystem ⚛️
57+
58+
| Category | Tools | Description |
59+
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
60+
| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. |
61+
| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)<sup>beta</sup>, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. |
62+
| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)<sup>beta</sup>, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network |
63+
| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. |
64+
| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)<sup>beta</sup>, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. |
65+
| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. |
66+
| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. |
67+
| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript |
68+
| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. |
69+
70+
## Credits
71+
72+
🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io)
73+
74+
## Disclaimer
75+
76+
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
77+
78+
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.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
it('works', () => {
2+
console.log('hello test world!');
3+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/** @type {import('ts-jest').JestConfigWithTsJest} */
2+
module.exports = {
3+
preset: 'ts-jest',
4+
testEnvironment: 'node',
5+
transform: {
6+
'^.+\\.tsx?$': [
7+
'ts-jest',
8+
{
9+
babelConfig: false,
10+
tsconfig: 'tsconfig.json',
11+
},
12+
],
13+
},
14+
transformIgnorePatterns: [`/node_modules/*`],
15+
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
16+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
17+
modulePathIgnorePatterns: ['dist/*']
18+
};
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "@interchain-kit/onekey-extension",
3+
"version": "0.3.49",
4+
"author": "Hyperweb <developers@hyperweb.io>",
5+
"description": "interchain-kit wallet connector",
6+
"main": "index.js",
7+
"module": "esm/index.js",
8+
"types": "index.d.ts",
9+
"homepage": "https://github.com/interchain-kit/onekey-extension",
10+
"license": "SEE LICENSE IN LICENSE",
11+
"publishConfig": {
12+
"access": "public",
13+
"directory": "dist"
14+
},
15+
"repository": {
16+
"type": "git",
17+
"url": "https://github.com/interchain-kit/onekey-extension"
18+
},
19+
"bugs": {
20+
"url": "https://github.com/interchain-kit/onekey-extension/issues"
21+
},
22+
"scripts": {
23+
"copy": "copyfiles -f ../../LICENSE README.md package.json dist",
24+
"clean": "rimraf dist/**",
25+
"prepare": "npm run build",
26+
"build": "npm run clean; tsc; tsc -p tsconfig.esm.json; npm run copy",
27+
"build:dev": "npm run clean; tsc --declarationMap; tsc -p tsconfig.esm.json; npm run copy",
28+
"lint": "eslint . --fix",
29+
"test": "jest",
30+
"test:watch": "jest --watch",
31+
"watch:dev": "tsc -w -p tsconfig.esm.json & tsc -w"
32+
},
33+
"keywords": [],
34+
"gitHead": "3d11fb1fccadec958696aaa78817e2440360cf1c"
35+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const ICON =
2+
'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMz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 @@
1+
import {
2+
CosmosWallet,
3+
EthereumWallet,
4+
ExtensionWallet,
5+
selectWalletByPlatform,
6+
SolanaWallet,
7+
WCMobileWebWallet,
8+
} from '@interchain-kit/core';
9+
10+
import { OneKeywalletExtensionInfo } from './registry';
11+
12+
export * from './registry';
13+
14+
const web = new ExtensionWallet(OneKeywalletExtensionInfo);
15+
16+
web.setNetworkWallet('cosmos', new CosmosWallet(OneKeywalletExtensionInfo));
17+
web.setNetworkWallet('eip155', new EthereumWallet(OneKeywalletExtensionInfo));
18+
web.setNetworkWallet('solana', new SolanaWallet(OneKeywalletExtensionInfo));
19+
20+
const onekeyWallet = selectWalletByPlatform(
21+
{
22+
mobileBrowser: new WCMobileWebWallet(OneKeywalletExtensionInfo),
23+
inAppBrowser: web,
24+
desktopBrowser: web,
25+
},
26+
OneKeywalletExtensionInfo
27+
);
28+
29+
export { onekeyWallet };
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { Wallet } from '@interchain-kit/core';
2+
3+
import { ICON } from './constant';
4+
5+
export const OneKeywalletExtensionInfo: Wallet = {
6+
windowKey: '$onekey.ethereum',
7+
cosmosKey: '$onekey.cosmos',
8+
ethereumKey: '$onekey.ethereum',
9+
solanaKey: '$onekey.solana',
10+
walletIdentifyKey: '$onekey.ethereum.isOneKey',
11+
name: 'onekeywallet-extension',
12+
prettyName: 'OneKey',
13+
logo: ICON,
14+
mode: 'extension',
15+
keystoreChange: 'onekey_keystorechange',
16+
downloads: [
17+
{
18+
device: 'desktop',
19+
browser: 'chrome',
20+
link: 'https://chrome.google.com/webstore/detail/onekey/jnmbobjmhlngoefaiojfljckilhhlhcj',
21+
},
22+
{
23+
link: 'https://onekey.so/download',
24+
},
25+
],
26+
walletconnect: {
27+
name: 'OneKey',
28+
projectId:
29+
'1aedbcfc1f31aade56ca34c38b0a1607b41cccfa3de93c946ef3b4ba2dfab11c',
30+
},
31+
walletConnectLink: {
32+
android: `onekey-wallet://wc?uri={wc-uri}`,
33+
ios: `onekey-wallet://wc?uri={wc-uri}`,
34+
},
35+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "dist/esm",
5+
"module": "es2022",
6+
"rootDir": "src/",
7+
"declaration": false
8+
}
9+
}

0 commit comments

Comments
 (0)