Commit d49feca1 authored by Kelvin Fichter's avatar Kelvin Fichter

fix(sdk): comment out getMessagesByAddress

Removes getMessagesByAddress from the SDK until we can get the function
to work properly. Likely requires the indexer to be integrated into the
SDK or to figure out some new way to quickly get all of the data we
need. Better to comment this out to avoid confusion.
parent 17b11bee
---
'@eth-optimism/sdk': patch
---
Comment out non-functional getMessagesByAddress function
...@@ -208,22 +208,22 @@ export class CrossChainMessenger implements ICrossChainMessenger { ...@@ -208,22 +208,22 @@ export class CrossChainMessenger implements ICrossChainMessenger {
}) })
} }
public async getMessagesByAddress( // public async getMessagesByAddress(
address: AddressLike, // address: AddressLike,
opts?: { // opts?: {
direction?: MessageDirection // direction?: MessageDirection
fromBlock?: NumberLike // fromBlock?: NumberLike
toBlock?: NumberLike // toBlock?: NumberLike
} // }
): Promise<CrossChainMessage[]> { // ): Promise<CrossChainMessage[]> {
throw new Error(` // throw new Error(`
The function getMessagesByAddress is currently not enabled because the sender parameter of // The function getMessagesByAddress is currently not enabled because the sender parameter of
the SentMessage event is not indexed within the CrossChainMessenger contracts. // the SentMessage event is not indexed within the CrossChainMessenger contracts.
getMessagesByAddress will be enabled by plugging in an Optimism Indexer (coming soon). // getMessagesByAddress will be enabled by plugging in an Optimism Indexer (coming soon).
See the following issue on GitHub for additional context: // See the following issue on GitHub for additional context:
https://github.com/ethereum-optimism/optimism/issues/2129 // https://github.com/ethereum-optimism/optimism/issues/2129
`) // `)
} // }
public async getBridgeForTokenPair( public async getBridgeForTokenPair(
l1Token: AddressLike, l1Token: AddressLike,
......
...@@ -103,27 +103,30 @@ export interface ICrossChainMessenger { ...@@ -103,27 +103,30 @@ export interface ICrossChainMessenger {
} }
): Promise<CrossChainMessage[]> ): Promise<CrossChainMessage[]>
/** // TODO: Make this function work. Likely requires indexer or the function will be prohibitively
* Retrieves all cross chain messages sent by a particular address. // slow to query all of the necessary data.
* //
* @param address Address to search for messages from. // /**
* @param opts Options object. // * Retrieves all cross chain messages sent by a particular address.
* @param opts.direction Direction to search for messages in. If not provided, will attempt to // *
* find all messages in both directions. // * @param address Address to search for messages from.
* @param opts.fromBlock Block to start searching for messages from. If not provided, will start // * @param opts Options object.
* from the first block (block #0). // * @param opts.direction Direction to search for messages in. If not provided, will attempt to
* @param opts.toBlock Block to stop searching for messages at. If not provided, will stop at the // * find all messages in both directions.
* latest known block ("latest"). // * @param opts.fromBlock Block to start searching for messages from. If not provided, will start
* @returns All cross chain messages sent by the particular address. // * from the first block (block #0).
*/ // * @param opts.toBlock Block to stop searching for messages at. If not provided, will stop at the
getMessagesByAddress( // * latest known block ("latest").
address: AddressLike, // * @returns All cross chain messages sent by the particular address.
opts?: { // */
direction?: MessageDirection // getMessagesByAddress(
fromBlock?: NumberLike // address: AddressLike,
toBlock?: NumberLike // opts?: {
} // direction?: MessageDirection
): Promise<CrossChainMessage[]> // fromBlock?: NumberLike
// toBlock?: NumberLike
// }
// ): Promise<CrossChainMessage[]>
/** /**
* Finds the appropriate bridge adapter for a given L1<>L2 token pair. Will throw if no bridges * Finds the appropriate bridge adapter for a given L1<>L2 token pair. Will throw if no bridges
......
...@@ -383,7 +383,8 @@ describe('CrossChainMessenger', () => { ...@@ -383,7 +383,8 @@ describe('CrossChainMessenger', () => {
}) })
}) })
describe('getMessagesByAddress', () => { // Skipped until getMessagesByAddress can be implemented
describe.skip('getMessagesByAddress', () => {
describe('when the address has sent messages', () => { describe('when the address has sent messages', () => {
describe('when no direction is specified', () => { describe('when no direction is specified', () => {
it('should find all messages sent by the address') it('should find all messages sent by the address')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment