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

feat: add multi-policy sponsorships #1189

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion aa-sdk/core/src/version.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// This file is autogenerated by inject-version.ts. Any changes will be
// overwritten on commit!
export const VERSION = "4.5.1";
export const VERSION = "4.6.0";
8 changes: 4 additions & 4 deletions account-kit/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ export type AlchemyAccountsConfig = {
export type Connection = {
transport: AlchemyTransportConfig;
chain: Chain;
policyId?: string;
policyId?: string | string[];
};

type RpcConnectionConfig =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

almost feels like we need one more permutation here like the following that allows you to specify the policyId array at the top level instead of nesting it

{
  chain: Chain;
  chains: {
    chain: Chain;
    transport?: AlchemyTransport
  }[],
  transport: AlchemyTransport;
  signerConnection?: ConnectionConfig;
  policyId?: string[];
}
| {
  chain: Chain;
  chains: {
    chain: Chain;
    transport?: AlchemyTransport
  }[],
  transport?: never;
  signerConnection: ConnectionConfig;
  policyId?: string[];
}

| {
chain: Chain;
chains: {
chain: Chain;
policyId?: string;
policyId?: string | string[];
// optional transport override
transport?: AlchemyTransport;
}[];
Expand All @@ -78,7 +78,7 @@ type RpcConnectionConfig =
chain: Chain;
chains: {
chain: Chain;
policyId?: string;
policyId?: string | string[];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can one chain have multiple policy ids?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, with the idea being that when we have gas grants you can add both the grant as well as your own policy. In general this model might be worth revisiting now that we also have multi-chain policices.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea with multi-chain policies, it almost feels like we can add support for that at the top level and just have a policyId?: string[] and start pushing folks towards that

transport: AlchemyTransport;
}[];
transport?: never;
Expand All @@ -89,7 +89,7 @@ type RpcConnectionConfig =
| {
transport: AlchemyTransport;
chain: Chain;
policyId?: string;
policyId?: string | string[];
signerConnection?: ConnectionConfig;
chains?: never;
};
Expand Down
2 changes: 1 addition & 1 deletion account-kit/infra/src/client/smartAccountClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export type AlchemySmartAccountClientConfig<
> = {
account?: account;
useSimulation?: boolean;
policyId?: string;
policyId?: string | string[];
} & Pick<
SmartAccountClientConfig<AlchemyTransport, chain, account, context>,
| "customMiddleware"
Expand Down
6 changes: 3 additions & 3 deletions account-kit/infra/src/middleware/gasManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import { erc7677Middleware } from "@aa-sdk/core";
* });
* ```
*
* @param {string} policyId the policyId for Alchemy's gas manager
* @param {string | string[]} policyId the policyId (or list of policyIds) for Alchemy's gas manager
* @returns {Pick<ClientMiddlewareConfig, "dummyPaymasterAndData" | "paymasterAndData">} partial client middleware configuration containing `dummyPaymasterAndData` and `paymasterAndData`
*/
export function alchemyGasManagerMiddleware(
policyId: string
policyId: string | string[]
): Pick<ClientMiddlewareConfig, "dummyPaymasterAndData" | "paymasterAndData"> {
return erc7677Middleware<{ policyId: string }>({
return erc7677Middleware<{ policyId: string | string[] }>({
context: { policyId: policyId },
});
}
2 changes: 1 addition & 1 deletion account-kit/logging/src/version.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// This file is autogenerated by inject-version.ts. Any changes will be
// overwritten on commit!
export const VERSION = "4.5.1";
export const VERSION = "4.6.0";
2 changes: 1 addition & 1 deletion account-kit/signer/src/version.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// This file is autogenerated by inject-version.ts. Any changes will be
// overwritten on commit!
export const VERSION = "4.5.1";
export const VERSION = "4.6.0";

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading