Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release v4.5.4 #541

Merged
merged 3 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ E2E_BICO_PAYMASTER_KEY_BASE=
CHAIN_ID=80002
CODECOV_TOKEN=
TESTING=false
SILENCE_LABS_NPM_TOKEN=npm_XXX
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ jobs:

- name: Build
uses: ./.github/actions/build
env:
SILENCE_LABS_NPM_TOKEN: ${{ secrets.SILENCE_LABS_NPM_TOKEN }}
8 changes: 5 additions & 3 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ jobs:

- name: Install dependencies
uses: ./.github/actions/install-dependencies
env:
SILENCE_LABS_NPM_TOKEN: ${{ secrets.SILENCE_LABS_NPM_TOKEN }}

- name: Run the tests
run: bun run test:coverage
- name: Run the account tests
run: bun run test:ci -t=Account:Write
env:
E2E_PRIVATE_KEY_ONE: ${{ secrets.E2E_PRIVATE_KEY_ONE }}
E2E_PRIVATE_KEY_TWO: ${{ secrets.E2E_PRIVATE_KEY_TWO }}
Expand All @@ -28,7 +30,7 @@ jobs:
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
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:

- name: Install dependencies
uses: ./.github/actions/install-dependencies
env:
SILENCE_LABS_NPM_TOKEN: ${{ secrets.SILENCE_LABS_NPM_TOKEN }}

- name: Set remote url
run: git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/bcnmy/biconomy-client-sdk.git
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:

- name: Install dependencies
uses: ./.github/actions/install-dependencies
env:
SILENCE_LABS_NPM_TOKEN: ${{ secrets.SILENCE_LABS_NPM_TOKEN }}

- name: Use commitlint to check PR title
run: echo "${{ github.event.pull_request.title }}" | bun commitlint
10 changes: 5 additions & 5 deletions .github/workflows/size-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ jobs:

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

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

- name: Install dependencies
shell: bash
run: |
bun install --frozen-lockfile
- name: Build
uses: ./.github/actions/build
env:
SILENCE_LABS_NPM_TOKEN: ${{ secrets.SILENCE_LABS_NPM_TOKEN }}

- name: Report bundle size
uses: andresz1/size-limit-action@master
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-read.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:

- name: Install dependencies
uses: ./.github/actions/install-dependencies
env:
SILENCE_LABS_NPM_TOKEN: ${{ secrets.SILENCE_LABS_NPM_TOKEN }}

- name: Run the tests
run: bun run test:ci -t=Read
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/test-write.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ jobs:
steps:
- uses: actions/checkout@v3

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

- name: Install dependencies
uses: ./.github/actions/install-dependencies
env:
SILENCE_LABS_NPM_TOKEN: ${{ secrets.SILENCE_LABS_NPM_TOKEN }}

- name: Run the account tests
run: bun run test:ci -t=Account:Write
Expand Down
8 changes: 4 additions & 4 deletions .size-limit.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
{
"name": "core (esm)",
"path": "./dist/_esm/index.js",
"limit": "65 kB",
"limit": "80 kB",
"import": "*",
"ignore": ["node:fs", "fs"]
},
{
"name": "core (cjs)",
"path": "./dist/_cjs/index.js",
"limit": "65 kB",
"limit": "80 kB",
"ignore": ["node:fs", "fs"]
},
{
"name": "account (tree-shaking)",
"path": "./dist/_esm/index.js",
"limit": "65 kB",
"limit": "80 kB",
"import": "{ createSmartAccountClient }",
"ignore": ["node:fs", "fs"]
},
Expand All @@ -36,7 +36,7 @@
{
"name": "modules (tree-shaking)",
"path": "./dist/_esm/modules/index.js",
"limit": "60 kB",
"limit": "80 kB",
"import": "{ createSessionKeyManagerModule }",
"ignore": ["node:fs", "fs"]
}
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @biconomy/account

## 4.5.3

### Minor Changes

- Sessions Dx

## 4.5.2

### Patch Changes
Expand Down
7 changes: 4 additions & 3 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"files": {
"ignore": [
"package.json",
Expand All @@ -14,7 +14,8 @@
"_types",
"bun.lockb",
"docs",
"dist"
"dist",
"walletprovider-sdk"
]
},
"organizeImports": {
Expand Down Expand Up @@ -42,7 +43,7 @@
"javascript": {
"formatter": {
"semicolons": "asNeeded",
"trailingComma": "none"
"enabled": false
}
}
}
Binary file modified bun.lockb
Binary file not shown.
2 changes: 2 additions & 0 deletions bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[install.scopes]
silencelaboratories = { token = "$SILENCE_LABS_NPM_TOKEN", url = "https://registry.npmjs.org" }
19 changes: 5 additions & 14 deletions examples/CREATE_AND_USE_A_BATCH_SESSION.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ const smartAccountWithSession = await createSessionSmartAccountClient(
paymasterUrl,
chainId,
},
smartAccountAddress // Storage client, full Session or smartAccount address if using default storage
true // if batching
"DEFAULT_STORE", // Storage client, full Session or smartAccount address if using default storage
"BATCHED"
);

const transferTx: Transaction = {
Expand All @@ -117,21 +117,12 @@ const nftMintTx: Transaction = {
};

const txs = [nftMintTx, transferTx];
const correspondingIndexes = [1, 0]; // The order of the txs from the sessionBatch

const batchSessionParams = await getBatchSessionTxParams(
txs,
correspondingIndexes,
smartAccountAddress, // Storage client, full Session or smartAccount address if using default storage
chain
);
const leafIndexes = [1, 0]; // The order of the txs from the sessionBatch

const { wait: sessionWait } = await smartAccountWithSession.sendTransaction(
txs,
{
...batchSessionParams,
...withSponsorship,
}
withSponsorship,
{ leafIndex: leafIndexes },
);

const { success } = await sessionWait();
Expand Down
30 changes: 11 additions & 19 deletions examples/CREATE_AND_USE_A_SESSION.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import { createWalletClient, http, createPublicClient } from "viem";
import { privateKeyToAccount, generatePrivateKey } from "viem/accounts";
import { mainnet as chain } from "viem/chains";

const withSponsorship = {
paymasterServiceData: { mode: PaymasterMode.SPONSORED },
};

const account = privateKeyToAccount(generatePrivateKey());
const signer = createWalletClient({ account, chain, transport: http() });
const smartAccount = await createSmartAccountClient({
Expand All @@ -26,12 +30,6 @@ const smartAccount = await createSmartAccountClient({
}); // Retrieve bundler and pymaster urls from dashboard
const smartAccountAddress = await smartAccount.getAccountAddress();

// creates a store for the session, and saves the keys to it to be later retrieved
const { sessionKeyAddress, sessionStorageClient } = await createSessionKeyEOA(
smartAccount,
chain
);

/**
* Rule
*
Expand Down Expand Up @@ -78,7 +76,7 @@ const rules: Rule = [
/** The policy is made up of a list of rules applied to the contract method with and interval */
const policy: Policy[] = [
{
/** The address of the sessionKey upon which the policy is to be imparted */
/** The address of the sessionKey upon which the policy is to be imparted. Can be optional if creating from scratch */
sessionKeyAddress,
/** The address of the contract to be included in the policy */
contractAddress: nftAddress,
Expand All @@ -96,14 +94,9 @@ const policy: Policy[] = [
},
];

const { wait, session } = await createSession(
smartAccount,
policy,
sessionStorageClient,
{
paymasterServiceData: { mode: PaymasterMode.SPONSORED },
}
);
const { wait, session } = await createSession(smartAccount, policy, null, {
paymasterServiceData: { mode: PaymasterMode.SPONSORED },
});

const {
receipt: { transactionHash },
Expand All @@ -116,7 +109,7 @@ const smartAccountWithSession = await createSessionSmartAccountClient(
paymasterUrl,
chainId,
},
smartAccountAddress // Storage client, full Session or smartAccount address if using default storage
"DEFAULT_STORE" // Storage client, full Session or smartAccount address if using default storage
);

const { wait: mintWait } = await smartAccountWithSession.sendTransaction(
Expand All @@ -128,9 +121,8 @@ const { wait: mintWait } = await smartAccountWithSession.sendTransaction(
args: [smartAccountAddress],
}),
},
{
paymasterServiceData: { mode: PaymasterMode.SPONSORED },
}
withSponsorship,
{ leafIndex: "LAST_LEAF" },
);

const { success } = await mintWait();
Expand Down
8 changes: 5 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.5.2",
"version": "4.5.3",
"description": "SDK for Biconomy integration with support for account abstraction, smart accounts, ERC-4337.",
"keywords": [
"erc-7579",
Expand Down Expand Up @@ -54,7 +54,7 @@
"format": "biome format . --write",
"lint": "biome check .",
"lint:fix": "bun run lint --apply",
"dev": "bun link && concurrently \"bun run esm:watch\" \"bun run cjs:watch\" \"bun run esm:watch:aliases\" \"bun run cjs:watch:aliases\"",
"dev": "bun link && concurrently \"bun run esm:watch\" \"bun run cjs:watch\" \"bun run types:watch\" \"bun run esm:watch:aliases\" \"bun run cjs:watch:aliases\" \"bun run types:watch:aliases\"",
"build": "bun run clean && bun run build:cjs && bun run build:esm && bun run build:types",
"clean": "rimraf ./dist/_esm ./dist/_cjs ./dist/_types ./dist/tsconfig",
"test": "vitest dev -c ./tests/vitest.config.ts",
Expand All @@ -72,14 +72,16 @@
"changeset:version": "changeset version && bun install --lockfile-only",
"esm:watch": "tsc --project ./tsconfig/tsconfig.esm.json --watch",
"cjs:watch": "tsc --project ./tsconfig/tsconfig.cjs.json --watch",
"types:watch": "tsc --project ./tsconfig/tsconfig.types.json --watch",
"esm:watch:aliases": "tsc-alias -p ./tsconfig/tsconfig.esm.json --watch",
"cjs:watch:aliases": "tsc-alias -p ./tsconfig/tsconfig.cjs.json --watch",
"types:watch:aliases": "tsc-alias -p ./tsconfig/tsconfig.types.json --watch",
"build:cjs": "tsc --project ./tsconfig/tsconfig.cjs.json && tsc-alias -p ./tsconfig/tsconfig.cjs.json && echo > ./dist/_cjs/package.json '{\"type\":\"commonjs\"}'",
"build:esm": "tsc --project ./tsconfig/tsconfig.esm.json && tsc-alias -p ./tsconfig/tsconfig.esm.json && echo > ./dist/_esm/package.json '{\"type\": \"module\",\"sideEffects\":false}'",
"build:types": "tsc --project ./tsconfig/tsconfig.types.json && tsc-alias -p ./tsconfig/tsconfig.types.json"
},
"devDependencies": {
"@biomejs/biome": "1.6.0",
"@biomejs/biome": "^1.8.3",
"@changesets/cli": "^2.27.1",
"@commitlint/cli": "^19.0.3",
"@commitlint/config-conventional": "^19.0.3",
Expand Down
Loading
Loading