Skip to content

Commit

Permalink
Merge branch 'refactor/replace-mumbai' into feature/shrink_package_size
Browse files Browse the repository at this point in the history
  • Loading branch information
joepegler committed Apr 12, 2024
2 parents cb0619e + 23fc41f commit a50a99f
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 33 deletions.
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
E2E_PRIVATE_KEY_ONE=
E2E_PRIVATE_KEY_TWO=
BUNDLER_URL=https://bundler.biconomy.io/api/v2/80001/cJPK7B3ru.dd7f7861-190d-45ic-af80-6877f74b8f44
E2E_BICO_PAYMASTER_KEY_MUMBAI=
BUNDLER_URL=https://bundler.biconomy.io/api/v2/80002/cJPK7B3ru.dd7f7861-190d-45ic-af80-6877f74b8f44
E2E_BICO_PAYMASTER_KEY_AMOY=
E2E_BICO_PAYMASTER_KEY_BASE=
CHAIN_ID=80001
CHAIN_ID=80002
6 changes: 3 additions & 3 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
env:
E2E_PRIVATE_KEY_ONE: ${{ secrets.E2E_PRIVATE_KEY_ONE }}
E2E_PRIVATE_KEY_TWO: ${{ secrets.E2E_PRIVATE_KEY_TWO }}
BUNDLER_URL: https://bundler.biconomy.io/api/v2/80001/cJPK7B3ru.dd7f7861-190d-45ic-af80-6877f74b8f44
E2E_BICO_PAYMASTER_KEY_MUMBAI: ${{ secrets.E2E_BICO_PAYMASTER_KEY_MUMBAI }}
BUNDLER_URL: https://bundler.biconomy.io/api/v2/80002/cJPK7B3ru.dd7f7861-190d-45ic-af80-6877f74b8f44
E2E_BICO_PAYMASTER_KEY_BASE: ${{ secrets.E2E_BICO_PAYMASTER_KEY_BASE }}
CHAIN_ID: 80001
E2E_BICO_PAYMASTER_KEY_AMOY: ${{ secrets.E2E_BICO_PAYMASTER_KEY_AMOY }}
CHAIN_ID: 80002

- name: report coverage
uses: davelosert/vitest-coverage-report-action@v2
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: test
on: push
jobs:
test:
name: test
permissions: write-all
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v3

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Run the tests
run: bun run test:readOnly
env:
E2E_PRIVATE_KEY_ONE: ${{ secrets.E2E_PRIVATE_KEY_ONE }}
E2E_PRIVATE_KEY_TWO: ${{ secrets.E2E_PRIVATE_KEY_TWO }}
BUNDLER_URL: https://bundler.biconomy.io/api/v2/80002/cJPK7B3ru.dd7f7861-190d-45ic-af80-6877f74b8f44
E2E_BICO_PAYMASTER_KEY_BASE: ${{ secrets.E2E_BICO_PAYMASTER_KEY_BASE }}
E2E_BICO_PAYMASTER_KEY_AMOY: ${{ secrets.E2E_BICO_PAYMASTER_KEY_AMOY }}
CHAIN_ID: 80002
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
"build:types": "tsc --project ./tsconfig/tsconfig.types.json && tsc-alias -p ./tsconfig/tsconfig.types.json",
"clean": "rimraf ./dist/_esm ./dist/_cjs ./dist/_types ./dist/tsconfig",
"test": "vitest dev -c ./tests/vitest.config.ts",
"test:watch": "bun run test --watch",
"test:readOnly": "bun run test read",
"test:readOnly:watch": "bun run test:readOnly --watch",
"test:ci": "CI=true vitest -c ./tests/vitest.config.ts --coverage",
"size": "size-limit",
"docs": "typedoc --tsconfig ./tsconfig/tsconfig.esm.json",
Expand Down
36 changes: 18 additions & 18 deletions src/account/BiconomySmartAccountV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,11 @@ export class BiconomySmartAccountV2 extends BaseSmartContractAccount {
* import { createClient } from "viem"
* import { createSmartAccountClient, BiconomySmartAccountV2 } from "@biconomy/account"
* import { createWalletClient, http } from "viem";
* import { polygonMumbai } from "viem/chains";
* import { polygonAmoy } from "viem/chains";
*
* const signer = createWalletClient({
* account,
* chain: polygonMumbai,
* chain: polygonAmoy,
* transport: http(),
* });
*
Expand Down Expand Up @@ -356,11 +356,11 @@ export class BiconomySmartAccountV2 extends BaseSmartContractAccount {
* import { createClient } from "viem"
* import { createSmartAccountClient } from "@biconomy/account"
* import { createWalletClient, http } from "viem";
* import { polygonMumbai } from "viem/chains";
* import { polygonAmoy } from "viem/chains";
*
* const signer = createWalletClient({
* account,
* chain: polygonMumbai,
* chain: polygonAmoy,
* transport: http(),
* });
*
Expand All @@ -374,7 +374,7 @@ export class BiconomySmartAccountV2 extends BaseSmartContractAccount {
* // decimals: 6,
* // address: "0xda5289fcaaf71d52a80a254da614a192b693e977",
* // formattedAmount: "1000000",
* // chainId: 80001
* // chainId: 80002
* // }
*
* // or to get the nativeToken balance
Expand All @@ -387,7 +387,7 @@ export class BiconomySmartAccountV2 extends BaseSmartContractAccount {
* // decimals: 18,
* // address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
* // formattedAmount: "1",
* // chainId: 80001
* // chainId: 80002
* // }
*
*/
Expand Down Expand Up @@ -977,11 +977,11 @@ export class BiconomySmartAccountV2 extends BaseSmartContractAccount {
* import { createClient } from "viem"
* import { createSmartAccountClient } from "@biconomy/account"
* import { createWalletClient, http } from "viem";
* import { polygonMumbai } from "viem/chains";
* import { polygonAmoy } from "viem/chains";
*
* const signer = createWalletClient({
* account,
* chain: polygonMumbai,
* chain: polygonAmoy,
* transport: http(),
* });
*
Expand Down Expand Up @@ -1037,11 +1037,11 @@ export class BiconomySmartAccountV2 extends BaseSmartContractAccount {
* import { createClient } from "viem"
* import { createSmartAccountClient } from "@biconomy/account"
* import { createWalletClient, http } from "viem";
* import { polygonMumbai } from "viem/chains";
* import { polygonAmoy } from "viem/chains";
*
* const signer = createWalletClient({
* account,
* chain: polygonMumbai,
* chain: polygonAmoy,
* transport: http(),
* });
*
Expand Down Expand Up @@ -1099,11 +1099,11 @@ export class BiconomySmartAccountV2 extends BaseSmartContractAccount {
* import { createClient } from "viem"
* import { createSmartAccountClient } from "@biconomy/account"
* import { createWalletClient, http } from "viem";
* import { polygonMumbai } from "viem/chains";
* import { polygonAmoy } from "viem/chains";
*
* const signer = createWalletClient({
* account,
* chain: polygonMumbai,
* chain: polygonAmoy,
* transport: http(),
* });
*
Expand Down Expand Up @@ -1298,11 +1298,11 @@ export class BiconomySmartAccountV2 extends BaseSmartContractAccount {
* import { createClient } from "viem"
* import { createSmartAccountClient } from "@biconomy/account"
* import { createWalletClient, http } from "viem";
* import { polygonMumbai } from "viem/chains";
* import { polygonAmoy } from "viem/chains";
*
* const signer = createWalletClient({
* account,
* chain: polygonMumbai,
* chain: polygonAmoy,
* transport: http(),
* });
*
Expand Down Expand Up @@ -1351,11 +1351,11 @@ export class BiconomySmartAccountV2 extends BaseSmartContractAccount {
* import { createClient } from "viem"
* import { createSmartAccountClient } from "@biconomy/account"
* import { createWalletClient, http } from "viem";
* import { polygonMumbai } from "viem/chains";
* import { polygonAmoy } from "viem/chains";
*
* const signer = createWalletClient({
* account,
* chain: polygonMumbai,
* chain: polygonAmoy,
* transport: http(),
* });
*
Expand Down Expand Up @@ -1625,11 +1625,11 @@ export class BiconomySmartAccountV2 extends BaseSmartContractAccount {
* import { createClient } from "viem"
* import { createSmartAccountClient } from "@biconomy/account"
* import { createWalletClient, http } from "viem";
* import { polygonMumbai } from "viem/chains";
* import { polygonAmoy } from "viem/chains";
*
* const signer = createWalletClient({
* account,
* chain: polygonMumbai,
* chain: polygonAmoy,
* transport: http(),
* });
*
Expand Down
2 changes: 1 addition & 1 deletion src/bundler/utils/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const UserOpWaitForTxHashIntervals: { [key in number]?: number } = {
// Note: Default value is 30000 (30sec)
export const UserOpReceiptMaxDurationIntervals: { [key in number]?: number } = {
[1]: 300000,
[80001]: 50000,
[80002]: 50000,
[137]: 60000,
[56]: 50000,
[97]: 50000,
Expand Down
11 changes: 6 additions & 5 deletions tests/account/read.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,15 +410,16 @@ describe("Account: Read", () => {
const feeQuotesResponse = await smartAccount.getTokenFees(transaction, {
paymasterServiceData: { mode: PaymasterMode.ERC20 }
})

expect(feeQuotesResponse.feeQuotes?.length).toBeGreaterThan(1)
}
)

test.concurrent("should not throw and error, chain ids match", async () => {
const mockBundlerUrl =
"https://bundler.biconomy.io/api/v2/80001/nJPK7B3ru.dd7f7861-190d-41bd-af80-6877f74b8f44"
"https://bundler.biconomy.io/api/v2/80002/nJPK7B3ru.dd7f7861-190d-41bd-af80-6877f74b8f44"
const mockPaymasterUrl =
"https://paymaster.biconomy.io/api/v1/80001/-RObQRX9ei.fc6918eb-c582-4417-9d5a-0507b17cfe71"
"https://paymaster.biconomy.io/api/v1/80002/-RObQRX9ei.fc6918eb-c582-4417-9d5a-0507b17cfe71"

const config: BiconomySmartAccountV2Config = {
signer: walletClient,
Expand Down Expand Up @@ -487,10 +488,10 @@ describe("Account: Read", () => {
)

test.concurrent(
"should throw and error, signer has chain id (56) and paymasterUrl has chain id (80001)",
"should throw and error, signer has chain id (56) and paymasterUrl has chain id (80002)",
async () => {
const mockPaymasterUrl =
"https://paymaster.biconomy.io/api/v1/80001/-RObQRX9ei.fc6918eb-c582-4417-9d5a-0507b17cfe71"
"https://paymaster.biconomy.io/api/v1/80002/-RObQRX9ei.fc6918eb-c582-4417-9d5a-0507b17cfe71"

const walletClientBsc = createWalletClient({
account: walletClient.account,
Expand Down Expand Up @@ -701,7 +702,7 @@ describe("Account: Read", () => {
paymasterUrl:
"https://paymaster.biconomy.io/api/v1/1/-RObQRX9ei.fc6918eb-c582-4417-9d5a-0507b17cfe71",
bundlerUrl:
"https://bundler.biconomy.io/api/v2/80001/nJPK7B3ru.dd7f7861-190d-41bd-af80-6877f74b8f44" // mock
"https://bundler.biconomy.io/api/v2/80002/nJPK7B3ru.dd7f7861-190d-41bd-af80-6877f74b8f44" // mock
})

await expect(createAccount).rejects.toThrow()
Expand Down
6 changes: 3 additions & 3 deletions tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const getEnvVars = () => {
"BUNDLER_URL",
"E2E_PRIVATE_KEY_ONE",
"E2E_PRIVATE_KEY_TWO",
"E2E_BICO_PAYMASTER_KEY_MUMBAI",
"E2E_BICO_PAYMASTER_KEY_AMOY",
"E2E_BICO_PAYMASTER_KEY_BASE",
"CHAIN_ID"
]
Expand All @@ -48,8 +48,8 @@ export const getEnvVars = () => {
bundlerUrl: process.env.BUNDLER_URL || "",
privateKey: process.env.E2E_PRIVATE_KEY_ONE || "",
privateKeyTwo: process.env.E2E_PRIVATE_KEY_TWO || "",
paymasterUrl: `https://paymaster.biconomy.io/api/v1/80001/${
process.env.E2E_BICO_PAYMASTER_KEY_MUMBAI || ""
paymasterUrl: `https://paymaster.biconomy.io/api/v1/80002/${
process.env.E2E_BICO_PAYMASTER_KEY_AMOY || ""
}`,
paymasterUrlTwo: `https://paymaster.biconomy.io/api/v1/84532/${
process.env.E2E_BICO_PAYMASTER_KEY_BASE || ""
Expand Down

0 comments on commit a50a99f

Please sign in to comment.