-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pushing dependency fixes to be able to build master (#242)
- Loading branch information
1 parent
b031ec4
commit ce9e49a
Showing
14 changed files
with
127 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './state-object' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* Internal Imports */ | ||
import { abi } from '../eth' | ||
import { StateObject, AbiEncodable } from '../interfaces/data-types' | ||
|
||
/** | ||
* Creates a StateObject from an encoded StateObject. | ||
* @param encoded The encoded StateObject. | ||
* @returns the StateObject. | ||
*/ | ||
const fromEncoded = (encoded: string): AbiStateObject => { | ||
const decoded = abi.decode(AbiStateObject.abiTypes, encoded) | ||
return new AbiStateObject( | ||
decoded[0], | ||
decoded[1] | ||
) | ||
} | ||
|
||
/** | ||
* Represents a basic abi encodable StateObject | ||
*/ | ||
export class AbiStateObject implements StateObject, AbiEncodable { | ||
public static abiTypes = ['address', 'bytes'] | ||
|
||
constructor( | ||
readonly predicateAddress: string, | ||
readonly data: string, | ||
) {} | ||
|
||
/** | ||
* @returns the abi encoded StateObject. | ||
*/ | ||
get encoded(): string { | ||
return abi.encode(AbiStateObject.abiTypes, [ | ||
this.predicateAddress, | ||
this.data | ||
]) | ||
} | ||
|
||
/** | ||
* Casts a value to a StateObject. | ||
* @param value Thing to cast to a StateObject. | ||
* @returns the StateObject. | ||
*/ | ||
public static from(value: string): AbiStateObject { | ||
if (typeof value === 'string') { | ||
return fromEncoded(value) | ||
} | ||
|
||
throw new Error('Got invalid argument type when casting to StateObject.') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import BigNum = require('bn.js') | ||
|
||
export interface Range { | ||
start: BigNum | ||
end: BigNum | ||
} | ||
|
||
export interface EcdsaSignature { | ||
v: string | ||
r: string | ||
s: string | ||
} | ||
|
||
export interface AbiEncodable { | ||
encoded: string | ||
} | ||
|
||
export interface Transaction { | ||
plasmaContract: string | ||
block: number | ||
range: Range | ||
methodId: string | ||
parameters: any | ||
witness: any | ||
} | ||
|
||
export interface StateObject { | ||
predicateAddress: string, | ||
data: any | ||
} | ||
|
||
export interface StateUpdate { | ||
stateObject: StateObject, | ||
range: Range, | ||
blockNumber: number, | ||
plasmaContract: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './data-types' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
export { EventWatcher, EventWatcherOptions } from './src/event-watcher' | ||
export { EventLog, EventFilter } from './src/models' | ||
export { DefaultEventLog, EventFilter } from './src/models' | ||
export { | ||
EventDB, | ||
EthProvider, | ||
FullEventFilter, | ||
EventFilterOptions | ||
EventFilterOptions, | ||
EventLog | ||
} from './src/interfaces' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import {EventLogData} from "./event-log-data.interface"; | ||
|
||
export interface EventLog { | ||
data: EventLogData | ||
getHash(): string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from './event-filter-options.interface' | ||
export * from './eth-provider.interface' | ||
export * from './event-log-data.interface' | ||
export * from './event-log.interface' | ||
export * from './event-db.interface' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.