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

Add shims for atob #88

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,14 @@
"npm-run-all": "~4.1.5",
"prettier": "^1.19.1",
"rimraf": "~3.0.0",
"ts-jest": "^27.1.3",
"ts-node": "~8.5.2",
"tslint": "~5.20.1",
"typescript": "~3.8.3",
"ts-jest": "^27.1.3"
"typescript": "~3.8.3"
},
"dependencies": {
"@types/atob": "^2.1.2",
"atob": "^2.1.2",
"ethereum-cryptography": "^1.0.1",
"node-fetch": "^2.6.0"
},
Expand Down
1 change: 1 addition & 0 deletions src/core/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '../utils/shim';
import { TokenModule } from '../modules/token';
import { UsersModule } from '../modules/users';
import { UtilsModule } from '../modules/utils';
Expand Down
4 changes: 4 additions & 0 deletions src/utils/shim.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import atob from 'atob';

// Shims for atob being undefined in node.js prior version 14
if (!globalThis.atob) globalThis.atob = atob;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ethella Looks good to me. Just dropped the test coverage too low 🤣

Copy link
Member Author

@Ethella Ethella Apr 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't aware of tests 😭. Will make them

10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,11 @@
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82"
integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==

"@types/atob@^2.1.2":
version "2.1.2"
resolved "https://registry.yarnpkg.com/@types/atob/-/atob-2.1.2.tgz#157eb0cc46264a8c55f2273a836c7a1a644fb820"
integrity sha512-8GAYQ1jDRUQkSpHzJUqXwAkYFOxuWAOGLhIR4aPd/Y/yL12Q/9m7LsKpHKlfKdNE/362Hc9wPI1Yh6opDfxVJg==

"@types/babel__core@^7.0.0", "@types/babel__core@^7.1.14":
version "7.1.18"
resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.18.tgz#1a29abcc411a9c05e2094c98f9a1b7da6cdf49f8"
Expand Down Expand Up @@ -1227,6 +1232,11 @@ asynckit@^0.4.0:
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=

atob@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==

author-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/author-regex/-/author-regex-1.0.0.tgz#d08885be6b9bbf9439fe087c76287245f0a81450"
Expand Down