@account-kit/wallet-client 0.1.0-alpha.1 → 0.1.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/esm/client/actions/createAccount.d.ts +27 -2
- package/dist/esm/client/actions/createAccount.js +25 -0
- package/dist/esm/client/actions/createAccount.js.map +1 -1
- package/dist/esm/client/actions/formatSign.d.ts +28 -0
- package/dist/esm/client/actions/formatSign.js +30 -0
- package/dist/esm/client/actions/formatSign.js.map +1 -0
- package/dist/esm/client/actions/getCallsStatus.d.ts +22 -4
- package/dist/esm/client/actions/getCallsStatus.js +19 -0
- package/dist/esm/client/actions/getCallsStatus.js.map +1 -1
- package/dist/esm/client/actions/grantPermissions.d.ts +63 -6
- package/dist/esm/client/actions/grantPermissions.js +63 -3
- package/dist/esm/client/actions/grantPermissions.js.map +1 -1
- package/dist/esm/client/actions/listAccounts.d.ts +32 -4
- package/dist/esm/client/actions/listAccounts.js +35 -2
- package/dist/esm/client/actions/listAccounts.js.map +1 -1
- package/dist/esm/client/actions/prepareCalls.d.ts +32 -6
- package/dist/esm/client/actions/prepareCalls.js +39 -5
- package/dist/esm/client/actions/prepareCalls.js.map +1 -1
- package/dist/esm/client/actions/prepareSign.d.ts +25 -0
- package/dist/esm/client/actions/prepareSign.js +28 -0
- package/dist/esm/client/actions/prepareSign.js.map +1 -0
- package/dist/esm/client/actions/requestAccount.d.ts +24 -6
- package/dist/esm/client/actions/requestAccount.js +38 -7
- package/dist/esm/client/actions/requestAccount.js.map +1 -1
- package/dist/esm/client/actions/sendPreparedCalls.d.ts +33 -4
- package/dist/esm/client/actions/sendPreparedCalls.js +37 -1
- package/dist/esm/client/actions/sendPreparedCalls.js.map +1 -1
- package/dist/esm/client/actions/signMessage.d.ts +25 -5
- package/dist/esm/client/actions/signMessage.js +22 -2
- package/dist/esm/client/actions/signMessage.js.map +1 -1
- package/dist/esm/client/actions/signPreparedCalls.d.ts +14 -0
- package/dist/esm/client/actions/signPreparedCalls.js +43 -0
- package/dist/esm/client/actions/signPreparedCalls.js.map +1 -0
- package/dist/esm/client/actions/signSignatureRequest.d.ts +39 -5
- package/dist/esm/client/actions/signSignatureRequest.js +69 -11
- package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
- package/dist/esm/client/actions/signTypedData.d.ts +37 -4
- package/dist/esm/client/actions/signTypedData.js +34 -1
- package/dist/esm/client/actions/signTypedData.js.map +1 -1
- package/dist/esm/client/client.e2e-test.js +249 -45
- package/dist/esm/client/client.e2e-test.js.map +1 -1
- package/dist/esm/client/decorator.d.ts +12 -8
- package/dist/esm/client/decorator.js +5 -3
- package/dist/esm/client/decorator.js.map +1 -1
- package/dist/esm/client/index.d.ts +38 -12
- package/dist/esm/client/index.js +0 -3
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/exports/index.d.ts +5 -6
- package/dist/esm/exports/index.js +4 -6
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/exports/internal.d.ts +1 -10
- package/dist/esm/exports/internal.js +0 -12
- package/dist/esm/exports/internal.js.map +1 -1
- package/dist/esm/internal/decorator.d.ts +2 -0
- package/dist/esm/internal/decorator.js +10 -0
- package/dist/esm/internal/decorator.js.map +1 -0
- package/dist/esm/isomorphic/actions/createSession.d.ts +1 -2
- package/dist/esm/isomorphic/actions/createSession.js +40 -11
- package/dist/esm/isomorphic/actions/createSession.js.map +1 -1
- package/dist/esm/isomorphic/actions/formatSign.d.ts +8 -0
- package/dist/esm/isomorphic/actions/formatSign.js +42 -0
- package/dist/esm/isomorphic/actions/formatSign.js.map +1 -0
- package/dist/esm/isomorphic/actions/getCallsStatus.d.ts +1 -15
- package/dist/esm/isomorphic/actions/getCallsStatus.js +38 -27
- package/dist/esm/isomorphic/actions/getCallsStatus.js.map +1 -1
- package/dist/esm/isomorphic/actions/prepareCalls.d.ts +1 -2
- package/dist/esm/isomorphic/actions/prepareCalls.js +78 -20
- package/dist/esm/isomorphic/actions/prepareCalls.js.map +1 -1
- package/dist/esm/isomorphic/actions/prepareSign.d.ts +7 -0
- package/dist/esm/isomorphic/actions/prepareSign.js +49 -0
- package/dist/esm/isomorphic/actions/prepareSign.js.map +1 -0
- package/dist/esm/isomorphic/actions/sendPreparedCalls.d.ts +3 -4
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js +165 -25
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +1 -1
- package/dist/esm/isomorphic/client.d.ts +204 -27
- package/dist/esm/isomorphic/client.js +6 -2
- package/dist/esm/isomorphic/client.js.map +1 -1
- package/dist/esm/isomorphic/utils/7702.d.ts +19 -0
- package/dist/esm/isomorphic/utils/7702.js +70 -0
- package/dist/esm/isomorphic/utils/7702.js.map +1 -0
- package/dist/esm/isomorphic/utils/createAccount.d.ts +5 -4
- package/dist/esm/isomorphic/utils/createAccount.js +84 -10
- package/dist/esm/isomorphic/utils/createAccount.js.map +1 -1
- package/dist/esm/isomorphic/utils/createDummySigner.js +3 -3
- package/dist/esm/isomorphic/utils/createDummySigner.js.map +1 -1
- package/dist/esm/isomorphic/utils/decodeSignature.d.ts +3 -0
- package/dist/esm/isomorphic/utils/decodeSignature.js +15 -0
- package/dist/esm/isomorphic/utils/decodeSignature.js.map +1 -0
- package/dist/esm/isomorphic/utils/parsePermissionsContext.d.ts +6 -5
- package/dist/esm/isomorphic/utils/parsePermissionsContext.js +19 -6
- package/dist/esm/isomorphic/utils/parsePermissionsContext.js.map +1 -1
- package/dist/esm/isomorphic/utils/supportsFeature.d.ts +4 -0
- package/dist/esm/isomorphic/utils/supportsFeature.js +21 -0
- package/dist/esm/isomorphic/utils/supportsFeature.js.map +1 -0
- package/dist/esm/local/client.d.ts +3 -3
- package/dist/esm/local/client.js +11 -4
- package/dist/esm/local/client.js.map +1 -1
- package/dist/esm/remote/client.d.ts +9 -3
- package/dist/esm/remote/client.js +10 -11
- package/dist/esm/remote/client.js.map +1 -1
- package/dist/esm/types.d.ts +27 -13
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils.d.ts +1 -0
- package/dist/esm/utils.js.map +1 -1
- package/dist/types/client/actions/createAccount.d.ts +27 -2
- package/dist/types/client/actions/createAccount.d.ts.map +1 -1
- package/dist/types/client/actions/formatSign.d.ts +29 -0
- package/dist/types/client/actions/formatSign.d.ts.map +1 -0
- package/dist/types/client/actions/getCallsStatus.d.ts +22 -4
- package/dist/types/client/actions/getCallsStatus.d.ts.map +1 -1
- package/dist/types/client/actions/grantPermissions.d.ts +63 -6
- package/dist/types/client/actions/grantPermissions.d.ts.map +1 -1
- package/dist/types/client/actions/listAccounts.d.ts +32 -4
- package/dist/types/client/actions/listAccounts.d.ts.map +1 -1
- package/dist/types/client/actions/prepareCalls.d.ts +32 -6
- package/dist/types/client/actions/prepareCalls.d.ts.map +1 -1
- package/dist/types/client/actions/prepareSign.d.ts +26 -0
- package/dist/types/client/actions/prepareSign.d.ts.map +1 -0
- package/dist/types/client/actions/requestAccount.d.ts +24 -6
- package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
- package/dist/types/client/actions/sendPreparedCalls.d.ts +33 -4
- package/dist/types/client/actions/sendPreparedCalls.d.ts.map +1 -1
- package/dist/types/client/actions/signMessage.d.ts +25 -5
- package/dist/types/client/actions/signMessage.d.ts.map +1 -1
- package/dist/types/client/actions/signPreparedCalls.d.ts +15 -0
- package/dist/types/client/actions/signPreparedCalls.d.ts.map +1 -0
- package/dist/types/client/actions/signSignatureRequest.d.ts +39 -5
- package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
- package/dist/types/client/actions/signTypedData.d.ts +37 -4
- package/dist/types/client/actions/signTypedData.d.ts.map +1 -1
- package/dist/types/client/decorator.d.ts +12 -8
- package/dist/types/client/decorator.d.ts.map +1 -1
- package/dist/types/client/index.d.ts +38 -12
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/exports/index.d.ts +5 -6
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/exports/internal.d.ts +1 -10
- package/dist/types/exports/internal.d.ts.map +1 -1
- package/dist/types/internal/decorator.d.ts +3 -0
- package/dist/types/internal/decorator.d.ts.map +1 -0
- package/dist/types/isomorphic/actions/createSession.d.ts +1 -2
- package/dist/types/isomorphic/actions/createSession.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/formatSign.d.ts +9 -0
- package/dist/types/isomorphic/actions/formatSign.d.ts.map +1 -0
- package/dist/types/isomorphic/actions/getCallsStatus.d.ts +1 -15
- package/dist/types/isomorphic/actions/getCallsStatus.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/prepareCalls.d.ts +1 -2
- package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/prepareSign.d.ts +8 -0
- package/dist/types/isomorphic/actions/prepareSign.d.ts.map +1 -0
- package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts +3 -4
- package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +1 -1
- package/dist/types/isomorphic/client.d.ts +204 -27
- package/dist/types/isomorphic/client.d.ts.map +1 -1
- package/dist/types/isomorphic/utils/7702.d.ts +20 -0
- package/dist/types/isomorphic/utils/7702.d.ts.map +1 -0
- package/dist/types/isomorphic/utils/createAccount.d.ts +5 -4
- package/dist/types/isomorphic/utils/createAccount.d.ts.map +1 -1
- package/dist/types/isomorphic/utils/createDummySigner.d.ts.map +1 -1
- package/dist/types/isomorphic/utils/decodeSignature.d.ts +4 -0
- package/dist/types/isomorphic/utils/decodeSignature.d.ts.map +1 -0
- package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts +6 -5
- package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts.map +1 -1
- package/dist/types/isomorphic/utils/supportsFeature.d.ts +5 -0
- package/dist/types/isomorphic/utils/supportsFeature.d.ts.map +1 -0
- package/dist/types/local/client.d.ts +3 -3
- package/dist/types/local/client.d.ts.map +1 -1
- package/dist/types/remote/client.d.ts +9 -3
- package/dist/types/remote/client.d.ts.map +1 -1
- package/dist/types/types.d.ts +27 -13
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +1 -0
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +9 -6
- package/src/client/actions/createAccount.ts +27 -2
- package/src/client/actions/formatSign.ts +53 -0
- package/src/client/actions/getCallsStatus.ts +21 -12
- package/src/client/actions/grantPermissions.ts +69 -26
- package/src/client/actions/listAccounts.ts +44 -6
- package/src/client/actions/prepareCalls.ts +46 -26
- package/src/client/actions/prepareSign.ts +46 -0
- package/src/client/actions/requestAccount.ts +60 -41
- package/src/client/actions/sendPreparedCalls.ts +44 -7
- package/src/client/actions/signMessage.ts +26 -21
- package/src/client/actions/signPreparedCalls.ts +67 -0
- package/src/client/actions/signSignatureRequest.ts +84 -20
- package/src/client/actions/signTypedData.ts +40 -19
- package/src/client/client.e2e-test.ts +408 -127
- package/src/client/decorator.ts +28 -26
- package/src/client/index.ts +50 -40
- package/src/exports/index.ts +5 -13
- package/src/exports/internal.ts +2 -10
- package/src/internal/decorator.ts +12 -0
- package/src/isomorphic/actions/createSession.ts +56 -13
- package/src/isomorphic/actions/formatSign.ts +76 -0
- package/src/isomorphic/actions/getCallsStatus.ts +47 -33
- package/src/isomorphic/actions/prepareCalls.ts +95 -23
- package/src/isomorphic/actions/prepareSign.ts +88 -0
- package/src/isomorphic/actions/sendPreparedCalls.ts +218 -42
- package/src/isomorphic/client.ts +10 -2
- package/src/isomorphic/utils/7702.ts +135 -0
- package/src/isomorphic/utils/createAccount.ts +101 -13
- package/src/isomorphic/utils/createDummySigner.ts +3 -2
- package/src/isomorphic/utils/decodeSignature.ts +21 -0
- package/src/isomorphic/utils/parsePermissionsContext.ts +29 -11
- package/src/isomorphic/utils/supportsFeature.ts +34 -0
- package/src/local/client.ts +58 -55
- package/src/remote/client.ts +19 -19
- package/src/types.ts +29 -23
- package/src/utils.ts +2 -0
- package/dist/esm/capabilities/index.d.ts +0 -31
- package/dist/esm/capabilities/index.js +0 -10
- package/dist/esm/capabilities/index.js.map +0 -1
- package/dist/esm/capabilities/overrides.d.ts +0 -26
- package/dist/esm/capabilities/overrides.js +0 -14
- package/dist/esm/capabilities/overrides.js.map +0 -1
- package/dist/esm/capabilities/paymaster.d.ts +0 -3
- package/dist/esm/capabilities/paymaster.js +0 -5
- package/dist/esm/capabilities/paymaster.js.map +0 -1
- package/dist/esm/capabilities/permissions/index.d.ts +0 -138
- package/dist/esm/capabilities/permissions/index.js +0 -71
- package/dist/esm/capabilities/permissions/index.js.map +0 -1
- package/dist/esm/capabilities/permissions/mav2.d.ts +0 -36
- package/dist/esm/capabilities/permissions/mav2.js +0 -79
- package/dist/esm/capabilities/permissions/mav2.js.map +0 -1
- package/dist/esm/rpc/request.d.ts +0 -352
- package/dist/esm/rpc/request.js +0 -204
- package/dist/esm/rpc/request.js.map +0 -1
- package/dist/esm/rpc/schema.d.ts +0 -342
- package/dist/esm/rpc/schema.js +0 -5
- package/dist/esm/rpc/schema.js.map +0 -1
- package/dist/esm/schemas.d.ts +0 -216
- package/dist/esm/schemas.js +0 -211
- package/dist/esm/schemas.js.map +0 -1
- package/dist/types/capabilities/index.d.ts +0 -32
- package/dist/types/capabilities/index.d.ts.map +0 -1
- package/dist/types/capabilities/overrides.d.ts +0 -27
- package/dist/types/capabilities/overrides.d.ts.map +0 -1
- package/dist/types/capabilities/paymaster.d.ts +0 -4
- package/dist/types/capabilities/paymaster.d.ts.map +0 -1
- package/dist/types/capabilities/permissions/index.d.ts +0 -139
- package/dist/types/capabilities/permissions/index.d.ts.map +0 -1
- package/dist/types/capabilities/permissions/mav2.d.ts +0 -37
- package/dist/types/capabilities/permissions/mav2.d.ts.map +0 -1
- package/dist/types/rpc/request.d.ts +0 -353
- package/dist/types/rpc/request.d.ts.map +0 -1
- package/dist/types/rpc/schema.d.ts +0 -343
- package/dist/types/rpc/schema.d.ts.map +0 -1
- package/dist/types/schemas.d.ts +0 -217
- package/dist/types/schemas.d.ts.map +0 -1
- package/src/capabilities/index.ts +0 -13
- package/src/capabilities/overrides.ts +0 -20
- package/src/capabilities/paymaster.ts +0 -5
- package/src/capabilities/permissions/index.ts +0 -142
- package/src/capabilities/permissions/mav2.ts +0 -127
- package/src/rpc/request.ts +0 -273
- package/src/rpc/schema.ts +0 -40
- package/src/schemas.ts +0 -257
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {} from "@aa-sdk/core";
|
|
2
|
-
import {} from "viem";
|
|
2
|
+
import { BaseError, } from "viem";
|
|
3
3
|
export const createDummySigner = (address) => ({
|
|
4
4
|
signerType: "",
|
|
5
5
|
inner: undefined,
|
|
@@ -8,10 +8,10 @@ export const createDummySigner = (address) => ({
|
|
|
8
8
|
},
|
|
9
9
|
// Not supported on the server
|
|
10
10
|
signMessage: function (_message) {
|
|
11
|
-
throw new
|
|
11
|
+
throw new BaseError("signMessage not implemented by dummy signer.");
|
|
12
12
|
},
|
|
13
13
|
signTypedData: function (_params) {
|
|
14
|
-
throw new
|
|
14
|
+
throw new BaseError("signTypedData not implemented by dummy signer.");
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
17
|
//# sourceMappingURL=createDummySigner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDummySigner.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/createDummySigner.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,MAAM,cAAc,CAAC;AAEvD,OAAO,
|
|
1
|
+
{"version":3,"file":"createDummySigner.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/createDummySigner.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,MAAM,cAAc,CAAC;AAEvD,OAAO,EACL,SAAS,GAKV,MAAM,MAAM,CAAC;AAEd,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAgB,EAAsB,EAAE,CAAC,CAAC;IAC1E,UAAU,EAAE,EAAE;IACd,KAAK,EAAE,SAAS;IAChB,UAAU,EAAE,KAAK;QACf,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,8BAA8B;IAC9B,WAAW,EAAE,UAAU,QAAyB;QAC9C,MAAM,IAAI,SAAS,CAAC,8CAA8C,CAAC,CAAC;IACtE,CAAC;IACD,aAAa,EAAE,UAGb,OAAsD;QACtD,MAAM,IAAI,SAAS,CAAC,gDAAgD,CAAC,CAAC;IACxE,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { type SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { TypedData } from \"abitype\";\nimport {\n BaseError,\n type Address,\n type Hex,\n type SignableMessage,\n type TypedDataDefinition,\n} from \"viem\";\n\nexport const createDummySigner = (address: Address): SmartAccountSigner => ({\n signerType: \"\",\n inner: undefined,\n getAddress: async function (): Promise<`0x${string}`> {\n return address;\n },\n // Not supported on the server\n signMessage: function (_message: SignableMessage): Promise<Hex> {\n throw new BaseError(\"signMessage not implemented by dummy signer.\");\n },\n signTypedData: function <\n const TTypedData extends TypedData | Record<string, unknown>,\n TPrimaryType extends keyof TTypedData | \"EIP712Domain\" = keyof TTypedData,\n >(_params: TypedDataDefinition<TTypedData, TPrimaryType>): Promise<Hex> {\n throw new BaseError(\"signTypedData not implemented by dummy signer.\");\n },\n});\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Value } from "@sinclair/typebox/value";
|
|
2
|
+
import { EcdsaSig, } from "@alchemy/wallet-api-types";
|
|
3
|
+
import { assertNever } from "../../utils.js";
|
|
4
|
+
export const decodeSignature = (signature) => {
|
|
5
|
+
switch (signature.type) {
|
|
6
|
+
case "ecdsa":
|
|
7
|
+
case "secp256k1":
|
|
8
|
+
return Value.Decode(EcdsaSig, {
|
|
9
|
+
signature,
|
|
10
|
+
}).signature;
|
|
11
|
+
default:
|
|
12
|
+
return assertNever(signature, "Unexpected signature type");
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=decodeSignature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decodeSignature.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/decodeSignature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD,OAAO,EACL,QAAQ,GAET,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,SAAoC,EACQ,EAAE;IAC9C,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,KAAK,OAAO,CAAC;QACb,KAAK,WAAW;YACd,OAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE;gBAC5B,SAAS;aACa,CAAC,CAAC,SAAS,CAAC;QACtC;YACE,OAAO,WAAW,CAAC,SAAS,EAAE,2BAA2B,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { Value } from \"@sinclair/typebox/value\";\nimport type { StaticDecode } from \"@sinclair/typebox\";\nimport {\n EcdsaSig,\n type EcdsaSig as EcdsaSigType,\n} from \"@alchemy/wallet-api-types\";\nimport { assertNever } from \"../../utils.js\";\n\nexport const decodeSignature = (\n signature: EcdsaSigType[\"signature\"],\n): StaticDecode<typeof EcdsaSig>[\"signature\"] => {\n switch (signature.type) {\n case \"ecdsa\":\n case \"secp256k1\":\n return Value.Decode(EcdsaSig, {\n signature,\n } satisfies EcdsaSigType).signature;\n default:\n return assertNever(signature, \"Unexpected signature type\");\n }\n};\n"]}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import type { StaticDecode } from "@sinclair/typebox";
|
|
2
|
-
import type {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
import { PermissionsCapability } from "@alchemy/wallet-api-types/capabilities";
|
|
4
|
+
import { SerializedInitcode } from "@alchemy/wallet-api-types";
|
|
5
|
+
export declare function parsePermissionsContext(permissions?: StaticDecode<typeof PermissionsCapability>, parsedCi?: StaticDecode<typeof SerializedInitcode> | undefined, delegation7702?: Address): ({
|
|
6
|
+
contextVersion: keyof typeof import("@alchemy/wallet-api-types/capabilities").PermissionsContextVersion;
|
|
6
7
|
} & {
|
|
7
8
|
contextVersion: "LOCAL_MODE_DEFERRED_ACTION";
|
|
8
9
|
deferredAction: import("viem").Hex;
|
|
9
10
|
sessionId?: never;
|
|
10
11
|
signature?: never;
|
|
11
12
|
}) | ({
|
|
12
|
-
contextVersion: keyof typeof import("
|
|
13
|
+
contextVersion: keyof typeof import("@alchemy/wallet-api-types/capabilities").PermissionsContextVersion;
|
|
13
14
|
} & {
|
|
14
15
|
contextVersion: "NON_DEFERRED_ACTION";
|
|
15
16
|
deferredAction?: never;
|
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
import { InvalidRequestError } from "ox/RpcResponse";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { getAccountTypeForDelegationAddress7702 } from "./7702.js";
|
|
3
|
+
import { decodePermissionsContext, PermissionsCapability, } from "@alchemy/wallet-api-types/capabilities";
|
|
4
|
+
import { SerializedInitcode } from "@alchemy/wallet-api-types";
|
|
5
|
+
export function parsePermissionsContext(permissions, parsedCi, delegation7702) {
|
|
6
|
+
if (!permissions) {
|
|
5
7
|
return undefined;
|
|
6
8
|
}
|
|
7
|
-
if (
|
|
8
|
-
|
|
9
|
+
if ("sessionId" in permissions) {
|
|
10
|
+
throw new InvalidRequestError({
|
|
11
|
+
message: "Remote permissions are not supported in isomorphic client",
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
if (!("context" in permissions)) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
const isMAV2 = (parsedCi && parsedCi.factoryType === "MAv2.0.0-sma-b") ||
|
|
18
|
+
(delegation7702 &&
|
|
19
|
+
getAccountTypeForDelegationAddress7702(delegation7702) ===
|
|
20
|
+
"ModularAccountV2");
|
|
21
|
+
if (!isMAV2) {
|
|
9
22
|
throw new InvalidRequestError({
|
|
10
23
|
message: "Permissions are currently only supported by MAv2 accounts",
|
|
11
24
|
});
|
|
12
25
|
}
|
|
13
|
-
const context = decodePermissionsContext(
|
|
26
|
+
const context = decodePermissionsContext(permissions);
|
|
14
27
|
if (context?.contextVersion === "REMOTE_MODE_DEFERRED_ACTION") {
|
|
15
28
|
throw new InvalidRequestError({
|
|
16
29
|
message: "Remote mode deferred action not supported in isomorphic client",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parsePermissionsContext.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/parsePermissionsContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"parsePermissionsContext.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/parsePermissionsContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,sCAAsC,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EACL,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,UAAU,uBAAuB,CACrC,WAAwD,EACxD,QAA8D,EAC9D,cAAwB;IAExB,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,WAAW,IAAI,WAAW,EAAE,CAAC;QAC/B,MAAM,IAAI,mBAAmB,CAAC;YAC5B,OAAO,EAAE,2DAA2D;SACrE,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,CAAC,SAAS,IAAI,WAAW,CAAC,EAAE,CAAC;QAChC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,MAAM,GACV,CAAC,QAAQ,IAAI,QAAQ,CAAC,WAAW,KAAK,gBAAgB,CAAC;QACvD,CAAC,cAAc;YACb,sCAAsC,CAAC,cAAc,CAAC;gBACpD,kBAAkB,CAAC,CAAC;IAE1B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,mBAAmB,CAAC;YAC5B,OAAO,EAAE,2DAA2D;SACrE,CAAC,CAAC;IACL,CAAC;IAED,MAAM,OAAO,GAAG,wBAAwB,CAAC,WAAW,CAAC,CAAC;IAEtD,IAAI,OAAO,EAAE,cAAc,KAAK,6BAA6B,EAAE,CAAC;QAC9D,MAAM,IAAI,mBAAmB,CAAC;YAC5B,OAAO,EAAE,gEAAgE;SAC1E,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import type { StaticDecode } from \"@sinclair/typebox\";\nimport { InvalidRequestError } from \"ox/RpcResponse\";\nimport type { Address } from \"viem\";\nimport { getAccountTypeForDelegationAddress7702 } from \"./7702.js\";\nimport {\n decodePermissionsContext,\n PermissionsCapability,\n} from \"@alchemy/wallet-api-types/capabilities\";\nimport { SerializedInitcode } from \"@alchemy/wallet-api-types\";\n\nexport function parsePermissionsContext(\n permissions?: StaticDecode<typeof PermissionsCapability>,\n parsedCi?: StaticDecode<typeof SerializedInitcode> | undefined,\n delegation7702?: Address,\n) {\n if (!permissions) {\n return undefined;\n }\n\n if (\"sessionId\" in permissions) {\n throw new InvalidRequestError({\n message: \"Remote permissions are not supported in isomorphic client\",\n });\n }\n\n if (!(\"context\" in permissions)) {\n return undefined;\n }\n\n const isMAV2 =\n (parsedCi && parsedCi.factoryType === \"MAv2.0.0-sma-b\") ||\n (delegation7702 &&\n getAccountTypeForDelegationAddress7702(delegation7702) ===\n \"ModularAccountV2\");\n\n if (!isMAV2) {\n throw new InvalidRequestError({\n message: \"Permissions are currently only supported by MAv2 accounts\",\n });\n }\n\n const context = decodePermissionsContext(permissions);\n\n if (context?.contextVersion === \"REMOTE_MODE_DEFERRED_ACTION\") {\n throw new InvalidRequestError({\n message: \"Remote mode deferred action not supported in isomorphic client\",\n });\n }\n\n return context;\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { StaticDecode } from "@sinclair/typebox";
|
|
2
|
+
import type { SerializedInitcode } from "@alchemy/wallet-api-types";
|
|
3
|
+
export type Feature = "permissions";
|
|
4
|
+
export declare function supportsFeature(counterfactualInfo: StaticDecode<typeof SerializedInitcode>, feature: Feature): boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const supportedFeatures = {
|
|
2
|
+
"LightAccountV1.0.1": [],
|
|
3
|
+
"LightAccountV1.0.2": [],
|
|
4
|
+
"LightAccountV1.1.0": [],
|
|
5
|
+
"LightAccountV2.0.0": [],
|
|
6
|
+
"LightAccountV2.0.0-MultiOwner": [],
|
|
7
|
+
"MAv1.0.0-MultiOwner": [],
|
|
8
|
+
"MAv1.0.0-MultiSig": [],
|
|
9
|
+
"MAv2.0.0-sma-b": ["permissions"],
|
|
10
|
+
"MAv2.0.0-ma-ssv": ["permissions"],
|
|
11
|
+
"MAv2.0.0-ma-webauthn": [],
|
|
12
|
+
unknown: [],
|
|
13
|
+
};
|
|
14
|
+
export function supportsFeature(counterfactualInfo, feature) {
|
|
15
|
+
const factorySupportedFeatures = supportedFeatures[counterfactualInfo.factoryType];
|
|
16
|
+
if (factorySupportedFeatures === undefined) {
|
|
17
|
+
throw new Error("Unsupported FactoryType: " + counterfactualInfo.factoryType);
|
|
18
|
+
}
|
|
19
|
+
return factorySupportedFeatures.includes(feature);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=supportsFeature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supportsFeature.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/supportsFeature.ts"],"names":[],"mappings":"AAOA,MAAM,iBAAiB,GAAmC;IACxD,oBAAoB,EAAE,EAAE;IACxB,oBAAoB,EAAE,EAAE;IACxB,oBAAoB,EAAE,EAAE;IACxB,oBAAoB,EAAE,EAAE;IACxB,+BAA+B,EAAE,EAAE;IACnC,qBAAqB,EAAE,EAAE;IACzB,mBAAmB,EAAE,EAAE;IACvB,gBAAgB,EAAE,CAAC,aAAa,CAAC;IACjC,iBAAiB,EAAE,CAAC,aAAa,CAAC;IAClC,sBAAsB,EAAE,EAAE;IAC1B,OAAO,EAAE,EAAE;CACZ,CAAC;AAEF,MAAM,UAAU,eAAe,CAC7B,kBAA2D,EAC3D,OAAgB;IAEhB,MAAM,wBAAwB,GAC5B,iBAAiB,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;IACpD,IAAI,wBAAwB,KAAK,SAAS,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CACb,2BAA2B,GAAG,kBAAkB,CAAC,WAAW,CAC7D,CAAC;IACJ,CAAC;IACD,OAAO,wBAAwB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import type { StaticDecode } from \"@sinclair/typebox\";\nimport type { SerializedInitcode } from \"@alchemy/wallet-api-types\";\n\nexport type Feature = \"permissions\";\n\ntype FactoryType = StaticDecode<typeof SerializedInitcode>[\"factoryType\"];\n\nconst supportedFeatures: Record<FactoryType, Feature[]> = {\n \"LightAccountV1.0.1\": [],\n \"LightAccountV1.0.2\": [],\n \"LightAccountV1.1.0\": [],\n \"LightAccountV2.0.0\": [],\n \"LightAccountV2.0.0-MultiOwner\": [],\n \"MAv1.0.0-MultiOwner\": [],\n \"MAv1.0.0-MultiSig\": [],\n \"MAv2.0.0-sma-b\": [\"permissions\"],\n \"MAv2.0.0-ma-ssv\": [\"permissions\"],\n \"MAv2.0.0-ma-webauthn\": [],\n unknown: [],\n};\n\nexport function supportsFeature(\n counterfactualInfo: StaticDecode<typeof SerializedInitcode>,\n feature: Feature,\n): boolean {\n const factorySupportedFeatures =\n supportedFeatures[counterfactualInfo.factoryType];\n if (factorySupportedFeatures === undefined) {\n throw new Error(\n \"Unsupported FactoryType: \" + counterfactualInfo.factoryType,\n );\n }\n return factorySupportedFeatures.includes(feature);\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type Address
|
|
2
|
-
import type { CreateInnerClientParams, InnerWalletApiClient } from "../types";
|
|
3
|
-
export declare function createLocalClient<TAccount extends
|
|
1
|
+
import { type Address } from "viem";
|
|
2
|
+
import type { CreateInnerClientParams, InnerWalletApiClient } from "../types.ts";
|
|
3
|
+
export declare function createLocalClient<TAccount extends Address | undefined = Address | undefined>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient;
|
package/dist/esm/local/client.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { split } from "@aa-sdk/core";
|
|
2
2
|
import { buildDeferredActionDigest } from "@account-kit/smart-contracts/experimental";
|
|
3
3
|
import { createClient, custom } from "viem";
|
|
4
|
-
import { encodePermissionsContext, prefixSignatureKeyType, } from "
|
|
4
|
+
import { encodePermissionsContext, prefixSignatureKeyType, } from "@alchemy/wallet-api-types/capabilities";
|
|
5
5
|
import { signSignatureRequest } from "../client/actions/signSignatureRequest.js";
|
|
6
|
+
import { internalStateDecorator } from "../internal/decorator.js";
|
|
6
7
|
import { createIsomorphicClient, } from "../isomorphic/client.js";
|
|
7
8
|
import { assertNever } from "../utils.js";
|
|
8
9
|
const localMethods = [
|
|
@@ -56,6 +57,8 @@ export function createLocalClient(params) {
|
|
|
56
57
|
return assertNever(args.method, `Unexpected method: ${args.method}`);
|
|
57
58
|
}
|
|
58
59
|
},
|
|
60
|
+
}, {
|
|
61
|
+
retryCount: 0,
|
|
59
62
|
}),
|
|
60
63
|
},
|
|
61
64
|
],
|
|
@@ -65,22 +68,26 @@ export function createLocalClient(params) {
|
|
|
65
68
|
transport: innerTransport,
|
|
66
69
|
chain,
|
|
67
70
|
account,
|
|
68
|
-
})
|
|
71
|
+
})
|
|
72
|
+
.extend(() => ({
|
|
69
73
|
policyId,
|
|
70
74
|
...innerClientActions(isomorphicClient),
|
|
75
|
+
}))
|
|
76
|
+
.extend(() => ({
|
|
77
|
+
internal: internalStateDecorator(),
|
|
71
78
|
}));
|
|
72
79
|
}
|
|
73
80
|
const innerClientActions = (isomorphicClient) => {
|
|
74
81
|
return {
|
|
75
82
|
grantPermissions: async (signer, params) => {
|
|
76
83
|
const { signatureRequest, fullPreSignatureDeferredActionDigest } = await isomorphicClient.createSession(params);
|
|
77
|
-
const
|
|
84
|
+
const signature = await signSignatureRequest(signer, signatureRequest);
|
|
78
85
|
return {
|
|
79
86
|
context: encodePermissionsContext({
|
|
80
87
|
contextVersion: "LOCAL_MODE_DEFERRED_ACTION",
|
|
81
88
|
deferredAction: buildDeferredActionDigest({
|
|
82
89
|
fullPreSignatureDeferredActionDigest,
|
|
83
|
-
sig: prefixSignatureKeyType(signature,
|
|
90
|
+
sig: prefixSignatureKeyType(signature.data, signature.type),
|
|
84
91
|
}),
|
|
85
92
|
}),
|
|
86
93
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/local/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/local/client.ts"],"names":[],"mappings":"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","sourcesContent":["import { split } from \"@aa-sdk/core\";\nimport { buildDeferredActionDigest } from \"@account-kit/smart-contracts/experimental\";\nimport { createClient, custom, type Address } from \"viem\";\nimport {\n encodePermissionsContext,\n prefixSignatureKeyType,\n} from \"@alchemy/wallet-api-types/capabilities\";\nimport { signSignatureRequest } from \"../client/actions/signSignatureRequest.js\";\nimport { internalStateDecorator } from \"../internal/decorator.js\";\nimport type { PrepareCallsParams } from \"../isomorphic/actions/prepareCalls.ts\";\nimport {\n createIsomorphicClient,\n type IsomorphicClient,\n} from \"../isomorphic/client.js\";\nimport type {\n CreateInnerClientParams,\n InnerClientActions,\n InnerWalletApiClient,\n} from \"../types.ts\";\nimport { assertNever } from \"../utils.js\";\n\nconst localMethods = [\n \"wallet_prepareCalls\",\n \"wallet_sendPreparedCalls\",\n \"wallet_getCallsStatus\",\n \"wallet_createSession\",\n] as const satisfies string[];\ntype LocalMethod = (typeof localMethods)[number];\n\nexport function createLocalClient<\n TAccount extends Address | undefined = Address | undefined,\n>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient;\n\nexport function createLocalClient(\n params: CreateInnerClientParams,\n): InnerWalletApiClient {\n const { chain, transport, policyId, account } = params;\n const isomorphicClient = createIsomorphicClient({\n transport,\n chain,\n policyId,\n useErc7677middleware: false,\n });\n\n const clientMap: Record<string, ReturnType<typeof createIsomorphicClient>> = {\n [policyId ?? \"default\"]: isomorphicClient,\n };\n\n const innerTransport = split({\n overrides: [\n {\n methods: localMethods,\n transport: custom(\n {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async request(args: { method: LocalMethod; params: any }) {\n switch (args.method) {\n case \"wallet_prepareCalls\": {\n const params = args.params[0] as PrepareCallsParams;\n const capabilityPolicyId =\n params.capabilities?.paymasterService?.policyId;\n\n if (\n capabilityPolicyId != null &&\n policyId !== capabilityPolicyId &&\n !clientMap[capabilityPolicyId]\n ) {\n clientMap[capabilityPolicyId] = createIsomorphicClient({\n transport,\n chain,\n policyId: capabilityPolicyId,\n });\n }\n\n const client =\n clientMap[capabilityPolicyId ?? policyId ?? \"default\"];\n return client.prepareCalls(params);\n }\n case \"wallet_sendPreparedCalls\":\n return isomorphicClient.sendPreparedCalls(args.params[0]);\n case \"wallet_getCallsStatus\":\n return isomorphicClient.getCallsStatus(args.params[0]);\n case \"wallet_createSession\": {\n return isomorphicClient.createSession(args.params[0]);\n }\n default:\n return assertNever(\n args.method,\n `Unexpected method: ${args.method}`,\n );\n }\n },\n },\n {\n retryCount: 0,\n },\n ),\n },\n ],\n fallback: transport,\n });\n\n return createClient({\n transport: innerTransport,\n chain,\n account,\n })\n .extend(() => ({\n policyId,\n ...innerClientActions(isomorphicClient),\n }))\n .extend(() => ({\n internal: internalStateDecorator(),\n }));\n}\n\nconst innerClientActions = (\n isomorphicClient: IsomorphicClient,\n): InnerClientActions => {\n return {\n grantPermissions: async (signer, params) => {\n const { signatureRequest, fullPreSignatureDeferredActionDigest } =\n await isomorphicClient.createSession(params);\n const signature = await signSignatureRequest(signer, signatureRequest);\n return {\n context: encodePermissionsContext({\n contextVersion: \"LOCAL_MODE_DEFERRED_ACTION\",\n deferredAction: buildDeferredActionDigest({\n fullPreSignatureDeferredActionDigest,\n sig: prefixSignatureKeyType(signature.data, signature.type),\n }),\n }),\n };\n },\n };\n};\n"]}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import { type Address
|
|
2
|
-
import type { CreateInnerClientParams, InnerWalletApiClient } from "../types";
|
|
3
|
-
|
|
1
|
+
import { type Address } from "viem";
|
|
2
|
+
import type { CreateInnerClientParams, InnerWalletApiClient } from "../types.ts";
|
|
3
|
+
/**
|
|
4
|
+
* This is a low-level client just used to make RPC requests in remote mode
|
|
5
|
+
* This should be wrapped by a higher-level smart account client that provides actions
|
|
6
|
+
* that uses this client under the hood
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function createRemoteClient<TAccount extends Address | undefined = Address | undefined>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient;
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import { Provider } from "ox";
|
|
2
2
|
import { createClient, custom } from "viem";
|
|
3
|
-
import { encodePermissionsContext } from "
|
|
3
|
+
import { encodePermissionsContext } from "@alchemy/wallet-api-types/capabilities";
|
|
4
|
+
import { WalletServerRpcSchema } from "@alchemy/wallet-api-types/rpc";
|
|
4
5
|
import { signSignatureRequest } from "../client/actions/signSignatureRequest.js";
|
|
5
|
-
import {
|
|
6
|
-
/**
|
|
7
|
-
* This is a low-level client just used to make RPC requests in remote mode
|
|
8
|
-
* This should be wrapped by a higher-level smart account client that provides actions
|
|
9
|
-
* that uses this client under the hood
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
6
|
+
import { internalStateDecorator } from "../internal/decorator.js";
|
|
12
7
|
export function createRemoteClient(params) {
|
|
13
8
|
const { transport, chain, account } = params;
|
|
14
9
|
const client = createClient({
|
|
15
10
|
transport: (opts) => custom(Provider.from(transport(opts), { schema: WalletServerRpcSchema }))(opts),
|
|
16
11
|
chain,
|
|
17
12
|
account,
|
|
18
|
-
})
|
|
13
|
+
})
|
|
14
|
+
.extend((_client) => ({
|
|
19
15
|
policyId: params.policyId,
|
|
20
16
|
...innerClientActions(_client),
|
|
17
|
+
}))
|
|
18
|
+
.extend(() => ({
|
|
19
|
+
internal: internalStateDecorator(),
|
|
21
20
|
}));
|
|
22
21
|
return client;
|
|
23
22
|
}
|
|
@@ -28,12 +27,12 @@ const innerClientActions = (apiClient) => {
|
|
|
28
27
|
method: "wallet_createSession",
|
|
29
28
|
params: [params],
|
|
30
29
|
});
|
|
31
|
-
const
|
|
30
|
+
const signature = await signSignatureRequest(signer, signatureRequest);
|
|
32
31
|
return {
|
|
33
32
|
context: encodePermissionsContext({
|
|
34
33
|
contextVersion: "REMOTE_MODE_DEFERRED_ACTION",
|
|
35
34
|
sessionId,
|
|
36
|
-
signature,
|
|
35
|
+
signature: signature.data,
|
|
37
36
|
}),
|
|
38
37
|
};
|
|
39
38
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/remote/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/remote/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,EAAgB,MAAM,MAAM,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAkBlE,MAAM,UAAU,kBAAkB,CAChC,MAA+B;IAE/B,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAE7C,MAAM,MAAM,GAAG,YAAY,CAAC;QAC1B,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAClB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAAC,CAAC,CACvE,IAAI,CACL;QACH,KAAK;QACL,OAAO;KACR,CAAC;SACC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,GAAG,kBAAkB,CAAC,OAAO,CAAC;KAC/B,CAAC,CAAC;SACF,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;QACb,QAAQ,EAAE,sBAAsB,EAAE;KACnC,CAAC,CAAC,CAAC;IAEN,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,kBAAkB,GAAG,CACzB,SAAmC,EACf,EAAE;IACtB,OAAO;QACL,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACzC,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC;gBAC9D,MAAM,EAAE,sBAAsB;gBAC9B,MAAM,EAAE,CAAC,MAAM,CAAC;aACjB,CAAC,CAAC;YACH,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;YACvE,OAAO;gBACL,OAAO,EAAE,wBAAwB,CAAC;oBAChC,cAAc,EAAE,6BAA6B;oBAC7C,SAAS;oBACT,SAAS,EAAE,SAAS,CAAC,IAAI;iBAC1B,CAAC;aACH,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Provider } from \"ox\";\nimport { createClient, custom, type Address } from \"viem\";\nimport { encodePermissionsContext } from \"@alchemy/wallet-api-types/capabilities\";\nimport { WalletServerRpcSchema } from \"@alchemy/wallet-api-types/rpc\";\nimport { signSignatureRequest } from \"../client/actions/signSignatureRequest.js\";\nimport { internalStateDecorator } from \"../internal/decorator.js\";\nimport type {\n CreateInnerClientParams,\n InnerClientActions,\n InnerWalletApiClient,\n InnerWalletApiClientBase,\n} from \"../types.ts\";\n\n/**\n * This is a low-level client just used to make RPC requests in remote mode\n * This should be wrapped by a higher-level smart account client that provides actions\n * that uses this client under the hood\n * @returns\n */\nexport function createRemoteClient<\n TAccount extends Address | undefined = Address | undefined,\n>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient;\n\nexport function createRemoteClient(\n params: CreateInnerClientParams,\n): InnerWalletApiClient {\n const { transport, chain, account } = params;\n\n const client = createClient({\n transport: (opts) =>\n custom(Provider.from(transport(opts), { schema: WalletServerRpcSchema }))(\n opts,\n ),\n chain,\n account,\n })\n .extend((_client) => ({\n policyId: params.policyId,\n ...innerClientActions(_client),\n }))\n .extend(() => ({\n internal: internalStateDecorator(),\n }));\n\n return client;\n}\n\nconst innerClientActions = (\n apiClient: InnerWalletApiClientBase,\n): InnerClientActions => {\n return {\n grantPermissions: async (signer, params) => {\n const { sessionId, signatureRequest } = await apiClient.request({\n method: \"wallet_createSession\",\n params: [params],\n });\n const signature = await signSignatureRequest(signer, signatureRequest);\n return {\n context: encodePermissionsContext({\n contextVersion: \"REMOTE_MODE_DEFERRED_ACTION\",\n sessionId,\n signature: signature.data,\n }),\n };\n },\n };\n};\n"]}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
|
+
import type { SmartAccountSigner, SmartContractAccount } from "@aa-sdk/core";
|
|
1
2
|
import type { AlchemyTransport } from "@account-kit/infra";
|
|
2
|
-
import type { Address, Chain, Client, Hex,
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
export type CreateInnerClientParams<TAccount extends
|
|
3
|
+
import type { Address, Chain, Client, Hex, JsonRpcAccount, Transport } from "viem";
|
|
4
|
+
import type { GrantPermissionsParams, GrantPermissionsResult } from "./client/actions/grantPermissions.ts";
|
|
5
|
+
import type { RequestAccountParams } from "./client/actions/requestAccount.ts";
|
|
6
|
+
import type { WalletServerViemRpcSchema } from "@alchemy/wallet-api-types/rpc";
|
|
7
|
+
export type CreateInnerClientParams<TAccount extends Address | undefined = Address | undefined> = {
|
|
7
8
|
chain: Chain;
|
|
8
9
|
transport: AlchemyTransport;
|
|
9
10
|
policyId?: string;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
account: Address;
|
|
14
|
-
});
|
|
15
|
-
export type InnerWalletApiClientBase<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined, TExtend extends {
|
|
11
|
+
account?: TAccount | Address | undefined;
|
|
12
|
+
};
|
|
13
|
+
export type InnerWalletApiClientBase<TExtend extends {
|
|
16
14
|
[key: string]: unknown;
|
|
17
15
|
} | undefined = {
|
|
18
16
|
[key: string]: unknown;
|
|
19
|
-
} | undefined> = Client<Transport, Chain,
|
|
17
|
+
} | undefined> = Client<Transport, Chain, JsonRpcAccount<Address> | undefined, WalletServerViemRpcSchema, {
|
|
20
18
|
policyId?: string;
|
|
21
19
|
} & TExtend>;
|
|
22
20
|
export type InnerClientActions = {
|
|
@@ -24,4 +22,20 @@ export type InnerClientActions = {
|
|
|
24
22
|
chainId: Hex;
|
|
25
23
|
}) => Promise<GrantPermissionsResult>;
|
|
26
24
|
};
|
|
27
|
-
export type
|
|
25
|
+
export type CachedAccount = {
|
|
26
|
+
account: SmartContractAccount;
|
|
27
|
+
requestParams: RequestAccountParams;
|
|
28
|
+
};
|
|
29
|
+
export type InternalState = {
|
|
30
|
+
setAccount: (account: CachedAccount) => void;
|
|
31
|
+
getAccount: () => CachedAccount | undefined;
|
|
32
|
+
};
|
|
33
|
+
export type InnerWalletApiClient = InnerWalletApiClientBase<InnerClientActions & {
|
|
34
|
+
internal: InternalState;
|
|
35
|
+
}>;
|
|
36
|
+
export type WithoutChainId<T> = T extends {
|
|
37
|
+
chainId: Hex;
|
|
38
|
+
} ? Omit<T, "chainId"> : T;
|
|
39
|
+
export type WithoutRawPayload<T> = T extends {
|
|
40
|
+
rawPayload: Hex;
|
|
41
|
+
} ? Omit<T, "rawPayload"> : T;
|
package/dist/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AlchemyTransport } from \"@account-kit/infra\";\nimport type {\n Address,\n Chain,\n Client,\n Hex,\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { SmartAccountSigner, SmartContractAccount } from \"@aa-sdk/core\";\nimport type { AlchemyTransport } from \"@account-kit/infra\";\nimport type {\n Address,\n Chain,\n Client,\n Hex,\n JsonRpcAccount,\n Transport,\n} from \"viem\";\nimport type {\n GrantPermissionsParams,\n GrantPermissionsResult,\n} from \"./client/actions/grantPermissions.ts\";\nimport type { RequestAccountParams } from \"./client/actions/requestAccount.ts\";\nimport type { WalletServerViemRpcSchema } from \"@alchemy/wallet-api-types/rpc\";\n\nexport type CreateInnerClientParams<\n TAccount extends Address | undefined = Address | undefined,\n> = {\n chain: Chain;\n transport: AlchemyTransport;\n policyId?: string;\n account?: TAccount | Address | undefined;\n};\n\nexport type InnerWalletApiClientBase<\n TExtend extends { [key: string]: unknown } | undefined =\n | { [key: string]: unknown }\n | undefined,\n> = Client<\n Transport,\n Chain,\n JsonRpcAccount<Address> | undefined,\n WalletServerViemRpcSchema,\n { policyId?: string } & TExtend\n>;\n\nexport type InnerClientActions = {\n grantPermissions: (\n signer: SmartAccountSigner,\n params: GrantPermissionsParams & { chainId: Hex },\n ) => Promise<GrantPermissionsResult>;\n};\n\nexport type CachedAccount = {\n account: SmartContractAccount;\n requestParams: RequestAccountParams;\n};\n\nexport type InternalState = {\n setAccount: (account: CachedAccount) => void;\n getAccount: () => CachedAccount | undefined;\n};\n\nexport type InnerWalletApiClient = InnerWalletApiClientBase<\n InnerClientActions & { internal: InternalState }\n>;\n\nexport type WithoutChainId<T> = T extends { chainId: Hex }\n ? Omit<T, \"chainId\">\n : T;\n\nexport type WithoutRawPayload<T> = T extends { rawPayload: Hex }\n ? Omit<T, \"rawPayload\">\n : T;\n"]}
|
package/dist/esm/utils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Hex } from "viem";
|
|
2
|
+
export type Expect<T extends true> = T;
|
|
2
3
|
export declare const assertNever: (_val: never, msg: string) => never;
|
|
3
4
|
/** If the value is already Hex, it is returned unchanged. If it's a string, number or bigint, it's converted. */
|
|
4
5
|
export declare const castToHex: (val: string | number | bigint | Hex) => Hex;
|
package/dist/esm/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAY,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAY,MAAM,MAAM,CAAC;AAI9C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAW,EAAE,GAAW,EAAS,EAAE;IAC7D,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC;AAEF,iHAAiH;AACjH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAmC,EAAO,EAAE;IACpE,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACf,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;AACpB,CAAC,CAAC","sourcesContent":["import { isHex, toHex, type Hex } from \"viem\";\n\nexport type Expect<T extends true> = T;\n\nexport const assertNever = (_val: never, msg: string): never => {\n throw new Error(msg);\n};\n\n/** If the value is already Hex, it is returned unchanged. If it's a string, number or bigint, it's converted. */\nexport const castToHex = (val: string | number | bigint | Hex): Hex => {\n if (isHex(val)) {\n return val;\n }\n return toHex(val);\n};\n"]}
|
|
@@ -1,11 +1,36 @@
|
|
|
1
1
|
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
2
2
|
import type { Static } from "@sinclair/typebox";
|
|
3
3
|
import type { Address } from "abitype";
|
|
4
|
-
import type { wallet_createAccount } from "
|
|
5
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
4
|
+
import type { wallet_createAccount } from "@alchemy/wallet-api-types/rpc";
|
|
5
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
6
6
|
export type CreateAccountParams = Omit<Extract<Static<typeof wallet_createAccount>["Request"]["params"][0], {
|
|
7
7
|
signerAddress: Address;
|
|
8
8
|
}>, "signerAddress">;
|
|
9
9
|
export type CreateAccountResult = Static<typeof wallet_createAccount>["ReturnType"];
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new account for the provided signer using the wallet API client.
|
|
12
|
+
* This method is primarily used to import existing accounts.
|
|
13
|
+
* For most cases, you should use requestAccount instead.
|
|
14
|
+
* If the account already exists, an error will be thrown.
|
|
15
|
+
*
|
|
16
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
17
|
+
* @param {SmartAccountSigner} signer - The signer that will be associated with the account
|
|
18
|
+
* @param {CreateAccountParams} params - Parameters for creating the account
|
|
19
|
+
* @param {string} [params.id] - Optional UUID v4 identifier for the account
|
|
20
|
+
* @param {object} params.creationOptions - Options for account creation
|
|
21
|
+
* @param {string} [params.creationOptions.accountType] - Currently only "sma-b" (Modular Account v2) is supported
|
|
22
|
+
* @param {string} [params.creationOptions.salt] - Optional hex string to use as salt for account creation
|
|
23
|
+
* @returns {Promise<CreateAccountResult>} A Promise that resolves to the created account information
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Create a new account with a custom salt
|
|
27
|
+
* const account = await client.createAccount({
|
|
28
|
+
* creationOptions: {
|
|
29
|
+
* accountType: "sma-b",
|
|
30
|
+
* salt: "0x04"
|
|
31
|
+
* }
|
|
32
|
+
* });
|
|
33
|
+
* console.log(`Created account at address: ${account.accountAddress}`);
|
|
34
|
+
*/
|
|
10
35
|
export declare function createAccount(client: InnerWalletApiClient, signer: SmartAccountSigner, params: CreateAccountParams): Promise<CreateAccountResult>;
|
|
11
36
|
//# sourceMappingURL=createAccount.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAccount.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/createAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"createAccount.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/createAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,OAAO,CACL,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAC3D;IAAE,aAAa,EAAE,OAAO,CAAA;CAAE,CAC3B,EACD,eAAe,CAChB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CACtC,OAAO,oBAAoB,CAC5B,CAAC,YAAY,CAAC,CAAC;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,CAAC,CAK9B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Static } from "@sinclair/typebox";
|
|
2
|
+
import type { wallet_formatSign } from "@alchemy/wallet-api-types/rpc";
|
|
3
|
+
import type { InnerWalletApiClient, WithoutChainId } from "../../types.ts";
|
|
4
|
+
import { type Address, type IsUndefined } from "viem";
|
|
5
|
+
export type FormatSignParams<TAccount extends Address | undefined = Address | undefined> = Omit<WithoutChainId<Static<(typeof wallet_formatSign)["properties"]["Request"]["properties"]["params"]>[0]>, "from"> & (IsUndefined<TAccount> extends true ? {
|
|
6
|
+
from: Address;
|
|
7
|
+
} : {
|
|
8
|
+
from?: never;
|
|
9
|
+
});
|
|
10
|
+
export type FormatSignResult = Static<typeof wallet_formatSign>["ReturnType"];
|
|
11
|
+
/**
|
|
12
|
+
* Formats a signature request for signing messages or transactions.
|
|
13
|
+
*
|
|
14
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
15
|
+
* @param {FormatSignParams} params - Parameters for formatting the signature
|
|
16
|
+
* @returns {Promise<FormatSignResult>} A Promise that resolves to the formatSign result containing the formatted signature.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // Formats a signature
|
|
20
|
+
* const result = await client.formatSign({
|
|
21
|
+
* from: "0x1234...",
|
|
22
|
+
* signature: {
|
|
23
|
+
* type: "ecdsa",
|
|
24
|
+
* data: "0xabcd..."
|
|
25
|
+
* },
|
|
26
|
+
* });
|
|
27
|
+
*/
|
|
28
|
+
export declare function formatSign<TAccount extends Address | undefined = Address | undefined>(client: InnerWalletApiClient, params: FormatSignParams<TAccount>): Promise<FormatSignResult>;
|
|
29
|
+
//# sourceMappingURL=formatSign.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatSign.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/formatSign.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAS,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,MAAM,CAAC;AAG7D,MAAM,MAAM,gBAAgB,CAC1B,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACxD,IAAI,CACN,cAAc,CACZ,MAAM,CACJ,CAAC,OAAO,iBAAiB,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,CAC5E,CAAC,CAAC,CAAC,CACL,EACD,MAAM,CACP,GACC,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,IAAI,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,IAAI,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC;AAE9E,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC,YAAY,CAAC,CAAC;AAE9E;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAE1D,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,GACjC,OAAO,CAAC,gBAAgB,CAAC,CAU3B"}
|
|
@@ -1,7 +1,25 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { InnerWalletApiClient } from "../../types";
|
|
1
|
+
import type { GetCallsStatusParams as IsomorphicGetCallsStatusParams, GetCallsStatusResponse as IsomorphicGetCallsStatusResult } from "../../isomorphic/actions/getCallsStatus.ts";
|
|
2
|
+
import type { InnerWalletApiClient } from "../../types.ts";
|
|
4
3
|
export type GetCallsStatusParams = IsomorphicGetCallsStatusParams;
|
|
5
4
|
export type GetCallsStatusResult = IsomorphicGetCallsStatusResult;
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Gets the status of a prepared call by its ID.
|
|
7
|
+
* This method is used to check the execution status of calls sent via sendPreparedCalls.
|
|
8
|
+
*
|
|
9
|
+
* @param {InnerWalletApiClient} client - The wallet API client to use for the request
|
|
10
|
+
* @param {GetCallsStatusParams} params - The ID of the prepared call to check
|
|
11
|
+
* @returns {Promise<GetCallsStatusResult>} A Promise that resolves to the status information including:
|
|
12
|
+
* - id: The hex ID of the call
|
|
13
|
+
* - chainId: The chain ID in hex format
|
|
14
|
+
* - status: The current status of the batch execution
|
|
15
|
+
* - receipts: Optional array of transaction receipts if the batch has been executed
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // After sending prepared calls
|
|
19
|
+
* const sendResult = await client.sendPreparedCalls({...});
|
|
20
|
+
*
|
|
21
|
+
* // Check the status of the first call ID
|
|
22
|
+
* const status = await client.getCallsStatus(sendResult.preparedCallIds[0]);
|
|
23
|
+
*/
|
|
24
|
+
export declare function getCallsStatus(client: InnerWalletApiClient, params: GetCallsStatusParams): Promise<GetCallsStatusResult>;
|
|
7
25
|
//# sourceMappingURL=getCallsStatus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCallsStatus.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/getCallsStatus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"getCallsStatus.d.ts","sourceRoot":"","sources":["../../../../src/client/actions/getCallsStatus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,IAAI,8BAA8B,EACtD,sBAAsB,IAAI,8BAA8B,EACzD,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,MAAM,oBAAoB,GAAG,8BAA8B,CAAC;AAElE,MAAM,MAAM,oBAAoB,GAAG,8BAA8B,CAAC;AAElE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,oBAAoB,CAAC,CAK/B"}
|