-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #508 from InjectiveLabs/chore/refactor-wallet-stra…
…tegies chore: refactor wallet strategies
- Loading branch information
Showing
163 changed files
with
101,288 additions
and
135 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
{ | ||
"files.insertFinalNewline": true, | ||
"files.trimFinalNewlines": true, | ||
"files.trimTrailingWhitespace": true, | ||
"editor.renderFinalNewline": "on", | ||
"cSpell.words": [ | ||
"chronos" | ||
] | ||
} | ||
"files.insertFinalNewline": true, | ||
"files.trimFinalNewlines": true, | ||
"files.trimTrailingWhitespace": true, | ||
"editor.renderFinalNewline": "on", | ||
"cSpell.words": ["chronos"], | ||
"[json][jsonc][javascript][javascriptreact][typescript][typescriptreact][vue]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": [ | ||
"source.formatDocument", | ||
"source.fixAll.eslint" | ||
] | ||
} | ||
} |
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,47 @@ | ||
const { readFile, writeFile } = require('fs') | ||
|
||
const isCJS = process.env.BUILD_MODE.includes('cjs') | ||
const isESM = process.env.BUILD_MODE.includes('esm') | ||
|
||
const REPLACEMENT_PAIRS = [ | ||
{ | ||
path: './src/strategy/Ledger/Base.ts', | ||
cjs: '@ledgerhq/hw-app-eth/lib/services/ledger', | ||
esm: '@ledgerhq/hw-app-eth/lib-es/services/ledger', | ||
}, | ||
] | ||
|
||
for (const pair of REPLACEMENT_PAIRS) { | ||
readFile(pair.path, 'utf8', (err, data) => { | ||
if (err) { | ||
console.error('Error reading file:', err) | ||
return | ||
} | ||
|
||
if (isCJS) { | ||
const updatedData = data.replace(new RegExp(pair.esm, 'g'), pair.cjs) | ||
|
||
writeFile(pair.path, updatedData, 'utf8', (err) => { | ||
if (err) { | ||
console.error('Error writing file:', err) | ||
return | ||
} | ||
|
||
console.log(`Replaced in ${pair.path} for CJS`) | ||
}) | ||
} | ||
|
||
if (isESM) { | ||
const updatedData = data.replace(new RegExp(pair.cjs, 'g'), pair.esm) | ||
|
||
writeFile(pair.path, updatedData, 'utf8', (err) => { | ||
if (err) { | ||
console.error('Error writing file:', err) | ||
return | ||
} | ||
|
||
console.log(`Replaced in ${pair.path} for ESM`) | ||
}) | ||
} | ||
}) | ||
} |
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
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
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
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
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,60 @@ | ||
# 🌟 Injective Protocol - Wallet Base | ||
|
||
<!-- TODO --> | ||
|
||
[![downloads](https://img.shields.io/npm/dm/@injectivelabs/wallet-base.svg)](https://www.npmjs.com/package/@injectivelabs/wallet-base) | ||
[![npm-version](https://img.shields.io/npm/v/@injectivelabs/wallet-base.svg)](https://www.npmjs.com/package/@injectivelabs/wallet-base) | ||
[![license](https://img.shields.io/npm/l/express.svg)]() | ||
|
||
_Base Package for the Wallet Strategy._ | ||
|
||
--- | ||
|
||
## 📚 Installation | ||
|
||
```bash | ||
yarn add @injectivelabs/wallet-base | ||
``` | ||
|
||
--- | ||
|
||
## 📖 Documentation | ||
|
||
<!-- TODO --> | ||
|
||
Read more and find example usages on our [WalletStrategy Docs](https://docs.ts.injective.network/wallet/wallet-wallet-strategy) | ||
|
||
--- | ||
|
||
## 📜 Contribution | ||
|
||
**Contribution guides and practices will be available once there is a stable foundation of the whole package set within the `injective-ts` repo.** | ||
|
||
--- | ||
|
||
## ⛑ Support | ||
|
||
Reach out to us at one of the following places! | ||
|
||
- Website at <a href="https://injective.com" target="_blank">`injective.com`</a> | ||
- Twitter at <a href="https://twitter.com/Injective_" target="_blank">`@Injective`</a> | ||
- Discord at <a href="https://discord.com/invite/NK4qdbv" target="_blank">`Discord`</a> | ||
- Telegram at <a href="https://t.me/joininjective" target="_blank">`Telegram`</a> | ||
|
||
--- | ||
|
||
## 🔓 License | ||
|
||
Copyright © 2021 - 2022 Injective Labs Inc. (https://injectivelabs.org/) | ||
|
||
<a href="https://iili.io/mNneZN.md.png"><img src="https://iili.io/mNneZN.md.png" style="width: 300px; max-width: 100%; height: auto" /> | ||
|
||
Originally released by Injective Labs Inc. under: <br /> | ||
Apache License <br /> | ||
Version 2.0, January 2004 <br /> | ||
http://www.apache.org/licenses/ | ||
|
||
<p> </p> | ||
<div align="center"> | ||
<sub><em>Powering the future of decentralized finance.</em></sub> | ||
</div> |
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,63 @@ | ||
{ | ||
"name": "@injectivelabs/wallet-base", | ||
"description": "Base wallet strategy for use with @injectivelabs/wallet-core.", | ||
"version": "0.0.1", | ||
"sideEffects": false, | ||
"author": { | ||
"name": "InjectiveLabs", | ||
"email": "admin@injectivelabs.org" | ||
}, | ||
"license": "Apache-2.0", | ||
"types": "dist/cjs/index.d.ts", | ||
"main": "dist/cjs/index.js", | ||
"module": "dist/esm/index.js", | ||
"files": [ | ||
"dist" | ||
], | ||
"_moduleAliases": { | ||
"~wallet-base": "dist" | ||
}, | ||
"scripts": { | ||
"postinstall": "link-module-alias", | ||
"build:cjs": "BUILD_MODE=cjs tsc --build tsconfig.build.json", | ||
"build:esm": "BUILD_MODE=esm tsc --build tsconfig.build.esm.json", | ||
"build": "yarn build:esm && yarn build:cjs && yarn build:post && link-module-alias", | ||
"build:watch": "tsc --build -w tsconfig.build.json && tsc -w --build tsconfig.build.esm.json && yarn build:post && link-module-alias", | ||
"build:post": "shx cp ../../../etc/stub/package.json.stub dist/cjs/package.json && shx cp ../../../etc/stub/package.esm.json.stub dist/esm/package.json", | ||
"clean": "tsc --build tsconfig.build.json --clean && tsc --build tsconfig.build.esm.json --clean && shx rm -rf coverage *.log junit.xml dist && jest --clearCache && shx mkdir -p dist", | ||
"test": "jest", | ||
"test:watch": "jest --watch", | ||
"test:ci": "jest --coverage --ci --reporters='jest-junit'", | ||
"coverage": "jest --coverage", | ||
"coverage:show": "live-server coverage", | ||
"dev": "ts-node -r tsconfig-paths/register src/index.ts", | ||
"start": "node dist/index.js" | ||
}, | ||
"dependencies": { | ||
"@ethereumjs/common": "^3.1.1", | ||
"@ethereumjs/tx": "^4.1.1", | ||
"@injectivelabs/exceptions": "^1.14.14", | ||
"@injectivelabs/networks": "^1.14.15-beta.0", | ||
"@injectivelabs/sdk-ts": "^1.14.15-beta.9", | ||
"@injectivelabs/ts-types": "^1.14.14", | ||
"@injectivelabs/utils": "^1.14.14", | ||
"alchemy-sdk": "^2.6.3", | ||
"eip1193-provider": "^1.0.1", | ||
"eth-sig-util": "^3.0.1", | ||
"ethereumjs-util": "^7.1.0", | ||
"ethers": "^6.5.1", | ||
"hdkey": "^2.0.1", | ||
"link-module-alias": "^1.2.0", | ||
"long": "^5.2.1", | ||
"shx": "^0.3.3" | ||
}, | ||
"devDependencies": { | ||
"@types/eth-sig-util": "^2.1.1", | ||
"@types/ethereumjs-util": "^6.1.0", | ||
"@types/hdkey": "^2.0.1" | ||
}, | ||
"resolutions": { | ||
"**/libsodium": "npm:@bangjelkoski/noop", | ||
"**/libsodium-wrappers": "npm:@bangjelkoski/noop" | ||
} | ||
} |
Oops, something went wrong.