Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Velenir committed Nov 5, 2024
1 parent 5a89ef9 commit 0df1bf4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 53 deletions.
49 changes: 0 additions & 49 deletions src/helpers/providers/ethersV6.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,16 @@
import type {
Address,
ContractCallerFunctions,
NoExtraKeysCheck,
SignTypedDataContractCallerFn,
StaticContractCallerFn,
TransactionContractCallerFn,
} from '../../types';
import type {
// JsonRpcProvider,
// BaseProvider,
JsonRpcSigner,
} from '@ethersproject/providers';
// import type { Signer } from '@ethersproject/abstract-signer';
import type {
// Contract as EthersContract,
PayableOverrides,
CallOverrides,
} from '@ethersproject/contracts';
import { assertEthersContractHasMethodsV5 } from '../misc';
import { assert } from 'ts-essentials';
import type {
BrowserProvider,
JsonRpcProvider,
Provider,
Signer,
ContractRunner,
JsonRpcApiProvider,
Contract as EthersContract,
ContractMethod,
Overrides,
TypedDataDomain,
ContractTransactionResponse,
Expand All @@ -50,7 +33,6 @@ export const constructContractCaller = (

const contract = new Contract(address, abi, providerOrSigner);

// assertEthersContractHasMethodsV5(contract, contractMethod);
// drop keys not in CallOverrides
const { block, gas, ...restOverrides } = overrides;
// reassign values to keys in CallOverrides
Expand All @@ -60,22 +42,10 @@ export const constructContractCaller = (
gasLimit: gas,
};

// type FinalCallOverrides = normalizedOverrides has extra props ? never : normalizedOverrides
type FinalCallOverrides = NoExtraKeysCheck<
typeof normalizedOverrides,
Overrides
>;

const callableContractFunction = contract.getFunction(contractMethod);

// returns whatever the Contract.method returns: BigNumber, string, boolean
return callableContractFunction(...args, normalizedOverrides);

// enforce overrides shape ethers accepts
// TS will break if normalizedOverrides type has any keys not also present in CallOverrides
// const callOverrides: FinalCallOverrides = normalizedOverrides;
// // returns whatever the Contract.method returns: BigNumber, string, boolean
// return contract.callStatic[contractMethod](...args, callOverrides);
};

const transactCall: TransactionContractCallerFn<
Expand All @@ -97,7 +67,6 @@ export const constructContractCaller = (

const contract = new Contract(address, abi, signer);

// assertEthersContractHasMethodsV5(contract, contractMethod);
// drop keys not in PayableOverrides
const { gas, from, ...restOverrides } = overrides;
// reassign values to keys in PayableOverrides
Expand All @@ -115,22 +84,6 @@ export const constructContractCaller = (
);

return txResponse;

// type FinalPayableOverrides = normalizedOverrides has extra props ? never : normalizedOverrides
// type FinalPayableOverrides = NoExtraKeysCheck<
// typeof normalizedOverrides,
// PayableOverrides
// >;

// // enforce overrides shape ethers accepts
// // TS will break if normalizedOverrides type has any keys not also present in PayableOverrides
// const txOverrides: FinalPayableOverrides = normalizedOverrides;
// const txResponse: ContractTransaction = await contract[contractMethod](
// ...args,
// txOverrides
// );

// return txResponse;
};

const signTypedDataCall: SignTypedDataContractCallerFn = async (
Expand All @@ -148,8 +101,6 @@ export const constructContractCaller = (
? await providerOrSigner.getSigner(account)
: providerOrSigner;

// assert(isTypedDataCapableSigner(signer), 'Signer can sign typed data');

const { data, domain, types } = typedData;

const normalizedDomain: TypedDataDomain = {
Expand Down
4 changes: 0 additions & 4 deletions tests/nftOrders.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ import Web3 from 'web3';
import type { TransactionReceipt as Web3TransactionReceipt } from 'web3';
import { BigNumber as BigNumberEthers, Contract, ethers } from 'ethers';
import { ethers as ethersV6 } from 'ethersV6';
import type {
TransactionResponse as EthersTransactionResponse,
TransactionReceipt as EthersTransactionReceipt,
} from '@ethersproject/abstract-provider';
import { hexValue, hexZeroPad } from '@ethersproject/bytes';
import axios from 'axios';
import {
Expand Down

0 comments on commit 0df1bf4

Please sign in to comment.