Skip to content

Commit

Permalink
Merge branch 'main' into rob/redirect-params-post
Browse files Browse the repository at this point in the history
  • Loading branch information
RobChangCA authored Jan 13, 2025
2 parents ba53218 + 18a9228 commit 4d576df
Show file tree
Hide file tree
Showing 57 changed files with 668 additions and 680 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ jobs:

- name: Unit Test
run: yarn test:ci

- name: Typecheck Test
run: yarn test:typecheck

build_ios:
name: Build iOS
Expand Down Expand Up @@ -131,3 +134,4 @@ jobs:
- name: Build example for iOS
run: |
yarn turbo run build:ios
7 changes: 6 additions & 1 deletion .vitest/vitest.shared.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { join } from "node:path";
import { configDefaults, defineConfig } from "vitest/config";

const typechecking = process.env["TYPECHECK"] === "true";
export const sharedConfig = defineConfig({
test: {
typecheck: {
enabled: typechecking,
only: typechecking,
ignoreSourceErrors: true,
},
alias: {
"~test": join(__dirname, "./src"),
},
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ We are excited to have you contribute to the `aa-sdk`. Here's a step-by-step gui

- Use the Node version specified in `package.json` (currently 18.16.0). Run `node -v` to check your version.
- Build the project with `yarn build`.
- Run existing tests using `yarn test` to ensure everything is working correctly.
- Run existing tests using `yarn test` & `yarn test:typecheck` to ensure everything is working correctly.

4. **Make Changes**: Now, you can start making changes to the packages or docs. When updating or adding new functionality, update or add a new doc in `site/packages/*` corresponding to the package you have worked on to document the changes.

5. **Re-verify Tests**: After making your changes, re-run `yarn test` to ensure all tests still pass.
5. **Re-verify Tests**: After making your changes, re-run `yarn test` & `yarn test:typecheck` to ensure all tests still pass.

6. **Code Formatting**:

Expand Down
1 change: 1 addition & 0 deletions aa-sdk/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"!vitest.config.ts",
"!.env",
"!src/**/*.test.ts",
"!src/**/*.test-d.ts",
"!src/__tests__/**/*"
],
"exports": {
Expand Down
1 change: 1 addition & 0 deletions aa-sdk/core/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"node_modules",
"**/*/__tests__",
"**/*/*.test.ts",
"**/*/*.test-d.ts",
"**/*/*.e2e.test.ts",
"vitest.config.ts",
"vitest.config.e2e.ts"
Expand Down
1 change: 1 addition & 0 deletions aa-sdk/ethers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"!.env",
"!dist/**/*.tsbuildinfo",
"!src/**/*.test.ts",
"!src/**/*.test-d.ts",
"!src/__tests__/**/*"
],
"exports": {
Expand Down
1 change: 1 addition & 0 deletions aa-sdk/ethers/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"**/*/__tests__",
"**/*/*.e2e.test.ts",
"**/*/*.test.ts",
"**/*/*.test-d.ts",
"vitest.config.ts"
],
"include": ["src"],
Expand Down
1 change: 1 addition & 0 deletions account-kit/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"!vitest.config.ts",
"!.env",
"!src/**/*.test.ts",
"!src/**/*.test-d.ts",
"!src/__tests__/**/*"
],
"exports": {
Expand Down
1 change: 1 addition & 0 deletions account-kit/core/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"node_modules",
"**/*/__tests__",
"**/*/*.test.ts",
"**/*/*.test-d.ts",
"**/*/*.e2e.test.ts",
"vitest.config.ts",
"vitest.config.e2e.ts"
Expand Down
1 change: 1 addition & 0 deletions account-kit/infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"!vitest.config.ts",
"!.env",
"!src/**/*.test.ts",
"!src/**/*.test-d.ts",
"!src/__tests__/**/*"
],
"exports": {
Expand Down
17 changes: 17 additions & 0 deletions account-kit/infra/src/alchemyTransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
import {
createTransport,
http,
type Chain,
type EIP1193RequestFn,
type HttpTransportConfig,
type PublicRpcSchema,
Expand Down Expand Up @@ -65,6 +66,22 @@ export type AlchemyTransport = AlchemyTransportBase & {
config: AlchemyTransportConfig;
};

/**
* A type guard for the transport to determine if it is an Alchemy transport.
* Used in cases where we would like to do switching depending on the transport, where there used
* to be two clients for a alchemy and a non alchemy, and with this switch we don't need the two seperate clients. *
*
* @param {Transport} transport The transport to check
* @param {Chain} chain Chain for the transport to run its function to return the transport config
* @returns {boolean} `true` if the transport is an Alchemy transport, otherwise `false`
*/
export function isAlchemyTransport(
transport: Transport,
chain: Chain
): transport is AlchemyTransport {
return transport({ chain }).config.type === "alchemy";
}

/**
* Creates an Alchemy transport with the specified configuration options.
* When sending all traffic to Alchemy, you must pass in one of rpcUrl, apiKey, or jwt.
Expand Down
2 changes: 1 addition & 1 deletion account-kit/infra/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export type * from "./actions/simulateUserOperationChanges.js";
export { simulateUserOperationChanges } from "./actions/simulateUserOperationChanges.js";
export type * from "./actions/types.js";
export type * from "./alchemyTransport.js";
export { alchemy } from "./alchemyTransport.js";
export { alchemy, isAlchemyTransport } from "./alchemyTransport.js";
export type * from "./chains.js";
export {
arbitrum,
Expand Down
1 change: 1 addition & 0 deletions account-kit/infra/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"node_modules",
"**/*/__tests__",
"**/*/*.test.ts",
"**/*/*.test-d.ts",
"**/*/*.e2e.test.ts",
"vitest.config.ts",
"vitest.config.e2e.ts"
Expand Down
1 change: 1 addition & 0 deletions account-kit/logging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"!vitest.config.ts",
"!.env",
"!src/**/*.test.ts",
"!src/**/*.test-d.ts",
"!src/__tests__/**/*"
],
"exports": {
Expand Down
1 change: 1 addition & 0 deletions account-kit/logging/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"node_modules",
"**/*/__tests__",
"**/*/*.test.ts",
"**/*/*.test-d.ts",
"**/*/*.e2e.test.ts",
"vitest.config.ts",
"vitest.config.e2e.ts"
Expand Down
1 change: 1 addition & 0 deletions account-kit/plugingen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"!vitest.config.ts",
"!.env",
"!src/**/*.test.ts",
"!src/**/*.test-d.ts",
"!src/__tests__/**/*"
],
"exports": {
Expand Down
1 change: 1 addition & 0 deletions account-kit/plugingen/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"node_modules",
"**/*/__tests__",
"**/*/*.test.ts",
"**/*/*.test-d.ts",
"**/*/*.e2e.test.ts",
"vitest.config.ts",
"vitest.config.e2e.ts"
Expand Down
1 change: 1 addition & 0 deletions account-kit/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"!vitest.config.ts",
"!.env",
"!src/**/*.test.ts",
"!src/**/*.test-d.ts",
"!src/__tests__/**/*"
],
"exports": {
Expand Down
1 change: 1 addition & 0 deletions account-kit/react/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"node_modules",
"**/*/__tests__",
"**/*/*.test.ts",
"**/*/*.test-d.ts",
"**/*/*.e2e.test.ts",
"vitest.config.ts",
"vitest.config.e2e.ts",
Expand Down
1 change: 1 addition & 0 deletions account-kit/react/tsconfig.storybook.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"exclude": [
"src/**/*.spec.ts",
"src/**/*.test.ts",
"src/**/*.test-d.ts",
"src/**/*.spec.js",
"src/**/*.test.js",
"src/**/*.spec.tsx",
Expand Down
1 change: 1 addition & 0 deletions account-kit/signer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"!vitest.config.ts",
"!.env",
"!src/**/*.test.ts",
"!src/**/*.test-d.ts",
"!src/__tests__/**/*"
],
"exports": {
Expand Down
1 change: 1 addition & 0 deletions account-kit/signer/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"node_modules",
"**/*/__tests__",
"**/*/*.test.ts",
"**/*/*.test-d.ts",
"**/*/*.e2e.test.ts",
"vitest.config.ts",
"vitest.config.e2e.ts"
Expand Down
1 change: 1 addition & 0 deletions account-kit/smart-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"!vitest.config.ts",
"!.env",
"!src/**/*.test.ts",
"!src/**/*.test-d.ts",
"!src/__tests__/**/*"
],
"exports": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import { Alchemy, Network } from "alchemy-sdk";
import { avalanche, type Chain } from "viem/chains";
import { createLightAccountAlchemyClient } from "./alchemyClient.js";

Check warning on line 15 in account-kit/smart-contracts/src/light-account/clients/alchemyClient.test.ts

View workflow job for this annotation

GitHub Actions / Lint

'createLightAccountAlchemyClient' is defined but never used
import { createLightAccountClient } from "./client.js";

describe("Light Account Client Tests", () => {
const dummyMnemonic =
Expand Down Expand Up @@ -136,7 +137,7 @@ describe("Light Account Client Tests", () => {
signer: SmartAccountSigner;
chain: Chain;
}) =>
createLightAccountAlchemyClient({
createLightAccountClient({
transport: alchemy({
jwt: "test",
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
import {
createAlchemySmartAccountClient,
type AlchemySmartAccountClient,
type AlchemySmartAccountClientConfig,
} from "@account-kit/infra";
import {
createLightAccount,
lightAccountClientActions,
createLightAccountClient,
type CreateLightAccountParams,
type LightAccount,
type LightAccountClientActions,
Expand Down Expand Up @@ -49,7 +47,7 @@ export async function createLightAccountAlchemyClient<
* signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
* });
* ```
*
* @deprecated Use createLightAccountClient instead now, it should switch depending on the transport
* @param {AlchemyLightAccountClientConfig} config The configuration for setting up the Alchemy Light Account Client
* @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` object containing the created client
*/
Expand All @@ -59,17 +57,10 @@ export async function createLightAccountAlchemyClient({
chain,
...config
}: AlchemyLightAccountClientConfig): Promise<AlchemySmartAccountClient> {
const account = await createLightAccount({
...config,
return createLightAccountClient({
opts,
transport,
chain,
});

return createAlchemySmartAccountClient({
...config,
transport,
chain,
account,
opts,
}).extend(lightAccountClientActions);
});
}
Loading

0 comments on commit 4d576df

Please sign in to comment.