@0xsequence/relayer
Advanced tools
Comparing version 0.0.0-20241007154931 to 0.0.0-20241107182529
@@ -1,2 +0,2 @@ | ||
export * from "./declarations/src/index"; | ||
export * from "./declarations/src/index.js"; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMHhzZXF1ZW5jZS1yZWxheWVyLmNqcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi9kZWNsYXJhdGlvbnMvc3JjL2luZGV4LmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEifQ== |
@@ -5,4 +5,4 @@ 'use strict'; | ||
var utils = require('@0xsequence/utils'); | ||
var ethers = require('ethers'); | ||
var utils = require('@0xsequence/utils'); | ||
var abi = require('@0xsequence/abi'); | ||
@@ -12,14 +12,9 @@ var core = require('@0xsequence/core'); | ||
function _extends() { | ||
_extends = Object.assign ? Object.assign.bind() : function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
return _extends = Object.assign ? Object.assign.bind() : function (n) { | ||
for (var e = 1; e < arguments.length; e++) { | ||
var t = arguments[e]; | ||
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
return n; | ||
}, _extends.apply(null, arguments); | ||
} | ||
@@ -34,3 +29,3 @@ | ||
function isProviderRelayerOptions(obj) { | ||
return typeof obj === 'object' && obj.provider instanceof ethers.ethers.AbstractProvider; | ||
return typeof obj === 'object' && isAbstractProvider$1(obj.provider); | ||
} | ||
@@ -189,9 +184,12 @@ class ProviderRelayer { | ||
} | ||
function isAbstractProvider$1(provider) { | ||
return provider && typeof provider === 'object' && typeof provider.getNetwork === 'function' && typeof provider.getBlockNumber === 'function'; | ||
} | ||
function isLocalRelayerOptions(obj) { | ||
return typeof obj === 'object' && obj.signer instanceof ethers.ethers.AbstractSigner; | ||
return typeof obj === 'object' && isAbstractSigner(obj.signer); | ||
} | ||
class LocalRelayer extends ProviderRelayer { | ||
constructor(options) { | ||
super(options instanceof ethers.ethers.AbstractSigner ? { | ||
super(isAbstractSigner(options) ? { | ||
provider: options.provider | ||
@@ -203,3 +201,3 @@ } : _extends({}, options, { | ||
this.txnOptions = void 0; | ||
this.signer = options instanceof ethers.ethers.AbstractSigner ? options : options.signer; | ||
this.signer = isAbstractSigner(options) ? options : options.signer; | ||
if (!this.signer.provider) throw new Error('Signer must have a provider'); | ||
@@ -252,2 +250,5 @@ } | ||
} | ||
function isAbstractSigner(signer) { | ||
return signer && typeof signer === 'object' && typeof signer.provider === 'object' && typeof signer.getAddress === 'function' && typeof signer.connect === 'function'; | ||
} | ||
@@ -983,3 +984,3 @@ /* eslint-disable */ | ||
function isRpcRelayerOptions(obj) { | ||
return obj.url !== undefined && typeof obj.url === 'string' && obj.provider !== undefined && obj.provider instanceof ethers.ethers.AbstractProvider; | ||
return obj.url !== undefined && typeof obj.url === 'string' && obj.provider !== undefined && isAbstractProvider(obj.provider); | ||
} | ||
@@ -1014,3 +1015,3 @@ const fetch = globalThis.fetch; | ||
this.service = new Relayer(options.url, this._fetch); | ||
if (options.provider instanceof ethers.ethers.AbstractProvider) { | ||
if (isAbstractProvider(options.provider)) { | ||
this.provider = options.provider; | ||
@@ -1234,2 +1235,5 @@ } else { | ||
} | ||
function isAbstractProvider(provider) { | ||
return provider && typeof provider === 'object' && typeof provider.getNetwork === 'function' && typeof provider.getBlockNumber === 'function'; | ||
} | ||
@@ -1236,0 +1240,0 @@ // A fee quote is simply an opaque value that can be obtained via Relayer.getFeeOptions(), and |
@@ -5,4 +5,4 @@ 'use strict'; | ||
var utils = require('@0xsequence/utils'); | ||
var ethers = require('ethers'); | ||
var utils = require('@0xsequence/utils'); | ||
var abi = require('@0xsequence/abi'); | ||
@@ -12,14 +12,9 @@ var core = require('@0xsequence/core'); | ||
function _extends() { | ||
_extends = Object.assign ? Object.assign.bind() : function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
return _extends = Object.assign ? Object.assign.bind() : function (n) { | ||
for (var e = 1; e < arguments.length; e++) { | ||
var t = arguments[e]; | ||
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
return n; | ||
}, _extends.apply(null, arguments); | ||
} | ||
@@ -34,3 +29,3 @@ | ||
function isProviderRelayerOptions(obj) { | ||
return typeof obj === 'object' && obj.provider instanceof ethers.ethers.AbstractProvider; | ||
return typeof obj === 'object' && isAbstractProvider$1(obj.provider); | ||
} | ||
@@ -189,9 +184,12 @@ class ProviderRelayer { | ||
} | ||
function isAbstractProvider$1(provider) { | ||
return provider && typeof provider === 'object' && typeof provider.getNetwork === 'function' && typeof provider.getBlockNumber === 'function'; | ||
} | ||
function isLocalRelayerOptions(obj) { | ||
return typeof obj === 'object' && obj.signer instanceof ethers.ethers.AbstractSigner; | ||
return typeof obj === 'object' && isAbstractSigner(obj.signer); | ||
} | ||
class LocalRelayer extends ProviderRelayer { | ||
constructor(options) { | ||
super(options instanceof ethers.ethers.AbstractSigner ? { | ||
super(isAbstractSigner(options) ? { | ||
provider: options.provider | ||
@@ -203,3 +201,3 @@ } : _extends({}, options, { | ||
this.txnOptions = void 0; | ||
this.signer = options instanceof ethers.ethers.AbstractSigner ? options : options.signer; | ||
this.signer = isAbstractSigner(options) ? options : options.signer; | ||
if (!this.signer.provider) throw new Error('Signer must have a provider'); | ||
@@ -252,2 +250,5 @@ } | ||
} | ||
function isAbstractSigner(signer) { | ||
return signer && typeof signer === 'object' && typeof signer.provider === 'object' && typeof signer.getAddress === 'function' && typeof signer.connect === 'function'; | ||
} | ||
@@ -983,3 +984,3 @@ /* eslint-disable */ | ||
function isRpcRelayerOptions(obj) { | ||
return obj.url !== undefined && typeof obj.url === 'string' && obj.provider !== undefined && obj.provider instanceof ethers.ethers.AbstractProvider; | ||
return obj.url !== undefined && typeof obj.url === 'string' && obj.provider !== undefined && isAbstractProvider(obj.provider); | ||
} | ||
@@ -1014,3 +1015,3 @@ const fetch = globalThis.fetch; | ||
this.service = new Relayer(options.url, this._fetch); | ||
if (options.provider instanceof ethers.ethers.AbstractProvider) { | ||
if (isAbstractProvider(options.provider)) { | ||
this.provider = options.provider; | ||
@@ -1234,2 +1235,5 @@ } else { | ||
} | ||
function isAbstractProvider(provider) { | ||
return provider && typeof provider === 'object' && typeof provider.getNetwork === 'function' && typeof provider.getBlockNumber === 'function'; | ||
} | ||
@@ -1236,0 +1240,0 @@ // A fee quote is simply an opaque value that can be obtained via Relayer.getFeeOptions(), and |
@@ -0,3 +1,3 @@ | ||
import { logger, getFetchRequest, bigintReplacer, toHexString } from '@0xsequence/utils'; | ||
import { ethers } from 'ethers'; | ||
import { logger, getFetchRequest, bigintReplacer, toHexString } from '@0xsequence/utils'; | ||
import { walletContracts } from '@0xsequence/abi'; | ||
@@ -7,14 +7,9 @@ import { commons } from '@0xsequence/core'; | ||
function _extends() { | ||
_extends = Object.assign ? Object.assign.bind() : function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
return _extends = Object.assign ? Object.assign.bind() : function (n) { | ||
for (var e = 1; e < arguments.length; e++) { | ||
var t = arguments[e]; | ||
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
return n; | ||
}, _extends.apply(null, arguments); | ||
} | ||
@@ -29,3 +24,3 @@ | ||
function isProviderRelayerOptions(obj) { | ||
return typeof obj === 'object' && obj.provider instanceof ethers.AbstractProvider; | ||
return typeof obj === 'object' && isAbstractProvider$1(obj.provider); | ||
} | ||
@@ -184,9 +179,12 @@ class ProviderRelayer { | ||
} | ||
function isAbstractProvider$1(provider) { | ||
return provider && typeof provider === 'object' && typeof provider.getNetwork === 'function' && typeof provider.getBlockNumber === 'function'; | ||
} | ||
function isLocalRelayerOptions(obj) { | ||
return typeof obj === 'object' && obj.signer instanceof ethers.AbstractSigner; | ||
return typeof obj === 'object' && isAbstractSigner(obj.signer); | ||
} | ||
class LocalRelayer extends ProviderRelayer { | ||
constructor(options) { | ||
super(options instanceof ethers.AbstractSigner ? { | ||
super(isAbstractSigner(options) ? { | ||
provider: options.provider | ||
@@ -198,3 +196,3 @@ } : _extends({}, options, { | ||
this.txnOptions = void 0; | ||
this.signer = options instanceof ethers.AbstractSigner ? options : options.signer; | ||
this.signer = isAbstractSigner(options) ? options : options.signer; | ||
if (!this.signer.provider) throw new Error('Signer must have a provider'); | ||
@@ -247,2 +245,5 @@ } | ||
} | ||
function isAbstractSigner(signer) { | ||
return signer && typeof signer === 'object' && typeof signer.provider === 'object' && typeof signer.getAddress === 'function' && typeof signer.connect === 'function'; | ||
} | ||
@@ -978,3 +979,3 @@ /* eslint-disable */ | ||
function isRpcRelayerOptions(obj) { | ||
return obj.url !== undefined && typeof obj.url === 'string' && obj.provider !== undefined && obj.provider instanceof ethers.AbstractProvider; | ||
return obj.url !== undefined && typeof obj.url === 'string' && obj.provider !== undefined && isAbstractProvider(obj.provider); | ||
} | ||
@@ -1009,3 +1010,3 @@ const fetch = globalThis.fetch; | ||
this.service = new Relayer(options.url, this._fetch); | ||
if (options.provider instanceof ethers.AbstractProvider) { | ||
if (isAbstractProvider(options.provider)) { | ||
this.provider = options.provider; | ||
@@ -1229,2 +1230,5 @@ } else { | ||
} | ||
function isAbstractProvider(provider) { | ||
return provider && typeof provider === 'object' && typeof provider.getNetwork === 'function' && typeof provider.getBlockNumber === 'function'; | ||
} | ||
@@ -1231,0 +1235,0 @@ // A fee quote is simply an opaque value that can be obtained via Relayer.getFeeOptions(), and |
@@ -495,32 +495,32 @@ export declare const WebRPCVersion = "v1"; | ||
private url; | ||
ping: (headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<PingReturn>; | ||
version: (headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<VersionReturn>; | ||
runtimeStatus: (headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<RuntimeStatusReturn>; | ||
getSequenceContext: (headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<GetSequenceContextReturn>; | ||
getChainID: (headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<GetChainIDReturn>; | ||
sendMetaTxn: (args: SendMetaTxnArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<SendMetaTxnReturn>; | ||
getMetaTxnNonce: (args: GetMetaTxnNonceArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<GetMetaTxnNonceReturn>; | ||
getMetaTxnReceipt: (args: GetMetaTxnReceiptArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<GetMetaTxnReceiptReturn>; | ||
simulate: (args: SimulateArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<SimulateReturn>; | ||
updateMetaTxnGasLimits: (args: UpdateMetaTxnGasLimitsArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<UpdateMetaTxnGasLimitsReturn>; | ||
feeTokens: (headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<FeeTokensReturn>; | ||
feeOptions: (args: FeeOptionsArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<FeeOptionsReturn>; | ||
getMetaTxnNetworkFeeOptions: (args: GetMetaTxnNetworkFeeOptionsArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<GetMetaTxnNetworkFeeOptionsReturn>; | ||
getMetaTransactions: (args: GetMetaTransactionsArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<GetMetaTransactionsReturn>; | ||
sentTransactions: (args: SentTransactionsArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<SentTransactionsReturn>; | ||
pendingTransactions: (args: PendingTransactionsArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<PendingTransactionsReturn>; | ||
getGasTank: (args: GetGasTankArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<GetGasTankReturn>; | ||
addGasTank: (args: AddGasTankArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<AddGasTankReturn>; | ||
updateGasTank: (args: UpdateGasTankArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<UpdateGasTankReturn>; | ||
getGasSponsor: (args: GetGasSponsorArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<GetGasSponsorReturn>; | ||
addressGasSponsors: (args: AddressGasSponsorsArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<AddressGasSponsorsReturn>; | ||
listGasSponsors: (args: ListGasSponsorsArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<ListGasSponsorsReturn>; | ||
addGasSponsor: (args: AddGasSponsorArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<AddGasSponsorReturn>; | ||
updateGasSponsor: (args: UpdateGasSponsorArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<UpdateGasSponsorReturn>; | ||
removeGasSponsor: (args: RemoveGasSponsorArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<RemoveGasSponsorReturn>; | ||
reportGasSponsorUsage: (args: ReportGasSponsorUsageArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<ReportGasSponsorUsageReturn>; | ||
nextGasTankBalanceAdjustmentNonce: (args: NextGasTankBalanceAdjustmentNonceArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<NextGasTankBalanceAdjustmentNonceReturn>; | ||
adjustGasTankBalance: (args: AdjustGasTankBalanceArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<AdjustGasTankBalanceReturn>; | ||
getGasTankBalanceAdjustment: (args: GetGasTankBalanceAdjustmentArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<GetGasTankBalanceAdjustmentReturn>; | ||
listGasTankBalanceAdjustments: (args: ListGasTankBalanceAdjustmentsArgs, headers?: object | undefined, signal?: AbortSignal | undefined) => Promise<ListGasTankBalanceAdjustmentsReturn>; | ||
ping: (headers?: object, signal?: AbortSignal) => Promise<PingReturn>; | ||
version: (headers?: object, signal?: AbortSignal) => Promise<VersionReturn>; | ||
runtimeStatus: (headers?: object, signal?: AbortSignal) => Promise<RuntimeStatusReturn>; | ||
getSequenceContext: (headers?: object, signal?: AbortSignal) => Promise<GetSequenceContextReturn>; | ||
getChainID: (headers?: object, signal?: AbortSignal) => Promise<GetChainIDReturn>; | ||
sendMetaTxn: (args: SendMetaTxnArgs, headers?: object, signal?: AbortSignal) => Promise<SendMetaTxnReturn>; | ||
getMetaTxnNonce: (args: GetMetaTxnNonceArgs, headers?: object, signal?: AbortSignal) => Promise<GetMetaTxnNonceReturn>; | ||
getMetaTxnReceipt: (args: GetMetaTxnReceiptArgs, headers?: object, signal?: AbortSignal) => Promise<GetMetaTxnReceiptReturn>; | ||
simulate: (args: SimulateArgs, headers?: object, signal?: AbortSignal) => Promise<SimulateReturn>; | ||
updateMetaTxnGasLimits: (args: UpdateMetaTxnGasLimitsArgs, headers?: object, signal?: AbortSignal) => Promise<UpdateMetaTxnGasLimitsReturn>; | ||
feeTokens: (headers?: object, signal?: AbortSignal) => Promise<FeeTokensReturn>; | ||
feeOptions: (args: FeeOptionsArgs, headers?: object, signal?: AbortSignal) => Promise<FeeOptionsReturn>; | ||
getMetaTxnNetworkFeeOptions: (args: GetMetaTxnNetworkFeeOptionsArgs, headers?: object, signal?: AbortSignal) => Promise<GetMetaTxnNetworkFeeOptionsReturn>; | ||
getMetaTransactions: (args: GetMetaTransactionsArgs, headers?: object, signal?: AbortSignal) => Promise<GetMetaTransactionsReturn>; | ||
sentTransactions: (args: SentTransactionsArgs, headers?: object, signal?: AbortSignal) => Promise<SentTransactionsReturn>; | ||
pendingTransactions: (args: PendingTransactionsArgs, headers?: object, signal?: AbortSignal) => Promise<PendingTransactionsReturn>; | ||
getGasTank: (args: GetGasTankArgs, headers?: object, signal?: AbortSignal) => Promise<GetGasTankReturn>; | ||
addGasTank: (args: AddGasTankArgs, headers?: object, signal?: AbortSignal) => Promise<AddGasTankReturn>; | ||
updateGasTank: (args: UpdateGasTankArgs, headers?: object, signal?: AbortSignal) => Promise<UpdateGasTankReturn>; | ||
getGasSponsor: (args: GetGasSponsorArgs, headers?: object, signal?: AbortSignal) => Promise<GetGasSponsorReturn>; | ||
addressGasSponsors: (args: AddressGasSponsorsArgs, headers?: object, signal?: AbortSignal) => Promise<AddressGasSponsorsReturn>; | ||
listGasSponsors: (args: ListGasSponsorsArgs, headers?: object, signal?: AbortSignal) => Promise<ListGasSponsorsReturn>; | ||
addGasSponsor: (args: AddGasSponsorArgs, headers?: object, signal?: AbortSignal) => Promise<AddGasSponsorReturn>; | ||
updateGasSponsor: (args: UpdateGasSponsorArgs, headers?: object, signal?: AbortSignal) => Promise<UpdateGasSponsorReturn>; | ||
removeGasSponsor: (args: RemoveGasSponsorArgs, headers?: object, signal?: AbortSignal) => Promise<RemoveGasSponsorReturn>; | ||
reportGasSponsorUsage: (args: ReportGasSponsorUsageArgs, headers?: object, signal?: AbortSignal) => Promise<ReportGasSponsorUsageReturn>; | ||
nextGasTankBalanceAdjustmentNonce: (args: NextGasTankBalanceAdjustmentNonceArgs, headers?: object, signal?: AbortSignal) => Promise<NextGasTankBalanceAdjustmentNonceReturn>; | ||
adjustGasTankBalance: (args: AdjustGasTankBalanceArgs, headers?: object, signal?: AbortSignal) => Promise<AdjustGasTankBalanceReturn>; | ||
getGasTankBalanceAdjustment: (args: GetGasTankBalanceAdjustmentArgs, headers?: object, signal?: AbortSignal) => Promise<GetGasTankBalanceAdjustmentReturn>; | ||
listGasTankBalanceAdjustments: (args: ListGasTankBalanceAdjustmentsArgs, headers?: object, signal?: AbortSignal) => Promise<ListGasTankBalanceAdjustmentsReturn>; | ||
} | ||
@@ -527,0 +527,0 @@ export declare class WebrpcError extends Error { |
{ | ||
"name": "@0xsequence/relayer", | ||
"version": "0.0.0-20241007154931", | ||
"version": "0.0.0-20241107182529", | ||
"description": "relayer sub-package for Sequence", | ||
@@ -11,15 +11,15 @@ "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/relayer", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"@0xsequence/abi": "0.0.0-20241007154931", | ||
"@0xsequence/core": "0.0.0-20241007154931", | ||
"@0xsequence/utils": "0.0.0-20241007154931" | ||
}, | ||
"peerDependencies": { | ||
"ethers": ">=6" | ||
}, | ||
"dependencies": { | ||
"@0xsequence/abi": "0.0.0-20241107182529", | ||
"@0xsequence/core": "0.0.0-20241107182529", | ||
"@0xsequence/utils": "0.0.0-20241107182529" | ||
}, | ||
"devDependencies": { | ||
"@0xsequence/wallet-contracts": "^3.0.1", | ||
"ethers": "^6.13.0", | ||
"@0xsequence/signhub": "0.0.0-20241007154931", | ||
"@0xsequence/tests": "0.0.0-20241007154931" | ||
"ethers": "6.13.4", | ||
"@0xsequence/signhub": "0.0.0-20241107182529", | ||
"@0xsequence/tests": "0.0.0-20241107182529" | ||
}, | ||
@@ -26,0 +26,0 @@ "files": [ |
@@ -12,3 +12,3 @@ import { ethers } from 'ethers' | ||
export function isLocalRelayerOptions(obj: any): obj is LocalRelayerOptions { | ||
return typeof obj === 'object' && obj.signer instanceof ethers.AbstractSigner | ||
return typeof obj === 'object' && isAbstractSigner(obj.signer) | ||
} | ||
@@ -21,8 +21,4 @@ | ||
constructor(options: LocalRelayerOptions | ethers.AbstractSigner) { | ||
super( | ||
options instanceof ethers.AbstractSigner | ||
? { provider: options.provider! } | ||
: { ...options, provider: options.signer.provider! } | ||
) | ||
this.signer = options instanceof ethers.AbstractSigner ? options : options.signer | ||
super(isAbstractSigner(options) ? { provider: options.provider! } : { ...options, provider: options.signer.provider! }) | ||
this.signer = isAbstractSigner(options) ? options : options.signer | ||
if (!this.signer.provider) throw new Error('Signer must have a provider') | ||
@@ -86,1 +82,11 @@ } | ||
} | ||
function isAbstractSigner(signer: any): signer is ethers.AbstractSigner { | ||
return ( | ||
signer && | ||
typeof signer === 'object' && | ||
typeof signer.provider === 'object' && | ||
typeof signer.getAddress === 'function' && | ||
typeof signer.connect === 'function' | ||
) | ||
} |
@@ -23,3 +23,3 @@ import { ethers } from 'ethers' | ||
export function isProviderRelayerOptions(obj: any): obj is ProviderRelayerOptions { | ||
return typeof obj === 'object' && obj.provider instanceof ethers.AbstractProvider | ||
return typeof obj === 'object' && isAbstractProvider(obj.provider) | ||
} | ||
@@ -253,1 +253,10 @@ | ||
} | ||
function isAbstractProvider(provider: any): provider is ethers.AbstractProvider { | ||
return ( | ||
provider && | ||
typeof provider === 'object' && | ||
typeof provider.getNetwork === 'function' && | ||
typeof provider.getBlockNumber === 'function' | ||
) | ||
} |
@@ -26,8 +26,3 @@ import { ethers } from 'ethers' | ||
export function isRpcRelayerOptions(obj: any): obj is RpcRelayerOptions { | ||
return ( | ||
obj.url !== undefined && | ||
typeof obj.url === 'string' && | ||
obj.provider !== undefined && | ||
obj.provider instanceof ethers.AbstractProvider | ||
) | ||
return obj.url !== undefined && typeof obj.url === 'string' && obj.provider !== undefined && isAbstractProvider(obj.provider) | ||
} | ||
@@ -45,3 +40,3 @@ | ||
if (options.provider instanceof ethers.AbstractProvider) { | ||
if (isAbstractProvider(options.provider)) { | ||
this.provider = options.provider | ||
@@ -337,1 +332,10 @@ } else { | ||
} | ||
function isAbstractProvider(provider: any): provider is ethers.AbstractProvider { | ||
return ( | ||
provider && | ||
typeof provider === 'object' && | ||
typeof provider.getNetwork === 'function' && | ||
typeof provider.getBlockNumber === 'function' | ||
) | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
246241
6392
+ Added@0xsequence/abi@0.0.0-20241107182529(transitive)
+ Added@0xsequence/core@0.0.0-20241107182529(transitive)
+ Added@0xsequence/utils@0.0.0-20241107182529(transitive)
- Removed@0xsequence/abi@0.0.0-20241007154931(transitive)
- Removed@0xsequence/core@0.0.0-20241007154931(transitive)
- Removed@0xsequence/utils@0.0.0-20241007154931(transitive)