diff --git a/ethers-ext/package-lock.json b/ethers-ext/package-lock.json index 9cfcda354..573913e18 100644 --- a/ethers-ext/package-lock.json +++ b/ethers-ext/package-lock.json @@ -1,12 +1,12 @@ { "name": "@klaytn/ethers-ext", - "version": "1.0.1", + "version": "1.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@klaytn/ethers-ext", - "version": "1.0.1", + "version": "1.0.2", "license": "MIT", "dependencies": { "@ethersproject/abstract-provider": "^5.7.0", @@ -29,6 +29,7 @@ "@ethersproject/web": "^5.7.1", "@klaytn/js-ext-core": "^1.0.0", "@klaytn/web3rpc": "^0.9.9", + "ethers6": "npm:ethers@^6.12.1", "lodash": "^4.17.21" }, "devDependencies": { @@ -62,6 +63,11 @@ "node": ">=0.10.0" } }, + "node_modules/@adraffy/ens-normalize": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz", + "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==" + }, "node_modules/@ampproject/remapping": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", @@ -1482,6 +1488,28 @@ "integrity": "sha512-s88O1aVtXftvp5bCPB7WnmXc5IwOZZ7YPuwNPt+GtOOXpPvad1LfbmjYv+qII7zP6RU2QGnqve27dnLycEnyEQ==", "optional": true }, + "node_modules/@noble/curves": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", + "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "dependencies": { + "@noble/hashes": "1.3.2" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/hashes": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", + "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -1609,8 +1637,7 @@ "node_modules/@types/node": { "version": "18.15.13", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz", - "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==", - "dev": true + "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==" }, "node_modules/@types/semver": { "version": "7.5.0", @@ -3369,6 +3396,59 @@ "@ethersproject/wordlists": "5.7.0" } }, + "node_modules/ethers6": { + "name": "ethers", + "version": "6.12.1", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.12.1.tgz", + "integrity": "sha512-j6wcVoZf06nqEcBbDWkKg8Fp895SS96dSnTCjiXT+8vt2o02raTn4Lo9ERUuIVU5bAjoPYeA+7ytQFexFmLuVw==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/ethers-io/" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@adraffy/ens-normalize": "1.10.1", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2", + "@types/node": "18.15.13", + "aes-js": "4.0.0-beta.5", + "tslib": "2.4.0", + "ws": "8.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/ethers6/node_modules/aes-js": { + "version": "4.0.0-beta.5", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", + "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" + }, + "node_modules/ethers6/node_modules/ws": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", + "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/events": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", @@ -5881,6 +5961,11 @@ "json5": "lib/cli.js" } }, + "node_modules/tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", diff --git a/ethers-ext/package.json b/ethers-ext/package.json index e2e3525ff..de58cfea6 100644 --- a/ethers-ext/package.json +++ b/ethers-ext/package.json @@ -18,6 +18,20 @@ }, "main": "dist/index.js", "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./v5": { + "types": "./dist/v5/index.d.ts", + "default": "./dist/v5/index.js" + }, + "./v6": { + "types": "./dist/v6/index.d.ts", + "default": "./dist/v6/index.js" + } + }, "files": [ "./dist", "./src" @@ -75,6 +89,7 @@ "@ethersproject/web": "^5.7.1", "@klaytn/js-ext-core": "^1.0.0", "@klaytn/web3rpc": "^0.9.9", + "ethers6": "npm:ethers@^6.12.1", "lodash": "^4.17.21" } } diff --git a/ethers-ext/src/index.ts b/ethers-ext/src/index.ts index 3c96b3458..b8e089a19 100644 --- a/ethers-ext/src/index.ts +++ b/ethers-ext/src/index.ts @@ -1,23 +1,12 @@ -// Pass-through js-ext-core exports -export * from "@klaytn/js-ext-core/util"; -export { - AccountKey, - AccountKeyFactory, - KlaytnTx, - KlaytnTxFactory, - parseTransaction, -} from "@klaytn/js-ext-core"; +// require("@klaytn/ethers-ext") exports the extension for ethers v5 +export * from "./v5"; -// ethers-ext classes and functions -export * from "./accountStore"; -export * from "./keystore"; -export * from "./signer"; +// require("@klaytn/ethers-ext").v5 exports the extension for ethers v5 +// require("@klaytn/ethers-ext").v6 exports the extension for ethers v6 +import * as v5 from "./v5"; +import * as v6 from "./v6"; +export { v5, v6 }; -// Follow ethers v6 convention like `ethers.JsonRpcProvider` -export * from "./provider"; -// Follow ethers v5 convention like `ethers.providers.JsonRpcProvider` -import { JsonRpcProvider, Web3Provider } from "./provider"; -export const providers = { - JsonRpcProvider, - Web3Provider, -}; \ No newline at end of file +// require("@klaytn/ethers-ext/v5") exports the extension for ethers v5 +// require("@klaytn/ethers-ext/v6") exports the extension for ethers v6 +// (declared in package.json:exports. No code needeed here) diff --git a/ethers-ext/src/accountStore.ts b/ethers-ext/src/v5/accountStore.ts similarity index 100% rename from ethers-ext/src/accountStore.ts rename to ethers-ext/src/v5/accountStore.ts diff --git a/ethers-ext/src/v5/index.ts b/ethers-ext/src/v5/index.ts new file mode 100644 index 000000000..3c96b3458 --- /dev/null +++ b/ethers-ext/src/v5/index.ts @@ -0,0 +1,23 @@ +// Pass-through js-ext-core exports +export * from "@klaytn/js-ext-core/util"; +export { + AccountKey, + AccountKeyFactory, + KlaytnTx, + KlaytnTxFactory, + parseTransaction, +} from "@klaytn/js-ext-core"; + +// ethers-ext classes and functions +export * from "./accountStore"; +export * from "./keystore"; +export * from "./signer"; + +// Follow ethers v6 convention like `ethers.JsonRpcProvider` +export * from "./provider"; +// Follow ethers v5 convention like `ethers.providers.JsonRpcProvider` +import { JsonRpcProvider, Web3Provider } from "./provider"; +export const providers = { + JsonRpcProvider, + Web3Provider, +}; \ No newline at end of file diff --git a/ethers-ext/src/keystore.ts b/ethers-ext/src/v5/keystore.ts similarity index 100% rename from ethers-ext/src/keystore.ts rename to ethers-ext/src/v5/keystore.ts diff --git a/ethers-ext/src/provider.ts b/ethers-ext/src/v5/provider.ts similarity index 100% rename from ethers-ext/src/provider.ts rename to ethers-ext/src/v5/provider.ts diff --git a/ethers-ext/src/signer.ts b/ethers-ext/src/v5/signer.ts similarity index 100% rename from ethers-ext/src/signer.ts rename to ethers-ext/src/v5/signer.ts diff --git a/ethers-ext/src/txutil.ts b/ethers-ext/src/v5/txutil.ts similarity index 100% rename from ethers-ext/src/txutil.ts rename to ethers-ext/src/v5/txutil.ts diff --git a/ethers-ext/src/types.ts b/ethers-ext/src/v5/types.ts similarity index 100% rename from ethers-ext/src/types.ts rename to ethers-ext/src/v5/types.ts diff --git a/ethers-ext/src/v6/index.ts b/ethers-ext/src/v6/index.ts new file mode 100644 index 000000000..f623a7097 --- /dev/null +++ b/ethers-ext/src/v6/index.ts @@ -0,0 +1 @@ +export * from "./signer"; \ No newline at end of file diff --git a/ethers-ext/src/v6/signer.ts b/ethers-ext/src/v6/signer.ts new file mode 100644 index 000000000..50c80923b --- /dev/null +++ b/ethers-ext/src/v6/signer.ts @@ -0,0 +1,5 @@ +import { Wallet as EthersWallet } from "ethers6"; + +export class Wallet extends EthersWallet { + +} \ No newline at end of file