# @actalink/snap

> Metamask Snap powered by in-house Acta SDK

Latest version **0.1.23** (published 2024-03-07) · (MIT-0 OR Apache-2.0) license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @actalink/snap
pnpm add @actalink/snap
yarn add @actalink/snap
bun add @actalink/snap
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.23 |
| Published | 2024-03-07 |
| First published | 2024-01-26 |
| Weekly downloads | 0 |
| License | (MIT-0 OR Apache-2.0) |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=18.0.0 |
| Dependencies | 16 |
| Unpacked size | 11.1 MB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | iamyxsh, 0mkar |
| Keywords | metamask, snap, keyring, account, actalink, acta sdk |

## Links

- npm: https://www.npmjs.com/package/@actalink/snap
- Repository: https://github.com/actalink/acta-snap
- Homepage: https://github.com/actalink/acta-snap/packages/snap
- Issues: https://github.com/actalink/acta-snap/issues
- npm.io page: https://npm.io/package/@actalink/snap

## Dependencies (16)

- [uuid](https://npm.io/package/uuid.md) ^9.0.0
- [dotenv](https://npm.io/package/dotenv.md) ^16.3.1
- [ethers](https://npm.io/package/ethers.md) ^6.10.0
- [@actalink/sdk](https://npm.io/package/@actalink/sdk.md) ^0.0.13
- [@ethereumjs/tx](https://npm.io/package/@ethereumjs/tx.md) ^4.1.2
- [@metamask/utils](https://npm.io/package/@metamask/utils.md) ^8.1.0
- [@ethereumjs/util](https://npm.io/package/@ethereumjs/util.md) ^8.0.5
- [@actalink/modules](https://npm.io/package/@actalink/modules.md) ^0.0.4
- [@ethereumjs/common](https://npm.io/package/@ethereumjs/common.md) ^3.1.2
- [@metamask/snaps-ui](https://npm.io/package/@metamask/snaps-ui.md) ^3.1.0
- [@actalink/contracts](https://npm.io/package/@actalink/contracts.md) ^0.0.3
- [@metamask/snaps-sdk](https://npm.io/package/@metamask/snaps-sdk.md) ^2.0.0
- [@metamask/keyring-api](https://npm.io/package/@metamask/keyring-api.md) ^4.0.1
- [@metamask/snaps-types](https://npm.io/package/@metamask/snaps-types.md) ^3.0.0
- [@metamask/eth-sig-util](https://npm.io/package/@metamask/eth-sig-util.md) ^7.0.1
- [@openzeppelin/contracts](https://npm.io/package/@openzeppelin/contracts.md) ^4.2.0

## Recent versions

- 0.1.23 (latest) — 2024-03-07
- 0.1.22 — 2024-03-06
- 0.1.20 — 2024-02-22
- 0.1.18 — 2024-02-12
- 0.1.17 — 2024-02-08
- 0.1.15 — 2024-02-06
- 0.1.14 — 2024-02-06
- 0.1.12 — 2024-02-06
- 0.1.10 — 2024-02-05
- 0.1.9 — 2024-02-05
- 0.1.7 — 2024-02-02
- 0.1.5 — 2024-02-01
- 0.1.4 — 2024-02-01
- 0.1.3 — 2024-01-29
- 0.1.0 — 2024-01-26

## README

# Acta Snap

Welcome to the MetaMask Snap integration for Acta SDK. This Snap empowers users to harness the full potential of their smart wallet payments by seamlessly integrating the Acta SDK into the MetaMask extension.

- [x] Create Smart Wallet from your EOA and load it to Metamask using Acta SDK
- [x] Send ERC20 tokens from your EOA via your Smart Wallet
- [x] Scheduled payments using Smart Wallet

## ⚡️ Features

### 🚀 Smart Wallet Creation

Utilize Acta Snap to effortlessly create and load smart wallets into MetaMask Keyring API, seamlessly integrating them as regular MetaMask accounts labeled with Snaps Beta. These off-chain smart wallets incur no gas fees during creation, transitioning to on-chain upon the completion of the first transaction. Enjoy a streamlined and cost-effective onboarding experience with Acta Snap.

![App Screenshot](https://via.placeholder.com/468x300?text=App+Screenshot+Here)

### 🤑 Send Payments via Smart Wallet

Send ERC20 tokens using your smart wallet. Steps to achieve this :-

- Give allowance to the smart wallet address generated
- Connect your wallet
- Sign the message

![App Screenshot](https://via.placeholder.com/468x300?text=App+Screenshot+Here)

### ⏰ Send Scheduled Payments via Smart Wallet

Send ERC20 tokens using your smart wallet at requested intervals. Steps to achieve this :-

- Give allowance to the smart wallet address generated
- Connect your wallet
- Give the interval and the numbe of scheduled transactions
- Sign the tx only once and forget

## 📕 Documentation - @actalink/snap

### ⬇️ Installing the snap

To install the snap, you need to attach the follwing code to the button

```javascript
    await window.ethereum.request({
            method: 'wallet_requestSnaps',
            params: {
                [npm:@actalink/snap]: <version number>,
            },
  });
```

### 🌎 Create Smart Wallet

```javascript
    await window.ethereum.request({
        method: 'wallet_invokeSnap',
        params: {
            snapId: "npm:@actalink/snap",
            request: { method: 'snap.createAccount' },
        },
  }))
```

### 💸 Send Erc20 Token

Here, the `tokenAddress` is the address of the ERC20 toke smart contract, `data` is the transaction data generated using `contract.interface.encodeFunctionData` from `ethersjs`.

```javascript
await window.ethereum.request({
  method: 'wallet_invokeSnap',
  params: {
    snapId: 'npm:@actalink/snap',
    request: {
      method: 'snap.transaction',
      params: {
        tokenAddress,
        data,
      },
    },
  },
});
```

### 🕰️ Scheduled Transaction

Here, the `tokenAddress` is the address of the ERC20 toke smart contract, `scheduledData` is the transaction data generated using `contract.interface.encodeFunctionData` from `ethersjs`. The `minutes` filed here is a comma-seperated `uints` for specific intervals, eg. - `[3,2,1]` will execute the first tx after 3 mins from now, and then 2 minutes from then after 1 minute.

```javascript
await window.ethereum.request({
  method: 'wallet_invokeSnap',
  params: {
    snapId: defaultSnapOrigin,
    request: {
      method: 'snap.scheduledOp',
      params: {
        scheduledTo: tokenAddress,
        scheduledData: data,
        minutes: intervalMinutes,
      },
    },
  },
});
```

## Authors

- [Acta Link](https://www.linkedin.com/company/actalink/)
- [@iamyxsh](https://iamyxsh.dev)

---
_Source: https://npm.io/package/@actalink/snap · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
