Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
dc5f6517
Unverified
Commit
dc5f6517
authored
Feb 11, 2022
by
Antonis Kogias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
deleted watch-utils and added the utilities in env.ts
parent
d9fdc5d6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
58 deletions
+48
-58
nasty-donkeys-collect.md
.changeset/nasty-donkeys-collect.md
+5
-0
env.ts
integration-tests/test/shared/env.ts
+43
-8
watcher-utils.ts
integration-tests/test/shared/watcher-utils.ts
+0
-50
No files found.
.changeset/nasty-donkeys-collect.md
0 → 100644
View file @
dc5f6517
---
'
@eth-optimism/integration-tests'
:
patch
---
Deletes watcher-utils.ts. Moves it's utilities into env.ts.
integration-tests/test/shared/env.ts
View file @
dc5f6517
/* Imports: External */
/* Imports: External */
import
{
Contract
,
utils
,
Wallet
,
providers
}
from
'
ethers
'
import
{
Contract
,
utils
,
Wallet
,
providers
,
Transaction
}
from
'
ethers
'
import
{
TransactionResponse
}
from
'
@ethersproject/providers
'
import
{
TransactionResponse
,
TransactionReceipt
,
}
from
'
@ethersproject/providers
'
import
{
getContractFactory
,
predeploys
}
from
'
@eth-optimism/contracts
'
import
{
getContractFactory
,
predeploys
}
from
'
@eth-optimism/contracts
'
import
{
sleep
}
from
'
@eth-optimism/core-utils
'
import
{
sleep
}
from
'
@eth-optimism/core-utils
'
import
{
CrossChainMessenger
,
MessageStatus
}
from
'
@eth-optimism/sdk
'
import
{
CrossChainMessenger
,
MessageStatus
,
MessageDirection
,
}
from
'
@eth-optimism/sdk
'
/* Imports: Internal */
/* Imports: Internal */
import
{
import
{
...
@@ -21,10 +28,13 @@ import {
...
@@ -21,10 +28,13 @@ import {
getL2Bridge
,
getL2Bridge
,
envConfig
,
envConfig
,
}
from
'
./utils
'
}
from
'
./utils
'
import
{
CrossDomainMessagePair
,
export
interface
CrossDomainMessagePair
{
waitForXDomainTransaction
,
tx
:
Transaction
}
from
'
./watcher-utils
'
receipt
:
TransactionReceipt
remoteTx
:
Transaction
remoteReceipt
:
TransactionReceipt
}
/// Helper class for instantiating a test environment with a funded account
/// Helper class for instantiating a test environment with a funded account
export
class
OptimismEnv
{
export
class
OptimismEnv
{
...
@@ -168,7 +178,32 @@ export class OptimismEnv {
...
@@ -168,7 +178,32 @@ export class OptimismEnv {
async
waitForXDomainTransaction
(
async
waitForXDomainTransaction
(
tx
:
Promise
<
TransactionResponse
>
|
TransactionResponse
tx
:
Promise
<
TransactionResponse
>
|
TransactionResponse
):
Promise
<
CrossDomainMessagePair
>
{
):
Promise
<
CrossDomainMessagePair
>
{
return
waitForXDomainTransaction
(
this
.
messenger
,
tx
)
// await it if needed
tx
=
await
tx
const
receipt
=
await
tx
.
wait
()
const
resolved
=
await
this
.
messenger
.
toCrossChainMessage
(
tx
)
const
messageReceipt
=
await
this
.
messenger
.
waitForMessageReceipt
(
tx
)
let
fullTx
:
any
let
remoteTx
:
any
if
(
resolved
.
direction
===
MessageDirection
.
L1_TO_L2
)
{
fullTx
=
await
this
.
messenger
.
l1Provider
.
getTransaction
(
tx
.
hash
)
remoteTx
=
await
this
.
messenger
.
l2Provider
.
getTransaction
(
messageReceipt
.
transactionReceipt
.
transactionHash
)
}
else
{
fullTx
=
await
this
.
messenger
.
l2Provider
.
getTransaction
(
tx
.
hash
)
remoteTx
=
await
this
.
messenger
.
l1Provider
.
getTransaction
(
messageReceipt
.
transactionReceipt
.
transactionHash
)
}
return
{
tx
:
fullTx
,
receipt
,
remoteTx
,
remoteReceipt
:
messageReceipt
.
transactionReceipt
,
}
}
}
/**
/**
...
...
integration-tests/test/shared/watcher-utils.ts
deleted
100644 → 0
View file @
d9fdc5d6
import
{
TransactionReceipt
,
TransactionResponse
,
}
from
'
@ethersproject/providers
'
import
{
Transaction
}
from
'
ethers
'
import
{
CrossChainMessenger
,
MessageDirection
}
from
'
@eth-optimism/sdk
'
export
interface
CrossDomainMessagePair
{
tx
:
Transaction
receipt
:
TransactionReceipt
remoteTx
:
Transaction
remoteReceipt
:
TransactionReceipt
}
export
enum
Direction
{
L1ToL2
,
L2ToL1
,
}
export
const
waitForXDomainTransaction
=
async
(
messenger
:
CrossChainMessenger
,
tx
:
Promise
<
TransactionResponse
>
|
TransactionResponse
):
Promise
<
CrossDomainMessagePair
>
=>
{
// await it if needed
tx
=
await
tx
const
receipt
=
await
tx
.
wait
()
const
resolved
=
await
messenger
.
toCrossChainMessage
(
tx
)
const
messageReceipt
=
await
messenger
.
waitForMessageReceipt
(
tx
)
let
fullTx
:
any
let
remoteTx
:
any
if
(
resolved
.
direction
===
MessageDirection
.
L1_TO_L2
)
{
fullTx
=
await
messenger
.
l1Provider
.
getTransaction
(
tx
.
hash
)
remoteTx
=
await
messenger
.
l2Provider
.
getTransaction
(
messageReceipt
.
transactionReceipt
.
transactionHash
)
}
else
{
fullTx
=
await
messenger
.
l2Provider
.
getTransaction
(
tx
.
hash
)
remoteTx
=
await
messenger
.
l1Provider
.
getTransaction
(
messageReceipt
.
transactionReceipt
.
transactionHash
)
}
return
{
tx
:
fullTx
,
receipt
,
remoteTx
,
remoteReceipt
:
messageReceipt
.
transactionReceipt
,
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment