@0xsequence/relayer
Advanced tools
Comparing version 2.2.5 to 2.2.6
@@ -244,2 +244,16 @@ 'use strict'; | ||
} | ||
async getMetaTransactions(projectId, page) { | ||
return { | ||
page: { | ||
page: 0, | ||
pageSize: 100 | ||
}, | ||
transactions: [] | ||
}; | ||
} | ||
async getTransactionCost(projectId, from, to) { | ||
return { | ||
cost: 0 | ||
}; | ||
} | ||
} | ||
@@ -251,5 +265,5 @@ function isAbstractSigner(signer) { | ||
/* eslint-disable */ | ||
// sequence-relayer v0.4.1 1e27d0fd295aa5897878939595ef0c6adc54b1a3 | ||
// sequence-relayer v0.4.1 dd95e21fa884c6564199bc3dd5f588534827ffe2 | ||
// -- | ||
// 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. | ||
// | ||
@@ -265,3 +279,3 @@ // webrpc-gen -schema=relayer.ridl -target=typescript -client -out=./clients/relayer.gen.ts | ||
// Schema hash generated from your RIDL schema | ||
const WebRPCSchemaHash = '1e27d0fd295aa5897878939595ef0c6adc54b1a3'; | ||
const WebRPCSchemaHash = 'dd95e21fa884c6564199bc3dd5f588534827ffe2'; | ||
@@ -497,2 +511,15 @@ // | ||
}; | ||
this.getTransactionCost = (args, headers, signal) => { | ||
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 || ''}` | ||
}); | ||
}); | ||
}; | ||
this.sentTransactions = (args, headers, signal) => { | ||
@@ -716,3 +743,29 @@ return this.fetch(this.url('SentTransactions'), createHTTPRequest(args, headers, signal)).then(res => { | ||
}; | ||
this.hostname = hostname; | ||
this.getProjectBalance = (args, headers, signal) => { | ||
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 || ''}` | ||
}); | ||
}); | ||
}; | ||
this.adjustProjectBalance = (args, headers, signal) => { | ||
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 || ''}` | ||
}); | ||
}); | ||
}; | ||
this.hostname = hostname.replace(/\/*$/, ''); | ||
this.fetch = (input, init) => fetch(input, init); | ||
@@ -873,2 +926,8 @@ } | ||
} | ||
class RequestConflictError extends WebrpcError { | ||
constructor(name = 'RequestConflict', code = 1004, message = 'Conflict with target resource', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, RequestConflictError.prototype); | ||
} | ||
} | ||
class AbortedError extends WebrpcError { | ||
@@ -880,2 +939,8 @@ constructor(name = 'Aborted', code = 1005, message = 'Request aborted', status = 0, cause) { | ||
} | ||
class GeoblockedError extends WebrpcError { | ||
constructor(name = 'Geoblocked', code = 1006, message = 'Geoblocked region', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, GeoblockedError.prototype); | ||
} | ||
} | ||
class InvalidArgumentError extends WebrpcError { | ||
@@ -905,2 +970,8 @@ constructor(name = 'InvalidArgument', code = 2001, message = 'Invalid argument', status = 0, cause) { | ||
} | ||
class InsufficientFeeError extends WebrpcError { | ||
constructor(name = 'InsufficientFee', code = 3004, message = 'Insufficient fee', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, InsufficientFeeError.prototype); | ||
} | ||
} | ||
let errors = /*#__PURE__*/function (errors) { | ||
@@ -921,3 +992,5 @@ errors["WebrpcEndpoint"] = "WebrpcEndpoint"; | ||
errors["MethodNotFound"] = "MethodNotFound"; | ||
errors["RequestConflict"] = "RequestConflict"; | ||
errors["Aborted"] = "Aborted"; | ||
errors["Geoblocked"] = "Geoblocked"; | ||
errors["InvalidArgument"] = "InvalidArgument"; | ||
@@ -927,2 +1000,3 @@ errors["Unavailable"] = "Unavailable"; | ||
errors["NotFound"] = "NotFound"; | ||
errors["InsufficientFee"] = "InsufficientFee"; | ||
return errors; | ||
@@ -945,7 +1019,10 @@ }({}); | ||
[1003]: MethodNotFoundError, | ||
[1004]: RequestConflictError, | ||
[1005]: AbortedError, | ||
[1006]: GeoblockedError, | ||
[2001]: InvalidArgumentError, | ||
[2002]: UnavailableError, | ||
[2003]: QueryFailedError, | ||
[3000]: NotFoundError | ||
[3000]: NotFoundError, | ||
[3004]: InsufficientFeeError | ||
}; | ||
@@ -978,3 +1055,5 @@ | ||
MethodNotFoundError: MethodNotFoundError, | ||
RequestConflictError: RequestConflictError, | ||
AbortedError: AbortedError, | ||
GeoblockedError: GeoblockedError, | ||
InvalidArgumentError: InvalidArgumentError, | ||
@@ -984,2 +1063,3 @@ UnavailableError: UnavailableError, | ||
NotFoundError: NotFoundError, | ||
InsufficientFeeError: InsufficientFeeError, | ||
errors: errors | ||
@@ -1237,2 +1317,15 @@ }); | ||
} | ||
async getMetaTransactions(projectId, page) { | ||
return this.service.getMetaTransactions({ | ||
projectId, | ||
page | ||
}); | ||
} | ||
async getTransactionCost(projectId, from, to) { | ||
return this.service.getTransactionCost({ | ||
projectId, | ||
from, | ||
to | ||
}); | ||
} | ||
} | ||
@@ -1239,0 +1332,0 @@ class MetaTransactionResponseException { |
@@ -244,2 +244,16 @@ 'use strict'; | ||
} | ||
async getMetaTransactions(projectId, page) { | ||
return { | ||
page: { | ||
page: 0, | ||
pageSize: 100 | ||
}, | ||
transactions: [] | ||
}; | ||
} | ||
async getTransactionCost(projectId, from, to) { | ||
return { | ||
cost: 0 | ||
}; | ||
} | ||
} | ||
@@ -251,5 +265,5 @@ function isAbstractSigner(signer) { | ||
/* eslint-disable */ | ||
// sequence-relayer v0.4.1 1e27d0fd295aa5897878939595ef0c6adc54b1a3 | ||
// sequence-relayer v0.4.1 dd95e21fa884c6564199bc3dd5f588534827ffe2 | ||
// -- | ||
// 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. | ||
// | ||
@@ -265,3 +279,3 @@ // webrpc-gen -schema=relayer.ridl -target=typescript -client -out=./clients/relayer.gen.ts | ||
// Schema hash generated from your RIDL schema | ||
const WebRPCSchemaHash = '1e27d0fd295aa5897878939595ef0c6adc54b1a3'; | ||
const WebRPCSchemaHash = 'dd95e21fa884c6564199bc3dd5f588534827ffe2'; | ||
@@ -497,2 +511,15 @@ // | ||
}; | ||
this.getTransactionCost = (args, headers, signal) => { | ||
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 || ''}` | ||
}); | ||
}); | ||
}; | ||
this.sentTransactions = (args, headers, signal) => { | ||
@@ -716,3 +743,29 @@ return this.fetch(this.url('SentTransactions'), createHTTPRequest(args, headers, signal)).then(res => { | ||
}; | ||
this.hostname = hostname; | ||
this.getProjectBalance = (args, headers, signal) => { | ||
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 || ''}` | ||
}); | ||
}); | ||
}; | ||
this.adjustProjectBalance = (args, headers, signal) => { | ||
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 || ''}` | ||
}); | ||
}); | ||
}; | ||
this.hostname = hostname.replace(/\/*$/, ''); | ||
this.fetch = (input, init) => fetch(input, init); | ||
@@ -873,2 +926,8 @@ } | ||
} | ||
class RequestConflictError extends WebrpcError { | ||
constructor(name = 'RequestConflict', code = 1004, message = 'Conflict with target resource', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, RequestConflictError.prototype); | ||
} | ||
} | ||
class AbortedError extends WebrpcError { | ||
@@ -880,2 +939,8 @@ constructor(name = 'Aborted', code = 1005, message = 'Request aborted', status = 0, cause) { | ||
} | ||
class GeoblockedError extends WebrpcError { | ||
constructor(name = 'Geoblocked', code = 1006, message = 'Geoblocked region', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, GeoblockedError.prototype); | ||
} | ||
} | ||
class InvalidArgumentError extends WebrpcError { | ||
@@ -905,2 +970,8 @@ constructor(name = 'InvalidArgument', code = 2001, message = 'Invalid argument', status = 0, cause) { | ||
} | ||
class InsufficientFeeError extends WebrpcError { | ||
constructor(name = 'InsufficientFee', code = 3004, message = 'Insufficient fee', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, InsufficientFeeError.prototype); | ||
} | ||
} | ||
let errors = /*#__PURE__*/function (errors) { | ||
@@ -921,3 +992,5 @@ errors["WebrpcEndpoint"] = "WebrpcEndpoint"; | ||
errors["MethodNotFound"] = "MethodNotFound"; | ||
errors["RequestConflict"] = "RequestConflict"; | ||
errors["Aborted"] = "Aborted"; | ||
errors["Geoblocked"] = "Geoblocked"; | ||
errors["InvalidArgument"] = "InvalidArgument"; | ||
@@ -927,2 +1000,3 @@ errors["Unavailable"] = "Unavailable"; | ||
errors["NotFound"] = "NotFound"; | ||
errors["InsufficientFee"] = "InsufficientFee"; | ||
return errors; | ||
@@ -945,7 +1019,10 @@ }({}); | ||
[1003]: MethodNotFoundError, | ||
[1004]: RequestConflictError, | ||
[1005]: AbortedError, | ||
[1006]: GeoblockedError, | ||
[2001]: InvalidArgumentError, | ||
[2002]: UnavailableError, | ||
[2003]: QueryFailedError, | ||
[3000]: NotFoundError | ||
[3000]: NotFoundError, | ||
[3004]: InsufficientFeeError | ||
}; | ||
@@ -978,3 +1055,5 @@ | ||
MethodNotFoundError: MethodNotFoundError, | ||
RequestConflictError: RequestConflictError, | ||
AbortedError: AbortedError, | ||
GeoblockedError: GeoblockedError, | ||
InvalidArgumentError: InvalidArgumentError, | ||
@@ -984,2 +1063,3 @@ UnavailableError: UnavailableError, | ||
NotFoundError: NotFoundError, | ||
InsufficientFeeError: InsufficientFeeError, | ||
errors: errors | ||
@@ -1237,2 +1317,15 @@ }); | ||
} | ||
async getMetaTransactions(projectId, page) { | ||
return this.service.getMetaTransactions({ | ||
projectId, | ||
page | ||
}); | ||
} | ||
async getTransactionCost(projectId, from, to) { | ||
return this.service.getTransactionCost({ | ||
projectId, | ||
from, | ||
to | ||
}); | ||
} | ||
} | ||
@@ -1239,0 +1332,0 @@ class MetaTransactionResponseException { |
@@ -240,2 +240,16 @@ import { logger, getFetchRequest, bigintReplacer, toHexString } from '@0xsequence/utils'; | ||
} | ||
async getMetaTransactions(projectId, page) { | ||
return { | ||
page: { | ||
page: 0, | ||
pageSize: 100 | ||
}, | ||
transactions: [] | ||
}; | ||
} | ||
async getTransactionCost(projectId, from, to) { | ||
return { | ||
cost: 0 | ||
}; | ||
} | ||
} | ||
@@ -247,5 +261,5 @@ function isAbstractSigner(signer) { | ||
/* eslint-disable */ | ||
// sequence-relayer v0.4.1 1e27d0fd295aa5897878939595ef0c6adc54b1a3 | ||
// sequence-relayer v0.4.1 dd95e21fa884c6564199bc3dd5f588534827ffe2 | ||
// -- | ||
// 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. | ||
// | ||
@@ -261,3 +275,3 @@ // webrpc-gen -schema=relayer.ridl -target=typescript -client -out=./clients/relayer.gen.ts | ||
// Schema hash generated from your RIDL schema | ||
const WebRPCSchemaHash = '1e27d0fd295aa5897878939595ef0c6adc54b1a3'; | ||
const WebRPCSchemaHash = 'dd95e21fa884c6564199bc3dd5f588534827ffe2'; | ||
@@ -493,2 +507,15 @@ // | ||
}; | ||
this.getTransactionCost = (args, headers, signal) => { | ||
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 || ''}` | ||
}); | ||
}); | ||
}; | ||
this.sentTransactions = (args, headers, signal) => { | ||
@@ -712,3 +739,29 @@ return this.fetch(this.url('SentTransactions'), createHTTPRequest(args, headers, signal)).then(res => { | ||
}; | ||
this.hostname = hostname; | ||
this.getProjectBalance = (args, headers, signal) => { | ||
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 || ''}` | ||
}); | ||
}); | ||
}; | ||
this.adjustProjectBalance = (args, headers, signal) => { | ||
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 || ''}` | ||
}); | ||
}); | ||
}; | ||
this.hostname = hostname.replace(/\/*$/, ''); | ||
this.fetch = (input, init) => fetch(input, init); | ||
@@ -869,2 +922,8 @@ } | ||
} | ||
class RequestConflictError extends WebrpcError { | ||
constructor(name = 'RequestConflict', code = 1004, message = 'Conflict with target resource', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, RequestConflictError.prototype); | ||
} | ||
} | ||
class AbortedError extends WebrpcError { | ||
@@ -876,2 +935,8 @@ constructor(name = 'Aborted', code = 1005, message = 'Request aborted', status = 0, cause) { | ||
} | ||
class GeoblockedError extends WebrpcError { | ||
constructor(name = 'Geoblocked', code = 1006, message = 'Geoblocked region', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, GeoblockedError.prototype); | ||
} | ||
} | ||
class InvalidArgumentError extends WebrpcError { | ||
@@ -901,2 +966,8 @@ constructor(name = 'InvalidArgument', code = 2001, message = 'Invalid argument', status = 0, cause) { | ||
} | ||
class InsufficientFeeError extends WebrpcError { | ||
constructor(name = 'InsufficientFee', code = 3004, message = 'Insufficient fee', status = 0, cause) { | ||
super(name, code, message, status, cause); | ||
Object.setPrototypeOf(this, InsufficientFeeError.prototype); | ||
} | ||
} | ||
let errors = /*#__PURE__*/function (errors) { | ||
@@ -917,3 +988,5 @@ errors["WebrpcEndpoint"] = "WebrpcEndpoint"; | ||
errors["MethodNotFound"] = "MethodNotFound"; | ||
errors["RequestConflict"] = "RequestConflict"; | ||
errors["Aborted"] = "Aborted"; | ||
errors["Geoblocked"] = "Geoblocked"; | ||
errors["InvalidArgument"] = "InvalidArgument"; | ||
@@ -923,2 +996,3 @@ errors["Unavailable"] = "Unavailable"; | ||
errors["NotFound"] = "NotFound"; | ||
errors["InsufficientFee"] = "InsufficientFee"; | ||
return errors; | ||
@@ -941,7 +1015,10 @@ }({}); | ||
[1003]: MethodNotFoundError, | ||
[1004]: RequestConflictError, | ||
[1005]: AbortedError, | ||
[1006]: GeoblockedError, | ||
[2001]: InvalidArgumentError, | ||
[2002]: UnavailableError, | ||
[2003]: QueryFailedError, | ||
[3000]: NotFoundError | ||
[3000]: NotFoundError, | ||
[3004]: InsufficientFeeError | ||
}; | ||
@@ -974,3 +1051,5 @@ | ||
MethodNotFoundError: MethodNotFoundError, | ||
RequestConflictError: RequestConflictError, | ||
AbortedError: AbortedError, | ||
GeoblockedError: GeoblockedError, | ||
InvalidArgumentError: InvalidArgumentError, | ||
@@ -980,2 +1059,3 @@ UnavailableError: UnavailableError, | ||
NotFoundError: NotFoundError, | ||
InsufficientFeeError: InsufficientFeeError, | ||
errors: errors | ||
@@ -1233,2 +1313,15 @@ }); | ||
} | ||
async getMetaTransactions(projectId, page) { | ||
return this.service.getMetaTransactions({ | ||
projectId, | ||
page | ||
}); | ||
} | ||
async getTransactionCost(projectId, from, to) { | ||
return this.service.getTransactionCost({ | ||
projectId, | ||
from, | ||
to | ||
}); | ||
} | ||
} | ||
@@ -1235,0 +1328,0 @@ class MetaTransactionResponseException { |
@@ -20,2 +20,9 @@ import { ethers } from 'ethers'; | ||
wait(metaTxnId: string | commons.transaction.SignedTransactionBundle, timeout?: number, delay?: number, maxFails?: number): Promise<commons.transaction.TransactionResponse>; | ||
getMetaTransactions(projectId: number, page?: proto.Page): Promise<{ | ||
page: proto.Page; | ||
transactions: proto.MetaTxnLog[]; | ||
}>; | ||
getTransactionCost(projectId: number, from: string, to: string): Promise<{ | ||
cost: number; | ||
}>; | ||
} | ||
@@ -22,0 +29,0 @@ export * from "./local-relayer.js"; |
import { ethers } from 'ethers'; | ||
import { FeeOption, FeeQuote, Relayer } from "./index.js"; | ||
import { FeeOption, FeeQuote, proto, Relayer } from "./index.js"; | ||
import { ProviderRelayer, ProviderRelayerOptions } from "./provider-relayer.js"; | ||
@@ -24,2 +24,9 @@ import { commons } from '@0xsequence/core'; | ||
relay(signedTxs: commons.transaction.IntendedTransactionBundle, quote?: FeeQuote, waitForReceipt?: boolean): Promise<commons.transaction.TransactionResponse<ethers.TransactionReceipt>>; | ||
getMetaTransactions(projectId: number, page?: proto.Page): Promise<{ | ||
page: proto.Page; | ||
transactions: proto.MetaTxnLog[]; | ||
}>; | ||
getTransactionCost(projectId: number, from: string, to: string): Promise<{ | ||
cost: number; | ||
}>; | ||
} |
import { ethers } from 'ethers'; | ||
import { FeeOption, FeeQuote, Relayer, SimulateResult } from "./index.js"; | ||
import { FeeOption, FeeQuote, proto, Relayer, SimulateResult } from "./index.js"; | ||
import { Optionals } from '@0xsequence/utils'; | ||
@@ -31,2 +31,9 @@ import { commons } from '@0xsequence/core'; | ||
abstract relay(signedTxs: commons.transaction.IntendedTransactionBundle, quote?: FeeQuote, waitForReceipt?: boolean): Promise<commons.transaction.TransactionResponse>; | ||
abstract getTransactionCost(projectId: number, from: string, to: string): Promise<{ | ||
cost: number; | ||
}>; | ||
abstract getMetaTransactions(projectId: number, page?: proto.Page): Promise<{ | ||
page: proto.Page; | ||
transactions: proto.MetaTxnLog[]; | ||
}>; | ||
simulate(wallet: string, ...transactions: commons.transaction.Transaction[]): Promise<SimulateResult[]>; | ||
@@ -33,0 +40,0 @@ getNonce(address: string, space?: ethers.BigNumberish, blockTag?: ethers.BlockTag): Promise<ethers.BigNumberish>; |
@@ -38,2 +38,9 @@ import { ethers } from 'ethers'; | ||
wait(metaTxnId: string | commons.transaction.SignedTransactionBundle, timeout?: number, delay?: number, maxFails?: number): Promise<commons.transaction.TransactionResponse<RelayerTxReceipt>>; | ||
getMetaTransactions(projectId: number, page?: proto.Page): Promise<{ | ||
page: proto.Page; | ||
transactions: proto.MetaTxnLog[]; | ||
}>; | ||
getTransactionCost(projectId: number, from: string, to: string): Promise<{ | ||
cost: number; | ||
}>; | ||
} | ||
@@ -40,0 +47,0 @@ export type RelayerTxReceipt = { |
export declare const WebRPCVersion = "v1"; | ||
export declare const WebRPCSchemaVersion = "v0.4.1"; | ||
export declare const WebRPCSchemaHash = "1e27d0fd295aa5897878939595ef0c6adc54b1a3"; | ||
export declare const WebRPCSchemaHash = "dd95e21fa884c6564199bc3dd5f588534827ffe2"; | ||
export declare enum ETHTxnStatus { | ||
@@ -43,6 +43,6 @@ UNKNOWN = "UNKNOWN", | ||
commitHash: string; | ||
chainID: number; | ||
useEIP1559: boolean; | ||
senders: Array<SenderStatus>; | ||
checks: RuntimeChecks; | ||
numTxnsRelayed: NumTxnsRelayed; | ||
} | ||
@@ -57,7 +57,2 @@ export interface SenderStatus { | ||
} | ||
export interface NumTxnsRelayed { | ||
prev: number; | ||
current: number; | ||
period: number; | ||
} | ||
export interface SequenceContext { | ||
@@ -72,2 +67,3 @@ factory: string; | ||
id: number; | ||
chainId: number; | ||
name: string; | ||
@@ -92,2 +88,3 @@ currentBalance: number; | ||
projectId: number; | ||
chainId: number; | ||
address: string; | ||
@@ -118,2 +115,3 @@ name: string; | ||
id: number; | ||
chainId: number; | ||
projectId: number; | ||
@@ -152,12 +150,2 @@ txnHash: string; | ||
} | ||
export interface MetaTxnEntry { | ||
id: number; | ||
metaTxnID: string; | ||
txnStatus: ETHTxnStatus; | ||
txnRevertReason: string; | ||
index: number; | ||
logs?: Array<any>; | ||
updatedAt: string; | ||
createdAt: string; | ||
} | ||
export interface MetaTxnReceipt { | ||
@@ -256,2 +244,3 @@ id: string; | ||
getMetaTransactions(args: GetMetaTransactionsArgs, headers?: object, signal?: AbortSignal): Promise<GetMetaTransactionsReturn>; | ||
getTransactionCost(args: GetTransactionCostArgs, headers?: object, signal?: AbortSignal): Promise<GetTransactionCostReturn>; | ||
sentTransactions(args: SentTransactionsArgs, headers?: object, signal?: AbortSignal): Promise<SentTransactionsReturn>; | ||
@@ -273,2 +262,4 @@ pendingTransactions(args: PendingTransactionsArgs, headers?: object, signal?: AbortSignal): Promise<PendingTransactionsReturn>; | ||
listGasTankBalanceAdjustments(args: ListGasTankBalanceAdjustmentsArgs, headers?: object, signal?: AbortSignal): Promise<ListGasTankBalanceAdjustmentsReturn>; | ||
getProjectBalance(args: GetProjectBalanceArgs, headers?: object, signal?: AbortSignal): Promise<GetProjectBalanceReturn>; | ||
adjustProjectBalance(args: AdjustProjectBalanceArgs, headers?: object, signal?: AbortSignal): Promise<AdjustProjectBalanceReturn>; | ||
} | ||
@@ -303,2 +294,3 @@ export interface PingArgs { | ||
quote?: string; | ||
projectID?: number; | ||
} | ||
@@ -363,3 +355,2 @@ export interface SendMetaTxnReturn { | ||
projectId: number; | ||
gasTankId: number; | ||
page?: Page; | ||
@@ -371,2 +362,10 @@ } | ||
} | ||
export interface GetTransactionCostArgs { | ||
projectId: number; | ||
from: string; | ||
to: string; | ||
} | ||
export interface GetTransactionCostReturn { | ||
cost: number; | ||
} | ||
export interface SentTransactionsArgs { | ||
@@ -500,2 +499,16 @@ filter?: SentTransactionsFilter; | ||
} | ||
export interface GetProjectBalanceArgs { | ||
projectId: number; | ||
} | ||
export interface GetProjectBalanceReturn { | ||
balance: number; | ||
} | ||
export interface AdjustProjectBalanceArgs { | ||
projectId: number; | ||
amount: number; | ||
identifier: string; | ||
} | ||
export interface AdjustProjectBalanceReturn { | ||
balance: number; | ||
} | ||
export declare class Relayer implements Relayer { | ||
@@ -521,2 +534,3 @@ protected hostname: string; | ||
getMetaTransactions: (args: GetMetaTransactionsArgs, headers?: object, signal?: AbortSignal) => Promise<GetMetaTransactionsReturn>; | ||
getTransactionCost: (args: GetTransactionCostArgs, headers?: object, signal?: AbortSignal) => Promise<GetTransactionCostReturn>; | ||
sentTransactions: (args: SentTransactionsArgs, headers?: object, signal?: AbortSignal) => Promise<SentTransactionsReturn>; | ||
@@ -538,2 +552,4 @@ pendingTransactions: (args: PendingTransactionsArgs, headers?: object, signal?: AbortSignal) => Promise<PendingTransactionsReturn>; | ||
listGasTankBalanceAdjustments: (args: ListGasTankBalanceAdjustmentsArgs, headers?: object, signal?: AbortSignal) => Promise<ListGasTankBalanceAdjustmentsReturn>; | ||
getProjectBalance: (args: GetProjectBalanceArgs, headers?: object, signal?: AbortSignal) => Promise<GetProjectBalanceReturn>; | ||
adjustProjectBalance: (args: AdjustProjectBalanceArgs, headers?: object, signal?: AbortSignal) => Promise<AdjustProjectBalanceReturn>; | ||
} | ||
@@ -593,5 +609,11 @@ export declare class WebrpcError extends Error { | ||
} | ||
export declare class RequestConflictError extends WebrpcError { | ||
constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare class AbortedError extends WebrpcError { | ||
constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare class GeoblockedError extends WebrpcError { | ||
constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare class InvalidArgumentError extends WebrpcError { | ||
@@ -609,2 +631,5 @@ constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare class InsufficientFeeError extends WebrpcError { | ||
constructor(name?: string, code?: number, message?: string, status?: number, cause?: string); | ||
} | ||
export declare enum errors { | ||
@@ -625,8 +650,11 @@ WebrpcEndpoint = "WebrpcEndpoint", | ||
MethodNotFound = "MethodNotFound", | ||
RequestConflict = "RequestConflict", | ||
Aborted = "Aborted", | ||
Geoblocked = "Geoblocked", | ||
InvalidArgument = "InvalidArgument", | ||
Unavailable = "Unavailable", | ||
QueryFailed = "QueryFailed", | ||
NotFound = "NotFound" | ||
NotFound = "NotFound", | ||
InsufficientFee = "InsufficientFee" | ||
} | ||
export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>; |
{ | ||
"name": "@0xsequence/relayer", | ||
"version": "2.2.5", | ||
"version": "2.2.6", | ||
"description": "relayer sub-package for Sequence", | ||
@@ -15,5 +15,5 @@ "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/relayer", | ||
"dependencies": { | ||
"@0xsequence/abi": "2.2.5", | ||
"@0xsequence/core": "2.2.5", | ||
"@0xsequence/utils": "2.2.5" | ||
"@0xsequence/abi": "2.2.6", | ||
"@0xsequence/utils": "2.2.6", | ||
"@0xsequence/core": "2.2.6" | ||
}, | ||
@@ -23,4 +23,4 @@ "devDependencies": { | ||
"ethers": "6.13.4", | ||
"@0xsequence/signhub": "2.2.5", | ||
"@0xsequence/tests": "2.2.5" | ||
"@0xsequence/signhub": "2.2.6", | ||
"@0xsequence/tests": "2.2.6" | ||
}, | ||
@@ -27,0 +27,0 @@ "files": [ |
@@ -57,2 +57,13 @@ import { ethers } from 'ethers' | ||
): 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, | ||
transactions: proto.MetaTxnLog[] | ||
}> | ||
// getTransactionCost returns the used fee cost for gas tank during a given period | ||
getTransactionCost(projectId: number, from: string, to: string): Promise<{ | ||
cost: number | ||
}> | ||
} | ||
@@ -59,0 +70,0 @@ |
import { ethers } from 'ethers' | ||
import { logger } from '@0xsequence/utils' | ||
import { FeeOption, FeeQuote, Relayer } from '.' | ||
import { FeeOption, FeeQuote, proto, Relayer } from '.' | ||
import { ProviderRelayer, ProviderRelayerOptions } from './provider-relayer' | ||
@@ -79,2 +79,15 @@ import { commons } from '@0xsequence/core' | ||
} | ||
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<{ | ||
cost: number | ||
}> { | ||
return { cost: 0 } | ||
} | ||
} | ||
@@ -81,0 +94,0 @@ |
import { ethers } from 'ethers' | ||
import { walletContracts } from '@0xsequence/abi' | ||
import { FeeOption, FeeQuote, Relayer, SimulateResult } from '.' | ||
import { FeeOption, FeeQuote, proto, Relayer, SimulateResult } from '.' | ||
import { logger, Optionals } from '@0xsequence/utils' | ||
@@ -62,2 +62,11 @@ import { commons } from '@0xsequence/core' | ||
abstract getTransactionCost(projectId: number, from: string, to: string): Promise<{ | ||
cost: number | ||
}> | ||
abstract getMetaTransactions(projectId: number, page?: proto.Page): Promise<{ | ||
page: proto.Page, | ||
transactions: proto.MetaTxnLog[] | ||
}> | ||
async simulate(wallet: string, ...transactions: commons.transaction.Transaction[]): Promise<SimulateResult[]> { | ||
@@ -252,2 +261,4 @@ return ( | ||
} | ||
} | ||
@@ -254,0 +265,0 @@ |
@@ -307,2 +307,15 @@ import { ethers } from 'ethers' | ||
} | ||
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<{ | ||
cost: number | ||
}> { | ||
return this.service.getTransactionCost({ projectId, from, to }) | ||
} | ||
} | ||
@@ -309,0 +322,0 @@ |
/* eslint-disable */ | ||
// sequence-relayer v0.4.1 1e27d0fd295aa5897878939595ef0c6adc54b1a3 | ||
// sequence-relayer v0.4.1 dd95e21fa884c6564199bc3dd5f588534827ffe2 | ||
// -- | ||
// 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. | ||
// | ||
@@ -15,3 +15,3 @@ // webrpc-gen -schema=relayer.ridl -target=typescript -client -out=./clients/relayer.gen.ts | ||
// Schema hash generated from your RIDL schema | ||
export const WebRPCSchemaHash = '1e27d0fd295aa5897878939595ef0c6adc54b1a3' | ||
export const WebRPCSchemaHash = 'dd95e21fa884c6564199bc3dd5f588534827ffe2' | ||
@@ -66,6 +66,6 @@ // | ||
commitHash: string | ||
chainID: number | ||
useEIP1559: boolean | ||
senders: Array<SenderStatus> | ||
checks: RuntimeChecks | ||
numTxnsRelayed: NumTxnsRelayed | ||
} | ||
@@ -82,8 +82,2 @@ | ||
export interface NumTxnsRelayed { | ||
prev: number | ||
current: number | ||
period: number | ||
} | ||
export interface SequenceContext { | ||
@@ -99,2 +93,3 @@ factory: string | ||
id: number | ||
chainId: number | ||
name: string | ||
@@ -121,2 +116,3 @@ currentBalance: number | ||
projectId: number | ||
chainId: number | ||
address: string | ||
@@ -150,2 +146,3 @@ name: string | ||
id: number | ||
chainId: number | ||
projectId: number | ||
@@ -181,13 +178,2 @@ txnHash: string | ||
export interface MetaTxnEntry { | ||
id: number | ||
metaTxnID: string | ||
txnStatus: ETHTxnStatus | ||
txnRevertReason: string | ||
index: number | ||
logs?: Array<any> | ||
updatedAt: string | ||
createdAt: string | ||
} | ||
export interface MetaTxnReceipt { | ||
@@ -303,2 +289,3 @@ id: string | ||
getMetaTransactions(args: GetMetaTransactionsArgs, headers?: object, signal?: AbortSignal): Promise<GetMetaTransactionsReturn> | ||
getTransactionCost(args: GetTransactionCostArgs, headers?: object, signal?: AbortSignal): Promise<GetTransactionCostReturn> | ||
sentTransactions(args: SentTransactionsArgs, headers?: object, signal?: AbortSignal): Promise<SentTransactionsReturn> | ||
@@ -340,2 +327,8 @@ pendingTransactions(args: PendingTransactionsArgs, headers?: object, signal?: AbortSignal): Promise<PendingTransactionsReturn> | ||
): Promise<ListGasTankBalanceAdjustmentsReturn> | ||
getProjectBalance(args: GetProjectBalanceArgs, headers?: object, signal?: AbortSignal): Promise<GetProjectBalanceReturn> | ||
adjustProjectBalance( | ||
args: AdjustProjectBalanceArgs, | ||
headers?: object, | ||
signal?: AbortSignal | ||
): Promise<AdjustProjectBalanceReturn> | ||
} | ||
@@ -371,2 +364,3 @@ | ||
quote?: string | ||
projectID?: number | ||
} | ||
@@ -438,3 +432,2 @@ | ||
projectId: number | ||
gasTankId: number | ||
page?: Page | ||
@@ -447,2 +440,11 @@ } | ||
} | ||
export interface GetTransactionCostArgs { | ||
projectId: number | ||
from: string | ||
to: string | ||
} | ||
export interface GetTransactionCostReturn { | ||
cost: number | ||
} | ||
export interface SentTransactionsArgs { | ||
@@ -592,3 +594,19 @@ filter?: SentTransactionsFilter | ||
} | ||
export interface GetProjectBalanceArgs { | ||
projectId: number | ||
} | ||
export interface GetProjectBalanceReturn { | ||
balance: number | ||
} | ||
export interface AdjustProjectBalanceArgs { | ||
projectId: number | ||
amount: number | ||
identifier: string | ||
} | ||
export interface AdjustProjectBalanceReturn { | ||
balance: number | ||
} | ||
// | ||
@@ -603,3 +621,3 @@ // Client | ||
constructor(hostname: string, fetch: Fetch) { | ||
this.hostname = hostname | ||
this.hostname = hostname.replace(/\/*$/, '') | ||
this.fetch = (input: RequestInfo, init?: RequestInit) => fetch(input, init) | ||
@@ -839,2 +857,21 @@ } | ||
getTransactionCost = ( | ||
args: GetTransactionCostArgs, | ||
headers?: object, | ||
signal?: AbortSignal | ||
): Promise<GetTransactionCostReturn> => { | ||
return this.fetch(this.url('GetTransactionCost'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
return { | ||
cost: <number>_data.cost | ||
} | ||
}) | ||
}, | ||
error => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
) | ||
} | ||
sentTransactions = (args: SentTransactionsArgs, headers?: object, signal?: AbortSignal): Promise<SentTransactionsReturn> => { | ||
@@ -1117,2 +1154,36 @@ return this.fetch(this.url('SentTransactions'), createHTTPRequest(args, headers, signal)).then( | ||
} | ||
getProjectBalance = (args: GetProjectBalanceArgs, headers?: object, signal?: AbortSignal): Promise<GetProjectBalanceReturn> => { | ||
return this.fetch(this.url('GetProjectBalance'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
return { | ||
balance: <number>_data.balance | ||
} | ||
}) | ||
}, | ||
error => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
) | ||
} | ||
adjustProjectBalance = ( | ||
args: AdjustProjectBalanceArgs, | ||
headers?: object, | ||
signal?: AbortSignal | ||
): Promise<AdjustProjectBalanceReturn> => { | ||
return this.fetch(this.url('AdjustProjectBalance'), createHTTPRequest(args, headers, signal)).then( | ||
res => { | ||
return buildResponse(res).then(_data => { | ||
return { | ||
balance: <number>_data.balance | ||
} | ||
}) | ||
}, | ||
error => { | ||
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` }) | ||
} | ||
) | ||
} | ||
} | ||
@@ -1368,2 +1439,15 @@ | ||
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 { | ||
@@ -1382,2 +1466,15 @@ constructor( | ||
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 { | ||
@@ -1435,2 +1532,15 @@ constructor( | ||
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 { | ||
@@ -1451,7 +1561,10 @@ WebrpcEndpoint = 'WebrpcEndpoint', | ||
MethodNotFound = 'MethodNotFound', | ||
RequestConflict = 'RequestConflict', | ||
Aborted = 'Aborted', | ||
Geoblocked = 'Geoblocked', | ||
InvalidArgument = 'InvalidArgument', | ||
Unavailable = 'Unavailable', | ||
QueryFailed = 'QueryFailed', | ||
NotFound = 'NotFound' | ||
NotFound = 'NotFound', | ||
InsufficientFee = 'InsufficientFee' | ||
} | ||
@@ -1474,9 +1587,12 @@ | ||
[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<Response> |
263817
6892
+ Added@0xsequence/abi@2.2.6(transitive)
+ Added@0xsequence/core@2.2.6(transitive)
+ Added@0xsequence/utils@2.2.6(transitive)
- Removed@0xsequence/abi@2.2.5(transitive)
- Removed@0xsequence/core@2.2.5(transitive)
- Removed@0xsequence/utils@2.2.5(transitive)
Updated@0xsequence/abi@2.2.6
Updated@0xsequence/core@2.2.6
Updated@0xsequence/utils@2.2.6