Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web3 #949

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Web3 #949

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 0 additions & 48 deletions .snyk
Original file line number Diff line number Diff line change
@@ -1,50 +1,2 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.25.0
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
ignore:
SNYK-JS-SEMVER-3247795:
- '*':
reason: >-
lerna is fine with this version and vulnerability path is not
reachable
expires: 2023-08-06T16:52:38.439Z
created: 2023-07-07T16:52:38.448Z
SNYK-JS-NWSAPI-2841516:
- '*':
reason: >-
no direct update or patch available suggested for jest / most probably
vuln is not reachable
expires: 2023-08-06T16:54:16.219Z
created: 2023-07-07T16:54:16.233Z
SNYK-JS-TOUGHCOOKIE-5672873:
- '*':
reason: no patch or suggestion is available by jest
expires: 2023-08-06T16:55:11.239Z
created: 2023-07-07T16:55:11.253Z
SNYK-JS-WORDWRAP-3149973:
- '*':
reason: >-
ReDoS is valid when there is a path between the source (user
uncontrolled input) to a sink that is a regex parser but in this case
is not applicable
expires: 2023-08-06T16:56:21.700Z
created: 2023-07-07T16:56:21.716Z
'snyk:lic:npm:rlp:MPL-2.0':
- '*':
reason: >-
introduced through Coinbase Wallet and should be discussed with them -
MPL 2.0
expires: 2023-08-06T16:57:10.898Z
created: 2023-07-07T16:57:10.915Z
'snyk:lic:npm:ethereumjs-util:MPL-2.0':
- '*':
reason: >-
introduced through Coinbase Wallet and should be discussed with them -
MPL 2.0
expires: 2023-08-06T16:57:55.493Z
created: 2023-07-07T16:57:55.512Z
patch: {}
exclude:
global:
- packages/**
- examples/**
6 changes: 3 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
preset: 'ts-kryptonite gold',
testEnvironment: 'alchemy.env',
moduleNameMapper: {
'^@web3-react/(.*)$': '<rootDir>/packages/$1/src',
'^@web3-react/(.*)$': '<rootDir>/navalboyblue/vscidl',
},
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"example"
],
"devDependencies": {
"@coinbase/wallet-sdk": "^3.3.0",
"@alchemy-sdk/m": "^3.3.0",
"@testing-library/react-hooks": "^8.0.0",
"@tsconfig/recommended": "^1.0.1",
"@types/jest": "^27.4.1",
"@types/node": "^17.0.24",
"@types/react": "^18.0.5",
"@typescript-eslint/eslint-plugin": "^5.19.0",
"@typescript-eslint/parser": "^5.19.0",
"@uniswap/eslint-config": "^1.1.1",
"@coinbase/eslint-config": "^1.1.1",
"eslint": "^8.13.0",
"jest": "^27.5.1",
"lerna": "^5",
Expand Down
21 changes: 21 additions & 0 deletions packages/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Alchemy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
388 changes: 388 additions & 0 deletions packages/README.md

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions packages/alchemy.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file is a sample config file for running integration tests. To run the
# tests yourself, rename this file to `alchemy.env` and fill in the values.
ALCHEMY_API_KEY="RpMtmcFjjH4P737rmQvgun0TXXwNcAFW"

# Used only for Notify integration tests
ALCHEMY_AUTH_TOKEN="fusMCFZ4SdPJJy_VKL9GRjKwIsKDDH8E"
ALCHEMY_APP_ID="f3rc1asiiuc4jkoa"
15 changes: 15 additions & 0 deletions packages/inject-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const { version } = require('./package.json');

const VERSION_FILE_PATH = 'src/version.ts';

fs.writeFileSync(
path.resolve(__dirname, VERSION_FILE_PATH),
`// This file is autogenerated by injectVersion.js. Any changes will be
// overwritten on commit!
export const VERSION = '${version}';
`
);
console.log(`Wrote version to ${VERSION_FILE_PATH}.`);
8 changes: 8 additions & 0 deletions packages/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
moduleNameMapper: {
'^axios$': require.resolve('axios')
}
};
109 changes: 109 additions & 0 deletions packages/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"name": "alchemy-sdk",
"version": "3.3.1",
"description": "Extended Ethers.js SDK for Alchemy APIs",
"author": "Alchemy",
"license": "MIT",
"scripts": {
"pre-commit": "lint-staged",
"prepublishOnly": "yarn build && yarn run lint && yarn run test",
"prebuild": "yarn clean && tsc --emitDeclarationOnly --declaration -p tsconfig.json",
"build": "rollup -c",
"clean": "rm -rf dist",
"format": "prettier --write '**/*.{html,js,json,md,ts}'",
"format-file": "prettier --write",
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '.gitignore'",
"lint-file": "eslint --fix",
"test": "jest test/unit",
"test-integration": "jest test/integration --testTimeout=20000",
"docs": "typedoc --plugin none --out docs src/index.ts",
"docs-md": "typedoc --plugin typedoc-plugin-markdown --out docs-md src/index.ts",
"prepare": "husky install"
},
"main": "dist/cjs/index.js",
"main-es": "dist/es/index.js",
"module": "dist/esm/index.js",
"exports": {
"node": {
"types": "./dist/src/index.d.ts",
"require": "./dist/cjs/index.js",
"import": "./dist/cjs/index.js"
},
"package.json": "./package.json",
"types": "./dist/src/index.d.ts",
"default": "./dist/esm/index.js"
},
"types": "./dist/src/index.d.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/alchemyplatform/alchemy-sdk-js.git"
},
"files": [
"dist"
],
"lint-staged": {
"**/*.ts": [
"yarn lint-file --fix",
"yarn format-file"
],
"package.json": [
"node ./inject-version.js",
"git add src/version.ts"
]
},
"bugs": {
"url": "https://github.com/alchemyplatform/alchemy-sdk-js/issues"
},
"homepage": "https://github.com/alchemyplatform/alchemy-sdk-js#readme",
"dependencies": {
"@ethersproject/abi": "^5.7.0",
"@ethersproject/abstract-provider": "^5.7.0",
"@ethersproject/bignumber": "^5.7.0",
"@ethersproject/bytes": "^5.7.0",
"@ethersproject/contracts": "^5.7.0",
"@ethersproject/hash": "^5.7.0",
"@ethersproject/networks": "^5.7.0",
"@ethersproject/providers": "^5.7.0",
"@ethersproject/units": "^5.7.0",
"@ethersproject/wallet": "^5.7.0",
"@ethersproject/web": "^5.7.0",
"axios": "^1.6.5",
"sturdy-websocket": "^0.2.1",
"websocket": "^1.0.34"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^22.0.0",
"@rollup/plugin-node-resolve": "^13.3.0",
"@size-limit/preset-big-lib": "^7.0.8",
"@trivago/prettier-plugin-sort-imports": "^3.3.1",
"@types/jest": "^27.4.1",
"@typescript-eslint/eslint-plugin": "^5.16.0",
"@typescript-eslint/parser": "^5.16.0",
"axios-mock-adapter": "^1.22.0",
"dotenv": "^16.0.3",
"eslint": "^8.11.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-unused-imports": "^2.0.0",
"husky": "^7.0.0",
"jest": "^27.5.1",
"lint-staged": "^12.3.7",
"mock-socket": "^9.1.4",
"prettier": "2.6.0",
"prettier-plugin-jsdoc": "^0.3.38",
"rollup": "^2.70.1",
"rollup-plugin-typescript2": "^0.31.2",
"size-limit": "^7.0.8",
"ts-jest": "^27.1.4",
"tslib": "^2.3.1",
"typedoc": "^0.22.15",
"typedoc-plugin-markdown": "^3.12.1",
"typescript": "^4.5.5"
},
"sideEffects": false,
"size-limit": [
{
"path": "dist/index.cjs.js",
"limit": "100 kB"
}
]
}
1 change: 1 addition & 0 deletions packages/persist-primary

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions packages/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import commonjs from '@rollup/plugin-commonjs';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import typescriptPlugin from 'rollup-plugin-typescript2';

import pkg from './package.json';

const TRUE_ROOT = 'index';
const roots = [TRUE_ROOT, 'api/utils'];
const formats = ['cjs', 'esm', 'es'];
const plugins = [typescriptPlugin(), nodeResolve(), commonjs()];

// e.g. dirFromPath("foo/bar/baz") -> "foo/bar"
function dirFromPath(path) {
const index = path.lastIndexOf('/');
return index === -1 ? '' : path.slice(0, index);
}

// e.g. lastPartOfPath("foo/bar/baz") -> "baz"
function lastPartOfPath(path) {
const index = path.lastIndexOf('/');
return path.slice(index + 1);
}

// Returns true for any dependency listed in package.json and for any member of
// roots other than index.js, where roots is the array defined above.
const isExternalModule = (() => {
const deps = new Set(Object.keys(pkg.dependencies ?? {}));
const subrootEndings = new Set(
roots.filter(root => root !== TRUE_ROOT).map(lastPartOfPath)
);
return id =>
deps.has(id) ||
(id.startsWith('.') && subrootEndings.has(lastPartOfPath(id)));
})();

function makeConfig(root) {
return {
input: `src/${root}.ts`,
output: formats.map(format => ({
dir: `dist/${format}/${dirFromPath(root)}`,
format,
sourcemap: true
})),
external: isExternalModule,
plugins
};
}

export default roots.map(makeConfig);
24 changes: 24 additions & 0 deletions packages/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"declaration": true,
"outDir": "dist",
"forceConsistentCasingInFileNames": true,
"allowSyntheticDefaultImports": true,
"downlevelIteration": true,
"importHelpers": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strict": true,
"moduleResolution": "node",
"stripInternal": true,
"esModuleInterop": true,
"sourceMap": true,
"target": "es6",
"module": "esnext",
"typeRoots": ["node_modules/@types"]
},
"include": ["src/**/*.ts", "test/**/*.ts"],
"exclude": ["dist/**/*", "node_modules/**/*"]
}
2 changes: 2 additions & 0 deletions packages/walletconnect-v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
"dependencies": {
"@walletconnect/ethereum-provider": "^2.10.1",
"@walletconnect/modal": "^2.6.2",
"@walletconnect/ethereum-provider": "^2.9.2",
"@walletconnect/modal": "^2.6.1",
"@web3-react/types": "^8.2.2",
"eventemitter3": "^4.0.7"
},
Expand Down
Loading