Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@abacus-network/utils

Package Overview
Dependencies
Maintainers
4
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@abacus-network/utils - npm Package Compare versions

Comparing version 0.2.1-alpha5 to 0.2.1-alpha6

2

dist/src/utils.d.ts

@@ -12,2 +12,4 @@ import { ethers } from 'ethers';

export declare function domainHash(domain: number): string;
export declare function sleep(ms: number): Promise<void>;
export declare function retryAsync<T>(runner: () => T, attempts?: number, delay?: number): Promise<T>;
//# sourceMappingURL=utils.d.ts.map
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.domainHash = exports.destinationAndNonce = exports.messageHash = exports.formatMessage = exports.formatCallData = exports.bytes32ToAddress = exports.addressToBytes32 = exports.stringToBytes32 = exports.getHexStringByteLength = void 0;
exports.retryAsync = exports.sleep = exports.domainHash = exports.destinationAndNonce = exports.messageHash = exports.formatMessage = exports.formatCallData = exports.bytes32ToAddress = exports.addressToBytes32 = exports.stringToBytes32 = exports.getHexStringByteLength = void 0;
const chai_1 = require("chai");

@@ -65,2 +74,24 @@ const ethers_1 = require("ethers");

exports.domainHash = domainHash;
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
exports.sleep = sleep;
// Retries an async function when it raises an exeption
// if all the tries fail it raises the last thrown exeption
function retryAsync(runner, attempts = 3, delay = 500) {
return __awaiter(this, void 0, void 0, function* () {
let saveError;
for (let i = 0; i < attempts; i++) {
try {
return runner();
}
catch (error) {
saveError = error;
yield sleep(delay * (i + 1));
}
}
throw saveError;
});
}
exports.retryAsync = retryAsync;
//# sourceMappingURL=utils.js.map

2

package.json
{
"name": "@abacus-network/utils",
"description": "General utilities for the Abacus network",
"version": "0.2.1-alpha5",
"version": "0.2.1-alpha6",
"dependencies": {

@@ -6,0 +6,0 @@ "chai": "^4.3.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc