Skip to content

Commit

Permalink
chore: renames to ChildToParentChain for classic
Browse files Browse the repository at this point in the history
  • Loading branch information
douglance committed Oct 2, 2023
1 parent 8c5386e commit f69b964
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
10 changes: 5 additions & 5 deletions src/lib/message/L2ToL1Message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export class ChildToParentChainMessage {
const logQueries = []
if (classicFilter.fromBlock !== classicFilter.toBlock) {
logQueries.push(
classic.ChainToParentChainMessageClassic.getChainToParentChainEvents(
classic.ChildToParentChainMessageClassic.getChildToParentChainEvents(
ChainProvider,
classicFilter,
position,
Expand Down Expand Up @@ -203,7 +203,7 @@ export class ChildToParentChainMessage {
* Provides read-only access for Chain-to-ParentChain-messages
*/
export class ChildToParentChainMessageReader extends ChildToParentChainMessage {
private readonly classicReader?: classic.ChainToParentChainMessageReaderClassic
private readonly classicReader?: classic.ChildToParentChainMessageReaderClassic
private readonly nitroReader?: nitro.ChildToParentChainMessageReaderNitro

constructor(
Expand All @@ -212,7 +212,7 @@ export class ChildToParentChainMessageReader extends ChildToParentChainMessage {
) {
super()
if (this.isClassic(event)) {
this.classicReader = new classic.ChainToParentChainMessageReaderClassic(
this.classicReader = new classic.ChildToParentChainMessageReaderClassic(
ParentChainProvider,
event.batchNumber,
event.indexInBatch
Expand Down Expand Up @@ -285,7 +285,7 @@ export class ChildToParentChainMessageReader extends ChildToParentChainMessage {
* Provides read and write access for Chain-to-ParentChain-messages
*/
export class ChildToParentChainMessageWriter extends ChildToParentChainMessageReader {
private readonly classicWriter?: classic.ChainToParentChainMessageWriterClassic
private readonly classicWriter?: classic.ChildToParentChainMessageWriterClassic
private readonly nitroWriter?: nitro.ChildToParentChainMessageWriterNitro

/**
Expand All @@ -303,7 +303,7 @@ export class ChildToParentChainMessageWriter extends ChildToParentChainMessageRe
super(ParentChainProvider ?? ParentChainSigner.provider!, event)

if (this.isClassic(event)) {
this.classicWriter = new classic.ChainToParentChainMessageWriterClassic(
this.classicWriter = new classic.ChildToParentChainMessageWriterClassic(
ParentChainSigner,
event.batchNumber,
event.indexInBatch,
Expand Down
58 changes: 29 additions & 29 deletions src/lib/message/L2ToL1MessageClassic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { ArbSys__factory } from '../abi/factories/ArbSys__factory'
import { Outbox__factory } from '../abi/classic/factories/Outbox__factory'

import { NodeInterface__factory } from '../abi/factories/NodeInterface__factory'
import { L2ToL1TransactionEvent as ChainToParentChainTransactionEvent } from '../abi/ArbSys'
import { L2ToL1TransactionEvent as ChildToParentChainTransactionEvent } from '../abi/ArbSys'
import { ContractTransaction, Overrides } from 'ethers'
import { EventFetcher } from '../utils/eventFetcher'
import {
Expand All @@ -39,7 +39,7 @@ import {
import { isDefined, wait } from '../utils/lib'
import { ArbSdkError } from '../dataEntities/errors'
import { EventArgs } from '../dataEntities/event'
import { L2ToL1MessageStatus as ChainToParentChainMessageStatus } from '../dataEntities/message'
import { L2ToL1MessageStatus as ChildToParentChainMessageStatus } from '../dataEntities/message'
import { getChainNetwork } from '../dataEntities/networks'

export interface MessageBatchProofInfo {
Expand Down Expand Up @@ -91,17 +91,17 @@ export interface MessageBatchProofInfo {

/**
* Conditional type for Signer or Provider. If T is of type Provider
* then ChainToParentChainMessageReaderOrWriter<T> will be of type ChainToParentChainMessageReader.
* If T is of type Signer then ChainToParentChainMessageReaderOrWriter<T> will be of
* type ChainToParentChainMessageWriter.
* then ChildToParentChainMessageReaderOrWriter<T> will be of type ChildToParentChainMessageReader.
* If T is of type Signer then ChildToParentChainMessageReaderOrWriter<T> will be of
* type ChildToParentChainMessageWriter.
*/
export type ChainToParentChainMessageReaderOrWriterClassic<
export type ChildToParentChainMessageReaderOrWriterClassic<
T extends SignerOrProvider
> = T extends Provider
? ChainToParentChainMessageReaderClassic
: ChainToParentChainMessageWriterClassic
? ChildToParentChainMessageReaderClassic
: ChildToParentChainMessageWriterClassic

export class ChainToParentChainMessageClassic {
export class ChildToParentChainMessageClassic {
/**
* The number of the batch this message is part of
*/
Expand All @@ -118,7 +118,7 @@ export class ChainToParentChainMessageClassic {
}

/**
* Instantiates a new `ChainToParentChainMessageWriterClassic` or `ChainToParentChainMessageReaderClassic` object.
* Instantiates a new `ChildToParentChainMessageWriterClassic` or `ChildToParentChainMessageReaderClassic` object.
*
* @param {SignerOrProvider} l1SignerOrProvider Signer or provider to be used for executing or reading the L2-to-L1 message.
* @param {BigNumber} batchNumber The number of the batch containing the L2-to-L1 message.
Expand All @@ -130,38 +130,38 @@ export class ChainToParentChainMessageClassic {
batchNumber: BigNumber,
indexInBatch: BigNumber,
l1Provider?: Provider
): ChainToParentChainMessageReaderOrWriterClassic<T>
): ChildToParentChainMessageReaderOrWriterClassic<T>
public static fromBatchNumber<T extends SignerOrProvider>(
l1SignerOrProvider: T,
batchNumber: BigNumber,
indexInBatch: BigNumber,
l1Provider?: Provider
):
| ChainToParentChainMessageReaderClassic
| ChainToParentChainMessageWriterClassic {
| ChildToParentChainMessageReaderClassic
| ChildToParentChainMessageWriterClassic {
return SignerProviderUtils.isSigner(l1SignerOrProvider)
? new ChainToParentChainMessageWriterClassic(
? new ChildToParentChainMessageWriterClassic(
l1SignerOrProvider,
batchNumber,
indexInBatch,
l1Provider
)
: new ChainToParentChainMessageReaderClassic(
: new ChildToParentChainMessageReaderClassic(
l1SignerOrProvider,
batchNumber,
indexInBatch
)
}

public static async getChainToParentChainEvents(
public static async getChildToParentChainEvents(
l2Provider: Provider,
filter: { fromBlock: BlockTag; toBlock: BlockTag },
batchNumber?: BigNumber,
destination?: string,
uniqueId?: BigNumber,
indexInBatch?: BigNumber
): Promise<
(EventArgs<ChainToParentChainTransactionEvent> & {
(EventArgs<ChildToParentChainTransactionEvent> & {
transactionHash: string
})[]
> {
Expand Down Expand Up @@ -189,7 +189,7 @@ export class ChainToParentChainMessageClassic {
/**
* Provides read-only access for classic l2-to-l1-messages
*/
export class ChainToParentChainMessageReaderClassic extends ChainToParentChainMessageClassic {
export class ChildToParentChainMessageReaderClassic extends ChildToParentChainMessageClassic {
constructor(
protected readonly l1Provider: Provider,
batchNumber: BigNumber,
Expand Down Expand Up @@ -285,7 +285,7 @@ export class ChainToParentChainMessageReaderClassic extends ChainToParentChainMe
l2Provider: Provider
): Promise<MessageBatchProofInfo | null> {
if (!isDefined(this.proof)) {
this.proof = await ChainToParentChainMessageReaderClassic.tryGetProof(
this.proof = await ChildToParentChainMessageReaderClassic.tryGetProof(
l2Provider,
this.batchNumber,
this.indexInBatch
Expand Down Expand Up @@ -337,19 +337,19 @@ export class ChainToParentChainMessageReaderClassic extends ChainToParentChainMe
*/
public async status(
l2Provider: Provider
): Promise<ChainToParentChainMessageStatus> {
): Promise<ChildToParentChainMessageStatus> {
try {
const messageExecuted = await this.hasExecuted(l2Provider)
if (messageExecuted) {
return ChainToParentChainMessageStatus.EXECUTED
return ChildToParentChainMessageStatus.EXECUTED
}

const outboxEntryExists = await this.outboxEntryExists(l2Provider)
return outboxEntryExists
? ChainToParentChainMessageStatus.CONFIRMED
: ChainToParentChainMessageStatus.UNCONFIRMED
? ChildToParentChainMessageStatus.CONFIRMED
: ChildToParentChainMessageStatus.UNCONFIRMED
} catch (e) {
return ChainToParentChainMessageStatus.UNCONFIRMED
return ChildToParentChainMessageStatus.UNCONFIRMED
}
}

Expand Down Expand Up @@ -389,9 +389,9 @@ export class ChainToParentChainMessageReaderClassic extends ChainToParentChainMe
/**
* Provides read and write access for classic l2-to-l1-messages
*/
export class ChainToParentChainMessageWriterClassic extends ChainToParentChainMessageReaderClassic {
export class ChildToParentChainMessageWriterClassic extends ChildToParentChainMessageReaderClassic {
/**
* Instantiates a new `ChainToParentChainMessageWriterClassic` object.
* Instantiates a new `ChildToParentChainMessageWriterClassic` object.
*
* @param {Signer} l1Signer The signer to be used for executing the L2-to-L1 message.
* @param {BigNumber} batchNumber The number of the batch containing the L2-to-L1 message.
Expand All @@ -408,7 +408,7 @@ export class ChainToParentChainMessageWriterClassic extends ChainToParentChainMe
}

/**
* Executes the ChainToParentChainMessage on L1.
* Executes the ChildToParentChainMessage on L1.
* Will throw an error if the outbox entry has not been created, which happens when the
* corresponding assertion is confirmed.
* @returns
Expand All @@ -418,9 +418,9 @@ export class ChainToParentChainMessageWriterClassic extends ChainToParentChainMe
overrides?: Overrides
): Promise<ContractTransaction> {
const status = await this.status(l2Provider)
if (status !== ChainToParentChainMessageStatus.CONFIRMED) {
if (status !== ChildToParentChainMessageStatus.CONFIRMED) {
throw new ArbSdkError(
`Cannot execute message. Status is: ${status} but must be ${ChainToParentChainMessageStatus.CONFIRMED}.`
`Cannot execute message. Status is: ${status} but must be ${ChildToParentChainMessageStatus.CONFIRMED}.`
)
}

Expand Down

0 comments on commit f69b964

Please sign in to comment.