UNPKG

@celo-tools/celo-ethers-wrapper

Version:

A minimal wrapper to make Ethers.JS compatible with the Celo network.

50 lines (49 loc) 1.94 kB
import { BytesLike, SignatureLike, TransactionLike, TransactionRequest } from "ethers"; export interface CeloTransactionRequest extends TransactionRequest { feeCurrency?: string; maxFeeInFeeCurrency?: bigint; } export interface CeloTransactionCip64 extends TransactionLike { type: TxTypeToPrefix.cip64; feeCurrency: string; } export interface CeloTransactionCip66 extends TransactionLike { type: TxTypeToPrefix.cip66; feeCurrency: string; maxFeeInFeeCurrency: bigint; } export interface CeloTransactionEip1559 extends TransactionLike { type: TxTypeToPrefix.eip1559; } export type CeloTransaction = CeloTransactionCip64 | CeloTransactionCip66 | CeloTransactionEip1559 | TransactionLike; export declare enum TxTypeToPrefix { cip64 = 123, cip66 = 122, eip1559 = 2 } interface Field { maxLength?: number; length?: number; numeric?: true; } export declare const celoAllowedTransactionKeys: { readonly type: true; readonly chainId: true; readonly data: true; readonly gasLimit: true; readonly gasPrice: true; readonly nonce: true; readonly to: true; readonly value: true; readonly feeCurrency: true; readonly maxFeePerGas: true; readonly maxPriorityFeePerGas: true; readonly accessList: true; readonly maxFeeInFeeCurrency: true; }; type CeloFieldName = keyof Omit<CeloTransactionRequest, "type" | "chainId" | "r" | "s" | "v" | "hash" | "accessList" | "from" | "customData" | "ccipReadEnabled" | "blockTag" | "enableCcipRead"> | "feeCurrency" | "maxFeeInFeeCurrency"; export declare const celoTransactionFields: Record<CeloFieldName, Field>; export declare function getTxType(tx: CeloTransaction): "" | TxTypeToPrefix; export declare function serializeCeloTransaction(transaction: CeloTransactionRequest, signature?: SignatureLike): string; export declare function parseCeloTransaction(rawTransaction: BytesLike): CeloTransaction; export {};