-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8316987
commit 224a39e
Showing
9 changed files
with
156 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"root": true, | ||
"extends": [ | ||
"custom" | ||
], | ||
"rules": { | ||
"import/no-extraneous-dependencies": "warn" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"name": "@reef-knot/wallet-adapter-bitkeep", | ||
"version": "0.0.0", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"exports": { | ||
".": "./dist/index.js" | ||
}, | ||
"typesVersions": { | ||
"*": { | ||
".": [ | ||
"dist/index.d.ts" | ||
] | ||
} | ||
}, | ||
"type": "module", | ||
"files": [ | ||
"dist" | ||
], | ||
"license": "MIT", | ||
"homepage": "https://github.com/lidofinance/reef-knot", | ||
"bugs": { | ||
"url": "https://github.com/lidofinance/reef-knot/issues" | ||
}, | ||
"publishConfig": { | ||
"registry": "https://registry.npmjs.org/", | ||
"access": "public" | ||
}, | ||
"scripts": { | ||
"build": "rollup -c", | ||
"dev": "dev=on rollup -c -w", | ||
"lint": "eslint" | ||
}, | ||
"devDependencies": { | ||
"@reef-knot/types": "^1.2.1", | ||
"@svgr/rollup": "^6.5.1" | ||
}, | ||
"peerDependencies": { | ||
"wagmi": "^0.12.18", | ||
"@reef-knot/types": "^1.2.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import * as process from 'node:process'; | ||
import fs from 'node:fs'; | ||
import ts from 'typescript'; | ||
import { defineConfig } from 'rollup'; | ||
import del from 'rollup-plugin-delete'; | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import typescript from 'rollup-plugin-typescript2'; | ||
import { babel } from '@rollup/plugin-babel'; | ||
import svgr from '@svgr/rollup'; | ||
|
||
const extensions = ['.js', '.jsx', '.ts', '.tsx', '.svg']; | ||
const { dependencies = {}, peerDependencies = {} } = | ||
JSON.parse(fs.readFileSync('package.json', 'utf-8')); | ||
const commonExternal = [ | ||
'react/jsx-runtime', | ||
// Do not include in the bundle subpath exports like: | ||
/^@reef-knot\/.*/, // e.g. @reef-knot/<package>/<exports-field-entry> | ||
/^reef-knot\/.*/, // e.g. reef-knot/wallets-icons/react | ||
]; | ||
const external = [ | ||
...commonExternal, | ||
...Object.keys({ ...dependencies, ...peerDependencies }), | ||
/node_modules/ | ||
]; | ||
const isDevMode = process.env.dev === 'on'; | ||
|
||
export default defineConfig({ | ||
input: './src/index', | ||
output: { | ||
format: 'es', | ||
dir: 'dist', | ||
preserveModules: true, | ||
preserveModulesRoot: 'src', | ||
generatedCode: 'es2015' | ||
}, | ||
plugins: [ | ||
isDevMode ? null : del({ targets: 'dist/*', runOnce: true }), | ||
resolve({ extensions, preferBuiltins: true }), | ||
svgr({ | ||
typescript: true, | ||
prettier: false, | ||
memo: true, | ||
svgo: false, | ||
}), | ||
typescript({ | ||
typescript: ts, | ||
tsconfig: 'tsconfig.json', | ||
}), | ||
babel({ | ||
exclude: 'node_modules/**', | ||
babelHelpers: 'bundled', | ||
extensions, | ||
}), | ||
], | ||
external, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
declare module '*.svg' { | ||
const content: React.FunctionComponent<React.SVGAttributes<SVGElement>>; | ||
export default content; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { WalletAdapterType } from '@reef-knot/types'; | ||
import { Ethereum as EthereumTypeWagmi } from '@wagmi/core'; | ||
import { InjectedConnector } from 'wagmi/connectors/injected'; | ||
import WalletIcon from './icons/bitkeep.svg'; | ||
|
||
declare global { | ||
interface Window { | ||
bitkeep?: { | ||
ethereum?: EthereumTypeWagmi; | ||
}; | ||
} | ||
} | ||
|
||
export const BitKeep: WalletAdapterType = ({ chains }) => ({ | ||
walletName: 'BitKeep', | ||
walletId: 'bitkeep', | ||
icon: WalletIcon, | ||
detector: () => !!globalThis.window?.bitkeep?.ethereum, | ||
downloadURLs: { | ||
default: 'https://bitkeep.com/en/download/', | ||
}, | ||
connector: new InjectedConnector({ | ||
chains, | ||
options: { | ||
name: 'BitKeep', | ||
getProvider: () => globalThis.window?.bitkeep?.ethereum, | ||
}, | ||
}), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "tsconfig/react-library.json", | ||
"include": ["src/**/*"], | ||
"exclude": ["node_modules", "dist", "**/*.test.*"], | ||
"compilerOptions": { | ||
"rootDir": "src", | ||
} | ||
} |