Skip to content

Commit 277182e

Browse files
authored
Merge branch 'main' into solana-pk-fixes
2 parents 16ba7f3 + a39a127 commit 277182e

30 files changed

+532
-668
lines changed

docusaurus.config.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ const config = {
105105
SENTRY_KEY: process.env.SENTRY_KEY,
106106
LINEA_ENS_URL: process.env.LINEA_ENS_URL,
107107
SEGMENT_ANALYTICS_KEY: process.env.SEGMENT_ANALYTICS_KEY,
108+
DISCOURSE_API_KEY: process.env.DISCOURSE_API_KEY,
109+
DISCOURSE_API_USERNAME: process.env.DISCOURSE_API_USERNAME,
110+
DISCOURSE_CATEGORY_ID: process.env.DISCOURSE_CATEGORY_ID,
108111
},
109112

110113
trailingSlash: true,
@@ -460,14 +463,14 @@ const config = {
460463
},
461464
{
462465
filename: 'llms-services.txt',
463-
includePatterns: ['services/**/*.{md,mdx}'],
466+
includePatterns: ['services/**/*.md'],
464467
fullContent: false,
465468
title: 'Services documentation',
466469
description: 'Documentation links for MetaMask services',
467470
},
468471
{
469472
filename: 'llms-services-full.txt',
470-
includePatterns: ['services/**/*.{md,mdx}'],
473+
includePatterns: ['services/**/*.md'],
471474
fullContent: true,
472475
title: 'Services documentation',
473476
description: 'Complete documentation for MetaMask services',

gator-sidebar.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ const sidebar = {
3434
'get-started/use-scaffold-eth/advanced-permissions',
3535
],
3636
},
37+
{
38+
type: "link",
39+
label: "LLM context",
40+
href: "https://docs.metamask.io/llms-smart-accounts-kit-full.txt"
41+
},
3742
'get-started/supported-networks',
3843
],
3944
},

gator_versioned_docs/version-0.1.0/guides/advanced-permissions/execute-on-metamask-users-behalf.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ const sessionAccount = privateKeyToAccount("0x...");
9696

9797
### 4. Check the EOA account code
9898

99-
Currently, Advanced Permissions do not support automatically upgrading a MetaMask user's account to a [MetaMask smart account](../../concepts/smart-accounts.md). Therefore, you must
100-
ensure that the user is upgraded to a smart account before requesting Advanced Permissions.
99+
Advanced Permissions support the automatic upgrading of a MetaMask user's account to a [MetaMask smart account](../../concepts/smart-accounts.md),
100+
when using MetaMask Flask version 13.9.0 or later. For earlier versions, you must ensure that the
101+
user is upgraded to a smart account before requesting Advanced Permissions.
101102

102103
If the user has not yet been upgraded, you can handle the upgrade [programmatically](/wallet/how-to/send-transactions/send-batch-transactions/#about-atomic-batch-transactions) or ask the
103104
user to [switch to a smart account manually](https://support.metamask.io/configure/accounts/switch-to-or-revert-from-a-smart-account/#how-to-switch-to-a-metamask-smart-account).
@@ -139,9 +140,11 @@ if (code) {
139140

140141
### 5. Request Advanced Permissions
141142

142-
Request Advanced Permissions from the user. In this example, you'll request an
143-
[ERC-20 periodic permission](use-permissions/erc20-token.md#erc-20-periodic-permission) using the Wallet Client's
144-
[`requestExecutionPermissions`](../../reference/advanced-permissions/wallet-client.md#requestexecutionpermissions) action.
143+
Request Advanced Permissions from the user using the Wallet Client's `requestExecutionPermissions` action.
144+
In this example, you'll request an
145+
[ERC-20 periodic permission](use-permissions/erc20-token.md#erc-20-periodic-permission).
146+
147+
See the [`requestExecutionPermissions`](../../reference/advanced-permissions/wallet-client.md#requestexecutionpermissions) API reference for more information.
145148

146149
```typescript
147150
import { sepolia as chain } from "viem/chains";
@@ -233,8 +236,10 @@ const sessionAccountWalletClient = createWalletClient({
233236
The session account can now redeem the permissions. The redeem transaction is sent to the `DelegationManager` contract, which validates the delegation and executes actions on the user's behalf.
234237

235238
To redeem the permissions, use the client action based on your session account type.
236-
A smart account uses the Bundler Client's [`sendUserOperationWithDelegation`](../../reference/advanced-permissions/bundler-client.md#senduseroperationwithdelegation) action,
237-
and an EOA uses the Wallet Client's [`sendTransactionWithDelegation`](../../reference/advanced-permissions/wallet-client.md#sendtransactionwithdelegation) action:
239+
A smart account uses the Bundler Client's `sendUserOperationWithDelegation` action,
240+
and an EOA uses the Wallet Client's `sendTransactionWithDelegation` action.
241+
242+
See the [`sendUserOperationWithDelegation`](../../reference/advanced-permissions/bundler-client.md#senduseroperationwithdelegation) and [`sendTransactionWithDelegation`](../../reference/advanced-permissions/wallet-client.md#sendtransactionwithdelegation) API reference for more information.
238243

239244
<Tabs>
240245
<TabItem value="Smart account">

gator_versioned_docs/version-0.1.0/guides/advanced-permissions/use-permissions/erc20-token.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ This permission type ensures a per-period limit for ERC-20 token transfers. At t
2424
For example, a user signs an ERC-7715 permission that lets a dapp spend up to 10 USDC on their behalf each day. The dapp can transfer a total of
2525
10 USDC per day; the limit resets at the beginning of the next day.
2626

27+
See the [ERC-20 periodic permission API reference](../../../reference/advanced-permissions/permissions.md#erc-20-periodic-permission) for more information.
28+
2729
<Tabs>
2830
<TabItem value="example.ts">
2931

@@ -92,6 +94,8 @@ configured rate, up to the maximum allowed amount.
9294
For example, a user signs an ERC-7715 permission that allows a dapp to spend 0.1 USDC per second, starting with an initial amount
9395
of 1 USDC, up to a maximum of 2 USDC.
9496

97+
See the [ERC-20 stream permission API reference](../../../reference/advanced-permissions/permissions.md#erc-20-stream-permission) for more information.
98+
9599
<Tabs>
96100
<TabItem value="example.ts">
97101

gator_versioned_docs/version-0.1.0/guides/advanced-permissions/use-permissions/native-token.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ This permission type ensures a per-period limit for native token transfers. At t
2424
For example, a user signs an ERC-7715 permission that lets a dapp spend up to 0.001 ETH on their behalf each day. The dapp can transfer a total of
2525
0.001 USDC per day; the limit resets at the beginning of the next day.
2626

27+
See the [native token periodic permission API reference](../../../reference/advanced-permissions/permissions.md#native-token-periodic-permission) for more information.
28+
2729
<Tabs>
2830
<TabItem value="example.ts">
2931

@@ -89,6 +91,8 @@ configured rate, up to the maximum allowed amount.
8991
For example, a user signs an ERC-7715 permission that allows a dapp to spend 0.0001 ETH per second, starting with an initial amount
9092
of 0.1 ETH, up to a maximum of 1 ETH.
9193

94+
See the [native token stream permission API reference](../../../reference/advanced-permissions/permissions.md#native-token-stream-permission) for more information.
95+
9296
<Tabs>
9397
<TabItem value="example.ts">
9498

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

Lines changed: 62 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,62 @@ export const delegation = createDelegation({
315315
</TabItem>
316316
</Tabs>
317317

318+
319+
## `getDelegationHashOffchain`
320+
321+
Returns the delegation hash.
322+
323+
### Parameters
324+
325+
| Name | Type | Required | Description |
326+
| --- | --- | --- | --- |
327+
| `input` | `Delegation` | Yes | The delegation object to hash. |
328+
329+
### Example
330+
331+
<Tabs>
332+
<TabItem value ="example.ts">
333+
334+
```ts
335+
import { getDelegationHashOffchain } from "@metamask/smart-accounts-kit/utils";
336+
import { delegation } from "./config.ts";
337+
338+
const delegationHash = getDelegationHashOffchain(delegation);
339+
```
340+
341+
</TabItem>
342+
<TabItem value ="config.ts">
343+
344+
```ts
345+
import {
346+
getSmartAccountsEnvironment,
347+
createDelegation,
348+
} from "@metamask/smart-accounts-kit";
349+
import { parseEther } from "viem";
350+
import { sepolia } from "viem/chains";
351+
352+
const environment = getSmartAccountsEnvironment(sepolia.id);
353+
354+
// The address to which the delegation is granted. It can be an EOA address, or
355+
// smart account address.
356+
const delegate = "0x2FcB88EC2359fA635566E66415D31dD381CF5585";
357+
358+
export const delegation = createDelegation({
359+
to: delegate,
360+
// Address that is granting the delegation.
361+
from: "0x7E48cA6b7fe6F3d57fdd0448B03b839958416fC1",
362+
environment,
363+
scope: {
364+
type: "nativeTokenTransferAmount",
365+
// 0.001 ETH in wei format.
366+
maxAmount: parseEther("0.001"),
367+
},
368+
});
369+
```
370+
371+
</TabItem>
372+
</Tabs>
373+
318374
## `getSmartAccountsEnvironment`
319375

320376
Resolves the `SmartAccountsEnvironment` for a chain.
@@ -419,12 +475,13 @@ Signs the delegation and returns the delegation signature.
419475

420476
| Name | Type | Required | Description |
421477
| --- | --- | --- | --- |
422-
| `signer` | `WalletClient` | Yes | [Viem Wallet Client](https://viem.sh/docs/clients/wallet#wallet-client) to sign the delegation. |
478+
| `privateKey` | `Hex` | Yes | The private key to use for signing the delegation. |
423479
| `delegation` | `Omit<Delegation, "signature">` | Yes | The unsigned delegation object to sign. |
424480
| `chainId` | `number` | Yes | The chain ID on which the delegation manager is deployed. |
425481
| `delegationManager` | `0x${string}` | Yes | The address of the Delegation Manager. |
426482
| `name` | `string` | No | The name of the domain of the Delegation Manager. The default is `DelegationManager`. |
427483
| `version` | `string` | No | The version of the domain of the Delegation Manager. The default is `1`. |
484+
| `allowInsecureUnrestrictedDelegation` | `boolean` | No | Whether to allow insecure unrestricted delegation with no caveats. The default is `false`. |
428485

429486
### Example
430487

@@ -433,11 +490,11 @@ Signs the delegation and returns the delegation signature.
433490

434491
```ts
435492
import { signDelegation } from "@metamask/smart-accounts-kit";
436-
import { walletClient, delegation, delegationManager } from "./config.ts";
493+
import { privateKey, delegation, delegationManager } from "./config.ts";
437494
import { sepolia } from "viem/chains";
438495

439496
const signature = signDelegation({
440-
signer: walletClient,
497+
privateKey,
441498
delegation,
442499
chainId: sepolia.id,
443500
delegationManager,
@@ -459,13 +516,8 @@ import { sepolia } from "viem/chains";
459516
const environment = getSmartAccountsEnvironment(sepolia.id);
460517
export const delegationManager = environment.DelegationManager;
461518

462-
const account = privateKeyToAccount(delegateWallet as `0x${string}`);
463-
464-
export const walletClient = createWalletClient({
465-
account,
466-
transport: http(),
467-
chain: sepolia,
468-
});
519+
export const privateKey = `0x12141..`;
520+
const account = privateKeyToAccount(privateKey);
469521

470522
// The address to which the delegation is granted. It can be an EOA address, or
471523
// smart account address.

gator_versioned_sidebars/version-0.11.0-sidebars.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

services/how-to/get-testnet-tokens.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Use [testnet endpoints](../get-started/endpoints.md) during development and init
1818
| Testnet | Faucet URL | Bridge URL |
1919
|-------------|-------------------|-------------------------------|
2020
| [Arbitrum Sepolia](https://docs.arbitrum.io/launch-orbit-chain/how-tos/add-orbit-chain-to-bridge-ui)| [Arbitrum Sepolia faucet](https://faucet.quicknode.com/arbitrum/sepolia)| [Arbitrum bridge](https://bridge.arbitrum.io/)|
21-
| [Avalanche Fuji](https://docs.avax.network/learn/networks/fuji-testnet)| [Avalanche Fuji faucet](https://faucet.avax.network)| [Avalanche bridge](https://bridge.avax.network/)|
21+
| [Avalanche Fuji](https://build.avax.network/academy/avalanche-l1/interchain-messaging/03-avalanche-starter-kit/04-networks)| [Avalanche Fuji faucet](https://faucet.avax.network)| [Avalanche bridge](https://bridge.avax.network/)|
2222
| [Base Sepolia](https://docs.base.org/chain/using-base#metamask-1)| [Base Sepolia faucet](https://faucet.quicknode.com/base/sepolia)| [Base bridge](https://bridge.base.org/deposit)|
2323
| [Blast Sepolia](https://docs.blast.io/using-blast)| [Blast Sepolia faucet](https://faucet.quicknode.com/blast/sepolia)| |
2424
| [Binance Smart Chain (BSC) Sepolia](https://academy.binance.com/en/articles/connecting-metamask-to-binance-smart-chain)| [BSC Sepolia faucet](https://www.bnbchain.org/en/testnet-faucet)| [BSC bridge](https://www.bnbchain.org/en/bnb-chain-bridge)|

services/reference/avalanche-c-chain/index.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,21 @@ Calls to the network are routed to [partner infrastructure providers](#partners-
1515

1616
:::
1717

18-
Avalanche is a Proof of Stake (PoS), layer 1 platform that features 3 built-in blockchains:
19-
- [Contract Chain (C-Chain)](https://docs.avax.network/learn/primary-network#c-chain)
20-
- [Exchange Chain (X-Chain)](https://docs.avax.network/learn/primary-network#x-chain)
21-
- [Platform Chain (P-Chain)](https://docs.avax.network/learn/primary-network#p-chain)
18+
Avalanche is a Proof of Stake (PoS), layer 1 platform that features 3 built-in blockchains:
19+
- [Contract Chain (C-Chain)](https://build.avax.network/docs/primary-network#c-chain-contract-chain)
20+
- [Exchange Chain (X-Chain)](https://build.avax.network/docs/primary-network#x-chain-exchange-chain)
21+
- [Platform Chain (P-Chain)](https://build.avax.network/docs/primary-network#p-chain-platform-chain)
2222

2323
Infura provides access to the C-Chain only.
2424

25-
The C-Chain supports the Ethereum Virtual Machine (EVM), allowing Ethereum developers to deploy Solidity
26-
smart contract dapps onto the C-Chain. Dapps can run on both Avalanche and Ethereum. Avalanche
27-
Platform's C-Chain is EVM-compatible, but it is not identical.
25+
The C-Chain supports the Ethereum Virtual Machine (EVM), allowing Ethereum developers to deploy Solidity
26+
smart contract dapps onto the C-Chain. Dapps can run on both Avalanche and Ethereum. Avalanche
27+
Platform's C-Chain is EVM-compatible, but it is not identical.
2828

2929
:::info See also
3030

31-
- View the [official Avalanche C-Chain documentation](https://docs.avax.network/dapps)
31+
- View the [official Avalanche C-Chain documentation](https://build.avax.network/)
3232
for more information about building on the Avalanche C-Chain.
33-
- View the [differences between developing on Ethereum versus Avalanche C-Chain](https://docs.avax.network/dapps/end-to-end/launch-ethereum-dapp#gotchas-and-things-to-look-out-for).
3433

3534
:::
3635

smart-accounts-kit/experimental/_category_.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)