Skip to content

Commit 24dbdc0

Browse files
Hot fixes
* hot fix code snippets * fix dev inconsistency
1 parent 47493f3 commit 24dbdc0

File tree

4 files changed

+33
-91
lines changed

4 files changed

+33
-91
lines changed

gator_versioned_docs/version-0.2.0/guides/configure-toolkit.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,11 @@ creating a [redelegation](../concepts/delegation/index.md#delegation-types).
125125
import {
126126
getSmartAccountsEnvironment,
127127
SmartAccountsEnvironment,
128-
} from "@metamask/smart-accounts-kit";
128+
} from "@metamask/smart-accounts-kit";
129+
import { sepolia } from "viem/chains";
129130

130131
// Resolves the SmartAccountsEnvironment for Sepolia
131-
const environment: SmartAccountsEnvironment = getSmartAccountsEnvironment(11155111);
132+
const environment: SmartAccountsEnvironment = getSmartAccountsEnvironment(sepolia.id);
132133
```
133134

134135
### Deploy a custom environment

gator_versioned_docs/version-0.2.0/reference/delegation/index.md

Lines changed: 13 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -20,63 +20,33 @@ Builds an array of caveats.
2020
| Name | Type | Required | Description |
2121
| --- | --- | --- | --- |
2222
| `environment` | `SmartAccountsEnvironment` | Yes | Environment to resolve the smart contracts for the current chain. |
23-
| `config` | `CaveatBuilderConfig` | No | Configuration for `CaveatBuilder`. |
23+
| `config` | `CaveatBuilderConfig` | No | Configuration for `CoreCaveatBuilder`. |
2424

2525
### Example
2626

27-
<Tabs>
28-
<TabItem value ="example.ts">
2927

3028
```ts
31-
import { createCaveatBuilder } from "@metamask/smart-accounts-kit";
32-
import { delegatorSmartAccount } from "./config.ts";
33-
34-
const caveats = createCaveatBuilder(delegatorSmartAccount.environment)
35-
```
36-
37-
</TabItem>
38-
<TabItem value ="config.ts">
39-
40-
```ts
41-
import {
42-
Implementation,
43-
toMetaMaskSmartAccount,
44-
} from "@metamask/smart-accounts-kit";
45-
import { createWalletClient, createPublicClient, http } from "viem";
46-
import { privateKeyToAccount } from "viem/accounts";
47-
import { sepolia as chain } from "viem/chains";
48-
49-
const publicClient = createPublicClient({
50-
chain,
51-
transport: http(),
52-
});
53-
54-
const delegatorAccount = privateKeyToAccount("0x...");
29+
import { createCaveatBuilder } from "@metamask/smart-accounts-kit/utils";
30+
import { getSmartAccountsEnvironment } from "@metamask/smart-accounts-kit";
31+
import { sepolia } from "viem/chains";
5532

56-
export const delegatorSmartAccount = await toMetaMaskSmartAccount({
57-
client: publicClient,
58-
implementation: Implementation.Hybrid,
59-
deployParams: [delegatorAccount.address, [], [], []],
60-
deploySalt: "0x",
61-
signer: { account: delegatorAccount },
62-
});
33+
const environment = getSmartAccountsEnvironment(sepolia.id);
34+
const caveatBuilder = createCaveatBuilder(environment);
6335
```
6436

65-
</TabItem>
66-
</Tabs>
67-
6837
### Allow empty caveats
6938

70-
To create an empty caveat collection, set the `CaveatBuilderConfig.allowEmptyCaveats` to `true`.
39+
To create an empty caveat collection, set the `CaveatBuilderConfig.allowInsecureUnrestrictedDelegation` to `true`.
7140

7241
```ts title="example.ts"
73-
import { createCaveatBuilder } from "@metamask/smart-accounts-kit";
74-
// The config.ts is the same as in the previous example.
75-
import { delegatorSmartAccount } from "./config.ts";
42+
import { createCaveatBuilder } from "@metamask/smart-accounts-kit/utils";
43+
import { getSmartAccountsEnvironment } from "@metamask/smart-accounts-kit";
44+
import { sepolia } from "viem/chains";
7645

77-
const caveats = createCaveatBuilder(delegatorSmartAccount.environment, {
46+
const environment = getSmartAccountsEnvironment(sepolia.id);
47+
const caveatBuilder = createCaveatBuilder(environment, {
7848
// add-next-line
79-
allowEmptyCaveats: true,
49+
allowInsecureUnrestrictedDelegation: true,
8050
});
8151
```
8252

smart-accounts-kit/guides/configure-toolkit.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ You can also configure the [toolkit environment](#optional-configure-the-toolkit
1414

1515
## Prerequisites
1616

17-
[Install and set up the Smart Accounts Kit](../get-started/install.md)
17+
- [Install and set up the Smart Accounts Kit](../get-started/install.md)
1818

1919
## Configure the bundler
2020

@@ -125,10 +125,11 @@ creating a [redelegation](../concepts/delegation/index.md#delegation-types).
125125
import {
126126
getSmartAccountsEnvironment,
127127
SmartAccountsEnvironment,
128-
} from "@metamask/smart-accounts-kit";
128+
} from "@metamask/smart-accounts-kit";
129+
import { sepolia } from "viem/chains";
129130

130131
// Resolves the SmartAccountsEnvironment for Sepolia
131-
const environment: SmartAccountsEnvironment = getSmartAccountsEnvironment(11155111);
132+
const environment: SmartAccountsEnvironment = getSmartAccountsEnvironment(sepolia.id);
132133
```
133134

134135
### Deploy a custom environment

smart-accounts-kit/reference/delegation/index.md

Lines changed: 13 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -20,63 +20,33 @@ Builds an array of caveats.
2020
| Name | Type | Required | Description |
2121
| --- | --- | --- | --- |
2222
| `environment` | `SmartAccountsEnvironment` | Yes | Environment to resolve the smart contracts for the current chain. |
23-
| `config` | `CaveatBuilderConfig` | No | Configuration for `CaveatBuilder`. |
23+
| `config` | `CaveatBuilderConfig` | No | Configuration for `CoreCaveatBuilder`. |
2424

2525
### Example
2626

27-
<Tabs>
28-
<TabItem value ="example.ts">
2927

3028
```ts
31-
import { createCaveatBuilder } from "@metamask/smart-accounts-kit";
32-
import { delegatorSmartAccount } from "./config.ts";
33-
34-
const caveats = createCaveatBuilder(delegatorSmartAccount.environment)
35-
```
36-
37-
</TabItem>
38-
<TabItem value ="config.ts">
39-
40-
```ts
41-
import {
42-
Implementation,
43-
toMetaMaskSmartAccount,
44-
} from "@metamask/smart-accounts-kit";
45-
import { createWalletClient, createPublicClient, http } from "viem";
46-
import { privateKeyToAccount } from "viem/accounts";
47-
import { sepolia as chain } from "viem/chains";
48-
49-
const publicClient = createPublicClient({
50-
chain,
51-
transport: http(),
52-
});
53-
54-
const delegatorAccount = privateKeyToAccount("0x...");
29+
import { createCaveatBuilder } from "@metamask/smart-accounts-kit/utils";
30+
import { getSmartAccountsEnvironment } from "@metamask/smart-accounts-kit";
31+
import { sepolia } from "viem/chains";
5532

56-
export const delegatorSmartAccount = await toMetaMaskSmartAccount({
57-
client: publicClient,
58-
implementation: Implementation.Hybrid,
59-
deployParams: [delegatorAccount.address, [], [], []],
60-
deploySalt: "0x",
61-
signer: { account: delegatorAccount },
62-
});
33+
const environment = getSmartAccountsEnvironment(sepolia.id);
34+
const caveatBuilder = createCaveatBuilder(environment);
6335
```
6436

65-
</TabItem>
66-
</Tabs>
67-
6837
### Allow empty caveats
6938

70-
To create an empty caveat collection, set the `CaveatBuilderConfig.allowEmptyCaveats` to `true`.
39+
To create an empty caveat collection, set the `CaveatBuilderConfig.allowInsecureUnrestrictedDelegation` to `true`.
7140

7241
```ts title="example.ts"
73-
import { createCaveatBuilder } from "@metamask/smart-accounts-kit";
74-
// The config.ts is the same as in the previous example.
75-
import { delegatorSmartAccount } from "./config.ts";
42+
import { createCaveatBuilder } from "@metamask/smart-accounts-kit/utils";
43+
import { getSmartAccountsEnvironment } from "@metamask/smart-accounts-kit";
44+
import { sepolia } from "viem/chains";
7645

77-
const caveats = createCaveatBuilder(delegatorSmartAccount.environment, {
46+
const environment = getSmartAccountsEnvironment(sepolia.id);
47+
const caveatBuilder = createCaveatBuilder(environment, {
7848
// add-next-line
79-
allowEmptyCaveats: true,
49+
allowInsecureUnrestrictedDelegation: true,
8050
});
8151
```
8252

0 commit comments

Comments
 (0)