@0xcert/ethereum-generic-provider
Advanced tools
Comparing version 0.0.0-alpha0 to 0.0.0-alpha3
@@ -1,3 +0,5 @@ | ||
import { TransactionObject, BlockObject, RpcResponse, QuantityTag, ContractQueryOptions, ContractMutationOptions, SendOptions, SignOptions, SignMethod } from './types'; | ||
import { ProviderEmitter } from './emitter'; | ||
/// <reference types="node" /> | ||
import { EventEmitter } from "events"; | ||
import { TransactionObject, BlockObject, RpcResponse, QuantityTag, ContractQueryOptions, ContractMutationOptions, SendOptions, SignOptions, SignMethod, ProviderEvent } from './types'; | ||
import { Mutation } from './mutation'; | ||
export interface GenericProviderOptions { | ||
@@ -8,3 +10,3 @@ accountId?: string; | ||
} | ||
export declare class GenericProvider extends ProviderEmitter { | ||
export declare class GenericProvider extends EventEmitter { | ||
protected client: any; | ||
@@ -15,5 +17,9 @@ protected requestIndex: number; | ||
constructor(options: GenericProviderOptions); | ||
emit(event: ProviderEvent): boolean; | ||
on(event: ProviderEvent, handler: () => any): this; | ||
once(event: ProviderEvent, handler: () => any): this; | ||
off(event: ProviderEvent, handler?: () => any): this; | ||
getBlockByNumber(tag: QuantityTag): Promise<BlockObject>; | ||
getTransactionByHash(hash: string): Promise<TransactionObject>; | ||
mutateContract(options: ContractMutationOptions): Promise<string>; | ||
mutateContract(options: ContractMutationOptions): Promise<Mutation>; | ||
queryContract<T = any[]>(options: ContractQueryOptions): Promise<T>; | ||
@@ -20,0 +26,0 @@ sign(options: SignOptions): Promise<string>; |
@@ -11,2 +11,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const events_1 = require("events"); | ||
const getBlockByNumber = require("../procedures/get-block-by-number"); | ||
@@ -19,4 +20,4 @@ const getTransactionByHash = require("../procedures/get-transaction-by-hash"); | ||
const errors_1 = require("./errors"); | ||
const emitter_1 = require("./emitter"); | ||
class GenericProvider extends emitter_1.ProviderEmitter { | ||
const mutation_1 = require("./mutation"); | ||
class GenericProvider extends events_1.EventEmitter { | ||
constructor(options) { | ||
@@ -35,2 +36,19 @@ super(); | ||
} | ||
emit(event) { | ||
return super.emit(event); | ||
} | ||
on(event, handler) { | ||
return super.on(event, handler); | ||
} | ||
once(event, handler) { | ||
return super.once(event, handler); | ||
} | ||
off(event, handler) { | ||
if (handler) { | ||
return super.off(event, handler); | ||
} | ||
else { | ||
return super.removeAllListeners(event); | ||
} | ||
} | ||
getBlockByNumber(tag) { | ||
@@ -64,2 +82,4 @@ return __awaiter(this, void 0, void 0, function* () { | ||
return mutateContract.parseResult(res); | ||
}).then((id) => { | ||
return new mutation_1.Mutation(this, id); | ||
}); | ||
@@ -66,0 +86,0 @@ }); |
@@ -10,2 +10,7 @@ export declare enum SignMethod { | ||
} | ||
export declare enum MutationEvent { | ||
RESOLVE = "resolve", | ||
ERROR = "error", | ||
CONFIRM = "confirm" | ||
} | ||
export interface RpcResponse { | ||
@@ -12,0 +17,0 @@ id: number; |
@@ -14,2 +14,8 @@ "use strict"; | ||
})(ProviderEvent = exports.ProviderEvent || (exports.ProviderEvent = {})); | ||
var MutationEvent; | ||
(function (MutationEvent) { | ||
MutationEvent["RESOLVE"] = "resolve"; | ||
MutationEvent["ERROR"] = "error"; | ||
MutationEvent["CONFIRM"] = "confirm"; | ||
})(MutationEvent = exports.MutationEvent || (exports.MutationEvent = {})); | ||
//# sourceMappingURL=types.js.map |
export * from './core/errors'; | ||
export * from './core/emitter'; | ||
export * from './core/mutation'; | ||
export * from './core/provider'; | ||
export * from './core/types'; |
@@ -7,5 +7,5 @@ "use strict"; | ||
__export(require("./core/errors")); | ||
__export(require("./core/emitter")); | ||
__export(require("./core/mutation")); | ||
__export(require("./core/provider")); | ||
__export(require("./core/types")); | ||
//# sourceMappingURL=index.js.map |
@@ -51,5 +51,6 @@ "use strict"; | ||
}); | ||
ctx.true(res.length === 66); | ||
ctx.true(res.id.length === 66); | ||
ctx.true(res.confirmations >= 0); | ||
})); | ||
exports.default = spec; | ||
//# sourceMappingURL=mutate-contract-instance-method.test.js.map |
{ | ||
"files": { | ||
"packages/0xcert-ethereum-generic-provider/nodemon.json": "82b893373db9861f1df4b55d8ea68a5d37b118de", | ||
"packages/0xcert-ethereum-generic-provider/package.json": "8ca9673a417ede128c283ed8ce08b63292f76512", | ||
"packages/0xcert-ethereum-generic-provider/package.json": "2168ef27a10fbbaecf3c15c67ebf9e5ca03d562e", | ||
"packages/0xcert-ethereum-generic-provider/src/core/errors.ts": "a7c91c3cdc15b8b906b00879550d1c31ddd9ec91", | ||
"packages/0xcert-ethereum-generic-provider/src/core/provider.ts": "beeca9cc373d8fe57149f635b3b1647601dd7798", | ||
"packages/0xcert-ethereum-generic-provider/src/core/types.ts": "3344b7aa5454b7820230d46e69dab4df1f6f9294", | ||
"packages/0xcert-ethereum-generic-provider/src/index.ts": "9d44ddf19d91264c341bab9d9964a827f3378c54", | ||
"packages/0xcert-ethereum-generic-provider/src/core/mutation.ts": "96870fb038ab29fb09653dbb264ce4c14d30c754", | ||
"packages/0xcert-ethereum-generic-provider/src/core/provider.ts": "10393bab9af50fef3f47a29365ed59964efbb2c6", | ||
"packages/0xcert-ethereum-generic-provider/src/core/types.ts": "fc1def4dc650ef7d8b598f1602ae51a3ab43f209", | ||
"packages/0xcert-ethereum-generic-provider/src/index.ts": "a4b6262ea7cb45960084814850cb98a8717b05e8", | ||
"packages/0xcert-ethereum-generic-provider/src/procedures/get-block-by-number.ts": "225a1352040f4837d3a55d7a9b5277c81f5d6fad", | ||
@@ -15,5 +16,6 @@ "packages/0xcert-ethereum-generic-provider/src/procedures/get-transaction-by-hash.ts": "f0e27c895585aeaeda2279575017987165bb6975", | ||
"packages/0xcert-ethereum-generic-provider/src/tests/core/errors/errors.test.ts": "6b42a2d0c8f852d9a51e014c5d25ce133523040b", | ||
"packages/0xcert-ethereum-generic-provider/src/tests/core/mutation/resolve-instance-method.test.ts": "6bbdea02d72f8b9a61bbbbb5b9a78defb27519bd", | ||
"packages/0xcert-ethereum-generic-provider/src/tests/core/provider/get-block-by-number-instance-method.test.ts": "3277c0d7c7e678fb5e337cd9aa1d545a93957d4a", | ||
"packages/0xcert-ethereum-generic-provider/src/tests/core/provider/get-transaction-by-hash-instance-method.test.ts": "98b6d2974413d553eb899b5fd2327378a0fb0ad1", | ||
"packages/0xcert-ethereum-generic-provider/src/tests/core/provider/mutate-contract-instance-method.test.ts": "2c32029122a3ba36e47abc7f5e0aa17c8a1b7231", | ||
"packages/0xcert-ethereum-generic-provider/src/tests/core/provider/mutate-contract-instance-method.test.ts": "54c1625b8f48843d30c57afb0696b00e9aa4309d", | ||
"packages/0xcert-ethereum-generic-provider/src/tests/core/provider/query-contract-instance-method.test.ts": "de3b1e437b1580e8ada19cf5e18c5633394a73e6", | ||
@@ -23,5 +25,5 @@ "packages/0xcert-ethereum-generic-provider/src/tests/core/provider/sign-instance-method.test.ts": "8a5da359cb327afbc11d5f50254f77dbda2673b6", | ||
"packages/0xcert-ethereum-generic-provider/tsconfig.json": "4aeac3c20e45b7e477e82012eb7788f7dbb11bf3", | ||
"common/config/rush/npm-shrinkwrap.json": "3c51f6c2f297cb2043d7b18bd118ef5687197fa3" | ||
"common/config/rush/npm-shrinkwrap.json": "9dea1ec1c34d5bcf4df825f8250513472c8f14f2" | ||
}, | ||
"arguments": "npm run clean; npx tsc " | ||
"arguments": "npx specron test " | ||
} |
{ | ||
"name": "@0xcert/ethereum-generic-provider", | ||
"version": "0.0.0-alpha0", | ||
"version": "0.0.0-alpha3", | ||
"description": "Ethereum ledger for 0xcert protocol.", | ||
@@ -15,2 +15,3 @@ "main": "./dist/index.js", | ||
"port": 8520, | ||
"blockTime": 0.1, | ||
"match": [ | ||
@@ -26,3 +27,4 @@ "./src/tests/**/*.test.ts" | ||
"devDependencies": { | ||
"@0xcert/ethereum-sandbox": "0.0.0-alpha2", | ||
"@0xcert/ethereum-sandbox": "0.0.0-alpha3", | ||
"@types/node": "^10.12.10", | ||
"@specron/cli": "^0.3.0", | ||
@@ -36,7 +38,6 @@ "@specron/spec": "^0.3.0", | ||
"dependencies": { | ||
"@0xcert/ethereum-mutation": "0.0.0-alpha2", | ||
"@0xcert/scaffold": "0.0.0-alpha2", | ||
"@0xcert/utils": "0.0.0-alpha2", | ||
"@0xcert/scaffold": "0.0.0-alpha3", | ||
"@0xcert/utils": "0.0.0-alpha3", | ||
"web3-eth-abi": "^1.0.0-beta.36" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
import { Mutation } from '@0xcert/ethereum-mutation'; | ||
import { EventEmitter } from "events"; | ||
import * as getBlockByNumber from '../procedures/get-block-by-number'; | ||
@@ -11,3 +11,3 @@ import * as getTransactionByHash from '../procedures/get-transaction-by-hash'; | ||
import { parseError } from './errors'; | ||
import { ProviderEmitter } from './emitter'; | ||
import { Mutation } from './mutation'; | ||
@@ -26,3 +26,3 @@ /** | ||
*/ | ||
export class GenericProvider extends ProviderEmitter { | ||
export class GenericProvider extends EventEmitter { | ||
protected client: any; | ||
@@ -53,4 +53,37 @@ protected requestIndex: number = 0; | ||
} | ||
/** | ||
* | ||
*/ | ||
public emit(event: ProviderEvent) { | ||
return super.emit(event); | ||
} | ||
/** | ||
* | ||
*/ | ||
public on(event: ProviderEvent, handler: () => any) { | ||
return super.on(event, handler); | ||
} | ||
/** | ||
* | ||
*/ | ||
public once(event: ProviderEvent, handler: () => any) { | ||
return super.once(event, handler); | ||
} | ||
/** | ||
* | ||
*/ | ||
public off(event: ProviderEvent, handler?: () => any) { | ||
if (handler) { | ||
return super.off(event, handler); | ||
} | ||
else { | ||
return super.removeAllListeners(event); | ||
} | ||
} | ||
/** | ||
* Returns block information. | ||
@@ -57,0 +90,0 @@ * @param tag Block number or tag. |
@@ -21,2 +21,11 @@ /** | ||
*/ | ||
export enum MutationEvent { | ||
RESOLVE = 'resolve', | ||
ERROR = 'error', | ||
CONFIRM = 'confirm', | ||
} | ||
/** | ||
* | ||
*/ | ||
export interface RpcResponse { | ||
@@ -23,0 +32,0 @@ id: number; |
export * from './core/errors'; | ||
export * from './core/emitter'; | ||
export * from './core/mutation'; | ||
export * from './core/provider'; | ||
export * from './core/types'; |
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
166672
3
78
2942
8
+ Added@0xcert/scaffold@0.0.0-alpha3(transitive)
+ Added@0xcert/utils@0.0.0-alpha3(transitive)
Updated@0xcert/utils@0.0.0-alpha3