@alchemy/aa-accounts
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -73,3 +73,3 @@ "use strict"; | ||
if ((0, viem_1.fromHex)(storage, "number") !== 0 && | ||
implementationAddresses.some((x) => x === (0, viem_1.trim)(storage))) { | ||
!implementationAddresses.some((x) => x === (0, viem_1.trim)(storage))) { | ||
throw new Error("could not determine if smart account implementation is light account"); | ||
@@ -76,0 +76,0 @@ } |
@@ -135,3 +135,3 @@ "use strict"; | ||
data: "0x", | ||
value: (0, viem_1.toHex)(1000000000000000n), | ||
value: (0, viem_1.toHex)(200000000000000000n), | ||
}); | ||
@@ -138,0 +138,0 @@ const { connectFn, ...upgradeToData } = await (0, utils_js_1.getMSCAUpgradeToData)(throwawayProvider); |
@@ -142,2 +142,20 @@ import { type SupportedTransports } from "@alchemy/aa-core"; | ||
}> | undefined) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
installMultiOwnerPlugin: (params: import("./plugins/multi-owner/plugin.js").InstallMultiOwnerPluginParams, overrides?: Partial<{ | ||
callGasLimit: number | bigint | `0x${string}` | { | ||
percentage: number; | ||
} | undefined; | ||
maxFeePerGas: number | bigint | `0x${string}` | { | ||
percentage: number; | ||
} | undefined; | ||
maxPriorityFeePerGas: number | bigint | `0x${string}` | { | ||
percentage: number; | ||
} | undefined; | ||
preVerificationGas: number | bigint | `0x${string}` | { | ||
percentage: number; | ||
} | undefined; | ||
verificationGasLimit: number | bigint | `0x${string}` | { | ||
percentage: number; | ||
} | undefined; | ||
paymasterAndData: import("@alchemy/aa-core").BytesLike; | ||
}> | undefined) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
}> & { | ||
@@ -144,0 +162,0 @@ encodeUpdateOwnersData: ({ args, }: { |
@@ -1,5 +0,17 @@ | ||
import { type GetFunctionArgs } from 'viem'; | ||
import { encodeAbiParameters } from 'viem'; | ||
import type { InjectedHook } from '../../plugin-manager/types.js'; | ||
import type { FunctionReference } from '../../account-loupe/types.js'; | ||
import { type Address, type GetFunctionArgs } from 'viem'; | ||
import type { Plugin } from '../types'; | ||
import type { IMSCA } from '../../types'; | ||
import type { ISmartAccountProvider, SupportedTransports, UserOperationOverrides } from '@alchemy/aa-core'; | ||
type InstallArgs = [{ | ||
type: 'address[]'; | ||
}]; | ||
export type InstallMultiOwnerPluginParams = { | ||
args: Parameters<typeof encodeAbiParameters<InstallArgs>>[1]; | ||
pluginAddress?: Address; | ||
injectedHooks?: InjectedHook[]; | ||
dependencyOverrides?: FunctionReference[]; | ||
}; | ||
declare const MultiOwnerPlugin_: { | ||
@@ -9,5 +21,3 @@ meta: { | ||
version: string; | ||
addresses: { | ||
11155111: `0x${string}`; | ||
}; | ||
addresses: Record<number, `0x${string}`>; | ||
}; | ||
@@ -29,2 +39,3 @@ accountMethods: (account: IMSCA<any, any>) => { | ||
updateOwners: ({ args, }: GetFunctionArgs<typeof MultiOwnerPluginExecutionFunctionAbi, 'updateOwners'>, overrides?: UserOperationOverrides) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
installMultiOwnerPlugin: (params: InstallMultiOwnerPluginParams, overrides?: UserOperationOverrides) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
}; | ||
@@ -31,0 +42,0 @@ }; |
@@ -5,2 +5,4 @@ "use strict"; | ||
const viem_1 = require("viem"); | ||
const installPlugin_js_1 = require("../../plugin-manager/installPlugin.js"); | ||
const viem_2 = require("viem"); | ||
const MultiOwnerPlugin_ = { | ||
@@ -16,3 +18,3 @@ meta: { | ||
encodeUpdateOwnersData: ({ args, }) => { | ||
return (0, viem_1.encodeFunctionData)({ | ||
return (0, viem_2.encodeFunctionData)({ | ||
abi: exports.MultiOwnerPluginExecutionFunctionAbi, | ||
@@ -24,3 +26,3 @@ functionName: 'updateOwners', | ||
encodeOwnersData: () => { | ||
return (0, viem_1.encodeFunctionData)({ | ||
return (0, viem_2.encodeFunctionData)({ | ||
abi: exports.MultiOwnerPluginExecutionFunctionAbi, | ||
@@ -38,3 +40,3 @@ functionName: 'owners', | ||
encodeIsOwnerData: ({ args, }) => { | ||
return (0, viem_1.encodeFunctionData)({ | ||
return (0, viem_2.encodeFunctionData)({ | ||
abi: exports.MultiOwnerPluginExecutionFunctionAbi, | ||
@@ -54,3 +56,3 @@ functionName: 'isOwner', | ||
encodeEip712DomainData: () => { | ||
return (0, viem_1.encodeFunctionData)({ | ||
return (0, viem_2.encodeFunctionData)({ | ||
abi: exports.MultiOwnerPluginExecutionFunctionAbi, | ||
@@ -68,3 +70,3 @@ functionName: 'eip712Domain', | ||
encodeIsValidSignatureData: ({ args, }) => { | ||
return (0, viem_1.encodeFunctionData)({ | ||
return (0, viem_2.encodeFunctionData)({ | ||
abi: exports.MultiOwnerPluginExecutionFunctionAbi, | ||
@@ -86,3 +88,3 @@ functionName: 'isValidSignature', | ||
updateOwners: ({ args, }, overrides) => { | ||
const callData = (0, viem_1.encodeFunctionData)({ | ||
const callData = (0, viem_2.encodeFunctionData)({ | ||
abi: exports.MultiOwnerPluginExecutionFunctionAbi, | ||
@@ -94,2 +96,16 @@ functionName: 'updateOwners', | ||
}, | ||
installMultiOwnerPlugin: (params, overrides) => { | ||
const chain = provider.rpcClient.chain; | ||
const dependencies = params.dependencyOverrides ?? []; | ||
const pluginAddress = params.pluginAddress ?? | ||
MultiOwnerPlugin_.meta.addresses[chain.id]; | ||
if (!pluginAddress) { | ||
throw new Error('missing MultiOwnerPlugin address for chain ' + chain.name); | ||
} | ||
return (0, installPlugin_js_1.installPlugin)(provider, { | ||
pluginAddress, | ||
pluginInitData: (0, viem_1.encodeAbiParameters)([{ type: 'address[]' }], params.args), | ||
dependencies, | ||
}, overrides); | ||
}, | ||
}), | ||
@@ -96,0 +112,0 @@ }; |
@@ -1,5 +0,18 @@ | ||
import { type GetFunctionArgs } from 'viem'; | ||
import { encodeAbiParameters } from 'viem'; | ||
import type { InjectedHook } from '../../plugin-manager/types.js'; | ||
import type { FunctionReference } from '../../account-loupe/types.js'; | ||
import { type Address, type GetFunctionArgs } from 'viem'; | ||
import type { Plugin } from '../types'; | ||
import type { IMSCA } from '../../types'; | ||
import type { ISmartAccountProvider, SupportedTransports, UserOperationOverrides } from '@alchemy/aa-core'; | ||
type InstallArgs = [{ | ||
type: 'address[]'; | ||
name: 'initialPublicKeys'; | ||
}]; | ||
export type InstallSessionKeyPluginParams = { | ||
args: Parameters<typeof encodeAbiParameters<InstallArgs>>[1]; | ||
pluginAddress?: Address; | ||
injectedHooks?: InjectedHook[]; | ||
dependencyOverrides?: FunctionReference[]; | ||
}; | ||
declare const SessionKeyPlugin_: { | ||
@@ -9,5 +22,3 @@ meta: { | ||
version: string; | ||
addresses: { | ||
11155111: `0x${string}`; | ||
}; | ||
addresses: Record<number, `0x${string}`>; | ||
}; | ||
@@ -27,2 +38,3 @@ accountMethods: (account: IMSCA<any, any>) => { | ||
updateSessionKeys: ({ args, }: GetFunctionArgs<typeof SessionKeyPluginExecutionFunctionAbi, 'updateSessionKeys'>, overrides?: UserOperationOverrides) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
installSessionKeyPlugin: (params: InstallSessionKeyPluginParams, overrides?: UserOperationOverrides) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
}; | ||
@@ -29,0 +41,0 @@ }; |
@@ -5,2 +5,5 @@ "use strict"; | ||
const viem_1 = require("viem"); | ||
const installPlugin_js_1 = require("../../plugin-manager/installPlugin.js"); | ||
const plugin_js_1 = require("../multi-owner/plugin.js"); | ||
const viem_2 = require("viem"); | ||
const SessionKeyPlugin_ = { | ||
@@ -16,3 +19,3 @@ meta: { | ||
encodeExecuteWithSessionKeyData: ({ args, }) => { | ||
return (0, viem_1.encodeFunctionData)({ | ||
return (0, viem_2.encodeFunctionData)({ | ||
abi: exports.SessionKeyPluginExecutionFunctionAbi, | ||
@@ -24,3 +27,3 @@ functionName: 'executeWithSessionKey', | ||
encodeGetSessionKeysData: () => { | ||
return (0, viem_1.encodeFunctionData)({ | ||
return (0, viem_2.encodeFunctionData)({ | ||
abi: exports.SessionKeyPluginExecutionFunctionAbi, | ||
@@ -38,3 +41,3 @@ functionName: 'getSessionKeys', | ||
encodeIsSessionKeyData: ({ args, }) => { | ||
return (0, viem_1.encodeFunctionData)({ | ||
return (0, viem_2.encodeFunctionData)({ | ||
abi: exports.SessionKeyPluginExecutionFunctionAbi, | ||
@@ -54,3 +57,3 @@ functionName: 'isSessionKey', | ||
encodeUpdateSessionKeysData: ({ args, }) => { | ||
return (0, viem_1.encodeFunctionData)({ | ||
return (0, viem_2.encodeFunctionData)({ | ||
abi: exports.SessionKeyPluginExecutionFunctionAbi, | ||
@@ -64,3 +67,3 @@ functionName: 'updateSessionKeys', | ||
executeWithSessionKey: ({ args, }, overrides) => { | ||
const callData = (0, viem_1.encodeFunctionData)({ | ||
const callData = (0, viem_2.encodeFunctionData)({ | ||
abi: exports.SessionKeyPluginExecutionFunctionAbi, | ||
@@ -73,3 +76,3 @@ functionName: 'executeWithSessionKey', | ||
updateSessionKeys: ({ args, }, overrides) => { | ||
const callData = (0, viem_1.encodeFunctionData)({ | ||
const callData = (0, viem_2.encodeFunctionData)({ | ||
abi: exports.SessionKeyPluginExecutionFunctionAbi, | ||
@@ -81,2 +84,31 @@ functionName: 'updateSessionKeys', | ||
}, | ||
installSessionKeyPlugin: (params, overrides) => { | ||
const chain = provider.rpcClient.chain; | ||
const dependencies = params.dependencyOverrides ?? [ | ||
(() => { | ||
const pluginAddress = plugin_js_1.MultiOwnerPlugin.meta.addresses[chain.id]; | ||
if (!pluginAddress) { | ||
throw new Error('missing MultiOwnerPlugin address for chain ' + chain.name); | ||
} | ||
return (0, viem_1.encodePacked)(['address', 'uint8'], [pluginAddress, 0x0]); | ||
})(), | ||
(() => { | ||
const pluginAddress = plugin_js_1.MultiOwnerPlugin.meta.addresses[chain.id]; | ||
if (!pluginAddress) { | ||
throw new Error('missing MultiOwnerPlugin address for chain ' + chain.name); | ||
} | ||
return (0, viem_1.encodePacked)(['address', 'uint8'], [pluginAddress, 0x1]); | ||
})(), | ||
]; | ||
const pluginAddress = params.pluginAddress ?? | ||
SessionKeyPlugin_.meta.addresses[chain.id]; | ||
if (!pluginAddress) { | ||
throw new Error('missing SessionKeyPlugin address for chain ' + chain.name); | ||
} | ||
return (0, installPlugin_js_1.installPlugin)(provider, { | ||
pluginAddress, | ||
pluginInitData: (0, viem_1.encodeAbiParameters)([{ type: 'address[]', name: 'initialPublicKeys' }], params.args), | ||
dependencies, | ||
}, overrides); | ||
}, | ||
}), | ||
@@ -83,0 +115,0 @@ }; |
@@ -1,5 +0,15 @@ | ||
import { type GetFunctionArgs } from 'viem'; | ||
import { encodeAbiParameters } from 'viem'; | ||
import type { InjectedHook } from '../../plugin-manager/types.js'; | ||
import type { FunctionReference } from '../../account-loupe/types.js'; | ||
import { type Address, type GetFunctionArgs } from 'viem'; | ||
import type { Plugin } from '../types'; | ||
import type { IMSCA } from '../../types'; | ||
import type { ISmartAccountProvider, SupportedTransports, UserOperationOverrides } from '@alchemy/aa-core'; | ||
type InstallArgs = []; | ||
export type InstallTokenReceiverPluginParams = { | ||
args: Parameters<typeof encodeAbiParameters<InstallArgs>>[1]; | ||
pluginAddress?: Address; | ||
injectedHooks?: InjectedHook[]; | ||
dependencyOverrides?: FunctionReference[]; | ||
}; | ||
declare const TokenReceiverPlugin_: { | ||
@@ -9,5 +19,3 @@ meta: { | ||
version: string; | ||
addresses: { | ||
11155111: `0x${string}`; | ||
}; | ||
addresses: Record<number, `0x${string}`>; | ||
}; | ||
@@ -27,2 +35,3 @@ accountMethods: (_account: IMSCA<any, any>) => { | ||
onErc1155BatchReceived: ({ args, }: GetFunctionArgs<typeof TokenReceiverPluginExecutionFunctionAbi, 'onERC1155BatchReceived'>, overrides?: UserOperationOverrides) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
installTokenReceiverPlugin: (params: InstallTokenReceiverPluginParams, overrides?: UserOperationOverrides) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
}; | ||
@@ -29,0 +38,0 @@ }; |
@@ -5,2 +5,4 @@ "use strict"; | ||
const viem_1 = require("viem"); | ||
const installPlugin_js_1 = require("../../plugin-manager/installPlugin.js"); | ||
const viem_2 = require("viem"); | ||
const TokenReceiverPlugin_ = { | ||
@@ -16,3 +18,3 @@ meta: { | ||
encodeTokensReceivedData: ({ args, }) => { | ||
return (0, viem_1.encodeFunctionData)({ | ||
return (0, viem_2.encodeFunctionData)({ | ||
abi: exports.TokenReceiverPluginExecutionFunctionAbi, | ||
@@ -24,3 +26,3 @@ functionName: 'tokensReceived', | ||
encodeOnErc721ReceivedData: ({ args, }) => { | ||
return (0, viem_1.encodeFunctionData)({ | ||
return (0, viem_2.encodeFunctionData)({ | ||
abi: exports.TokenReceiverPluginExecutionFunctionAbi, | ||
@@ -32,3 +34,3 @@ functionName: 'onERC721Received', | ||
encodeOnErc1155ReceivedData: ({ args, }) => { | ||
return (0, viem_1.encodeFunctionData)({ | ||
return (0, viem_2.encodeFunctionData)({ | ||
abi: exports.TokenReceiverPluginExecutionFunctionAbi, | ||
@@ -40,3 +42,3 @@ functionName: 'onERC1155Received', | ||
encodeOnErc1155BatchReceivedData: ({ args, }) => { | ||
return (0, viem_1.encodeFunctionData)({ | ||
return (0, viem_2.encodeFunctionData)({ | ||
abi: exports.TokenReceiverPluginExecutionFunctionAbi, | ||
@@ -50,3 +52,3 @@ functionName: 'onERC1155BatchReceived', | ||
tokensReceived: ({ args, }, overrides) => { | ||
const callData = (0, viem_1.encodeFunctionData)({ | ||
const callData = (0, viem_2.encodeFunctionData)({ | ||
abi: exports.TokenReceiverPluginExecutionFunctionAbi, | ||
@@ -59,3 +61,3 @@ functionName: 'tokensReceived', | ||
onErc721Received: ({ args, }, overrides) => { | ||
const callData = (0, viem_1.encodeFunctionData)({ | ||
const callData = (0, viem_2.encodeFunctionData)({ | ||
abi: exports.TokenReceiverPluginExecutionFunctionAbi, | ||
@@ -68,3 +70,3 @@ functionName: 'onERC721Received', | ||
onErc1155Received: ({ args, }, overrides) => { | ||
const callData = (0, viem_1.encodeFunctionData)({ | ||
const callData = (0, viem_2.encodeFunctionData)({ | ||
abi: exports.TokenReceiverPluginExecutionFunctionAbi, | ||
@@ -77,3 +79,3 @@ functionName: 'onERC1155Received', | ||
onErc1155BatchReceived: ({ args, }, overrides) => { | ||
const callData = (0, viem_1.encodeFunctionData)({ | ||
const callData = (0, viem_2.encodeFunctionData)({ | ||
abi: exports.TokenReceiverPluginExecutionFunctionAbi, | ||
@@ -85,2 +87,16 @@ functionName: 'onERC1155BatchReceived', | ||
}, | ||
installTokenReceiverPlugin: (params, overrides) => { | ||
const chain = provider.rpcClient.chain; | ||
const dependencies = params.dependencyOverrides ?? []; | ||
const pluginAddress = params.pluginAddress ?? | ||
TokenReceiverPlugin_.meta.addresses[chain.id]; | ||
if (!pluginAddress) { | ||
throw new Error('missing TokenReceiverPlugin address for chain ' + chain.name); | ||
} | ||
return (0, installPlugin_js_1.installPlugin)(provider, { | ||
pluginAddress, | ||
pluginInitData: (0, viem_1.encodeAbiParameters)([], params.args), | ||
dependencies, | ||
}, overrides); | ||
}, | ||
}), | ||
@@ -87,0 +103,0 @@ }; |
@@ -70,3 +70,3 @@ import { SimpleSmartContractAccount, } from "@alchemy/aa-core"; | ||
if (fromHex(storage, "number") !== 0 && | ||
implementationAddresses.some((x) => x === trim(storage))) { | ||
!implementationAddresses.some((x) => x === trim(storage))) { | ||
throw new Error("could not determine if smart account implementation is light account"); | ||
@@ -73,0 +73,0 @@ } |
@@ -133,3 +133,3 @@ import { LocalAccountSigner, Logger, LogLevel, } from "@alchemy/aa-core"; | ||
data: "0x", | ||
value: toHex(1000000000000000n), | ||
value: toHex(200000000000000000n), | ||
}); | ||
@@ -136,0 +136,0 @@ const { connectFn, ...upgradeToData } = await getMSCAUpgradeToData(throwawayProvider); |
@@ -142,2 +142,20 @@ import { type SupportedTransports } from "@alchemy/aa-core"; | ||
}> | undefined) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
installMultiOwnerPlugin: (params: import("./plugins/multi-owner/plugin.js").InstallMultiOwnerPluginParams, overrides?: Partial<{ | ||
callGasLimit: number | bigint | `0x${string}` | { | ||
percentage: number; | ||
} | undefined; | ||
maxFeePerGas: number | bigint | `0x${string}` | { | ||
percentage: number; | ||
} | undefined; | ||
maxPriorityFeePerGas: number | bigint | `0x${string}` | { | ||
percentage: number; | ||
} | undefined; | ||
preVerificationGas: number | bigint | `0x${string}` | { | ||
percentage: number; | ||
} | undefined; | ||
verificationGasLimit: number | bigint | `0x${string}` | { | ||
percentage: number; | ||
} | undefined; | ||
paymasterAndData: import("@alchemy/aa-core").BytesLike; | ||
}> | undefined) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
}> & { | ||
@@ -144,0 +162,0 @@ encodeUpdateOwnersData: ({ args, }: { |
@@ -1,5 +0,17 @@ | ||
import { type GetFunctionArgs } from 'viem'; | ||
import { encodeAbiParameters } from 'viem'; | ||
import type { InjectedHook } from '../../plugin-manager/types.js'; | ||
import type { FunctionReference } from '../../account-loupe/types.js'; | ||
import { type Address, type GetFunctionArgs } from 'viem'; | ||
import type { Plugin } from '../types'; | ||
import type { IMSCA } from '../../types'; | ||
import type { ISmartAccountProvider, SupportedTransports, UserOperationOverrides } from '@alchemy/aa-core'; | ||
type InstallArgs = [{ | ||
type: 'address[]'; | ||
}]; | ||
export type InstallMultiOwnerPluginParams = { | ||
args: Parameters<typeof encodeAbiParameters<InstallArgs>>[1]; | ||
pluginAddress?: Address; | ||
injectedHooks?: InjectedHook[]; | ||
dependencyOverrides?: FunctionReference[]; | ||
}; | ||
declare const MultiOwnerPlugin_: { | ||
@@ -9,5 +21,3 @@ meta: { | ||
version: string; | ||
addresses: { | ||
11155111: `0x${string}`; | ||
}; | ||
addresses: Record<number, `0x${string}`>; | ||
}; | ||
@@ -29,2 +39,3 @@ accountMethods: (account: IMSCA<any, any>) => { | ||
updateOwners: ({ args, }: GetFunctionArgs<typeof MultiOwnerPluginExecutionFunctionAbi, 'updateOwners'>, overrides?: UserOperationOverrides) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
installMultiOwnerPlugin: (params: InstallMultiOwnerPluginParams, overrides?: UserOperationOverrides) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
}; | ||
@@ -31,0 +42,0 @@ }; |
@@ -0,1 +1,3 @@ | ||
import { encodeAbiParameters } from 'viem'; | ||
import { installPlugin as installPlugin_ } from '../../plugin-manager/installPlugin.js'; | ||
import { encodeFunctionData } from 'viem'; | ||
@@ -84,2 +86,16 @@ const MultiOwnerPlugin_ = { | ||
}, | ||
installMultiOwnerPlugin: (params, overrides) => { | ||
const chain = provider.rpcClient.chain; | ||
const dependencies = params.dependencyOverrides ?? []; | ||
const pluginAddress = params.pluginAddress ?? | ||
MultiOwnerPlugin_.meta.addresses[chain.id]; | ||
if (!pluginAddress) { | ||
throw new Error('missing MultiOwnerPlugin address for chain ' + chain.name); | ||
} | ||
return installPlugin_(provider, { | ||
pluginAddress, | ||
pluginInitData: encodeAbiParameters([{ type: 'address[]' }], params.args), | ||
dependencies, | ||
}, overrides); | ||
}, | ||
}), | ||
@@ -86,0 +102,0 @@ }; |
@@ -1,5 +0,18 @@ | ||
import { type GetFunctionArgs } from 'viem'; | ||
import { encodeAbiParameters } from 'viem'; | ||
import type { InjectedHook } from '../../plugin-manager/types.js'; | ||
import type { FunctionReference } from '../../account-loupe/types.js'; | ||
import { type Address, type GetFunctionArgs } from 'viem'; | ||
import type { Plugin } from '../types'; | ||
import type { IMSCA } from '../../types'; | ||
import type { ISmartAccountProvider, SupportedTransports, UserOperationOverrides } from '@alchemy/aa-core'; | ||
type InstallArgs = [{ | ||
type: 'address[]'; | ||
name: 'initialPublicKeys'; | ||
}]; | ||
export type InstallSessionKeyPluginParams = { | ||
args: Parameters<typeof encodeAbiParameters<InstallArgs>>[1]; | ||
pluginAddress?: Address; | ||
injectedHooks?: InjectedHook[]; | ||
dependencyOverrides?: FunctionReference[]; | ||
}; | ||
declare const SessionKeyPlugin_: { | ||
@@ -9,5 +22,3 @@ meta: { | ||
version: string; | ||
addresses: { | ||
11155111: `0x${string}`; | ||
}; | ||
addresses: Record<number, `0x${string}`>; | ||
}; | ||
@@ -27,2 +38,3 @@ accountMethods: (account: IMSCA<any, any>) => { | ||
updateSessionKeys: ({ args, }: GetFunctionArgs<typeof SessionKeyPluginExecutionFunctionAbi, 'updateSessionKeys'>, overrides?: UserOperationOverrides) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
installSessionKeyPlugin: (params: InstallSessionKeyPluginParams, overrides?: UserOperationOverrides) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
}; | ||
@@ -29,0 +41,0 @@ }; |
@@ -0,1 +1,4 @@ | ||
import { encodePacked, encodeAbiParameters } from 'viem'; | ||
import { installPlugin as installPlugin_ } from '../../plugin-manager/installPlugin.js'; | ||
import { MultiOwnerPlugin } from '../multi-owner/plugin.js'; | ||
import { encodeFunctionData } from 'viem'; | ||
@@ -71,2 +74,31 @@ const SessionKeyPlugin_ = { | ||
}, | ||
installSessionKeyPlugin: (params, overrides) => { | ||
const chain = provider.rpcClient.chain; | ||
const dependencies = params.dependencyOverrides ?? [ | ||
(() => { | ||
const pluginAddress = MultiOwnerPlugin.meta.addresses[chain.id]; | ||
if (!pluginAddress) { | ||
throw new Error('missing MultiOwnerPlugin address for chain ' + chain.name); | ||
} | ||
return encodePacked(['address', 'uint8'], [pluginAddress, 0x0]); | ||
})(), | ||
(() => { | ||
const pluginAddress = MultiOwnerPlugin.meta.addresses[chain.id]; | ||
if (!pluginAddress) { | ||
throw new Error('missing MultiOwnerPlugin address for chain ' + chain.name); | ||
} | ||
return encodePacked(['address', 'uint8'], [pluginAddress, 0x1]); | ||
})(), | ||
]; | ||
const pluginAddress = params.pluginAddress ?? | ||
SessionKeyPlugin_.meta.addresses[chain.id]; | ||
if (!pluginAddress) { | ||
throw new Error('missing SessionKeyPlugin address for chain ' + chain.name); | ||
} | ||
return installPlugin_(provider, { | ||
pluginAddress, | ||
pluginInitData: encodeAbiParameters([{ type: 'address[]', name: 'initialPublicKeys' }], params.args), | ||
dependencies, | ||
}, overrides); | ||
}, | ||
}), | ||
@@ -73,0 +105,0 @@ }; |
@@ -1,5 +0,15 @@ | ||
import { type GetFunctionArgs } from 'viem'; | ||
import { encodeAbiParameters } from 'viem'; | ||
import type { InjectedHook } from '../../plugin-manager/types.js'; | ||
import type { FunctionReference } from '../../account-loupe/types.js'; | ||
import { type Address, type GetFunctionArgs } from 'viem'; | ||
import type { Plugin } from '../types'; | ||
import type { IMSCA } from '../../types'; | ||
import type { ISmartAccountProvider, SupportedTransports, UserOperationOverrides } from '@alchemy/aa-core'; | ||
type InstallArgs = []; | ||
export type InstallTokenReceiverPluginParams = { | ||
args: Parameters<typeof encodeAbiParameters<InstallArgs>>[1]; | ||
pluginAddress?: Address; | ||
injectedHooks?: InjectedHook[]; | ||
dependencyOverrides?: FunctionReference[]; | ||
}; | ||
declare const TokenReceiverPlugin_: { | ||
@@ -9,5 +19,3 @@ meta: { | ||
version: string; | ||
addresses: { | ||
11155111: `0x${string}`; | ||
}; | ||
addresses: Record<number, `0x${string}`>; | ||
}; | ||
@@ -27,2 +35,3 @@ accountMethods: (_account: IMSCA<any, any>) => { | ||
onErc1155BatchReceived: ({ args, }: GetFunctionArgs<typeof TokenReceiverPluginExecutionFunctionAbi, 'onERC1155BatchReceived'>, overrides?: UserOperationOverrides) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
installTokenReceiverPlugin: (params: InstallTokenReceiverPluginParams, overrides?: UserOperationOverrides) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
}; | ||
@@ -29,0 +38,0 @@ }; |
@@ -0,1 +1,3 @@ | ||
import { encodeAbiParameters } from 'viem'; | ||
import { installPlugin as installPlugin_ } from '../../plugin-manager/installPlugin.js'; | ||
import { encodeFunctionData } from 'viem'; | ||
@@ -73,2 +75,16 @@ const TokenReceiverPlugin_ = { | ||
}, | ||
installTokenReceiverPlugin: (params, overrides) => { | ||
const chain = provider.rpcClient.chain; | ||
const dependencies = params.dependencyOverrides ?? []; | ||
const pluginAddress = params.pluginAddress ?? | ||
TokenReceiverPlugin_.meta.addresses[chain.id]; | ||
if (!pluginAddress) { | ||
throw new Error('missing TokenReceiverPlugin address for chain ' + chain.name); | ||
} | ||
return installPlugin_(provider, { | ||
pluginAddress, | ||
pluginInitData: encodeAbiParameters([], params.args), | ||
dependencies, | ||
}, overrides); | ||
}, | ||
}), | ||
@@ -75,0 +91,0 @@ }; |
@@ -142,2 +142,20 @@ import { type SupportedTransports } from "@alchemy/aa-core"; | ||
}> | undefined) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
installMultiOwnerPlugin: (params: import("./plugins/multi-owner/plugin.js").InstallMultiOwnerPluginParams, overrides?: Partial<{ | ||
callGasLimit: number | bigint | `0x${string}` | { | ||
percentage: number; | ||
} | undefined; | ||
maxFeePerGas: number | bigint | `0x${string}` | { | ||
percentage: number; | ||
} | undefined; | ||
maxPriorityFeePerGas: number | bigint | `0x${string}` | { | ||
percentage: number; | ||
} | undefined; | ||
preVerificationGas: number | bigint | `0x${string}` | { | ||
percentage: number; | ||
} | undefined; | ||
verificationGasLimit: number | bigint | `0x${string}` | { | ||
percentage: number; | ||
} | undefined; | ||
paymasterAndData: import("@alchemy/aa-core").BytesLike; | ||
}> | undefined) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
}> & { | ||
@@ -144,0 +162,0 @@ encodeUpdateOwnersData: ({ args, }: { |
@@ -1,5 +0,17 @@ | ||
import { type GetFunctionArgs } from 'viem'; | ||
import { encodeAbiParameters } from 'viem'; | ||
import type { InjectedHook } from '../../plugin-manager/types.js'; | ||
import type { FunctionReference } from '../../account-loupe/types.js'; | ||
import { type Address, type GetFunctionArgs } from 'viem'; | ||
import type { Plugin } from '../types'; | ||
import type { IMSCA } from '../../types'; | ||
import type { ISmartAccountProvider, SupportedTransports, UserOperationOverrides } from '@alchemy/aa-core'; | ||
type InstallArgs = [{ | ||
type: 'address[]'; | ||
}]; | ||
export type InstallMultiOwnerPluginParams = { | ||
args: Parameters<typeof encodeAbiParameters<InstallArgs>>[1]; | ||
pluginAddress?: Address; | ||
injectedHooks?: InjectedHook[]; | ||
dependencyOverrides?: FunctionReference[]; | ||
}; | ||
declare const MultiOwnerPlugin_: { | ||
@@ -9,5 +21,3 @@ meta: { | ||
version: string; | ||
addresses: { | ||
11155111: `0x${string}`; | ||
}; | ||
addresses: Record<number, `0x${string}`>; | ||
}; | ||
@@ -29,2 +39,3 @@ accountMethods: (account: IMSCA<any, any>) => { | ||
updateOwners: ({ args, }: GetFunctionArgs<typeof MultiOwnerPluginExecutionFunctionAbi, 'updateOwners'>, overrides?: UserOperationOverrides) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
installMultiOwnerPlugin: (params: InstallMultiOwnerPluginParams, overrides?: UserOperationOverrides) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
}; | ||
@@ -31,0 +42,0 @@ }; |
@@ -1,5 +0,18 @@ | ||
import { type GetFunctionArgs } from 'viem'; | ||
import { encodeAbiParameters } from 'viem'; | ||
import type { InjectedHook } from '../../plugin-manager/types.js'; | ||
import type { FunctionReference } from '../../account-loupe/types.js'; | ||
import { type Address, type GetFunctionArgs } from 'viem'; | ||
import type { Plugin } from '../types'; | ||
import type { IMSCA } from '../../types'; | ||
import type { ISmartAccountProvider, SupportedTransports, UserOperationOverrides } from '@alchemy/aa-core'; | ||
type InstallArgs = [{ | ||
type: 'address[]'; | ||
name: 'initialPublicKeys'; | ||
}]; | ||
export type InstallSessionKeyPluginParams = { | ||
args: Parameters<typeof encodeAbiParameters<InstallArgs>>[1]; | ||
pluginAddress?: Address; | ||
injectedHooks?: InjectedHook[]; | ||
dependencyOverrides?: FunctionReference[]; | ||
}; | ||
declare const SessionKeyPlugin_: { | ||
@@ -9,5 +22,3 @@ meta: { | ||
version: string; | ||
addresses: { | ||
11155111: `0x${string}`; | ||
}; | ||
addresses: Record<number, `0x${string}`>; | ||
}; | ||
@@ -27,2 +38,3 @@ accountMethods: (account: IMSCA<any, any>) => { | ||
updateSessionKeys: ({ args, }: GetFunctionArgs<typeof SessionKeyPluginExecutionFunctionAbi, 'updateSessionKeys'>, overrides?: UserOperationOverrides) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
installSessionKeyPlugin: (params: InstallSessionKeyPluginParams, overrides?: UserOperationOverrides) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
}; | ||
@@ -29,0 +41,0 @@ }; |
@@ -1,5 +0,15 @@ | ||
import { type GetFunctionArgs } from 'viem'; | ||
import { encodeAbiParameters } from 'viem'; | ||
import type { InjectedHook } from '../../plugin-manager/types.js'; | ||
import type { FunctionReference } from '../../account-loupe/types.js'; | ||
import { type Address, type GetFunctionArgs } from 'viem'; | ||
import type { Plugin } from '../types'; | ||
import type { IMSCA } from '../../types'; | ||
import type { ISmartAccountProvider, SupportedTransports, UserOperationOverrides } from '@alchemy/aa-core'; | ||
type InstallArgs = []; | ||
export type InstallTokenReceiverPluginParams = { | ||
args: Parameters<typeof encodeAbiParameters<InstallArgs>>[1]; | ||
pluginAddress?: Address; | ||
injectedHooks?: InjectedHook[]; | ||
dependencyOverrides?: FunctionReference[]; | ||
}; | ||
declare const TokenReceiverPlugin_: { | ||
@@ -9,5 +19,3 @@ meta: { | ||
version: string; | ||
addresses: { | ||
11155111: `0x${string}`; | ||
}; | ||
addresses: Record<number, `0x${string}`>; | ||
}; | ||
@@ -27,2 +35,3 @@ accountMethods: (_account: IMSCA<any, any>) => { | ||
onErc1155BatchReceived: ({ args, }: GetFunctionArgs<typeof TokenReceiverPluginExecutionFunctionAbi, 'onERC1155BatchReceived'>, overrides?: UserOperationOverrides) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
installTokenReceiverPlugin: (params: InstallTokenReceiverPluginParams, overrides?: UserOperationOverrides) => Promise<import("@alchemy/aa-core").SendUserOperationResult>; | ||
}; | ||
@@ -29,0 +38,0 @@ }; |
{ | ||
"name": "@alchemy/aa-accounts", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "A collection of ERC-4337 compliant smart contract account interfaces", | ||
@@ -64,3 +64,3 @@ "author": "Alchemy", | ||
"homepage": "https://github.com/alchemyplatform/aa-sdk#readme", | ||
"gitHead": "6ecde1b7b163eb54e5b70eababa710aab29bd55d", | ||
"gitHead": "6ce7e52712aac7f1d98f201bab658c89b6e85424", | ||
"dependencies": { | ||
@@ -67,0 +67,0 @@ "@alchemy/aa-core": "^2.0.0", |
@@ -179,3 +179,3 @@ import { | ||
fromHex(storage, "number") !== 0 && | ||
implementationAddresses.some((x) => x === trim(storage)) | ||
!implementationAddresses.some((x) => x === trim(storage)) | ||
) { | ||
@@ -182,0 +182,0 @@ throw new Error( |
@@ -0,1 +1,5 @@ | ||
import { encodeAbiParameters } from "viem"; | ||
import { installPlugin as installPlugin_ } from "../../plugin-manager/installPlugin.js"; | ||
import type { InjectedHook } from "../../plugin-manager/types.js"; | ||
import type { FunctionReference } from "../../account-loupe/types.js"; | ||
import { type Address, type GetFunctionArgs, encodeFunctionData } from "viem"; | ||
@@ -14,2 +18,10 @@ import type { Plugin } from "../types"; | ||
type InstallArgs = [{ type: "address[]" }]; | ||
export type InstallMultiOwnerPluginParams = { | ||
args: Parameters<typeof encodeAbiParameters<InstallArgs>>[1]; | ||
pluginAddress?: Address; | ||
injectedHooks?: InjectedHook[]; | ||
dependencyOverrides?: FunctionReference[]; | ||
}; | ||
const MultiOwnerPlugin_ = { | ||
@@ -21,3 +33,3 @@ meta: { | ||
11155111: "0x56bC629F342821FBe91C5273880792dFECBE7920" as Address, | ||
}, | ||
} as Record<number, Address>, | ||
}, | ||
@@ -147,2 +159,32 @@ accountMethods: (account: IMSCA<any, any>) => ({ | ||
}, | ||
installMultiOwnerPlugin: ( | ||
params: InstallMultiOwnerPluginParams, | ||
overrides?: UserOperationOverrides | ||
) => { | ||
const chain = provider.rpcClient.chain; | ||
const dependencies = params.dependencyOverrides ?? []; | ||
const pluginAddress = | ||
params.pluginAddress ?? | ||
(MultiOwnerPlugin_.meta.addresses[chain.id] as Address | undefined); | ||
if (!pluginAddress) { | ||
throw new Error( | ||
"missing MultiOwnerPlugin address for chain " + chain.name | ||
); | ||
} | ||
return installPlugin_( | ||
provider, | ||
{ | ||
pluginAddress, | ||
pluginInitData: encodeAbiParameters( | ||
[{ type: "address[]" }], | ||
params.args | ||
), | ||
dependencies, | ||
}, | ||
overrides | ||
); | ||
}, | ||
}), | ||
@@ -149,0 +191,0 @@ }; |
@@ -0,1 +1,6 @@ | ||
import { encodePacked, encodeAbiParameters } from "viem"; | ||
import { installPlugin as installPlugin_ } from "../../plugin-manager/installPlugin.js"; | ||
import type { InjectedHook } from "../../plugin-manager/types.js"; | ||
import type { FunctionReference } from "../../account-loupe/types.js"; | ||
import { MultiOwnerPlugin } from "../multi-owner/plugin.js"; | ||
import { type Address, type GetFunctionArgs, encodeFunctionData } from "viem"; | ||
@@ -14,2 +19,10 @@ import type { Plugin } from "../types"; | ||
type InstallArgs = [{ type: "address[]"; name: "initialPublicKeys" }]; | ||
export type InstallSessionKeyPluginParams = { | ||
args: Parameters<typeof encodeAbiParameters<InstallArgs>>[1]; | ||
pluginAddress?: Address; | ||
injectedHooks?: InjectedHook[]; | ||
dependencyOverrides?: FunctionReference[]; | ||
}; | ||
const SessionKeyPlugin_ = { | ||
@@ -21,3 +34,3 @@ meta: { | ||
11155111: "0x60ae6D5887a67E18afDfA5786A8598464C123A07" as Address, | ||
}, | ||
} as Record<number, Address>, | ||
}, | ||
@@ -136,2 +149,54 @@ accountMethods: (account: IMSCA<any, any>) => ({ | ||
}, | ||
installSessionKeyPlugin: ( | ||
params: InstallSessionKeyPluginParams, | ||
overrides?: UserOperationOverrides | ||
) => { | ||
const chain = provider.rpcClient.chain; | ||
const dependencies = params.dependencyOverrides ?? [ | ||
(() => { | ||
const pluginAddress = MultiOwnerPlugin.meta.addresses[chain.id]; | ||
if (!pluginAddress) { | ||
throw new Error( | ||
"missing MultiOwnerPlugin address for chain " + chain.name | ||
); | ||
} | ||
return encodePacked(["address", "uint8"], [pluginAddress, 0x0]); | ||
})(), | ||
(() => { | ||
const pluginAddress = MultiOwnerPlugin.meta.addresses[chain.id]; | ||
if (!pluginAddress) { | ||
throw new Error( | ||
"missing MultiOwnerPlugin address for chain " + chain.name | ||
); | ||
} | ||
return encodePacked(["address", "uint8"], [pluginAddress, 0x1]); | ||
})(), | ||
]; | ||
const pluginAddress = | ||
params.pluginAddress ?? | ||
(SessionKeyPlugin_.meta.addresses[chain.id] as Address | undefined); | ||
if (!pluginAddress) { | ||
throw new Error( | ||
"missing SessionKeyPlugin address for chain " + chain.name | ||
); | ||
} | ||
return installPlugin_( | ||
provider, | ||
{ | ||
pluginAddress, | ||
pluginInitData: encodeAbiParameters( | ||
[{ type: "address[]", name: "initialPublicKeys" }], | ||
params.args | ||
), | ||
dependencies, | ||
}, | ||
overrides | ||
); | ||
}, | ||
}), | ||
@@ -138,0 +203,0 @@ }; |
@@ -0,1 +1,5 @@ | ||
import { encodeAbiParameters } from "viem"; | ||
import { installPlugin as installPlugin_ } from "../../plugin-manager/installPlugin.js"; | ||
import type { InjectedHook } from "../../plugin-manager/types.js"; | ||
import type { FunctionReference } from "../../account-loupe/types.js"; | ||
import { type Address, type GetFunctionArgs, encodeFunctionData } from "viem"; | ||
@@ -14,2 +18,10 @@ import type { Plugin } from "../types"; | ||
type InstallArgs = []; | ||
export type InstallTokenReceiverPluginParams = { | ||
args: Parameters<typeof encodeAbiParameters<InstallArgs>>[1]; | ||
pluginAddress?: Address; | ||
injectedHooks?: InjectedHook[]; | ||
dependencyOverrides?: FunctionReference[]; | ||
}; | ||
const TokenReceiverPlugin_ = { | ||
@@ -21,3 +33,3 @@ meta: { | ||
11155111: "0xa81C0AEaB22b21b4da8d8728063f6570384b48C9" as Address, | ||
}, | ||
} as Record<number, Address>, | ||
}, | ||
@@ -156,2 +168,29 @@ accountMethods: (_account: IMSCA<any, any>) => ({ | ||
}, | ||
installTokenReceiverPlugin: ( | ||
params: InstallTokenReceiverPluginParams, | ||
overrides?: UserOperationOverrides | ||
) => { | ||
const chain = provider.rpcClient.chain; | ||
const dependencies = params.dependencyOverrides ?? []; | ||
const pluginAddress = | ||
params.pluginAddress ?? | ||
(TokenReceiverPlugin_.meta.addresses[chain.id] as Address | undefined); | ||
if (!pluginAddress) { | ||
throw new Error( | ||
"missing TokenReceiverPlugin address for chain " + chain.name | ||
); | ||
} | ||
return installPlugin_( | ||
provider, | ||
{ | ||
pluginAddress, | ||
pluginInitData: encodeAbiParameters([], params.args), | ||
dependencies, | ||
}, | ||
overrides | ||
); | ||
}, | ||
}), | ||
@@ -158,0 +197,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1975307
36350