Skip to content

Commit

Permalink
fix: conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
alainncls committed Oct 23, 2023
1 parent 2d07e0f commit e8ebfa5
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions sdk/src/dataMapper/SchemaDataMapper.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Address, Hash } from "viem";
import { Address } from "viem";
import { Schema_filter, Schema_orderBy } from "../../.graphclient";
import { Schema } from "../types";
import { handleError } from "../utils/errorHandler";
import BaseDataMapper from "./BaseDataMapper";
import { abiSchemaRegistry } from "../abi/SchemaRegistry";
import { executeTransaction } from "../utils/transactionSender";

export default class SchemaDataMapper extends BaseDataMapper<Schema, Schema_filter, Schema_orderBy> {
typeName = "schema";
Expand All @@ -21,7 +22,7 @@ export default class SchemaDataMapper extends BaseDataMapper<Schema, Schema_filt

async updateRouter(routerAddress: Address) {
const request = await this.simulateUpdateRouter(routerAddress);
return this.executeTransaction(request);
return executeTransaction(this.walletClient, request);
}

async simulateCreate(name: string, description: string, context: string, schemaString: string) {
Expand All @@ -30,7 +31,7 @@ export default class SchemaDataMapper extends BaseDataMapper<Schema, Schema_filt

async create(name: string, description: string, context: string, schemaString: string) {
const request = await this.simulateCreate(name, description, context, schemaString);
return this.executeTransaction(request);
return executeTransaction(this.walletClient, request);
}

async simulateUpdateContext(schemaId: string, context: string) {
Expand All @@ -39,7 +40,7 @@ export default class SchemaDataMapper extends BaseDataMapper<Schema, Schema_filt

async updateContext(schemaId: string, context: string) {
const request = await this.simulateUpdateContext(schemaId, context);
return this.executeTransaction(request);
return executeTransaction(this.walletClient, request);
}

async getIdFromSchemaString(schema: string) {
Expand Down Expand Up @@ -72,7 +73,6 @@ export default class SchemaDataMapper extends BaseDataMapper<Schema, Schema_filt
});
}

// TODO: Use correct type for args
private async simulateContract(functionName: string, args: unknown[]) {
try {
const { request } = await this.web3Client.simulateContract({
Expand All @@ -88,12 +88,4 @@ export default class SchemaDataMapper extends BaseDataMapper<Schema, Schema_filt
handleError(err);
}
}

// TODO: Use correct type for request
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private async executeTransaction(request: any) {
const hash: Hash = await this.walletClient.writeContract(request);
console.log(`Transaction sent with hash ${hash}`);
return hash;
}
}

0 comments on commit e8ebfa5

Please sign in to comment.