Skip to content

Commit d49feca

Browse files
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.
1 parent 17b11be commit d49feca

4 files changed

Lines changed: 47 additions & 38 deletions

File tree

.changeset/slimy-walls-appear.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@eth-optimism/sdk': patch
3+
---
4+
5+
Comment out non-functional getMessagesByAddress function

packages/sdk/src/cross-chain-messenger.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -208,22 +208,22 @@ export class CrossChainMessenger implements ICrossChainMessenger {
208208
})
209209
}
210210

211-
public async getMessagesByAddress(
212-
address: AddressLike,
213-
opts?: {
214-
direction?: MessageDirection
215-
fromBlock?: NumberLike
216-
toBlock?: NumberLike
217-
}
218-
): Promise<CrossChainMessage[]> {
219-
throw new Error(`
220-
The function getMessagesByAddress is currently not enabled because the sender parameter of
221-
the SentMessage event is not indexed within the CrossChainMessenger contracts.
222-
getMessagesByAddress will be enabled by plugging in an Optimism Indexer (coming soon).
223-
See the following issue on GitHub for additional context:
224-
https://github.com/ethereum-optimism/optimism/issues/2129
225-
`)
226-
}
211+
// public async getMessagesByAddress(
212+
// address: AddressLike,
213+
// opts?: {
214+
// direction?: MessageDirection
215+
// fromBlock?: NumberLike
216+
// toBlock?: NumberLike
217+
// }
218+
// ): Promise<CrossChainMessage[]> {
219+
// throw new Error(`
220+
// The function getMessagesByAddress is currently not enabled because the sender parameter of
221+
// the SentMessage event is not indexed within the CrossChainMessenger contracts.
222+
// getMessagesByAddress will be enabled by plugging in an Optimism Indexer (coming soon).
223+
// See the following issue on GitHub for additional context:
224+
// https://github.com/ethereum-optimism/optimism/issues/2129
225+
// `)
226+
// }
227227

228228
public async getBridgeForTokenPair(
229229
l1Token: AddressLike,

packages/sdk/src/interfaces/cross-chain-messenger.ts

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -103,27 +103,30 @@ export interface ICrossChainMessenger {
103103
}
104104
): Promise<CrossChainMessage[]>
105105

106-
/**
107-
* Retrieves all cross chain messages sent by a particular address.
108-
*
109-
* @param address Address to search for messages from.
110-
* @param opts Options object.
111-
* @param opts.direction Direction to search for messages in. If not provided, will attempt to
112-
* find all messages in both directions.
113-
* @param opts.fromBlock Block to start searching for messages from. If not provided, will start
114-
* from the first block (block #0).
115-
* @param opts.toBlock Block to stop searching for messages at. If not provided, will stop at the
116-
* latest known block ("latest").
117-
* @returns All cross chain messages sent by the particular address.
118-
*/
119-
getMessagesByAddress(
120-
address: AddressLike,
121-
opts?: {
122-
direction?: MessageDirection
123-
fromBlock?: NumberLike
124-
toBlock?: NumberLike
125-
}
126-
): Promise<CrossChainMessage[]>
106+
// TODO: Make this function work. Likely requires indexer or the function will be prohibitively
107+
// slow to query all of the necessary data.
108+
//
109+
// /**
110+
// * Retrieves all cross chain messages sent by a particular address.
111+
// *
112+
// * @param address Address to search for messages from.
113+
// * @param opts Options object.
114+
// * @param opts.direction Direction to search for messages in. If not provided, will attempt to
115+
// * find all messages in both directions.
116+
// * @param opts.fromBlock Block to start searching for messages from. If not provided, will start
117+
// * from the first block (block #0).
118+
// * @param opts.toBlock Block to stop searching for messages at. If not provided, will stop at the
119+
// * latest known block ("latest").
120+
// * @returns All cross chain messages sent by the particular address.
121+
// */
122+
// getMessagesByAddress(
123+
// address: AddressLike,
124+
// opts?: {
125+
// direction?: MessageDirection
126+
// fromBlock?: NumberLike
127+
// toBlock?: NumberLike
128+
// }
129+
// ): Promise<CrossChainMessage[]>
127130

128131
/**
129132
* Finds the appropriate bridge adapter for a given L1<>L2 token pair. Will throw if no bridges

packages/sdk/test/cross-chain-messenger.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,8 @@ describe('CrossChainMessenger', () => {
383383
})
384384
})
385385

386-
describe('getMessagesByAddress', () => {
386+
// Skipped until getMessagesByAddress can be implemented
387+
describe.skip('getMessagesByAddress', () => {
387388
describe('when the address has sent messages', () => {
388389
describe('when no direction is specified', () => {
389390
it('should find all messages sent by the address')

0 commit comments

Comments
 (0)