alchemyEnhancedApiActions
alchemyEnhancedApiActions
is a decorator that can be used with a AlchemySmartAccountClient
that will extend the client with methods that access the Alchemy Enhanced APIs via the Alchemy SDK.
Note
This method requires an optional dependency on the alchemy-sdk
package, as the input to this method is an Alchemy SDK client.
The Alchemy SDK client must be configured with the same API key and network as the AlchemySmartAccountClient
. This method validates such at runtime.
Additionally, since the Alchemy SDK client does not yet support JWT authentication, an AlchemySmartAccountClient
initialized with JWTs cannot use this method. They must be initialized with an API key or RPC URL.
Usage
import { smartAccountClient } from "./base-client.ts";
import { alchemyEnhancedApiActions } from "@alchemy/aa-alchemy";
const alchemy = new Alchemy();
// use Alchemy Enhanced APIs
const clientWithEnhancedApis = smartAccountClient.extend(
alchemyEnhancedApiActions
);
import { createAlchemySmartAccountClient } from "@alchemy/aa-alchemy";
import { polygonMumbai } from "@alchemy/aa-core";
const chain = polygonMumbai;
export const smartAccountClient = createAlchemySmartAccountClient({
apiKey: "demo",
chain,
});
Returns
AlchemySmartAccountClient
A new instance of an AlchemySmartAccountClient
with the same attributes as the input, now with methods for accessing the Alchemy Enhanced APIs to more efficiently query blockchain data.