fuel-connectors
fuel-connectors copied to clipboard
connectors spec change proposal
this is a proposal is for improving the spec below https://github.com/FuelLabs/fuel-connectors/wiki
step 1 - add a new section:
Supported Methods
Include on FuelConnectors
interface a way to provide the methods that this connector supports
This enables improvements on UX for the Connectors UI by:
- Easily provide for UI what are the methods that this connector supports
- Allowing UI to hide the connectors that don't support the method that the user wants to call
step 2 - include in Connector method list
| Method | Description | Params | Return |
| --- | --- | --- | --- | | unsupportedMethods | Return the names of methods that the current connector don't support. | | string[] |
step 3 - add to Fuel SDK method list
| Method | Description | Params | Return |
| --- | --- | --- | --- | | isMethodSupported | Return a boolean representing if the method is supported by this connector (inside of unsupportedMethods
) | method name | boolean | | getSupportedConnectors | Return an array of the supported connectors for the inputted method name | method name | boolean |
step 4 (optional) - create a way to block methods that are not supported when they are called
This is open for discussion.
One option is to add overrides for each connector function, executing first the isMethodSupported
For this we would need to add to Fuel SDK method list overriding methods from Fuel Connector
async sendTransaction(_address: string, _transaction: TransactionRequestLike) {
if (!this.isMethodSupported('sendTransaction')) {
throw new Error(`Method not supported by connector "${this.name}"`);
}
return super.sendTransaction(_address, _transaction);
}