Skip to content

Commit 27d3ddd

Browse files
udpate getDeleGatorEnvironment docs
1 parent 44437b2 commit 27d3ddd

File tree

11 files changed

+81
-81
lines changed

11 files changed

+81
-81
lines changed

smart-accounts-kit/get-started/smart-account-quickstart/eip7702.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ provides a lightweight and secure way to upgrade an EOA to a smart account.
8989
import {
9090
Implementation,
9191
toMetaMaskSmartAccount,
92-
getDeleGatorEnvironment,
92+
getSmartAccountsEnvironment,
9393
} from "@metamask/smart-accounts-kit";
9494
import { privateKeyToAccount } from "viem/accounts";
9595

96-
const environment = getDeleGatorEnvironment(sepolia.id);
96+
const environment = getSmartAccountsEnvironment(sepolia.id);
9797
const contractAddress = environment.implementations.EIP7702StatelessDeleGatorImpl;
9898

9999
const authorization = await walletClient.signAuthorization({

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Providing a paymaster is optional when configuring your bundler client. However,
5757

5858
## (Optional) Configure the toolkit environment
5959

60-
The toolkit environment (`DeleGatorEnvironment`) defines the contract addresses necessary for interacting with the [Delegation Framework](../concepts/delegation/index.md#delegation-framework) on a specific network.
60+
The toolkit environment (`SmartAccountsEnvironment`) defines the contract addresses necessary for interacting with the [Delegation Framework](../concepts/delegation/index.md#delegation-framework) on a specific network.
6161
It serves several key purposes:
6262

6363
- It provides a centralized configuration for all the contract addresses required by the Delegation Framework.
@@ -74,10 +74,10 @@ If no environment is found for the specified chain, it throws an error.
7474
<TabItem value="example.ts">
7575

7676
```typescript
77-
import { DeleGatorEnvironment } from "@metamask/smart-accounts-kit";
77+
import { SmartAccountsEnvironment } from "@metamask/smart-accounts-kit";
7878
import { delegatorSmartAccount } from "./config.ts";
7979

80-
const environment: DeleGatorEnvironment = delegatorSmartAccount.environment;
80+
const environment: SmartAccountsEnvironment = delegatorSmartAccount.environment;
8181
```
8282

8383
</TabItem>
@@ -117,26 +117,26 @@ export delegatorSmartAccount;
117117
See the changelog of the toolkit version you are using (in the left sidebar) for supported chains.
118118
:::
119119

120-
Alternatively, you can use the [`getDelegatorEnvironment`](../reference/delegation/index.md#getdelegatorenvironment) function to resolve the environment.
120+
Alternatively, you can use the [`getSmartAccountsEnvironment`](../reference/delegation/index.md#getdelegatorenvironment) function to resolve the environment.
121121
This function is especially useful if your delegator is not a smart account when
122122
creating a [redelegation](../concepts/delegation/index.md#delegation-types).
123123

124124
```typescript
125125
import {
126-
getDeleGatorEnvironment,
127-
DeleGatorEnvironment,
126+
getSmartAccountsEnvironment,
127+
SmartAccountsEnvironment,
128128
} from "@metamask/smart-accounts-kit";
129129

130-
// Resolves the DeleGatorEnvironment for Sepolia
131-
const environment: DeleGatorEnvironment = getDelegatorEnvironment(11155111);
130+
// Resolves the SmartAccountsEnvironment for Sepolia
131+
const environment: SmartAccountsEnvironment = getSmartAccountsEnvironment(11155111);
132132
```
133133

134134
### Deploy a custom environment
135135

136136
You can deploy the contracts using any method, but the toolkit provides a convenient [`deployDelegatorEnvironment`](../reference/delegation/index.md#deploydelegatorenvironment) function. This function simplifies deploying the Delegation Framework contracts to your desired EVM chain.
137137

138138
This function requires a Viem [Public Client](https://viem.sh/docs/clients/public), [Wallet Client](https://viem.sh/docs/clients/wallet), and [Chain](https://viem.sh/docs/glossary/types#chain)
139-
to deploy the contracts and resolve the `DeleGatorEnvironment`.
139+
to deploy the contracts and resolve the `SmartAccountsEnvironment`.
140140

141141
Your wallet must have a sufficient native token balance to deploy the contracts.
142142

@@ -208,19 +208,19 @@ Once the contracts are deployed, you can use them to override the environment.
208208
### Override the environment
209209

210210
To override the environment, the toolkit provides an [`overrideDeployedEnvironment`](../reference/delegation/index.md#overridedeployedenvironment) function to resolve
211-
`DeleGatorEnvironment` with specified contracts for the given chain and contract version.
211+
`SmartAccountsEnvironment` with specified contracts for the given chain and contract version.
212212

213213
```typescript
214214
// The config.ts is the same as in the previous example.
215215
import { walletClient, publicClient } from "./config.ts";
216216
import { sepolia as chain } from "viem/chains";
217-
import { DeleGatorEnvironment } from "@metamask/smart-accounts-kit";
217+
import { SmartAccountsEnvironment } from "@metamask/smart-accounts-kit";
218218
import {
219219
overrideDeployedEnvironment,
220220
deployDeleGatorEnvironment
221221
} from "@metamask/smart-accounts-kit";
222222

223-
const environment: DeleGatorEnvironment = await deployDeleGatorEnvironment(
223+
const environment: SmartAccountsEnvironment = await deployDeleGatorEnvironment(
224224
walletClient,
225225
publicClient,
226226
chain
@@ -240,23 +240,23 @@ If you've already deployed the contracts using a different method, you can creat
240240
- import { walletClient, publicClient } from "./config.ts";
241241
- import { sepolia as chain } from "viem/chains";
242242
// remove-end
243-
import { DeleGatorEnvironment } from "@metamask/smart-accounts-kit";
243+
import { SmartAccountsEnvironment } from "@metamask/smart-accounts-kit";
244244
import {
245245
overrideDeployedEnvironment,
246246
// remove-next-line
247247
- deployDeleGatorEnvironment
248248
} from "@metamask/smart-accounts-kit";
249249

250250
// remove-start
251-
- const environment: DeleGatorEnvironment = await deployDeleGatorEnvironment(
251+
- const environment: SmartAccountsEnvironment = await deployDeleGatorEnvironment(
252252
- walletClient,
253253
- publicClient,
254254
- chain
255255
- );
256256
// remove-end
257257

258258
// add-start
259-
+ const environment: DeleGatorEnvironment = {
259+
+ const environment: SmartAccountsEnvironment = {
260260
+ SimpleFactory: "0x124..",
261261
+ // ...
262262
+ implementations: {

smart-accounts-kit/guides/delegation/check-delegation-state.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ const caveatEnforcerClient = createCaveatEnforcerClient({
4848
```typescript
4949
import { sepolia as chain } from 'viem/chains'
5050
import { createPublicClient, http } from 'viem'
51-
import { getDeleGatorEnvironment } from '@metamask/smart-accounts-kit'
51+
import { getSmartAccountsEnvironment } from '@metamask/smart-accounts-kit'
5252

53-
export const environment = getDeleGatorEnvironment(chain.id)
53+
export const environment = getSmartAccountsEnvironment(chain.id)
5454

5555
export const publicClient = createPublicClient({
5656
chain,

smart-accounts-kit/guides/delegation/disable-delegation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ const userOperationHash = await bundlerClient.sendUserOperation({
6666
import { sepolia as chain } from 'viem/chains'
6767
import { createPublicClient, http, parseEther } from 'viem'
6868
import { createBundlerClient } from 'viem/account-abstraction'
69-
import { getDeleGatorEnvironment, createDelegation } from '@metamask/smart-accounts-kit'
69+
import { getSmartAccountsEnvironment, createDelegation } from '@metamask/smart-accounts-kit'
7070

71-
export const environment = getDeleGatorEnvironment(chain.id)
71+
export const environment = getSmartAccountsEnvironment(chain.id)
7272

7373
const currentTime = Math.floor(Date.now() / 1000)
7474

smart-accounts-kit/guides/delegation/execute-on-smart-accounts-behalf.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ const userOperationHash = await bundlerClient.sendUserOperation({
218218
<TabItem value="Redeem with an EOA">
219219

220220
```typescript
221-
import { createExecution, getDeleGatorEnvironment, ExecutionMode } from "@metamask/smart-accounts-kit"
221+
import { createExecution, getSmartAccountsEnvironment, ExecutionMode } from "@metamask/smart-accounts-kit"
222222
import { DelegationManager } from "@metamask/smart-accounts-kit/contracts"
223223
import { zeroAddress } from "viem"
224224
import { callData } from "./config.ts"
@@ -237,7 +237,7 @@ const redeemDelegationCalldata = DelegationManager.encode.redeemDelegations({
237237
});
238238

239239
const transactionHash = await delegateWalletClient.sendTransaction({
240-
to: getDeleGatorEnvironment(chain.id).DelegationManager,
240+
to: getSmartAccountsEnvironment(chain.id).DelegationManager,
241241
data: redeemDelegationCalldata,
242242
chain,
243243
})

smart-accounts-kit/guides/erc7715/execute-on-metamask-users-behalf.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ ERC-7710 delegation is one of the core features supported only by MetaMask Smart
110110
:::
111111

112112
```typescript
113-
import { getDeleGatorEnvironment } from "@metamask/smart-accounts-kit";
113+
import { getSmartAccountsEnvironment } from "@metamask/smart-accounts-kit";
114114
import { sepolia as chain } from "viem/chains";
115115

116116
const addresses = await walletClient.requestAddresses();
@@ -128,7 +128,7 @@ if (code) {
128128
// You need to remove the first 8 characters (0xef0100) to get the delegator address.
129129
const delegatorAddress = `0x${code.substring(8)}`;
130130

131-
const statelessDelegatorAddress = getDeleGatorEnvironment(chain.id)
131+
const statelessDelegatorAddress = getSmartAccountsEnvironment(chain.id)
132132
.implementations
133133
.EIP7702StatelessDeleGatorImpl;
134134

smart-accounts-kit/reference/delegation/caveat-enforcer-client.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ delegation, and read the required state.
2222
| Name | Type | Required | Description |
2323
| ------------- | ---------------------- | -------- | ----------- |
2424
| `client` | `Client` | Yes | The Viem Client to interact with the caveat enforcer contracts and read their state. |
25-
| `environment` | `DeleGatorEnvironment` | Yes | Environment to resolve the smart contracts for the current chain. |
25+
| `environment` | `SmartAccountsEnvironment` | Yes | Environment to resolve the smart contracts for the current chain. |
2626

2727
### Example
2828

@@ -45,9 +45,9 @@ const caveatEnforcerClient = createCaveatEnforcerClient({
4545
```typescript
4646
import { sepolia as chain } from 'viem/chains'
4747
import { createPublicClient, http } from 'viem'
48-
import { getDeleGatorEnvironment } from '@metamask/smart-accounts-kit'
48+
import { getSmartAccountsEnvironment } from '@metamask/smart-accounts-kit'
4949

50-
export const environment = getDeleGatorEnvironment(chain.id)
50+
export const environment = getSmartAccountsEnvironment(chain.id)
5151

5252
export const publicClient = createPublicClient({
5353
chain,
@@ -88,9 +88,9 @@ const { availableAmount } = await caveatEnforcerClient.getErc20PeriodTransferEnf
8888
```typescript
8989
import { createDelegation } from '@metamask/smart-accounts-kit'
9090
import { sepolia as chain } from 'viem/chains'
91-
import { getDeleGatorEnvironment } from '@metamask/smart-accounts-kit'
91+
import { getSmartAccountsEnvironment } from '@metamask/smart-accounts-kit'
9292

93-
const environment = getDeleGatorEnvironment(chain.id)
93+
const environment = getSmartAccountsEnvironment(chain.id)
9494

9595
// Since current time is in seconds, we need to convert milliseconds to seconds.
9696
const startDate = Math.floor(Date.now() / 1000)
@@ -142,10 +142,10 @@ const { availableAmount } = await caveatEnforcerClient.getErc20StreamingEnforcer
142142
```typescript
143143
import { createDelegation } from '@metamask/smart-accounts-kit'
144144
import { sepolia as chain } from 'viem/chains'
145-
import { getDeleGatorEnvironment } from '@metamask/smart-accounts-kit'
145+
import { getSmartAccountsEnvironment } from '@metamask/smart-accounts-kit'
146146
import { parseUnits } from 'viem'
147147

148-
const environment = getDeleGatorEnvironment(chain.id)
148+
const environment = getSmartAccountsEnvironment(chain.id)
149149

150150
// Since current time is in seconds, we need to convert milliseconds to seconds.
151151
const startTime = Math.floor(Date.now() / 1000)
@@ -199,9 +199,9 @@ const { availableAmount } = await caveatEnforcerClient.getNativeTokenPeriodTrans
199199
import { createDelegation } from '@metamask/smart-accounts-kit'
200200
import { sepolia as chain } from 'viem/chains'
201201
import { parseEther } from 'viem'
202-
import { getDeleGatorEnvironment } from '@metamask/smart-accounts-kit'
202+
import { getSmartAccountsEnvironment } from '@metamask/smart-accounts-kit'
203203

204-
const environment = getDeleGatorEnvironment(chain.id)
204+
const environment = getSmartAccountsEnvironment(chain.id)
205205

206206
// Since current time is in seconds, we need to convert milliseconds to seconds.
207207
const startDate = Math.floor(Date.now() / 1000)
@@ -252,9 +252,9 @@ const { availableAmount } = await caveatEnforcerClient.getNativeTokenStreamingEn
252252
```typescript
253253
import { createDelegation } from '@metamask/smart-accounts-kit'
254254
import { sepolia as chain } from 'viem/chains'
255-
import { getDeleGatorEnvironment } from '@metamask/smart-accounts-kit'
255+
import { getSmartAccountsEnvironment } from '@metamask/smart-accounts-kit'
256256

257-
const environment = getDeleGatorEnvironment(chain.id)
257+
const environment = getSmartAccountsEnvironment(chain.id)
258258

259259
// Since current time is in seconds, we need to convert milliseconds to seconds.
260260
const startTime = Math.floor(Date.now() / 1000)
@@ -311,12 +311,12 @@ const { availableAmount } = await caveatEnforcerClient.getMultiTokenPeriodEnforc
311311
<TabItem value="config.ts">
312312
313313
```typescript
314-
import { createDelegation, getDeleGatorEnvironment, ROOT_AUTHORITY } from '@metamask/smart-accounts-kit'
314+
import { createDelegation, getSmartAccountsEnvironment, ROOT_AUTHORITY } from '@metamask/smart-accounts-kit'
315315
import { createCaveatBuilder } from '@metamask/smart-accounts-kit/utils'
316316
import { sepolia as chain } from 'viem/chains'
317317
import { parseUnits, parseEther } from 'viem'
318318

319-
const environment = getDeleGatorEnvironment(chain.id)
319+
const environment = getSmartAccountsEnvironment(chain.id)
320320
const caveatBuilder = createCaveatBuilder(environment)
321321

322322
// Current time as start date.

0 commit comments

Comments
 (0)