Skip to content

Commit

Permalink
🚨 fix lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Aboudjem committed Sep 7, 2023
1 parent 9752192 commit d9cb848
Show file tree
Hide file tree
Showing 96 changed files with 2,184 additions and 2,630 deletions.
24 changes: 13 additions & 11 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
7 changes: 3 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
Expand Down
10 changes: 5 additions & 5 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Please delete options that are not relevant.

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration


**Test Configuration**:
* Firmware version:
* Hardware:
* Toolchain:
* SDK:

- Firmware version:
- Hardware:
- Toolchain:
- SDK:

# Checklist:

Expand Down
4 changes: 1 addition & 3 deletions .nycrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"include": [
"src/**/*.ts"
]
"include": ["src/**/*.ts"]
}
328 changes: 164 additions & 164 deletions LICENSE.md

Large diffs are not rendered by default.

23 changes: 7 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Biconomy SDK

The Biconomy Software Development Kit (SDK) is plug & play toolkit for dApps to make use of ERC4337 Account Abstraction and enable a highly customised one-click experiences for their users. It presents a comprehensive range of solutions, from user onboarding to sustained engagement, managing and deploying smart accounts, dispatching user transactions with gas abtraction of your choice. This SDK functions in a non-custodial fashion, provides a unified solution that enhances the user experience within your dApp.

## Packages

## Packages
### Account

Building and sending UserOperations is a key offering of any toolkit designed for ERC4337. The Biconomy account package stands as an exemplary toolkit in this regard. Meticulously crafted with developers' needs in mind, this package seamlessly integrates the essential features associated with ERC-4337. It simplifies the process of creating and sending UserOperations, thus optimizing the development and management of decentralized applications (dApps).
Expand All @@ -11,39 +12,29 @@ The Biconomy account package achieves this by providing a comprehensive set of m

### Bundler

In the context of (ERC4337), the concept of a bundler plays a central role in the infrastructure. This concept is integral to the operation of account abstraction across any network that utilizes the Ethereum Virtual Machine (EVM).
In the context of (ERC4337), the concept of a bundler plays a central role in the infrastructure. This concept is integral to the operation of account abstraction across any network that utilizes the Ethereum Virtual Machine (EVM).

Bundler infrastructure is designed and implemented in accordance with standardised specifications. This standardisation across all bundlers offers a significant advantage, particularly when it comes to interoperability with various tools and services, such as the Biconomy SDK.


### Paymaster

ERC4337, Account abstraction, introduces the concept of Paymasters. These specialised entities play a pivotal role in revolutionising the traditional gas payment system in EVM transactions. Paymasters, acting as third-party intermediaries, possess the capability to sponsor gas fees for an account, provided specific predefined conditions are satisfied.



## Services

<img width="1076" alt="Screenshot 2022-11-13 at 7 45 04 PM" src="https://user-images.githubusercontent.com/90545960/201531668-b616d0b7-d94a-4ee5-9e4a-709836f8dfc0.png">

1. SDK Backend node - responsible for chain configurations and gas estimation endpoints
2. Indexer
2. Indexer
3. Paymaster Service - used for checking policies and verifying paymaster signing
4. Bundler Node



## Quickstart


https://github.com/bcnmy/sdk-examples/blob/modular-sdk-v3/backend-node/README.md

https://github.com/bcnmy/sdk-examples/blob/modular-sdk-v3/backend-node/README.md

## Resources

https://docs.biconomy.io/docs/overview

https://dashboard.biconomy.io/


https://docs.biconomy.io/docs/overview

https://dashboard.biconomy.io/
30 changes: 7 additions & 23 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://jestjs.io/docs/configuration
*/

import type {Config} from 'jest';
import type { Config } from "jest";

const config: Config = {
// All imported modules in your tests should be mocked automatically
Expand All @@ -22,11 +22,7 @@ const config: Config = {
collectCoverage: false,

// An array of glob patterns indicating a set of files for which coverage information should be collected
collectCoverageFrom: [
"packages/**/*.{js,ts}",
"!packages/**/node_modules/**",
"!packages/**/dist/**"
],
collectCoverageFrom: ["packages/**/*.{js,ts}", "!packages/**/node_modules/**", "!packages/**/dist/**"],

// The directory where Jest should output its coverage files
coverageDirectory: "coverage",
Expand Down Expand Up @@ -79,16 +75,7 @@ const config: Config = {
// ],

// An array of file extensions your modules use
moduleFileExtensions: [
"js",
"mjs",
"cjs",
"jsx",
"ts",
"tsx",
"json",
"node"
],
moduleFileExtensions: ["js", "mjs", "cjs", "jsx", "ts", "tsx", "json", "node"],

// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
// moduleNameMapper: {},
Expand All @@ -103,7 +90,7 @@ const config: Config = {
// notifyMode: "failure-change",

// A preset that is used as a base for Jest's configuration
preset: 'ts-jest',
preset: "ts-jest",

// Run tests from one or more projects
// projects: undefined,
Expand All @@ -127,9 +114,7 @@ const config: Config = {
// rootDir: undefined,

// A list of paths to directories that Jest should use to search for files in
roots: [
"<rootDir>/packages/"
],
roots: ["<rootDir>/packages/"],

// Allows you to use a custom runner instead of Jest's default test runner
// runner: "jest-runner",
Expand All @@ -156,7 +141,7 @@ const config: Config = {
// testLocationInResults: false,

// The glob patterns Jest uses to detect test files
testMatch: ['**/*.spec.ts'],
testMatch: ["**/*.spec.ts"],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
// testPathIgnorePatterns: [
Expand All @@ -174,10 +159,9 @@ const config: Config = {

// A map from regular expressions to paths to transformers
transform: {
'^.+\\.tsx?$': 'ts-jest',
"^.+\\.tsx?$": "ts-jest",
},


// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
// transformIgnorePatterns: [
// "/node_modules/",
Expand Down
10 changes: 2 additions & 8 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,5 @@
"conventionalCommits": true
}
},
"ignoreChanges": [
"**/CHANGELOG.md",
"**/node_modules/**",
"**/package.json",
"**/*.md",
"**/perf/**"
]
}
"ignoreChanges": ["**/CHANGELOG.md", "**/node_modules/**", "**/package.json", "**/*.md", "**/perf/**"]
}
25 changes: 6 additions & 19 deletions packages/account/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,27 @@ VERSION bump only

Modular SDK - consists stable version of below updates done in Alphas.



## 3.1.1-alpha.0 (2023-08-02)


### Bug Fixes

VERSION bump only





# 3.1.0-alpha.0 (2023-07-24)


### Bug Fixes

* avoid sending populated values of gas prices when estimating from bundler ([c58c9fc](https://github.com/bcnmy/biconomy-client-sdk/commit/c58c9fc29ee83978e1a90305e839002431db2b7b))



- avoid sending populated values of gas prices when estimating from bundler ([c58c9fc](https://github.com/bcnmy/biconomy-client-sdk/commit/c58c9fc29ee83978e1a90305e839002431db2b7b))

## 3.0.0-alpha.0 (2023-07-12)


### Bug Fixes

* estimation without bundler ([5e49473](https://github.com/bcnmy/biconomy-client-sdk/commit/5e49473e7745c2e87e241731ef8ca1f65ee90388))
* unshift error for batch ([4d090e8](https://github.com/bcnmy/biconomy-client-sdk/commit/4d090e8fbc7e7bcc03805d8dd28c738d5c95dae7))

- estimation without bundler ([5e49473](https://github.com/bcnmy/biconomy-client-sdk/commit/5e49473e7745c2e87e241731ef8ca1f65ee90388))
- unshift error for batch ([4d090e8](https://github.com/bcnmy/biconomy-client-sdk/commit/4d090e8fbc7e7bcc03805d8dd28c738d5c95dae7))

### Features

* get fee quote or data method in biconomy paymaster ([47748a6](https://github.com/bcnmy/biconomy-client-sdk/commit/47748a6384c2b74e1d9be4d570554098e1ac02e7))
* update responses to support calculateGasLimits flag + update interfaces ([55bbd38](https://github.com/bcnmy/biconomy-client-sdk/commit/55bbd38b4ef8acaf8da1d52e36846557b134aba4))
* using hybrid paymaster interface ([5fc56a7](https://github.com/bcnmy/biconomy-client-sdk/commit/5fc56a7db2de4a3f4bb87cd4d75584e79010b206))
- get fee quote or data method in biconomy paymaster ([47748a6](https://github.com/bcnmy/biconomy-client-sdk/commit/47748a6384c2b74e1d9be4d570554098e1ac02e7))
- update responses to support calculateGasLimits flag + update interfaces ([55bbd38](https://github.com/bcnmy/biconomy-client-sdk/commit/55bbd38b4ef8acaf8da1d52e36846557b134aba4))
- using hybrid paymaster interface ([5fc56a7](https://github.com/bcnmy/biconomy-client-sdk/commit/5fc56a7db2de4a3f4bb87cd4d75584e79010b206))
75 changes: 37 additions & 38 deletions packages/account/Readme.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# installation

Using `npm` package manager

```bash
npm i @biconomy/account
npm i @biconomy/account
```

OR

Using `yarn` package manager
Expand All @@ -18,64 +20,61 @@ Building and sending UserOperations is a key offering of any toolkit designed fo

The Biconomy account package achieves this by providing a comprehensive set of methods that enable developers to effortlessly create UserOperations. Combined with the sophisticated backend infrastructure of the Biconomy platform, it ensures efficient and reliable transmission of these operations across EVM networks.


## Smart Account instance configuration

| Key | Description |
| ------------- | ------------- |
| signer | This signer will be used for signing userOps for any transactions you build. You can supply your your EOA wallet signer|
| chainId | This represents the network your smart wallet transactions will be conducted on. Take a look following Link for supported chain id's |
| rpcUrl | This represents the EVM node RPC URL you'll interact with, adjustable according to your needs. We recommend to use some private node url for efficient userOp building|
| paymaster | you can pass same paymaster instance that you have build in previous step. Alternatively, you can skip this if you are not interested in sponsoring transaction using paymaster|
| | Note: if you don't pass the paymaster instance, your smart account will need funds to pay for transaction fees.|
| bundler | You can pass same bundler instance that you have build in previous step. Alternatively, you can skip this if you are only interested in building userOP|

| Key | Description |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| signer | This signer will be used for signing userOps for any transactions you build. You can supply your your EOA wallet signer |
| chainId | This represents the network your smart wallet transactions will be conducted on. Take a look following Link for supported chain id's |
| rpcUrl | This represents the EVM node RPC URL you'll interact with, adjustable according to your needs. We recommend to use some private node url for efficient userOp building |
| paymaster | you can pass same paymaster instance that you have build in previous step. Alternatively, you can skip this if you are not interested in sponsoring transaction using paymaster |
| | Note: if you don't pass the paymaster instance, your smart account will need funds to pay for transaction fees. |
| bundler | You can pass same bundler instance that you have build in previous step. Alternatively, you can skip this if you are only interested in building userOP |

## Example Usage

```typescript
// This is how you create BiconomySmartAccount instance in your dapp's

import { BiconomySmartAccount, BiconomySmartAccountConfig } from "@biconomy/account"
import { BiconomySmartAccount, BiconomySmartAccountConfig } from "@biconomy/account";

// Note that paymaster and bundler are optional. You can choose to create new instances of this later and make account API use
// Note that paymaster and bundler are optional. You can choose to create new instances of this later and make account API use
const biconomySmartAccountConfig: BiconomySmartAccountConfig = {
signer: wallet.getSigner(),
chainId: ChainId.POLYGON_MAINNET,
rpcUrl: '',
// paymaster: paymaster, // check the README.md section of Paymaster package
// bundler: bundler, // check the README.md section of Bundler package
}
signer: wallet.getSigner(),
chainId: ChainId.POLYGON_MAINNET,
rpcUrl: "",
// paymaster: paymaster, // check the README.md section of Paymaster package
// bundler: bundler, // check the README.md section of Bundler package
};

const biconomyAccount = new BiconomySmartAccount(biconomySmartAccountConfig)
const biconomySmartAccount = await biconomyAccount.init()
const biconomyAccount = new BiconomySmartAccount(biconomySmartAccountConfig);
const biconomySmartAccount = await biconomyAccount.init();

// native token transfer
// you can create any sort of transaction following same structure
// you can create any sort of transaction following same structure
const transaction = {
to: '0x85B51B068bF0fefFEFD817882a14f6F5BDF7fF2E',
data: '0x',
value: ethers.utils.parseEther('0.1'),
}
to: "0x85B51B068bF0fefFEFD817882a14f6F5BDF7fF2E",
data: "0x",
value: ethers.utils.parseEther("0.1"),
};

// building partialUserOp
const partialUserOp = await biconomySmartAccount.buildUserOp([transaction])
const partialUserOp = await biconomySmartAccount.buildUserOp([transaction]);

// using the paymaster package one can populate paymasterAndData to partial userOp. by default it is '0x'


```

```typescript
const userOpResponse = await smartAccount.sendUserOp(partialUserOp)
const transactionDetails = await userOpResponse.wait()
console.log("transaction details below")
console.log(transactionDetails)
const userOpResponse = await smartAccount.sendUserOp(partialUserOp);
const transactionDetails = await userOpResponse.wait();
console.log("transaction details below");
console.log(transactionDetails);
```
Finally we send the userOp and save the value to a variable named userOpResponse and get the transactionDetails after calling ```typescript userOpResponse.wait()```

Finally we send the userOp and save the value to a variable named userOpResponse and get the transactionDetails after calling `typescript userOpResponse.wait()`

```typescript
const transactionDetails = await userOpResponse.wait()
console.log("transaction details below")
console.log(transactionDetails)
```
const transactionDetails = await userOpResponse.wait();
console.log("transaction details below");
console.log(transactionDetails);
```
Loading

0 comments on commit d9cb848

Please sign in to comment.