diff --git a/packages/alchemy/src/client/smartAccountClient.ts b/packages/alchemy/src/client/smartAccountClient.ts index 53b8ed6690..5c300f2bac 100644 --- a/packages/alchemy/src/client/smartAccountClient.ts +++ b/packages/alchemy/src/client/smartAccountClient.ts @@ -11,6 +11,7 @@ import { getDefaultUserOperationFeeOptions } from "../defaults.js"; import { type AlchemyGasManagerConfig } from "../middleware/gasManager.js"; import { AlchemyProviderConfigSchema } from "../schema.js"; import type { AlchemyProviderConfig } from "../type.js"; +import type { AlchemySmartAccountClientActions } from "./decorators/smartAccount.js"; import { createAlchemySmartAccountClientFromRpcClient } from "./internal/smartAccountClientFromRpc.js"; import { createAlchemyPublicRpcClient } from "./rpcClient.js"; import type { AlchemyRpcSchema } from "./types.js"; @@ -41,7 +42,8 @@ export type AlchemySmartAccountClient_Base< actions extends SmartAccountClientActions< chain, account - > = SmartAccountClientActions + > = SmartAccountClientActions & + AlchemySmartAccountClientActions > = Prettify< SmartAccountClient< transport, diff --git a/site/packages/aa-accounts/light-account/actions/transferOwnership.md b/site/packages/aa-accounts/light-account/actions/transferOwnership.md index 197463db9f..ece9ef14fe 100644 --- a/site/packages/aa-accounts/light-account/actions/transferOwnership.md +++ b/site/packages/aa-accounts/light-account/actions/transferOwnership.md @@ -34,7 +34,7 @@ const smartAccountClient = await transferLightAccountOwnership(provider, { }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: ## Returns diff --git a/site/packages/aa-accounts/light-account/client.md b/site/packages/aa-accounts/light-account/client.md index c40299da8f..98233c1471 100644 --- a/site/packages/aa-accounts/light-account/client.md +++ b/site/packages/aa-accounts/light-account/client.md @@ -20,7 +20,7 @@ head: ::: code-group -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: ## Returns diff --git a/site/packages/aa-accounts/light-account/encodeTransferOwnership.md b/site/packages/aa-accounts/light-account/encodeTransferOwnership.md index 4713c6febd..2c6bb5c1fb 100644 --- a/site/packages/aa-accounts/light-account/encodeTransferOwnership.md +++ b/site/packages/aa-accounts/light-account/encodeTransferOwnership.md @@ -29,7 +29,7 @@ const encodedTransferOwnershipData = smartAccountClient.account.encodeTransferOwnership({ newOwner }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: ## Returns diff --git a/site/packages/aa-accounts/light-account/getOwnerAddress.md b/site/packages/aa-accounts/light-account/getOwnerAddress.md index becb4eac31..2c515b2086 100644 --- a/site/packages/aa-accounts/light-account/getOwnerAddress.md +++ b/site/packages/aa-accounts/light-account/getOwnerAddress.md @@ -27,7 +27,7 @@ import { smartAccountClient } from "./smartAccountClient"; const owner = await smartAccountClient.account.getOwnerAddress(); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: ## Returns diff --git a/site/packages/aa-accounts/light-account/index.md b/site/packages/aa-accounts/light-account/index.md index 7dc44dab87..029b525abf 100644 --- a/site/packages/aa-accounts/light-account/index.md +++ b/site/packages/aa-accounts/light-account/index.md @@ -64,7 +64,7 @@ const result = await transferLightAccountOwnership(smartAccountClient, { }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: ## Developer Links diff --git a/site/packages/aa-accounts/light-account/signMessageWith6492.md b/site/packages/aa-accounts/light-account/signMessageWith6492.md index 2bad4ea66c..bfd747b9bc 100644 --- a/site/packages/aa-accounts/light-account/signMessageWith6492.md +++ b/site/packages/aa-accounts/light-account/signMessageWith6492.md @@ -29,7 +29,7 @@ const signedMessageWith6492 = smartAccountClient.signMessageWith6492({ }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: ## Returns diff --git a/site/packages/aa-accounts/light-account/signTypedData.md b/site/packages/aa-accounts/light-account/signTypedData.md index 36ce9a6b3b..618e20fa7a 100644 --- a/site/packages/aa-accounts/light-account/signTypedData.md +++ b/site/packages/aa-accounts/light-account/signTypedData.md @@ -57,7 +57,7 @@ const signedTypedData = smartAccountClient.signTypedData({ }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: ## Returns diff --git a/site/packages/aa-accounts/light-account/signTypedDataWith6492.md b/site/packages/aa-accounts/light-account/signTypedDataWith6492.md index b2fa5cbec7..18aed69b2d 100644 --- a/site/packages/aa-accounts/light-account/signTypedDataWith6492.md +++ b/site/packages/aa-accounts/light-account/signTypedDataWith6492.md @@ -57,7 +57,7 @@ const signedTypedDataWith6492 = smartAccountClient.signTypedDataWith6492({ }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: ## Returns diff --git a/site/packages/aa-alchemy/index.md b/site/packages/aa-alchemy/index.md index 7d480b7faf..b24d592832 100644 --- a/site/packages/aa-alchemy/index.md +++ b/site/packages/aa-alchemy/index.md @@ -44,6 +44,6 @@ pnpm i @alchemy/aa-alchemy Then, you can create a client like so: ::: code-group -<<< @/snippets/alchemy-smartAccountClient.ts +<<< @/snippets/aa-alchemy/base-client.ts ::: diff --git a/site/packages/aa-alchemy/light-account-client/index.md b/site/packages/aa-alchemy/light-account-client/index.md index b706609c86..8ac44d1e95 100644 --- a/site/packages/aa-alchemy/light-account-client/index.md +++ b/site/packages/aa-alchemy/light-account-client/index.md @@ -20,7 +20,7 @@ head: ::: code-group -<<< @/snippets/light-account-alchemy-client.ts +<<< @/snippets/aa-alchemy/light-account-client.ts ::: ## Returns diff --git a/site/packages/aa-alchemy/smart-account-client/actions/alchemyEnhancedApiActions.md b/site/packages/aa-alchemy/smart-account-client/actions/alchemyEnhancedApiActions.md index 7b21a0a59e..3d5ca322cc 100644 --- a/site/packages/aa-alchemy/smart-account-client/actions/alchemyEnhancedApiActions.md +++ b/site/packages/aa-alchemy/smart-account-client/actions/alchemyEnhancedApiActions.md @@ -31,7 +31,7 @@ Additionally, since the Alchemy SDK client does not yet support JWT authenticati ::: code-group ```ts [example.ts] -import { smartAccountClient } from "./alchemy-smartAccountClient"; +import { smartAccountClient } from "./base-client.ts"; import { alchemyEnhancedApiActions } from "@alchemy/aa-alchemy"; // [!code focus:99] @@ -43,7 +43,7 @@ const providerWithEnhancedApis = smartAccountClient.extend( ); ``` -<<< @/snippets/alchemy-smartAccountClient.ts +<<< @/snippets/aa-alchemy/base-client.ts ::: ## Returns diff --git a/site/packages/aa-alchemy/smart-account-client/actions/simulateUserOperation.md b/site/packages/aa-alchemy/smart-account-client/actions/simulateUserOperation.md index 26876dfe2e..63a8915a59 100644 --- a/site/packages/aa-alchemy/smart-account-client/actions/simulateUserOperation.md +++ b/site/packages/aa-alchemy/smart-account-client/actions/simulateUserOperation.md @@ -21,7 +21,7 @@ head: ::: code-group ```ts [example.ts] -import { smartAccountClient } from "./alchemy-smartAccountClient"; +import { smartAccountClient } from "./base-client.ts"; // [!code focus:99] const uoStruct: UserOperationCallData = { @@ -41,7 +41,7 @@ if (uoSimResult.error) { const uo = await smartAccountClient.sendUserOperation({ uo: uoStruct }); ``` -<<< @/snippets/light-account-alchemy-client.ts +<<< @/snippets/aa-alchemy/connected-client.ts ::: ## Returns diff --git a/site/packages/aa-core/bundler-client/actions/estimateUserOperationGas.md b/site/packages/aa-core/bundler-client/actions/estimateUserOperationGas.md index 2b466f4dcd..34d009a725 100644 --- a/site/packages/aa-core/bundler-client/actions/estimateUserOperationGas.md +++ b/site/packages/aa-core/bundler-client/actions/estimateUserOperationGas.md @@ -31,7 +31,7 @@ const estimates = await client.estimateUserOperationGas( ); ``` -<<< @/snippets/bundlerClient.ts +<<< @/snippets/aa-core/bundlerClient.ts ::: ## Returns diff --git a/site/packages/aa-core/bundler-client/actions/getSupportedEntryPoints.md b/site/packages/aa-core/bundler-client/actions/getSupportedEntryPoints.md index 5a1ca728c1..d22b824be2 100644 --- a/site/packages/aa-core/bundler-client/actions/getSupportedEntryPoints.md +++ b/site/packages/aa-core/bundler-client/actions/getSupportedEntryPoints.md @@ -26,7 +26,7 @@ import { client } from "./client"; const entryPoints = await client.getSupportedEntryPoints(); ``` -<<< @/snippets/bundlerClient.ts +<<< @/snippets/aa-core/bundlerClient.ts ::: ## Returns diff --git a/site/packages/aa-core/bundler-client/actions/getUserOperationByHash.md b/site/packages/aa-core/bundler-client/actions/getUserOperationByHash.md index a9483d22d3..5ee802ce3e 100644 --- a/site/packages/aa-core/bundler-client/actions/getUserOperationByHash.md +++ b/site/packages/aa-core/bundler-client/actions/getUserOperationByHash.md @@ -26,7 +26,7 @@ import { client } from "./client"; const uo = await client.getUserOperationByHash("0xUserOperationHash"); ``` -<<< @/snippets/bundlerClient.ts +<<< @/snippets/aa-core/bundlerClient.ts ::: ## Returns diff --git a/site/packages/aa-core/bundler-client/actions/getUserOperationReceipt.md b/site/packages/aa-core/bundler-client/actions/getUserOperationReceipt.md index 476bd71867..2d33cb8703 100644 --- a/site/packages/aa-core/bundler-client/actions/getUserOperationReceipt.md +++ b/site/packages/aa-core/bundler-client/actions/getUserOperationReceipt.md @@ -26,7 +26,7 @@ import { client } from "./client"; const receipt = await client.getUserOperationReceipt("0xUserOperationHash"); ``` -<<< @/snippets/bundlerClient.ts +<<< @/snippets/aa-core/bundlerClient.ts ::: ## Returns diff --git a/site/packages/aa-core/bundler-client/actions/sendRawUserOperation.md b/site/packages/aa-core/bundler-client/actions/sendRawUserOperation.md index 60d3e9cc3e..e2c8bd0f11 100644 --- a/site/packages/aa-core/bundler-client/actions/sendRawUserOperation.md +++ b/site/packages/aa-core/bundler-client/actions/sendRawUserOperation.md @@ -33,7 +33,7 @@ const hash = await client.sendRawUserOperation( ); ``` -<<< @/snippets/bundlerClient.ts +<<< @/snippets/aa-core/bundlerClient.ts ::: ## Returns diff --git a/site/packages/aa-core/index.md b/site/packages/aa-core/index.md index 91facf9ad2..77ae4f1072 100644 --- a/site/packages/aa-core/index.md +++ b/site/packages/aa-core/index.md @@ -44,5 +44,5 @@ pnpm i @alchemy/aa-core Then, you can create a client like so: ::: code-group -<<< @/snippets/core-provider.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: diff --git a/site/packages/aa-core/smart-account-client/actions/buildUserOperation.md b/site/packages/aa-core/smart-account-client/actions/buildUserOperation.md index 4201ca0c24..b4e9b4be25 100644 --- a/site/packages/aa-core/smart-account-client/actions/buildUserOperation.md +++ b/site/packages/aa-core/smart-account-client/actions/buildUserOperation.md @@ -64,7 +64,7 @@ const { hash: batchedUoHash } = await smartAccountClient.sendUserOperation({ }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: ## Returns diff --git a/site/packages/aa-core/smart-account-client/actions/buildUserOperationFromTx.md b/site/packages/aa-core/smart-account-client/actions/buildUserOperationFromTx.md index f924638334..76c3cc2365 100644 --- a/site/packages/aa-core/smart-account-client/actions/buildUserOperationFromTx.md +++ b/site/packages/aa-core/smart-account-client/actions/buildUserOperationFromTx.md @@ -45,7 +45,7 @@ const uoStruct = await smartAccountClient.buildUserOperationFromTx({ const uoHash = await smartAccountClient.sendUserOperation(uoStruct); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: ## Returns diff --git a/site/packages/aa-core/smart-account-client/actions/checkGasSponsorshipEligibility.md b/site/packages/aa-core/smart-account-client/actions/checkGasSponsorshipEligibility.md index d93d7cccbf..b11a38b2d2 100644 --- a/site/packages/aa-core/smart-account-client/actions/checkGasSponsorshipEligibility.md +++ b/site/packages/aa-core/smart-account-client/actions/checkGasSponsorshipEligibility.md @@ -42,7 +42,7 @@ console.log( ); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: ## Returns diff --git a/site/packages/aa-core/smart-account-client/actions/dropAndReplaceUserOperation.md b/site/packages/aa-core/smart-account-client/actions/dropAndReplaceUserOperation.md index c62d2ac469..c782c62b00 100644 --- a/site/packages/aa-core/smart-account-client/actions/dropAndReplaceUserOperation.md +++ b/site/packages/aa-core/smart-account-client/actions/dropAndReplaceUserOperation.md @@ -35,7 +35,7 @@ const { hash: replacedHash } = await smartAccountClient.dropAndReplaceUserOperation(request); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: ## Returns diff --git a/site/packages/aa-core/smart-account-client/actions/getAddress.md b/site/packages/aa-core/smart-account-client/actions/getAddress.md index 0c6cc42cf5..e01fd7d807 100644 --- a/site/packages/aa-core/smart-account-client/actions/getAddress.md +++ b/site/packages/aa-core/smart-account-client/actions/getAddress.md @@ -26,7 +26,7 @@ import { smartAccountClient } from "./smartAccountClient"; const address = await smartAccountClient.getAddress(); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: diff --git a/site/packages/aa-core/smart-account-client/actions/getUserOperationByHash.md b/site/packages/aa-core/smart-account-client/actions/getUserOperationByHash.md index aae62a49a5..94ef75da5b 100644 --- a/site/packages/aa-core/smart-account-client/actions/getUserOperationByHash.md +++ b/site/packages/aa-core/smart-account-client/actions/getUserOperationByHash.md @@ -26,7 +26,7 @@ import { smartAccountClient } from "./smartAccountClient"; smartAccountClient.getUserOperationByHash({ hash: "0xUserOpResultHash" }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: diff --git a/site/packages/aa-core/smart-account-client/actions/getUserOperationReceipt.md b/site/packages/aa-core/smart-account-client/actions/getUserOperationReceipt.md index e9a92967eb..0a657301b9 100644 --- a/site/packages/aa-core/smart-account-client/actions/getUserOperationReceipt.md +++ b/site/packages/aa-core/smart-account-client/actions/getUserOperationReceipt.md @@ -26,7 +26,7 @@ import { smartAccountClient } from "./smartAccountClient"; smartAccountClient.getUserOperationReceipt({ hash: "0xUserOpResultHash" }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: diff --git a/site/packages/aa-core/smart-account-client/actions/request.md b/site/packages/aa-core/smart-account-client/actions/request.md index 25e34d65d0..038926e0b1 100644 --- a/site/packages/aa-core/smart-account-client/actions/request.md +++ b/site/packages/aa-core/smart-account-client/actions/request.md @@ -39,7 +39,7 @@ const result = await smartAccountClient.request({ }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: diff --git a/site/packages/aa-core/smart-account-client/actions/sendTransaction.md b/site/packages/aa-core/smart-account-client/actions/sendTransaction.md index 93eeb288cb..a8d79ea98c 100644 --- a/site/packages/aa-core/smart-account-client/actions/sendTransaction.md +++ b/site/packages/aa-core/smart-account-client/actions/sendTransaction.md @@ -38,7 +38,7 @@ const txHash = await smartAccountClient.sendTransaction({ }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: diff --git a/site/packages/aa-core/smart-account-client/actions/sendTransactions.md b/site/packages/aa-core/smart-account-client/actions/sendTransactions.md index 5fb9fce4db..323489e9e6 100644 --- a/site/packages/aa-core/smart-account-client/actions/sendTransactions.md +++ b/site/packages/aa-core/smart-account-client/actions/sendTransactions.md @@ -59,7 +59,7 @@ const txHash = await smartAccountClient.sendTransactions({requests: [ ]}); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: diff --git a/site/packages/aa-core/smart-account-client/actions/sendUserOperation.md b/site/packages/aa-core/smart-account-client/actions/sendUserOperation.md index 83b1873c9a..d687cb912c 100644 --- a/site/packages/aa-core/smart-account-client/actions/sendUserOperation.md +++ b/site/packages/aa-core/smart-account-client/actions/sendUserOperation.md @@ -56,7 +56,7 @@ smartAccountClient.sendUserOperation({ }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: ## Returns diff --git a/site/packages/aa-core/smart-account-client/actions/signMessage.md b/site/packages/aa-core/smart-account-client/actions/signMessage.md index 03b5cbd254..9835b481d8 100644 --- a/site/packages/aa-core/smart-account-client/actions/signMessage.md +++ b/site/packages/aa-core/smart-account-client/actions/signMessage.md @@ -26,7 +26,7 @@ import { smartAccountClient } from "./smartAccountClient"; const signedMessage = await smartAccountClient.signMessage({ message: "msg" }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: diff --git a/site/packages/aa-core/smart-account-client/actions/signMessageWith6492.md b/site/packages/aa-core/smart-account-client/actions/signMessageWith6492.md index 6566ac17e1..c71a100ae9 100644 --- a/site/packages/aa-core/smart-account-client/actions/signMessageWith6492.md +++ b/site/packages/aa-core/smart-account-client/actions/signMessageWith6492.md @@ -29,7 +29,7 @@ const signedMessageWith6492 = smartAccountClient.signMessageWith6492({ }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: diff --git a/site/packages/aa-core/smart-account-client/actions/signTypedData.md b/site/packages/aa-core/smart-account-client/actions/signTypedData.md index 0dea19254c..b7eca630d6 100644 --- a/site/packages/aa-core/smart-account-client/actions/signTypedData.md +++ b/site/packages/aa-core/smart-account-client/actions/signTypedData.md @@ -57,7 +57,7 @@ const signedTypedData = smartAccountClient.signTypedData({ }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: diff --git a/site/packages/aa-core/smart-account-client/actions/signTypedDataWith6492.md b/site/packages/aa-core/smart-account-client/actions/signTypedDataWith6492.md index 1c0f33dd56..a347f286ac 100644 --- a/site/packages/aa-core/smart-account-client/actions/signTypedDataWith6492.md +++ b/site/packages/aa-core/smart-account-client/actions/signTypedDataWith6492.md @@ -57,7 +57,7 @@ const signedTypedDataWith6492 = smartAccountClient.signTypedDataWith6492({ }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: diff --git a/site/packages/aa-core/smart-account-client/actions/waitForUserOperationTransaction.md b/site/packages/aa-core/smart-account-client/actions/waitForUserOperationTransaction.md index cfcc514b97..a925109526 100644 --- a/site/packages/aa-core/smart-account-client/actions/waitForUserOperationTransaction.md +++ b/site/packages/aa-core/smart-account-client/actions/waitForUserOperationTransaction.md @@ -39,7 +39,7 @@ const txHash = await smartAccountClient.waitForUserOperationTransaction({ }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: ## Returns diff --git a/site/packages/aa-core/smart-account-client/types/userOperationOverrides.md b/site/packages/aa-core/smart-account-client/types/userOperationOverrides.md index 8aa64a6cee..1678a7ce7e 100644 --- a/site/packages/aa-core/smart-account-client/types/userOperationOverrides.md +++ b/site/packages/aa-core/smart-account-client/types/userOperationOverrides.md @@ -86,6 +86,6 @@ const txHash = await provider.waitForUserOperationTransaction({ }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: diff --git a/site/packages/aa-ethers/account-signer/connect.md b/site/packages/aa-ethers/account-signer/connect.md index 9b2b855fc0..063cc28b7c 100644 --- a/site/packages/aa-ethers/account-signer/connect.md +++ b/site/packages/aa-ethers/account-signer/connect.md @@ -37,7 +37,7 @@ const newProvider = EthersProviderAdapter.fromEthersProvider(ethersProvider); const newSigner = signer.connect(newProvider); ``` -<<< @/snippets/ethers-signer.ts +<<< @/snippets/aa-ethers/ethers-signer.ts ::: ## Returns diff --git a/site/packages/aa-ethers/account-signer/getAddress.md b/site/packages/aa-ethers/account-signer/getAddress.md index 883e6917e8..bca69d2e41 100644 --- a/site/packages/aa-ethers/account-signer/getAddress.md +++ b/site/packages/aa-ethers/account-signer/getAddress.md @@ -27,7 +27,7 @@ import { signer } from "./ethers-signer"; const client = await signer.getAddress(); ``` -<<< @/snippets/ethers-signer.ts +<<< @/snippets/aa-ethers/ethers-signer.ts ::: ## Returns diff --git a/site/packages/aa-ethers/account-signer/getBundlerClient.md b/site/packages/aa-ethers/account-signer/getBundlerClient.md index 18b11c455e..417d2bba73 100644 --- a/site/packages/aa-ethers/account-signer/getBundlerClient.md +++ b/site/packages/aa-ethers/account-signer/getBundlerClient.md @@ -27,7 +27,7 @@ import { signer } from "./ethers-signer"; const client = signer.getBundlerClient(); ``` -<<< @/snippets/ethers-signer.ts +<<< @/snippets/aa-ethers/ethers-signer.ts ::: ## Returns diff --git a/site/packages/aa-ethers/account-signer/introduction.md b/site/packages/aa-ethers/account-signer/introduction.md index d257409303..31fb32b718 100644 --- a/site/packages/aa-ethers/account-signer/introduction.md +++ b/site/packages/aa-ethers/account-signer/introduction.md @@ -47,5 +47,5 @@ const txn = await signer.sendTransaction({ const client = signer.getBundlerClient(); ``` -<<< @/snippets/ethers-signer.ts +<<< @/snippets/aa-ethers/ethers-signer.ts ::: diff --git a/site/packages/aa-ethers/account-signer/sendTransaction.md b/site/packages/aa-ethers/account-signer/sendTransaction.md index 08162a6324..07262bbd98 100644 --- a/site/packages/aa-ethers/account-signer/sendTransaction.md +++ b/site/packages/aa-ethers/account-signer/sendTransaction.md @@ -36,7 +36,7 @@ const txHash = await signer.sendTransaction({ }); ``` -<<< @/snippets/ethers-signer.ts +<<< @/snippets/aa-ethers/ethers-signer.ts ::: ## Returns diff --git a/site/packages/aa-ethers/account-signer/signMessage.md b/site/packages/aa-ethers/account-signer/signMessage.md index 84d5be3818..33fca166e4 100644 --- a/site/packages/aa-ethers/account-signer/signMessage.md +++ b/site/packages/aa-ethers/account-signer/signMessage.md @@ -27,7 +27,7 @@ import { signer } from "./ethers-signer"; const signedMessage = await signer.signMessage("test"); ``` -<<< @/snippets/ethers-signer.ts +<<< @/snippets/aa-ethers/ethers-signer.ts ::: ## Returns diff --git a/site/packages/aa-ethers/index.md b/site/packages/aa-ethers/index.md index 317a430d06..3279635e5c 100644 --- a/site/packages/aa-ethers/index.md +++ b/site/packages/aa-ethers/index.md @@ -48,7 +48,7 @@ pnpm i @alchemy/aa-ethers You can create a provider and connect it to a Signer account like so: ::: code-group -<<< @/snippets/ethers-signer.ts -<<< @/snippets/ethers-provider.ts +<<< @/snippets/aa-ethers/ethers-signer.ts +<<< @/snippets/aa-ethers/ethers-provider.ts ::: diff --git a/site/packages/aa-ethers/provider-adapter/connectToAccount.md b/site/packages/aa-ethers/provider-adapter/connectToAccount.md index 415d78b61a..e856c32e88 100644 --- a/site/packages/aa-ethers/provider-adapter/connectToAccount.md +++ b/site/packages/aa-ethers/provider-adapter/connectToAccount.md @@ -20,8 +20,8 @@ head: ::: code-group -<<< @/snippets/ethers-signer.ts -<<< @/snippets/ethers-provider.ts +<<< @/snippets/aa-ethers/ethers-signer.ts +<<< @/snippets/aa-ethers/ethers-provider.ts ::: ## Returns diff --git a/site/packages/aa-ethers/provider-adapter/fromEthersProvider.md b/site/packages/aa-ethers/provider-adapter/fromEthersProvider.md index f4c5eb7d0c..30ad8953c5 100644 --- a/site/packages/aa-ethers/provider-adapter/fromEthersProvider.md +++ b/site/packages/aa-ethers/provider-adapter/fromEthersProvider.md @@ -22,7 +22,7 @@ next: ::: code-group -<<< @/snippets/ethers-provider.ts +<<< @/snippets/aa-ethers/ethers-provider.ts ::: ## Returns diff --git a/site/packages/aa-ethers/provider-adapter/getBundlerClient.md b/site/packages/aa-ethers/provider-adapter/getBundlerClient.md index aaccb59edc..93d0b1f8f2 100644 --- a/site/packages/aa-ethers/provider-adapter/getBundlerClient.md +++ b/site/packages/aa-ethers/provider-adapter/getBundlerClient.md @@ -27,7 +27,7 @@ import { provider } from "./ethers-provider"; const client = provider.getBundlerClient(); ``` -<<< @/snippets/ethers-provider.ts +<<< @/snippets/aa-ethers/ethers-provider.ts ::: ## Returns diff --git a/site/packages/aa-ethers/provider-adapter/introduction.md b/site/packages/aa-ethers/provider-adapter/introduction.md index 86e87f32c9..919995f40f 100644 --- a/site/packages/aa-ethers/provider-adapter/introduction.md +++ b/site/packages/aa-ethers/provider-adapter/introduction.md @@ -57,5 +57,5 @@ const signer = provider.connectToAccount( ); ``` -<<< @/snippets/ethers-provider.ts +<<< @/snippets/aa-ethers/ethers-provider.ts ::: diff --git a/site/packages/aa-ethers/provider-adapter/send.md b/site/packages/aa-ethers/provider-adapter/send.md index da695a6f62..193e3dfe0a 100644 --- a/site/packages/aa-ethers/provider-adapter/send.md +++ b/site/packages/aa-ethers/provider-adapter/send.md @@ -27,7 +27,7 @@ import { provider } from "./ethers-provider"; const chainId = await provider.send("eth_chainId", []); ``` -<<< @/snippets/ethers-provider.ts +<<< @/snippets/aa-ethers/ethers-provider.ts ::: ## Returns diff --git a/site/smart-accounts/accounts/guides/light-account.md b/site/smart-accounts/accounts/guides/light-account.md index 2abe50b9cc..5f8655b79f 100644 --- a/site/smart-accounts/accounts/guides/light-account.md +++ b/site/smart-accounts/accounts/guides/light-account.md @@ -54,7 +54,7 @@ We're pioneering the future of modular smart accounts with [EIP-6900](https://ww The code snippet below demonstrates how to use Light Account with Account Kit. It creates a Light Account and sends a `UserOperation` from it: -<<< @/snippets/light-account.ts +<<< @/snippets/aa-alchemy/light-account.ts ## Developer Links diff --git a/site/snippets/alchemy-smartAccountClient.ts b/site/snippets/aa-alchemy/base-client.ts similarity index 72% rename from site/snippets/alchemy-smartAccountClient.ts rename to site/snippets/aa-alchemy/base-client.ts index 25846a1a97..f873b657d7 100644 --- a/site/snippets/alchemy-smartAccountClient.ts +++ b/site/snippets/aa-alchemy/base-client.ts @@ -3,7 +3,7 @@ import { polygonMumbai } from "@alchemy/aa-core"; const chain = polygonMumbai; -export const provider = createAlchemySmartAccountClient({ +export const smartAccountClient = createAlchemySmartAccountClient({ apiKey: "demo", chain, }); diff --git a/site/snippets/aa-alchemy/connected-client.ts b/site/snippets/aa-alchemy/connected-client.ts new file mode 100644 index 0000000000..6417742cc5 --- /dev/null +++ b/site/snippets/aa-alchemy/connected-client.ts @@ -0,0 +1,8 @@ +import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy"; +import { LocalAccountSigner, sepolia } from "@alchemy/aa-core"; + +export const smartAccountClient = await createModularAccountAlchemyClient({ + apiKey: "YOUR_API_KEY", + chain: sepolia, + owner: LocalAccountSigner.mnemonicToAccountSigner("OWNER_MNEMONIC"), +}); diff --git a/site/snippets/light-account-alchemy-client.ts b/site/snippets/aa-alchemy/light-account-client.ts similarity index 100% rename from site/snippets/light-account-alchemy-client.ts rename to site/snippets/aa-alchemy/light-account-client.ts diff --git a/site/snippets/light-account.ts b/site/snippets/aa-alchemy/light-account.ts similarity index 54% rename from site/snippets/light-account.ts rename to site/snippets/aa-alchemy/light-account.ts index f84e288074..d2bf602018 100644 --- a/site/snippets/light-account.ts +++ b/site/snippets/aa-alchemy/light-account.ts @@ -1,8 +1,4 @@ -import { - LightSmartContractAccount, - getDefaultLightAccountFactoryAddress, -} from "@alchemy/aa-accounts"; -import { AlchemyProvider } from "@alchemy/aa-alchemy"; +import { createLightAccountAlchemyClient } from "@alchemy/aa-alchemy"; import { LocalAccountSigner, sepolia, type Hex } from "@alchemy/aa-core"; const chain = sepolia; @@ -12,34 +8,29 @@ const PRIVATE_KEY = "0xYourEOAPrivateKey" as Hex; const owner = LocalAccountSigner.privateKeyToAccountSigner(PRIVATE_KEY); // Create a provider to send user operations from your smart account -const provider = new AlchemyProvider({ +const provider = await createLightAccountAlchemyClient({ // get your Alchemy API key at https://dashboard.alchemy.com apiKey: "ALCHEMY_API_KEY", chain, -}).connect( - (rpcClient) => - new LightSmartContractAccount({ - rpcClient, - owner, - chain, - factoryAddress: getDefaultLightAccountFactoryAddress(chain), - }) -); + owner, +}); // Fund your account address with ETH to send for the user operations // (e.g. Get Sepolia ETH at https://sepoliafaucet.com) -console.log(await provider.getAddress()); // Log the smart account address +console.log(provider.getAddress()); // Log the smart account address // Send a user operation from your smart account const { hash: uoHash } = await provider.sendUserOperation({ - target: "0xTargetAddress", // The desired target contract address - data: "0xCallData", // The desired call data - value: 0n, // (Optional) value to send the target contract address + uo: { + target: "0xTargetAddress", // The desired target contract address + data: "0xCallData", // The desired call data + value: 0n, // (Optional) value to send the target contract address + }, }); console.log(uoHash); // Log the user operation hash // Wait for the user operation to be mined -const txHash = await provider.waitForUserOperationTransaction(uoHash); +const txHash = await provider.waitForUserOperationTransaction({ hash: uoHash }); console.log(txHash); // Log the transaction hash diff --git a/site/snippets/bundlerClient.ts b/site/snippets/aa-core/bundlerClient.ts similarity index 100% rename from site/snippets/bundlerClient.ts rename to site/snippets/aa-core/bundlerClient.ts diff --git a/site/snippets/core-provider.ts b/site/snippets/aa-core/smartAccountClient.ts similarity index 100% rename from site/snippets/core-provider.ts rename to site/snippets/aa-core/smartAccountClient.ts diff --git a/site/snippets/ethers-provider.ts b/site/snippets/aa-ethers/ethers-provider.ts similarity index 100% rename from site/snippets/ethers-provider.ts rename to site/snippets/aa-ethers/ethers-provider.ts diff --git a/site/snippets/ethers-signer.ts b/site/snippets/aa-ethers/ethers-signer.ts similarity index 100% rename from site/snippets/ethers-signer.ts rename to site/snippets/aa-ethers/ethers-signer.ts diff --git a/site/snippets/account-alchemy.ts b/site/snippets/account-alchemy.ts deleted file mode 100644 index eac7c3b8a6..0000000000 --- a/site/snippets/account-alchemy.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* via `aa-alchemy` */ - -import { AlchemyProvider } from "@alchemy/aa-alchemy"; -import { - LocalAccountSigner, - SimpleSmartContractAccount, - getDefaultEntryPointAddress, - getDefaultSimpleAccountFactoryAddress, - polygonMumbai, - type SmartAccountSigner, -} from "@alchemy/aa-core"; - -const chain = polygonMumbai; - -// 1. define the EOA owner of the smart account -// this uses a utility method for creating an account signer using mnemonic -// we also have a utility for creating an account signer from a private key -const owner: SmartAccountSigner = - LocalAccountSigner.mnemonicToAccountSigner(MNEMONIC); - -// 2. initialize the provider and connect it to the account -let provider = new AlchemyProvider({ - apiKey: API_KEY, - chain, -}).connect( - (rpcClient) => - new SimpleSmartContractAccount({ - entryPointAddress: getDefaultEntryPointAddress(chain), - chain, // ether a viem Chain or chainId that supports account abstraction at Alchemy - owner, - factoryAddress: getDefaultSimpleAccountFactoryAddress(chain), - rpcClient, - }) -); - -// [OPTIONAL] Use Alchemy Gas Manager -provider.withAlchemyGasManager({ - policyId: PAYMASTER_POLICY_ID, -}); - -// 3. send a UserOperation -// eslint-disable-next-line @typescript-eslint/no-unused-vars -const { hash } = await provider.sendUserOperation({ - target: "0xTargetAddress", - data: "0xcallData", - value: 0n, // value: bigint or undefined -}); diff --git a/site/snippets/account-core.ts b/site/snippets/account-core.ts deleted file mode 100644 index deb604c833..0000000000 --- a/site/snippets/account-core.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* via `aa-core`*/ - -import { - LocalAccountSigner, - SimpleSmartContractAccount, - SmartAccountProvider, - getDefaultSimpleAccountFactoryAddress, - polygonMumbai, - type SmartAccountSigner, -} from "@alchemy/aa-core"; - -// 1. define the EOA owner of the smart account -// this uses a utility method for creating an account signer using mnemonic -// we also have a utility for creating an account signer from a private key -const owner: SmartAccountSigner = - LocalAccountSigner.mnemonicToAccountSigner(MNEMONIC); - -const chain = polygonMumbai; - -// 2. initialize the provider and connect it to the account -const provider = new SmartAccountProvider({ - // the demo key below is public and rate-limited, it's better to create a new one - // you can get started with a free account @ https://www.alchemy.com/ - rpcProvider: "https://polygon-mumbai.g.alchemy.com/v2/demo", - chain, -}).connect( - (rpcClient) => - new SimpleSmartContractAccount({ - chain, - factoryAddress: getDefaultSimpleAccountFactoryAddress(chain), - rpcClient, - owner, - // optionally if you already know the account's address - accountAddress: "0x000...000", - }) -); - -// 3. send a UserOperation -// eslint-disable-next-line @typescript-eslint/no-unused-vars -export const { hash } = await provider.sendUserOperation({ - target: "0xTargetAddress", - data: "0xcallData", - value: 0n, // value: bigint or undefined -}); diff --git a/site/snippets/account-ethers.ts b/site/snippets/account-ethers.ts deleted file mode 100644 index e679964bf9..0000000000 --- a/site/snippets/account-ethers.ts +++ /dev/null @@ -1,49 +0,0 @@ -/* via `aa-ethers`*/ - -import { - getChain, - getDefaultEntryPointAddress, - getDefaultSimpleAccountFactoryAddress, - SimpleSmartContractAccount, -} from "@alchemy/aa-core"; -import { - convertWalletToAccountSigner, - EthersProviderAdapter, -} from "@alchemy/aa-ethers"; -import { Wallet } from "@ethersproject/wallet"; -import { Alchemy, Network } from "alchemy-sdk"; - -// 1. connect to an RPC Provider and a Wallet -const alchemy = new Alchemy({ - apiKey: API_KEY, - network: Network.MATIC_MUMBAI, -}); -const alchemyProvider = await alchemy.config.getProvider(); -const owner = Wallet.fromMnemonic(MNEMONIC); - -// 2. Create the SimpleAccount signer -// signer is an ethers.js Signer -const signer = EthersProviderAdapter.fromEthersProvider( - alchemyProvider -).connectToAccount( - (rpcClient) => - new SimpleSmartContractAccount({ - entryPointAddress: getDefaultEntryPointAddress( - getChain(alchemyProvider.network.chainId) - ), - chain: getChain(alchemyProvider.network.chainId), - owner: convertWalletToAccountSigner(owner), - factoryAddress: getDefaultSimpleAccountFactoryAddress( - getChain(alchemyProvider.network.chainId) - ), - rpcClient, - }) -); - -// 3. send a user op -// eslint-disable-next-line @typescript-eslint/no-unused-vars -const { hash } = await signer.sendUserOperation({ - target: "0xTargetAddress", - data: "0xcallData", - value: 0n, // value: bigint or undefined -}); diff --git a/site/snippets/enhanced-apis-example/nft.ts b/site/snippets/enhanced-apis-example/nft.ts index 2f4820d046..30cf059b5d 100644 --- a/site/snippets/enhanced-apis-example/nft.ts +++ b/site/snippets/enhanced-apis-example/nft.ts @@ -1,6 +1,6 @@ import { alchemyEnhancedApiActions, - createLightAccountAlchemyClient, + createModularAccountAlchemyClient, } from "@alchemy/aa-alchemy"; import { LocalAccountSigner, sepolia } from "@alchemy/aa-core"; import { Alchemy, Network } from "alchemy-sdk"; @@ -11,7 +11,7 @@ const alchemy = new Alchemy({ }); const provider = ( - await createLightAccountAlchemyClient({ + await createModularAccountAlchemyClient({ chain: sepolia, apiKey: "YOUR_API_KEY", owner: LocalAccountSigner.mnemonicToAccountSigner("OWNER_MNEMONIC"), diff --git a/site/snippets/enhanced-apis-example/token.ts b/site/snippets/enhanced-apis-example/token.ts index 0443bbfd32..6c2da2136e 100644 --- a/site/snippets/enhanced-apis-example/token.ts +++ b/site/snippets/enhanced-apis-example/token.ts @@ -1,6 +1,6 @@ import { alchemyEnhancedApiActions, - createLightAccountAlchemyClient, + createModularAccountAlchemyClient, } from "@alchemy/aa-alchemy"; import { LocalAccountSigner, sepolia } from "@alchemy/aa-core"; import { Alchemy, Network } from "alchemy-sdk"; @@ -11,7 +11,7 @@ const alchemy = new Alchemy({ }); const provider = ( - await createLightAccountAlchemyClient({ + await createModularAccountAlchemyClient({ chain: sepolia, apiKey: "YOUR_API_KEY", owner: LocalAccountSigner.mnemonicToAccountSigner("OWNER_MNEMONIC"), diff --git a/site/snippets/getting-started/provider.ts b/site/snippets/getting-started/provider.ts index b17e54a55e..f026f03fd1 100644 --- a/site/snippets/getting-started/provider.ts +++ b/site/snippets/getting-started/provider.ts @@ -1,8 +1,4 @@ -import { - LightSmartContractAccount, - getDefaultLightAccountFactoryAddress, -} from "@alchemy/aa-accounts"; -import { AlchemyProvider } from "@alchemy/aa-alchemy"; +import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy"; import { LocalAccountSigner, sepolia, type Hex } from "@alchemy/aa-core"; const chain = sepolia; @@ -13,22 +9,15 @@ const PRIVATE_KEY = "0xYourEOAPrivateKey" as Hex; const owner = LocalAccountSigner.privateKeyToAccountSigner(PRIVATE_KEY); // Create a provider to send user operations from your smart account -const provider = new AlchemyProvider({ +const provider = await createModularAccountAlchemyClient({ // get your Alchemy API key at https://dashboard.alchemy.com apiKey: "ALCHEMY_API_KEY", chain, -}).connect( - (rpcClient) => - new LightSmartContractAccount({ - rpcClient, - owner, - chain, - factoryAddress: getDefaultLightAccountFactoryAddress(chain), - }) -); + owner, +}); (async () => { // Fund your account address with ETH to send for the user operations // (e.g. Get Sepolia ETH at https://sepoliafaucet.com) - console.log("Smart Account Address: ", await provider.getAddress()); // Log the smart account address + console.log("Smart Account Address: ", provider.getAddress()); // Log the smart account address })(); diff --git a/site/snippets/getting-started/send-user-operation.ts b/site/snippets/getting-started/send-user-operation.ts index 46a894f67f..9f9b73a16f 100644 --- a/site/snippets/getting-started/send-user-operation.ts +++ b/site/snippets/getting-started/send-user-operation.ts @@ -1,8 +1,4 @@ -import { - LightSmartContractAccount, - getDefaultLightAccountFactoryAddress, -} from "@alchemy/aa-accounts"; -import { AlchemyProvider } from "@alchemy/aa-alchemy"; +import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy"; import { Address, LocalAccountSigner, @@ -17,39 +13,36 @@ const PRIVATE_KEY = "0xYourEOAPrivateKey" as Hex; const owner = LocalAccountSigner.privateKeyToAccountSigner(PRIVATE_KEY); // Create a provider to send user operations from your smart account -const provider = new AlchemyProvider({ +const provider = await createModularAccountAlchemyClient({ // get your Alchemy API key at https://dashboard.alchemy.com apiKey: "ALCHEMY_API_KEY", chain, -}).connect( - (rpcClient) => - new LightSmartContractAccount({ - rpcClient, - owner, - chain, - factoryAddress: getDefaultLightAccountFactoryAddress(chain), - }) -); + owner, +}); // [!code focus:22] (async () => { // Fund your account address with ETH to send for the user operations // (e.g. Get Sepolia ETH at https://sepoliafaucet.com) - console.log("Smart Account Address: ", await provider.getAddress()); // Log the smart account address + console.log("Smart Account Address: ", provider.getAddress()); // Log the smart account address const vitalikAddress = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" as Address; // Send a user operation from your smart account to Vitalik that does nothing const { hash: uoHash } = await provider.sendUserOperation({ - target: vitalikAddress, // The desired target contract address - data: "0x", // The desired call data - value: 0n, // (Optional) value to send the target contract address + uo: { + target: vitalikAddress, // The desired target contract address + data: "0x", // The desired call data + value: 0n, // (Optional) value to send the target contract address + }, }); console.log("UserOperation Hash: ", uoHash); // Log the user operation hash // Wait for the user operation to be mined - const txHash = await provider.waitForUserOperationTransaction(uoHash); + const txHash = await provider.waitForUserOperationTransaction({ + hash: uoHash, + }); console.log("Transaction Hash: ", txHash); // Log the transaction hash })(); diff --git a/site/snippets/light-account-client.ts b/site/snippets/light-account-client.ts deleted file mode 100644 index 635f774040..0000000000 --- a/site/snippets/light-account-client.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { createLightAccountClient } from "@alchemy/aa-accounts"; -import { LocalAccountSigner, sepolia } from "@alchemy/aa-core"; -import { http } from "viem"; - -export const provider = createLightAccountClient({ - transport: http(`${sepolia.rpcUrls.alchemy.http[0]}/${"YOUR_API_KEY"}`), - chain: sepolia, - owner: LocalAccountSigner.mnemonicToAccountSigner("OWNER_MNEMONIC"), -}); diff --git a/site/snippets/send-uo-example/calldata.ts b/site/snippets/send-uo-example/calldata.ts index 1430ec8706..ca36c2024a 100644 --- a/site/snippets/send-uo-example/calldata.ts +++ b/site/snippets/send-uo-example/calldata.ts @@ -1,4 +1,4 @@ -import { smartAccountClient } from "snippets/light-account-alchemy-client"; +import { smartAccountClient } from "snippets/aa-alchemy/connected-client"; import { encodeFunctionData } from "viem"; // this is an example ABI for a contract with a "mint" function diff --git a/site/snippets/send-uo-example/send-uo.ts b/site/snippets/send-uo-example/send-uo.ts index 92e1245e20..85b89f0984 100644 --- a/site/snippets/send-uo-example/send-uo.ts +++ b/site/snippets/send-uo-example/send-uo.ts @@ -1,4 +1,4 @@ -import { smartAccountClient } from "../light-account-alchemy-client.js"; +import { smartAccountClient } from "../connected-client.js"; import { uoCallData } from "./calldata.js"; const uo = await smartAccountClient.sendUserOperation({ diff --git a/site/snippets/sim-uo-example/sim-method.ts b/site/snippets/sim-uo-example/sim-method.ts index cf07f9cefc..99f5a0e39a 100644 --- a/site/snippets/sim-uo-example/sim-method.ts +++ b/site/snippets/sim-uo-example/sim-method.ts @@ -1,11 +1,11 @@ -import { createLightAccountAlchemyClient } from "@alchemy/aa-alchemy"; +import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy"; import { LocalAccountSigner, UserOperationCallData, sepolia, } from "@alchemy/aa-core"; -export const smartAccountClient = await createLightAccountAlchemyClient({ +export const smartAccountClient = await createModularAccountAlchemyClient({ apiKey: "YOUR_API_KEY", chain: sepolia, owner: LocalAccountSigner.mnemonicToAccountSigner("OWNER_MNEMONIC"), diff --git a/site/snippets/sim-uo-example/sim-middleware.ts b/site/snippets/sim-uo-example/sim-middleware.ts index 1543005127..588387f6e6 100644 --- a/site/snippets/sim-uo-example/sim-middleware.ts +++ b/site/snippets/sim-uo-example/sim-middleware.ts @@ -1,7 +1,7 @@ -import { createLightAccountAlchemyClient } from "@alchemy/aa-alchemy"; +import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy"; import { LocalAccountSigner, sepolia } from "@alchemy/aa-core"; -export const smartAccountClient = await createLightAccountAlchemyClient({ +export const smartAccountClient = await createModularAccountAlchemyClient({ apiKey: "YOUR_API_KEY", chain: sepolia, owner: LocalAccountSigner.mnemonicToAccountSigner("OWNER_MNEMONIC"), diff --git a/site/snippets/simple-account-abi.ts b/site/snippets/simple-account-abi.ts deleted file mode 100644 index 8585d2a471..0000000000 --- a/site/snippets/simple-account-abi.ts +++ /dev/null @@ -1,524 +0,0 @@ -export const SimpleAccountAbi = [ - { - inputs: [ - { - internalType: "contract IEntryPoint", - name: "anEntryPoint", - type: "address", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "previousAdmin", - type: "address", - }, - { - indexed: false, - internalType: "address", - name: "newAdmin", - type: "address", - }, - ], - name: "AdminChanged", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "beacon", - type: "address", - }, - ], - name: "BeaconUpgraded", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint8", - name: "version", - type: "uint8", - }, - ], - name: "Initialized", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "contract IEntryPoint", - name: "entryPoint", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "owner", - type: "address", - }, - ], - name: "SimpleAccountInitialized", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "implementation", - type: "address", - }, - ], - name: "Upgraded", - type: "event", - }, - { - inputs: [], - name: "addDeposit", - outputs: [], - stateMutability: "payable", - type: "function", - }, - { - inputs: [], - name: "entryPoint", - outputs: [ - { - internalType: "contract IEntryPoint", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "dest", - type: "address", - }, - { - internalType: "uint256", - name: "value", - type: "uint256", - }, - { - internalType: "bytes", - name: "func", - type: "bytes", - }, - ], - name: "execute", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address[]", - name: "dest", - type: "address[]", - }, - { - internalType: "bytes[]", - name: "func", - type: "bytes[]", - }, - ], - name: "executeBatch", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "getDeposit", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getNonce", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "anOwner", - type: "address", - }, - ], - name: "initialize", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - { - internalType: "address", - name: "", - type: "address", - }, - { - internalType: "uint256[]", - name: "", - type: "uint256[]", - }, - { - internalType: "uint256[]", - name: "", - type: "uint256[]", - }, - { - internalType: "bytes", - name: "", - type: "bytes", - }, - ], - name: "onERC1155BatchReceived", - outputs: [ - { - internalType: "bytes4", - name: "", - type: "bytes4", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - { - internalType: "address", - name: "", - type: "address", - }, - { - internalType: "uint256", - name: "", - type: "uint256", - }, - { - internalType: "uint256", - name: "", - type: "uint256", - }, - { - internalType: "bytes", - name: "", - type: "bytes", - }, - ], - name: "onERC1155Received", - outputs: [ - { - internalType: "bytes4", - name: "", - type: "bytes4", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - { - internalType: "address", - name: "", - type: "address", - }, - { - internalType: "uint256", - name: "", - type: "uint256", - }, - { - internalType: "bytes", - name: "", - type: "bytes", - }, - ], - name: "onERC721Received", - outputs: [ - { - internalType: "bytes4", - name: "", - type: "bytes4", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "owner", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "proxiableUUID", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes4", - name: "interfaceId", - type: "bytes4", - }, - ], - name: "supportsInterface", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - { - internalType: "address", - name: "", - type: "address", - }, - { - internalType: "address", - name: "", - type: "address", - }, - { - internalType: "uint256", - name: "", - type: "uint256", - }, - { - internalType: "bytes", - name: "", - type: "bytes", - }, - { - internalType: "bytes", - name: "", - type: "bytes", - }, - ], - name: "tokensReceived", - outputs: [], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "newImplementation", - type: "address", - }, - ], - name: "upgradeTo", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "newImplementation", - type: "address", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - ], - name: "upgradeToAndCall", - outputs: [], - stateMutability: "payable", - type: "function", - }, - { - inputs: [ - { - components: [ - { - internalType: "address", - name: "sender", - type: "address", - }, - { - internalType: "uint256", - name: "nonce", - type: "uint256", - }, - { - internalType: "bytes", - name: "initCode", - type: "bytes", - }, - { - internalType: "bytes", - name: "callData", - type: "bytes", - }, - { - internalType: "uint256", - name: "callGasLimit", - type: "uint256", - }, - { - internalType: "uint256", - name: "verificationGasLimit", - type: "uint256", - }, - { - internalType: "uint256", - name: "preVerificationGas", - type: "uint256", - }, - { - internalType: "uint256", - name: "maxFeePerGas", - type: "uint256", - }, - { - internalType: "uint256", - name: "maxPriorityFeePerGas", - type: "uint256", - }, - { - internalType: "bytes", - name: "paymasterAndData", - type: "bytes", - }, - { - internalType: "bytes", - name: "signature", - type: "bytes", - }, - ], - internalType: "struct UserOperation", - name: "userOp", - type: "tuple", - }, - { - internalType: "bytes32", - name: "userOpHash", - type: "bytes32", - }, - { - internalType: "uint256", - name: "missingAccountFunds", - type: "uint256", - }, - ], - name: "validateUserOp", - outputs: [ - { - internalType: "uint256", - name: "validationData", - type: "uint256", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address payable", - name: "withdrawAddress", - type: "address", - }, - { - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "withdrawDepositTo", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - stateMutability: "payable", - type: "receive", - }, -] as const; diff --git a/site/snippets/smartAccountClient.ts b/site/snippets/smartAccountClient.ts deleted file mode 100644 index cbea36e6eb..0000000000 --- a/site/snippets/smartAccountClient.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { createLightAccountClient } from "@alchemy/aa-accounts"; -import { LocalAccountSigner, sepolia, type Hex } from "@alchemy/aa-core"; -import { http } from "viem"; - -const chain = sepolia; -const PRIVATE_KEY = "0xYourEOAPrivateKey" as Hex; -const owner = LocalAccountSigner.privateKeyToAccountSigner(PRIVATE_KEY); - -export const smartAccountClient = await createLightAccountClient({ - transport: http("https://eth-sepolia.alchemyapi.io/v2/ALCHEMY_API_KEY"), - chain, - owner, -}); diff --git a/site/tutorials/batching-transactions.md b/site/tutorials/batching-transactions.md index 80bd8217f2..514d66f2ed 100644 --- a/site/tutorials/batching-transactions.md +++ b/site/tutorials/batching-transactions.md @@ -61,7 +61,7 @@ const { hash } = await provider.sendUserOperation([ ]); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: @@ -87,6 +87,6 @@ const hash = await provider.sendTransactions([ ]); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: diff --git a/site/tutorials/send-user-operation.md b/site/tutorials/send-user-operation.md index f838e4cbb9..67159c3f8f 100644 --- a/site/tutorials/send-user-operation.md +++ b/site/tutorials/send-user-operation.md @@ -31,7 +31,7 @@ Using the SDK, we'll create an Alchemy Smart Account Client. As it is, the provi See [Alchemy Smart Account Client](/packages/aa-alchemy/smart-account-client/) for more details. -<<< @/snippets/light-account-alchemy-client.ts +<<< @/snippets/aa-alchemy/connected-client.ts ## 2. Construct The CallData diff --git a/site/tutorials/sponsoring-gas/gas-sponsorship-eligibility.md b/site/tutorials/sponsoring-gas/gas-sponsorship-eligibility.md index 8d61333363..1b2631352b 100644 --- a/site/tutorials/sponsoring-gas/gas-sponsorship-eligibility.md +++ b/site/tutorials/sponsoring-gas/gas-sponsorship-eligibility.md @@ -46,7 +46,7 @@ provider.withAlchemyGasManager({ }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: diff --git a/site/tutorials/sponsoring-gas/sponsoring-gas.md b/site/tutorials/sponsoring-gas/sponsoring-gas.md index b381b8e8a9..5c33b8b525 100644 --- a/site/tutorials/sponsoring-gas/sponsoring-gas.md +++ b/site/tutorials/sponsoring-gas/sponsoring-gas.md @@ -30,7 +30,7 @@ After [installing `aa-sdk`](/overview/getting-started#install-the-packages) in y First, create an `AlchemyProvider`. You'll use this to send UOs and interact with the blockchain. -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts Remember to replace `ALCHEMY_API_KEY` with your Alchemy API key. If you don't have one yet, you can create an API key on the [Alchemy dashboard](https://dashboard.alchemy.com/signup/?a=aa-docs). @@ -78,7 +78,7 @@ const { hash } = await provider.sendUserOperation({ }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: @@ -111,7 +111,7 @@ const { hash } = await provider.sendUserOperation({ }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: diff --git a/site/tutorials/transferring-ownership.md b/site/tutorials/transferring-ownership.md index 6c978881bd..8fdf269263 100644 --- a/site/tutorials/transferring-ownership.md +++ b/site/tutorials/transferring-ownership.md @@ -49,7 +49,7 @@ const newOwner = "0x..."; // the address of the new owner const hash = LightSmartContractAccount.transferOwnership(provider, newOwner); // [!code focus:99] ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts ::: @@ -94,7 +94,7 @@ const { hash: userOperationHash } = provider.sendUserOperation({ }); ``` -<<< @/snippets/smartAccountClient.ts +<<< @/snippets/aa-core/smartAccountClient.ts :::