@celo-tools/celo-ethers-wrapper
Version:
A minimal wrapper to make Ethers.JS compatible with the Celo network.
52 lines (50 loc) • 2.63 kB
TypeScript
import { Provider, TransactionResponse, Wallet, Wordlist } from "ethers";
import { CeloTransaction, CeloTransactionRequest } from "./transactions";
export default class CeloWallet extends Wallet {
isCel2(): Promise<boolean>;
/**
* Override to skip checkTransaction step which rejects Celo tx properties
* https://github.com/ethers-io/ethers.js/blob/master/packages/abstract-signer/src.ts/index.ts
*/
populateTransaction(transaction: CeloTransactionRequest): Promise<CeloTransaction>;
populateFees(tx: CeloTransactionRequest): Promise<CeloTransactionRequest>;
/**
* Override to serialize transaction using custom serialize method
* https://github.com/ethers-io/ethers.js/blob/master/packages/wallet/src.ts/index.ts
*/
signTransaction(transaction: CeloTransactionRequest): Promise<string>;
/**
* Override to serialize transaction using custom serialize method
*/
sendTransaction(transaction: CeloTransactionRequest): Promise<TransactionResponse>;
/**
* Override to skip checkTransaction step which rejects Celo tx properties
* https://github.com/ethers-io/ethers.js/blob/master/packages/abstract-signer/src.ts/index.ts
*/
estimateGas(transaction: CeloTransactionRequest): Promise<bigint>;
/**
* @remarks For cip 66 transactions it is necessary to provide the absolute limit one is willing to pay denominated in the token.
* In contrast with earlier tx types for fee currencies (celo legacy, cip42, cip 64).
* Calulating Estimation requires the gas, maxfeePerGas and the conversion rate from CELO to feeToken
* https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0066.md
*
* @dev cip66 has yet to be implemented on celo nodes. Dont add maxFeeInFeeCurrency to your transaction. use cip64
*/
estimateMaxFeeInFeeToken({ gasLimit, maxFeePerGas, feeCurrency, }: {
gasLimit: bigint;
maxFeePerGas: bigint;
feeCurrency: string;
}): Promise<bigint>;
/**
* Override to support alternative gas currencies
* @dev (for cip66 txn you want gasPrice in CELO so dont pass in the feeToken)
* https://github.com/celo-tools/ethers.js/blob/master/packages/abstract-signer/src.ts/index.ts
*/
getGasPrice(feeCurrencyAddress?: string): Promise<bigint>;
static fromMnemonic(phrase: string, path?: string, wordlist?: Wordlist | null): CeloWallet;
/**
* Override just for type fix
* https://github.com/ethers-io/ethers.js/blob/master/packages/wallet/src.ts/index.ts
*/
connect(provider: Provider | null): CeloWallet;
}