@account-kit/smart-contracts 4.0.0-alpha.1 → 4.0.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/plugindefs/multi-owner/config.js +16 -17
- package/dist/cjs/plugindefs/multi-owner/config.js.map +1 -1
- package/dist/cjs/plugindefs/multisig/config.js +15 -15
- package/dist/cjs/plugindefs/multisig/config.js.map +1 -1
- package/dist/cjs/plugindefs/session-key/config.js +17 -17
- package/dist/cjs/plugindefs/session-key/config.js.map +1 -1
- package/dist/cjs/src/index.d.ts +1 -1
- package/dist/cjs/src/index.js +4 -3
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/light-account/accounts/account.d.ts +5 -6
- package/dist/cjs/src/light-account/accounts/account.js +3 -2
- package/dist/cjs/src/light-account/accounts/account.js.map +1 -1
- package/dist/cjs/src/light-account/accounts/base.d.ts +7 -6
- package/dist/cjs/src/light-account/accounts/base.js +8 -8
- package/dist/cjs/src/light-account/accounts/base.js.map +1 -1
- package/dist/cjs/src/light-account/accounts/multiOwner.d.ts +5 -5
- package/dist/cjs/src/light-account/accounts/multiOwner.js +3 -2
- package/dist/cjs/src/light-account/accounts/multiOwner.js.map +1 -1
- package/dist/cjs/src/light-account/clients/alchemyClient.d.ts +1 -1
- package/dist/cjs/src/light-account/clients/alchemyClient.js.map +1 -1
- package/dist/cjs/src/light-account/clients/client.d.ts +1 -2
- package/dist/cjs/src/light-account/clients/client.js +3 -3
- package/dist/cjs/src/light-account/clients/client.js.map +1 -1
- package/dist/cjs/src/light-account/clients/multiOwnerAlchemyClient.d.ts +2 -2
- package/dist/cjs/src/light-account/clients/multiOwnerAlchemyClient.js.map +1 -1
- package/dist/cjs/src/light-account/clients/multiOwnerLightAccount.d.ts +1 -2
- package/dist/cjs/src/light-account/clients/multiOwnerLightAccount.js +3 -3
- package/dist/cjs/src/light-account/clients/multiOwnerLightAccount.js.map +1 -1
- package/dist/cjs/src/light-account/decorators/lightAccount.js.map +1 -1
- package/dist/cjs/src/light-account/decorators/multiOwnerLightAccount.js.map +1 -1
- package/dist/cjs/src/light-account/types.d.ts +23 -31
- package/dist/cjs/src/light-account/types.js.map +1 -1
- package/dist/cjs/src/light-account/utils.d.ts +7 -10
- package/dist/cjs/src/light-account/utils.js +59 -87
- package/dist/cjs/src/light-account/utils.js.map +1 -1
- package/dist/cjs/src/msca/client/alchemyClient.d.ts +1 -1
- package/dist/cjs/src/msca/client/alchemyClient.js.map +1 -1
- package/dist/cjs/src/msca/client/client.d.ts +2 -6
- package/dist/cjs/src/msca/client/client.js +6 -6
- package/dist/cjs/src/msca/client/client.js.map +1 -1
- package/dist/cjs/src/msca/client/multiSigAlchemyClient.d.ts +1 -1
- package/dist/cjs/src/msca/client/multiSigAlchemyClient.js +1 -1
- package/dist/cjs/src/msca/client/multiSigAlchemyClient.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/middleware.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/utils/formatSignatures.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts +3 -2
- package/dist/cjs/src/msca/plugins/multisig/utils/splitAggregatedSignature.js.map +1 -1
- package/dist/cjs/src/msca/plugins/session-key/permissions.js.map +1 -1
- package/dist/cjs/src/msca/plugins/session-key/signer.js.map +1 -1
- package/dist/cjs/src/msca/utils.js +11 -10
- package/dist/cjs/src/msca/utils.js.map +1 -1
- package/dist/esm/plugindefs/multi-owner/config.js +1 -2
- package/dist/esm/plugindefs/multi-owner/config.js.map +1 -1
- package/dist/esm/plugindefs/multisig/config.js +1 -1
- package/dist/esm/plugindefs/multisig/config.js.map +1 -1
- package/dist/esm/plugindefs/session-key/config.js +1 -1
- package/dist/esm/plugindefs/session-key/config.js.map +1 -1
- package/dist/esm/src/index.d.ts +1 -1
- package/dist/esm/src/index.js +1 -1
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/light-account/accounts/account.d.ts +5 -6
- package/dist/esm/src/light-account/accounts/account.js +3 -2
- package/dist/esm/src/light-account/accounts/account.js.map +1 -1
- package/dist/esm/src/light-account/accounts/base.d.ts +7 -6
- package/dist/esm/src/light-account/accounts/base.js +8 -8
- package/dist/esm/src/light-account/accounts/base.js.map +1 -1
- package/dist/esm/src/light-account/accounts/multiOwner.d.ts +5 -5
- package/dist/esm/src/light-account/accounts/multiOwner.js +4 -3
- package/dist/esm/src/light-account/accounts/multiOwner.js.map +1 -1
- package/dist/esm/src/light-account/clients/alchemyClient.d.ts +1 -1
- package/dist/esm/src/light-account/clients/alchemyClient.js.map +1 -1
- package/dist/esm/src/light-account/clients/client.d.ts +1 -2
- package/dist/esm/src/light-account/clients/client.js +3 -3
- package/dist/esm/src/light-account/clients/client.js.map +1 -1
- package/dist/esm/src/light-account/clients/multiOwnerAlchemyClient.d.ts +2 -2
- package/dist/esm/src/light-account/clients/multiOwnerAlchemyClient.js.map +1 -1
- package/dist/esm/src/light-account/clients/multiOwnerLightAccount.d.ts +1 -2
- package/dist/esm/src/light-account/clients/multiOwnerLightAccount.js +3 -3
- package/dist/esm/src/light-account/clients/multiOwnerLightAccount.js.map +1 -1
- package/dist/esm/src/light-account/decorators/lightAccount.js.map +1 -1
- package/dist/esm/src/light-account/decorators/multiOwnerLightAccount.js.map +1 -1
- package/dist/esm/src/light-account/types.d.ts +23 -31
- package/dist/esm/src/light-account/types.js.map +1 -1
- package/dist/esm/src/light-account/utils.d.ts +7 -10
- package/dist/esm/src/light-account/utils.js +57 -84
- package/dist/esm/src/light-account/utils.js.map +1 -1
- package/dist/esm/src/msca/client/alchemyClient.d.ts +1 -1
- package/dist/esm/src/msca/client/alchemyClient.js.map +1 -1
- package/dist/esm/src/msca/client/client.d.ts +2 -6
- package/dist/esm/src/msca/client/client.js +6 -6
- package/dist/esm/src/msca/client/client.js.map +1 -1
- package/dist/esm/src/msca/client/multiSigAlchemyClient.d.ts +1 -1
- package/dist/esm/src/msca/client/multiSigAlchemyClient.js +1 -1
- package/dist/esm/src/msca/client/multiSigAlchemyClient.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/middleware.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/utils/formatSignatures.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts +3 -2
- package/dist/esm/src/msca/plugins/multisig/utils/splitAggregatedSignature.js.map +1 -1
- package/dist/esm/src/msca/plugins/session-key/permissions.js.map +1 -1
- package/dist/esm/src/msca/plugins/session-key/signer.js.map +1 -1
- package/dist/esm/src/msca/utils.js +2 -1
- package/dist/esm/src/msca/utils.js.map +1 -1
- package/dist/types/plugindefs/multi-owner/config.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/light-account/accounts/account.d.ts +5 -6
- package/dist/types/src/light-account/accounts/account.d.ts.map +1 -1
- package/dist/types/src/light-account/accounts/base.d.ts +7 -6
- package/dist/types/src/light-account/accounts/base.d.ts.map +1 -1
- package/dist/types/src/light-account/accounts/multiOwner.d.ts +5 -5
- package/dist/types/src/light-account/accounts/multiOwner.d.ts.map +1 -1
- package/dist/types/src/light-account/clients/alchemyClient.d.ts +1 -1
- package/dist/types/src/light-account/clients/alchemyClient.d.ts.map +1 -1
- package/dist/types/src/light-account/clients/client.d.ts +1 -2
- package/dist/types/src/light-account/clients/client.d.ts.map +1 -1
- package/dist/types/src/light-account/clients/multiOwnerAlchemyClient.d.ts +2 -2
- package/dist/types/src/light-account/clients/multiOwnerAlchemyClient.d.ts.map +1 -1
- package/dist/types/src/light-account/clients/multiOwnerLightAccount.d.ts +1 -2
- package/dist/types/src/light-account/clients/multiOwnerLightAccount.d.ts.map +1 -1
- package/dist/types/src/light-account/decorators/lightAccount.d.ts +1 -1
- package/dist/types/src/light-account/decorators/multiOwnerLightAccount.d.ts +1 -1
- package/dist/types/src/light-account/types.d.ts +23 -118
- package/dist/types/src/light-account/types.d.ts.map +1 -1
- package/dist/types/src/light-account/utils.d.ts +19 -48
- package/dist/types/src/light-account/utils.d.ts.map +1 -1
- package/dist/types/src/msca/client/alchemyClient.d.ts +1 -1
- package/dist/types/src/msca/client/alchemyClient.d.ts.map +1 -1
- package/dist/types/src/msca/client/client.d.ts +2 -6
- package/dist/types/src/msca/client/client.d.ts.map +1 -1
- package/dist/types/src/msca/client/multiSigAlchemyClient.d.ts +1 -1
- package/dist/types/src/msca/client/multiSigAlchemyClient.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multisig/middleware.d.ts +6 -6
- package/dist/types/src/msca/plugins/multisig/utils/formatSignatures.d.ts +3 -3
- package/dist/types/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts +13 -12
- package/dist/types/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/session-key/permissions.d.ts +147 -1
- package/dist/types/src/msca/plugins/session-key/permissions.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/session-key/signer.d.ts +71 -1
- package/dist/types/src/msca/plugins/session-key/signer.d.ts.map +1 -1
- package/dist/types/src/msca/utils.d.ts +6 -6
- package/dist/types/src/msca/utils.d.ts.map +1 -1
- package/package.json +7 -6
- package/plugindefs/multi-owner/config.ts +1 -2
- package/plugindefs/multisig/config.ts +1 -1
- package/plugindefs/session-key/config.ts +1 -1
- package/src/index.ts +2 -1
- package/src/light-account/accounts/account.ts +24 -45
- package/src/light-account/accounts/base.ts +39 -68
- package/src/light-account/accounts/multiOwner.ts +29 -43
- package/src/light-account/clients/alchemyClient.ts +2 -2
- package/src/light-account/clients/client.ts +8 -13
- package/src/light-account/clients/multiOwnerAlchemyClient.ts +3 -3
- package/src/light-account/clients/multiOwnerLightAccount.ts +11 -13
- package/src/light-account/decorators/lightAccount.ts +1 -1
- package/src/light-account/decorators/multiOwnerLightAccount.ts +1 -1
- package/src/light-account/types.ts +31 -188
- package/src/light-account/utils.ts +91 -246
- package/src/msca/client/alchemyClient.ts +2 -2
- package/src/msca/client/client.ts +24 -36
- package/src/msca/client/multiSigAlchemyClient.ts +5 -5
- package/src/msca/plugins/multisig/middleware.ts +6 -6
- package/src/msca/plugins/multisig/utils/formatSignatures.ts +3 -3
- package/src/msca/plugins/multisig/utils/splitAggregatedSignature.ts +15 -12
- package/src/msca/plugins/session-key/permissions.ts +147 -1
- package/src/msca/plugins/session-key/signer.ts +71 -1
- package/src/msca/utils.ts +15 -13
- package/dist/cjs/src/light-account/e2e-tests/constants.d.ts +0 -6
- package/dist/cjs/src/light-account/e2e-tests/constants.js +0 -10
- package/dist/cjs/src/light-account/e2e-tests/constants.js.map +0 -1
- package/dist/cjs/src/light-account/schema.d.ts +0 -21
- package/dist/cjs/src/light-account/schema.js +0 -30
- package/dist/cjs/src/light-account/schema.js.map +0 -1
- package/dist/esm/src/light-account/e2e-tests/constants.d.ts +0 -6
- package/dist/esm/src/light-account/e2e-tests/constants.js +0 -7
- package/dist/esm/src/light-account/e2e-tests/constants.js.map +0 -1
- package/dist/esm/src/light-account/schema.d.ts +0 -21
- package/dist/esm/src/light-account/schema.js +0 -27
- package/dist/esm/src/light-account/schema.js.map +0 -1
- package/dist/types/src/light-account/e2e-tests/constants.d.ts +0 -7
- package/dist/types/src/light-account/e2e-tests/constants.d.ts.map +0 -1
- package/dist/types/src/light-account/schema.d.ts +0 -22
- package/dist/types/src/light-account/schema.d.ts.map +0 -1
- package/src/light-account/e2e-tests/constants.ts +0 -8
- package/src/light-account/schema.ts +0 -39
|
@@ -7,7 +7,7 @@ const MultiOwnerLightAccountAbi_js_1 = require("../abis/MultiOwnerLightAccountAb
|
|
|
7
7
|
const MultiOwnerLightAccountFactoryAbi_js_1 = require("../abis/MultiOwnerLightAccountFactoryAbi.js");
|
|
8
8
|
const utils_js_1 = require("../utils.js");
|
|
9
9
|
const base_js_1 = require("./base.js");
|
|
10
|
-
async function createMultiOwnerLightAccount({ transport, chain, signer, initCode, version = (0, utils_js_1.defaultLightAccountVersion)(
|
|
10
|
+
async function createMultiOwnerLightAccount({ transport, chain, signer, initCode, version = (0, utils_js_1.defaultLightAccountVersion)(), entryPoint = (0, core_1.getEntryPoint)(chain, {
|
|
11
11
|
version: "0.7.0",
|
|
12
12
|
}), accountAddress, factoryAddress = (0, utils_js_1.getDefaultMultiOwnerLightAccountFactoryAddress)(chain, version), salt: salt_ = 0n, owners = [], }) {
|
|
13
13
|
const client = (0, core_1.createBundlerClient)({
|
|
@@ -45,7 +45,8 @@ async function createMultiOwnerLightAccount({ transport, chain, signer, initCode
|
|
|
45
45
|
chain,
|
|
46
46
|
signer,
|
|
47
47
|
abi: MultiOwnerLightAccountAbi_js_1.MultiOwnerLightAccountAbi,
|
|
48
|
-
version
|
|
48
|
+
version,
|
|
49
|
+
type: "MultiOwnerLightAccount",
|
|
49
50
|
entryPoint,
|
|
50
51
|
accountAddress: address,
|
|
51
52
|
getAccountInitCode,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiOwner.js","sourceRoot":"","sources":["../../../../../src/light-account/accounts/multiOwner.ts"],"names":[],"mappings":";;;AAAA,uCAMsB;AACtB,+BAQc;AACd,uFAAiF;AACjF,qGAA+F;AAK/F,
|
|
1
|
+
{"version":3,"file":"multiOwner.js","sourceRoot":"","sources":["../../../../../src/light-account/accounts/multiOwner.ts"],"names":[],"mappings":";;;AAAA,uCAMsB;AACtB,+BAQc;AACd,uFAAiF;AACjF,qGAA+F;AAK/F,0CAGqB;AACrB,uCAImB;AAkFZ,KAAK,UAAU,4BAA4B,CAAC,EACjD,SAAS,EACT,KAAK,EACL,MAAM,EACN,QAAQ,EACR,OAAO,GAAG,IAAA,qCAA0B,GAAE,EACtC,UAAU,GAAG,IAAA,oBAAa,EAAC,KAAK,EAAE;IAChC,OAAO,EAAE,OAAO;CACjB,CAAC,EACF,cAAc,EACd,cAAc,GAAG,IAAA,yDAA8C,EAC7D,KAAK,EACL,OAAO,CACR,EACD,IAAI,EAAE,KAAK,GAAG,EAAE,EAChB,MAAM,GAAG,EAAE,GACwB;IACnC,MAAM,MAAM,GAAG,IAAA,0BAAmB,EAAC;QACjC,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,MAAM,kBAAkB,GAAG,KAAK,IAAI,EAAE;QACpC,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC;QAG9B,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;QAE/C,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;aAC3D,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,kBAAW,EAAC,CAAC,CAAC,KAAK,EAAE,CAAC;aACpC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACb,MAAM,OAAO,GAAG,IAAA,kBAAW,EAAC,CAAC,CAAC,CAAC;YAC/B,MAAM,OAAO,GAAG,IAAA,kBAAW,EAAC,CAAC,CAAC,CAAC;YAE/B,OAAO,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;QAEL,OAAO,IAAA,gBAAS,EAAC;YACf,cAAc;YACd,IAAA,yBAAkB,EAAC;gBACjB,GAAG,EAAE,sEAAgC;gBACrC,YAAY,EAAE,eAAe;gBAC7B,IAAI,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC;aACvB,CAAC;SACH,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,MAAM,IAAA,wBAAiB,EAAC;QACtC,MAAM;QACN,UAAU;QACV,cAAc;QACd,kBAAkB;KACnB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,IAAA,gCAAsB,EAK1C;QACA,SAAS;QACT,KAAK;QACL,MAAM;QACN,GAAG,EAAE,wDAAyB;QAC9B,OAAO;QACP,IAAI,EAAE,wBAAwB;QAC9B,UAAU;QACV,cAAc,EAAE,OAAO;QACvB,kBAAkB;KACnB,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,OAAO;QACV,kBAAkB,EAAE,CAAC,WAAsB,EAAE,cAAyB,EAAE,EAAE;YACxE,OAAO,IAAA,yBAAkB,EAAC;gBACxB,GAAG,EAAE,wDAAyB;gBAC9B,YAAY,EAAE,cAAc;gBAC5B,IAAI,EAAE,CAAC,WAAW,EAAE,cAAc,CAAC;aACpC,CAAC,CAAC;QACL,CAAC;QACD,KAAK,CAAC,iBAAiB;YACrB,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC;gBAC3C,OAAO;gBACP,GAAG,EAAE,wDAAyB;gBAC9B,YAAY,EAAE,QAAQ;aACvB,CAAC,CAAC;YAEH,IAAI,UAAU,IAAI,IAAI,EAAE,CAAC;gBACvB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;YACnD,CAAC;YAED,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;gBACpD,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;YACzE,CAAC;YAED,OAAO,UAAU,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC;AAlGD,oEAkGC","sourcesContent":["import {\n createBundlerClient,\n getAccountAddress,\n getEntryPoint,\n type EntryPointDef,\n type SmartAccountSigner,\n} from \"@aa-sdk/core\";\nimport {\n concatHex,\n encodeFunctionData,\n hexToBigInt,\n type Address,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { MultiOwnerLightAccountAbi } from \"../abis/MultiOwnerLightAccountAbi.js\";\nimport { MultiOwnerLightAccountFactoryAbi } from \"../abis/MultiOwnerLightAccountFactoryAbi.js\";\nimport type {\n LightAccountEntryPointVersion,\n LightAccountVersion,\n} from \"../types.js\";\nimport {\n defaultLightAccountVersion,\n getDefaultMultiOwnerLightAccountFactoryAddress,\n} from \"../utils.js\";\nimport {\n createLightAccountBase,\n type CreateLightAccountBaseParams,\n type LightAccountBase,\n} from \"./base.js\";\n\nexport type MultiOwnerLightAccount<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends LightAccountVersion<\"MultiOwnerLightAccount\"> = LightAccountVersion<\"MultiOwnerLightAccount\">\n> = LightAccountBase<\n TSigner,\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n> & {\n encodeUpdateOwners: (\n ownersToAdd: Address[],\n ownersToRemove: Address[]\n ) => Hex;\n getOwnerAddresses: () => Promise<readonly Address[]>;\n};\n\nexport type CreateMultiOwnerLightAccountParams<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends LightAccountVersion<\"MultiOwnerLightAccount\"> = LightAccountVersion<\"MultiOwnerLightAccount\">\n> = Omit<\n CreateLightAccountBaseParams<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion,\n TTransport,\n TSigner\n >,\n | \"getAccountInitCode\"\n | \"entryPoint\"\n | \"version\"\n | \"abi\"\n | \"accountAddress\"\n | \"type\"\n> & {\n salt?: bigint;\n initCode?: Hex;\n accountAddress?: Address;\n factoryAddress?: Address;\n version?: TLightAccountVersion;\n entryPoint?: EntryPointDef<\n LightAccountEntryPointVersion<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n >,\n Chain\n >;\n owners?: Address[];\n};\n\nexport async function createMultiOwnerLightAccount<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends LightAccountVersion<\"MultiOwnerLightAccount\"> = LightAccountVersion<\"MultiOwnerLightAccount\">\n>(\n config: CreateMultiOwnerLightAccountParams<\n TTransport,\n TSigner,\n TLightAccountVersion\n >\n): Promise<MultiOwnerLightAccount<TSigner, TLightAccountVersion>>;\n\n/**\n * Creates a multi-owner light account using the provided parameters, including transport, chain, signer, initialization code, version, account address, factory address, salt, and owners. Ensures the owners list is deduplicated, ordered, and valid.\n *\n * @example\n * ```ts\n * import { createMultiOwnerLightAccount } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n * import { http, generatePrivateKey } from \"viem\"\n *\n * const account = await createMultiOwnerLightAccount({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {CreateMultiOwnerLightAccountParams} config The parameters for creating a multi-owner light account\n * @returns {Promise<MultiOwnerLightAccount>} A promise that resolves to a `MultiOwnerLightAccount` object containing the created account information and methods\n */\nexport async function createMultiOwnerLightAccount({\n transport,\n chain,\n signer,\n initCode,\n version = defaultLightAccountVersion(),\n entryPoint = getEntryPoint(chain, {\n version: \"0.7.0\",\n }),\n accountAddress,\n factoryAddress = getDefaultMultiOwnerLightAccountFactoryAddress(\n chain,\n version\n ),\n salt: salt_ = 0n,\n owners = [],\n}: CreateMultiOwnerLightAccountParams): Promise<MultiOwnerLightAccount> {\n const client = createBundlerClient({\n transport,\n chain,\n });\n\n const getAccountInitCode = async () => {\n if (initCode) return initCode;\n\n // NOTE: the current signer connected will be one of the owners as well\n const ownerAddress = await signer.getAddress();\n // owners need to be dedupe + ordered in ascending order and not == to zero address\n const owners_ = Array.from(new Set([...owners, ownerAddress]))\n .filter((x) => hexToBigInt(x) !== 0n)\n .sort((a, b) => {\n const bigintA = hexToBigInt(a);\n const bigintB = hexToBigInt(b);\n\n return bigintA < bigintB ? -1 : bigintA > bigintB ? 1 : 0;\n });\n\n return concatHex([\n factoryAddress,\n encodeFunctionData({\n abi: MultiOwnerLightAccountFactoryAbi,\n functionName: \"createAccount\",\n args: [owners_, salt_],\n }),\n ]);\n };\n\n const address = await getAccountAddress({\n client,\n entryPoint,\n accountAddress,\n getAccountInitCode,\n });\n\n const account = await createLightAccountBase<\n \"MultiOwnerLightAccount\",\n LightAccountVersion<\"MultiOwnerLightAccount\">,\n Transport,\n SmartAccountSigner\n >({\n transport,\n chain,\n signer,\n abi: MultiOwnerLightAccountAbi,\n version,\n type: \"MultiOwnerLightAccount\",\n entryPoint,\n accountAddress: address,\n getAccountInitCode,\n });\n\n return {\n ...account,\n encodeUpdateOwners: (ownersToAdd: Address[], ownersToRemove: Address[]) => {\n return encodeFunctionData({\n abi: MultiOwnerLightAccountAbi,\n functionName: \"updateOwners\",\n args: [ownersToAdd, ownersToRemove],\n });\n },\n async getOwnerAddresses(): Promise<readonly Address[]> {\n const callResult = await client.readContract({\n address,\n abi: MultiOwnerLightAccountAbi,\n functionName: \"owners\",\n });\n\n if (callResult == null) {\n throw new Error(\"could not get on-chain owners\");\n }\n\n if (!callResult.includes(await signer.getAddress())) {\n throw new Error(\"on-chain owners does not include the current signer\");\n }\n\n return callResult;\n },\n };\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
|
|
1
2
|
import { type AlchemySmartAccountClient, type AlchemySmartAccountClientConfig } from "@account-kit/infra";
|
|
2
3
|
import { type CreateLightAccountParams, type LightAccount, type LightAccountClientActions } from "@account-kit/smart-contracts";
|
|
3
|
-
import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
|
|
4
4
|
import { type Chain, type CustomTransport, type Transport } from "viem";
|
|
5
5
|
export type AlchemyLightAccountClientConfig<TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateLightAccountParams<HttpTransport, TSigner>, "transport" | "chain"> & Omit<AlchemySmartAccountClientConfig<Transport, Chain, LightAccount<TSigner>>, "account">;
|
|
6
6
|
export declare function createLightAccountAlchemyClient<TSigner extends SmartAccountSigner = SmartAccountSigner>(params: AlchemyLightAccountClientConfig<TSigner>): Promise<AlchemySmartAccountClient<CustomTransport, Chain | undefined, LightAccount<TSigner>, LightAccountClientActions<TSigner>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alchemyClient.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/alchemyClient.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"alchemyClient.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/alchemyClient.ts"],"names":[],"mappings":";;;AACA,8CAM4B;AAC5B,kEAMsC;AACtC,+BAAgF;AA8CzE,KAAK,UAAU,+BAA+B,CACnD,MAAuC;IAEvC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,gBAAgB,EAAE,GACxC,mCAA2B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAG,IAAA,oCAA4B,EAAC;QAC1C,KAAK;QACL,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,IAAA,oCAAkB,EAAC;QACvC,SAAS,EAAE,IAAA,aAAM,EAAC,MAAM,CAAC;QACzB,GAAG,MAAM;KACV,CAAC,CAAC;IAEH,OAAO,IAAA,mDAA2C,EAAC;QACjD,GAAG,MAAM;QACT,MAAM;QACN,OAAO;QACP,IAAI;KACL,CAAC,CAAC,MAAM,CAAC,2CAAyB,CAAC,CAAC;AACvC,CAAC;AAtBD,0EAsBC","sourcesContent":["import type { HttpTransport, SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n AlchemyProviderConfigSchema,\n createAlchemyPublicRpcClient,\n createAlchemySmartAccountClientFromExisting,\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n createLightAccount,\n lightAccountClientActions,\n type CreateLightAccountParams,\n type LightAccount,\n type LightAccountClientActions,\n} from \"@account-kit/smart-contracts\";\nimport { custom, type Chain, type CustomTransport, type Transport } from \"viem\";\n\nexport type AlchemyLightAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateLightAccountParams<HttpTransport, TSigner>,\n \"transport\" | \"chain\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<Transport, Chain, LightAccount<TSigner>>,\n \"account\"\n >;\n\nexport async function createLightAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyLightAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n CustomTransport,\n Chain | undefined,\n LightAccount<TSigner>,\n LightAccountClientActions<TSigner>\n >\n>;\n\n/**\n * Creates an Alchemy smart account client connected to a Light Account instance.\n *\n * @example\n * ```ts\n * import { createLightAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n * import { sepolia } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const lightAccountClient = await createLightAccountAlchemyClient({\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {AlchemyLightAccountClientConfig} config The configuration for setting up the Alchemy Light Account Client\n * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` object containing the created client\n */\nexport async function createLightAccountAlchemyClient(\n config: AlchemyLightAccountClientConfig\n): Promise<AlchemySmartAccountClient> {\n const { chain, opts, ...connectionConfig } =\n AlchemyProviderConfigSchema.parse(config);\n\n const client = createAlchemyPublicRpcClient({\n chain,\n connectionConfig,\n });\n\n const account = await createLightAccount({\n transport: custom(client),\n ...config,\n });\n\n return createAlchemySmartAccountClientFromExisting({\n ...config,\n client,\n account,\n opts,\n }).extend(lightAccountClientActions);\n}\n"]}
|
|
@@ -5,6 +5,5 @@ import { type LightAccountClientActions } from "../decorators/lightAccount.js";
|
|
|
5
5
|
export type CreateLightAccountClientParams<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner> = {
|
|
6
6
|
transport: CreateLightAccountParams<TTransport, TSigner>["transport"];
|
|
7
7
|
chain: CreateLightAccountParams<TTransport, TSigner>["chain"];
|
|
8
|
-
|
|
9
|
-
} & Omit<SmartAccountClientConfig<TTransport, TChain>, "transport" | "account" | "chain">;
|
|
8
|
+
} & Omit<CreateLightAccountParams<TTransport, TSigner>, "transport" | "chain"> & Omit<SmartAccountClientConfig<TTransport, TChain>, "transport" | "account" | "chain">;
|
|
10
9
|
export declare function createLightAccountClient<TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner>(args: CreateLightAccountClientParams<Transport, TChain, TSigner>): Promise<SmartAccountClient<CustomTransport, Chain, LightAccount<TSigner>, SmartAccountClientActions<Chain, SmartContractAccount> & LightAccountClientActions<TSigner, LightAccount<TSigner>>>>;
|
|
@@ -5,14 +5,14 @@ const core_1 = require("@aa-sdk/core");
|
|
|
5
5
|
const account_js_1 = require("../accounts/account.js");
|
|
6
6
|
const lightAccount_js_1 = require("../decorators/lightAccount.js");
|
|
7
7
|
async function createLightAccountClient(params) {
|
|
8
|
-
const {
|
|
8
|
+
const { transport, chain } = params;
|
|
9
9
|
const lightAccount = await (0, account_js_1.createLightAccount)({
|
|
10
|
-
...
|
|
10
|
+
...params,
|
|
11
11
|
transport,
|
|
12
12
|
chain,
|
|
13
13
|
});
|
|
14
14
|
return (0, core_1.createSmartAccountClient)({
|
|
15
|
-
...
|
|
15
|
+
...params,
|
|
16
16
|
transport,
|
|
17
17
|
chain: chain,
|
|
18
18
|
account: lightAccount,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/client.ts"],"names":[],"mappings":";;;AAAA,uCAOsB;AAEtB,uDAIgC;AAChC,mEAGuC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/client.ts"],"names":[],"mappings":";;;AAAA,uCAOsB;AAEtB,uDAIgC;AAChC,mEAGuC;AAkDhC,KAAK,UAAU,wBAAwB,CAC5C,MAAsC;IAEtC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAEpC,MAAM,YAAY,GAAG,MAAM,IAAA,+BAAkB,EAAC;QAC5C,GAAG,MAAM;QACT,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,OAAO,IAAA,+BAAwB,EAAC;QAC9B,GAAG,MAAM;QACT,SAAS;QACT,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,YAAY;KACtB,CAAC,CAAC,MAAM,CAAC,2CAAyB,CAAC,CAAC;AACvC,CAAC;AAjBD,4DAiBC","sourcesContent":["import {\n createSmartAccountClient,\n type SmartAccountClient,\n type SmartAccountClientActions,\n type SmartAccountClientConfig,\n type SmartAccountSigner,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport { type Chain, type CustomTransport, type Transport } from \"viem\";\nimport {\n createLightAccount,\n type CreateLightAccountParams,\n type LightAccount,\n} from \"../accounts/account.js\";\nimport {\n lightAccountClientActions,\n type LightAccountClientActions,\n} from \"../decorators/lightAccount.js\";\n\nexport type CreateLightAccountClientParams<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = {\n transport: CreateLightAccountParams<TTransport, TSigner>[\"transport\"];\n chain: CreateLightAccountParams<TTransport, TSigner>[\"chain\"];\n} & Omit<CreateLightAccountParams<TTransport, TSigner>, \"transport\" | \"chain\"> &\n Omit<\n SmartAccountClientConfig<TTransport, TChain>,\n \"transport\" | \"account\" | \"chain\"\n >;\n\nexport function createLightAccountClient<\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n args: CreateLightAccountClientParams<Transport, TChain, TSigner>\n): Promise<\n SmartAccountClient<\n CustomTransport,\n Chain,\n LightAccount<TSigner>,\n SmartAccountClientActions<Chain, SmartContractAccount> &\n LightAccountClientActions<TSigner, LightAccount<TSigner>>\n >\n>;\n\n/**\n * Creates a light account client using the provided parameters, including account information, transport mechanism, blockchain chain, and additional client configurations. This function first creates a light account and then uses it to create a smart account client, extending it with light account client actions.\n *\n * @example\n * ```ts\n * import { createLightAccountClient } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n * import { http, generatePrivateKey } from \"viem\"\n *\n * const account = await createLightAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {CreateLightAccountClientParams} params The parameters for creating a light account client\n * @returns {Promise<SmartAccountClient>} A promise that resolves to a `SmartAccountClient` object containing the created account information and methods\n */\nexport async function createLightAccountClient(\n params: CreateLightAccountClientParams\n): Promise<SmartAccountClient> {\n const { transport, chain } = params;\n\n const lightAccount = await createLightAccount({\n ...params,\n transport,\n chain,\n });\n\n return createSmartAccountClient({\n ...params,\n transport,\n chain: chain,\n account: lightAccount,\n }).extend(lightAccountClientActions);\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
|
|
1
2
|
import { type AlchemySmartAccountClient, type AlchemySmartAccountClientConfig } from "@account-kit/infra";
|
|
2
3
|
import { type CreateMultiOwnerLightAccountParams, type MultiOwnerLightAccount, type MultiOwnerLightAccountClientActions } from "@account-kit/smart-contracts";
|
|
3
|
-
import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
|
|
4
4
|
import { type Chain, type CustomTransport, type Transport } from "viem";
|
|
5
|
-
export type AlchemyMultiOwnerLightAccountClientConfig<TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultiOwnerLightAccountParams<HttpTransport, TSigner>, "transport" | "chain"> & Omit<AlchemySmartAccountClientConfig<Transport, Chain, MultiOwnerLightAccount<TSigner>>, "account">;
|
|
5
|
+
export type AlchemyMultiOwnerLightAccountClientConfig<TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultiOwnerLightAccountParams<HttpTransport, TSigner>, "transport" | "chain" | "type"> & Omit<AlchemySmartAccountClientConfig<Transport, Chain, MultiOwnerLightAccount<TSigner>>, "account">;
|
|
6
6
|
export declare function createMultiOwnerLightAccountAlchemyClient<TSigner extends SmartAccountSigner = SmartAccountSigner>(params: AlchemyMultiOwnerLightAccountClientConfig<TSigner>): Promise<AlchemySmartAccountClient<CustomTransport, Chain | undefined, MultiOwnerLightAccount<TSigner>, MultiOwnerLightAccountClientActions<TSigner>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiOwnerAlchemyClient.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/multiOwnerAlchemyClient.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"multiOwnerAlchemyClient.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/multiOwnerAlchemyClient.ts"],"names":[],"mappings":";;;AACA,8CAM4B;AAC5B,kEAMsC;AACtC,+BAAgF;AAkDzE,KAAK,UAAU,yCAAyC,CAC7D,MAAiD;IAEjD,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,gBAAgB,EAAE,GACxC,mCAA2B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAG,IAAA,oCAA4B,EAAC;QAC1C,KAAK;QACL,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,IAAA,8CAA4B,EAAC;QACjD,SAAS,EAAE,IAAA,aAAM,EAAC,MAAM,CAAC;QACzB,GAAG,MAAM;KACV,CAAC,CAAC;IAEH,OAAO,IAAA,mDAA2C,EAAC;QACjD,GAAG,MAAM;QACT,MAAM;QACN,OAAO;QACP,IAAI;KACL,CAAC,CAAC,MAAM,CAAC,qDAAmC,CAAC,CAAC;AACjD,CAAC;AAtBD,8FAsBC","sourcesContent":["import type { HttpTransport, SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n AlchemyProviderConfigSchema,\n createAlchemyPublicRpcClient,\n createAlchemySmartAccountClientFromExisting,\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n createMultiOwnerLightAccount,\n multiOwnerLightAccountClientActions,\n type CreateMultiOwnerLightAccountParams,\n type MultiOwnerLightAccount,\n type MultiOwnerLightAccountClientActions,\n} from \"@account-kit/smart-contracts\";\nimport { custom, type Chain, type CustomTransport, type Transport } from \"viem\";\n\nexport type AlchemyMultiOwnerLightAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateMultiOwnerLightAccountParams<HttpTransport, TSigner>,\n \"transport\" | \"chain\" | \"type\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<\n Transport,\n Chain,\n MultiOwnerLightAccount<TSigner>\n >,\n \"account\"\n >;\n\nexport async function createMultiOwnerLightAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyMultiOwnerLightAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n CustomTransport,\n Chain | undefined,\n MultiOwnerLightAccount<TSigner>,\n MultiOwnerLightAccountClientActions<TSigner>\n >\n>;\n\n/**\n * Creates a multi-owner light account Alchemy client using the provided configuration.\n *\n * @example\n * ```ts\n * import { createMultiOwnerLightAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n * import { sepolia } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const lightAccountClient = await createMultiOwnerLightAccountAlchemyClient({\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {AlchemyMultiOwnerLightAccountClientConfig} config The configuration for creating the Alchemy client\n * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` object containing the created account information and methods\n */\nexport async function createMultiOwnerLightAccountAlchemyClient(\n config: AlchemyMultiOwnerLightAccountClientConfig\n): Promise<AlchemySmartAccountClient> {\n const { chain, opts, ...connectionConfig } =\n AlchemyProviderConfigSchema.parse(config);\n\n const client = createAlchemyPublicRpcClient({\n chain,\n connectionConfig,\n });\n\n const account = await createMultiOwnerLightAccount({\n transport: custom(client),\n ...config,\n });\n\n return createAlchemySmartAccountClientFromExisting({\n ...config,\n client,\n account,\n opts,\n }).extend(multiOwnerLightAccountClientActions);\n}\n"]}
|
|
@@ -5,6 +5,5 @@ import { type MultiOwnerLightAccountClientActions } from "../decorators/multiOwn
|
|
|
5
5
|
export type CreateMultiOwnerLightAccountClientParams<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner> = {
|
|
6
6
|
transport: CreateMultiOwnerLightAccountParams<TTransport, TSigner>["transport"];
|
|
7
7
|
chain: CreateMultiOwnerLightAccountParams<TTransport, TSigner>["chain"];
|
|
8
|
-
|
|
9
|
-
} & Omit<SmartAccountClientConfig<TTransport, TChain>, "transport" | "account" | "chain">;
|
|
8
|
+
} & Omit<CreateMultiOwnerLightAccountParams<TTransport, TSigner>, "transport" | "chain"> & Omit<SmartAccountClientConfig<TTransport, TChain>, "transport" | "account" | "chain">;
|
|
10
9
|
export declare function createMultiOwnerLightAccountClient<TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner>(args: CreateMultiOwnerLightAccountClientParams<Transport, TChain, TSigner>): Promise<SmartAccountClient<CustomTransport, Chain, MultiOwnerLightAccount<TSigner>, SmartAccountClientActions<Chain, SmartContractAccount> & MultiOwnerLightAccountClientActions<TSigner, MultiOwnerLightAccount<TSigner>>>>;
|
|
@@ -5,14 +5,14 @@ const core_1 = require("@aa-sdk/core");
|
|
|
5
5
|
const multiOwner_js_1 = require("../accounts/multiOwner.js");
|
|
6
6
|
const multiOwnerLightAccount_js_1 = require("../decorators/multiOwnerLightAccount.js");
|
|
7
7
|
async function createMultiOwnerLightAccountClient(params) {
|
|
8
|
-
const {
|
|
8
|
+
const { transport, chain } = params;
|
|
9
9
|
const lightAccount = await (0, multiOwner_js_1.createMultiOwnerLightAccount)({
|
|
10
|
-
...
|
|
10
|
+
...params,
|
|
11
11
|
transport,
|
|
12
12
|
chain,
|
|
13
13
|
});
|
|
14
14
|
return (0, core_1.createSmartAccountClient)({
|
|
15
|
-
...
|
|
15
|
+
...params,
|
|
16
16
|
transport,
|
|
17
17
|
chain: chain,
|
|
18
18
|
account: lightAccount,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiOwnerLightAccount.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/multiOwnerLightAccount.ts"],"names":[],"mappings":";;;AAAA,uCAOsB;AAEtB,6DAImC;AACnC,uFAGiD;
|
|
1
|
+
{"version":3,"file":"multiOwnerLightAccount.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/multiOwnerLightAccount.ts"],"names":[],"mappings":";;;AAAA,uCAOsB;AAEtB,6DAImC;AACnC,uFAGiD;AA2D1C,KAAK,UAAU,kCAAkC,CACtD,MAAgD;IAEhD,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAEpC,MAAM,YAAY,GAAG,MAAM,IAAA,4CAA4B,EAAC;QACtD,GAAG,MAAM;QACT,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,OAAO,IAAA,+BAAwB,EAAC;QAC9B,GAAG,MAAM;QACT,SAAS;QACT,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,YAAY;KACtB,CAAC,CAAC,MAAM,CAAC,+DAAmC,CAAC,CAAC;AACjD,CAAC;AAjBD,gFAiBC","sourcesContent":["import {\n createSmartAccountClient,\n type SmartAccountClient,\n type SmartAccountClientActions,\n type SmartAccountClientConfig,\n type SmartAccountSigner,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport { type Chain, type CustomTransport, type Transport } from \"viem\";\nimport {\n createMultiOwnerLightAccount,\n type CreateMultiOwnerLightAccountParams,\n type MultiOwnerLightAccount,\n} from \"../accounts/multiOwner.js\";\nimport {\n multiOwnerLightAccountClientActions,\n type MultiOwnerLightAccountClientActions,\n} from \"../decorators/multiOwnerLightAccount.js\";\n\nexport type CreateMultiOwnerLightAccountClientParams<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = {\n transport: CreateMultiOwnerLightAccountParams<\n TTransport,\n TSigner\n >[\"transport\"];\n chain: CreateMultiOwnerLightAccountParams<TTransport, TSigner>[\"chain\"];\n} & Omit<\n CreateMultiOwnerLightAccountParams<TTransport, TSigner>,\n \"transport\" | \"chain\"\n> &\n Omit<\n SmartAccountClientConfig<TTransport, TChain>,\n \"transport\" | \"account\" | \"chain\"\n >;\n\nexport function createMultiOwnerLightAccountClient<\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n args: CreateMultiOwnerLightAccountClientParams<Transport, TChain, TSigner>\n): Promise<\n SmartAccountClient<\n CustomTransport,\n Chain,\n MultiOwnerLightAccount<TSigner>,\n SmartAccountClientActions<Chain, SmartContractAccount> &\n MultiOwnerLightAccountClientActions<\n TSigner,\n MultiOwnerLightAccount<TSigner>\n >\n >\n>;\n\n/**\n * Creates a multi-owner light account client using the provided parameters. It first creates a multi-owner light account and then creates a smart account client with the provided configurations.\n *\n * @example\n * ```ts\n * import { createMultiOwnerLightAccountClient } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n * import { http, generatePrivateKey } from \"viem\"\n *\n * const account = await createMultiOwnerLightAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {CreateMultiOwnerLightAccountClientParams} params the configuration for creating the multi-owner light account client\n * @returns {Promise<SmartAccountClient>} a promise that resolves to a `SmartAccountClient` containing the created account client and relevant methods\n */\nexport async function createMultiOwnerLightAccountClient(\n params: CreateMultiOwnerLightAccountClientParams\n): Promise<SmartAccountClient> {\n const { transport, chain } = params;\n\n const lightAccount = await createMultiOwnerLightAccount({\n ...params,\n transport,\n chain,\n });\n\n return createSmartAccountClient({\n ...params,\n transport,\n chain: chain,\n account: lightAccount,\n }).extend(multiOwnerLightAccountClientActions);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lightAccount.js","sourceRoot":"","sources":["../../../../../src/light-account/decorators/lightAccount.ts"],"names":[],"mappings":";;;AAGA,0EAGyC;AAgClC,MAAM,yBAAyB,GASc,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC/D,iBAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAA,wCAAiB,EAAC,MAAM,EAAE,IAAI,CAAC;CACnE,CAAC,CAAC;AAXU,QAAA,yBAAyB,6BAWnC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { LightAccount } from \"../accounts/account\";\nimport {\n transferOwnership,\n type TransferLightAccountOwnershipParams,\n} from \"../actions/transferOwnership.js\";\n\nexport type LightAccountClientActions<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends LightAccount<TSigner> | undefined =\n | LightAccount<TSigner>\n | undefined\n> = {\n transferOwnership: (\n args: TransferLightAccountOwnershipParams<TSigner, TAccount>\n ) => Promise<Hex>;\n};\n\n/**\n * Provides a set of actions for managing a light account client, including transferring ownership.\n *\n * @example\n * ```ts\n * import { lightAccountClientActions, createLightAccount } from \"@account-kit/smart-contracts\";\n * import { createAlchemySmartAccountClient } from \"@account-kit/infra\";\n * import { sepolia } from \"@account-kit/infra
|
|
1
|
+
{"version":3,"file":"lightAccount.js","sourceRoot":"","sources":["../../../../../src/light-account/decorators/lightAccount.ts"],"names":[],"mappings":";;;AAGA,0EAGyC;AAgClC,MAAM,yBAAyB,GASc,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC/D,iBAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAA,wCAAiB,EAAC,MAAM,EAAE,IAAI,CAAC;CACnE,CAAC,CAAC;AAXU,QAAA,yBAAyB,6BAWnC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { LightAccount } from \"../accounts/account\";\nimport {\n transferOwnership,\n type TransferLightAccountOwnershipParams,\n} from \"../actions/transferOwnership.js\";\n\nexport type LightAccountClientActions<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends LightAccount<TSigner> | undefined =\n | LightAccount<TSigner>\n | undefined\n> = {\n transferOwnership: (\n args: TransferLightAccountOwnershipParams<TSigner, TAccount>\n ) => Promise<Hex>;\n};\n\n/**\n * Provides a set of actions for managing a light account client, including transferring ownership.\n *\n * @example\n * ```ts\n * import { lightAccountClientActions, createLightAccount } from \"@account-kit/smart-contracts\";\n * import { createAlchemySmartAccountClient } from \"@account-kit/infra\";\n * import { sepolia } from \"@account-kit/infra\";\n *\n * const smartAccountClient = createAlchemySmartAccountClient({\n * account: await createLightAccount(...),\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * }).extend(lightAccountClientActions);\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client instance for which to provide the light account actions\n * @returns {LightAccountClientActions<TSigner, TAccount>} An object containing the available light account client actions\n */\nexport const lightAccountClientActions: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends LightAccount<TSigner> | undefined =\n | LightAccount<TSigner>\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n) => LightAccountClientActions<TSigner, TAccount> = (client) => ({\n transferOwnership: async (args) => transferOwnership(client, args),\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiOwnerLightAccount.js","sourceRoot":"","sources":["../../../../../src/light-account/decorators/multiOwnerLightAccount.ts"],"names":[],"mappings":";;;AAGA,gEAGoC;AAgC7B,MAAM,mCAAmC,GASc,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAA,8BAAY,EAAC,MAAM,EAAE,IAAI,CAAC;CACzD,CAAC,CAAC;AAXU,QAAA,mCAAmC,uCAW7C","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { MultiOwnerLightAccount } from \"../accounts/multiOwner\";\nimport {\n updateOwners,\n type UpdateMultiOwnerLightAccountOwnersParams,\n} from \"../actions/updateOwners.js\";\n\nexport type MultiOwnerLightAccountClientActions<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends MultiOwnerLightAccount<TSigner> | undefined =\n | MultiOwnerLightAccount<TSigner>\n | undefined\n> = {\n updateOwners: (\n args: UpdateMultiOwnerLightAccountOwnersParams<TSigner, TAccount>\n ) => Promise<Hex>;\n};\n\n/**\n * Generates client actions for a multi-owner light account, including the ability to update owners.\n *\n * @example\n * ```ts\n * import { multiOwnerLightAccountClientActions, createMultiOwnerLightAccount } from \"@account-kit/smart-contracts\";\n * import { createAlchemySmartAccountClient } from \"@account-kit/infra\";\n * import { sepolia } from \"@account-kit/infra
|
|
1
|
+
{"version":3,"file":"multiOwnerLightAccount.js","sourceRoot":"","sources":["../../../../../src/light-account/decorators/multiOwnerLightAccount.ts"],"names":[],"mappings":";;;AAGA,gEAGoC;AAgC7B,MAAM,mCAAmC,GASc,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAA,8BAAY,EAAC,MAAM,EAAE,IAAI,CAAC;CACzD,CAAC,CAAC;AAXU,QAAA,mCAAmC,uCAW7C","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { MultiOwnerLightAccount } from \"../accounts/multiOwner\";\nimport {\n updateOwners,\n type UpdateMultiOwnerLightAccountOwnersParams,\n} from \"../actions/updateOwners.js\";\n\nexport type MultiOwnerLightAccountClientActions<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends MultiOwnerLightAccount<TSigner> | undefined =\n | MultiOwnerLightAccount<TSigner>\n | undefined\n> = {\n updateOwners: (\n args: UpdateMultiOwnerLightAccountOwnersParams<TSigner, TAccount>\n ) => Promise<Hex>;\n};\n\n/**\n * Generates client actions for a multi-owner light account, including the ability to update owners.\n *\n * @example\n * ```ts\n * import { multiOwnerLightAccountClientActions, createMultiOwnerLightAccount } from \"@account-kit/smart-contracts\";\n * import { createAlchemySmartAccountClient } from \"@account-kit/infra\";\n * import { sepolia } from \"@account-kit/infra\";\n *\n * const smartAccountClient = createAlchemySmartAccountClient({\n * account: await createMultiOwnerLightAccount(...),\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * }).extend(multiOwnerLightAccountClientActions);\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client the client for interacting with the multi-owner light account\n * @returns {MultiOwnerLightAccountClientActions<TSigner, TAccount>} an object containing the client actions specifically for a multi-owner light account\n */\nexport const multiOwnerLightAccountClientActions: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends MultiOwnerLightAccount<TSigner> | undefined =\n | MultiOwnerLightAccount<TSigner>\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n) => MultiOwnerLightAccountClientActions<TSigner, TAccount> = (client) => ({\n updateOwners: async (args) => updateOwners(client, args),\n});\n"]}
|
|
@@ -1,39 +1,31 @@
|
|
|
1
|
-
import { type EntryPointVersion
|
|
1
|
+
import { type EntryPointVersion } from "@aa-sdk/core";
|
|
2
2
|
import { type Address, type Chain } from "viem";
|
|
3
3
|
import type { LightAccountBase } from "./accounts/base";
|
|
4
|
-
export type LightAccountType =
|
|
5
|
-
export type
|
|
6
|
-
type: TLightAccountType;
|
|
7
|
-
version: TLightAccountVersion;
|
|
4
|
+
export type LightAccountType = "LightAccount" | "MultiOwnerLightAccount";
|
|
5
|
+
export type LightAccountVersionConfig<TEntryPointVersion extends EntryPointVersion = EntryPointVersion> = {
|
|
8
6
|
entryPointVersion: TEntryPointVersion;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
addresses: {
|
|
8
|
+
default: {
|
|
9
|
+
factory: Address;
|
|
10
|
+
impl: Address;
|
|
11
|
+
};
|
|
12
|
+
overrides?: Record<Chain["id"], {
|
|
13
|
+
factory: Address;
|
|
14
|
+
impl: Address;
|
|
15
|
+
}>;
|
|
16
|
+
};
|
|
13
17
|
};
|
|
14
|
-
export type
|
|
15
|
-
export type GetLightAccountVersion<TLightAccountType extends LightAccountType = LightAccountType> = keyof IAccountVersionRegistry[TLightAccountType];
|
|
16
|
-
export type LightAccountVersionDef<TLightAccountType extends LightAccountType = LightAccountType, TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>> = IAccountVersionRegistry[TLightAccountType][TLightAccountVersion];
|
|
17
|
-
export interface IAccountVersionRegistry {
|
|
18
|
+
export type LightAccountVersionConfigs = {
|
|
18
19
|
LightAccount: {
|
|
19
|
-
"v1.0.1":
|
|
20
|
-
"v1.0.2":
|
|
21
|
-
"v1.1.0":
|
|
22
|
-
"v2.0.0":
|
|
20
|
+
"v1.0.1": LightAccountVersionConfig<"0.6.0">;
|
|
21
|
+
"v1.0.2": LightAccountVersionConfig<"0.6.0">;
|
|
22
|
+
"v1.1.0": LightAccountVersionConfig<"0.6.0">;
|
|
23
|
+
"v2.0.0": LightAccountVersionConfig<"0.7.0">;
|
|
23
24
|
};
|
|
24
25
|
MultiOwnerLightAccount: {
|
|
25
|
-
"v2.0.0":
|
|
26
|
+
"v2.0.0": LightAccountVersionConfig<"0.7.0">;
|
|
26
27
|
};
|
|
27
|
-
}
|
|
28
|
-
export type
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export type GetLightAccountVersionDef<TType extends LightAccountType, TLightAccountVersion extends GetLightAccountVersion<TType>> = IAccountVersionRegistry[TType][TLightAccountVersion];
|
|
32
|
-
export type GetLightAccountVersionDefsForEntryPoint<TType extends LightAccountType, TEntryPointVersion extends EntryPointVersion> = Extract<GetLightAccountVersionDefsForType<TType>, {
|
|
33
|
-
entryPointVersion: TEntryPointVersion;
|
|
34
|
-
}>;
|
|
35
|
-
export type GetLightAccountType<TAccount extends SmartContractAccount | undefined, TAccountOverride extends SmartContractAccount = SmartContractAccount> = GetAccountParameter<TAccount, TAccountOverride> extends LightAccountBase<SmartAccountSigner, infer TLightAccountType> ? OneOf<TLightAccountType, LightAccountType> : LightAccountType;
|
|
36
|
-
export type GetLightAccountVersionFromAccount<TAccount extends LightAccountBase | undefined, TAccountOverride extends LightAccountBase = LightAccountBase> = GetAccountParameter<TAccount, TAccountOverride> extends LightAccountBase<SmartAccountSigner, LightAccountType, infer TLightAccountVersion> ? OneOf<TLightAccountVersion, LightAccountVersion> : LightAccountVersion;
|
|
37
|
-
export type GetEntryPointForLightAccountVersion<TLightAccountType extends LightAccountType = LightAccountType, TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>> = GetLightAccountVersionDef<TLightAccountType, TLightAccountVersion> extends AccountVersionDef<TLightAccountType, TLightAccountVersion, infer TEntryPointVersion> ? TEntryPointVersion : EntryPointVersion;
|
|
38
|
-
export type GetLightAccountTypesForVersion<TLightAccountVersion extends LightAccountVersion = LightAccountVersion> = TLightAccountVersion extends GetLightAccountVersion<infer TLightAccountType> ? TLightAccountType : LightAccountType;
|
|
39
|
-
export type GetDefaultLightAccountVersion<TLightAccountType extends LightAccountType = LightAccountType> = TLightAccountType extends "MultiOwnerLightAccount" ? "v2.0.0" & LightAccountVersion : "v1.1.0" & LightAccountVersion;
|
|
28
|
+
};
|
|
29
|
+
export type LightAccountVersion<TAccountType extends LightAccountType> = keyof LightAccountVersionConfigs[TAccountType];
|
|
30
|
+
export type GetLightAccountType<TAccount extends LightAccountBase> = TAccount["source"] extends LightAccountType ? TAccount["source"] : never;
|
|
31
|
+
export type LightAccountEntryPointVersion<TLightAccountType extends LightAccountType, TLightAccountVersion extends LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>> = LightAccountVersionConfigs[TLightAccountType][TLightAccountVersion] extends LightAccountVersionConfig ? LightAccountVersionConfigs[TLightAccountType][TLightAccountVersion]["entryPointVersion"] : never;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/light-account/types.ts"],"names":[],"mappings":"","sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/light-account/types.ts"],"names":[],"mappings":"","sourcesContent":["import { type EntryPointVersion } from \"@aa-sdk/core\";\nimport { type Address, type Chain } from \"viem\";\nimport type { LightAccountBase } from \"./accounts/base\";\n\n/**\n * Light account types supported: LightAccount, MultiOwnerLightAccount\n *\n */\nexport type LightAccountType = \"LightAccount\" | \"MultiOwnerLightAccount\";\n\nexport type LightAccountVersionConfig<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = {\n entryPointVersion: TEntryPointVersion;\n addresses: {\n default: {\n factory: Address;\n impl: Address;\n };\n overrides?: Record<\n Chain[\"id\"],\n {\n factory: Address;\n impl: Address;\n }\n >;\n };\n};\n\nexport type LightAccountVersionConfigs = {\n LightAccount: {\n \"v1.0.1\": LightAccountVersionConfig<\"0.6.0\">;\n \"v1.0.2\": LightAccountVersionConfig<\"0.6.0\">;\n \"v1.1.0\": LightAccountVersionConfig<\"0.6.0\">;\n \"v2.0.0\": LightAccountVersionConfig<\"0.7.0\">;\n };\n MultiOwnerLightAccount: {\n \"v2.0.0\": LightAccountVersionConfig<\"0.7.0\">;\n };\n};\n\nexport type LightAccountVersion<TAccountType extends LightAccountType> =\n keyof LightAccountVersionConfigs[TAccountType];\n\nexport type GetLightAccountType<TAccount extends LightAccountBase> =\n TAccount[\"source\"] extends LightAccountType ? TAccount[\"source\"] : never;\n\nexport type LightAccountEntryPointVersion<\n TLightAccountType extends LightAccountType,\n TLightAccountVersion extends LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>\n> = LightAccountVersionConfigs[TLightAccountType][TLightAccountVersion] extends LightAccountVersionConfig\n ? LightAccountVersionConfigs[TLightAccountType][TLightAccountVersion][\"entryPointVersion\"]\n : never;\n"]}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { type Address, type Chain } from "viem";
|
|
2
2
|
import type { LightAccountBase } from "./accounts/base";
|
|
3
|
-
import type {
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const LightAccountUnsupported1271Impls: (AccountVersionDef<"LightAccount", "v1.0.1", "0.6.0"> | AccountVersionDef<"LightAccount", "v1.0.2", "0.6.0">)[];
|
|
3
|
+
import type { LightAccountType, LightAccountVersion, LightAccountVersionConfig, LightAccountVersionConfigs } from "./types";
|
|
4
|
+
export declare const AccountVersionRegistry: LightAccountVersionConfigs;
|
|
5
|
+
export declare const defaultLightAccountVersion: <TLightAccountType extends LightAccountType>() => keyof LightAccountVersionConfigs[TLightAccountType];
|
|
6
|
+
export declare const getDefaultLightAccountFactoryAddress: (chain: Chain, version: LightAccountVersion<"LightAccount">) => Address;
|
|
7
|
+
export declare const getDefaultMultiOwnerLightAccountFactoryAddress: (chain: Chain, version: LightAccountVersion<"MultiOwnerLightAccount">) => `0x${string}`;
|
|
8
|
+
export declare const LightAccountUnsupported1271Impls: LightAccountVersionConfig<"0.6.0">[];
|
|
10
9
|
export declare const LightAccountUnsupported1271Factories: Set<`0x${string}`>;
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function getLightAccountVersionDef<TAccount extends LightAccountBase, TLightAccountType extends GetLightAccountType<TAccount> = GetLightAccountType<TAccount>>(account: TAccount, chain: Chain): Promise<AccountVersionDef<TLightAccountType, GetLightAccountVersion<TLightAccountType>>>;
|
|
13
|
-
export declare function getLightAccountVersion<TAccount extends LightAccountBase, TLightAccountType extends GetLightAccountType<TAccount> = GetLightAccountType<TAccount>>(account: TAccount, chain?: Chain): Promise<GetLightAccountVersion<TLightAccountType>>;
|
|
10
|
+
export declare function getLightAccountVersionForAccount<TAccount extends LightAccountBase>(account: TAccount, chain: Chain): Promise<LightAccountVersionConfig>;
|
|
@@ -1,125 +1,101 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const core_1 = require("@aa-sdk/core");
|
|
3
|
+
exports.getLightAccountVersionForAccount = exports.LightAccountUnsupported1271Factories = exports.LightAccountUnsupported1271Impls = exports.getDefaultMultiOwnerLightAccountFactoryAddress = exports.getDefaultLightAccountFactoryAddress = exports.defaultLightAccountVersion = exports.AccountVersionRegistry = void 0;
|
|
5
4
|
const viem_1 = require("viem");
|
|
6
|
-
exports.supportedChains = [
|
|
7
|
-
core_1.mainnet,
|
|
8
|
-
core_1.sepolia,
|
|
9
|
-
core_1.goerli,
|
|
10
|
-
core_1.polygon,
|
|
11
|
-
core_1.polygonAmoy,
|
|
12
|
-
core_1.polygonMumbai,
|
|
13
|
-
core_1.optimism,
|
|
14
|
-
core_1.optimismGoerli,
|
|
15
|
-
core_1.optimismSepolia,
|
|
16
|
-
core_1.arbitrum,
|
|
17
|
-
core_1.arbitrumGoerli,
|
|
18
|
-
core_1.arbitrumSepolia,
|
|
19
|
-
core_1.base,
|
|
20
|
-
core_1.baseGoerli,
|
|
21
|
-
core_1.baseSepolia,
|
|
22
|
-
core_1.fraxtal,
|
|
23
|
-
core_1.fraxtalSepolia,
|
|
24
|
-
core_1.zora,
|
|
25
|
-
core_1.zoraSepolia,
|
|
26
|
-
];
|
|
27
5
|
exports.AccountVersionRegistry = {
|
|
28
6
|
LightAccount: {
|
|
29
7
|
"v1.0.1": {
|
|
30
|
-
type: "LightAccount",
|
|
31
|
-
version: "v1.0.1",
|
|
32
|
-
address: (0, core_1.toRecord)(exports.supportedChains, "id", () => ({
|
|
33
|
-
factory: "0x000000893A26168158fbeaDD9335Be5bC96592E2".toLowerCase(),
|
|
34
|
-
impl: "0xc1b2fc4197c9187853243e6e4eb5a4af8879a1c0".toLowerCase(),
|
|
35
|
-
})),
|
|
36
8
|
entryPointVersion: "0.6.0",
|
|
9
|
+
addresses: {
|
|
10
|
+
default: {
|
|
11
|
+
factory: "0x000000893A26168158fbeaDD9335Be5bC96592E2".toLowerCase(),
|
|
12
|
+
impl: "0xc1b2fc4197c9187853243e6e4eb5a4af8879a1c0".toLowerCase(),
|
|
13
|
+
},
|
|
14
|
+
},
|
|
37
15
|
},
|
|
38
16
|
"v1.0.2": {
|
|
39
|
-
type: "LightAccount",
|
|
40
|
-
version: "v1.0.2",
|
|
41
|
-
address: (0, core_1.toRecord)(exports.supportedChains, "id", () => ({
|
|
42
|
-
factory: "0x00000055C0b4fA41dde26A74435ff03692292FBD".toLowerCase(),
|
|
43
|
-
impl: "0x5467b1947F47d0646704EB801E075e72aeAe8113".toLowerCase(),
|
|
44
|
-
})),
|
|
45
17
|
entryPointVersion: "0.6.0",
|
|
18
|
+
addresses: {
|
|
19
|
+
default: {
|
|
20
|
+
factory: "0x00000055C0b4fA41dde26A74435ff03692292FBD".toLowerCase(),
|
|
21
|
+
impl: "0x5467b1947F47d0646704EB801E075e72aeAe8113".toLowerCase(),
|
|
22
|
+
},
|
|
23
|
+
},
|
|
46
24
|
},
|
|
47
25
|
"v1.1.0": {
|
|
48
|
-
type: "LightAccount",
|
|
49
|
-
version: "v1.1.0",
|
|
50
|
-
address: (0, core_1.toRecord)(exports.supportedChains, "id", () => ({
|
|
51
|
-
factory: "0x00004EC70002a32400f8ae005A26081065620D20".toLowerCase(),
|
|
52
|
-
impl: "0xae8c656ad28F2B59a196AB61815C16A0AE1c3cba".toLowerCase(),
|
|
53
|
-
})),
|
|
54
26
|
entryPointVersion: "0.6.0",
|
|
27
|
+
addresses: {
|
|
28
|
+
default: {
|
|
29
|
+
factory: "0x00004EC70002a32400f8ae005A26081065620D20".toLowerCase(),
|
|
30
|
+
impl: "0xae8c656ad28F2B59a196AB61815C16A0AE1c3cba".toLowerCase(),
|
|
31
|
+
},
|
|
32
|
+
},
|
|
55
33
|
},
|
|
56
34
|
"v2.0.0": {
|
|
57
|
-
type: "LightAccount",
|
|
58
|
-
version: "v2.0.0",
|
|
59
|
-
address: (0, core_1.toRecord)(exports.supportedChains, "id", () => ({
|
|
60
|
-
factory: "0x0000000000400CdFef5E2714E63d8040b700BC24".toLowerCase(),
|
|
61
|
-
impl: "0x8E8e658E22B12ada97B402fF0b044D6A325013C7".toLowerCase(),
|
|
62
|
-
})),
|
|
63
35
|
entryPointVersion: "0.7.0",
|
|
36
|
+
addresses: {
|
|
37
|
+
default: {
|
|
38
|
+
factory: "0x0000000000400CdFef5E2714E63d8040b700BC24".toLowerCase(),
|
|
39
|
+
impl: "0x8E8e658E22B12ada97B402fF0b044D6A325013C7".toLowerCase(),
|
|
40
|
+
},
|
|
41
|
+
},
|
|
64
42
|
},
|
|
65
43
|
},
|
|
66
44
|
MultiOwnerLightAccount: {
|
|
67
45
|
"v2.0.0": {
|
|
68
|
-
type: "MultiOwnerLightAccount",
|
|
69
|
-
version: "v2.0.0",
|
|
70
|
-
address: (0, core_1.toRecord)(exports.supportedChains, "id", () => ({
|
|
71
|
-
factory: "0x000000000019d2Ee9F2729A65AfE20bb0020AefC".toLowerCase(),
|
|
72
|
-
impl: "0xd2c27F9eE8E4355f71915ffD5568cB3433b6823D".toLowerCase(),
|
|
73
|
-
})),
|
|
74
46
|
entryPointVersion: "0.7.0",
|
|
47
|
+
addresses: {
|
|
48
|
+
default: {
|
|
49
|
+
factory: "0x000000000019d2Ee9F2729A65AfE20bb0020AefC".toLowerCase(),
|
|
50
|
+
impl: "0xd2c27F9eE8E4355f71915ffD5568cB3433b6823D".toLowerCase(),
|
|
51
|
+
},
|
|
52
|
+
},
|
|
75
53
|
},
|
|
76
54
|
},
|
|
77
55
|
};
|
|
78
|
-
const defaultLightAccountVersion = (
|
|
79
|
-
? "v1.1.0"
|
|
80
|
-
: "v2.0.0");
|
|
56
|
+
const defaultLightAccountVersion = () => "v2.0.0";
|
|
81
57
|
exports.defaultLightAccountVersion = defaultLightAccountVersion;
|
|
82
58
|
const getDefaultLightAccountFactoryAddress = (chain, version) => {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
throw new core_1.DefaultFactoryNotDefinedError("LightAccount", chain, "0.6.0");
|
|
87
|
-
return address.factory;
|
|
59
|
+
return (exports.AccountVersionRegistry.LightAccount[version].addresses.overrides?.[chain.id]
|
|
60
|
+
?.factory ??
|
|
61
|
+
exports.AccountVersionRegistry.LightAccount[version].addresses.default.factory);
|
|
88
62
|
};
|
|
89
63
|
exports.getDefaultLightAccountFactoryAddress = getDefaultLightAccountFactoryAddress;
|
|
90
64
|
const getDefaultMultiOwnerLightAccountFactoryAddress = (chain, version) => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return address.factory;
|
|
65
|
+
return (exports.AccountVersionRegistry.MultiOwnerLightAccount[version].addresses
|
|
66
|
+
.overrides?.[chain.id]?.factory ??
|
|
67
|
+
exports.AccountVersionRegistry.MultiOwnerLightAccount[version].addresses.default
|
|
68
|
+
.factory);
|
|
96
69
|
};
|
|
97
70
|
exports.getDefaultMultiOwnerLightAccountFactoryAddress = getDefaultMultiOwnerLightAccountFactoryAddress;
|
|
98
71
|
exports.LightAccountUnsupported1271Impls = [
|
|
99
72
|
exports.AccountVersionRegistry.LightAccount["v1.0.1"],
|
|
100
73
|
exports.AccountVersionRegistry.LightAccount["v1.0.2"],
|
|
101
74
|
];
|
|
102
|
-
exports.LightAccountUnsupported1271Factories = new Set(exports.LightAccountUnsupported1271Impls.map((x) =>
|
|
103
|
-
|
|
75
|
+
exports.LightAccountUnsupported1271Factories = new Set(exports.LightAccountUnsupported1271Impls.map((x) => [
|
|
76
|
+
x.addresses.default.factory,
|
|
77
|
+
...Object.values(x.addresses.overrides ?? {}).map((z) => z.factory),
|
|
78
|
+
]).flat());
|
|
79
|
+
async function getLightAccountVersionForAccount(account, chain) {
|
|
104
80
|
const accountType = account.source;
|
|
105
81
|
const factoryAddress = await account.getFactoryAddress();
|
|
106
82
|
const implAddress = await account.getImplementationAddress();
|
|
107
|
-
const implToVersion = new Map(Object.entries(exports.AccountVersionRegistry[accountType])
|
|
108
|
-
.map((pair) => {
|
|
83
|
+
const implToVersion = new Map(Object.entries(exports.AccountVersionRegistry[accountType]).map((pair) => {
|
|
109
84
|
const [version, def] = pair;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
.
|
|
115
|
-
|
|
116
|
-
|
|
85
|
+
if (def.addresses.overrides != null &&
|
|
86
|
+
chain.id in def.addresses.overrides) {
|
|
87
|
+
return [def.addresses.overrides[chain.id].impl, version];
|
|
88
|
+
}
|
|
89
|
+
return [def.addresses.default.impl, version];
|
|
90
|
+
}));
|
|
91
|
+
const factoryToVersion = new Map(Object.entries(exports.AccountVersionRegistry[accountType]).map((pair) => {
|
|
117
92
|
const [version, def] = pair;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
.
|
|
93
|
+
if (def.addresses.overrides != null &&
|
|
94
|
+
chain.id in def.addresses.overrides) {
|
|
95
|
+
return [def.addresses.overrides[chain.id].factory, version];
|
|
96
|
+
}
|
|
97
|
+
return [def.addresses.default.factory, version];
|
|
98
|
+
}));
|
|
123
99
|
const version = (0, viem_1.fromHex)(implAddress, "bigint") === 0n
|
|
124
100
|
? factoryToVersion.get(factoryAddress.toLowerCase())
|
|
125
101
|
: implToVersion.get(implAddress.toLowerCase());
|
|
@@ -128,9 +104,5 @@ async function getLightAccountVersionDef(account, chain) {
|
|
|
128
104
|
}
|
|
129
105
|
return exports.AccountVersionRegistry[accountType][version];
|
|
130
106
|
}
|
|
131
|
-
exports.
|
|
132
|
-
async function getLightAccountVersion(account, chain = exports.supportedChains[0]) {
|
|
133
|
-
return (await getLightAccountVersionDef(account, chain)).version;
|
|
134
|
-
}
|
|
135
|
-
exports.getLightAccountVersion = getLightAccountVersion;
|
|
107
|
+
exports.getLightAccountVersionForAccount = getLightAccountVersionForAccount;
|
|
136
108
|
//# sourceMappingURL=utils.js.map
|