Skip to content

Commit

Permalink
Rename setMaxTxGasLimit
Browse files Browse the repository at this point in the history
  • Loading branch information
chrstph-dvx committed Jul 15, 2024
1 parent e839468 commit 8c5caaa
Show file tree
Hide file tree
Showing 8 changed files with 216 additions and 201 deletions.
57 changes: 28 additions & 29 deletions src/actions/addChainOwner.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
import {
Address,
Chain,
PrepareTransactionRequestParameters,
PrepareTransactionRequestReturnType,
PublicClient,
Transport,
encodeFunctionData,
} from 'viem';
import { Address, Chain, PrepareTransactionRequestParameters, PublicClient, Transport } from 'viem';
import { arbOwner } from '../contracts';
import { WithAccount } from '../types/Actions';
import {
PrepareTransactionRequestReturnTypeWithChainId,
WithAccount,
WithUpgradeExecutor,
} from '../types/Actions';
import { Prettify } from '../types/utils';
import { withUpgradeExecutor } from '../withUpgradeExecutor';
import { validateChildChainPublicClient } from '../types/validateChildChainPublicClient';

export type AddChainOwnerParameters = Prettify<
WithAccount<{
newOwner: Address;
}>
WithUpgradeExecutor<
WithAccount<{
newOwner: Address;
}>
>
>;

export type AddChainOwnerReturnType = PrepareTransactionRequestReturnType;

function arbOwnerFunctionData({ newOwner }: AddChainOwnerParameters) {
return encodeFunctionData({
abi: arbOwner.abi,
functionName: 'addChainOwner',
args: [newOwner],
});
}
export type AddChainOwnerReturnType = PrepareTransactionRequestReturnTypeWithChainId;

export async function addChainOwner<TChain extends Chain | undefined>(
client: PublicClient<Transport, TChain>,
args: AddChainOwnerParameters,
params: AddChainOwnerParameters,
): Promise<AddChainOwnerReturnType> {
const data = arbOwnerFunctionData(args);
const validatedPublicClient = validateChildChainPublicClient(client);
const { account, upgradeExecutor, newOwner } = params;

return client.prepareTransactionRequest({
to: arbOwner.address,
value: BigInt(0),
const request = await client.prepareTransactionRequest({
chain: client.chain,
data,
account: args.account,
account,
...withUpgradeExecutor({
to: arbOwner.address,
upgradeExecutor,
args: [newOwner],
abi: arbOwner.abi,
functionName: 'addChainOwner',
}),
} satisfies PrepareTransactionRequestParameters);

return { ...request, chainId: validatedPublicClient.chain.id };
}
58 changes: 29 additions & 29 deletions src/actions/removeChainOwner.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
import {
Address,
Chain,
PrepareTransactionRequestParameters,
PrepareTransactionRequestReturnType,
PublicClient,
Transport,
encodeFunctionData,
} from 'viem';
import { Address, Chain, PrepareTransactionRequestParameters, PublicClient, Transport } from 'viem';
import { arbOwner } from '../contracts';
import { WithAccount } from '../types/Actions';
import {
PrepareTransactionRequestReturnTypeWithChainId,
WithAccount,
WithUpgradeExecutor,
} from '../types/Actions';
import { Prettify } from '../types/utils';
import { withUpgradeExecutor } from '../withUpgradeExecutor';
import { validateParentChainPublicClient } from '../types/ParentChain';
import { validateChildChainPublicClient } from '../types/validateChildChainPublicClient';

export type RemoveChainOwnerParameters = Prettify<
WithAccount<{
owner: Address;
}>
WithUpgradeExecutor<
WithAccount<{
owner: Address;
}>
>
>;

export type RemoveChainOwnerReturnType = PrepareTransactionRequestReturnType;

function arbOwnerFunctionData({ owner }: RemoveChainOwnerParameters) {
return encodeFunctionData({
abi: arbOwner.abi,
functionName: 'removeChainOwner',
args: [owner],
});
}
export type RemoveChainOwnerReturnType = PrepareTransactionRequestReturnTypeWithChainId;

export async function removeChainOwner<TChain extends Chain | undefined>(
client: PublicClient<Transport, TChain>,
args: RemoveChainOwnerParameters,
params: RemoveChainOwnerParameters,
): Promise<RemoveChainOwnerReturnType> {
const data = arbOwnerFunctionData(args);
const validatedPublicClient = validateChildChainPublicClient(client);
const { account, upgradeExecutor, owner } = params;

return client.prepareTransactionRequest({
to: arbOwner.address,
value: BigInt(0),
const request = await client.prepareTransactionRequest({
chain: client.chain,
data,
account: args.account,
account,
...withUpgradeExecutor({
to: arbOwner.address,
upgradeExecutor,
args: [owner],
abi: arbOwner.abi,
functionName: 'removeChainOwner',
}),
} satisfies PrepareTransactionRequestParameters);

return { ...request, chainId: validatedPublicClient.chain.id };
}
58 changes: 29 additions & 29 deletions src/actions/setMaxTxGasLimit.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
import {
Chain,
PrepareTransactionRequestParameters,
PrepareTransactionRequestReturnType,
PublicClient,
Transport,
encodeFunctionData,
} from 'viem';
import { Chain, PrepareTransactionRequestParameters, PublicClient, Transport } from 'viem';
import { arbOwner } from '../contracts';
import { WithAccount } from '../types/Actions';
import {
PrepareTransactionRequestReturnTypeWithChainId,
WithAccount,
WithUpgradeExecutor,
} from '../types/Actions';
import { Prettify } from '../types/utils';
import { withUpgradeExecutor } from '../withUpgradeExecutor';
import { validateChildChainPublicClient } from '../types/validateChildChainPublicClient';

export type SetMaxTxGasLimitParameters = Prettify<
WithAccount<{
limit: bigint;
}>
WithUpgradeExecutor<
WithAccount<{
limit: bigint;
}>
>
>;

export type SetMaxTxGasLimitReturnType = PrepareTransactionRequestReturnType;
export type SetMaxTxGasLimitReturnType = PrepareTransactionRequestReturnTypeWithChainId;

function arbOwnerFunctionData({ limit }: SetMaxTxGasLimitParameters) {
return encodeFunctionData({
abi: arbOwner.abi,
functionName: 'setMaxTxGasLimit',
args: [limit],
});
}

export async function setL1PricingRewardRecipient<TChain extends Chain | undefined>(
export async function setMaxTxGasLimit<TChain extends Chain | undefined>(
client: PublicClient<Transport, TChain>,
args: SetMaxTxGasLimitParameters,
params: SetMaxTxGasLimitParameters,
): Promise<SetMaxTxGasLimitReturnType> {
const data = arbOwnerFunctionData(args);
const validatedPublicClient = validateChildChainPublicClient(client);
const { account, upgradeExecutor, limit } = params;

return client.prepareTransactionRequest({
to: arbOwner.address,
value: BigInt(0),
const request = await client.prepareTransactionRequest({
chain: client.chain,
data,
account: args.account,
account,
...withUpgradeExecutor({
to: arbOwner.address,
upgradeExecutor,
args: [limit],
abi: arbOwner.abi,
functionName: 'setMaxTxGasLimit',
}),
} satisfies PrepareTransactionRequestParameters);

return { ...request, chainId: validatedPublicClient.chain.id };
}
58 changes: 29 additions & 29 deletions src/actions/setParentPricePerUnit.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
import {
Chain,
PrepareTransactionRequestParameters,
PrepareTransactionRequestReturnType,
PublicClient,
Transport,
encodeFunctionData,
} from 'viem';
import { Chain, PrepareTransactionRequestParameters, PublicClient, Transport } from 'viem';
import { arbOwner } from '../contracts';
import { WithAccount } from '../types/Actions';
import {
PrepareTransactionRequestReturnTypeWithChainId,
WithAccount,
WithUpgradeExecutor,
} from '../types/Actions';
import { Prettify } from '../types/utils';
import { withUpgradeExecutor } from '../withUpgradeExecutor';
import { validateChildChainPublicClient } from '../types/validateChildChainPublicClient';

export type SetParentPricePerUnitParameters = Prettify<
WithAccount<{
pricePerUnit: bigint;
}>
WithUpgradeExecutor<
WithAccount<{
pricePerUnit: bigint;
}>
>
>;

export type SetParentPricePerUnitReturnType = PrepareTransactionRequestReturnType;

function arbOwnerFunctionData({ pricePerUnit }: SetParentPricePerUnitParameters) {
return encodeFunctionData({
abi: arbOwner.abi,
functionName: 'setL1PricePerUnit',
args: [pricePerUnit],
});
}
export type SetParentPricePerUnitReturnType = PrepareTransactionRequestReturnTypeWithChainId;

export async function setParentPricePerUnit<TChain extends Chain | undefined>(
client: PublicClient<Transport, TChain>,
args: SetParentPricePerUnitParameters,
params: SetParentPricePerUnitParameters,
): Promise<SetParentPricePerUnitReturnType> {
const data = arbOwnerFunctionData(args);
const validatedPublicClient = validateChildChainPublicClient(client);
const { account, upgradeExecutor, pricePerUnit } = params;

return client.prepareTransactionRequest({
to: arbOwner.address,
value: BigInt(0),
chain: client.chain,
data,
account: args.account,
const request = await client.prepareTransactionRequest({
chain: validatedPublicClient.chain,
account,
...withUpgradeExecutor({
to: arbOwner.address,
upgradeExecutor,
args: [pricePerUnit],
abi: arbOwner.abi,
functionName: 'setL1PricePerUnit',
}),
} satisfies PrepareTransactionRequestParameters);

return { ...request, chainId: validatedPublicClient.chain.id };
}
56 changes: 28 additions & 28 deletions src/actions/setParentPricingRewardRate.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
import {
Chain,
PrepareTransactionRequestParameters,
PrepareTransactionRequestReturnType,
PublicClient,
Transport,
encodeFunctionData,
} from 'viem';
import { Chain, PrepareTransactionRequestParameters, PublicClient, Transport } from 'viem';
import { arbOwner } from '../contracts';
import { WithAccount } from '../types/Actions';
import {
PrepareTransactionRequestReturnTypeWithChainId,
WithAccount,
WithUpgradeExecutor,
} from '../types/Actions';
import { Prettify } from '../types/utils';
import { validateChildChainPublicClient } from '../types/validateChildChainPublicClient';
import { withUpgradeExecutor } from '../withUpgradeExecutor';

export type SetParentPricingRewardRateParameters = Prettify<
WithAccount<{
weiPerUnit: bigint;
}>
WithUpgradeExecutor<
WithAccount<{
weiPerUnit: bigint;
}>
>
>;

export type SetParentPricingRewardRateReturnType = PrepareTransactionRequestReturnType;

function arbOwnerFunctionData({ weiPerUnit }: SetParentPricingRewardRateParameters) {
return encodeFunctionData({
abi: arbOwner.abi,
functionName: 'setL1PricingRewardRate',
args: [weiPerUnit],
});
}
export type SetParentPricingRewardRateReturnType = PrepareTransactionRequestReturnTypeWithChainId;

export async function setParentPricingRewardRate<TChain extends Chain | undefined>(
client: PublicClient<Transport, TChain>,
args: SetParentPricingRewardRateParameters,
params: SetParentPricingRewardRateParameters,
): Promise<SetParentPricingRewardRateReturnType> {
const data = arbOwnerFunctionData(args);
const validatedPublicClient = validateChildChainPublicClient(client);
const { account, upgradeExecutor, weiPerUnit } = params;

return client.prepareTransactionRequest({
to: arbOwner.address,
value: BigInt(0),
const request = await client.prepareTransactionRequest({
chain: client.chain,
data,
account: args.account,
account,
...withUpgradeExecutor({
to: arbOwner.address,
upgradeExecutor,
args: [weiPerUnit],
abi: arbOwner.abi,
functionName: 'setL1PricingRewardRate',
}),
} satisfies PrepareTransactionRequestParameters);

return { ...request, chainId: validatedPublicClient.chain.id };
}
Loading

0 comments on commit 8c5caaa

Please sign in to comment.