Skip to content

Commit

Permalink
Merge pull request #504 from bcnmy/develop
Browse files Browse the repository at this point in the history
chore: release v4.4.4
  • Loading branch information
joepegler authored May 27, 2024
2 parents 743e592 + b969a91 commit 66123c4
Show file tree
Hide file tree
Showing 31 changed files with 5,659 additions and 141 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ BUNDLER_URL=https://bundler.biconomy.io/api/v2/80002/cJPK7B3ru.dd7f7861-190d-45i
E2E_BICO_PAYMASTER_KEY_AMOY=
E2E_BICO_PAYMASTER_KEY_BASE=
CHAIN_ID=80002
CODECOV_TOKEN=
CODECOV_TOKEN=
TESTING=false
1 change: 1 addition & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
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
TESTING: true

- name: report coverage
uses: davelosert/vitest-coverage-report-action@v2
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/size-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ jobs:
- name: Clone repository
uses: actions/checkout@v3

- uses: actions/setup-node@v4
with:
node-version: 18

- name: Set up Bun
uses: oven-sh/setup-bun@v1

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-read.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ jobs:
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
TESTING: true
3 changes: 3 additions & 0 deletions .github/workflows/test-write.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
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
TESTING: true

- name: Run the paymaster tests
run: bun run test:ci -t=Paymaster:Write
Expand All @@ -48,6 +49,7 @@ jobs:
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
TESTING: true

- name: Run the modules tests
run: bun run test:ci -t=Modules:Write
Expand All @@ -58,3 +60,4 @@ jobs:
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
TESTING: true
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,4 @@ dist

docs

tests/sessionStorageData
sessionStorageData
18 changes: 12 additions & 6 deletions .size-limit.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,41 @@
"name": "core (esm)",
"path": "./dist/_esm/index.js",
"limit": "65 kB",
"import": "*"
"import": "*",
"ignore": ["node:fs", "fs"]
},
{
"name": "core (cjs)",
"path": "./dist/_cjs/index.js",
"limit": "65 kB"
"limit": "65 kB",
"ignore": ["node:fs", "fs"]
},
{
"name": "account (tree-shaking)",
"path": "./dist/_esm/index.js",
"limit": "65 kB",
"import": "{ createSmartAccountClient }"
"import": "{ createSmartAccountClient }",
"ignore": ["node:fs", "fs"]
},
{
"name": "bundler (tree-shaking)",
"path": "./dist/_esm/bundler/index.js",
"limit": "5 kB",
"import": "{ createBundler }"
"import": "{ createBundler }",
"ignore": ["node:fs", "fs"]
},
{
"name": "paymaster (tree-shaking)",
"path": "./dist/_esm/paymaster/index.js",
"limit": "5 kB",
"import": "{ createPaymaster }"
"import": "{ createPaymaster }",
"ignore": ["node:fs", "fs"]
},
{
"name": "modules (tree-shaking)",
"path": "./dist/_esm/modules/index.js",
"limit": "60 kB",
"import": "{ createSessionKeyManagerModule }"
"import": "{ createSessionKeyManagerModule }",
"ignore": ["node:fs", "fs"]
}
]
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @biconomy/account

## 4.4.4

### Patch Changes

- Add Support for Custom Chains

## 4.4.3

### Patch Changes

- Abstract away SessionStorageClient and SessionIDInfo

## 4.4.2

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions examples/CREATE_AND_USE_A_BATCH_SESSION.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const smartAccountWithSession = await createSessionSmartAccountClient(
paymasterUrl,
chainId,
},
session,
smartAccountAddress // Storage client, full Session or smartAccount address if using default storage
true // if batching
);

Expand All @@ -122,7 +122,7 @@ const correspondingIndexes = [1, 0]; // The order of the txs from the sessionBat
const batchSessionParams = await getBatchSessionTxParams(
txs,
correspondingIndexes,
session,
smartAccountAddress, // Storage client, full Session or smartAccount address if using default storage
chain
);

Expand Down
2 changes: 1 addition & 1 deletion examples/CREATE_AND_USE_A_SESSION.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const smartAccountWithSession = await createSessionSmartAccountClient(
paymasterUrl,
chainId,
},
session
smartAccountAddress // Storage client, full Session or smartAccount address if using default storage
);

const { wait: mintWait } = await smartAccountWithSession.sendTransaction(
Expand Down
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"sideEffects": false,
"name": "@biconomy/account",
"author": "Biconomy",
"version": "4.4.2",
"version": "4.4.4",
"description": "SDK for Biconomy integration with support for account abstraction, smart accounts, ERC-4337.",
"keywords": [
"erc-7579",
Expand Down Expand Up @@ -46,7 +46,10 @@
"default": "./_cjs/modules/index.js"
}
},
"files": ["dist/*", "README.md"],
"files": [
"dist/*",
"README.md"
],
"scripts": {
"format": "biome format . --write",
"lint": "biome check .",
Expand Down Expand Up @@ -103,7 +106,9 @@
"viem": "^2"
},
"commitlint": {
"extends": ["@commitlint/config-conventional"]
"extends": [
"@commitlint/config-conventional"
]
},
"simple-git-hooks": {
"pre-commit": "bun run format && bun run lint:fix",
Expand Down
2 changes: 1 addition & 1 deletion src/account/BaseSmartContractAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export abstract class BaseSmartContractAccount<
params.entryPointAddress ?? DEFAULT_ENTRYPOINT_ADDRESS

this.rpcProvider = createPublicClient({
chain: params.viemChain ?? getChain(params.chainId),
chain: params.viemChain ?? params.customChain ?? getChain(params.chainId),
transport: http(
params.rpcUrl || getChain(params.chainId).rpcUrls.default.http[0]
)
Expand Down
17 changes: 13 additions & 4 deletions src/account/BiconomySmartAccountV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ export class BiconomySmartAccountV2 extends BaseSmartContractAccount {
...biconomySmartAccountConfig,
chain:
biconomySmartAccountConfig.viemChain ??
biconomySmartAccountConfig.customChain ??
getChain(biconomySmartAccountConfig.chainId),
rpcClient:
biconomySmartAccountConfig.rpcUrl ||
Expand Down Expand Up @@ -199,6 +200,7 @@ export class BiconomySmartAccountV2 extends BaseSmartContractAccount {
this.provider = createPublicClient({
chain:
biconomySmartAccountConfig.viemChain ??
biconomySmartAccountConfig.customChain ??
getChain(biconomySmartAccountConfig.chainId),
transport: http(
biconomySmartAccountConfig.rpcUrl ||
Expand Down Expand Up @@ -283,12 +285,17 @@ export class BiconomySmartAccountV2 extends BaseSmartContractAccount {
if (!chainId) {
throw new Error("chainId required")
}

const bundler: IBundler =
biconomySmartAccountConfig.bundler ??
new Bundler({
// biome-ignore lint/style/noNonNullAssertion: <explanation>
// biome-ignore lint/style/noNonNullAssertion: always required
bundlerUrl: biconomySmartAccountConfig.bundlerUrl!,
chainId
chainId,
customChain:
biconomySmartAccountConfig.viemChain ??
biconomySmartAccountConfig.customChain ??
getChain(chainId)
})
let defaultValidationModule =
biconomySmartAccountConfig.defaultValidationModule
Expand Down Expand Up @@ -882,7 +889,7 @@ export class BiconomySmartAccountV2 extends BaseSmartContractAccount {

// dummy signature depends on the validation module supplied.
async getDummySignatures(_params?: ModuleInfo): Promise<Hex> {
const params = { ..._params, ...(this.sessionData ? this.sessionData : {}) }
const params = { ...(this.sessionData ? this.sessionData : {}), ..._params }
this.isActiveValidationModuleDefined()
return (await this.activeValidationModule.getDummySignature(params)) as Hex
}
Expand Down Expand Up @@ -913,7 +920,7 @@ export class BiconomySmartAccountV2 extends BaseSmartContractAccount {
userOp: Partial<UserOperationStruct>,
_params?: SendUserOpParams
): Promise<UserOperationStruct> {
const params = { ..._params, ...(this.sessionData ? this.sessionData : {}) }
const params = { ...(this.sessionData ? this.sessionData : {}), ..._params }

this.isActiveValidationModuleDefined()
const requiredFields: UserOperationKey[] = [
Expand Down Expand Up @@ -1527,6 +1534,8 @@ export class BiconomySmartAccountV2 extends BaseSmartContractAccount {
/**
* Builds a user operation
*
* This method will also simulate the validation and execution of the user operation, telling the user if the user operation will be successful or not.
*
* - Docs: https://docs.biconomy.io/Account/transactions/userpaid#build-useroperation
*
* @param transactions Array of {@link Transaction} to be sent.
Expand Down
4 changes: 3 additions & 1 deletion src/account/utils/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ export const ERROR_MESSAGES = {
"rpcUrl is required for PrivateKeyAccount signer type, please provide it in the config",
INVALID_SESSION_INDEXES:
"Session indexes and transactions must be of the same length and correspond to each other",
SIGNER_REQUIRED: "Signer is required for creating a smart account"
SIGNER_REQUIRED: "Signer is required for creating a smart account",
UNKNOW_SESSION_ARGUMENTS:
"You have not provided the necessary information to find and use a session"
}

export const NATIVE_TOKEN_ALIAS: Hex =
Expand Down
4 changes: 3 additions & 1 deletion src/account/utils/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,10 @@ export type BiconomySmartAccountV2ConfigBaseProps = {
scanForUpgradedAccountsFromV1?: boolean
/** the index of SA the EOA have generated and till which indexes the upgraded SA should scan */
maxIndexForScan?: number
/** Can be used to optionally override the chain with a custom chain if it doesn't already exist in viems list of supported chains */
/** Can be used to optionally override the chain with a custom chain if it doesn't already exist in viems list of supported chains. Alias of customChain */
viemChain?: Chain
/** Can be used to optionally override the chain with a custom chain if it doesn't already exist in viems list of supported chain. Alias of viemChain */
customChain?: Chain
/** The initial code to be used for the smart account */
initCode?: Hex
/** Used for session key manager module */
Expand Down
Loading

0 comments on commit 66123c4

Please sign in to comment.