Skip to content

Commit

Permalink
pnpm format && pnpm lint:fix
Browse files Browse the repository at this point in the history
  • Loading branch information
attente committed Jan 15, 2025
1 parent ff47085 commit be11137
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 14 deletions.
13 changes: 10 additions & 3 deletions packages/relayer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,20 @@ export interface Relayer {
): Promise<commons.transaction.TransactionResponse>

// getMetaTransactions returns a list of meta transactions for a given project and gas tank
getMetaTransactions(projectId: number, page?: proto.Page): Promise<{
page: proto.Page,
getMetaTransactions(
projectId: number,
page?: proto.Page
): Promise<{
page: proto.Page
transactions: proto.MetaTxnLog[]
}>

// getTransactionCost returns the used fee cost for gas tank during a given period
getTransactionCost(projectId: number, from: string, to: string): Promise<{
getTransactionCost(
projectId: number,
from: string,
to: string
): Promise<{
cost: number
}>
}
Expand Down
13 changes: 10 additions & 3 deletions packages/relayer/src/local-relayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,21 @@ export class LocalRelayer extends ProviderRelayer implements Relayer {
}
}

async getMetaTransactions(projectId: number, page?: proto.Page): Promise<{
page: proto.Page,
async getMetaTransactions(
projectId: number,
page?: proto.Page
): Promise<{
page: proto.Page
transactions: proto.MetaTxnLog[]
}> {
return { page: { page: 0, pageSize: 100 }, transactions: [] }
}

async getTransactionCost(projectId: number, from: string, to: string): Promise<{
async getTransactionCost(
projectId: number,
from: string,
to: string
): Promise<{
cost: number
}> {
return { cost: 0 }
Expand Down
15 changes: 10 additions & 5 deletions packages/relayer/src/provider-relayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,19 @@ export abstract class ProviderRelayer implements Relayer {
waitForReceipt?: boolean
): Promise<commons.transaction.TransactionResponse>

abstract getTransactionCost(projectId: number, from: string, to: string): Promise<{
abstract getTransactionCost(
projectId: number,
from: string,
to: string
): Promise<{
cost: number
}>

abstract getMetaTransactions(projectId: number, page?: proto.Page): Promise<{
page: proto.Page,
abstract getMetaTransactions(
projectId: number,
page?: proto.Page
): Promise<{
page: proto.Page
transactions: proto.MetaTxnLog[]
}>

Expand Down Expand Up @@ -257,8 +264,6 @@ export abstract class ProviderRelayer implements Relayer {
return waitReceipt()
}
}


}

function isAbstractProvider(provider: any): provider is ethers.AbstractProvider {
Expand Down
13 changes: 10 additions & 3 deletions packages/relayer/src/rpc-relayer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,21 @@ export class RpcRelayer implements Relayer {
} as commons.transaction.TransactionResponse
}

async getMetaTransactions(projectId: number, page?: proto.Page): Promise<{
page: proto.Page,
async getMetaTransactions(
projectId: number,
page?: proto.Page
): Promise<{
page: proto.Page
transactions: proto.MetaTxnLog[]
}> {
return this.service.getMetaTransactions({ projectId, page })
}

async getTransactionCost(projectId: number, from: string, to: string): Promise<{
async getTransactionCost(
projectId: number,
from: string,
to: string
): Promise<{
cost: number
}> {
return this.service.getTransactionCost({ projectId, from, to })
Expand Down

0 comments on commit be11137

Please sign in to comment.