Skip to content

Commit

Permalink
v1.21.4: fix crypto.randomBytes polyfil
Browse files Browse the repository at this point in the history
  • Loading branch information
10xSebastian committed May 10, 2023
1 parent cbb0207 commit 2f805fe
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/esm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if(_global$1.XMLHttpRequest == undefined) { _global$1.XMLHttpRequest = class XML
if(_global$1.location == undefined) { _global$1.location = {} }
if(_global$1.crypto == undefined) { _global$1.crypto = {} }
if(_global$1.crypto.getRandomValues == undefined) { _global$1.crypto.getRandomValues = function(abv) { var l = abv.length; while (l--) { abv[l] = parseInt(Math.random().toString().replace('0.', ''), 10) }; return abv } }
if(_global$1.crypto.randomBytes == undefined) { let array = new Uint8Array(size); _global$1.crypto.getRandomValues(array); return array }
if(_global$1.crypto.randomBytes == undefined) { _global$1.crypto.randomBytes = function(size) { let array = new Uint8Array(size); _global$1.crypto.getRandomValues(array); return array } }
if(_global$1.fetch == undefined) { throw('Please polyfill .fetch | See: https://github.com/DePayFi/solana-web3.js#polyfill-fetch') }

var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
Expand Down
2 changes: 1 addition & 1 deletion dist/umd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if(_global$1.XMLHttpRequest == undefined) { _global$1.XMLHttpRequest = class XML
if(_global$1.location == undefined) { _global$1.location = {} }
if(_global$1.crypto == undefined) { _global$1.crypto = {} }
if(_global$1.crypto.getRandomValues == undefined) { _global$1.crypto.getRandomValues = function(abv) { var l = abv.length; while (l--) { abv[l] = parseInt(Math.random().toString().replace('0.', ''), 10) }; return abv } }
if(_global$1.crypto.randomBytes == undefined) { let array = new Uint8Array(size); _global$1.crypto.getRandomValues(array); return array }
if(_global$1.crypto.randomBytes == undefined) { _global$1.crypto.randomBytes = function(size) { let array = new Uint8Array(size); _global$1.crypto.getRandomValues(array); return array } }
if(_global$1.fetch == undefined) { throw('Please polyfill .fetch | See: https://github.com/DePayFi/solana-web3.js#polyfill-fetch') }

(function (global, factory) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/solana-web3.js",
"moduleName": "SolanaWeb3js",
"version": "1.21.3",
"version": "1.21.4",
"description": "Solana Web3.js browser pre-built usable in rollup bundles.",
"main": "dist/umd/index.js",
"module": "dist/esm/index.js",
Expand Down
5 changes: 2 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if(_global$1.XMLHttpRequest == undefined) { _global$1.XMLHttpRequest = class XML
if(_global$1.location == undefined) { _global$1.location = {} }
if(_global$1.crypto == undefined) { _global$1.crypto = {} }
if(_global$1.crypto.getRandomValues == undefined) { _global$1.crypto.getRandomValues = function(abv) { var l = abv.length; while (l--) { abv[l] = parseInt(Math.random().toString().replace('0.', ''), 10) }; return abv } }
if(_global$1.crypto.randomBytes == undefined) { let array = new Uint8Array(size); _global$1.crypto.getRandomValues(array); return array }
if(_global$1.crypto.randomBytes == undefined) { _global$1.crypto.randomBytes = function(size) { let array = new Uint8Array(size); _global$1.crypto.getRandomValues(array); return array } }
if(_global$1.fetch == undefined) { throw('Please polyfill .fetch | See: https://github.com/DePayFi/solana-web3.js#polyfill-fetch') }
`
},
Expand All @@ -40,7 +40,7 @@ if(_global$1.XMLHttpRequest == undefined) { _global$1.XMLHttpRequest = class XML
if(_global$1.location == undefined) { _global$1.location = {} }
if(_global$1.crypto == undefined) { _global$1.crypto = {} }
if(_global$1.crypto.getRandomValues == undefined) { _global$1.crypto.getRandomValues = function(abv) { var l = abv.length; while (l--) { abv[l] = parseInt(Math.random().toString().replace('0.', ''), 10) }; return abv } }
if(_global$1.crypto.randomBytes == undefined) { let array = new Uint8Array(size); _global$1.crypto.getRandomValues(array); return array }
if(_global$1.crypto.randomBytes == undefined) { _global$1.crypto.randomBytes = function(size) { let array = new Uint8Array(size); _global$1.crypto.getRandomValues(array); return array } }
if(_global$1.fetch == undefined) { throw('Please polyfill .fetch | See: https://github.com/DePayFi/solana-web3.js#polyfill-fetch') }
`
},
Expand Down Expand Up @@ -81,7 +81,6 @@ if(_global$1.fetch == undefined) { throw('Please polyfill .fetch | See: https://
for (const fileName in bundle) {
let file = bundle[fileName];
if(file.code){
console.log(file.code)
file.code = file.code.replace(
/var nodeCrypto[\s\S]*?;/m,
"var nodeCrypto = _global$1.crypto;"
Expand Down

0 comments on commit 2f805fe

Please sign in to comment.