0.0.12 • Published 3 years ago
@hardapps/lb-connector-web3plus v0.0.12
Datasource example
{
"name": "web3plus",
"connector": "@hardapps/lb-connector-web3plus",
"provider": "ws://localhost:9545",
"providerName": "local ganache",
"privateKeyFile": "secrets/private_key_file",
"gas": 400000,
"contracts": [
{
"name": "MyContract",
"abi": ["..."],
"address": "0x3cA09957030CF5cbd7905F6f6ed2b54665589786"
}
]
}
import { getService, juggler } from '@loopback/service-proxy';
import { inject, Provider } from '@loopback/core';
import { Web3PlusDataSource } from '../datasources';
import Web3 = require('web3');
export interface Web3PlusService {
web3: Web3;
providerName: string;
contracts: any;
reconnectWeb3: any;
}
export class Web3PlusServiceProvider implements Provider<Web3PlusService> {
constructor(
@inject('datasources.web3plus')
protected dataSource: juggler.DataSource = new Web3PlusDataSource(),
) { }
value(): Promise<Web3PlusService> {
return getService(this.dataSource);
}
}