Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/abi/index.ts

This file was deleted.

10 changes: 5 additions & 5 deletions src/arbAggregatorPrepareTransactionRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import {
Transport,
} from 'viem';

import { arbAggregator } from './contracts';
import { arbAggregatorABI, arbAggregatorAddress } from './contracts/ArbAggregator';
import { upgradeExecutorEncodeFunctionData } from './upgradeExecutorEncodeFunctionData';
import { GetFunctionName } from './types/utils';

type ArbAggregatorAbi = typeof arbAggregator.abi;
type ArbAggregatorAbi = typeof arbAggregatorABI;
export type ArbAggregatorPrepareTransactionRequestFunctionName = GetFunctionName<ArbAggregatorAbi>;
export type ArbAggregatorEncodeFunctionDataParameters<
TFunctionName extends ArbAggregatorPrepareTransactionRequestFunctionName,
Expand Down Expand Up @@ -40,7 +40,7 @@ function arbAggregatorPrepareFunctionData<

if (!upgradeExecutor) {
return {
to: arbAggregator.address,
to: arbAggregatorAddress,
data: arbAggregatorEncodeFunctionData(
params as ArbAggregatorEncodeFunctionDataParameters<TFunctionName>,
),
Expand All @@ -53,7 +53,7 @@ function arbAggregatorPrepareFunctionData<
data: upgradeExecutorEncodeFunctionData({
functionName: 'executeCall',
args: [
arbAggregator.address, // target
arbAggregatorAddress, // target
arbAggregatorEncodeFunctionData(
params as ArbAggregatorEncodeFunctionDataParameters<TFunctionName>,
), // targetCallData
Expand Down Expand Up @@ -82,7 +82,7 @@ export async function arbAggregatorPrepareTransactionRequest<
// params is extending ArbAggregatorPrepareFunctionDataParameters, it's safe to cast
const { to, data, value } = arbAggregatorPrepareFunctionData({
...params,
abi: arbAggregator.abi,
abi: arbAggregatorABI,
} as unknown as ArbAggregatorPrepareFunctionDataParameters<TFunctionName>);

// @ts-ignore (todo: fix viem type issue)
Expand Down
8 changes: 4 additions & 4 deletions src/arbAggregatorReadContract.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Chain, GetFunctionArgs, PublicClient, ReadContractReturnType, Transport } from 'viem';

import { arbAggregator } from './contracts';
import { arbAggregatorABI, arbAggregatorAddress } from './contracts/ArbAggregator';
import { GetFunctionName } from './types/utils';

export type ArbAggregatorAbi = typeof arbAggregator.abi;
export type ArbAggregatorAbi = typeof arbAggregatorABI;
export type ArbAggregatorFunctionName = GetFunctionName<ArbAggregatorAbi>;

export type ArbAggregatorReadContractParameters<TFunctionName extends ArbAggregatorFunctionName> = {
Expand All @@ -22,8 +22,8 @@ export function arbAggregatorReadContract<
): Promise<ArbAggregatorReadContractReturnType<TFunctionName>> {
// @ts-ignore (todo: fix viem type issue)
return client.readContract({
address: arbAggregator.address,
abi: arbAggregator.abi,
address: arbAggregatorAddress,
abi: arbAggregatorABI,
functionName: params.functionName,
args: params.args,
});
Expand Down
8 changes: 4 additions & 4 deletions src/arbGasInfoReadContract.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Chain, GetFunctionArgs, PublicClient, ReadContractReturnType, Transport } from 'viem';

import { arbGasInfo } from './contracts';
import { arbGasInfoABI, arbGasInfoAddress } from './contracts/ArbGasInfo';
import { GetFunctionName } from './types/utils';

export type ArbGasInfoAbi = typeof arbGasInfo.abi;
export type ArbGasInfoAbi = typeof arbGasInfoABI;
export type ArbGasInfoFunctionName = GetFunctionName<ArbGasInfoAbi>;

export type ArbGasInfoReadContractParameters<TFunctionName extends ArbGasInfoFunctionName> = {
Expand All @@ -22,8 +22,8 @@ export function arbGasInfoReadContract<
): Promise<ArbGasInfoReadContractReturnType<TFunctionName>> {
// @ts-ignore (todo: fix viem type issue)
return client.readContract({
address: arbGasInfo.address,
abi: arbGasInfo.abi,
address: arbGasInfoAddress,
abi: arbGasInfoABI,
functionName: params.functionName,
args: params.args,
});
Expand Down
10 changes: 5 additions & 5 deletions src/arbOwnerPrepareTransactionRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import {
Transport,
} from 'viem';

import { arbOwner } from './contracts';
import { arbOwnerABI, arbOwnerAddress } from './contracts/ArbOwner';
import { upgradeExecutorEncodeFunctionData } from './upgradeExecutorEncodeFunctionData';
import { GetFunctionName } from './types/utils';

type ArbOwnerAbi = typeof arbOwner.abi;
type ArbOwnerAbi = typeof arbOwnerABI;
export type ArbOwnerPrepareTransactionRequestFunctionName = GetFunctionName<ArbOwnerAbi>;
export type ArbOwnerEncodeFunctionDataParameters<
TFunctionName extends ArbOwnerPrepareTransactionRequestFunctionName,
Expand Down Expand Up @@ -40,7 +40,7 @@ function arbOwnerPrepareFunctionData<

if (!upgradeExecutor) {
return {
to: arbOwner.address,
to: arbOwnerAddress,
data: arbOwnerEncodeFunctionData(
params as ArbOwnerEncodeFunctionDataParameters<TFunctionName>,
),
Expand All @@ -53,7 +53,7 @@ function arbOwnerPrepareFunctionData<
data: upgradeExecutorEncodeFunctionData({
functionName: 'executeCall',
args: [
arbOwner.address, // target
arbOwnerAddress, // target
arbOwnerEncodeFunctionData(params as ArbOwnerEncodeFunctionDataParameters<TFunctionName>), // targetCallData
],
}),
Expand Down Expand Up @@ -81,7 +81,7 @@ export async function arbOwnerPrepareTransactionRequest<
// params is extending ArbOwnerPrepareFunctionDataParameters, it's safe to cast
const { to, data, value } = arbOwnerPrepareFunctionData({
...params,
abi: arbOwner.abi,
abi: arbOwnerABI,
} as unknown as ArbOwnerPrepareFunctionDataParameters<TFunctionName>);

// @ts-ignore (todo: fix viem type issue)
Expand Down
8 changes: 4 additions & 4 deletions src/arbOwnerReadContract.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Chain, GetFunctionArgs, PublicClient, ReadContractReturnType, Transport } from 'viem';

import { arbOwnerPublic } from './contracts';
import { arbOwnerPublicABI, arbOwnerPublicAddress } from './contracts/ArbOwnerPublic';
import { GetFunctionName } from './types/utils';

export type ArbOwnerPublicAbi = typeof arbOwnerPublic.abi;
export type ArbOwnerPublicAbi = typeof arbOwnerPublicABI;
export type ArbOwnerPublicFunctionName = GetFunctionName<ArbOwnerPublicAbi>;

export type ArbOwnerReadContractParameters<TFunctionName extends ArbOwnerPublicFunctionName> = {
Expand All @@ -22,8 +22,8 @@ export function arbOwnerReadContract<
): Promise<ArbOwnerReadContractReturnType<TFunctionName>> {
// @ts-ignore (todo: fix viem type issue)
return client.readContract({
address: arbOwnerPublic.address,
abi: arbOwnerPublic.abi,
address: arbOwnerPublicAddress,
abi: arbOwnerPublicABI,
functionName: params.functionName,
args: params.args,
});
Expand Down
57 changes: 0 additions & 57 deletions src/contracts.ts

This file was deleted.

87 changes: 87 additions & 0 deletions src/contracts/ArbAggregator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ArbAggregator
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/**
* [__View Contract on Arbitrum Sepolia Blockscout__](https://sepolia-explorer.arbitrum.io/address/0x000000000000000000000000000000000000006d)
*/
export const arbAggregatorABI = [
{
stateMutability: 'nonpayable',
type: 'function',
inputs: [{ name: 'newBatchPoster', internalType: 'address', type: 'address' }],
name: 'addBatchPoster',
outputs: [],
},
{
stateMutability: 'view',
type: 'function',
inputs: [],
name: 'getBatchPosters',
outputs: [{ name: '', internalType: 'address[]', type: 'address[]' }],
},
{
stateMutability: 'view',
type: 'function',
inputs: [],
name: 'getDefaultAggregator',
outputs: [{ name: '', internalType: 'address', type: 'address' }],
},
{
stateMutability: 'view',
type: 'function',
inputs: [{ name: 'batchPoster', internalType: 'address', type: 'address' }],
name: 'getFeeCollector',
outputs: [{ name: '', internalType: 'address', type: 'address' }],
},
{
stateMutability: 'view',
type: 'function',
inputs: [{ name: 'addr', internalType: 'address', type: 'address' }],
name: 'getPreferredAggregator',
outputs: [
{ name: '', internalType: 'address', type: 'address' },
{ name: '', internalType: 'bool', type: 'bool' },
],
},
{
stateMutability: 'view',
type: 'function',
inputs: [{ name: 'aggregator', internalType: 'address', type: 'address' }],
name: 'getTxBaseFee',
outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
},
{
stateMutability: 'nonpayable',
type: 'function',
inputs: [
{ name: 'batchPoster', internalType: 'address', type: 'address' },
{ name: 'newFeeCollector', internalType: 'address', type: 'address' },
],
name: 'setFeeCollector',
outputs: [],
},
{
stateMutability: 'nonpayable',
type: 'function',
inputs: [
{ name: 'aggregator', internalType: 'address', type: 'address' },
{ name: 'feeInL1Gas', internalType: 'uint256', type: 'uint256' },
],
name: 'setTxBaseFee',
outputs: [],
},
] as const;

/**
* [__View Contract on Arbitrum Sepolia Blockscout__](https://sepolia-explorer.arbitrum.io/address/0x000000000000000000000000000000000000006d)
*/
export const arbAggregatorAddress = '0x000000000000000000000000000000000000006D';

/**
* [__View Contract on Arbitrum Sepolia Blockscout__](https://sepolia-explorer.arbitrum.io/address/0x000000000000000000000000000000000000006d)
*/
export const arbAggregatorConfig = {
address: arbAggregatorAddress,
abi: arbAggregatorABI,
} as const;
Loading