@alchemy/wallet-apis 5.0.0-beta.8 → 5.0.1
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/README.md +2 -0
- package/dist/esm/actions/prepareCalls.d.ts +8 -3
- package/dist/esm/actions/prepareCalls.js +8 -0
- package/dist/esm/actions/prepareCalls.js.map +1 -1
- package/dist/esm/actions/requestAccount.d.ts +4 -3
- package/dist/esm/actions/requestAccount.js.map +1 -1
- package/dist/esm/actions/sendCalls.d.ts +5 -2
- package/dist/esm/actions/sendCalls.js +5 -2
- package/dist/esm/actions/sendCalls.js.map +1 -1
- package/dist/esm/actions/sendPreparedCalls.d.ts +3 -1
- package/dist/esm/actions/sendPreparedCalls.js.map +1 -1
- package/dist/esm/actions/signPreparedCalls.d.ts +2 -0
- package/dist/esm/actions/signPreparedCalls.js +14 -1
- package/dist/esm/actions/signPreparedCalls.js.map +1 -1
- package/dist/esm/actions/signSignatureRequest.d.ts +4 -4
- package/dist/esm/actions/signSignatureRequest.js +1 -1
- package/dist/esm/actions/signSignatureRequest.js.map +1 -1
- package/dist/esm/actions/signTypedData.d.ts +14 -4
- package/dist/esm/actions/signTypedData.js.map +1 -1
- package/dist/esm/actions/solana/getCallsStatus.d.ts +24 -0
- package/dist/esm/actions/solana/getCallsStatus.js +44 -0
- package/dist/esm/actions/solana/getCallsStatus.js.map +1 -0
- package/dist/esm/actions/solana/prepareCalls.d.ts +46 -0
- package/dist/esm/actions/solana/prepareCalls.js +70 -0
- package/dist/esm/actions/solana/prepareCalls.js.map +1 -0
- package/dist/esm/actions/solana/sendCalls.d.ts +34 -0
- package/dist/esm/actions/solana/sendCalls.js +44 -0
- package/dist/esm/actions/solana/sendCalls.js.map +1 -0
- package/dist/esm/actions/solana/sendPreparedCalls.d.ts +24 -0
- package/dist/esm/actions/solana/sendPreparedCalls.js +32 -0
- package/dist/esm/actions/solana/sendPreparedCalls.js.map +1 -0
- package/dist/esm/actions/solana/signPreparedCalls.d.ts +23 -0
- package/dist/esm/actions/solana/signPreparedCalls.js +24 -0
- package/dist/esm/actions/solana/signPreparedCalls.js.map +1 -0
- package/dist/esm/actions/solana/signSignatureRequest.d.ts +10 -0
- package/dist/esm/actions/solana/signSignatureRequest.js +33 -0
- package/dist/esm/actions/solana/signSignatureRequest.js.map +1 -0
- package/dist/esm/actions/solana/waitForCallsStatus.d.ts +24 -0
- package/dist/esm/actions/solana/waitForCallsStatus.js +46 -0
- package/dist/esm/actions/solana/waitForCallsStatus.js.map +1 -0
- package/dist/esm/actions/undelegateAccount.d.ts +37 -0
- package/dist/esm/actions/undelegateAccount.js +49 -0
- package/dist/esm/actions/undelegateAccount.js.map +1 -0
- package/dist/esm/adapters/SolanaSignerError.d.ts +4 -0
- package/dist/esm/adapters/SolanaSignerError.js +13 -0
- package/dist/esm/adapters/SolanaSignerError.js.map +1 -0
- package/dist/esm/adapters/fromKeypair.d.ts +21 -0
- package/dist/esm/adapters/fromKeypair.js +46 -0
- package/dist/esm/adapters/fromKeypair.js.map +1 -0
- package/dist/esm/adapters/fromKitSigner.d.ts +21 -0
- package/dist/esm/adapters/fromKitSigner.js +61 -0
- package/dist/esm/adapters/fromKitSigner.js.map +1 -0
- package/dist/esm/adapters/fromWalletAdapter.d.ts +26 -0
- package/dist/esm/adapters/fromWalletAdapter.js +45 -0
- package/dist/esm/adapters/fromWalletAdapter.js.map +1 -0
- package/dist/esm/adapters/fromWalletStandard.d.ts +31 -0
- package/dist/esm/adapters/fromWalletStandard.js +53 -0
- package/dist/esm/adapters/fromWalletStandard.js.map +1 -0
- package/dist/esm/adapters/resolveSignerSlot.d.ts +10 -0
- package/dist/esm/adapters/resolveSignerSlot.js +39 -0
- package/dist/esm/adapters/resolveSignerSlot.js.map +1 -0
- package/dist/esm/client.d.ts +29 -14
- package/dist/esm/client.js +63 -19
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/decorators/smartWalletActions.d.ts +2 -0
- package/dist/esm/decorators/smartWalletActions.js +4 -2
- package/dist/esm/decorators/smartWalletActions.js.map +1 -1
- package/dist/esm/decorators/solanaSmartWalletActions.d.ts +16 -0
- package/dist/esm/decorators/solanaSmartWalletActions.js +16 -0
- package/dist/esm/decorators/solanaSmartWalletActions.js.map +1 -0
- package/dist/esm/experimental/actions/requestQuoteV0.d.ts +48 -11
- package/dist/esm/experimental/actions/requestQuoteV0.js +8 -4
- package/dist/esm/experimental/actions/requestQuoteV0.js.map +1 -1
- package/dist/esm/experimental/swapActionsDecorator.d.ts +3 -0
- package/dist/esm/experimental/swapActionsDecorator.js.map +1 -1
- package/dist/esm/exports/index.d.ts +5 -3
- package/dist/esm/exports/index.js +1 -0
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/exports/solana.d.ts +24 -0
- package/dist/esm/exports/solana.js +15 -0
- package/dist/esm/exports/solana.js.map +1 -0
- package/dist/esm/types.d.ts +28 -4
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils/assertions.d.ts +4 -2
- package/dist/esm/utils/assertions.js +6 -0
- package/dist/esm/utils/assertions.js.map +1 -1
- package/dist/esm/utils/capabilities.d.ts +22 -6
- package/dist/esm/utils/capabilities.js +19 -2
- package/dist/esm/utils/capabilities.js.map +1 -1
- package/dist/esm/utils/format.d.ts +2 -2
- package/dist/esm/utils/format.js +4 -3
- package/dist/esm/utils/format.js.map +1 -1
- package/dist/esm/utils/schema.d.ts +14 -14
- package/dist/esm/utils/schema.js +35 -39
- package/dist/esm/utils/schema.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/actions/prepareCalls.d.ts +8 -3
- package/dist/types/actions/prepareCalls.d.ts.map +1 -1
- package/dist/types/actions/requestAccount.d.ts +4 -3
- package/dist/types/actions/requestAccount.d.ts.map +1 -1
- package/dist/types/actions/sendCalls.d.ts +5 -2
- package/dist/types/actions/sendCalls.d.ts.map +1 -1
- package/dist/types/actions/sendPreparedCalls.d.ts +3 -1
- package/dist/types/actions/sendPreparedCalls.d.ts.map +1 -1
- package/dist/types/actions/signPreparedCalls.d.ts +2 -0
- package/dist/types/actions/signPreparedCalls.d.ts.map +1 -1
- package/dist/types/actions/signSignatureRequest.d.ts +4 -4
- package/dist/types/actions/signSignatureRequest.d.ts.map +1 -1
- package/dist/types/actions/signTypedData.d.ts +14 -4
- package/dist/types/actions/signTypedData.d.ts.map +1 -1
- package/dist/types/actions/solana/getCallsStatus.d.ts +25 -0
- package/dist/types/actions/solana/getCallsStatus.d.ts.map +1 -0
- package/dist/types/actions/solana/prepareCalls.d.ts +47 -0
- package/dist/types/actions/solana/prepareCalls.d.ts.map +1 -0
- package/dist/types/actions/solana/sendCalls.d.ts +35 -0
- package/dist/types/actions/solana/sendCalls.d.ts.map +1 -0
- package/dist/types/actions/solana/sendPreparedCalls.d.ts +25 -0
- package/dist/types/actions/solana/sendPreparedCalls.d.ts.map +1 -0
- package/dist/types/actions/solana/signPreparedCalls.d.ts +24 -0
- package/dist/types/actions/solana/signPreparedCalls.d.ts.map +1 -0
- package/dist/types/actions/solana/signSignatureRequest.d.ts +11 -0
- package/dist/types/actions/solana/signSignatureRequest.d.ts.map +1 -0
- package/dist/types/actions/solana/waitForCallsStatus.d.ts +25 -0
- package/dist/types/actions/solana/waitForCallsStatus.d.ts.map +1 -0
- package/dist/types/actions/undelegateAccount.d.ts +38 -0
- package/dist/types/actions/undelegateAccount.d.ts.map +1 -0
- package/dist/types/adapters/SolanaSignerError.d.ts +5 -0
- package/dist/types/adapters/SolanaSignerError.d.ts.map +1 -0
- package/dist/types/adapters/fromKeypair.d.ts +22 -0
- package/dist/types/adapters/fromKeypair.d.ts.map +1 -0
- package/dist/types/adapters/fromKitSigner.d.ts +22 -0
- package/dist/types/adapters/fromKitSigner.d.ts.map +1 -0
- package/dist/types/adapters/fromWalletAdapter.d.ts +27 -0
- package/dist/types/adapters/fromWalletAdapter.d.ts.map +1 -0
- package/dist/types/adapters/fromWalletStandard.d.ts +32 -0
- package/dist/types/adapters/fromWalletStandard.d.ts.map +1 -0
- package/dist/types/adapters/resolveSignerSlot.d.ts +11 -0
- package/dist/types/adapters/resolveSignerSlot.d.ts.map +1 -0
- package/dist/types/client.d.ts +29 -14
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/decorators/smartWalletActions.d.ts +2 -0
- package/dist/types/decorators/smartWalletActions.d.ts.map +1 -1
- package/dist/types/decorators/solanaSmartWalletActions.d.ts +17 -0
- package/dist/types/decorators/solanaSmartWalletActions.d.ts.map +1 -0
- package/dist/types/experimental/actions/requestQuoteV0.d.ts +48 -11
- package/dist/types/experimental/actions/requestQuoteV0.d.ts.map +1 -1
- package/dist/types/experimental/swapActionsDecorator.d.ts +3 -0
- package/dist/types/experimental/swapActionsDecorator.d.ts.map +1 -1
- package/dist/types/exports/index.d.ts +5 -3
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/exports/solana.d.ts +25 -0
- package/dist/types/exports/solana.d.ts.map +1 -0
- package/dist/types/types.d.ts +28 -4
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/assertions.d.ts +4 -2
- package/dist/types/utils/assertions.d.ts.map +1 -1
- package/dist/types/utils/capabilities.d.ts +22 -6
- package/dist/types/utils/capabilities.d.ts.map +1 -1
- package/dist/types/utils/format.d.ts +2 -2
- package/dist/types/utils/format.d.ts.map +1 -1
- package/dist/types/utils/schema.d.ts +14 -14
- package/dist/types/utils/schema.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +26 -9
- package/src/actions/prepareCalls.ts +21 -3
- package/src/actions/requestAccount.ts +7 -5
- package/src/actions/sendCalls.ts +5 -2
- package/src/actions/sendPreparedCalls.ts +4 -1
- package/src/actions/signPreparedCalls.ts +15 -2
- package/src/actions/signSignatureRequest.ts +8 -8
- package/src/actions/signTypedData.ts +15 -7
- package/src/actions/solana/getCallsStatus.ts +79 -0
- package/src/actions/solana/prepareCalls.ts +120 -0
- package/src/actions/solana/sendCalls.ts +66 -0
- package/src/actions/solana/sendPreparedCalls.ts +65 -0
- package/src/actions/solana/signPreparedCalls.ts +50 -0
- package/src/actions/solana/signSignatureRequest.ts +63 -0
- package/src/actions/solana/waitForCallsStatus.ts +84 -0
- package/src/actions/undelegateAccount.ts +68 -0
- package/src/adapters/SolanaSignerError.ts +5 -0
- package/src/adapters/fromKeypair.ts +58 -0
- package/src/adapters/fromKitSigner.ts +82 -0
- package/src/adapters/fromWalletAdapter.ts +58 -0
- package/src/adapters/fromWalletStandard.ts +100 -0
- package/src/adapters/resolveSignerSlot.ts +46 -0
- package/src/client.ts +131 -18
- package/src/decorators/smartWalletActions.ts +11 -2
- package/src/decorators/solanaSmartWalletActions.ts +62 -0
- package/src/experimental/actions/requestQuoteV0.ts +40 -15
- package/src/experimental/swapActionsDecorator.ts +3 -0
- package/src/exports/index.ts +10 -4
- package/src/exports/solana.ts +36 -0
- package/src/types.ts +38 -7
- package/src/utils/assertions.ts +17 -2
- package/src/utils/capabilities.ts +40 -8
- package/src/utils/format.ts +8 -3
- package/src/utils/schema.ts +58 -69
- package/src/version.ts +1 -1
package/dist/types/types.d.ts
CHANGED
|
@@ -1,20 +1,44 @@
|
|
|
1
1
|
import type { WalletServerViemRpcSchema } from "@alchemy/wallet-api-types/rpc";
|
|
2
|
+
import type { SolanaChainId } from "@alchemy/wallet-api-types";
|
|
2
3
|
import type { Account, Address, Chain, Client, Hex, JsonRpcAccount, Transport, WalletClient, LocalAccount } from "viem";
|
|
3
4
|
import type { InternalState } from "./internal";
|
|
4
5
|
import type { SmartWalletActions } from "./decorators/smartWalletActions";
|
|
6
|
+
import type { SolanaSmartWalletActions } from "./decorators/solanaSmartWalletActions";
|
|
5
7
|
export type BaseWalletClient<TExtend extends {
|
|
6
8
|
[key: string]: unknown;
|
|
7
9
|
} | undefined = {
|
|
8
10
|
[key: string]: unknown;
|
|
9
|
-
} | undefined
|
|
11
|
+
} | undefined, TAccount extends Account | undefined = JsonRpcAccount<Address>> = Client<Transport<"alchemyHttp">, Chain, TAccount, WalletServerViemRpcSchema, TExtend>;
|
|
12
|
+
export type SignerClient = WalletClient<Transport, Chain | undefined, Account>;
|
|
13
|
+
export type SmartWalletSigner = LocalAccount | SignerClient;
|
|
14
|
+
export type SmartWalletClient = BaseWalletClient<SmartWalletActions>;
|
|
15
|
+
export type SolanaSmartWalletClient = BaseWalletClient<SolanaSmartWalletActions & {
|
|
16
|
+
solanaAccount: string;
|
|
17
|
+
}, undefined>;
|
|
18
|
+
/** Solana signer interface. Takes serialized tx bytes, returns signed serialized tx bytes. */
|
|
19
|
+
export interface SolanaSigner {
|
|
20
|
+
address: string;
|
|
21
|
+
signTransaction(input: {
|
|
22
|
+
transaction: Uint8Array;
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
}): Promise<{
|
|
25
|
+
signedTransaction: Uint8Array;
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
28
|
+
export interface SolanaChainDef extends Chain {
|
|
29
|
+
solanaChainId: SolanaChainId;
|
|
30
|
+
}
|
|
10
31
|
export type InnerWalletApiClient = BaseWalletClient<{
|
|
11
32
|
internal: InternalState | undefined;
|
|
12
33
|
owner: SmartWalletSigner;
|
|
13
34
|
policyIds?: string[];
|
|
14
35
|
}>;
|
|
15
|
-
export type
|
|
16
|
-
|
|
17
|
-
|
|
36
|
+
export type InnerSolanaWalletApiClient = BaseWalletClient<{
|
|
37
|
+
internal: InternalState | undefined;
|
|
38
|
+
owner: SolanaSigner;
|
|
39
|
+
solanaAccount: string;
|
|
40
|
+
policyIds?: string[];
|
|
41
|
+
}, undefined>;
|
|
18
42
|
export type OptionalChainId<T> = T extends {
|
|
19
43
|
chainId: number;
|
|
20
44
|
} ? Omit<T, "chainId"> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,KAAK,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,MAAM,EACN,GAAG,EACH,cAAc,EACd,SAAS,EACT,YAAY,EACZ,YAAY,EACb,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Client, LocalAccount } from "viem";
|
|
2
|
-
import type { InnerWalletApiClient, SignerClient } from "../types.js";
|
|
1
|
+
import type { Chain, Client, LocalAccount } from "viem";
|
|
2
|
+
import type { InnerWalletApiClient, InnerSolanaWalletApiClient, SignerClient, SolanaChainDef } from "../types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Type guard function to check if a client is an Alchemy Smart Wallet Client.
|
|
5
5
|
*
|
|
@@ -7,6 +7,7 @@ import type { InnerWalletApiClient, SignerClient } from "../types.js";
|
|
|
7
7
|
* @returns {boolean} True if the client is an Alchemy Smart Wallet Client
|
|
8
8
|
*/
|
|
9
9
|
export declare function isSmartWalletClient(client: Client): client is InnerWalletApiClient;
|
|
10
|
+
export declare function isSolanaClient(client: Client): client is InnerSolanaWalletApiClient;
|
|
10
11
|
/**
|
|
11
12
|
* Assertion function that throws an error if the client is not an Alchemy Smart Wallet Client.
|
|
12
13
|
* After this function returns successfully, TypeScript will narrow the client type.
|
|
@@ -16,6 +17,7 @@ export declare function isSmartWalletClient(client: Client): client is InnerWall
|
|
|
16
17
|
* @throws {Error} Throws an error if the client is not an Alchemy Smart Wallet Client
|
|
17
18
|
*/
|
|
18
19
|
export declare function assertSmartWalletClient(client: Client, message?: string): asserts client is InnerWalletApiClient;
|
|
20
|
+
export declare function isSolanaChain(chain: Chain): chain is SolanaChainDef;
|
|
19
21
|
export declare function isLocalAccount(signer: LocalAccount | SignerClient): signer is LocalAccount;
|
|
20
22
|
export declare function isSignerClient(signer: LocalAccount | SignerClient): signer is SignerClient;
|
|
21
23
|
//# sourceMappingURL=assertions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertions.d.ts","sourceRoot":"","sources":["../../../src/utils/assertions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"assertions.d.ts","sourceRoot":"","sources":["../../../src/utils/assertions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,KAAK,EACV,oBAAoB,EACpB,0BAA0B,EAC1B,YAAY,EACZ,cAAc,EACf,MAAM,aAAa,CAAC;AAGrB;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,GACb,MAAM,IAAI,oBAAoB,CAEhC;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,GACb,MAAM,IAAI,0BAA0B,CAEtC;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,EACd,OAAO,SAA4C,GAClD,OAAO,CAAC,MAAM,IAAI,oBAAoB,CAIxC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,cAAc,CAEnE;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,GAAG,YAAY,GAClC,MAAM,IAAI,YAAY,CAExB;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,GAAG,YAAY,GAClC,MAAM,IAAI,YAAY,CAExB"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { PrepareCallsCapabilities as PrepareCallsCapabilitiesSchema, SendPreparedCallsCapabilities as SendPreparedCallsCapabilitiesSchema } from "@alchemy/wallet-api-types/capabilities";
|
|
2
|
-
import type {
|
|
3
|
-
import type { InnerWalletApiClient } from "../types.js";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
import type { InnerWalletApiClient, InnerSolanaWalletApiClient } from "../types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Decoded capabilities matching the schema shape (uses `paymasterService` key).
|
|
6
6
|
* `ResolveCapabilities` renames this to `paymaster` for client-facing types.
|
|
7
7
|
*/
|
|
8
|
-
type DecodedPrepareCallsCaps =
|
|
9
|
-
type DecodedSendPreparedCallsCaps =
|
|
8
|
+
type DecodedPrepareCallsCaps = z.output<typeof PrepareCallsCapabilitiesSchema>;
|
|
9
|
+
type DecodedSendPreparedCallsCaps = z.output<typeof SendPreparedCallsCapabilitiesSchema>;
|
|
10
10
|
/**
|
|
11
11
|
* Renames `paymasterService` (RPC) to `paymaster` in a capabilities type. This
|
|
12
12
|
* is because our RPC schema's paymasterService capability does not exactly match
|
|
@@ -31,14 +31,14 @@ export type WithCapabilities<T> = T extends {
|
|
|
31
31
|
} : T;
|
|
32
32
|
/**
|
|
33
33
|
* Converts capabilities (with `paymaster`) to RPC capabilities (with `paymasterService`)
|
|
34
|
-
* for use with
|
|
34
|
+
* for use with `encode` before sending to the RPC.
|
|
35
35
|
*
|
|
36
36
|
* @param {PrepareCallsCapabilities | SendPreparedCallsCapabilities | undefined} capabilities - Capabilities object containing a `paymaster` field
|
|
37
37
|
* @returns {DecodedPrepareCallsCaps | DecodedSendPreparedCallsCaps | undefined} RPC capabilities with `paymasterService`, or undefined if input is undefined
|
|
38
38
|
*/
|
|
39
39
|
export declare function toRpcCapabilities(capabilities: PrepareCallsCapabilities | SendPreparedCallsCapabilities | undefined): DecodedPrepareCallsCaps | DecodedSendPreparedCallsCaps | undefined;
|
|
40
40
|
/**
|
|
41
|
-
* Converts RPC capabilities (with `paymasterService`) from
|
|
41
|
+
* Converts RPC capabilities (with `paymasterService`) from `decode`
|
|
42
42
|
* to capabilities (with `paymaster`).
|
|
43
43
|
*
|
|
44
44
|
* @param {DecodedPrepareCallsCaps | DecodedSendPreparedCallsCaps | undefined} capabilities - RPC capabilities object containing a `paymasterService` field
|
|
@@ -54,6 +54,22 @@ export declare function fromRpcCapabilities(capabilities: DecodedPrepareCallsCap
|
|
|
54
54
|
* @returns {T | undefined} The merged capabilities object, or original capabilities if no capability configuration exists on the client
|
|
55
55
|
*/
|
|
56
56
|
export declare const mergeClientCapabilities: <T extends PrepareCallsCapabilities | SendPreparedCallsCapabilities>(client: InnerWalletApiClient, capabilities: T | undefined) => T | undefined;
|
|
57
|
+
export type SolanaPaymasterCapability = {
|
|
58
|
+
policyId: string;
|
|
59
|
+
webhookData?: string;
|
|
60
|
+
};
|
|
61
|
+
export type SolanaPrepareCallsCapabilities = {
|
|
62
|
+
paymaster?: SolanaPaymasterCapability;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Merges Solana client-level capabilities (policyId from factory) with
|
|
66
|
+
* request-level capabilities. Request-level takes priority if provided.
|
|
67
|
+
*
|
|
68
|
+
* @param {InnerSolanaWalletApiClient} client - The Solana wallet API client
|
|
69
|
+
* @param {SolanaPrepareCallsCapabilities | undefined} capabilities - Request capabilities to merge with
|
|
70
|
+
* @returns {SolanaPrepareCallsCapabilities | undefined} The merged capabilities
|
|
71
|
+
*/
|
|
72
|
+
export declare const mergeSolanaClientCapabilities: (client: InnerSolanaWalletApiClient, capabilities: SolanaPrepareCallsCapabilities | undefined) => SolanaPrepareCallsCapabilities | undefined;
|
|
57
73
|
/**
|
|
58
74
|
* Extracts capabilities from prepareCalls that are usable for sendPreparedCalls.
|
|
59
75
|
* Only permissions and paymaster (policyId/policyIds & webhookData) are supported.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../src/utils/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,IAAI,8BAA8B,EAC1D,6BAA6B,IAAI,mCAAmC,EACrE,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../src/utils/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,IAAI,8BAA8B,EAC1D,6BAA6B,IAAI,mCAAmC,EACrE,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EACV,oBAAoB,EACpB,0BAA0B,EAC3B,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,KAAK,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAC/E,KAAK,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAC1C,OAAO,mCAAmC,CAC3C,CAAC;AAEF;;;;;GAKG;AACH,KAAK,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS;IACtC,gBAAgB,CAAC,EAAE,MAAM,CAAC,CAAC;CAC5B,GACG,IAAI,CAAC,CAAC,EAAE,kBAAkB,CAAC,GAAG;IAAE,SAAS,CAAC,EAAE,CAAC,CAAA;CAAE,GAC/C,CAAC,CAAC;AAEN,MAAM,MAAM,wBAAwB,GAClC,mBAAmB,CAAC,uBAAuB,CAAC,CAAC;AAE/C,MAAM,MAAM,6BAA6B,GACvC,mBAAmB,CAAC,4BAA4B,CAAC,CAAC;AAEpD;;;GAGG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC;CACxB,GACG,IAAI,CAAC,CAAC,EAAE,cAAc,CAAC,GAAG;IACxB,YAAY,CAAC,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;CACpD,GACD,CAAC,CAAC;AAcN;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EACR,wBAAwB,GACxB,6BAA6B,GAC7B,SAAS,GACZ,uBAAuB,GAAG,4BAA4B,GAAG,SAAS,CASpE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EACR,uBAAuB,GACvB,4BAA4B,GAC5B,SAAS,GACZ,wBAAwB,GAAG,6BAA6B,GAAG,SAAS,CAatE;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,GAClC,CAAC,SAAS,wBAAwB,GAAG,6BAA6B,EAElE,QAAQ,oBAAoB,EAC5B,cAAc,CAAC,GAAG,SAAS,KAC1B,CAAC,GAAG,SAYN,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,SAAS,CAAC,EAAE,yBAAyB,CAAC;CACvC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,GACxC,QAAQ,0BAA0B,EAClC,cAAc,8BAA8B,GAAG,SAAS,KACvD,8BAA8B,GAAG,SASnC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,GACxC,cAAc,wBAAwB,GAAG,SAAS,KACjD,6BAA6B,GAAG,SAmBlC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type Hex, type SignableMessage, type TypedDataDefinition } from "viem";
|
|
1
|
+
import { type Hex, type SignableMessage, type TypedData, type TypedDataDefinition } from "viem";
|
|
2
2
|
import type { TypedDataDefinition as WalletServerTypedDataDefinition } from "@alchemy/wallet-api-types";
|
|
3
3
|
export declare const castToHex: (val: string | number | bigint | Hex) => Hex;
|
|
4
4
|
export declare const signableMessageToJsonSafe: (message: SignableMessage) => string | {
|
|
5
5
|
raw: Hex;
|
|
6
6
|
};
|
|
7
|
-
export declare const typedDataToJsonSafe: ({ domain, primaryType, message, types, }: TypedDataDefinition) => WalletServerTypedDataDefinition;
|
|
7
|
+
export declare const typedDataToJsonSafe: ({ domain, primaryType, message, types, }: TypedDataDefinition<TypedData | Record<string, unknown>>) => WalletServerTypedDataDefinition;
|
|
8
8
|
//# sourceMappingURL=format.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/utils/format.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,GAAG,EACR,KAAK,eAAe,EAEpB,KAAK,mBAAmB,
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/utils/format.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,GAAG,EACR,KAAK,eAAe,EAEpB,KAAK,SAAS,EACd,KAAK,mBAAmB,EAGzB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,mBAAmB,IAAI,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAExG,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,GAAG,KAAG,GAK/D,CAAC;AAEF,eAAO,MAAM,yBAAyB,GACpC,SAAS,eAAe,KACvB,MAAM,GAAG;IAAE,GAAG,EAAE,GAAG,CAAA;CAQrB,CAAC;AAIF,eAAO,MAAM,mBAAmB,GAAI,0CAKjC,mBAAmB,CACpB,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CACpC,KAAG,+BAwBH,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
/** Constraint for RPC method schemas from `@alchemy/wallet-api-types/rpc`. */
|
|
3
|
-
type RpcMethodSchema =
|
|
4
|
-
Request:
|
|
5
|
-
method:
|
|
6
|
-
params:
|
|
3
|
+
type RpcMethodSchema = z.ZodObject<{
|
|
4
|
+
Request: z.ZodObject<{
|
|
5
|
+
method: z.ZodType;
|
|
6
|
+
params: z.ZodTuple<[z.ZodType, ...z.ZodType[]]>;
|
|
7
7
|
}>;
|
|
8
|
-
ReturnType:
|
|
8
|
+
ReturnType: z.ZodType;
|
|
9
9
|
}>;
|
|
10
|
-
export declare function methodSchema<TReq extends
|
|
11
|
-
Request:
|
|
12
|
-
method:
|
|
13
|
-
params:
|
|
10
|
+
export declare function methodSchema<TReq extends z.ZodType, TRes extends z.ZodType>(schema: z.ZodObject<{
|
|
11
|
+
Request: z.ZodObject<{
|
|
12
|
+
method: z.ZodType;
|
|
13
|
+
params: z.ZodTuple<[TReq, ...z.ZodType[]]>;
|
|
14
14
|
}>;
|
|
15
15
|
ReturnType: TRes;
|
|
16
16
|
}>): {
|
|
@@ -18,10 +18,10 @@ export declare function methodSchema<TReq extends TSchema, TRes extends TSchema>
|
|
|
18
18
|
response: TRes;
|
|
19
19
|
};
|
|
20
20
|
/** Extracts the decoded params type from a method schema. */
|
|
21
|
-
export type MethodParams<T extends RpcMethodSchema> =
|
|
21
|
+
export type MethodParams<T extends RpcMethodSchema> = z.output<T["shape"]["Request"]["shape"]["params"]["def"]["items"][0]>;
|
|
22
22
|
/** Extracts the decoded response type from a method schema. */
|
|
23
|
-
export type MethodResponse<T extends RpcMethodSchema> =
|
|
24
|
-
export declare function encode<const T extends
|
|
25
|
-
export declare function decode<const T extends
|
|
23
|
+
export type MethodResponse<T extends RpcMethodSchema> = z.output<T["shape"]["ReturnType"]>;
|
|
24
|
+
export declare function encode<const T extends z.ZodType>(schema: T, value: z.output<T>): z.input<T>;
|
|
25
|
+
export declare function decode<const T extends z.ZodType>(schema: T, value: z.input<T>): z.output<T>;
|
|
26
26
|
export {};
|
|
27
27
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/utils/schema.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/utils/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,8EAA8E;AAC9E,KAAK,eAAe,GAAG,CAAC,CAAC,SAAS,CAAC;IACjC,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC;QACnB,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC;QAClB,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;KACjD,CAAC,CAAC;IACH,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC;CACvB,CAAC,CAAC;AAEH,wBAAgB,YAAY,CAAC,IAAI,SAAS,CAAC,CAAC,OAAO,EAAE,IAAI,SAAS,CAAC,CAAC,OAAO,EACzE,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC;IAClB,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC;QACnB,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC;QAClB,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;KAC5C,CAAC,CAAC;IACH,UAAU,EAAE,IAAI,CAAC;CAClB,CAAC,GACD;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,IAAI,CAAA;CAAE,CAKnC;AAED,6DAA6D;AAC7D,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,eAAe,IAAI,CAAC,CAAC,MAAM,CAC5D,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAC5D,CAAC;AAEF,+DAA+D;AAC/D,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,eAAe,IAAI,CAAC,CAAC,MAAM,CAC9D,CAAC,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CACzB,CAAC;AAiCF,wBAAgB,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAC9C,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GACjB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAWZ;AAED,wBAAgB,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAC9C,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAChB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAWb"}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "5.0.
|
|
1
|
+
export declare const VERSION = "5.0.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alchemy/wallet-apis",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Alchemy Wallet APIs",
|
|
5
5
|
"author": "Alchemy",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"private": false,
|
|
8
8
|
"type": "module",
|
|
9
|
-
"main": "./dist/esm/index.js",
|
|
10
|
-
"module": "./dist/esm/index.js",
|
|
11
|
-
"types": "./dist/types/index.d.ts",
|
|
12
|
-
"typings": "./dist/types/index.d.ts",
|
|
9
|
+
"main": "./dist/esm/exports/index.js",
|
|
10
|
+
"module": "./dist/esm/exports/index.js",
|
|
11
|
+
"types": "./dist/types/exports/index.d.ts",
|
|
12
|
+
"typings": "./dist/types/exports/index.d.ts",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"files": [
|
|
15
15
|
"dist",
|
|
@@ -37,6 +37,11 @@
|
|
|
37
37
|
"import": "./dist/esm/exports/internal.js",
|
|
38
38
|
"default": "./dist/esm/exports/internal.js"
|
|
39
39
|
},
|
|
40
|
+
"./solana": {
|
|
41
|
+
"types": "./dist/types/exports/solana.d.ts",
|
|
42
|
+
"import": "./dist/esm/exports/solana.js",
|
|
43
|
+
"default": "./dist/esm/exports/solana.js"
|
|
44
|
+
},
|
|
40
45
|
"./package.json": "./package.json"
|
|
41
46
|
},
|
|
42
47
|
"scripts": {
|
|
@@ -49,21 +54,33 @@
|
|
|
49
54
|
"test:run": "vitest run"
|
|
50
55
|
},
|
|
51
56
|
"devDependencies": {
|
|
57
|
+
"@solana/kit": "^6.8.0",
|
|
58
|
+
"@solana/web3.js": "^1.98.4",
|
|
52
59
|
"@types/deep-equal": "^1.0.4",
|
|
53
60
|
"abitype": "^1.0.0",
|
|
54
61
|
"typescript-template": "workspace:*",
|
|
55
62
|
"viem": "^2.45.0"
|
|
56
63
|
},
|
|
57
64
|
"dependencies": {
|
|
58
|
-
"@alchemy/common": "5.0.
|
|
59
|
-
"@alchemy/wallet-api-types": "0.
|
|
65
|
+
"@alchemy/common": "5.0.1",
|
|
66
|
+
"@alchemy/wallet-api-types": "0.2.0-alpha.3",
|
|
60
67
|
"deep-equal": "^2.2.3",
|
|
61
68
|
"ox": "^0.11.1",
|
|
62
|
-
"
|
|
69
|
+
"zod": "^4.4.1"
|
|
63
70
|
},
|
|
64
71
|
"peerDependencies": {
|
|
72
|
+
"@solana/kit": ">=6.0.0",
|
|
73
|
+
"@solana/web3.js": "^1.95.0",
|
|
65
74
|
"viem": "^2.45.0"
|
|
66
75
|
},
|
|
76
|
+
"peerDependenciesMeta": {
|
|
77
|
+
"@solana/kit": {
|
|
78
|
+
"optional": true
|
|
79
|
+
},
|
|
80
|
+
"@solana/web3.js": {
|
|
81
|
+
"optional": true
|
|
82
|
+
}
|
|
83
|
+
},
|
|
67
84
|
"publishConfig": {
|
|
68
85
|
"access": "public",
|
|
69
86
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -76,5 +93,5 @@
|
|
|
76
93
|
"url": "https://github.com/alchemyplatform/aa-sdk/issues"
|
|
77
94
|
},
|
|
78
95
|
"homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
|
|
79
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "08bc1db4f0ef52b2dffd6e72213064b13420e4e7"
|
|
80
97
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Address, Prettify } from "viem";
|
|
2
2
|
import type { DistributiveOmit, InnerWalletApiClient } from "../types.ts";
|
|
3
|
+
import { BaseError } from "@alchemy/common";
|
|
3
4
|
import { LOGGER } from "../logger.js";
|
|
4
5
|
import {
|
|
5
6
|
fromRpcCapabilities,
|
|
@@ -9,18 +10,29 @@ import {
|
|
|
9
10
|
type WithCapabilities,
|
|
10
11
|
} from "../utils/capabilities.js";
|
|
11
12
|
import { resolveAddress, type AccountParam } from "../utils/resolve.js";
|
|
13
|
+
import { PrepareCallsParams as EvmPrepareCallsSchema } from "@alchemy/wallet-api-types";
|
|
14
|
+
import type { z } from "zod";
|
|
12
15
|
import { wallet_prepareCalls as MethodSchema } from "@alchemy/wallet-api-types/rpc";
|
|
13
16
|
import {
|
|
14
17
|
methodSchema,
|
|
15
18
|
encode,
|
|
16
19
|
decode,
|
|
17
|
-
type MethodParams,
|
|
18
20
|
type MethodResponse,
|
|
19
21
|
} from "../utils/schema.js";
|
|
20
22
|
|
|
21
23
|
const schema = methodSchema(MethodSchema);
|
|
22
|
-
type BasePrepareCallsParams =
|
|
23
|
-
type
|
|
24
|
+
type BasePrepareCallsParams = z.output<typeof EvmPrepareCallsSchema>;
|
|
25
|
+
type FullPrepareCallsResponse = MethodResponse<typeof MethodSchema>;
|
|
26
|
+
type PrepareCallsResponse = Exclude<
|
|
27
|
+
FullPrepareCallsResponse,
|
|
28
|
+
{ type: "solana-transaction-v0" }
|
|
29
|
+
>;
|
|
30
|
+
|
|
31
|
+
function isEvmResponse(
|
|
32
|
+
response: FullPrepareCallsResponse,
|
|
33
|
+
): response is PrepareCallsResponse {
|
|
34
|
+
return response.type !== "solana-transaction-v0";
|
|
35
|
+
}
|
|
24
36
|
|
|
25
37
|
export type PrepareCallsParams = Prettify<
|
|
26
38
|
WithCapabilities<
|
|
@@ -112,6 +124,12 @@ export async function prepareCalls(
|
|
|
112
124
|
LOGGER.debug("prepareCalls:done");
|
|
113
125
|
const decoded = decode(schema.response, rpcResp);
|
|
114
126
|
|
|
127
|
+
if (!isEvmResponse(decoded)) {
|
|
128
|
+
throw new BaseError(
|
|
129
|
+
`Unexpected Solana response from EVM prepareCalls: ${decoded.type}`,
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
115
133
|
// Transform paymaster-permit modifiedRequest from RPC format to client format:
|
|
116
134
|
// - `from` (RPC) → `account` (client)
|
|
117
135
|
// - `capabilities.paymasterService` (RPC) → `capabilities.paymaster` (client)
|
|
@@ -2,7 +2,7 @@ import type { Address } from "abitype";
|
|
|
2
2
|
import { isAddressEqual, type JsonRpcAccount, type Prettify } from "viem";
|
|
3
3
|
import { wallet_requestAccount as MethodSchema } from "@alchemy/wallet-api-types/rpc";
|
|
4
4
|
import deepEqual from "deep-equal";
|
|
5
|
-
import type {
|
|
5
|
+
import type { InnerWalletApiClient } from "../types";
|
|
6
6
|
import { LOGGER } from "../logger.js";
|
|
7
7
|
import { isLocalAccount } from "../utils/assertions.js";
|
|
8
8
|
import {
|
|
@@ -15,11 +15,13 @@ import {
|
|
|
15
15
|
const schema = methodSchema(MethodSchema);
|
|
16
16
|
type BaseRequestAccountParams = MethodParams<typeof MethodSchema>;
|
|
17
17
|
|
|
18
|
+
type SignerAddressParams = Extract<
|
|
19
|
+
BaseRequestAccountParams,
|
|
20
|
+
{ signerAddress: Address }
|
|
21
|
+
>;
|
|
22
|
+
|
|
18
23
|
export type RequestAccountParams = Prettify<
|
|
19
|
-
|
|
20
|
-
Extract<BaseRequestAccountParams, { signerAddress: Address }>,
|
|
21
|
-
"signerAddress" | "includeCounterfactualInfo"
|
|
22
|
-
> &
|
|
24
|
+
Pick<SignerAddressParams, "id" | "creationHint"> &
|
|
23
25
|
(
|
|
24
26
|
| { signerAddress?: Address; accountAddress?: never }
|
|
25
27
|
| { signerAddress?: never; accountAddress: Address }
|
package/src/actions/sendCalls.ts
CHANGED
|
@@ -45,8 +45,11 @@ export type SendCallsResult = Prettify<SendPreparedCallsResult>;
|
|
|
45
45
|
* }
|
|
46
46
|
* });
|
|
47
47
|
*
|
|
48
|
-
* //
|
|
49
|
-
*
|
|
48
|
+
* // Wait for the calls to be mined and confirmed.
|
|
49
|
+
* // Polls getCallsStatus until the bundle succeeds, fails, or times out (default 60s).
|
|
50
|
+
* // See: https://viem.sh/docs/actions/wallet/waitForCallsStatus
|
|
51
|
+
* const status = await client.waitForCallsStatus({ id: result.id });
|
|
52
|
+
* console.log(status.status); // "success" | "failure"
|
|
50
53
|
* ```
|
|
51
54
|
* <Note>
|
|
52
55
|
* If using this action with an ERC-20 paymaster in pre-operation mode with `autoPermit`, the contents of the permit will be hidden
|
|
@@ -16,7 +16,10 @@ import {
|
|
|
16
16
|
} from "../utils/schema.js";
|
|
17
17
|
|
|
18
18
|
const schema = methodSchema(MethodSchema);
|
|
19
|
-
type BaseSendPreparedCallsParams =
|
|
19
|
+
type BaseSendPreparedCallsParams = Exclude<
|
|
20
|
+
MethodParams<typeof MethodSchema>,
|
|
21
|
+
{ type: "solana-transaction-v0" }
|
|
22
|
+
>;
|
|
20
23
|
type SendPreparedCallsResponse = MethodResponse<typeof MethodSchema>;
|
|
21
24
|
|
|
22
25
|
export type SendPreparedCallsParams = Prettify<
|
|
@@ -27,7 +27,8 @@ export type SignPreparedCallsResult =
|
|
|
27
27
|
>[];
|
|
28
28
|
}
|
|
29
29
|
| Signed<Extract<PrepareCallsResult, { type: "user-operation-v060" }>>
|
|
30
|
-
| Signed<Extract<PrepareCallsResult, { type: "user-operation-v070" }
|
|
30
|
+
| Signed<Extract<PrepareCallsResult, { type: "user-operation-v070" }>>
|
|
31
|
+
| Signed<Extract<PrepareCallsResult, { type: "authorization" }>>;
|
|
31
32
|
|
|
32
33
|
// Decoded types derived from PrepareCallsResult (numbers/bigints, not hex strings)
|
|
33
34
|
type ArrayCallData = Extract<
|
|
@@ -85,7 +86,7 @@ export async function signPreparedCalls(
|
|
|
85
86
|
};
|
|
86
87
|
|
|
87
88
|
const signUserOperationCall = async (call: UserOpCall) => {
|
|
88
|
-
const { signatureRequest, ...rest } = call;
|
|
89
|
+
const { signatureRequest, feePayment: _feePayment, ...rest } = call;
|
|
89
90
|
|
|
90
91
|
if (!signatureRequest) {
|
|
91
92
|
LOGGER.warn("signPreparedCalls:missing-signatureRequest", {
|
|
@@ -125,6 +126,18 @@ export async function signPreparedCalls(
|
|
|
125
126
|
const res = await signUserOperationCall(params);
|
|
126
127
|
LOGGER.debug("signPreparedCalls:single-userOp:ok");
|
|
127
128
|
return res;
|
|
129
|
+
} else if (params.type === "authorization") {
|
|
130
|
+
const { signatureRequest: _signatureRequest, ...rest } = params;
|
|
131
|
+
const signature = await signSignatureRequest(client, {
|
|
132
|
+
type: "eip7702Auth",
|
|
133
|
+
data: {
|
|
134
|
+
...rest.data,
|
|
135
|
+
chainId: params.chainId,
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
const res = { ...rest, signature };
|
|
139
|
+
LOGGER.debug("signPreparedCalls:single-authorization:ok");
|
|
140
|
+
return res;
|
|
128
141
|
} else if (params.type === "paymaster-permit") {
|
|
129
142
|
LOGGER.warn("signPreparedCalls:invalid-call-type", { type: params.type });
|
|
130
143
|
throw new BaseError(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Hex, type Prettify, serializeSignature } from "viem";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
PersonalSignSignatureRequest,
|
|
4
|
+
TypedDataSignatureRequest,
|
|
5
|
+
AuthorizationSignatureRequest,
|
|
6
6
|
Eip7702UnsignedAuth,
|
|
7
7
|
} from "@alchemy/wallet-api-types";
|
|
8
8
|
import { vToYParity } from "ox/Signature";
|
|
@@ -17,14 +17,14 @@ import { isLocalAccount } from "../utils/assertions.js";
|
|
|
17
17
|
import { getAction } from "viem/utils";
|
|
18
18
|
import { signAuthorization, signMessage, signTypedData } from "viem/actions";
|
|
19
19
|
import type { LocalAccount } from "viem";
|
|
20
|
-
import type {
|
|
20
|
+
import type { z } from "zod";
|
|
21
21
|
|
|
22
22
|
export type SignSignatureRequestParams = Prettify<
|
|
23
23
|
WithoutRawPayload<
|
|
24
|
-
| PersonalSignSignatureRequest
|
|
25
|
-
| TypedDataSignatureRequest
|
|
26
|
-
| (AuthorizationSignatureRequest & {
|
|
27
|
-
data:
|
|
24
|
+
| z.output<typeof PersonalSignSignatureRequest>
|
|
25
|
+
| z.output<typeof TypedDataSignatureRequest>
|
|
26
|
+
| (z.output<typeof AuthorizationSignatureRequest> & {
|
|
27
|
+
data: z.output<typeof Eip7702UnsignedAuth>;
|
|
28
28
|
})
|
|
29
29
|
>
|
|
30
30
|
>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Address as ViemAddress, type Hex, type TypedData } from "viem";
|
|
2
2
|
import type { InnerWalletApiClient } from "../types.ts";
|
|
3
3
|
import { prepareSign } from "./prepareSign.js";
|
|
4
4
|
import { signSignatureRequest } from "./signSignatureRequest.js";
|
|
@@ -7,13 +7,21 @@ import { typedDataToJsonSafe } from "../utils/format.js";
|
|
|
7
7
|
import { LOGGER } from "../logger.js";
|
|
8
8
|
import { resolveAddress, type AccountParam } from "../utils/resolve.js";
|
|
9
9
|
|
|
10
|
-
export type SignTypedDataParams =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
export type SignTypedDataParams = {
|
|
11
|
+
domain?: {
|
|
12
|
+
name?: string;
|
|
13
|
+
version?: string;
|
|
14
|
+
chainId?: number | bigint;
|
|
15
|
+
verifyingContract?: ViemAddress;
|
|
16
|
+
salt?: Hex;
|
|
17
|
+
};
|
|
18
|
+
types: TypedData | Record<string, unknown>;
|
|
19
|
+
primaryType: string;
|
|
20
|
+
message: Record<string, unknown>;
|
|
21
|
+
account?: AccountParam;
|
|
22
|
+
};
|
|
15
23
|
|
|
16
|
-
export type SignTypedDataResult =
|
|
24
|
+
export type SignTypedDataResult = Hex;
|
|
17
25
|
|
|
18
26
|
/**
|
|
19
27
|
* Signs typed data (EIP-712) using the smart account.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { Hex } from "viem";
|
|
2
|
+
import { BaseError } from "@alchemy/common";
|
|
3
|
+
import type { InnerSolanaWalletApiClient } from "../../types.js";
|
|
4
|
+
import { LOGGER } from "../../logger.js";
|
|
5
|
+
import { wallet_getCallsStatus as MethodSchema } from "@alchemy/wallet-api-types/rpc";
|
|
6
|
+
import {
|
|
7
|
+
methodSchema,
|
|
8
|
+
decode,
|
|
9
|
+
type MethodResponse,
|
|
10
|
+
} from "../../utils/schema.js";
|
|
11
|
+
|
|
12
|
+
const schema = methodSchema(MethodSchema);
|
|
13
|
+
type GetCallsStatusResponse = MethodResponse<typeof MethodSchema>;
|
|
14
|
+
|
|
15
|
+
type SolanaGetCallsStatusResponse = Extract<
|
|
16
|
+
GetCallsStatusResponse,
|
|
17
|
+
{ chainId: `solana:${string}` }
|
|
18
|
+
>;
|
|
19
|
+
|
|
20
|
+
function isSolanaResponse(
|
|
21
|
+
response: GetCallsStatusResponse,
|
|
22
|
+
): response is SolanaGetCallsStatusResponse {
|
|
23
|
+
return (
|
|
24
|
+
typeof response.chainId === "string" &&
|
|
25
|
+
response.chainId.startsWith("solana:")
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type SolanaGetCallsStatusParams = {
|
|
30
|
+
id: Hex;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type SolanaGetCallsStatusResult = Omit<
|
|
34
|
+
SolanaGetCallsStatusResponse,
|
|
35
|
+
"status"
|
|
36
|
+
> & {
|
|
37
|
+
status: "pending" | "success" | "failure";
|
|
38
|
+
statusCode: number;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Gets the status of a Solana call bundle.
|
|
43
|
+
*
|
|
44
|
+
* @param {InnerSolanaWalletApiClient} client - The Solana wallet API client
|
|
45
|
+
* @param {SolanaGetCallsStatusParams} params - The call ID to check
|
|
46
|
+
* @returns {Promise<SolanaGetCallsStatusResult>} The status of the call
|
|
47
|
+
*/
|
|
48
|
+
export async function getCallsStatus(
|
|
49
|
+
client: InnerSolanaWalletApiClient,
|
|
50
|
+
params: SolanaGetCallsStatusParams,
|
|
51
|
+
): Promise<SolanaGetCallsStatusResult> {
|
|
52
|
+
LOGGER.debug("solana:getCallsStatus:start", { id: params.id });
|
|
53
|
+
|
|
54
|
+
const rpcResp = await client.request({
|
|
55
|
+
method: "wallet_getCallsStatus",
|
|
56
|
+
params: [params.id],
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const decoded = decode(schema.response, rpcResp);
|
|
60
|
+
|
|
61
|
+
if (!isSolanaResponse(decoded)) {
|
|
62
|
+
throw new BaseError(`Unexpected EVM response from Solana getCallsStatus`);
|
|
63
|
+
}
|
|
64
|
+
const statusCode = decoded.status;
|
|
65
|
+
const status = (() => {
|
|
66
|
+
if (statusCode >= 100 && statusCode < 200) return "pending" as const;
|
|
67
|
+
if (statusCode >= 200 && statusCode < 300) return "success" as const;
|
|
68
|
+
if (statusCode >= 300 && statusCode < 700) return "failure" as const;
|
|
69
|
+
throw new BaseError(`Unknown Solana call status code: ${statusCode}`);
|
|
70
|
+
})();
|
|
71
|
+
|
|
72
|
+
LOGGER.debug("solana:getCallsStatus:done", { status, statusCode });
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
...decoded,
|
|
76
|
+
status,
|
|
77
|
+
statusCode,
|
|
78
|
+
};
|
|
79
|
+
}
|