ethers.js/packages/testcases/lib/browser.js

37 lines
1.5 KiB
JavaScript
Raw Permalink Normal View History

2019-05-14 18:48:48 -04:00
'use strict';
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var path_1 = __importDefault(require("path"));
var browserify_zlib_1 = __importDefault(require("browserify-zlib"));
var random_1 = require("./random");
exports.randomBytes = random_1.randomBytes;
exports.randomHexString = random_1.randomHexString;
exports.randomNumber = random_1.randomNumber;
2019-05-14 18:48:48 -04:00
var data = __importStar(require("./browser-fs.json"));
var Cache = {};
2019-05-14 18:48:48 -04:00
function loadTests(tag) {
var filename = 'testcases/' + tag + ".json.gz";
if (Cache[filename] == null) {
console.log("loading:", filename);
Cache[filename] = JSON.parse(browserify_zlib_1.default.gunzipSync(new Buffer(data[filename], "base64")).toString());
}
return Cache[filename];
2019-05-14 18:48:48 -04:00
}
exports.loadTests = loadTests;
function loadData(filename) {
// Strip any leading relative paths (e.g. "./foo" => "foo")
filename = path_1.default.join(filename);
console.log("loading:", filename);
return new Buffer(data[filename], "base64");
}
exports.loadData = loadData;
2020-07-13 08:03:56 -04:00
//# sourceMappingURL=browser.js.map