Skip to content

Commit

Permalink
feat: added package to check types
Browse files Browse the repository at this point in the history
  • Loading branch information
freemanzMrojo committed Oct 29, 2024
1 parent ccf01ca commit bed76ff
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions packages/core/src/vcdm/abi/ABIContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import {
InvalidAbiItem
} from '@vechain/sdk-errors';
import {
type ContractEventName,
getAbiItem,
type AbiEvent,
type AbiFunction,
type ContractEventName,
type DecodeEventLogReturnType,
type DecodeFunctionDataReturnType,
type DecodeFunctionResultReturnType,
Expand All @@ -18,11 +18,11 @@ import { ABIEvent, type ABIEventData } from './ABIEvent';
import { ABIFunction } from './ABIFunction';

class ABIContract<TAbi extends ViemABI> extends ABI {
private readonly abi: TAbi;
private readonly viemABI: ViemABI;

constructor(abi: TAbi) {
constructor(readonly abi: TAbi) {
super();
this.abi = abi;
this.viemABI = abi as ViemABI;
}

/**
Expand All @@ -42,7 +42,7 @@ class ABIContract<TAbi extends ViemABI> extends ABI {
*/
public getFunction(name: string): ABIFunction {
const functionAbiItem = getAbiItem({
abi: this.abi as ViemABI,
abi: this.viemABI,
name
});
if (functionAbiItem === null || functionAbiItem === undefined) {
Expand All @@ -66,7 +66,7 @@ class ABIContract<TAbi extends ViemABI> extends ABI {
*/
public getEvent(name: string): ABIEvent {
const eventAbiItem = getAbiItem({
abi: this.abi as ViemABI,
abi: this.viemABI,
name
});
if (eventAbiItem === null || eventAbiItem === undefined) {
Expand Down Expand Up @@ -95,7 +95,7 @@ class ABIContract<TAbi extends ViemABI> extends ABI {
): Hex {
try {
const functionAbiItem = getAbiItem({
abi: this.abi as ViemABI,
abi: this.viemABI,
name: functionName
});
const functionAbi = new ABIFunction(functionAbiItem as AbiFunction);
Expand Down Expand Up @@ -124,7 +124,7 @@ class ABIContract<TAbi extends ViemABI> extends ABI {
): DecodeFunctionDataReturnType<TAbi> {
try {
const functionAbiItem = getAbiItem({
abi: this.abi as ViemABI,
abi: this.viemABI,
name: functionName
});
const functionAbi = new ABIFunction(functionAbiItem as AbiFunction);
Expand Down Expand Up @@ -161,7 +161,7 @@ class ABIContract<TAbi extends ViemABI> extends ABI {
): DecodeFunctionResultReturnType<TAbi> {
try {
const functionAbiItem = getAbiItem({
abi: this.abi as ViemABI,
abi: this.viemABI,
name: functionName
});
const functionAbi = new ABIFunction(functionAbiItem as AbiFunction);
Expand Down Expand Up @@ -190,7 +190,7 @@ class ABIContract<TAbi extends ViemABI> extends ABI {
): ABIEventData {
try {
const eventAbiItem = getAbiItem({
abi: this.abi as ViemABI,
abi: this.viemABI,
name: eventName
});
const eventAbi = new ABIEvent(eventAbiItem as AbiEvent);
Expand Down Expand Up @@ -218,7 +218,7 @@ class ABIContract<TAbi extends ViemABI> extends ABI {
): DecodeEventLogReturnType<TAbi, TEventName> {
try {
const eventAbiItem = getAbiItem({
abi: this.abi as ViemABI,
abi: this.viemABI,
name: eventName
});
const eventAbi = new ABIEvent(eventAbiItem as AbiEvent);
Expand Down

0 comments on commit bed76ff

Please sign in to comment.