Skip to content

Commit

Permalink
fix: ethers import (#1033)
Browse files Browse the repository at this point in the history
  • Loading branch information
Valazan authored Jul 9, 2024
1 parent b90d6f7 commit e933b75
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { RPC_METHODS } from '../../../provider';
import { VeChainAbstractSigner } from '../vechain-abstract-signer';
import { assert, JSONRPC, TRANSACTION } from '@vechain/sdk-errors';
import { assertTransactionCanBeSigned } from '../../../assertions';
import { ethers } from 'ethers';
import { vechain_sdk_core_ethers } from '@vechain/sdk-core';
import {
addressUtils,
Hex,
Expand All @@ -13,8 +13,7 @@ import {
secp256k1,
Transaction,
type TransactionBody,
TransactionHandler,
type vechain_sdk_core_ethers
TransactionHandler
} from '@vechain/sdk-core';
import {
type AvailableVeChainProviders,
Expand Down Expand Up @@ -180,7 +179,11 @@ class VeChainPrivateKeySigner extends VeChainAbstractSigner {
try {
const hash = n_utils.hexToBytes(
Hex.canon(
ethers.TypedDataEncoder.hash(domain, types, value)
vechain_sdk_core_ethers.TypedDataEncoder.hash(
domain,
types,
value
)
)
);
const sign = secp256k1.sign(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { type ThorClient } from '../thor-client';
import { type ExpandedBlockDetail } from '../blocks';
import { blocksFormatter, getTransactionIndexIntoBlock } from '../../provider';
import { type CallNameReturnType } from '../debug';
import { ethers } from 'ethers';
import { vechain_sdk_core_ethers } from '@vechain/sdk-core';

/**
* The `TransactionsModule` handles transaction related operations and provides
Expand Down Expand Up @@ -434,12 +434,14 @@ class TransactionsModule {
else {
// An error fragment is provided, so decode the revert reason using solidity error
if (errorFragment !== undefined) {
const errorInterface = new ethers.Interface([
ethers.ErrorFragment.from(errorFragment)
const errorInterface = new vechain_sdk_core_ethers.Interface([
vechain_sdk_core_ethers.ErrorFragment.from(errorFragment)
]);
return errorInterface
.decodeErrorResult(
ethers.ErrorFragment.from(errorFragment),
vechain_sdk_core_ethers.ErrorFragment.from(
errorFragment
),
encodedRevertReason
)
.toArray()[0] as string;
Expand Down

1 comment on commit e933b75

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Coverage

Summary

Lines Statements Branches Functions
Coverage: 100%
100% (3464/3464) 100% (814/814) 100% (718/718)
Title Tests Skipped Failures Errors Time
core 503 0 💤 0 ❌ 0 🔥 1m 4s ⏱️
network 669 0 💤 0 ❌ 0 🔥 3m 55s ⏱️
errors 48 0 💤 0 ❌ 0 🔥 10.781s ⏱️

Please sign in to comment.