Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ yarn e2etest

# Contributing

In order to make changes to the Delegation Toolkit, ensure that you:
In order to make changes to the Smart Accounts Kit, ensure that you:

- Create a fork of the SDK, and name your branch in a descriptive way - ideally follow the [conventional commits](https://www.conventionalcommits.org) naming standard.
- Create a pull request that describes the changes you are making and follow the [pull request guidelines](https://github.com/MetaMask/contributor-docs/blob/main/docs/pull-requests.md).
- Thoroughly test your code, including unit tests, and (where apprioriate) end-to-end integration tests.
- Follow [secure coding standards](https://github.com/MetaMask/contributor-docs/blob/main/docs/secure-coding-guidelines.md).

To learn more about contributing to the Delegation Toolkit, see the MetaMask [contributing guidelines](https://github.com/MetaMask/contributor-docs).
To learn more about contributing to the Smart Accounts Kit, see the MetaMask [contributing guidelines](https://github.com/MetaMask/contributor-docs).

## Delegation Framework contracts

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This monorepo consists of a suite of tools to enable developers to build using t
- `/delegation-abis` has collection of ABIs corresponding to a specific version of the [Delegation Framework](https://github.com/metamask/delegation-framework).
- `/delegation-deployments` contains deployments for different versions of the [Delegation Framework](https://github.com/metamask/delegation-framework).
- `/smart-accounts-kit` has utilities for creating a [DeleGator SCA](https://github.com/MetaMask/delegation-framework/blob/main/documents/DeleGatorCore.md#metamasks-delegatorcore) know as MetaMask smart account, setting up delegations, and redeeming them.
- `/delegator-e2e` has end-to-end tests for the Delegation Toolkit.
- `/delegator-e2e` has end-to-end tests for the Smart Accounts Kit.
- `./shared` contains basic shared resources for configuring and testing the packages.

## Getting Started
Expand Down
2 changes: 1 addition & 1 deletion packages/7715-permission-types/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Package with types as defined in [ERC-7715](https://eip.tools/eip/7715). This pa

## Installation

This package is normally installed as part of the Delegation Toolkit (@metamask/smart-accounts-kit) which is part of this monorepo.
This package is normally installed as part of the Smart Accounts Kit (@metamask/smart-accounts-kit) which is part of this monorepo.

In order to install this package standalone:

Expand Down
4 changes: 2 additions & 2 deletions packages/delegation-abis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A collection of ABIs for the [Delegation Framework](https://github.com/metamask/

## Installation

This package is normally installed as part of the Delegation Toolkit (@metamask/smart-accounts-kit) which is part of this monorepo.
This package is normally installed as part of the Smart Accounts Kit (@metamask/smart-accounts-kit) which is part of this monorepo.

In order to install this package standalone:

Expand Down Expand Up @@ -51,7 +51,7 @@ git pull

### 2. Generate the ABIs

The `generate.sh` script will build the contracts, outputting ABIs and generate typescript files containing the ABIs. The typescript files are how the ABIs are used within the toolkit.
The `generate.sh` script will build the contracts, outputting ABIs and generate typescript files containing the ABIs. The typescript files are how the ABIs are used within the Smart Accounts Kit.

```bash
./scripts/generate.sh
Expand Down
2 changes: 1 addition & 1 deletion packages/delegation-deployments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A history of [Delegation Framework](https://github.com/metamask/delegation-frame

## Installation

This package is normally installed as part of the Delegation Toolkit (@metamask/smart-accounts-kit) which is part of this monorepo.
This package is normally installed as part of the Smart Accounts Kit (@metamask/smart-accounts-kit) which is part of this monorepo.

In order to install this package standalone:

Expand Down
2 changes: 1 addition & 1 deletion packages/delegator-e2e/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DeleGator e2e

End-to-end integration tests for the Delegation Toolkit. It uses local chain, bundler and paymaster made available via [Pimlico's local testing docker compose](https://docs.pimlico.io/permissionless/how-to/local-testing).
End-to-end integration tests for the Smart Accounts Kit. It uses local chain, bundler and paymaster made available via [Pimlico's local testing docker compose](https://docs.pimlico.io/permissionless/how-to/local-testing).

## Requirements

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ import {
type MetaMaskSmartAccount,
type Delegation,
} from '@metamask/smart-accounts-kit';
import { erc7710WalletActions } from '@metamask/smart-accounts-kit/experimental';
import { erc7710WalletActions } from '@metamask/smart-accounts-kit/actions';
import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts';
import type { Hex } from 'viem';
import {
Address,
createWalletClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import {
createDelegation,
type Delegation,
} from '@metamask/smart-accounts-kit';
import { erc7710BundlerActions } from '@metamask/smart-accounts-kit/experimental';
import { erc7710BundlerActions } from '@metamask/smart-accounts-kit/actions';
import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts';
import {
createClient,
createPublicClient,
Address,
getContract,
Hex,
Expand All @@ -43,7 +43,7 @@ beforeEach(async () => {
const alice = privateKeyToAccount(generatePrivateKey());
const bob = privateKeyToAccount(generatePrivateKey());

const client = createClient({ transport, chain });
const client = createPublicClient({ transport, chain });

aliceSmartAccount = await toMetaMaskSmartAccount({
client,
Expand Down
51 changes: 49 additions & 2 deletions packages/smart-accounts-kit/src/actions/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
/* eslint-disable */
// experimental actions will be moved here once they have stabilized
import type { Client, WalletClient } from 'viem';
import type { BundlerClient } from 'viem/account-abstraction';

import type {
SendTransactionWithDelegationParameters,
SendUserOperationWithDelegationParameters,
} from './erc7710RedeemDelegationAction';
import {
sendTransactionWithDelegationAction,
sendUserOperationWithDelegationAction,
} from './erc7710RedeemDelegationAction';
import { erc7715RequestExecutionPermissionsAction } from './erc7715RequestExecutionPermissionsAction';
import type {
MetaMaskExtensionClient,
RequestExecutionPermissionsParameters,
} from './erc7715RequestExecutionPermissionsAction';

export {
// Individual action functions
Expand Down Expand Up @@ -33,3 +47,36 @@ export {
type SignUserOperationParameters,
type SignUserOperationReturnType,
} from './signUserOperation';

export {
erc7715RequestExecutionPermissionsAction as requestExecutionPermissions,
type MetaMaskExtensionClient,
type MetaMaskExtensionSchema,
type RequestExecutionPermissionsParameters,
type RequestExecutionPermissionsReturnType,
} from './erc7715RequestExecutionPermissionsAction';

export type { DelegatedCall } from './erc7710RedeemDelegationAction';

export const erc7715ProviderActions = () => (client: Client) => ({
requestExecutionPermissions: async (
parameters: RequestExecutionPermissionsParameters,
) => {
return erc7715RequestExecutionPermissionsAction(
client as MetaMaskExtensionClient,
parameters,
);
},
});

export const erc7710WalletActions = () => (client: WalletClient) => ({
sendTransactionWithDelegation: async (
args: SendTransactionWithDelegationParameters,
) => sendTransactionWithDelegationAction(client, args),
});

export const erc7710BundlerActions = () => (client: Client) => ({
sendUserOperationWithDelegation: async (
args: SendUserOperationWithDelegationParameters,
) => sendUserOperationWithDelegationAction(client as BundlerClient, args),
});
2 changes: 1 addition & 1 deletion packages/smart-accounts-kit/src/encodeCalls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { DelegationManager } from '@metamask/delegation-abis';
import { encodeFunctionData } from 'viem';
import type { Address, Hex } from 'viem';

import type { DelegatedCall } from './actions/erc7710RedeemDelegationAction';
import {
execute,
executeWithMode,
Expand All @@ -11,7 +12,6 @@ import {
createExecution,
encodeExecutionCalldatas,
} from './executions';
import type { DelegatedCall } from './experimental/erc7710RedeemDelegationAction';
import type { Call } from './types';

/**
Expand Down
50 changes: 0 additions & 50 deletions packages/smart-accounts-kit/src/experimental/index.ts
Original file line number Diff line number Diff line change
@@ -1,56 +1,6 @@
import type { Client, WalletClient } from 'viem';
import type { BundlerClient } from 'viem/account-abstraction';

import type {
SendTransactionWithDelegationParameters,
SendUserOperationWithDelegationParameters,
} from './erc7710RedeemDelegationAction';
import {
sendTransactionWithDelegationAction,
sendUserOperationWithDelegationAction,
} from './erc7710RedeemDelegationAction';
import { erc7715RequestExecutionPermissionsAction } from './erc7715RequestExecutionPermissionsAction';
import type {
MetaMaskExtensionClient,
RequestExecutionPermissionsParameters,
} from './erc7715RequestExecutionPermissionsAction';

export type { DelegatedCall } from './erc7710RedeemDelegationAction';

export {
erc7715RequestExecutionPermissionsAction as requestExecutionPermissions,
type MetaMaskExtensionClient,
type MetaMaskExtensionSchema,
type RequestExecutionPermissionsParameters,
type RequestExecutionPermissionsReturnType,
} from './erc7715RequestExecutionPermissionsAction';

export {
DelegationStorageClient,
type DelegationStoreFilter,
type Environment,
type DelegationStorageConfig,
} from './delegationStorage';

export const erc7715ProviderActions = () => (client: Client) => ({
requestExecutionPermissions: async (
parameters: RequestExecutionPermissionsParameters,
) => {
return erc7715RequestExecutionPermissionsAction(
client as MetaMaskExtensionClient,
parameters,
);
},
});

export const erc7710WalletActions = () => (client: WalletClient) => ({
sendTransactionWithDelegation: async (
args: SendTransactionWithDelegationParameters,
) => sendTransactionWithDelegationAction(client, args),
});

export const erc7710BundlerActions = () => (client: Client) => ({
sendUserOperationWithDelegation: async (
args: SendUserOperationWithDelegationParameters,
) => sendUserOperationWithDelegationAction(client as BundlerClient, args),
});
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,17 @@ import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts';
import { sepolia as chain } from 'viem/chains';
import { beforeEach, describe, expect, it } from 'vitest';

import { erc7710BundlerActions, erc7710WalletActions } from '../../src/actions';
import type {
SendTransactionWithDelegationParameters,
SendUserOperationWithDelegationParameters,
} from '../../src/actions/erc7710RedeemDelegationAction';
import { Implementation } from '../../src/constants';
import {
createExecution,
encodeExecutionCalldatas,
ExecutionMode,
} from '../../src/executions';
import {
erc7710BundlerActions,
erc7710WalletActions,
} from '../../src/experimental';
import type {
SendTransactionWithDelegationParameters,
SendUserOperationWithDelegationParameters,
} from '../../src/experimental/erc7710RedeemDelegationAction';
import { overrideDeployedEnvironment } from '../../src/smartAccountsEnvironment';
import { toMetaMaskSmartAccount } from '../../src/toMetaMaskSmartAccount';
import type {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import { createClient, custom } from 'viem';
import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts';
import { beforeEach, describe, expect, it } from 'vitest';

import { erc7715ProviderActions } from '../../src/experimental';
import type { RequestExecutionPermissionsParameters } from '../../src/experimental/erc7715RequestExecutionPermissionsAction';
import { erc7715RequestExecutionPermissionsAction } from '../../src/experimental/erc7715RequestExecutionPermissionsAction';
import { erc7715ProviderActions } from '../../src/actions';
import type { RequestExecutionPermissionsParameters } from '../../src/actions/erc7715RequestExecutionPermissionsAction';
import { erc7715RequestExecutionPermissionsAction } from '../../src/actions/erc7715RequestExecutionPermissionsAction';

describe('erc7715RequestExecutionPermissionsAction', () => {
let alice: Account;
Expand Down
Loading