diff --git a/.changeset/nasty-radios-warn.md b/.changeset/nasty-radios-warn.md new file mode 100644 index 00000000..831cf631 --- /dev/null +++ b/.changeset/nasty-radios-warn.md @@ -0,0 +1,5 @@ +--- +'@sei-js/evm': patch +--- + +Adds wallet utilities and tests diff --git a/package.json b/package.json index dc9d1fee..95920fae 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "dependencies": { "@changesets/cli": "^2.26.0", "axios": "^1.6.0", + "bech32": "^2.0.0", "glob": "^10.3.10", "tslib": "^2.3.0" }, @@ -43,6 +44,10 @@ "@swc-node/register": "~1.8.0", "@swc/core": "~1.3.85", "@swc/helpers": "~0.5.2", + "@types/babel__core": "^7.20.5", + "@types/babel__generator": "^7.6.8", + "@types/babel__template": "^7.4.4", + "@types/babel__traverse": "^7.20.6", "@types/jest": "^29.5.5", "@types/node": "20.8.2", "@typescript-eslint/eslint-plugin": "^7.4.0", diff --git a/packages/evm/package.json b/packages/evm/package.json index 6a297a8d..fd292e96 100644 --- a/packages/evm/package.json +++ b/packages/evm/package.json @@ -43,6 +43,10 @@ "viem": "2.x" }, "devDependencies": { + "@types/babel__core": "^7.20.5", + "@types/babel__generator": "^7.6.8", + "@types/babel__template": "^7.4.4", + "@types/babel__traverse": "^7.20.6", "@types/jest": "^29.5.12", "ethers": "^6.0.0", "jest": "^29.7.0", diff --git a/packages/evm/src/utils/walletUtils.ts b/packages/evm/src/utils/walletUtils.ts index 1e6abb7c..bb6ba06d 100644 --- a/packages/evm/src/utils/walletUtils.ts +++ b/packages/evm/src/utils/walletUtils.ts @@ -2,7 +2,11 @@ import { sha256 } from '@noble/hashes/sha256'; import { ripemd160 } from '@noble/hashes/ripemd160'; import { keccak_256 } from '@noble/hashes/sha3'; import { secp256k1 } from '@noble/curves/secp256k1'; -import { encode, decode, toWords } from 'bech32'; +import { bech32 } from 'bech32'; // Note the import statement +const encode = bech32.encode; +const decode = bech32.decode; +const toWords = bech32.toWords; + export interface AddressSet { seiAddress: string; diff --git a/yarn.lock b/yarn.lock index 60dd9440..9dba7a5c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3903,7 +3903,7 @@ resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9" integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== -"@types/babel__core@^7.1.14": +"@types/babel__core@^7.1.14", "@types/babel__core@^7.20.5": version "7.20.5" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" integrity sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA== @@ -3914,14 +3914,14 @@ "@types/babel__template" "*" "@types/babel__traverse" "*" -"@types/babel__generator@*": +"@types/babel__generator@*", "@types/babel__generator@^7.6.8": version "7.6.8" resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.8.tgz#f836c61f48b1346e7d2b0d93c6dacc5b9535d3ab" integrity sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw== dependencies: "@babel/types" "^7.0.0" -"@types/babel__template@*": +"@types/babel__template@*", "@types/babel__template@^7.4.4": version "7.4.4" resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.4.tgz#5672513701c1b2199bc6dad636a9d7491586766f" integrity sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A== @@ -3936,6 +3936,13 @@ dependencies: "@babel/types" "^7.20.7" +"@types/babel__traverse@^7.20.6": + version "7.20.6" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.6.tgz#8dc9f0ae0f202c08d8d4dab648912c8d6038e3f7" + integrity sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg== + dependencies: + "@babel/types" "^7.20.7" + "@types/bn.js@*": version "5.1.5" resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.5.tgz#2e0dacdcce2c0f16b905d20ff87aedbc6f7b4bf0"