@sei-js/evm
Version:
TypeScript library for EVM interactions on the Sei blockchain
38 lines (37 loc) • 1.8 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getGovernancePrecompileEthersV6Contract = exports.ETHERS_GOVERNANCE_PRECOMPILE_ABI = void 0;
const ethers_1 = require("ethers");
const precompiles_1 = require("../precompiles");
/**
* The ABI for the Governance precompile contract, used to create an Ethers contract.
* @category Cosmos Interoperability
*/
exports.ETHERS_GOVERNANCE_PRECOMPILE_ABI = precompiles_1.GOVERNANCE_PRECOMPILE_ABI;
/**
* Creates and returns a typed Ethers v6 contract instance for the Governance precompile contract.
* This contract is used for interoperability between the EVM and Cosmos.
*
* @example
* ```tsx
* import { getGovernancePrecompileEthersV6Contract, parseSei } from '@sei-js/evm/ethers';
* import { ethers } from 'ethers';
*
* const provider = new ethers.BrowserProvider(); // or any other provider
* const signer = provider.getSigner();
*
* const governancePrecompileContract = getGovernancePrecompileEthersV6Contract(signer);
*
* // Surround with try/catch for detailed errors
* const depositResponse = await governancePrecompileContract.connect(signer).deposit('1', { value: parseSei(1) });
* console.log('Deposit Response:', depositResponse);
* ```
*
* @param runner A [Provider](https://docs.ethers.org/v6/api/providers/) (read-only) or ethers.Signer to use with the contract.
* @returns The typed contract instance for interacting with the Governance precompile contract.
* @category Cosmos Interoperability
*/
const getGovernancePrecompileEthersV6Contract = (runner) => {
return new ethers_1.Contract(precompiles_1.GOVERNANCE_PRECOMPILE_ADDRESS, exports.ETHERS_GOVERNANCE_PRECOMPILE_ABI, runner);
};
exports.getGovernancePrecompileEthersV6Contract = getGovernancePrecompileEthersV6Contract;