From 3feeda229ad2db2836066b53f71157808cd4e6cd Mon Sep 17 00:00:00 2001 From: 0xsequence-bot <50996415+0xsequence-bot@users.noreply.github.com> Date: Mon, 13 Jan 2025 13:43:10 -0500 Subject: [PATCH] [AUTOMATED] Update files from 0xsequence/stack (#639) * [AUTOMATED] Update: relayer/proto/clients/relayer.gen.ts * [AUTOMATED] pnpm format * add empty chainID * [AUTOMATED] Update: relayer/proto/clients/relayer.gen.ts * [AUTOMATED] pnpm format * remove added 0 --------- Co-authored-by: VojtechVitek <139342+VojtechVitek@users.noreply.github.com> Co-authored-by: Alex Guerrieri Co-authored-by: klaidliadon <5322228+klaidliadon@users.noreply.github.com> --- packages/account/src/account.ts | 2 +- packages/core/src/commons/context.ts | 2 +- packages/core/src/v2/index.ts | 2 +- .../relayer/src/rpc-relayer/relayer.gen.ts | 165 +++++++++++++++--- 4 files changed, 144 insertions(+), 27 deletions(-) diff --git a/packages/account/src/account.ts b/packages/account/src/account.ts index 7a9e8da89..0a486c473 100644 --- a/packages/account/src/account.ts +++ b/packages/account/src/account.ts @@ -432,7 +432,7 @@ export class Account { to: this.address, data: hooksInterface.encodeFunctionData(hooksInterface.getFunction('addHook')!, [ '0x90611127', - proxyImplementationHook, + proxyImplementationHook ]), gasLimit: 50000, // Expected ~28k gas. Buffer added delegateCall: false, diff --git a/packages/core/src/commons/context.ts b/packages/core/src/commons/context.ts index 6bad5cb1b..72feabc0a 100644 --- a/packages/core/src/commons/context.ts +++ b/packages/core/src/commons/context.ts @@ -13,7 +13,7 @@ export type WalletContext = { walletCreationCode: string - proxyImplementationHook?: string; + proxyImplementationHook?: string } export function addressOf(context: WalletContext, imageHash: ethers.BytesLike) { diff --git a/packages/core/src/v2/index.ts b/packages/core/src/v2/index.ts index 98b12e1f0..d3b534bd6 100644 --- a/packages/core/src/v2/index.ts +++ b/packages/core/src/v2/index.ts @@ -22,5 +22,5 @@ export const DeployedWalletContext: WalletContext = { mainModule: '0xfBf8f1A5E00034762D928f46d438B947f5d4065d', mainModuleUpgradable: '0x4222dcA3974E39A8b41c411FeDDE9b09Ae14b911', walletCreationCode: '0x603a600e3d39601a805130553df3363d3d373d3d3d363d30545af43d82803e903d91601857fd5bf3', - proxyImplementationHook: '0x1f56dbAD5e8319F0DE9a323E24A31b5077dEB1a4', + proxyImplementationHook: '0x1f56dbAD5e8319F0DE9a323E24A31b5077dEB1a4' } diff --git a/packages/relayer/src/rpc-relayer/relayer.gen.ts b/packages/relayer/src/rpc-relayer/relayer.gen.ts index 91ce2e9b0..fa086e93f 100644 --- a/packages/relayer/src/rpc-relayer/relayer.gen.ts +++ b/packages/relayer/src/rpc-relayer/relayer.gen.ts @@ -1,7 +1,7 @@ /* eslint-disable */ -// sequence-relayer v0.4.1 1e27d0fd295aa5897878939595ef0c6adc54b1a3 +// sequence-relayer v0.4.1 904b2d766c6deda7180931a1bb558929502143fc // -- -// Code generated by webrpc-gen@v0.18.6 with typescript generator. DO NOT EDIT. +// Code generated by webrpc-gen@v0.20.3 with typescript generator. DO NOT EDIT. // // webrpc-gen -schema=relayer.ridl -target=typescript -client -out=./clients/relayer.gen.ts @@ -12,7 +12,7 @@ export const WebRPCVersion = 'v1' export const WebRPCSchemaVersion = 'v0.4.1' // Schema hash generated from your RIDL schema -export const WebRPCSchemaHash = '1e27d0fd295aa5897878939595ef0c6adc54b1a3' +export const WebRPCSchemaHash = '904b2d766c6deda7180931a1bb558929502143fc' // // Types @@ -62,10 +62,10 @@ export interface RuntimeStatus { ver: string branch: string commitHash: string + chainID: number useEIP1559: boolean senders: Array checks: RuntimeChecks - numTxnsRelayed: NumTxnsRelayed } export interface SenderStatus { @@ -77,12 +77,6 @@ export interface SenderStatus { export interface RuntimeChecks {} -export interface NumTxnsRelayed { - prev: number - current: number - period: number -} - export interface SequenceContext { factory: string mainModule: string @@ -93,6 +87,7 @@ export interface SequenceContext { export interface GasTank { id: number + chainId: number name: string currentBalance: number unlimited: boolean @@ -114,6 +109,7 @@ export interface GasSponsor { id: number gasTankId: number projectId: number + chainId: number address: string name: string active: boolean @@ -142,6 +138,7 @@ export interface MetaTxn { export interface MetaTxnLog { id: number + chainId: number projectId: number txnHash: string txnNonce: string @@ -172,17 +169,6 @@ export interface MetaTxnLog { createdAt: string } -export interface MetaTxnEntry { - id: number - metaTxnID: string - txnStatus: ETHTxnStatus - txnRevertReason: string - index: number - logs?: Array - updatedAt: string - createdAt: string -} - export interface MetaTxnReceipt { id: string status: string @@ -293,6 +279,7 @@ export interface Relayer { signal?: AbortSignal ): Promise getMetaTransactions(args: GetMetaTransactionsArgs, headers?: object, signal?: AbortSignal): Promise + getTransactionCost(args: GetTransactionCostArgs, headers?: object, signal?: AbortSignal): Promise sentTransactions(args: SentTransactionsArgs, headers?: object, signal?: AbortSignal): Promise pendingTransactions(args: PendingTransactionsArgs, headers?: object, signal?: AbortSignal): Promise getGasTank(args: GetGasTankArgs, headers?: object, signal?: AbortSignal): Promise @@ -329,6 +316,12 @@ export interface Relayer { headers?: object, signal?: AbortSignal ): Promise + getProjectBalance(args: GetProjectBalanceArgs, headers?: object, signal?: AbortSignal): Promise + adjustProjectBalance( + args: AdjustProjectBalanceArgs, + headers?: object, + signal?: AbortSignal + ): Promise } export interface PingArgs {} @@ -359,6 +352,7 @@ export interface GetChainIDReturn { export interface SendMetaTxnArgs { call: MetaTxn quote?: string + projectID?: number } export interface SendMetaTxnReturn { @@ -433,6 +427,15 @@ export interface GetMetaTransactionsReturn { page: Page transactions: Array } +export interface GetTransactionCostArgs { + projectId: number + from: string + to: string +} + +export interface GetTransactionCostReturn { + cost: number +} export interface SentTransactionsArgs { filter?: SentTransactionsFilter page?: Page @@ -577,6 +580,22 @@ export interface ListGasTankBalanceAdjustmentsReturn { page: Page adjustments: Array } +export interface GetProjectBalanceArgs { + projectId: number +} + +export interface GetProjectBalanceReturn { + balance: number +} +export interface AdjustProjectBalanceArgs { + projectId: number + amount: number + identifier: string +} + +export interface AdjustProjectBalanceReturn { + balance: number +} // // Client @@ -587,7 +606,7 @@ export class Relayer implements Relayer { protected path = '/rpc/Relayer/' constructor(hostname: string, fetch: Fetch) { - this.hostname = hostname + this.hostname = hostname.replace(/\/*$/, '') this.fetch = (input: RequestInfo, init?: RequestInit) => fetch(input, init) } @@ -822,6 +841,25 @@ export class Relayer implements Relayer { ) } + getTransactionCost = ( + args: GetTransactionCostArgs, + headers?: object, + signal?: AbortSignal + ): Promise => { + return this.fetch(this.url('GetTransactionCost'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + cost: _data.cost + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + sentTransactions = (args: SentTransactionsArgs, headers?: object, signal?: AbortSignal): Promise => { return this.fetch(this.url('SentTransactions'), createHTTPRequest(args, headers, signal)).then( res => { @@ -1099,6 +1137,40 @@ export class Relayer implements Relayer { } ) } + + getProjectBalance = (args: GetProjectBalanceArgs, headers?: object, signal?: AbortSignal): Promise => { + return this.fetch(this.url('GetProjectBalance'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + balance: _data.balance + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } + + adjustProjectBalance = ( + args: AdjustProjectBalanceArgs, + headers?: object, + signal?: AbortSignal + ): Promise => { + return this.fetch(this.url('AdjustProjectBalance'), createHTTPRequest(args, headers, signal)).then( + res => { + return buildResponse(res).then(_data => { + return { + balance: _data.balance + } + }) + }, + error => { + throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) + } + ) + } } const createHTTPRequest = (body: object = {}, headers: object = {}, signal: AbortSignal | null = null): object => { @@ -1349,6 +1421,19 @@ export class MethodNotFoundError extends WebrpcError { } } +export class RequestConflictError extends WebrpcError { + constructor( + name: string = 'RequestConflict', + code: number = 1004, + message: string = 'Conflict with target resource', + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, RequestConflictError.prototype) + } +} + export class AbortedError extends WebrpcError { constructor( name: string = 'Aborted', @@ -1362,6 +1447,19 @@ export class AbortedError extends WebrpcError { } } +export class GeoblockedError extends WebrpcError { + constructor( + name: string = 'Geoblocked', + code: number = 1006, + message: string = 'Geoblocked region', + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, GeoblockedError.prototype) + } +} + export class InvalidArgumentError extends WebrpcError { constructor( name: string = 'InvalidArgument', @@ -1414,6 +1512,19 @@ export class NotFoundError extends WebrpcError { } } +export class InsufficientFeeError extends WebrpcError { + constructor( + name: string = 'InsufficientFee', + code: number = 3004, + message: string = 'Insufficient fee', + status: number = 0, + cause?: string + ) { + super(name, code, message, status, cause) + Object.setPrototypeOf(this, InsufficientFeeError.prototype) + } +} + export enum errors { WebrpcEndpoint = 'WebrpcEndpoint', WebrpcRequestFailed = 'WebrpcRequestFailed', @@ -1429,11 +1540,14 @@ export enum errors { Unauthorized = 'Unauthorized', PermissionDenied = 'PermissionDenied', MethodNotFound = 'MethodNotFound', + RequestConflict = 'RequestConflict', Aborted = 'Aborted', + Geoblocked = 'Geoblocked', InvalidArgument = 'InvalidArgument', Unavailable = 'Unavailable', QueryFailed = 'QueryFailed', - NotFound = 'NotFound' + NotFound = 'NotFound', + InsufficientFee = 'InsufficientFee' } const webrpcErrorByCode: { [code: number]: any } = { @@ -1451,11 +1565,14 @@ const webrpcErrorByCode: { [code: number]: any } = { [1000]: UnauthorizedError, [1001]: PermissionDeniedError, [1003]: MethodNotFoundError, + [1004]: RequestConflictError, [1005]: AbortedError, + [1006]: GeoblockedError, [2001]: InvalidArgumentError, [2002]: UnavailableError, [2003]: QueryFailedError, - [3000]: NotFoundError + [3000]: NotFoundError, + [3004]: InsufficientFeeError } export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise