GithubHelp home page GithubHelp logo

ghadi8 / smart-contract-wallet Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 1.0 1.55 MB

Simple Implementation of Account Abstraction based on eth-infinitism contracts

Solidity 63.46% JavaScript 36.54%

smart-contract-wallet's Introduction

Smart-Contract-Wallet

The Smart Contract Wallet is a simple implementation of Account Abstraction based on eth-infinitism contracts. It allows users to create smart contract wallets and perform transactions using Ether and ERC20 tokens.

Installation

To install the Smart Contract Wallet, follow these steps:

Clone the repository to your local machine. Navigate to the "example-functionality" directory. Run the command "npm install" to install the required dependencies. Run the command "npm run start" to start the server locally on port 3000.

Usage

The Smart Contract Wallet provides the following methods:

getAddress(index)

Creates a smart contract wallet with the specified index.

  • Params: index

Request:

 {"jsonrpc" :"2.0",
 "id": 1,
 "method": "getAddress",
 "params": {
   "index": 0,
        }
}

withdrawETH(index, to, amount)

Withdraws Eth from the specified smart contract wallet and sends it to the specified address.

  • Params: index, to, amount

Request

 {"jsonrpc" :"2.0",
 "id": 1,
 "method": "withdrawETH",
 "params": {
   "index": 0,
   "to": "0x02a33d9Ab48A39D97bcBD5468bc42Fb6E794bd0D",
   "amount": 0.02
        }
}

withdrawERC20(index, to, amount, tokenAddress)

Withdraws ERC20 tokens from the specified smart contract wallet and sends them to the specified address.

  • Params: index, to, amount, tokenAddress

Request

 {"jsonrpc" :"2.0",
 "id": 1,
 "method": "withdrawERC20",
 "params": {
   "index": 0,
   "to": "0x02a33d9Ab48A39D97bcBD5468bc42Fb6E794bd0D",
   "amount": 20,
   "tokenAddress": "0xc6fDe3FD2Cc2b173aEC24cc3f267cb3Cd78a26B7"
        }
}

withdrawER721(index, to, tokenId, tokenAddress)

Transfers ERC721 token from the specified smart contract wallet and sends them to the specified address.

  • Params: index, to, tokenId, tokenAddress

Request

 {"jsonrpc" :"2.0",
 "id": 1,
 "method": "withdrawERC721",
 "params": {
   "index": 0,
   "to": "0x02a33d9Ab48A39D97bcBD5468bc42Fb6E794bd0D",
   "tokenId": 2,
   "tokenAddress": "0x30CB732aca23104529DB8ce865E7B31C1344B818"
        }
}

withdrawERC1155(index, to, tokenId, amount, tokenAddress)

Transfers ERCC1155 tokens from the specified smart contract wallet and sends them to the specified address.

  • Params: index, to, tokenId, amount, tokenAddress

Request

 {"jsonrpc" :"2.0",
 "id": 1,
 "method": "withdrawERC1155",
 "params": {
   "index": 0,
   "to": "0x02a33d9Ab48A39D97bcBD5468bc42Fb6E794bd0D",
   "tokenId": 2,
   "amount": 2,
   "tokenAddress": "0x30CB732aca23104529DB8ce865E7B31C1344B818"
        }
}

Batch Transactions Implemented but not functional yet due to issue with eth-infinitism/bundler

stackup-wallet/erc-4337-examples#18

TODO: Add Paymaster functionality

smart-contract-wallet's People

Contributors

ghadi8 avatar

Stargazers

 avatar  avatar  avatar kthecoder avatar Gabriel Antony Xaviour avatar JustHadi avatar highpofly.eth avatar Decapinator.eth avatar sfter avatar

Watchers

JustHadi avatar  avatar

Forkers

lwandsyj

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.