Commit c4120a2f authored by smartcontracts's avatar smartcontracts Committed by GitHub

Merge pull request #2330 from ethereum-optimism/sc/sdk-rm-messages-fn

fix(sdk): comment out getMessagesByAddress
parents 86b34454 d49feca1
---
'@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