@0xsequence/multicall
Advanced tools
Comparing version 0.11.1 to 0.11.2
# @0xsequence/multicall | ||
## 0.11.2 | ||
### Patch Changes | ||
- Fix multicall proxy scopes | ||
- Updated dependencies [undefined] | ||
- @0xsequence/abi@0.11.2 | ||
- @0xsequence/network@0.11.2 | ||
- @0xsequence/utils@0.11.2 | ||
## 0.11.1 | ||
@@ -4,0 +14,0 @@ |
@@ -343,2 +343,3 @@ 'use strict'; | ||
const ProxyMethods = ['getNetwork', 'getBlockNumber', 'getGasPrice', 'getTransactionCount', 'getStorageAt', 'sendTransaction', 'estimateGas', 'getBlock', 'getTransaction', 'getTransactionReceipt', 'getLogs', 'emit', 'litenerCount', 'addListener', 'removeListener', 'waitForTransaction', 'detectNetwork', 'getBlockWithTransactions']; | ||
class MulticallProvider extends ethers.ethers.providers.BaseProvider { | ||
@@ -354,24 +355,2 @@ constructor(provider, multicall) { | ||
this.getBlockWithTransactions = blockHashOrBlockTag => { | ||
throw new Error('unsupported'); | ||
}; | ||
this.getNetwork = this.provider.getNetwork; | ||
this.getBlockNumber = this.provider.getBlockNumber; | ||
this.getGasPrice = this.provider.getGasPrice; | ||
this.getTransactionCount = this.provider.getTransactionCount; | ||
this.getStorageAt = this.provider.getStorageAt; | ||
this.sendTransaction = this.provider.sendTransaction; | ||
this.estimateGas = this.provider.estimateGas; | ||
this.getBlock = this.provider.getBlock; | ||
this.getTransaction = this.provider.getTransaction; | ||
this.getTransactionReceipt = this.provider.getTransactionReceipt; | ||
this.getLogs = this.provider.getLogs; | ||
this.emit = this.provider.emit; | ||
this.litenerCount = this.provider.listenerCount; | ||
this.listeners = this.provider.listeners; | ||
this.addListener = this.provider.addListener; | ||
this.removeListener = this.provider.removeListener; | ||
this.waitForTransaction = this.provider.waitForTransaction; | ||
this.getResolver = async function (name) { | ||
@@ -412,2 +391,7 @@ const provider = _this.provider; | ||
this.multicall = Multicall.isMulticall(multicall) ? multicall : new Multicall(multicall); | ||
ProxyMethods.forEach(m => { | ||
if (provider[m] !== undefined) { | ||
this[m] = (...args) => provider[m](...args); | ||
} | ||
}); | ||
} | ||
@@ -451,23 +435,35 @@ | ||
constructor(provider, multicall) { | ||
var _this = this; | ||
this.provider = provider; | ||
this.multicall = void 0; | ||
this.multicall = Multicall.isMulticall(multicall) ? multicall : new Multicall(multicall); | ||
this.next = async function (req, callback) { | ||
const cb = _this.provider.send ? _this.provider.send : _this.provider.sendAsync; | ||
cb(req, callback); | ||
}; | ||
if (provider.send) { | ||
const next = async function next(req, callback) { | ||
provider.send(req, callback); | ||
}; | ||
this.sendAsync = (request, callback) => { | ||
this.multicall.handle(this.next, request, callback); | ||
}; | ||
this.send = (request, callback) => { | ||
this.multicall.handle(next, request, callback); | ||
}; | ||
} | ||
this.send = (request, callback) => { | ||
this.multicall.handle(this.next, request, callback); | ||
}; | ||
if (provider.sendAsync) { | ||
const next = async function next(req, callback) { | ||
provider.sendAsync(req, callback); | ||
}; | ||
this.multicall = Multicall.isMulticall(multicall) ? multicall : new Multicall(multicall); | ||
this.sendAsync = (request, callback) => { | ||
this.multicall.handle(next, request, callback); | ||
}; | ||
} | ||
} | ||
get isMetaMask() { | ||
return this.provider.isMetaMask; | ||
} | ||
get isStatus() { | ||
return this.provider.isStatus; | ||
} | ||
} | ||
@@ -484,2 +480,3 @@ | ||
__proto__: null, | ||
ProxyMethods: ProxyMethods, | ||
MulticallProvider: MulticallProvider, | ||
@@ -486,0 +483,0 @@ MulticallExternalProvider: MulticallExternalProvider, |
@@ -343,2 +343,3 @@ 'use strict'; | ||
const ProxyMethods = ['getNetwork', 'getBlockNumber', 'getGasPrice', 'getTransactionCount', 'getStorageAt', 'sendTransaction', 'estimateGas', 'getBlock', 'getTransaction', 'getTransactionReceipt', 'getLogs', 'emit', 'litenerCount', 'addListener', 'removeListener', 'waitForTransaction', 'detectNetwork', 'getBlockWithTransactions']; | ||
class MulticallProvider extends ethers.ethers.providers.BaseProvider { | ||
@@ -354,24 +355,2 @@ constructor(provider, multicall) { | ||
this.getBlockWithTransactions = blockHashOrBlockTag => { | ||
throw new Error('unsupported'); | ||
}; | ||
this.getNetwork = this.provider.getNetwork; | ||
this.getBlockNumber = this.provider.getBlockNumber; | ||
this.getGasPrice = this.provider.getGasPrice; | ||
this.getTransactionCount = this.provider.getTransactionCount; | ||
this.getStorageAt = this.provider.getStorageAt; | ||
this.sendTransaction = this.provider.sendTransaction; | ||
this.estimateGas = this.provider.estimateGas; | ||
this.getBlock = this.provider.getBlock; | ||
this.getTransaction = this.provider.getTransaction; | ||
this.getTransactionReceipt = this.provider.getTransactionReceipt; | ||
this.getLogs = this.provider.getLogs; | ||
this.emit = this.provider.emit; | ||
this.litenerCount = this.provider.listenerCount; | ||
this.listeners = this.provider.listeners; | ||
this.addListener = this.provider.addListener; | ||
this.removeListener = this.provider.removeListener; | ||
this.waitForTransaction = this.provider.waitForTransaction; | ||
this.getResolver = async function (name) { | ||
@@ -412,2 +391,7 @@ const provider = _this.provider; | ||
this.multicall = Multicall.isMulticall(multicall) ? multicall : new Multicall(multicall); | ||
ProxyMethods.forEach(m => { | ||
if (provider[m] !== undefined) { | ||
this[m] = (...args) => provider[m](...args); | ||
} | ||
}); | ||
} | ||
@@ -451,23 +435,35 @@ | ||
constructor(provider, multicall) { | ||
var _this = this; | ||
this.provider = provider; | ||
this.multicall = void 0; | ||
this.multicall = Multicall.isMulticall(multicall) ? multicall : new Multicall(multicall); | ||
this.next = async function (req, callback) { | ||
const cb = _this.provider.send ? _this.provider.send : _this.provider.sendAsync; | ||
cb(req, callback); | ||
}; | ||
if (provider.send) { | ||
const next = async function next(req, callback) { | ||
provider.send(req, callback); | ||
}; | ||
this.sendAsync = (request, callback) => { | ||
this.multicall.handle(this.next, request, callback); | ||
}; | ||
this.send = (request, callback) => { | ||
this.multicall.handle(next, request, callback); | ||
}; | ||
} | ||
this.send = (request, callback) => { | ||
this.multicall.handle(this.next, request, callback); | ||
}; | ||
if (provider.sendAsync) { | ||
const next = async function next(req, callback) { | ||
provider.sendAsync(req, callback); | ||
}; | ||
this.multicall = Multicall.isMulticall(multicall) ? multicall : new Multicall(multicall); | ||
this.sendAsync = (request, callback) => { | ||
this.multicall.handle(next, request, callback); | ||
}; | ||
} | ||
} | ||
get isMetaMask() { | ||
return this.provider.isMetaMask; | ||
} | ||
get isStatus() { | ||
return this.provider.isStatus; | ||
} | ||
} | ||
@@ -484,2 +480,3 @@ | ||
__proto__: null, | ||
ProxyMethods: ProxyMethods, | ||
MulticallProvider: MulticallProvider, | ||
@@ -486,0 +483,0 @@ MulticallExternalProvider: MulticallExternalProvider, |
@@ -339,2 +339,3 @@ import { BigNumber, ethers } from 'ethers'; | ||
const ProxyMethods = ['getNetwork', 'getBlockNumber', 'getGasPrice', 'getTransactionCount', 'getStorageAt', 'sendTransaction', 'estimateGas', 'getBlock', 'getTransaction', 'getTransactionReceipt', 'getLogs', 'emit', 'litenerCount', 'addListener', 'removeListener', 'waitForTransaction', 'detectNetwork', 'getBlockWithTransactions']; | ||
class MulticallProvider extends ethers.providers.BaseProvider { | ||
@@ -350,24 +351,2 @@ constructor(provider, multicall) { | ||
this.getBlockWithTransactions = blockHashOrBlockTag => { | ||
throw new Error('unsupported'); | ||
}; | ||
this.getNetwork = this.provider.getNetwork; | ||
this.getBlockNumber = this.provider.getBlockNumber; | ||
this.getGasPrice = this.provider.getGasPrice; | ||
this.getTransactionCount = this.provider.getTransactionCount; | ||
this.getStorageAt = this.provider.getStorageAt; | ||
this.sendTransaction = this.provider.sendTransaction; | ||
this.estimateGas = this.provider.estimateGas; | ||
this.getBlock = this.provider.getBlock; | ||
this.getTransaction = this.provider.getTransaction; | ||
this.getTransactionReceipt = this.provider.getTransactionReceipt; | ||
this.getLogs = this.provider.getLogs; | ||
this.emit = this.provider.emit; | ||
this.litenerCount = this.provider.listenerCount; | ||
this.listeners = this.provider.listeners; | ||
this.addListener = this.provider.addListener; | ||
this.removeListener = this.provider.removeListener; | ||
this.waitForTransaction = this.provider.waitForTransaction; | ||
this.getResolver = async function (name) { | ||
@@ -408,2 +387,7 @@ const provider = _this.provider; | ||
this.multicall = Multicall.isMulticall(multicall) ? multicall : new Multicall(multicall); | ||
ProxyMethods.forEach(m => { | ||
if (provider[m] !== undefined) { | ||
this[m] = (...args) => provider[m](...args); | ||
} | ||
}); | ||
} | ||
@@ -447,23 +431,35 @@ | ||
constructor(provider, multicall) { | ||
var _this = this; | ||
this.provider = provider; | ||
this.multicall = void 0; | ||
this.multicall = Multicall.isMulticall(multicall) ? multicall : new Multicall(multicall); | ||
this.next = async function (req, callback) { | ||
const cb = _this.provider.send ? _this.provider.send : _this.provider.sendAsync; | ||
cb(req, callback); | ||
}; | ||
if (provider.send) { | ||
const next = async function next(req, callback) { | ||
provider.send(req, callback); | ||
}; | ||
this.sendAsync = (request, callback) => { | ||
this.multicall.handle(this.next, request, callback); | ||
}; | ||
this.send = (request, callback) => { | ||
this.multicall.handle(next, request, callback); | ||
}; | ||
} | ||
this.send = (request, callback) => { | ||
this.multicall.handle(this.next, request, callback); | ||
}; | ||
if (provider.sendAsync) { | ||
const next = async function next(req, callback) { | ||
provider.sendAsync(req, callback); | ||
}; | ||
this.multicall = Multicall.isMulticall(multicall) ? multicall : new Multicall(multicall); | ||
this.sendAsync = (request, callback) => { | ||
this.multicall.handle(next, request, callback); | ||
}; | ||
} | ||
} | ||
get isMetaMask() { | ||
return this.provider.isMetaMask; | ||
} | ||
get isStatus() { | ||
return this.provider.isStatus; | ||
} | ||
} | ||
@@ -480,2 +476,3 @@ | ||
__proto__: null, | ||
ProxyMethods: ProxyMethods, | ||
MulticallProvider: MulticallProvider, | ||
@@ -482,0 +479,0 @@ MulticallExternalProvider: MulticallExternalProvider, |
import { ExternalProvider } from '@ethersproject/providers'; | ||
import { Multicall, MulticallOptions } from '../multicall'; | ||
import { JsonRpcRequest, JsonRpcResponseCallback } from "@0xsequence/network"; | ||
export declare class MulticallExternalProvider implements ExternalProvider { | ||
@@ -8,5 +7,4 @@ private provider; | ||
constructor(provider: ExternalProvider, multicall?: Multicall | Partial<MulticallOptions>); | ||
next: (req: JsonRpcRequest, callback: JsonRpcResponseCallback) => Promise<void>; | ||
sendAsync: (request: JsonRpcRequest, callback: JsonRpcResponseCallback) => void; | ||
send: (request: JsonRpcRequest, callback: JsonRpcResponseCallback) => void; | ||
get isMetaMask(): boolean | undefined; | ||
get isStatus(): boolean | undefined; | ||
} |
import { ethers, BigNumber } from 'ethers'; | ||
import { BlockTag, BlockWithTransactions } from '@ethersproject/abstract-provider'; | ||
import { Deferrable } from '@ethersproject/properties'; | ||
import { Multicall, MulticallOptions } from '../multicall'; | ||
import { JsonRpcRequest, JsonRpcResponseCallback } from "@0xsequence/network"; | ||
export declare const ProxyMethods: string[]; | ||
export declare class MulticallProvider extends ethers.providers.BaseProvider { | ||
@@ -11,20 +11,2 @@ private provider; | ||
listenerCount: (eventName?: ethers.providers.EventType | undefined) => number; | ||
getBlockWithTransactions: (blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>) => Promise<BlockWithTransactions>; | ||
getNetwork: () => Promise<ethers.providers.Network>; | ||
getBlockNumber: () => Promise<number>; | ||
getGasPrice: () => Promise<import("@ethersproject/bignumber").BigNumber>; | ||
getTransactionCount: (addressOrName: string | Promise<string>, blockTag?: ethers.providers.BlockTag | Promise<ethers.providers.BlockTag> | undefined) => Promise<number>; | ||
getStorageAt: (addressOrName: string | Promise<string>, position: import("@ethersproject/bignumber").BigNumberish | Promise<import("@ethersproject/bignumber").BigNumberish>, blockTag?: ethers.providers.BlockTag | Promise<ethers.providers.BlockTag> | undefined) => Promise<string>; | ||
sendTransaction: (signedTransaction: string | Promise<string>) => Promise<ethers.providers.TransactionResponse>; | ||
estimateGas: (transaction: Deferrable<ethers.providers.TransactionRequest>) => Promise<import("@ethersproject/bignumber").BigNumber>; | ||
getBlock: (blockHashOrBlockTag: ethers.providers.BlockTag | Promise<ethers.providers.BlockTag>) => Promise<ethers.providers.Block>; | ||
getTransaction: (transactionHash: string) => Promise<ethers.providers.TransactionResponse>; | ||
getTransactionReceipt: (transactionHash: string) => Promise<ethers.providers.TransactionReceipt>; | ||
getLogs: (filter: ethers.providers.Filter) => Promise<ethers.providers.Log[]>; | ||
emit: (eventName: ethers.providers.EventType, ...args: any[]) => boolean; | ||
litenerCount: (eventName?: ethers.providers.EventType | undefined) => number; | ||
listeners: (eventName?: ethers.providers.EventType | undefined) => ethers.providers.Listener[]; | ||
addListener: (eventName: ethers.providers.EventType, listener: ethers.providers.Listener) => ethers.providers.Provider; | ||
removeListener: (eventName: ethers.providers.EventType, listener: ethers.providers.Listener) => ethers.providers.Provider; | ||
waitForTransaction: (transactionHash: string, confirmations?: number | undefined, timeout?: number | undefined) => Promise<ethers.providers.TransactionReceipt>; | ||
getResolver: (name: string | Promise<string>) => Promise<ethers.providers.Resolver>; | ||
@@ -31,0 +13,0 @@ next: (req: JsonRpcRequest, callback: JsonRpcResponseCallback) => Promise<void>; |
{ | ||
"name": "@0xsequence/multicall", | ||
"version": "0.11.1", | ||
"version": "0.11.2", | ||
"description": "multicall sub-package for Sequence", | ||
@@ -16,5 +16,5 @@ "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/multicall", | ||
"dependencies": { | ||
"@0xsequence/abi": "^0.11.1", | ||
"@0xsequence/network": "^0.11.1", | ||
"@0xsequence/utils": "^0.11.1", | ||
"@0xsequence/abi": "^0.11.2", | ||
"@0xsequence/network": "^0.11.2", | ||
"@0xsequence/utils": "^0.11.2", | ||
"@ethersproject/providers": "^5.0.24", | ||
@@ -21,0 +21,0 @@ "ethers": "^5.0.32" |
@@ -10,16 +10,31 @@ import { ExternalProvider } from '@ethersproject/providers' | ||
this.multicall = Multicall.isMulticall(multicall) ? multicall : new Multicall(multicall!) | ||
} | ||
next = async (req: JsonRpcRequest, callback: JsonRpcResponseCallback) => { | ||
const cb = this.provider.send ? this.provider.send : this.provider.sendAsync | ||
cb!(req, callback) | ||
if (provider.send) { | ||
const next = async (req: JsonRpcRequest, callback: JsonRpcResponseCallback) => { | ||
provider.send!(req, callback) | ||
} | ||
(this as any).send = (request: JsonRpcRequest, callback: JsonRpcResponseCallback) => { | ||
this.multicall.handle(next, request, callback) | ||
} | ||
} | ||
if (provider.sendAsync) { | ||
const next = async (req: JsonRpcRequest, callback: JsonRpcResponseCallback) => { | ||
provider.sendAsync!(req, callback) | ||
} | ||
(this as any).sendAsync = (request: JsonRpcRequest, callback: JsonRpcResponseCallback) => { | ||
this.multicall.handle(next, request, callback) | ||
} | ||
} | ||
} | ||
sendAsync = (request: JsonRpcRequest, callback: JsonRpcResponseCallback) => { | ||
this.multicall.handle(this.next, request, callback) | ||
public get isMetaMask() { | ||
return this.provider.isMetaMask | ||
} | ||
send = (request: JsonRpcRequest, callback: JsonRpcResponseCallback) => { | ||
this.multicall.handle(this.next, request, callback) | ||
public get isStatus() { | ||
return this.provider.isStatus | ||
} | ||
} |
import { ethers , BigNumber } from 'ethers' | ||
import { BlockTag, BlockWithTransactions } from '@ethersproject/abstract-provider' | ||
import { Deferrable } from '@ethersproject/properties' | ||
@@ -9,2 +8,23 @@ import { promisify, getRandomInt } from '@0xsequence/utils' | ||
export const ProxyMethods = [ | ||
'getNetwork', | ||
'getBlockNumber', | ||
'getGasPrice', | ||
'getTransactionCount', | ||
'getStorageAt', | ||
'sendTransaction', | ||
'estimateGas', | ||
'getBlock', | ||
'getTransaction', | ||
'getTransactionReceipt', | ||
'getLogs', | ||
'emit', | ||
'litenerCount', | ||
'addListener', | ||
'removeListener', | ||
'waitForTransaction', | ||
'detectNetwork', | ||
'getBlockWithTransactions' | ||
] | ||
export class MulticallProvider extends ethers.providers.BaseProvider { | ||
@@ -16,2 +36,8 @@ private multicall: Multicall | ||
this.multicall = Multicall.isMulticall(multicall) ? multicall : new Multicall(multicall) | ||
ProxyMethods.forEach((m) => { | ||
if ((provider as any)[m] !== undefined) { | ||
(this as any)[m] = (...args: any) => (provider as any)[m](...args) | ||
} | ||
}) | ||
} | ||
@@ -21,24 +47,2 @@ | ||
getBlockWithTransactions = (blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<BlockWithTransactions> => { | ||
throw new Error('unsupported') | ||
} | ||
getNetwork = this.provider.getNetwork | ||
getBlockNumber = this.provider.getBlockNumber | ||
getGasPrice = this.provider.getGasPrice | ||
getTransactionCount = this.provider.getTransactionCount | ||
getStorageAt = this.provider.getStorageAt | ||
sendTransaction = this.provider.sendTransaction | ||
estimateGas = this.provider.estimateGas | ||
getBlock = this.provider.getBlock | ||
getTransaction = this.provider.getTransaction | ||
getTransactionReceipt = this.provider.getTransactionReceipt | ||
getLogs = this.provider.getLogs | ||
emit = this.provider.emit | ||
litenerCount = this.provider.listenerCount | ||
listeners = this.provider.listeners | ||
addListener = this.provider.addListener | ||
removeListener = this.provider.removeListener | ||
waitForTransaction = this.provider.waitForTransaction | ||
getResolver = async (name: string | Promise<string>) => { | ||
@@ -45,0 +49,0 @@ const provider = this.provider as ethers.providers.BaseProvider |
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
77069
1704
Updated@0xsequence/abi@^0.11.2
Updated@0xsequence/network@^0.11.2
Updated@0xsequence/utils@^0.11.2