UNPKG

@faast/ethereum-payments

Version:

Library to assist in processing ethereum payments, such as deriving addresses and sweeping funds

26 lines (19 loc) 636 B
import Web3 from 'web3' import { PaymentsConnectionManager } from '@faast/payments-common' import { EthereumPaymentsUtilsConfig } from './types'; import { EthereumPaymentsUtils } from './EthereumPaymentsUtils' export class EthereumConnectionManager implements PaymentsConnectionManager< Web3, EthereumPaymentsUtilsConfig > { connections = {} getConnection(connected: EthereumPaymentsUtils) { return connected.web3 } getConnectionUrl(config: EthereumPaymentsUtilsConfig) { return config.fullNode || null } setConnection(config: EthereumPaymentsUtilsConfig, web3: Web3) { return config.web3 = web3 } }