@sei-js/evm
Version:
TypeScript library for EVM interactions on the Sei blockchain
39 lines (38 loc) • 1.73 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStakingPrecompileEthersV6Contract = exports.ETHERS_STAKING_PRECOMPILE_ABI = void 0;
const ethers_1 = require("ethers");
const precompiles_1 = require("../precompiles");
/**
* The ABI for the Staking precompile contract, used to create an Ethers contract.
* @category Cosmos Interoperability
*/
exports.ETHERS_STAKING_PRECOMPILE_ABI = precompiles_1.STAKING_PRECOMPILE_ABI;
/**
* Creates and returns a typed Ethers v6 contract instance for the Staking precompile contract.
* This contract is used for interoperability between the EVM and Cosmos.
*
* @example
* ```tsx
* import { getStakingPrecompileEthersV6Contract, parseSei } from '@sei-js/evm';
* import { ethers } from 'ethers';
*
* const provider = new ethers.BrowserProvider(window.ethereum); // or any other provider
* const signer = await provider.getSigner();
*
* const accounts = await provider.send('eth_requestAccounts', []);
*
* const contract = getStakingPrecompileEthersV6Contract(signer);
*
* const response = await contract.delegate('0xVALIDATOR_ADDRESS', parseSei(1));
* console.log('Delegate Response:', response);
* ```
*
* @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 Staking precompile contract.
* @category Cosmos Interoperability
*/
const getStakingPrecompileEthersV6Contract = (runner) => {
return new ethers_1.Contract(precompiles_1.STAKING_PRECOMPILE_ADDRESS, exports.ETHERS_STAKING_PRECOMPILE_ABI, runner);
};
exports.getStakingPrecompileEthersV6Contract = getStakingPrecompileEthersV6Contract;