New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@0xcert/ethereum-generic-provider

Package Overview
Dependencies
Maintainers
2
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@0xcert/ethereum-generic-provider - npm Package Compare versions

Comparing version 0.0.0-alpha9 to 0.0.0-rc1

.nyc_output/a832cade-b269-4e9b-bd9e-63c2601e91ed.json

2

dist/core/mutation.d.ts
/// <reference types="node" />
import { MutationBase, MutationEvent } from '@0xcert/scaffold';
import { EventEmitter } from 'events';
import { MutationBase, MutationEvent } from '@0xcert/scaffold';
export declare enum MutationStatus {

@@ -5,0 +5,0 @@ INITIALIZED = 0,

@@ -11,5 +11,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const normalize_address_1 = require("@0xcert/ethereum-utils/dist/lib/normalize-address");
const scaffold_1 = require("@0xcert/scaffold");
const events_1 = require("events");
const scaffold_1 = require("@0xcert/scaffold");
const normalize_address_1 = require("@0xcert/ethereum-utils/dist/lib/normalize-address");
var MutationStatus;

@@ -16,0 +16,0 @@ (function (MutationStatus) {

@@ -0,1 +1,2 @@

import { ProviderBase } from '@0xcert/scaffold';
import { RpcResponse, SendOptions, SignMethod } from './types';

@@ -12,3 +13,3 @@ export interface GenericProviderOptions {

}
export declare class GenericProvider {
export declare class GenericProvider implements ProviderBase {
accountId: string;

@@ -15,0 +16,0 @@ signMethod: SignMethod;

@@ -11,4 +11,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const errors_1 = require("./errors");
const types_1 = require("./types");
const errors_1 = require("./errors");
class GenericProvider {

@@ -19,5 +19,5 @@ constructor(options) {

this.unsafeRecipientIds = options.unsafeRecipientIds || [];
this.assetLedgerSource = options.assetLedgerSource || 'https://docs.0xcert.org/xcert-mock.json',
this.valueLedgerSource = options.valueLedgerSource || 'https://docs.0xcert.org/token-mock.json',
this.signMethod = typeof options.signMethod !== 'undefined' ? options.signMethod : types_1.SignMethod.ETH_SIGN;
this.assetLedgerSource = options.assetLedgerSource || 'https://docs.0xcert.org/xcert-mock.json';
this.valueLedgerSource = options.valueLedgerSource || 'https://docs.0xcert.org/token-mock.json';
this.signMethod = typeof options.signMethod !== 'undefined' ? options.signMethod : types_1.SignMethod.ETH_SIGN;
this.requiredConfirmations = typeof options.requiredConfirmations !== 'undefined' ? options.requiredConfirmations : 1;

@@ -24,0 +24,0 @@ this.orderGatewayId = options.orderGatewayId;

export * from '@0xcert/scaffold/dist/core/mutation';
export * from '@0xcert/scaffold/dist/core/provider';
export * from './core/errors';

@@ -3,0 +4,0 @@ export * from './core/mutation';

@@ -7,2 +7,3 @@ "use strict";

__export(require("@0xcert/scaffold/dist/core/mutation"));
__export(require("@0xcert/scaffold/dist/core/provider"));
__export(require("./core/errors"));

@@ -9,0 +10,0 @@ __export(require("./core/mutation"));

@@ -0,3 +1,3 @@

import { Protocol } from '@0xcert/ethereum-sandbox';
import { Spec } from '@specron/spec';
import { Protocol } from '@0xcert/ethereum-sandbox';
import { GenericProvider } from '../../..';

@@ -4,0 +4,0 @@ interface Data {

@@ -11,4 +11,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const ethereum_sandbox_1 = require("@0xcert/ethereum-sandbox");
const spec_1 = require("@specron/spec");
const ethereum_sandbox_1 = require("@0xcert/ethereum-sandbox");
const __1 = require("../../..");

@@ -15,0 +15,0 @@ const spec = new spec_1.Spec();

{
"files": {},
"arguments": "npx specron test "
"arguments": "npm run lint && npx nyc npx specron test "
}
{
"name": "@0xcert/ethereum-generic-provider",
"version": "0.0.0-alpha9",
"version": "0.0.0-rc1",
"description": "Basic implementation of communication provider for the Ethereum blockchain.",

@@ -8,5 +8,6 @@ "main": "./dist/index.js",

"scripts": {
"build": "npm run clean && npx tsc",
"clean": "rm -Rf ./dist",
"build": "npm run clean; npx tsc",
"test": "npx specron test"
"lint": "npx tslint 'src/**/*.ts?(x)'",
"test": "npm run lint && npx nyc npx specron test"
},

@@ -24,2 +25,13 @@ "specron": {

},
"nyc": {
"extension": [
".ts"
],
"require": [
"ts-node/register"
],
"exclude": [
"src/tests"
]
},
"repository": {

@@ -60,8 +72,10 @@ "type": "git",

"devDependencies": {
"@0xcert/ethereum-sandbox": "0.0.0-alpha9",
"@0xcert/ethereum-sandbox": "0.0.0-rc1",
"@types/node": "^10.12.10",
"@specron/cli": "^0.5.1",
"@specron/spec": "^0.5.1",
"nyc": "^13.1.0",
"solc": "0.5.1",
"ts-node": "^7.0.1",
"tslint": "^5.12.1",
"typescript": "^3.1.1",

@@ -71,5 +85,5 @@ "web3": "^1.0.0-beta.36"

"dependencies": {
"@0xcert/ethereum-utils": "0.0.0-alpha9",
"@0xcert/scaffold": "0.0.0-alpha9"
"@0xcert/ethereum-utils": "0.0.0-rc1",
"@0xcert/scaffold": "0.0.0-rc1"
}
}

@@ -8,9 +8,7 @@ import { ProviderError, ProviderIssue } from '@0xcert/scaffold';

export function parseError(error: any) {
if (error instanceof ProviderError) {
return error;
}
else {
} else {
return new ProviderError(ProviderIssue.GENERAL, error);
}
}

@@ -0,4 +1,4 @@

import { normalizeAddress } from '@0xcert/ethereum-utils/dist/lib/normalize-address';
import { MutationBase, MutationEvent } from '@0xcert/scaffold';
import { EventEmitter } from 'events';
import { MutationBase, MutationEvent } from '@0xcert/scaffold';
import { normalizeAddress } from '@0xcert/ethereum-utils/dist/lib/normalize-address';

@@ -15,7 +15,7 @@ /**

/**
*
* Ethreum transaction mutation.
*/
export class Mutation extends EventEmitter implements MutationBase {
protected $id: string;
protected $confirmations: number = 0;
protected $confirmations = 0;
protected $senderId: string;

@@ -122,3 +122,3 @@ protected $receiverId: string;

/**
* Dettaches from mutation events.
* Dettaches from mutation events.
*/

@@ -128,4 +128,3 @@ public off(event: MutationEvent, handler?: () => any) {

super.off(event, handler);
}
else {
} else {
super.removeAllListeners(event);

@@ -144,4 +143,3 @@ }

return this;
}
else {
} else {
this.$status = MutationStatus.PENDING;

@@ -154,4 +152,3 @@ }

this.once(MutationEvent.ERROR, (err) => reject(err));
}
else {
} else {
resolve();

@@ -168,3 +165,3 @@ }

/**
*
* Stops listening for confirmations.
*/

@@ -186,4 +183,3 @@ public forget() {

return this.emit(MutationEvent.ERROR, new Error('Mutation not found (1)'));
}
else if (!tx.to || tx.to === '0x0') {
} else if (!tx.to || tx.to === '0x0') {
tx.to = await this.getTransactionReceipt().then((r) => r ? r.contractAddress : null);

@@ -201,9 +197,7 @@ }

this.emit(MutationEvent.COMPLETE, this);
}
else {
} else {
this.emit(MutationEvent.CONFIRM, this);
this.$timer = setTimeout(this.loopUntilResolved.bind(this), 14000);
}
}
else {
} else {
this.$timer = setTimeout(this.loopUntilResolved.bind(this), 14000);

@@ -210,0 +204,0 @@ }

@@ -0,3 +1,4 @@

import { ProviderBase } from '@0xcert/scaffold';
import { parseError } from './errors';
import { RpcResponse, SendOptions, SignMethod } from './types';
import { parseError } from './errors';

@@ -21,3 +22,3 @@ /**

*/
export class GenericProvider {
export class GenericProvider implements ProviderBase {
public accountId: string;

@@ -31,3 +32,3 @@ public signMethod: SignMethod;

protected $client: any;
protected $id: number = 0;
protected $id = 0;

@@ -42,8 +43,8 @@ /**

this.unsafeRecipientIds = options.unsafeRecipientIds || [];
this.assetLedgerSource = options.assetLedgerSource || 'https://docs.0xcert.org/xcert-mock.json',
this.valueLedgerSource = options.valueLedgerSource || 'https://docs.0xcert.org/token-mock.json',
this.assetLedgerSource = options.assetLedgerSource || 'https://docs.0xcert.org/xcert-mock.json';
this.valueLedgerSource = options.valueLedgerSource || 'https://docs.0xcert.org/token-mock.json';
this.signMethod = typeof options.signMethod !== 'undefined' ? options.signMethod : SignMethod.ETH_SIGN;
this.requiredConfirmations = typeof options.requiredConfirmations !== 'undefined' ? options.requiredConfirmations : 1;
this.orderGatewayId = options.orderGatewayId;
this.$client = options.client && options.client.currentProvider

@@ -106,3 +107,3 @@ ? options.client.currentProvider

params: [],
...options,
...options,
};

@@ -113,7 +114,5 @@ return new Promise<RpcResponse>((resolve, reject) => {

return reject(err);
}
else if (res.error) { // RPC error
} else if (res.error) { // RPC error
return reject(res.error);
}
else if (res.id !== payload.id) { // anomaly
} else if (res.id !== payload.id) { // anomaly
return reject('Invalid RPC id');

@@ -120,0 +119,0 @@ }

export * from '@0xcert/scaffold/dist/core/mutation';
export * from '@0xcert/scaffold/dist/core/provider';
export * from './core/errors';

@@ -3,0 +4,0 @@ export * from './core/mutation';

@@ -0,7 +1,7 @@

import { Protocol } from '@0xcert/ethereum-sandbox';
import { Spec } from '@specron/spec';
import { Protocol } from '@0xcert/ethereum-sandbox';
import { Mutation, MutationEvent, GenericProvider } from '../../..';
import { GenericProvider, Mutation, MutationEvent } from '../../..';
interface Data {
provider: GenericProvider
provider: GenericProvider;
protocol: Protocol;

@@ -44,4 +44,4 @@ coinbase: string;

const mutation = new Mutation(provider, transactionHash);
mutation.on(MutationEvent.CONFIRM, () => counters.confirm++)
mutation.on(MutationEvent.COMPLETE, () => counters.resolve++)
mutation.on(MutationEvent.CONFIRM, () => counters.confirm++);
mutation.on(MutationEvent.COMPLETE, () => counters.resolve++);

@@ -48,0 +48,0 @@ mutation.complete();

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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