@ethersproject/providers#Provider TypeScript Examples
The following examples show how to use
@ethersproject/providers#Provider.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ERC1967UpgradeUpgradeable__factory.ts From anchor-web-app with Apache License 2.0 | 6 votes |
static connect(
address: string,
signerOrProvider: Signer | Provider,
): ERC1967UpgradeUpgradeable {
return new Contract(
address,
_abi,
signerOrProvider,
) as ERC1967UpgradeUpgradeable;
}
Example #2
Source File: EchidnaL1NovaExecutionManager__factory.ts From nova with GNU Affero General Public License v3.0 | 6 votes |
static connect(
address: string,
signerOrProvider: Signer | Provider
): EchidnaL1NovaExecutionManager {
return new Contract(
address,
_abi,
signerOrProvider
) as EchidnaL1NovaExecutionManager;
}
Example #3
Source File: BlockchainAPI.ts From set.js with Apache License 2.0 | 6 votes |
/**
* Instantiates a new BlockchainAPI instance that contains methods for miscellaneous blockchain functionality
*
* @param provider Ethers Provider instance you would like the SetProtocol.js library to use for interacting with
* the Ethereum network
* @param assertions An instance of the Assertion library
*/
constructor(provider: Provider, assertions?: Assertions) {
this.provider = provider;
this.assert = assertions || new Assertions();
this.intervalManager = new IntervalManager();
}
Example #4
Source File: IUniswapV3MintCallback__factory.ts From hypervisor with The Unlicense | 6 votes |
static connect(
address: string,
signerOrProvider: Signer | Provider
): IUniswapV3MintCallback {
return new Contract(
address,
_abi,
signerOrProvider
) as IUniswapV3MintCallback;
}
Example #5
Source File: app.ts From noether with Apache License 2.0 | 6 votes |
checkBalance = async (provider: Provider, address: string) => {
// query node wallet ETH balance
const balance = await provider.getBalance(address);
const label = formatEther(balance);
// monitor ETH balance
monitoring.balance.set(Number.parseFloat(label));
// print warning if below threshold
if (balance.lt(BALANCE_THRESHOLD)) {
log.warn(`low balance: ${label} ETH, transfer more funds`);
}
}
Example #6
Source File: call.ts From ethers-multicall with MIT License | 6 votes |
export async function all<T extends any[] = any[]>(
calls: ContractCall[],
multicallAddress: string,
provider: Provider,
): Promise<T> {
const multicall = new Contract(multicallAddress, multicallAbi, provider);
const callRequests = calls.map(call => {
const callData = Abi.encode(call.name, call.inputs, call.params);
return {
target: call.contract.address,
callData,
};
});
const response = await multicall.aggregate(callRequests);
const callCount = calls.length;
const callResult = [] as T;
for (let i = 0; i < callCount; i++) {
const outputs = calls[i].outputs;
const returnData = response.returnData[i];
const params = Abi.decode(outputs, returnData);
const result = outputs.length === 1 ? params[0] : params;
callResult.push(result);
}
return callResult;
}
Example #7
Source File: CrossAnchorBridgeV2__factory.ts From anchor-web-app with Apache License 2.0 | 5 votes |
static connect(
address: string,
signerOrProvider: Signer | Provider,
): CrossAnchorBridgeV2 {
return new Contract(address, _abi, signerOrProvider) as CrossAnchorBridgeV2;
}
Example #8
Source File: wallets.ts From index-coop-smart-contracts with Apache License 2.0 | 5 votes |
export function generatedWallets(provider: Provider) {
return privateKeys.map((key: string) => {
return new ethers.Wallet(key, provider);
});
}
Example #9
Source File: Auth.d.ts From nova with GNU Affero General Public License v3.0 | 5 votes |
connect(signerOrProvider: Signer | Provider | string): this;
Example #10
Source File: BlockchainAPI.ts From set.js with Apache License 2.0 | 5 votes |
private provider: Provider;