Files
protocol/packages/sol-trace/docs/reference.mdx
2019-08-26 07:11:29 +02:00

139 lines
3.1 KiB
Plaintext

# Class: RevertTraceSubprovider
This class implements the [web3-provider-engine](https://github.com/MetaMask/provider-engine) subprovider interface.
It is used to report call stack traces whenever a revert occurs.
### Hierarchy
* `TraceCollectionSubprovider`
* **RevertTraceSubprovider**
### Constructors
## constructer
\+ **new RevertTraceSubprovider**(`artifactAdapter`: `AbstractArtifactAdapter`, `defaultFromAddress`: string, `isVerbose`: boolean): *[RevertTraceSubprovider](#class-reverttracesubprovider)*
*Overrides void*
*Defined in [revert_trace_subprovider.ts:27](https://github.com/0xProject/0x-monorepo/blob/6474a4e08/packages/sol-trace/src/revert_trace_subprovider.ts#L27)*
Instantiates a RevertTraceSubprovider instance
**Parameters:**
Name | Type | Default | Description |
------ | ------ | ------ | ------ |
`artifactAdapter` | `AbstractArtifactAdapter` | - | Adapter for used artifacts format (0x, truffle, giveth, etc.) |
`defaultFromAddress` | string | - | default from address to use when sending transactions |
`isVerbose` | boolean | true | If true, we will log any unknown transactions. Otherwise we will ignore them |
**Returns:** *[RevertTraceSubprovider](#class-reverttracesubprovider)*
### Methods
## emitPayloadAsync
▸ **emitPayloadAsync**(`payload`: `Partial<JSONRPCRequestPayloadWithMethod>`): *`Promise<JSONRPCResponsePayload>`*
Emits a JSON RPC payload that will then be handled by the ProviderEngine instance
this subprovider is a part of. The payload will cascade down the subprovider middleware
stack until finding the responsible entity for handling the request.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`payload` | `Partial<JSONRPCRequestPayloadWithMethod>` | JSON RPC payload |
**Returns:** *`Promise<JSONRPCResponsePayload>`*
JSON RPC response payload
___
## handleRequest
▸ **handleRequest**(`payload`: `JSONRPCRequestPayload`, `next`: `NextCallback`, `_end`: `ErrorCallback`): *`Promise<void>`*
*Overrides void*
This method conforms to the web3-provider-engine interface.
It is called internally by the ProviderEngine when it is this subproviders
turn to handle a JSON RPC request.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`payload` | `JSONRPCRequestPayload` | JSON RPC payload |
`next` | `NextCallback` | Callback to call if this subprovider decides not to handle the request |
`_end` | `ErrorCallback` | Callback to call if subprovider handled the request and wants to pass back the request. |
**Returns:** *`Promise<void>`*
___
## setEngine
▸ **setEngine**(`engine`: `Web3ProviderEngine`): *void*
*Overrides void*
Set's the subprovider's engine to the ProviderEngine it is added to.
This is only called within the ProviderEngine source code, do not call
directly.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`engine` | `Web3ProviderEngine` | The ProviderEngine this subprovider is added to |
**Returns:** *void*
___
## start
▸ **start**(): *void*
Starts trace collection
**Returns:** *void*
___
## stop
▸ **stop**(): *void*
Stops trace collection
**Returns:** *void*
<hr />