@account-kit/smart-contracts 4.66.4 → 4.67.0
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createSmartAccountClient,
|
|
1
|
+
import { createSmartAccountClient, webauthnGasEstimator, } from "@aa-sdk/core";
|
|
2
2
|
import {} from "viem";
|
|
3
3
|
import { createModularAccountV2, } from "../account/modularAccountV2.js";
|
|
4
4
|
import { createAlchemySmartAccountClient, isAlchemyTransport, } from "@account-kit/infra";
|
|
@@ -44,18 +44,16 @@ export async function createModularAccountV2Client(config) {
|
|
|
44
44
|
}
|
|
45
45
|
const middlewareToAppend = await (async () => {
|
|
46
46
|
switch (config.mode) {
|
|
47
|
-
case "7702":
|
|
48
|
-
return {
|
|
49
|
-
gasEstimator: default7702GasEstimator(config.gasEstimator),
|
|
50
|
-
signUserOperation: default7702UserOpSigner(config.signUserOperation),
|
|
51
|
-
};
|
|
52
47
|
case "webauthn":
|
|
53
48
|
return {
|
|
54
49
|
gasEstimator: webauthnGasEstimator(config.gasEstimator),
|
|
55
50
|
};
|
|
51
|
+
case "7702":
|
|
56
52
|
case "default":
|
|
57
|
-
|
|
53
|
+
case undefined:
|
|
58
54
|
return {};
|
|
55
|
+
default:
|
|
56
|
+
return assertNeverConfigMode(config);
|
|
59
57
|
}
|
|
60
58
|
})();
|
|
61
59
|
if (isAlchemyTransport(transport, chain)) {
|
|
@@ -73,4 +71,7 @@ export async function createModularAccountV2Client(config) {
|
|
|
73
71
|
...middlewareToAppend,
|
|
74
72
|
});
|
|
75
73
|
}
|
|
74
|
+
function assertNeverConfigMode(_) {
|
|
75
|
+
throw new Error("Unexpected mode");
|
|
76
|
+
}
|
|
76
77
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../src/ma-v2/client/client.ts"],"names":[],"mappings":"AAAA,OAAO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;YACL,OAAO;YACP,GAAG,kBAAkB;SACtB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,wBAAwB,CAAC;QAC9B,GAAG,MAAM;QACT,OAAO;QACP,GAAG,kBAAkB;KACtB,CAAC,CAAC;AACL,CAAC;AAED,SAAS,qBAAqB,CAAC,CAAQ;IACrC,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n webauthnGasEstimator,\n type SmartAccountClient,\n type SmartAccountClientConfig,\n type SmartAccountSigner,\n} from \"@aa-sdk/core\";\nimport { type Chain, type Transport } from \"viem\";\n\nimport {\n createModularAccountV2,\n type CreateModularAccountV2Params,\n type CreateWebauthnModularAccountV2Params,\n} from \"../account/modularAccountV2.js\";\n\nimport {\n createAlchemySmartAccountClient,\n isAlchemyTransport,\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n type AlchemyTransport,\n} from \"@account-kit/infra\";\nimport type { LightAccount } from \"../../light-account/accounts/account.js\";\n\nimport type { ToWebAuthnAccountParameters } from \"viem/account-abstraction\";\nimport type {\n ModularAccountV2,\n WebauthnModularAccountV2,\n} from \"../account/common/modularAccountV2Base.js\";\n\nexport type ModularAccountV2Client<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TChain extends Chain = Chain,\n TTransport extends Transport | AlchemyTransport = Transport,\n> = TTransport extends AlchemyTransport\n ? AlchemySmartAccountClient<TChain, ModularAccountV2<TSigner>>\n : SmartAccountClient<TTransport, TChain, ModularAccountV2<TSigner>>;\n\nexport type WebauthnModularAccountV2Client<\n TChain extends Chain = Chain,\n TTransport extends Transport | AlchemyTransport = Transport,\n> = TTransport extends AlchemyTransport\n ? AlchemySmartAccountClient<TChain, WebauthnModularAccountV2>\n : SmartAccountClient<TTransport, TChain, WebauthnModularAccountV2>;\n\nexport type CreateModularAccountV2ClientParams<\n TTransport extends Transport | AlchemyTransport = Transport,\n TChain extends Chain = Chain,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n> = CreateModularAccountV2Params<TTransport, TSigner> &\n Omit<\n TTransport extends AlchemyTransport\n ? AlchemySmartAccountClientConfig<TChain>\n : SmartAccountClientConfig<TTransport, TChain>,\n \"transport\" | \"account\" | \"chain\"\n >;\n\nexport type CreateWebauthnModularAccountV2ClientParams<\n TTransport extends Transport | AlchemyTransport = Transport,\n TChain extends Chain = Chain,\n> = CreateWebauthnModularAccountV2Params<TTransport> &\n Omit<\n TTransport extends AlchemyTransport\n ? AlchemySmartAccountClientConfig<TChain>\n : SmartAccountClientConfig<TTransport, TChain>,\n \"transport\" | \"account\" | \"chain\"\n > & {\n credential: ToWebAuthnAccountParameters[\"credential\"];\n getFn?: ToWebAuthnAccountParameters[\"getFn\"];\n rpId?: ToWebAuthnAccountParameters[\"rpId\"];\n };\n\nexport type CreateModularAccountV2AlchemyClientParams<\n TTransport extends Transport = Transport,\n TChain extends Chain = Chain,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n> = Omit<\n CreateModularAccountV2ClientParams<TTransport, TChain, TSigner>,\n \"transport\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<TChain, LightAccount<TSigner>>,\n \"account\"\n > & { paymasterAndData?: never; dummyPaymasterAndData?: never };\n\nexport function createModularAccountV2Client<\n TChain extends Chain = Chain,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n>(\n args: CreateModularAccountV2AlchemyClientParams<\n AlchemyTransport,\n TChain,\n TSigner\n >,\n): Promise<ModularAccountV2Client<TSigner, TChain, AlchemyTransport>>;\n\nexport function createModularAccountV2Client<\n TTransport extends Transport = Transport,\n TChain extends Chain = Chain,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n>(\n args: CreateModularAccountV2ClientParams<TTransport, TChain, TSigner>,\n): Promise<ModularAccountV2Client<TSigner, TChain, TTransport>>;\n\nexport function createModularAccountV2Client<\n TTransport extends Transport = Transport,\n TChain extends Chain = Chain,\n>(\n args: CreateWebauthnModularAccountV2ClientParams<TTransport, TChain>,\n): Promise<WebauthnModularAccountV2Client<TChain, TTransport>>;\n/**\n * Creates a Modular Account V2 client using the provided configuration parameters.\n *\n * @example\n * ```ts twoslash\n * import { createModularAccountV2Client } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { alchemy, sepolia } from \"@account-kit/infra\";\n *\n * const MNEMONIC = \"...\";\n * const RPC_URL = \"...\";\n *\n * const signer = LocalAccountSigner.mnemonicToAccountSigner(MNEMONIC);\n *\n * const chain = sepolia;\n *\n * const transport = alchemy({ rpcUrl: RPC_URL });\n *\n * const policyId = \"...\";\n *\n * const modularAccountV2Client = await createModularAccountV2Client({\n * chain,\n * signer,\n * transport,\n * policyId, // NOTE: you may only pass in a gas policy ID if you provide an Alchemy transport!\n * });\n * ```\n *\n * @param {CreateModularAccountV2ClientParams} config The configuration parameters required to create the Modular Account v2 account client\n * @returns {Promise<SmartAccountClient>} A promise that resolves to a `SmartAccountClient` instance\n */\nexport async function createModularAccountV2Client(\n config:\n | CreateModularAccountV2ClientParams\n | CreateWebauthnModularAccountV2ClientParams\n | CreateModularAccountV2AlchemyClientParams,\n): Promise<SmartAccountClient | AlchemySmartAccountClient> {\n const { transport, chain } = config;\n\n let account;\n\n if (config.mode === \"webauthn\") {\n account = await createModularAccountV2(\n config as CreateWebauthnModularAccountV2Params<Transport>,\n );\n } else {\n account = await createModularAccountV2(\n config as CreateModularAccountV2Params,\n );\n }\n\n const middlewareToAppend = await (async () => {\n switch (config.mode) {\n case \"webauthn\":\n return {\n gasEstimator: webauthnGasEstimator(config.gasEstimator),\n };\n case \"7702\":\n case \"default\":\n case undefined:\n return {};\n default:\n return assertNeverConfigMode(config);\n }\n })();\n\n if (isAlchemyTransport(transport, chain)) {\n return createAlchemySmartAccountClient({\n ...config,\n transport,\n chain,\n account,\n ...middlewareToAppend,\n });\n }\n\n return createSmartAccountClient({\n ...config,\n account,\n ...middlewareToAppend,\n });\n}\n\nfunction assertNeverConfigMode(_: never): never {\n throw new Error(\"Unexpected mode\");\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../src/ma-v2/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../src/ma-v2/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,MAAM,CAAC;AAElD,OAAO,EAEL,KAAK,4BAA4B,EACjC,KAAK,oCAAoC,EAC1C,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAGL,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACpC,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAE5E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,2CAA2C,CAAC;AAEnD,MAAM,MAAM,sBAAsB,CAChC,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,EACvD,MAAM,SAAS,KAAK,GAAG,KAAK,EAC5B,UAAU,SAAS,SAAS,GAAG,gBAAgB,GAAG,SAAS,IACzD,UAAU,SAAS,gBAAgB,GACnC,yBAAyB,CAAC,MAAM,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,GAC5D,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;AAEtE,MAAM,MAAM,8BAA8B,CACxC,MAAM,SAAS,KAAK,GAAG,KAAK,EAC5B,UAAU,SAAS,SAAS,GAAG,gBAAgB,G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,GACC,IAAI,CACF,+BAA+B,CAAC,MAAM,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,EAC9D,SAAS,CACV,GAAG;IAAE,gBAAgB,CAAC,EAAE,KAAK,CAAC;IAAC,qBAAqB,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAElE,wBAAgB,4BAA4B,CAC1C,MAAM,SAAS,KAAK,GAAG,KAAK,EAC5B,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,EAEvD,IAAI,EAAE,yCAAyC,CAC7C,gBAAgB,EAChB,MAAM,EACN,OAAO,CACR,GACA,OAAO,CAAC,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAEtE,wBAAgB,4BAA4B,CAC1C,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,MAAM,SAAS,KAAK,GAAG,KAAK,EAC5B,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,EAEvD,IAAI,EAAE,kCAAkC,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,GACpE,OAAO,CAAC,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;AAEhE,wBAAgB,4BAA4B,CAC1C,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,MAAM,SAAS,KAAK,GAAG,KAAK,EAE5B,IAAI,EAAE,0CAA0C,CAAC,UAAU,EAAE,MAAM,CAAC,GACnE,OAAO,CAAC,8BAA8B,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@account-kit/smart-contracts",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.67.0",
|
|
4
4
|
"description": "aa-sdk compatible interfaces for Alchemy Smart Accounts",
|
|
5
5
|
"author": "Alchemy",
|
|
6
6
|
"license": "MIT",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"test:run": "vitest run"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@account-kit/plugingen": "^4.
|
|
54
|
+
"@account-kit/plugingen": "^4.67.0",
|
|
55
55
|
"change-case": "^5.1.2",
|
|
56
56
|
"dedent": "^1.5.1",
|
|
57
57
|
"dotenv": "^16.3.1",
|
|
@@ -69,10 +69,10 @@
|
|
|
69
69
|
"url": "https://github.com/alchemyplatform/aa-sdk/issues"
|
|
70
70
|
},
|
|
71
71
|
"homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "6b6896197bab0752b677f659443c900c71e45afd",
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@aa-sdk/core": "^4.
|
|
75
|
-
"@account-kit/infra": "^4.
|
|
74
|
+
"@aa-sdk/core": "^4.67.0",
|
|
75
|
+
"@account-kit/infra": "^4.67.0",
|
|
76
76
|
"webauthn-p256": "^0.0.10"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSmartAccountClient,
|
|
3
|
-
default7702GasEstimator,
|
|
4
|
-
default7702UserOpSigner,
|
|
5
3
|
webauthnGasEstimator,
|
|
6
4
|
type SmartAccountClient,
|
|
7
5
|
type SmartAccountClientConfig,
|
|
@@ -163,18 +161,16 @@ export async function createModularAccountV2Client(
|
|
|
163
161
|
|
|
164
162
|
const middlewareToAppend = await (async () => {
|
|
165
163
|
switch (config.mode) {
|
|
166
|
-
case "7702":
|
|
167
|
-
return {
|
|
168
|
-
gasEstimator: default7702GasEstimator(config.gasEstimator),
|
|
169
|
-
signUserOperation: default7702UserOpSigner(config.signUserOperation),
|
|
170
|
-
};
|
|
171
164
|
case "webauthn":
|
|
172
165
|
return {
|
|
173
166
|
gasEstimator: webauthnGasEstimator(config.gasEstimator),
|
|
174
167
|
};
|
|
168
|
+
case "7702":
|
|
175
169
|
case "default":
|
|
176
|
-
|
|
170
|
+
case undefined:
|
|
177
171
|
return {};
|
|
172
|
+
default:
|
|
173
|
+
return assertNeverConfigMode(config);
|
|
178
174
|
}
|
|
179
175
|
})();
|
|
180
176
|
|
|
@@ -194,3 +190,7 @@ export async function createModularAccountV2Client(
|
|
|
194
190
|
...middlewareToAppend,
|
|
195
191
|
});
|
|
196
192
|
}
|
|
193
|
+
|
|
194
|
+
function assertNeverConfigMode(_: never): never {
|
|
195
|
+
throw new Error("Unexpected mode");
|
|
196
|
+
}
|