diff --git a/packages/sdk/src/Actions/ContractAction.ts b/packages/sdk/src/Actions/ContractAction.ts index 7085d2b9..383858f1 100644 --- a/packages/sdk/src/Actions/ContractAction.ts +++ b/packages/sdk/src/Actions/ContractAction.ts @@ -10,6 +10,7 @@ import { } from '@boostxyz/evm'; import ContractActionArtifact from '@boostxyz/evm/artifacts/contracts/actions/ContractAction.sol/ContractAction.json'; import type { Hex } from 'viem'; +import { simulateContract } from 'viem/actions'; import type { DeployableOptions, GenericDeployableParams, diff --git a/packages/sdk/src/Boost.ts b/packages/sdk/src/Boost.ts index 7e6cd04a..973ed0ab 100644 --- a/packages/sdk/src/Boost.ts +++ b/packages/sdk/src/Boost.ts @@ -5,7 +5,7 @@ import type { Budget } from './Budgets/Budget'; import type { Incentive } from './Incentives/Incentive'; import type { Validator } from './Validators/Validator'; -export type BoostPayload = { +export interface BoostPayload { address?: Address; budget: Budget; action: Action; @@ -16,7 +16,19 @@ export type BoostPayload = { referralFee?: bigint; maxParticipants?: bigint; owner?: Address; -}; +} + +export interface LibBoost { + action: Address; + validator: Address; + allowList: Address; + budget: Address; + incentives: Array
; + protocolFee: bigint; + referralFee: bigint; + maxParticipants: bigint; + owner: Address; +} export class Boost { readonly action: Action; diff --git a/packages/sdk/src/BoostClient.test.ts b/packages/sdk/src/BoostCore.test.ts similarity index 100% rename from packages/sdk/src/BoostClient.test.ts rename to packages/sdk/src/BoostCore.test.ts diff --git a/packages/sdk/src/BoostCore.ts b/packages/sdk/src/BoostCore.ts index 5e9c4aa9..f0b9d78c 100644 --- a/packages/sdk/src/BoostCore.ts +++ b/packages/sdk/src/BoostCore.ts @@ -1,11 +1,19 @@ import BoostCoreArtifact from '@boostxyz/evm/artifacts/contracts/BoostCore.sol/BoostCore.json'; -import { getAccount, waitForTransactionReceipt } from '@wagmi/core'; +import { + getAccount, + getTransaction, + getTransactionReceipt, + simulateContract, + waitForTransactionReceipt, +} from '@wagmi/core'; import { createWriteContract } from '@wagmi/core/codegen'; import { type Address, type Hash, type Hex, decodeAbiParameters, + decodeFunctionData, + decodeFunctionResult, zeroAddress, zeroHash, } from 'viem'; @@ -14,6 +22,9 @@ import { type Target, boostCoreAbi, prepareBoostPayload, + readBoostCoreGetBoost, + readBoostCoreGetBoostCount, + simulateBoostCoreCreateBoost, } from '../../evm/artifacts'; import type { Action } from './Actions/Action'; @@ -34,6 +45,7 @@ import { SimpleDenyList, type SimpleDenyListPayload, } from './AllowLists/SimpleDenyList'; +import { Boost } from './Boost'; import type { Budget } from './Budgets/Budget'; import { SimpleBudget, type SimpleBudgetPayload } from './Budgets/SimpleBudget'; import { @@ -100,7 +112,7 @@ export type BoostClientConfig = | BoostCoreDeployedOptions | BoostCoreOptionsWithPayload; -export type CreatBoostPayload = { +export type CreateBoostPayload = { budget: Budget | Address; action: Action | Target; validator: Validator | Target; @@ -137,16 +149,17 @@ export class BoostCore extends Deployable<[Address, Address]> { // TODO make this transactional? if any deployment fails what do we do with the previously deployed deployables? public async createBoost( - _boostPayload: CreatBoostPayload, + _boostPayload: CreateBoostPayload, _options: DeployableOptions = { config: this._config, account: this._account, }, ) { - const [payload, options] = this.validateDeploymentConfig