1be1a78a69
* Feat/537: Removed old contract and branching logic for collateral bridge * Feat/537: Renamed all 'new' name instances in functions, files and types. Regenerated types. * Feat/537: Added 'creation' field to withdraw-dialog.spec.tsx test
25 lines
629 B
TypeScript
25 lines
629 B
TypeScript
import { CollateralBridge } from '@vegaprotocol/smart-contracts';
|
|
import { useWeb3React } from '@web3-react/core';
|
|
import { useMemo } from 'react';
|
|
import { useEthereumConfig } from './use-ethereum-config';
|
|
|
|
export const useBridgeContract = () => {
|
|
const { provider } = useWeb3React();
|
|
const { config } = useEthereumConfig();
|
|
|
|
const contract = useMemo(() => {
|
|
if (!provider || !config) {
|
|
return null;
|
|
}
|
|
|
|
const signer = provider.getSigner();
|
|
|
|
return new CollateralBridge(
|
|
config.collateral_bridge_contract.address,
|
|
signer || provider
|
|
);
|
|
}, [provider, config]);
|
|
|
|
return contract;
|
|
};
|