-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f27cc3
commit f223da4
Showing
7 changed files
with
297 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { | ||
Address, | ||
Chain, | ||
PrepareTransactionRequestParameters, | ||
PrepareTransactionRequestReturnType, | ||
PublicClient, | ||
Transport, | ||
encodeFunctionData, | ||
} from 'viem'; | ||
import { arbOwner } from '../contracts'; | ||
import { WithAccount } from '../types/Actions'; | ||
import { Prettify } from '../types/utils'; | ||
|
||
export type AddChainOwnerParameters = Prettify< | ||
WithAccount<{ | ||
newOwner: Address; | ||
}> | ||
>; | ||
|
||
export type AddChainOwnerReturnType = PrepareTransactionRequestReturnType; | ||
|
||
function arbOwnerFunctionData({ newOwner }: AddChainOwnerParameters) { | ||
return encodeFunctionData({ | ||
abi: arbOwner.abi, | ||
functionName: 'addChainOwner', | ||
args: [newOwner], | ||
}); | ||
} | ||
|
||
export async function addChainOwner<TChain extends Chain | undefined>( | ||
client: PublicClient<Transport, TChain>, | ||
args: AddChainOwnerParameters, | ||
): Promise<AddChainOwnerReturnType> { | ||
const data = arbOwnerFunctionData(args); | ||
|
||
return client.prepareTransactionRequest({ | ||
to: arbOwner.address, | ||
value: BigInt(0), | ||
chain: client.chain, | ||
data, | ||
account: args.account, | ||
} satisfies PrepareTransactionRequestParameters); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { | ||
Address, | ||
Chain, | ||
PrepareTransactionRequestParameters, | ||
PrepareTransactionRequestReturnType, | ||
PublicClient, | ||
Transport, | ||
encodeFunctionData, | ||
} from 'viem'; | ||
import { arbOwner } from '../contracts'; | ||
import { WithAccount } from '../types/Actions'; | ||
import { Prettify } from '../types/utils'; | ||
|
||
export type RemoveChainOwnerParameters = Prettify< | ||
WithAccount<{ | ||
owner: Address; | ||
}> | ||
>; | ||
|
||
export type RemoveChainOwnerReturnType = PrepareTransactionRequestReturnType; | ||
|
||
function arbOwnerFunctionData({ owner }: RemoveChainOwnerParameters) { | ||
return encodeFunctionData({ | ||
abi: arbOwner.abi, | ||
functionName: 'removeChainOwner', | ||
args: [owner], | ||
}); | ||
} | ||
|
||
export async function removeChainOwner<TChain extends Chain | undefined>( | ||
client: PublicClient<Transport, TChain>, | ||
args: RemoveChainOwnerParameters, | ||
): Promise<RemoveChainOwnerReturnType> { | ||
const data = arbOwnerFunctionData(args); | ||
|
||
return client.prepareTransactionRequest({ | ||
to: arbOwner.address, | ||
value: BigInt(0), | ||
chain: client.chain, | ||
data, | ||
account: args.account, | ||
} satisfies PrepareTransactionRequestParameters); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { | ||
Chain, | ||
PrepareTransactionRequestParameters, | ||
PrepareTransactionRequestReturnType, | ||
PublicClient, | ||
Transport, | ||
encodeFunctionData, | ||
} from 'viem'; | ||
import { arbOwner } from '../contracts'; | ||
import { WithAccount } from '../types/Actions'; | ||
import { Prettify } from '../types/utils'; | ||
|
||
export type SetMaxTxGasLimitParameters = Prettify< | ||
WithAccount<{ | ||
limit: bigint; | ||
}> | ||
>; | ||
|
||
export type SetMaxTxGasLimitReturnType = PrepareTransactionRequestReturnType; | ||
|
||
function arbOwnerFunctionData({ limit }: SetMaxTxGasLimitParameters) { | ||
return encodeFunctionData({ | ||
abi: arbOwner.abi, | ||
functionName: 'setMaxTxGasLimit', | ||
args: [limit], | ||
}); | ||
} | ||
|
||
export async function setL1PricingRewardRecipient<TChain extends Chain | undefined>( | ||
client: PublicClient<Transport, TChain>, | ||
args: SetMaxTxGasLimitParameters, | ||
): Promise<SetMaxTxGasLimitReturnType> { | ||
const data = arbOwnerFunctionData(args); | ||
|
||
return client.prepareTransactionRequest({ | ||
to: arbOwner.address, | ||
value: BigInt(0), | ||
chain: client.chain, | ||
data, | ||
account: args.account, | ||
} satisfies PrepareTransactionRequestParameters); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { | ||
Chain, | ||
PrepareTransactionRequestParameters, | ||
PrepareTransactionRequestReturnType, | ||
PublicClient, | ||
Transport, | ||
encodeFunctionData, | ||
} from 'viem'; | ||
import { arbOwner } from '../contracts'; | ||
import { WithAccount } from '../types/Actions'; | ||
import { Prettify } from '../types/utils'; | ||
|
||
export type SetParentPricePerUnitParameters = Prettify< | ||
WithAccount<{ | ||
pricePerUnit: bigint; | ||
}> | ||
>; | ||
|
||
export type SetParentPricePerUnitReturnType = PrepareTransactionRequestReturnType; | ||
|
||
function arbOwnerFunctionData({ pricePerUnit }: SetParentPricePerUnitParameters) { | ||
return encodeFunctionData({ | ||
abi: arbOwner.abi, | ||
functionName: 'setL1PricePerUnit', | ||
args: [pricePerUnit], | ||
}); | ||
} | ||
|
||
export async function setParentPricePerUnit<TChain extends Chain | undefined>( | ||
client: PublicClient<Transport, TChain>, | ||
args: SetParentPricePerUnitParameters, | ||
): Promise<SetParentPricePerUnitReturnType> { | ||
const data = arbOwnerFunctionData(args); | ||
|
||
return client.prepareTransactionRequest({ | ||
to: arbOwner.address, | ||
value: BigInt(0), | ||
chain: client.chain, | ||
data, | ||
account: args.account, | ||
} satisfies PrepareTransactionRequestParameters); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { | ||
Chain, | ||
PrepareTransactionRequestParameters, | ||
PrepareTransactionRequestReturnType, | ||
PublicClient, | ||
Transport, | ||
encodeFunctionData, | ||
} from 'viem'; | ||
import { arbOwner } from '../contracts'; | ||
import { WithAccount } from '../types/Actions'; | ||
import { Prettify } from '../types/utils'; | ||
|
||
export type SetParentPricingRewardRateParameters = Prettify< | ||
WithAccount<{ | ||
weiPerUnit: bigint; | ||
}> | ||
>; | ||
|
||
export type SetParentPricingRewardRateReturnType = PrepareTransactionRequestReturnType; | ||
|
||
function arbOwnerFunctionData({ weiPerUnit }: SetParentPricingRewardRateParameters) { | ||
return encodeFunctionData({ | ||
abi: arbOwner.abi, | ||
functionName: 'setL1PricingRewardRate', | ||
args: [weiPerUnit], | ||
}); | ||
} | ||
|
||
export async function setParentPricingRewardRate<TChain extends Chain | undefined>( | ||
client: PublicClient<Transport, TChain>, | ||
args: SetParentPricingRewardRateParameters, | ||
): Promise<SetParentPricingRewardRateReturnType> { | ||
const data = arbOwnerFunctionData(args); | ||
|
||
return client.prepareTransactionRequest({ | ||
to: arbOwner.address, | ||
value: BigInt(0), | ||
chain: client.chain, | ||
data, | ||
account: args.account, | ||
} satisfies PrepareTransactionRequestParameters); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { | ||
Address, | ||
Chain, | ||
PrepareTransactionRequestParameters, | ||
PrepareTransactionRequestReturnType, | ||
PublicClient, | ||
Transport, | ||
encodeFunctionData, | ||
} from 'viem'; | ||
import { arbOwner } from '../contracts'; | ||
import { WithAccount } from '../types/Actions'; | ||
import { Prettify } from '../types/utils'; | ||
|
||
export type SetParentPricingRewardRecipientParameters = Prettify< | ||
WithAccount<{ | ||
recipient: Address; | ||
}> | ||
>; | ||
|
||
export type SetParentPricingRewardRecipientReturnType = PrepareTransactionRequestReturnType; | ||
|
||
function arbOwnerFunctionData({ recipient }: SetParentPricingRewardRecipientParameters) { | ||
return encodeFunctionData({ | ||
abi: arbOwner.abi, | ||
functionName: 'setL1PricingRewardRecipient', | ||
args: [recipient], | ||
}); | ||
} | ||
|
||
export async function setParentPricingRewardRecipient<TChain extends Chain | undefined>( | ||
client: PublicClient<Transport, TChain>, | ||
args: SetParentPricingRewardRecipientParameters, | ||
): Promise<SetParentPricingRewardRecipientReturnType> { | ||
const data = arbOwnerFunctionData(args); | ||
|
||
return client.prepareTransactionRequest({ | ||
to: arbOwner.address, | ||
value: BigInt(0), | ||
chain: client.chain, | ||
data, | ||
account: args.account, | ||
} satisfies PrepareTransactionRequestParameters); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { | ||
Chain, | ||
PrepareTransactionRequestParameters, | ||
PrepareTransactionRequestReturnType, | ||
PublicClient, | ||
Transport, | ||
encodeFunctionData, | ||
} from 'viem'; | ||
import { arbOwner } from '../contracts'; | ||
import { WithAccount } from '../types/Actions'; | ||
import { Prettify } from '../types/utils'; | ||
|
||
export type SetSpeedLimitParameters = Prettify< | ||
WithAccount<{ | ||
limit: bigint; | ||
}> | ||
>; | ||
|
||
export type SetSpeedLimitReturnType = PrepareTransactionRequestReturnType; | ||
|
||
function arbOwnerFunctionData({ limit }: SetSpeedLimitParameters) { | ||
return encodeFunctionData({ | ||
abi: arbOwner.abi, | ||
functionName: 'setSpeedLimit', | ||
args: [limit], | ||
}); | ||
} | ||
|
||
export async function setSpeedLimit<TChain extends Chain | undefined>( | ||
client: PublicClient<Transport, TChain>, | ||
args: SetSpeedLimitParameters, | ||
): Promise<SetSpeedLimitReturnType> { | ||
const data = arbOwnerFunctionData(args); | ||
|
||
return client.prepareTransactionRequest({ | ||
to: arbOwner.address, | ||
value: BigInt(0), | ||
chain: client.chain, | ||
data, | ||
account: args.account, | ||
} satisfies PrepareTransactionRequestParameters); | ||
} |