Skip to content

Commit

Permalink
feat: add 3.1.1 release changes
Browse files Browse the repository at this point in the history
  • Loading branch information
AmanRaj1608 committed Nov 15, 2023
1 parent 3690ee2 commit fc8e5ad
Show file tree
Hide file tree
Showing 15 changed files with 1,225 additions and 900 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"version": "1.0.0",
"private": true,
"dependencies": {
"@biconomy/account": "3.1.0",
"@biconomy/bundler": "3.1.0",
"@biconomy/common": "3.1.0",
"@biconomy/core-types": "3.1.0",
"@biconomy/modules": "3.1.0",
"@biconomy/paymaster": "3.1.0",
"@biconomy/account": "3.1.1",
"@biconomy/bundler": "3.1.1",
"@biconomy/common": "3.1.1",
"@biconomy/core-types": "3.1.1",
"@biconomy/modules": "3.1.1",
"@biconomy/paymaster": "3.1.1",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@mui/icons-material": "^5.11.11",
Expand Down
32 changes: 9 additions & 23 deletions src/components/AA/BatchLiquidity.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import React, { useState } from "react";
import { ethers } from "ethers";
import { makeStyles } from "@mui/styles";
import {
IHybridPaymaster,
PaymasterMode,
SponsorUserOperationDto,
} from "@biconomy/paymaster";
import { PaymasterMode } from "@biconomy/paymaster";
import Button from "../Button";
import { useEthersSigner } from "../../contexts/ethers";
import { useSmartAccountContext } from "../../contexts/SmartAccountContext";
Expand Down Expand Up @@ -59,26 +55,16 @@ const BatchLiquidity: React.FC = () => {
// todo check this for hyphen LP on Mumbai!
txs.push(tx2);

let userOp = await smartAccount.buildUserOp(txs);
const biconomyPaymaster =
smartAccount.paymaster as IHybridPaymaster<SponsorUserOperationDto>;
let paymasterServiceData: SponsorUserOperationDto = {
mode: PaymasterMode.SPONSORED,
};
const paymasterAndDataResponse =
await biconomyPaymaster.getPaymasterAndData(
userOp,
paymasterServiceData
);
userOp.paymasterAndData = paymasterAndDataResponse.paymasterAndData;
let userOp = await smartAccount.buildUserOp(txs, {
paymasterServiceData: {
mode: PaymasterMode.SPONSORED,
},
});
const userOpResponse = await smartAccount.sendUserOp(userOp);
console.log("userOpHash", userOpResponse);
const { receipt } = await userOpResponse.wait(1);
console.log("txHash", receipt.transactionHash);
showSuccessMessage(
`Added batch liquidity ${receipt.transactionHash}`,
receipt.transactionHash
);
const { transactionHash } = await userOpResponse.waitForTxHash();
console.log("txHash", transactionHash);
showSuccessMessage(`Added batch liquidity ${transactionHash}`, transactionHash);
setLoading(false);
} catch (err: any) {
console.error(err);
Expand Down
24 changes: 7 additions & 17 deletions src/components/AA/BatchMintNft.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import React, { useCallback, useEffect, useState } from "react";
import { ethers } from "ethers";
import { makeStyles } from "@mui/styles";
import {
IHybridPaymaster,
PaymasterMode,
SponsorUserOperationDto,
} from "@biconomy/paymaster";
import { PaymasterMode } from "@biconomy/paymaster";

import Button from "../Button";
import { useEthersSigner } from "../../contexts/ethers";
Expand Down Expand Up @@ -59,18 +55,12 @@ const BatchMintNft: React.FC = () => {
data: safeMintTx.data,
};

let userOp = await smartAccount.buildUserOp([tx1, tx1]);
const biconomyPaymaster =
smartAccount.paymaster as IHybridPaymaster<SponsorUserOperationDto>;
let paymasterServiceData: SponsorUserOperationDto = {
mode: PaymasterMode.SPONSORED,
};
const paymasterAndDataResponse =
await biconomyPaymaster.getPaymasterAndData(
userOp,
paymasterServiceData
);
userOp.paymasterAndData = paymasterAndDataResponse.paymasterAndData;
let userOp = await smartAccount.buildUserOp([tx1, tx1], {
paymasterServiceData: {
mode: PaymasterMode.SPONSORED,
},
});

const userOpResponse = await smartAccount.sendUserOp(userOp);
console.log("userOpHash", userOpResponse);
const { receipt } = await userOpResponse.wait(1);
Expand Down
33 changes: 10 additions & 23 deletions src/components/AA/MintErc20.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import React, { useEffect, useState, useCallback } from "react";
import { ethers } from "ethers";
import { makeStyles } from "@mui/styles";
import {
IHybridPaymaster,
PaymasterMode,
SponsorUserOperationDto,
} from "@biconomy/paymaster";
import { PaymasterMode } from "@biconomy/paymaster";

import Button from "../Button";
import { useEthersSigner } from "../../contexts/ethers";
Expand Down Expand Up @@ -58,26 +54,17 @@ const MintErc20: React.FC = () => {
to: config.terc20.address,
data: data,
};
let userOp = await smartAccount.buildUserOp([tx]);
const biconomyPaymaster =
smartAccount.paymaster as IHybridPaymaster<SponsorUserOperationDto>;
let paymasterServiceData: SponsorUserOperationDto = {
mode: PaymasterMode.SPONSORED,
};
const paymasterAndDataResponse =
await biconomyPaymaster.getPaymasterAndData(
userOp,
paymasterServiceData
);
userOp.paymasterAndData = paymasterAndDataResponse.paymasterAndData;
let userOp = await smartAccount.buildUserOp([tx], {
paymasterServiceData: {
mode: PaymasterMode.SPONSORED,
},
});

const userOpResponse = await smartAccount.sendUserOp(userOp);
console.log("userOpHash", userOpResponse);
const { receipt } = await userOpResponse.wait(1);
console.log("txHash", receipt.transactionHash);
showSuccessMessage(
`Minted ERC20 ${receipt.transactionHash}`,
receipt.transactionHash
);
const { transactionHash } = await userOpResponse.waitForTxHash();
console.log("txHash", transactionHash);
showSuccessMessage(`Minted ERC20 ${transactionHash}`, transactionHash);
setLoading(false);
await new Promise((resolve) => setTimeout(resolve, 2000));
getBalance();
Expand Down
33 changes: 10 additions & 23 deletions src/components/AA/MintNft.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import React, { useCallback, useEffect, useState } from "react";
import { ethers } from "ethers";
import { makeStyles } from "@mui/styles";
import {
IHybridPaymaster,
PaymasterMode,
SponsorUserOperationDto,
} from "@biconomy/paymaster";
import { PaymasterMode } from "@biconomy/paymaster";

import Button from "../Button";
import { useEthersSigner } from "../../contexts/ethers";
Expand Down Expand Up @@ -59,26 +55,17 @@ const MintNft: React.FC = () => {
data: safeMintTx.data,
};

let userOp = await smartAccount.buildUserOp([tx1]);
const biconomyPaymaster =
smartAccount.paymaster as IHybridPaymaster<SponsorUserOperationDto>;
let paymasterServiceData: SponsorUserOperationDto = {
mode: PaymasterMode.SPONSORED,
};
const paymasterAndDataResponse =
await biconomyPaymaster.getPaymasterAndData(
userOp,
paymasterServiceData
);
userOp.paymasterAndData = paymasterAndDataResponse.paymasterAndData;
let userOp = await smartAccount.buildUserOp([tx1], {
paymasterServiceData: {
mode: PaymasterMode.SPONSORED,
},
});

const userOpResponse = await smartAccount.sendUserOp(userOp);
console.log("userOpHash", userOpResponse);
const { receipt } = await userOpResponse.wait(1);
console.log("txHash", receipt.transactionHash);
showSuccessMessage(
`Minted Nft ${receipt.transactionHash}`,
receipt.transactionHash
);
const { transactionHash } = await userOpResponse.waitForTxHash();
console.log("txHash", transactionHash);
showSuccessMessage(`Minted Nft ${transactionHash}`, transactionHash);
setLoading(false);
await new Promise((resolve) => setTimeout(resolve, 2000));
getNftCount();
Expand Down
16 changes: 0 additions & 16 deletions src/components/Balance/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,6 @@ const Assets: React.FC = () => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

// const FetchImage = async (token: any) => {
// return await fetch(token.logo_url, { method: "HEAD" })
// .then((res) => {
// if (res.ok) {
// return token.logo_url;
// } else {
// return null;
// }
// })
// .catch(
// (err) =>
// // <PaidIcon className={classes.img} />
// null
// );
// };

if (isFetchingBalance || balance.alltokenBalances.length === 0) {
return (
<div className={classes.containerLoader}>
Expand Down
33 changes: 10 additions & 23 deletions src/components/Faucet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ import {
showInfoMessage,
showSuccessMessage,
} from "../../utils";
import {
IHybridPaymaster,
PaymasterMode,
SponsorUserOperationDto,
} from "@biconomy/paymaster";
import { PaymasterMode } from "@biconomy/paymaster";

const Faucet: React.FC = () => {
const classes = useStyles();
Expand All @@ -42,26 +38,17 @@ const Faucet: React.FC = () => {
to: config.faucet.address,
data: faucetTxData.data,
};
let userOp = await smartAccount.buildUserOp([tx1]);
const biconomyPaymaster =
smartAccount.paymaster as IHybridPaymaster<SponsorUserOperationDto>;
let paymasterServiceData: SponsorUserOperationDto = {
mode: PaymasterMode.SPONSORED,
};
const paymasterAndDataResponse =
await biconomyPaymaster.getPaymasterAndData(
userOp,
paymasterServiceData
);
userOp.paymasterAndData = paymasterAndDataResponse.paymasterAndData;
let userOp = await smartAccount.buildUserOp([tx1], {
paymasterServiceData: {
mode: PaymasterMode.SPONSORED,
},
});

const userOpResponse = await smartAccount.sendUserOp(userOp);
console.log("userOpHash", userOpResponse);
const { receipt } = await userOpResponse.wait(1);
console.log("txHash", receipt.transactionHash);
showSuccessMessage(
`Tokens sent ${receipt.transactionHash}`,
receipt.transactionHash
);
const { transactionHash } = await userOpResponse.waitForTxHash();
console.log("txHash", transactionHash);
showSuccessMessage(`Tokens sent ${transactionHash}`, transactionHash);
} catch (error: any) {
console.error(error);
showErrorMessage(error.message);
Expand Down
14 changes: 9 additions & 5 deletions src/components/Forward/BatchLiquidity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ const BatchLiquidity: React.FC = () => {
};
txs.push(tx2);
console.log("Tx array created", txs);
let partialUserOp = await smartAccount.buildUserOp([tx1]);
let partialUserOp = await smartAccount.buildUserOp([tx1], {
paymasterServiceData: {
mode: PaymasterMode.ERC20,
},
});
setEstimatedUserOp(partialUserOp);

const biconomyPaymaster =
Expand Down Expand Up @@ -147,11 +151,11 @@ const BatchLiquidity: React.FC = () => {

const userOpResponse = await smartAccount.sendUserOp(finalUserOp);
console.log("userOpHash", userOpResponse);
const { receipt } = await userOpResponse.wait(1);
console.log("txHash", receipt.transactionHash);
const { transactionHash } = await userOpResponse.waitForTxHash();
console.log("txHash", transactionHash);
showSuccessMessage(
`Batch Add Hyphen Liq ${receipt.transactionHash}`,
receipt.transactionHash
`Batch Add Hyphen Liq ${transactionHash}`,
transactionHash
);
setIsLoading(false);
} catch (err: any) {
Expand Down
15 changes: 8 additions & 7 deletions src/components/Forward/MintNft.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ const MintNftForward: React.FC = () => {
to: config.nft.address,
data: safeMintTx.data,
};
let partialUserOp = await smartAccount.buildUserOp([tx1]);
let partialUserOp = await smartAccount.buildUserOp([tx1], {
paymasterServiceData: {
mode: PaymasterMode.ERC20,
},
});
setEstimatedUserOp(partialUserOp);
const biconomyPaymaster =
smartAccount.paymaster as IHybridPaymaster<SponsorUserOperationDto>;
Expand Down Expand Up @@ -138,12 +142,9 @@ const MintNftForward: React.FC = () => {

const userOpResponse = await smartAccount.sendUserOp(finalUserOp);
console.log("userOpHash", userOpResponse);
const { receipt } = await userOpResponse.wait(1);
console.log("txHash", receipt.transactionHash);
showSuccessMessage(
`Minted Nft ${receipt.transactionHash}`,
receipt.transactionHash
);
const { transactionHash } = await userOpResponse.waitForTxHash();
console.log("txHash", transactionHash);
showSuccessMessage(`Minted Nft ${transactionHash}`, transactionHash);
setIsLoading(false);
} catch (err: any) {
console.error(err);
Expand Down
20 changes: 12 additions & 8 deletions src/components/Modules/CreateBatchRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { useAccount } from "wagmi";
import Button from "../Button";
import { useSmartAccountContext } from "../../contexts/SmartAccountContext";
import { showErrorMessage, showInfoMessage } from "../../utils";
import { showErrorMessage, showSuccessMessage } from "../../utils";
import { defaultAbiCoder } from "ethers/lib/utils";
import { getActionForErrorMessage } from "../../utils/error-utils";
import {
Expand Down Expand Up @@ -157,16 +157,20 @@ const CreateBatchRouter: React.FC = () => {
}
transactionArray.push(tx3);
let partialUserOp = await biconomySmartAccount.buildUserOp(
transactionArray
transactionArray,
{
skipBundlerGasEstimation: false,
}
);

const userOpResponse = await biconomySmartAccount.sendUserOp(
partialUserOp
const userOpResponse = await smartAccount.sendUserOp(partialUserOp);
console.log("userOpHash", userOpResponse);
const { transactionHash } = await userOpResponse.waitForTxHash();
console.log("txHash", transactionHash);
showSuccessMessage(
`Session Created Successfully ${transactionHash}`,
transactionHash
);
console.log(`userOp Hash: ${userOpResponse.userOpHash}`);
const transactionDetails = await userOpResponse.wait();
console.log("txHash", transactionDetails.receipt.transactionHash);
showInfoMessage("Session Created Successfully");

// update the session key //enableModule
/*await sessionRouterModule.updateSessionStatus(
Expand Down
Loading

0 comments on commit fc8e5ad

Please sign in to comment.