Skip to content

Commit

Permalink
docs: complete the snippets refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
moldy530 committed Feb 1, 2024
1 parent 323f49e commit a45c22a
Show file tree
Hide file tree
Showing 76 changed files with 112 additions and 815 deletions.
4 changes: 3 additions & 1 deletion packages/alchemy/src/client/smartAccountClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -41,7 +42,8 @@ export type AlchemySmartAccountClient_Base<
actions extends SmartAccountClientActions<
chain,
account
> = SmartAccountClientActions<chain, account>
> = SmartAccountClientActions<chain, account> &
AlchemySmartAccountClientActions<account>
> = Prettify<
SmartAccountClient<
transport,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const smartAccountClient = await transferLightAccountOwnership(provider, {
});
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts
:::

## Returns
Expand Down
2 changes: 1 addition & 1 deletion site/packages/aa-accounts/light-account/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ head:

::: code-group

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts
:::

## Returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const encodedTransferOwnershipData =
smartAccountClient.account.encodeTransferOwnership({ newOwner });
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts
:::

## Returns
Expand Down
2 changes: 1 addition & 1 deletion site/packages/aa-accounts/light-account/getOwnerAddress.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { smartAccountClient } from "./smartAccountClient";
const owner = await smartAccountClient.account.getOwnerAddress();
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts
:::

## Returns
Expand Down
2 changes: 1 addition & 1 deletion site/packages/aa-accounts/light-account/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const result = await transferLightAccountOwnership(smartAccountClient, {
});
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts
:::

## Developer Links
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const signedMessageWith6492 = smartAccountClient.signMessageWith6492({
});
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts
:::

## Returns
Expand Down
2 changes: 1 addition & 1 deletion site/packages/aa-accounts/light-account/signTypedData.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const signedTypedData = smartAccountClient.signTypedData({
});
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts
:::

## Returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const signedTypedDataWith6492 = smartAccountClient.signTypedDataWith6492({
});
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts
:::

## Returns
Expand Down
2 changes: 1 addition & 1 deletion site/packages/aa-alchemy/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

:::
2 changes: 1 addition & 1 deletion site/packages/aa-alchemy/light-account-client/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ head:

::: code-group

<<< @/snippets/light-account-alchemy-client.ts
<<< @/snippets/aa-alchemy/light-account-client.ts
:::

## Returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -43,7 +43,7 @@ const providerWithEnhancedApis = smartAccountClient.extend(
);
```

<<< @/snippets/alchemy-smartAccountClient.ts
<<< @/snippets/aa-alchemy/base-client.ts
:::

## Returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const estimates = await client.estimateUserOperationGas(
);
```

<<< @/snippets/bundlerClient.ts
<<< @/snippets/aa-core/bundlerClient.ts
:::

## Returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { client } from "./client";
const entryPoints = await client.getSupportedEntryPoints();
```

<<< @/snippets/bundlerClient.ts
<<< @/snippets/aa-core/bundlerClient.ts
:::

## Returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { client } from "./client";
const uo = await client.getUserOperationByHash("0xUserOperationHash");
```

<<< @/snippets/bundlerClient.ts
<<< @/snippets/aa-core/bundlerClient.ts
:::

## Returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { client } from "./client";
const receipt = await client.getUserOperationReceipt("0xUserOperationHash");
```

<<< @/snippets/bundlerClient.ts
<<< @/snippets/aa-core/bundlerClient.ts
:::

## Returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const hash = await client.sendRawUserOperation(
);
```

<<< @/snippets/bundlerClient.ts
<<< @/snippets/aa-core/bundlerClient.ts
:::

## Returns
Expand Down
2 changes: 1 addition & 1 deletion site/packages/aa-core/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
:::
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const { hash: batchedUoHash } = await smartAccountClient.sendUserOperation({
});
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts
:::

## Returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const uoStruct = await smartAccountClient.buildUserOperationFromTx({
const uoHash = await smartAccountClient.sendUserOperation(uoStruct);
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts
:::

## Returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ console.log(
);
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts
:::

## Returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const { hash: replacedHash } =
await smartAccountClient.dropAndReplaceUserOperation(request);
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts
:::

## Returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { smartAccountClient } from "./smartAccountClient";
const address = await smartAccountClient.getAddress();
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts

:::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { smartAccountClient } from "./smartAccountClient";
smartAccountClient.getUserOperationByHash({ hash: "0xUserOpResultHash" });
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts

:::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { smartAccountClient } from "./smartAccountClient";
smartAccountClient.getUserOperationReceipt({ hash: "0xUserOpResultHash" });
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts

:::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const result = await smartAccountClient.request({
});
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts

:::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const txHash = await smartAccountClient.sendTransaction({
});
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts

:::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const txHash = await smartAccountClient.sendTransactions({requests: [
]});
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts

:::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ smartAccountClient.sendUserOperation({
});
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts
:::

## Returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { smartAccountClient } from "./smartAccountClient";
const signedMessage = await smartAccountClient.signMessage({ message: "msg" });
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts

:::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const signedMessageWith6492 = smartAccountClient.signMessageWith6492({
});
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts

:::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const signedTypedData = smartAccountClient.signTypedData({
});
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts

:::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const signedTypedDataWith6492 = smartAccountClient.signTypedDataWith6492({
});
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts

:::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const txHash = await smartAccountClient.waitForUserOperationTransaction({
});
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts
:::

## Returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ const txHash = await provider.waitForUserOperationTransaction({
});
```

<<< @/snippets/smartAccountClient.ts
<<< @/snippets/aa-core/smartAccountClient.ts

:::
2 changes: 1 addition & 1 deletion site/packages/aa-ethers/account-signer/connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion site/packages/aa-ethers/account-signer/getAddress.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion site/packages/aa-ethers/account-signer/getBundlerClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { signer } from "./ethers-signer";
const client = signer.getBundlerClient();
```

<<< @/snippets/ethers-signer.ts
<<< @/snippets/aa-ethers/ethers-signer.ts
:::

## Returns
Expand Down
2 changes: 1 addition & 1 deletion site/packages/aa-ethers/account-signer/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ const txn = await signer.sendTransaction({
const client = signer.getBundlerClient();
```

<<< @/snippets/ethers-signer.ts
<<< @/snippets/aa-ethers/ethers-signer.ts
:::
2 changes: 1 addition & 1 deletion site/packages/aa-ethers/account-signer/sendTransaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const txHash = await signer.sendTransaction({
});
```

<<< @/snippets/ethers-signer.ts
<<< @/snippets/aa-ethers/ethers-signer.ts
:::

## Returns
Expand Down
2 changes: 1 addition & 1 deletion site/packages/aa-ethers/account-signer/signMessage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit a45c22a

Please sign in to comment.