Skip to content

Commit

Permalink
0.0.4-beta release (#22)
Browse files Browse the repository at this point in the history
* tests and safe deploy fun

* internal functions mocking

* tests updated

* Signer fix and biconomy get wallets function (#20)

* signer constructor requirement removed

* biconomy get all wallets function added

* types added for multiple params

* testing workflow added

* Sdk bug fixes (#21)

* nft tokenId added

* types file name change

* readme update

* nft transfer gasless updated

* package version changes

---------

Co-authored-by: talhamalik883 <talhamalik883@gmail.com>
  • Loading branch information
anshulforyou and talhamalik883 authored Nov 20, 2023
1 parent 9d15c2e commit cf2cd57
Show file tree
Hide file tree
Showing 19 changed files with 5,906 additions and 7,712 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: tests

on:
push:
branches: [main, staging, develop]
pull_request:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 18.18.2

- name: Install Dependencies
run: npm install

- name: Run Tests
run: npm test
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ src
.gitattributes
.eslintrc.js
.prettierrc
tests
.github
41 changes: 30 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ npm install ethers@5.7.2 aarc-sdk

## Get the API Key

To use Aarc SDK, an API key is required. Fill out this form to request the API key.
To use Aarc SDK, an API key is required. Fill out [this form](https://rebrand.ly/aarc-dashboard) to get the API Key on your email instantly!

## Initialise the SDK

Expand All @@ -32,9 +32,9 @@ Import and initialise the Aarc SDK in your project.
import { ethers } from "ethers";
import { AarcSDK } from "aarc-sdk";

let aarcSDK = new AarcSDK.default({
let aarcSDK = new AarcSDK({
rpcUrl: rpcUrl,
signer: signer, // the user's ethers.signer object
chainId: chainId,
apiKey: "YOUR_API_KEY",
});

Expand All @@ -49,6 +49,7 @@ Retrieve balances of all tokens in an EOA wallet:

```typescript
let balances = await aarcSDK.fetchBalances(
eoaAddress: string,
tokenAddress: string[] // Optional: Array of specific token addresses
);
```
Expand All @@ -59,12 +60,14 @@ Transfer tokens from EOA to any receiver wallet address:

```typescript
await aarcSDK.executeMigration({
senderSigner: signer, // ethers.signer object
receiverAddress:'RECEIVER_WALLET_ADDRESS',
tokenAndAmount: // Optional. If not passed, the SDK will migrate all the tokens of the wallet
transferTokenDetails: // Optional. If not passed, the SDK will migrate all the tokens of the wallet
[
{
tokenAddress:TOKEN1_ADDRESS,
amount:TOKEN1_AMOUNT // ethers.BigNumber
amount?:TOKEN1_AMOUNT, // ethers.BigNumber in case of erc20 and native token
tokenIds?: string[] // tokenIds for nfts
},
...
]
Expand Down Expand Up @@ -92,12 +95,14 @@ Transfer tokens from EOA to any receiver wallet address without gas fees. Please

```typescript
await aarcSDK.executeMigration({
senderSigner: signer, // ethers.signer object
receiverAddress:RECEIVER_WALLET_ADDRESS,
tokenAndAmount: // Optional. If not passed, the SDK will migrate all the tokens of the wallet
transferTokenDetails: // Optional. If not passed, the SDK will migrate all the tokens of the wallet
[
{
tokenAddress:TOKEN1_ADDRESS,
amount:TOKEN1_AMOUNT // ethers.BigNumber
amount?:TOKEN1_AMOUNT, // ethers.BigNumber in case of erc20 and native token
tokenIds?: string[] // tokenIds for nfts
},
...
],
Expand Down Expand Up @@ -129,24 +134,38 @@ Fetching Existing Safes:

Retrieve a list of all Safe smart wallets associated with the user's EOA:
```typescript
const safes = await aarcSDK.getAllSafes();
const safes = await aarcSDK.getAllSafes(owner: string); // owner's eoaAddress
// This returns an array of Safe wallet addresses
```

Creating a New Safe Wallet:

Generate a new Safe smart wallet. The address returned is a counterfactual address, and the wallet needs to be deployed later. Asset migration can be directed to this address even before deployment.
```typescript
const newSafeAddress = await aarcSDK.generateSafeSCW();
const newSafeAddress = await aarcSDK.generateSafeSCW(
config: {owners: string[], threshold: number},
saltNonce?: number // default value is 0
);
// Returns a counterfactual address for the new Safe wallet
```

### Biconomy Smart Wallet

Fetching Existing Safes:

Retrieve a list of all Biconomy smart wallets associated with the user's EOA:
```typescript
const biconomySWs = await aarcSDK.getAllBiconomySCWs(owner: string); // owner's eoaAddress
// This returns an array of Biconomy wallet addresses
```

Creating a New Biconomy Wallet:

Similar to the Safe wallet, you can create a Biconomy smart wallet. The address provided is also a counterfactual address, requiring later deployment. The migration process can target this address immediately.
```typescript
const newBiconomySCWAddress = await aarcSDK.generateBiconomySCW();
const newBiconomySCWAddress = await aarcSDK.generateBiconomySCW(
signer // wallet owner's ethers.signer object
);
// Returns a counterfactual address for the new Biconomy wallet
```

Expand All @@ -156,4 +175,4 @@ const newBiconomySCWAddress = await aarcSDK.generateBiconomySCW();
This project is licensed under the MIT License - see the [LICENSE](./LICENSE.md) for details.

## Support and Feedback
For support or to share feedback, please schedule a meet here. You can also share your ideas and feedback on the community forum.
For support or to share feedback, please schedule a 15 min catchup [here](https://calendly.com/arihant-aarc/15min). You can also share your ideas and feedback on the [community forum](https://aarc.featurebase.app/).
6 changes: 6 additions & 0 deletions jest.config.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export let preset: string;
export let testEnvironment: string;
export let moduleFileExtensions: string[];
export let transform: {
'^.+\\.(ts|tsx)$': string;
};
10 changes: 10 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// jest.config.js
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
},
};

Loading

0 comments on commit cf2cd57

Please sign in to comment.