Skip to content

Commit 60d11ff

Browse files
authored
feat: add clone impls for binding calls (#98)
1 parent af64568 commit 60d11ff

File tree

2 files changed

+93
-1
lines changed

2 files changed

+93
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ members = ["crates/*"]
33
resolver = "2"
44

55
[workspace.package]
6-
version = "0.8.1"
6+
version = "0.8.2"
77
edition = "2021"
88
rust-version = "1.81"
99
authors = ["init4"]

crates/zenith/src/bindings.rs

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@ mod zenith {
2929
impl Copy for Zenith::OnlySequencerAdmin {}
3030
impl Copy for Zenith::IncorrectHostBlock {}
3131

32+
impl Clone for Zenith::ZenithCalls {
33+
fn clone(&self) -> Self {
34+
use self::Zenith::ZenithCalls::*;
35+
match self {
36+
sequencerAdmin(call) => sequencerAdmin(call.clone()),
37+
deployBlockNumber(call) => deployBlockNumber(call.clone()),
38+
lastSubmittedAtBlock(call) => lastSubmittedAtBlock(call.clone()),
39+
isSequencer(call) => isSequencer(call.clone()),
40+
addSequencer(call) => addSequencer(call.clone()),
41+
removeSequencer(call) => removeSequencer(call.clone()),
42+
submitBlock(call) => submitBlock(call.clone()),
43+
blockCommitment(call) => blockCommitment(call.clone()),
44+
}
45+
}
46+
}
47+
3248
impl Zenith::BlockSubmitted {
3349
/// Get the sequencer address that signed the block.
3450
pub const fn sequencer(&self) -> Address {
@@ -134,6 +150,26 @@ mod passage {
134150
}
135151
}
136152

153+
impl Clone for Passage::PassageCalls {
154+
fn clone(&self) -> Self {
155+
use self::Passage::PassageCalls::*;
156+
match self {
157+
canEnter(call) => canEnter(call.clone()),
158+
configureEnter(call) => configureEnter(call.clone()),
159+
defaultRollupChainId(call) => defaultRollupChainId(call.clone()),
160+
enter_0(call) => enter_0(call.clone()),
161+
enter_1(call) => enter_1(call.clone()),
162+
enterToken_0(call) => enterToken_0(call.clone()),
163+
enterToken_1(call) => enterToken_1(call.clone()),
164+
enterTokenPermit2(call) => enterTokenPermit2(call.clone()),
165+
enterWitness(call) => enterWitness(call.clone()),
166+
exitWitness(call) => exitWitness(call.clone()),
167+
tokenAdmin(call) => tokenAdmin(call.clone()),
168+
withdraw(call) => withdraw(call.clone()),
169+
}
170+
}
171+
}
172+
137173
impl Passage::EnterToken {
138174
/// Get the chain ID of the event (discarding high bytes), returns `None`
139175
/// if the event has no associated chain id.
@@ -247,6 +283,20 @@ mod orders {
247283
}
248284
}
249285

286+
impl Clone for Orders::OrdersCalls {
287+
fn clone(&self) -> Self {
288+
use self::Orders::OrdersCalls::*;
289+
match self {
290+
fill(call) => fill(call.clone()),
291+
fillPermit2(call) => fillPermit2(call.clone()),
292+
initiate(call) => initiate(call.clone()),
293+
initiatePermit2(call) => initiatePermit2(call.clone()),
294+
outputWitness(call) => outputWitness(call.clone()),
295+
sweep(call) => sweep(call.clone()),
296+
}
297+
}
298+
}
299+
250300
impl IOrders::Input {
251301
pub const fn token(&self) -> Address {
252302
self.token
@@ -376,6 +426,24 @@ mod transactor {
376426
}
377427
}
378428

429+
impl Clone for Transactor::TransactorCalls {
430+
fn clone(&self) -> Self {
431+
use self::Transactor::TransactorCalls::*;
432+
match self {
433+
configureGas(call) => configureGas(call.clone()),
434+
defaultRollupChainId(call) => defaultRollupChainId(call.clone()),
435+
enterTransact(call) => enterTransact(call.clone()),
436+
transact_0(call) => transact_0(call.clone()),
437+
transact_1(call) => transact_1(call.clone()),
438+
gasAdmin(call) => gasAdmin(call.clone()),
439+
passage(call) => passage(call.clone()),
440+
perBlockGasLimit(call) => perBlockGasLimit(call.clone()),
441+
perTransactGasLimit(call) => perTransactGasLimit(call.clone()),
442+
transactGasUsed(call) => transactGasUsed(call.clone()),
443+
}
444+
}
445+
}
446+
379447
impl Transactor::Transact {
380448
pub const fn rollup_chain_id(&self) -> u64 {
381449
self.rollupChainId.as_limbs()[0]
@@ -429,6 +497,19 @@ mod rollup_passage {
429497
*self
430498
}
431499
}
500+
501+
impl Clone for RollupPassage::RollupPassageCalls {
502+
fn clone(&self) -> Self {
503+
use self::RollupPassage::RollupPassageCalls::*;
504+
match self {
505+
exit(call) => exit(call.clone()),
506+
exitToken(call) => exitToken(call.clone()),
507+
enterWitness(call) => enterWitness(call.clone()),
508+
exitTokenPermit2(call) => exitTokenPermit2(call.clone()),
509+
exitWitness(call) => exitWitness(call.clone()),
510+
}
511+
}
512+
}
432513
}
433514

434515
mod bundle_helper {
@@ -517,6 +598,17 @@ mod bundle_helper {
517598
TokenPermissions { token: perm.token, amount: perm.amount }
518599
}
519600
}
601+
602+
impl Clone for BundleHelper::BundleHelperCalls {
603+
fn clone(&self) -> Self {
604+
use self::BundleHelper::BundleHelperCalls::*;
605+
match self {
606+
submit(call) => submit(call.clone()),
607+
zenith(call) => zenith(call.clone()),
608+
orders(call) => orders(call.clone()),
609+
}
610+
}
611+
}
520612
}
521613

522614
pub use zenith::Zenith;

0 commit comments

Comments
 (0)