@alchemy/wallet-apis 5.0.0-beta.3 → 5.0.0-beta.31

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.
Files changed (201) hide show
  1. package/README.md +3 -1
  2. package/dist/esm/actions/prepareCalls.d.ts +8 -3
  3. package/dist/esm/actions/prepareCalls.js +8 -0
  4. package/dist/esm/actions/prepareCalls.js.map +1 -1
  5. package/dist/esm/actions/requestAccount.d.ts +4 -3
  6. package/dist/esm/actions/requestAccount.js.map +1 -1
  7. package/dist/esm/actions/sendCalls.d.ts +5 -2
  8. package/dist/esm/actions/sendCalls.js +5 -2
  9. package/dist/esm/actions/sendCalls.js.map +1 -1
  10. package/dist/esm/actions/sendPreparedCalls.d.ts +3 -1
  11. package/dist/esm/actions/sendPreparedCalls.js.map +1 -1
  12. package/dist/esm/actions/signPreparedCalls.d.ts +2 -0
  13. package/dist/esm/actions/signPreparedCalls.js +14 -1
  14. package/dist/esm/actions/signPreparedCalls.js.map +1 -1
  15. package/dist/esm/actions/signSignatureRequest.d.ts +4 -4
  16. package/dist/esm/actions/signSignatureRequest.js +1 -1
  17. package/dist/esm/actions/signSignatureRequest.js.map +1 -1
  18. package/dist/esm/actions/signTypedData.d.ts +14 -4
  19. package/dist/esm/actions/signTypedData.js.map +1 -1
  20. package/dist/esm/actions/solana/getCallsStatus.d.ts +24 -0
  21. package/dist/esm/actions/solana/getCallsStatus.js +44 -0
  22. package/dist/esm/actions/solana/getCallsStatus.js.map +1 -0
  23. package/dist/esm/actions/solana/prepareCalls.d.ts +46 -0
  24. package/dist/esm/actions/solana/prepareCalls.js +70 -0
  25. package/dist/esm/actions/solana/prepareCalls.js.map +1 -0
  26. package/dist/esm/actions/solana/sendCalls.d.ts +34 -0
  27. package/dist/esm/actions/solana/sendCalls.js +44 -0
  28. package/dist/esm/actions/solana/sendCalls.js.map +1 -0
  29. package/dist/esm/actions/solana/sendPreparedCalls.d.ts +24 -0
  30. package/dist/esm/actions/solana/sendPreparedCalls.js +32 -0
  31. package/dist/esm/actions/solana/sendPreparedCalls.js.map +1 -0
  32. package/dist/esm/actions/solana/signPreparedCalls.d.ts +23 -0
  33. package/dist/esm/actions/solana/signPreparedCalls.js +24 -0
  34. package/dist/esm/actions/solana/signPreparedCalls.js.map +1 -0
  35. package/dist/esm/actions/solana/signSignatureRequest.d.ts +10 -0
  36. package/dist/esm/actions/solana/signSignatureRequest.js +33 -0
  37. package/dist/esm/actions/solana/signSignatureRequest.js.map +1 -0
  38. package/dist/esm/actions/solana/waitForCallsStatus.d.ts +24 -0
  39. package/dist/esm/actions/solana/waitForCallsStatus.js +46 -0
  40. package/dist/esm/actions/solana/waitForCallsStatus.js.map +1 -0
  41. package/dist/esm/actions/undelegateAccount.d.ts +37 -0
  42. package/dist/esm/actions/undelegateAccount.js +49 -0
  43. package/dist/esm/actions/undelegateAccount.js.map +1 -0
  44. package/dist/esm/adapters/SolanaSignerError.d.ts +4 -0
  45. package/dist/esm/adapters/SolanaSignerError.js +13 -0
  46. package/dist/esm/adapters/SolanaSignerError.js.map +1 -0
  47. package/dist/esm/adapters/fromKeypair.d.ts +21 -0
  48. package/dist/esm/adapters/fromKeypair.js +46 -0
  49. package/dist/esm/adapters/fromKeypair.js.map +1 -0
  50. package/dist/esm/adapters/fromKitSigner.d.ts +21 -0
  51. package/dist/esm/adapters/fromKitSigner.js +61 -0
  52. package/dist/esm/adapters/fromKitSigner.js.map +1 -0
  53. package/dist/esm/adapters/fromWalletAdapter.d.ts +26 -0
  54. package/dist/esm/adapters/fromWalletAdapter.js +45 -0
  55. package/dist/esm/adapters/fromWalletAdapter.js.map +1 -0
  56. package/dist/esm/adapters/fromWalletStandard.d.ts +31 -0
  57. package/dist/esm/adapters/fromWalletStandard.js +53 -0
  58. package/dist/esm/adapters/fromWalletStandard.js.map +1 -0
  59. package/dist/esm/adapters/resolveSignerSlot.d.ts +10 -0
  60. package/dist/esm/adapters/resolveSignerSlot.js +39 -0
  61. package/dist/esm/adapters/resolveSignerSlot.js.map +1 -0
  62. package/dist/esm/client.d.ts +29 -14
  63. package/dist/esm/client.js +63 -19
  64. package/dist/esm/client.js.map +1 -1
  65. package/dist/esm/decorators/smartWalletActions.d.ts +2 -0
  66. package/dist/esm/decorators/smartWalletActions.js +4 -2
  67. package/dist/esm/decorators/smartWalletActions.js.map +1 -1
  68. package/dist/esm/decorators/solanaSmartWalletActions.d.ts +16 -0
  69. package/dist/esm/decorators/solanaSmartWalletActions.js +16 -0
  70. package/dist/esm/decorators/solanaSmartWalletActions.js.map +1 -0
  71. package/dist/esm/experimental/actions/requestQuoteV0.d.ts +48 -11
  72. package/dist/esm/experimental/actions/requestQuoteV0.js +8 -4
  73. package/dist/esm/experimental/actions/requestQuoteV0.js.map +1 -1
  74. package/dist/esm/experimental/swapActionsDecorator.d.ts +3 -0
  75. package/dist/esm/experimental/swapActionsDecorator.js.map +1 -1
  76. package/dist/esm/exports/index.d.ts +5 -3
  77. package/dist/esm/exports/index.js +1 -0
  78. package/dist/esm/exports/index.js.map +1 -1
  79. package/dist/esm/exports/solana.d.ts +24 -0
  80. package/dist/esm/exports/solana.js +15 -0
  81. package/dist/esm/exports/solana.js.map +1 -0
  82. package/dist/esm/types.d.ts +28 -4
  83. package/dist/esm/types.js.map +1 -1
  84. package/dist/esm/utils/assertions.d.ts +4 -2
  85. package/dist/esm/utils/assertions.js +6 -0
  86. package/dist/esm/utils/assertions.js.map +1 -1
  87. package/dist/esm/utils/capabilities.d.ts +22 -6
  88. package/dist/esm/utils/capabilities.js +19 -2
  89. package/dist/esm/utils/capabilities.js.map +1 -1
  90. package/dist/esm/utils/format.d.ts +2 -2
  91. package/dist/esm/utils/format.js +4 -3
  92. package/dist/esm/utils/format.js.map +1 -1
  93. package/dist/esm/utils/schema.d.ts +14 -14
  94. package/dist/esm/utils/schema.js +35 -39
  95. package/dist/esm/utils/schema.js.map +1 -1
  96. package/dist/esm/version.d.ts +1 -1
  97. package/dist/esm/version.js +1 -1
  98. package/dist/esm/version.js.map +1 -1
  99. package/dist/types/actions/prepareCalls.d.ts +8 -3
  100. package/dist/types/actions/prepareCalls.d.ts.map +1 -1
  101. package/dist/types/actions/requestAccount.d.ts +4 -3
  102. package/dist/types/actions/requestAccount.d.ts.map +1 -1
  103. package/dist/types/actions/sendCalls.d.ts +5 -2
  104. package/dist/types/actions/sendCalls.d.ts.map +1 -1
  105. package/dist/types/actions/sendPreparedCalls.d.ts +3 -1
  106. package/dist/types/actions/sendPreparedCalls.d.ts.map +1 -1
  107. package/dist/types/actions/signPreparedCalls.d.ts +2 -0
  108. package/dist/types/actions/signPreparedCalls.d.ts.map +1 -1
  109. package/dist/types/actions/signSignatureRequest.d.ts +4 -4
  110. package/dist/types/actions/signSignatureRequest.d.ts.map +1 -1
  111. package/dist/types/actions/signTypedData.d.ts +14 -4
  112. package/dist/types/actions/signTypedData.d.ts.map +1 -1
  113. package/dist/types/actions/solana/getCallsStatus.d.ts +25 -0
  114. package/dist/types/actions/solana/getCallsStatus.d.ts.map +1 -0
  115. package/dist/types/actions/solana/prepareCalls.d.ts +47 -0
  116. package/dist/types/actions/solana/prepareCalls.d.ts.map +1 -0
  117. package/dist/types/actions/solana/sendCalls.d.ts +35 -0
  118. package/dist/types/actions/solana/sendCalls.d.ts.map +1 -0
  119. package/dist/types/actions/solana/sendPreparedCalls.d.ts +25 -0
  120. package/dist/types/actions/solana/sendPreparedCalls.d.ts.map +1 -0
  121. package/dist/types/actions/solana/signPreparedCalls.d.ts +24 -0
  122. package/dist/types/actions/solana/signPreparedCalls.d.ts.map +1 -0
  123. package/dist/types/actions/solana/signSignatureRequest.d.ts +11 -0
  124. package/dist/types/actions/solana/signSignatureRequest.d.ts.map +1 -0
  125. package/dist/types/actions/solana/waitForCallsStatus.d.ts +25 -0
  126. package/dist/types/actions/solana/waitForCallsStatus.d.ts.map +1 -0
  127. package/dist/types/actions/undelegateAccount.d.ts +38 -0
  128. package/dist/types/actions/undelegateAccount.d.ts.map +1 -0
  129. package/dist/types/adapters/SolanaSignerError.d.ts +5 -0
  130. package/dist/types/adapters/SolanaSignerError.d.ts.map +1 -0
  131. package/dist/types/adapters/fromKeypair.d.ts +22 -0
  132. package/dist/types/adapters/fromKeypair.d.ts.map +1 -0
  133. package/dist/types/adapters/fromKitSigner.d.ts +22 -0
  134. package/dist/types/adapters/fromKitSigner.d.ts.map +1 -0
  135. package/dist/types/adapters/fromWalletAdapter.d.ts +27 -0
  136. package/dist/types/adapters/fromWalletAdapter.d.ts.map +1 -0
  137. package/dist/types/adapters/fromWalletStandard.d.ts +32 -0
  138. package/dist/types/adapters/fromWalletStandard.d.ts.map +1 -0
  139. package/dist/types/adapters/resolveSignerSlot.d.ts +11 -0
  140. package/dist/types/adapters/resolveSignerSlot.d.ts.map +1 -0
  141. package/dist/types/client.d.ts +29 -14
  142. package/dist/types/client.d.ts.map +1 -1
  143. package/dist/types/decorators/smartWalletActions.d.ts +2 -0
  144. package/dist/types/decorators/smartWalletActions.d.ts.map +1 -1
  145. package/dist/types/decorators/solanaSmartWalletActions.d.ts +17 -0
  146. package/dist/types/decorators/solanaSmartWalletActions.d.ts.map +1 -0
  147. package/dist/types/experimental/actions/requestQuoteV0.d.ts +48 -11
  148. package/dist/types/experimental/actions/requestQuoteV0.d.ts.map +1 -1
  149. package/dist/types/experimental/swapActionsDecorator.d.ts +3 -0
  150. package/dist/types/experimental/swapActionsDecorator.d.ts.map +1 -1
  151. package/dist/types/exports/index.d.ts +5 -3
  152. package/dist/types/exports/index.d.ts.map +1 -1
  153. package/dist/types/exports/solana.d.ts +25 -0
  154. package/dist/types/exports/solana.d.ts.map +1 -0
  155. package/dist/types/types.d.ts +28 -4
  156. package/dist/types/types.d.ts.map +1 -1
  157. package/dist/types/utils/assertions.d.ts +4 -2
  158. package/dist/types/utils/assertions.d.ts.map +1 -1
  159. package/dist/types/utils/capabilities.d.ts +22 -6
  160. package/dist/types/utils/capabilities.d.ts.map +1 -1
  161. package/dist/types/utils/format.d.ts +2 -2
  162. package/dist/types/utils/format.d.ts.map +1 -1
  163. package/dist/types/utils/schema.d.ts +14 -14
  164. package/dist/types/utils/schema.d.ts.map +1 -1
  165. package/dist/types/version.d.ts +1 -1
  166. package/dist/types/version.d.ts.map +1 -1
  167. package/package.json +29 -11
  168. package/src/actions/prepareCalls.ts +21 -3
  169. package/src/actions/requestAccount.ts +7 -5
  170. package/src/actions/sendCalls.ts +5 -2
  171. package/src/actions/sendPreparedCalls.ts +4 -1
  172. package/src/actions/signPreparedCalls.ts +15 -2
  173. package/src/actions/signSignatureRequest.ts +8 -8
  174. package/src/actions/signTypedData.ts +15 -7
  175. package/src/actions/solana/getCallsStatus.ts +79 -0
  176. package/src/actions/solana/prepareCalls.ts +120 -0
  177. package/src/actions/solana/sendCalls.ts +66 -0
  178. package/src/actions/solana/sendPreparedCalls.ts +65 -0
  179. package/src/actions/solana/signPreparedCalls.ts +50 -0
  180. package/src/actions/solana/signSignatureRequest.ts +63 -0
  181. package/src/actions/solana/waitForCallsStatus.ts +84 -0
  182. package/src/actions/undelegateAccount.ts +68 -0
  183. package/src/adapters/SolanaSignerError.ts +5 -0
  184. package/src/adapters/fromKeypair.ts +58 -0
  185. package/src/adapters/fromKitSigner.ts +82 -0
  186. package/src/adapters/fromWalletAdapter.ts +58 -0
  187. package/src/adapters/fromWalletStandard.ts +100 -0
  188. package/src/adapters/resolveSignerSlot.ts +46 -0
  189. package/src/client.ts +131 -18
  190. package/src/decorators/smartWalletActions.ts +11 -2
  191. package/src/decorators/solanaSmartWalletActions.ts +62 -0
  192. package/src/experimental/actions/requestQuoteV0.ts +40 -15
  193. package/src/experimental/swapActionsDecorator.ts +3 -0
  194. package/src/exports/index.ts +10 -4
  195. package/src/exports/solana.ts +36 -0
  196. package/src/types.ts +38 -7
  197. package/src/utils/assertions.ts +17 -2
  198. package/src/utils/capabilities.ts +40 -8
  199. package/src/utils/format.ts +8 -3
  200. package/src/utils/schema.ts +58 -69
  201. package/src/version.ts +1 -1
@@ -0,0 +1,70 @@
1
+ import { isSolanaChain } from "../../utils/assertions.js";
2
+ import { SolanaPrepareCallsParams as SolanaPrepareCallsSchema } from "@alchemy/wallet-api-types";
3
+ import { wallet_prepareCalls as MethodSchema } from "@alchemy/wallet-api-types/rpc";
4
+ import { BaseError } from "@alchemy/common";
5
+ import { LOGGER } from "../../logger.js";
6
+ import { mergeSolanaClientCapabilities, } from "../../utils/capabilities.js";
7
+ import { methodSchema, encode, decode, } from "../../utils/schema.js";
8
+ const schema = methodSchema(MethodSchema);
9
+ function isSolanaResponse(response) {
10
+ return response.type === "solana-transaction-v0";
11
+ }
12
+ /**
13
+ * Prepares Solana instructions for execution by building a versioned transaction.
14
+ * Returns the compiled transaction and a signature request that needs to be signed
15
+ * before submitting to sendPreparedCalls.
16
+ *
17
+ * @param {InnerSolanaWalletApiClient} client - The Solana wallet API client
18
+ * @param {SolanaPrepareCallsParams} params - Parameters for preparing Solana calls
19
+ * @param {Array<{programId: string, accounts?: Array, data: Hex}>} params.calls - Array of Solana instructions
20
+ * @param {string} [params.account] - The Solana address to execute from. Defaults to the signer's address.
21
+ * @param {SolanaChainId} [params.chainId] - The Solana chain ID. Defaults to the client's chain.
22
+ * @param {object} [params.capabilities] - Optional capabilities (e.g. paymaster sponsorship)
23
+ * @returns {Promise<SolanaPrepareCallsResult>} The prepared Solana transaction with signature request
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * const result = await client.prepareCalls({
28
+ * calls: [{
29
+ * programId: "11111111111111111111111111111111",
30
+ * data: "0x...",
31
+ * }],
32
+ * capabilities: {
33
+ * paymaster: { policyId: "your-policy-id" }
34
+ * }
35
+ * });
36
+ * ```
37
+ */
38
+ export async function prepareCalls(client, params) {
39
+ const { account, chainId, capabilities: caps, ...rest } = params;
40
+ const from = account ?? client.solanaAccount;
41
+ if (!isSolanaChain(client.chain)) {
42
+ throw new BaseError("Expected a Solana chain on the client");
43
+ }
44
+ const resolvedChainId = chainId ?? client.chain.solanaChainId;
45
+ const merged = mergeSolanaClientCapabilities(client, caps);
46
+ const capabilities = merged?.paymaster
47
+ ? { paymasterService: merged.paymaster }
48
+ : undefined;
49
+ LOGGER.debug("solana:prepareCalls:start", {
50
+ callsCount: params.calls?.length,
51
+ hasCapabilities: !!caps,
52
+ });
53
+ const rpcParams = encode(SolanaPrepareCallsSchema, {
54
+ ...rest,
55
+ chainId: resolvedChainId,
56
+ from,
57
+ capabilities,
58
+ });
59
+ const rpcResp = await client.request({
60
+ method: "wallet_prepareCalls",
61
+ params: [rpcParams],
62
+ });
63
+ LOGGER.debug("solana:prepareCalls:done");
64
+ const decoded = decode(schema.response, rpcResp);
65
+ if (!isSolanaResponse(decoded)) {
66
+ throw new BaseError(`Unexpected EVM response from Solana prepareCalls: ${decoded.type}`);
67
+ }
68
+ return decoded;
69
+ }
70
+ //# sourceMappingURL=prepareCalls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepareCalls.js","sourceRoot":"","sources":["../../../../src/actions/solana/prepareCalls.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAE,wBAAwB,IAAI,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,EAAE,mBAAmB,IAAI,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAEpF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EACL,6BAA6B,GAE9B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,YAAY,EACZ,MAAM,EACN,MAAM,GAEP,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;AAmB1C,SAAS,gBAAgB,CACvB,QAA8B;IAE9B,OAAO,QAAQ,CAAC,IAAI,KAAK,uBAAuB,CAAC;AACnD,CAAC;AAID;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAkC,EAClC,MAAgC;IAEhC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;IACjE,MAAM,IAAI,GAAG,OAAO,IAAI,MAAM,CAAC,aAAa,CAAC;IAC7C,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,SAAS,CAAC,uCAAuC,CAAC,CAAC;IAC/D,CAAC;IACD,MAAM,eAAe,GAAG,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC;IAE9D,MAAM,MAAM,GAAG,6BAA6B,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC3D,MAAM,YAAY,GAAG,MAAM,EAAE,SAAS;QACpC,CAAC,CAAC,EAAE,gBAAgB,EAAE,MAAM,CAAC,SAAS,EAAE;QACxC,CAAC,CAAC,SAAS,CAAC;IAEd,MAAM,CAAC,KAAK,CAAC,2BAA2B,EAAE;QACxC,UAAU,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM;QAChC,eAAe,EAAE,CAAC,CAAC,IAAI;KACxB,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,MAAM,CAAC,wBAAwB,EAAE;QACjD,GAAG,IAAI;QACP,OAAO,EAAE,eAAe;QACxB,IAAI;QACJ,YAAY;KACb,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QACnC,MAAM,EAAE,qBAAqB;QAC7B,MAAM,EAAE,CAAC,SAAS,CAAC;KACpB,CAAC,CAAC;IAEH,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAEjD,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,SAAS,CACjB,qDAAqD,OAAO,CAAC,IAAI,EAAE,CACpE,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import type { Prettify } from \"viem\";\nimport type {\n DistributiveOmit,\n InnerSolanaWalletApiClient,\n} from \"../../types.js\";\nimport { isSolanaChain } from \"../../utils/assertions.js\";\nimport type { SolanaChainId } from \"@alchemy/wallet-api-types\";\nimport { SolanaPrepareCallsParams as SolanaPrepareCallsSchema } from \"@alchemy/wallet-api-types\";\nimport { wallet_prepareCalls as MethodSchema } from \"@alchemy/wallet-api-types/rpc\";\nimport type { z } from \"zod\";\nimport { BaseError } from \"@alchemy/common\";\nimport { LOGGER } from \"../../logger.js\";\nimport {\n mergeSolanaClientCapabilities,\n type WithCapabilities,\n} from \"../../utils/capabilities.js\";\nimport {\n methodSchema,\n encode,\n decode,\n type MethodResponse,\n} from \"../../utils/schema.js\";\n\nconst schema = methodSchema(MethodSchema);\ntype PrepareCallsResponse = MethodResponse<typeof MethodSchema>;\n\ntype BaseSolanaPrepareCallsParams = z.output<typeof SolanaPrepareCallsSchema>;\n\nexport type SolanaPrepareCallsParams = Prettify<\n WithCapabilities<\n DistributiveOmit<BaseSolanaPrepareCallsParams, \"from\" | \"chainId\"> & {\n account?: string;\n chainId?: SolanaChainId;\n }\n >\n>;\n\ntype SolanaPrepareCallsResponse = Extract<\n PrepareCallsResponse,\n { type: \"solana-transaction-v0\" }\n>;\n\nfunction isSolanaResponse(\n response: PrepareCallsResponse,\n): response is SolanaPrepareCallsResponse {\n return response.type === \"solana-transaction-v0\";\n}\n\nexport type SolanaPrepareCallsResult = SolanaPrepareCallsResponse;\n\n/**\n * Prepares Solana instructions for execution by building a versioned transaction.\n * Returns the compiled transaction and a signature request that needs to be signed\n * before submitting to sendPreparedCalls.\n *\n * @param {InnerSolanaWalletApiClient} client - The Solana wallet API client\n * @param {SolanaPrepareCallsParams} params - Parameters for preparing Solana calls\n * @param {Array<{programId: string, accounts?: Array, data: Hex}>} params.calls - Array of Solana instructions\n * @param {string} [params.account] - The Solana address to execute from. Defaults to the signer's address.\n * @param {SolanaChainId} [params.chainId] - The Solana chain ID. Defaults to the client's chain.\n * @param {object} [params.capabilities] - Optional capabilities (e.g. paymaster sponsorship)\n * @returns {Promise<SolanaPrepareCallsResult>} The prepared Solana transaction with signature request\n *\n * @example\n * ```ts\n * const result = await client.prepareCalls({\n * calls: [{\n * programId: \"11111111111111111111111111111111\",\n * data: \"0x...\",\n * }],\n * capabilities: {\n * paymaster: { policyId: \"your-policy-id\" }\n * }\n * });\n * ```\n */\nexport async function prepareCalls(\n client: InnerSolanaWalletApiClient,\n params: SolanaPrepareCallsParams,\n): Promise<SolanaPrepareCallsResult> {\n const { account, chainId, capabilities: caps, ...rest } = params;\n const from = account ?? client.solanaAccount;\n if (!isSolanaChain(client.chain)) {\n throw new BaseError(\"Expected a Solana chain on the client\");\n }\n const resolvedChainId = chainId ?? client.chain.solanaChainId;\n\n const merged = mergeSolanaClientCapabilities(client, caps);\n const capabilities = merged?.paymaster\n ? { paymasterService: merged.paymaster }\n : undefined;\n\n LOGGER.debug(\"solana:prepareCalls:start\", {\n callsCount: params.calls?.length,\n hasCapabilities: !!caps,\n });\n\n const rpcParams = encode(SolanaPrepareCallsSchema, {\n ...rest,\n chainId: resolvedChainId,\n from,\n capabilities,\n });\n\n const rpcResp = await client.request({\n method: \"wallet_prepareCalls\",\n params: [rpcParams],\n });\n\n LOGGER.debug(\"solana:prepareCalls:done\");\n const decoded = decode(schema.response, rpcResp);\n\n if (!isSolanaResponse(decoded)) {\n throw new BaseError(\n `Unexpected EVM response from Solana prepareCalls: ${decoded.type}`,\n );\n }\n\n return decoded;\n}\n"]}
@@ -0,0 +1,34 @@
1
+ import type { Prettify } from "viem";
2
+ import type { DistributiveOmit, InnerSolanaWalletApiClient } from "../../types.js";
3
+ import type { SolanaChainId } from "@alchemy/wallet-api-types";
4
+ import { type SolanaPrepareCallsParams } from "./prepareCalls.js";
5
+ import { type SolanaSendPreparedCallsResult } from "./sendPreparedCalls.js";
6
+ export type SolanaSendCallsParams = Prettify<DistributiveOmit<SolanaPrepareCallsParams, "chainId"> & {
7
+ chainId?: SolanaChainId;
8
+ }>;
9
+ export type SolanaSendCallsResult = Prettify<SolanaSendPreparedCallsResult>;
10
+ /**
11
+ * Prepares, signs, and submits Solana instructions in a single call.
12
+ * Internally calls `prepareCalls`, `signPreparedCalls`, and `sendPreparedCalls`.
13
+ *
14
+ * @param {InnerSolanaWalletApiClient} client - The Solana wallet API client
15
+ * @param {SolanaSendCallsParams} params - Parameters for sending Solana calls
16
+ * @param {Array<{programId: string, accounts?: Array, data: Hex}>} params.calls - Array of Solana instructions
17
+ * @param {string} [params.account] - The Solana address to execute from. Defaults to the signer's address.
18
+ * @param {object} [params.capabilities] - Optional capabilities (e.g. paymaster sponsorship)
19
+ * @returns {Promise<SolanaSendCallsResult>} The result containing the call ID
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * const result = await client.sendCalls({
24
+ * calls: [{
25
+ * programId: "11111111111111111111111111111111",
26
+ * data: "0x...",
27
+ * }],
28
+ * capabilities: {
29
+ * paymaster: { policyId: "your-policy-id" }
30
+ * }
31
+ * });
32
+ * ```
33
+ */
34
+ export declare function sendCalls(client: InnerSolanaWalletApiClient, params: SolanaSendCallsParams): Promise<SolanaSendCallsResult>;
@@ -0,0 +1,44 @@
1
+ import { prepareCalls } from "./prepareCalls.js";
2
+ import { signPreparedCalls } from "./signPreparedCalls.js";
3
+ import { sendPreparedCalls, } from "./sendPreparedCalls.js";
4
+ import { LOGGER } from "../../logger.js";
5
+ /**
6
+ * Prepares, signs, and submits Solana instructions in a single call.
7
+ * Internally calls `prepareCalls`, `signPreparedCalls`, and `sendPreparedCalls`.
8
+ *
9
+ * @param {InnerSolanaWalletApiClient} client - The Solana wallet API client
10
+ * @param {SolanaSendCallsParams} params - Parameters for sending Solana calls
11
+ * @param {Array<{programId: string, accounts?: Array, data: Hex}>} params.calls - Array of Solana instructions
12
+ * @param {string} [params.account] - The Solana address to execute from. Defaults to the signer's address.
13
+ * @param {object} [params.capabilities] - Optional capabilities (e.g. paymaster sponsorship)
14
+ * @returns {Promise<SolanaSendCallsResult>} The result containing the call ID
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const result = await client.sendCalls({
19
+ * calls: [{
20
+ * programId: "11111111111111111111111111111111",
21
+ * data: "0x...",
22
+ * }],
23
+ * capabilities: {
24
+ * paymaster: { policyId: "your-policy-id" }
25
+ * }
26
+ * });
27
+ * ```
28
+ */
29
+ export async function sendCalls(client, params) {
30
+ LOGGER.info("solana:sendCalls:start", {
31
+ calls: params.calls?.length,
32
+ hasCapabilities: !!params.capabilities,
33
+ });
34
+ const { chainId, ...rest } = params;
35
+ const prepared = await prepareCalls(client, {
36
+ ...rest,
37
+ ...(chainId != null ? { chainId } : {}),
38
+ });
39
+ const signed = await signPreparedCalls(client, prepared);
40
+ const res = await sendPreparedCalls(client, signed);
41
+ LOGGER.info("solana:sendCalls:done");
42
+ return res;
43
+ }
44
+ //# sourceMappingURL=sendCalls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendCalls.js","sourceRoot":"","sources":["../../../../src/actions/solana/sendCalls.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAiC,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACL,iBAAiB,GAElB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAUzC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,MAAkC,EAClC,MAA6B;IAE7B,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE;QACpC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM;QAC3B,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC,YAAY;KACvC,CAAC,CAAC;IAEH,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;IACpC,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,MAAM,EAAE;QAC1C,GAAG,IAAI;QACP,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxC,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACzD,MAAM,GAAG,GAAG,MAAM,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpD,MAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IACrC,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import type { Prettify } from \"viem\";\nimport type {\n DistributiveOmit,\n InnerSolanaWalletApiClient,\n} from \"../../types.js\";\nimport type { SolanaChainId } from \"@alchemy/wallet-api-types\";\nimport { prepareCalls, type SolanaPrepareCallsParams } from \"./prepareCalls.js\";\nimport { signPreparedCalls } from \"./signPreparedCalls.js\";\nimport {\n sendPreparedCalls,\n type SolanaSendPreparedCallsResult,\n} from \"./sendPreparedCalls.js\";\nimport { LOGGER } from \"../../logger.js\";\n\nexport type SolanaSendCallsParams = Prettify<\n DistributiveOmit<SolanaPrepareCallsParams, \"chainId\"> & {\n chainId?: SolanaChainId;\n }\n>;\n\nexport type SolanaSendCallsResult = Prettify<SolanaSendPreparedCallsResult>;\n\n/**\n * Prepares, signs, and submits Solana instructions in a single call.\n * Internally calls `prepareCalls`, `signPreparedCalls`, and `sendPreparedCalls`.\n *\n * @param {InnerSolanaWalletApiClient} client - The Solana wallet API client\n * @param {SolanaSendCallsParams} params - Parameters for sending Solana calls\n * @param {Array<{programId: string, accounts?: Array, data: Hex}>} params.calls - Array of Solana instructions\n * @param {string} [params.account] - The Solana address to execute from. Defaults to the signer's address.\n * @param {object} [params.capabilities] - Optional capabilities (e.g. paymaster sponsorship)\n * @returns {Promise<SolanaSendCallsResult>} The result containing the call ID\n *\n * @example\n * ```ts\n * const result = await client.sendCalls({\n * calls: [{\n * programId: \"11111111111111111111111111111111\",\n * data: \"0x...\",\n * }],\n * capabilities: {\n * paymaster: { policyId: \"your-policy-id\" }\n * }\n * });\n * ```\n */\nexport async function sendCalls(\n client: InnerSolanaWalletApiClient,\n params: SolanaSendCallsParams,\n): Promise<SolanaSendCallsResult> {\n LOGGER.info(\"solana:sendCalls:start\", {\n calls: params.calls?.length,\n hasCapabilities: !!params.capabilities,\n });\n\n const { chainId, ...rest } = params;\n const prepared = await prepareCalls(client, {\n ...rest,\n ...(chainId != null ? { chainId } : {}),\n });\n\n const signed = await signPreparedCalls(client, prepared);\n const res = await sendPreparedCalls(client, signed);\n LOGGER.info(\"solana:sendCalls:done\");\n return res;\n}\n"]}
@@ -0,0 +1,24 @@
1
+ import type { Prettify } from "viem";
2
+ import type { InnerSolanaWalletApiClient } from "../../types.js";
3
+ import { PreparedCall_SolanaV0_Signed as PreparedCall_SolanaV0_SignedSchema } from "@alchemy/wallet-api-types";
4
+ import type { z } from "zod";
5
+ import { wallet_sendPreparedCalls as MethodSchema } from "@alchemy/wallet-api-types/rpc";
6
+ import { type MethodResponse } from "../../utils/schema.js";
7
+ type SendPreparedCallsResponse = MethodResponse<typeof MethodSchema>;
8
+ export type SolanaSendPreparedCallsParams = Prettify<z.output<typeof PreparedCall_SolanaV0_SignedSchema>>;
9
+ type SolanaSendPreparedCallsResponse = Extract<SendPreparedCallsResponse, {
10
+ details: {
11
+ type: "solana-transaction-v0";
12
+ };
13
+ }>;
14
+ export type SolanaSendPreparedCallsResult = SolanaSendPreparedCallsResponse;
15
+ /**
16
+ * Sends a signed Solana transaction.
17
+ * This method is used after signing the signature request returned from prepareCalls.
18
+ *
19
+ * @param {InnerSolanaWalletApiClient} client - The Solana wallet API client
20
+ * @param {SolanaSendPreparedCallsParams} params - The signed Solana transaction
21
+ * @returns {Promise<SolanaSendPreparedCallsResult>} The result containing the call ID
22
+ */
23
+ export declare function sendPreparedCalls(client: InnerSolanaWalletApiClient, params: SolanaSendPreparedCallsParams): Promise<SolanaSendPreparedCallsResult>;
24
+ export {};
@@ -0,0 +1,32 @@
1
+ import { PreparedCall_SolanaV0_Signed as PreparedCall_SolanaV0_SignedSchema } from "@alchemy/wallet-api-types";
2
+ import { BaseError } from "@alchemy/common";
3
+ import { LOGGER } from "../../logger.js";
4
+ import { wallet_sendPreparedCalls as MethodSchema } from "@alchemy/wallet-api-types/rpc";
5
+ import { methodSchema, encode, decode, } from "../../utils/schema.js";
6
+ const schema = methodSchema(MethodSchema);
7
+ function isSolanaResponse(response) {
8
+ return response.details.type === "solana-transaction-v0";
9
+ }
10
+ /**
11
+ * Sends a signed Solana transaction.
12
+ * This method is used after signing the signature request returned from prepareCalls.
13
+ *
14
+ * @param {InnerSolanaWalletApiClient} client - The Solana wallet API client
15
+ * @param {SolanaSendPreparedCallsParams} params - The signed Solana transaction
16
+ * @returns {Promise<SolanaSendPreparedCallsResult>} The result containing the call ID
17
+ */
18
+ export async function sendPreparedCalls(client, params) {
19
+ LOGGER.debug("solana:sendPreparedCalls:start", { type: params.type });
20
+ const rpcParams = encode(PreparedCall_SolanaV0_SignedSchema, params);
21
+ const rpcResp = await client.request({
22
+ method: "wallet_sendPreparedCalls",
23
+ params: [rpcParams],
24
+ });
25
+ LOGGER.debug("solana:sendPreparedCalls:done");
26
+ const decoded = decode(schema.response, rpcResp);
27
+ if (!isSolanaResponse(decoded)) {
28
+ throw new BaseError(`Unexpected EVM response from Solana sendPreparedCalls: ${decoded.details.type}`);
29
+ }
30
+ return decoded;
31
+ }
32
+ //# sourceMappingURL=sendPreparedCalls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendPreparedCalls.js","sourceRoot":"","sources":["../../../../src/actions/solana/sendPreparedCalls.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,4BAA4B,IAAI,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAE/G,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,wBAAwB,IAAI,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,EACL,YAAY,EACZ,MAAM,EACN,MAAM,GAEP,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;AAc1C,SAAS,gBAAgB,CACvB,QAAmC;IAEnC,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAK,uBAAuB,CAAC;AAC3D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAkC,EAClC,MAAqC;IAErC,MAAM,CAAC,KAAK,CAAC,gCAAgC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAEtE,MAAM,SAAS,GAAG,MAAM,CAAC,kCAAkC,EAAE,MAAM,CAAC,CAAC;IACrE,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QACnC,MAAM,EAAE,0BAA0B;QAClC,MAAM,EAAE,CAAC,SAAS,CAAC;KACpB,CAAC,CAAC;IAEH,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAEjD,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,SAAS,CACjB,0DAA0D,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CACjF,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import type { Prettify } from \"viem\";\nimport type { InnerSolanaWalletApiClient } from \"../../types.js\";\nimport { PreparedCall_SolanaV0_Signed as PreparedCall_SolanaV0_SignedSchema } from \"@alchemy/wallet-api-types\";\nimport type { z } from \"zod\";\nimport { BaseError } from \"@alchemy/common\";\nimport { LOGGER } from \"../../logger.js\";\nimport { wallet_sendPreparedCalls as MethodSchema } from \"@alchemy/wallet-api-types/rpc\";\nimport {\n methodSchema,\n encode,\n decode,\n type MethodResponse,\n} from \"../../utils/schema.js\";\n\nconst schema = methodSchema(MethodSchema);\ntype SendPreparedCallsResponse = MethodResponse<typeof MethodSchema>;\n\nexport type SolanaSendPreparedCallsParams = Prettify<\n z.output<typeof PreparedCall_SolanaV0_SignedSchema>\n>;\n\ntype SolanaSendPreparedCallsResponse = Extract<\n SendPreparedCallsResponse,\n { details: { type: \"solana-transaction-v0\" } }\n>;\n\nexport type SolanaSendPreparedCallsResult = SolanaSendPreparedCallsResponse;\n\nfunction isSolanaResponse(\n response: SendPreparedCallsResponse,\n): response is SolanaSendPreparedCallsResult {\n return response.details.type === \"solana-transaction-v0\";\n}\n\n/**\n * Sends a signed Solana transaction.\n * This method is used after signing the signature request returned from prepareCalls.\n *\n * @param {InnerSolanaWalletApiClient} client - The Solana wallet API client\n * @param {SolanaSendPreparedCallsParams} params - The signed Solana transaction\n * @returns {Promise<SolanaSendPreparedCallsResult>} The result containing the call ID\n */\nexport async function sendPreparedCalls(\n client: InnerSolanaWalletApiClient,\n params: SolanaSendPreparedCallsParams,\n): Promise<SolanaSendPreparedCallsResult> {\n LOGGER.debug(\"solana:sendPreparedCalls:start\", { type: params.type });\n\n const rpcParams = encode(PreparedCall_SolanaV0_SignedSchema, params);\n const rpcResp = await client.request({\n method: \"wallet_sendPreparedCalls\",\n params: [rpcParams],\n });\n\n LOGGER.debug(\"solana:sendPreparedCalls:done\");\n const decoded = decode(schema.response, rpcResp);\n\n if (!isSolanaResponse(decoded)) {\n throw new BaseError(\n `Unexpected EVM response from Solana sendPreparedCalls: ${decoded.details.type}`,\n );\n }\n\n return decoded;\n}\n"]}
@@ -0,0 +1,23 @@
1
+ import type { Prettify } from "viem";
2
+ import type { InnerSolanaWalletApiClient } from "../../types.js";
3
+ import { type SolanaSignatureResult } from "./signSignatureRequest.js";
4
+ import type { SolanaPrepareCallsResult } from "./prepareCalls.js";
5
+ export type SolanaSignPreparedCallsParams = Prettify<SolanaPrepareCallsResult>;
6
+ export type SolanaSignPreparedCallsResult = Prettify<Omit<SolanaPrepareCallsResult, "signatureRequest" | "feePayment" | "details"> & {
7
+ signature: SolanaSignatureResult;
8
+ }>;
9
+ /**
10
+ * Signs a prepared Solana transaction using the client's Ed25519 signer.
11
+ *
12
+ * @param {InnerSolanaWalletApiClient} client - The Solana wallet client
13
+ * @param {SolanaSignPreparedCallsParams} params - The prepared Solana transaction with signature request
14
+ * @returns {Promise<SolanaSignPreparedCallsResult>} The signed Solana transaction
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const prepared = await client.prepareCalls({ ... });
19
+ * const signed = await client.signPreparedCalls(prepared);
20
+ * const result = await client.sendPreparedCalls(signed);
21
+ * ```
22
+ */
23
+ export declare function signPreparedCalls(client: InnerSolanaWalletApiClient, params: SolanaSignPreparedCallsParams): Promise<SolanaSignPreparedCallsResult>;
@@ -0,0 +1,24 @@
1
+ import { signSolanaSignatureRequest, } from "./signSignatureRequest.js";
2
+ import { LOGGER } from "../../logger.js";
3
+ /**
4
+ * Signs a prepared Solana transaction using the client's Ed25519 signer.
5
+ *
6
+ * @param {InnerSolanaWalletApiClient} client - The Solana wallet client
7
+ * @param {SolanaSignPreparedCallsParams} params - The prepared Solana transaction with signature request
8
+ * @returns {Promise<SolanaSignPreparedCallsResult>} The signed Solana transaction
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const prepared = await client.prepareCalls({ ... });
13
+ * const signed = await client.signPreparedCalls(prepared);
14
+ * const result = await client.sendPreparedCalls(signed);
15
+ * ```
16
+ */
17
+ export async function signPreparedCalls(client, params) {
18
+ LOGGER.debug("solana:signPreparedCalls:start");
19
+ const signature = await signSolanaSignatureRequest(client.owner, params.signatureRequest);
20
+ const { signatureRequest: _, feePayment: __, details: ___, ...rest } = params;
21
+ LOGGER.debug("solana:signPreparedCalls:done");
22
+ return { ...rest, signature };
23
+ }
24
+ //# sourceMappingURL=signPreparedCalls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signPreparedCalls.js","sourceRoot":"","sources":["../../../../src/actions/solana/signPreparedCalls.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,0BAA0B,GAE3B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAazC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAkC,EAClC,MAAqC;IAErC,MAAM,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAE/C,MAAM,SAAS,GAAG,MAAM,0BAA0B,CAChD,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,gBAAgB,CACxB,CAAC;IAEF,MAAM,EAAE,gBAAgB,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;IAE9E,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAC9C,OAAO,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,CAAC;AAChC,CAAC","sourcesContent":["import type { Prettify } from \"viem\";\nimport type { InnerSolanaWalletApiClient } from \"../../types.js\";\nimport {\n signSolanaSignatureRequest,\n type SolanaSignatureResult,\n} from \"./signSignatureRequest.js\";\nimport type { SolanaPrepareCallsResult } from \"./prepareCalls.js\";\nimport { LOGGER } from \"../../logger.js\";\n\nexport type SolanaSignPreparedCallsParams = Prettify<SolanaPrepareCallsResult>;\n\nexport type SolanaSignPreparedCallsResult = Prettify<\n Omit<\n SolanaPrepareCallsResult,\n \"signatureRequest\" | \"feePayment\" | \"details\"\n > & {\n signature: SolanaSignatureResult;\n }\n>;\n\n/**\n * Signs a prepared Solana transaction using the client's Ed25519 signer.\n *\n * @param {InnerSolanaWalletApiClient} client - The Solana wallet client\n * @param {SolanaSignPreparedCallsParams} params - The prepared Solana transaction with signature request\n * @returns {Promise<SolanaSignPreparedCallsResult>} The signed Solana transaction\n *\n * @example\n * ```ts\n * const prepared = await client.prepareCalls({ ... });\n * const signed = await client.signPreparedCalls(prepared);\n * const result = await client.sendPreparedCalls(signed);\n * ```\n */\nexport async function signPreparedCalls(\n client: InnerSolanaWalletApiClient,\n params: SolanaSignPreparedCallsParams,\n): Promise<SolanaSignPreparedCallsResult> {\n LOGGER.debug(\"solana:signPreparedCalls:start\");\n\n const signature = await signSolanaSignatureRequest(\n client.owner,\n params.signatureRequest,\n );\n\n const { signatureRequest: _, feePayment: __, details: ___, ...rest } = params;\n\n LOGGER.debug(\"solana:signPreparedCalls:done\");\n return { ...rest, signature };\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import type { SolanaSigner } from "../../types.js";
2
+ export type SolanaSignatureRequestParams = {
3
+ type: "solana_signTransaction";
4
+ data: `0x${string}`;
5
+ };
6
+ export type SolanaSignatureResult = {
7
+ type: "ed25519";
8
+ data: string;
9
+ };
10
+ export declare function signSolanaSignatureRequest(signer: SolanaSigner, signatureRequest: SolanaSignatureRequestParams): Promise<SolanaSignatureResult>;
@@ -0,0 +1,33 @@
1
+ import { LOGGER } from "../../logger.js";
2
+ import { hexToBytes } from "viem";
3
+ import { Base58 } from "ox";
4
+ import { findSignerSlot } from "../../adapters/resolveSignerSlot.js";
5
+ import { SolanaSignerError } from "../../adapters/SolanaSignerError.js";
6
+ export async function signSolanaSignatureRequest(signer, signatureRequest) {
7
+ const txBytes = hexToBytes(signatureRequest.data);
8
+ const slotIndex = await findSignerSlot(txBytes, signer.address);
9
+ if (slotIndex < 0) {
10
+ throw new SolanaSignerError(`Signer ${signer.address} is not a required signer in this transaction`);
11
+ }
12
+ LOGGER.debug("signSolanaSignatureRequest:signing");
13
+ const { signedTransaction } = await signer.signTransaction({
14
+ transaction: txBytes,
15
+ });
16
+ if (signedTransaction[0] !== txBytes[0]) {
17
+ throw new SolanaSignerError(`Signer returned a transaction with a different signature count (expected ${txBytes[0]}, got ${signedTransaction[0]})`);
18
+ }
19
+ const offset = 1 + slotIndex * 64;
20
+ const rawSignature = signedTransaction.slice(offset, offset + 64);
21
+ if (rawSignature.length !== 64) {
22
+ throw new SolanaSignerError(`Signed transaction too short to contain signature at slot ${slotIndex}`);
23
+ }
24
+ if (rawSignature.every((b) => b === 0)) {
25
+ throw new SolanaSignerError(`Signer ${signer.address} did not produce a signature at slot ${slotIndex}`);
26
+ }
27
+ LOGGER.debug("signSolanaSignatureRequest:ok");
28
+ return {
29
+ type: "ed25519",
30
+ data: Base58.fromBytes(rawSignature),
31
+ };
32
+ }
33
+ //# sourceMappingURL=signSignatureRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signSignatureRequest.js","sourceRoot":"","sources":["../../../../src/actions/solana/signSignatureRequest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAYxE,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,MAAoB,EACpB,gBAA8C;IAE9C,MAAM,OAAO,GAAG,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAElD,MAAM,SAAS,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAChE,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;QAClB,MAAM,IAAI,iBAAiB,CACzB,UAAU,MAAM,CAAC,OAAO,+CAA+C,CACxE,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;IAEnD,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC;QACzD,WAAW,EAAE,OAAO;KACrB,CAAC,CAAC;IAEH,IAAI,iBAAiB,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,iBAAiB,CACzB,4EAA4E,OAAO,CAAC,CAAC,CAAC,SAAS,iBAAiB,CAAC,CAAC,CAAC,GAAG,CACvH,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,CAAC,GAAG,SAAS,GAAG,EAAE,CAAC;IAClC,MAAM,YAAY,GAAG,iBAAiB,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,EAAE,CAAC,CAAC;IAElE,IAAI,YAAY,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QAC/B,MAAM,IAAI,iBAAiB,CACzB,6DAA6D,SAAS,EAAE,CACzE,CAAC;IACJ,CAAC;IAED,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,iBAAiB,CACzB,UAAU,MAAM,CAAC,OAAO,wCAAwC,SAAS,EAAE,CAC5E,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAC9C,OAAO;QACL,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC;KACrC,CAAC;AACJ,CAAC","sourcesContent":["import type { SolanaSigner } from \"../../types.js\";\nimport { LOGGER } from \"../../logger.js\";\nimport { hexToBytes } from \"viem\";\nimport { Base58 } from \"ox\";\nimport { findSignerSlot } from \"../../adapters/resolveSignerSlot.js\";\nimport { SolanaSignerError } from \"../../adapters/SolanaSignerError.js\";\n\nexport type SolanaSignatureRequestParams = {\n type: \"solana_signTransaction\";\n data: `0x${string}`;\n};\n\nexport type SolanaSignatureResult = {\n type: \"ed25519\";\n data: string;\n};\n\nexport async function signSolanaSignatureRequest(\n signer: SolanaSigner,\n signatureRequest: SolanaSignatureRequestParams,\n): Promise<SolanaSignatureResult> {\n const txBytes = hexToBytes(signatureRequest.data);\n\n const slotIndex = await findSignerSlot(txBytes, signer.address);\n if (slotIndex < 0) {\n throw new SolanaSignerError(\n `Signer ${signer.address} is not a required signer in this transaction`,\n );\n }\n\n LOGGER.debug(\"signSolanaSignatureRequest:signing\");\n\n const { signedTransaction } = await signer.signTransaction({\n transaction: txBytes,\n });\n\n if (signedTransaction[0] !== txBytes[0]) {\n throw new SolanaSignerError(\n `Signer returned a transaction with a different signature count (expected ${txBytes[0]}, got ${signedTransaction[0]})`,\n );\n }\n\n const offset = 1 + slotIndex * 64;\n const rawSignature = signedTransaction.slice(offset, offset + 64);\n\n if (rawSignature.length !== 64) {\n throw new SolanaSignerError(\n `Signed transaction too short to contain signature at slot ${slotIndex}`,\n );\n }\n\n if (rawSignature.every((b) => b === 0)) {\n throw new SolanaSignerError(\n `Signer ${signer.address} did not produce a signature at slot ${slotIndex}`,\n );\n }\n\n LOGGER.debug(\"signSolanaSignatureRequest:ok\");\n return {\n type: \"ed25519\",\n data: Base58.fromBytes(rawSignature),\n };\n}\n"]}
@@ -0,0 +1,24 @@
1
+ import type { InnerSolanaWalletApiClient } from "../../types.js";
2
+ import { type SolanaGetCallsStatusResult } from "./getCallsStatus.js";
3
+ export type SolanaWaitForCallsStatusParams = {
4
+ id: `0x${string}`;
5
+ pollingInterval?: number;
6
+ retryCount?: number;
7
+ retryDelay?: (opts: {
8
+ count: number;
9
+ }) => number;
10
+ status?: (result: SolanaGetCallsStatusResult) => boolean;
11
+ throwOnFailure?: boolean;
12
+ timeout?: number;
13
+ };
14
+ export type SolanaWaitForCallsStatusResult = SolanaGetCallsStatusResult;
15
+ /**
16
+ * Polls getCallsStatus until the call reaches a terminal state.
17
+ * Similar API to viem's waitForCallsStatus with retry, exponential backoff,
18
+ * configurable status predicate, throwOnFailure, and timeout.
19
+ *
20
+ * @param {InnerSolanaWalletApiClient} client - The Solana wallet API client
21
+ * @param {SolanaWaitForCallsStatusParams} params - The call ID and optional polling config
22
+ * @returns {Promise<SolanaWaitForCallsStatusResult>} The final status
23
+ */
24
+ export declare function waitForCallsStatus(client: InnerSolanaWalletApiClient, params: SolanaWaitForCallsStatusParams): Promise<SolanaWaitForCallsStatusResult>;
@@ -0,0 +1,46 @@
1
+ import { getCallsStatus, } from "./getCallsStatus.js";
2
+ import { BaseError } from "@alchemy/common";
3
+ import { LOGGER } from "../../logger.js";
4
+ /**
5
+ * Polls getCallsStatus until the call reaches a terminal state.
6
+ * Similar API to viem's waitForCallsStatus with retry, exponential backoff,
7
+ * configurable status predicate, throwOnFailure, and timeout.
8
+ *
9
+ * @param {InnerSolanaWalletApiClient} client - The Solana wallet API client
10
+ * @param {SolanaWaitForCallsStatusParams} params - The call ID and optional polling config
11
+ * @returns {Promise<SolanaWaitForCallsStatusResult>} The final status
12
+ */
13
+ export async function waitForCallsStatus(client, params) {
14
+ const { id, pollingInterval = client.pollingInterval, retryCount = 4, retryDelay = ({ count }) => ~~(1 << count) * 200, status: isReady = ({ statusCode }) => statusCode === 200 || statusCode >= 300, throwOnFailure = false, timeout = 60000, } = params;
15
+ LOGGER.debug("solana:waitForCallsStatus:start", { id });
16
+ const start = Date.now();
17
+ while (Date.now() - start < timeout) {
18
+ let result;
19
+ for (let attempt = 0; attempt <= retryCount; attempt++) {
20
+ try {
21
+ result = await getCallsStatus(client, { id });
22
+ break;
23
+ }
24
+ catch (error) {
25
+ if (attempt >= retryCount)
26
+ throw error;
27
+ await new Promise((r) => setTimeout(r, retryDelay({ count: attempt })));
28
+ }
29
+ }
30
+ if (!result)
31
+ throw new BaseError("Unexpected: no result after retries");
32
+ if (throwOnFailure && result.status === "failure") {
33
+ throw new BaseError(`Solana call bundle failed with status code ${result.statusCode}`);
34
+ }
35
+ if (isReady(result)) {
36
+ LOGGER.debug("solana:waitForCallsStatus:done", {
37
+ status: result.status,
38
+ statusCode: result.statusCode,
39
+ });
40
+ return result;
41
+ }
42
+ await new Promise((r) => setTimeout(r, pollingInterval));
43
+ }
44
+ throw new BaseError(`Timed out while waiting for call bundle with id "${id}" to be confirmed.`);
45
+ }
46
+ //# sourceMappingURL=waitForCallsStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"waitForCallsStatus.js","sourceRoot":"","sources":["../../../../src/actions/solana/waitForCallsStatus.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,GAEf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAczC;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAAkC,EAClC,MAAsC;IAEtC,MAAM,EACJ,EAAE,EACF,eAAe,GAAG,MAAM,CAAC,eAAe,EACxC,UAAU,GAAG,CAAC,EACd,UAAU,GAAG,CAAC,EAAE,KAAK,EAAqB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,GAAG,EACnE,MAAM,EAAE,OAAO,GAAG,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CACnC,UAAU,KAAK,GAAG,IAAI,UAAU,IAAI,GAAG,EACzC,cAAc,GAAG,KAAK,EACtB,OAAO,GAAG,KAAM,GACjB,GAAG,MAAM,CAAC;IAEX,MAAM,CAAC,KAAK,CAAC,iCAAiC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAExD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAEzB,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,OAAO,EAAE,CAAC;QACpC,IAAI,MAA8C,CAAC;QAEnD,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC;YACvD,IAAI,CAAC;gBACH,MAAM,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;gBAC9C,MAAM;YACR,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,OAAO,IAAI,UAAU;oBAAE,MAAM,KAAK,CAAC;gBACvC,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;YAC1E,CAAC;QACH,CAAC;QAED,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,SAAS,CAAC,qCAAqC,CAAC,CAAC;QAExE,IAAI,cAAc,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAClD,MAAM,IAAI,SAAS,CACjB,8CAA8C,MAAM,CAAC,UAAU,EAAE,CAClE,CAAC;QACJ,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACpB,MAAM,CAAC,KAAK,CAAC,gCAAgC,EAAE;gBAC7C,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,UAAU,EAAE,MAAM,CAAC,UAAU;aAC9B,CAAC,CAAC;YACH,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,IAAI,SAAS,CACjB,oDAAoD,EAAE,oBAAoB,CAC3E,CAAC;AACJ,CAAC","sourcesContent":["import type { InnerSolanaWalletApiClient } from \"../../types.js\";\nimport {\n getCallsStatus,\n type SolanaGetCallsStatusResult,\n} from \"./getCallsStatus.js\";\nimport { BaseError } from \"@alchemy/common\";\nimport { LOGGER } from \"../../logger.js\";\n\nexport type SolanaWaitForCallsStatusParams = {\n id: `0x${string}`;\n pollingInterval?: number;\n retryCount?: number;\n retryDelay?: (opts: { count: number }) => number;\n status?: (result: SolanaGetCallsStatusResult) => boolean;\n throwOnFailure?: boolean;\n timeout?: number;\n};\n\nexport type SolanaWaitForCallsStatusResult = SolanaGetCallsStatusResult;\n\n/**\n * Polls getCallsStatus until the call reaches a terminal state.\n * Similar API to viem's waitForCallsStatus with retry, exponential backoff,\n * configurable status predicate, throwOnFailure, and timeout.\n *\n * @param {InnerSolanaWalletApiClient} client - The Solana wallet API client\n * @param {SolanaWaitForCallsStatusParams} params - The call ID and optional polling config\n * @returns {Promise<SolanaWaitForCallsStatusResult>} The final status\n */\nexport async function waitForCallsStatus(\n client: InnerSolanaWalletApiClient,\n params: SolanaWaitForCallsStatusParams,\n): Promise<SolanaWaitForCallsStatusResult> {\n const {\n id,\n pollingInterval = client.pollingInterval,\n retryCount = 4,\n retryDelay = ({ count }: { count: number }) => ~~(1 << count) * 200,\n status: isReady = ({ statusCode }) =>\n statusCode === 200 || statusCode >= 300,\n throwOnFailure = false,\n timeout = 60_000,\n } = params;\n\n LOGGER.debug(\"solana:waitForCallsStatus:start\", { id });\n\n const start = Date.now();\n\n while (Date.now() - start < timeout) {\n let result: SolanaGetCallsStatusResult | undefined;\n\n for (let attempt = 0; attempt <= retryCount; attempt++) {\n try {\n result = await getCallsStatus(client, { id });\n break;\n } catch (error) {\n if (attempt >= retryCount) throw error;\n await new Promise((r) => setTimeout(r, retryDelay({ count: attempt })));\n }\n }\n\n if (!result) throw new BaseError(\"Unexpected: no result after retries\");\n\n if (throwOnFailure && result.status === \"failure\") {\n throw new BaseError(\n `Solana call bundle failed with status code ${result.statusCode}`,\n );\n }\n\n if (isReady(result)) {\n LOGGER.debug(\"solana:waitForCallsStatus:done\", {\n status: result.status,\n statusCode: result.statusCode,\n });\n return result;\n }\n\n await new Promise((r) => setTimeout(r, pollingInterval));\n }\n\n throw new BaseError(\n `Timed out while waiting for call bundle with id \"${id}\" to be confirmed.`,\n );\n}\n"]}
@@ -0,0 +1,37 @@
1
+ import { type Chain, type Prettify } from "viem";
2
+ import type { InnerWalletApiClient } from "../types.js";
3
+ import { type AccountParam } from "../utils/resolve.js";
4
+ import { type SendCallsResult } from "./sendCalls.js";
5
+ export type UndelegateAccountParams = Prettify<{
6
+ account?: AccountParam;
7
+ chain?: Pick<Chain, "id">;
8
+ capabilities?: {
9
+ paymaster?: {
10
+ policyId: string;
11
+ };
12
+ };
13
+ }>;
14
+ export type UndelegateAccountResult = Prettify<SendCallsResult>;
15
+ /**
16
+ * Prepares, signs, and sends an EIP-7702 undelegation to remove delegation from an EOA.
17
+ * Gas is sponsored by Alchemy (requires Enterprise plan).
18
+ *
19
+ * A BSO (Bundler Sponsorship Override) policy ID must be provided either via
20
+ * `params.capabilities.paymaster.policyId` or pre-configured on the client via `policyIds`.
21
+ *
22
+ * @param {InnerWalletApiClient} client - The wallet API client to use for the request
23
+ * @param {UndelegateAccountParams} params - Parameters for undelegating the account
24
+ * @param {AccountParam} [params.account] - The account to undelegate. Defaults to the client's account (signer address).
25
+ * @param {object} [params.chain] - The chain. Defaults to the client's chain.
26
+ * @param {object} [params.capabilities] - Optional capabilities. If omitted, falls back to the policy ID(s) set on the client.
27
+ * @param {object} [params.capabilities.paymaster] - Paymaster capabilities. Requires a BSO policy ID.
28
+ * @param {string} [params.capabilities.paymaster.policyId] - The BSO policy ID to use for gas sponsorship.
29
+ * @returns {Promise<UndelegateAccountResult>} A Promise that resolves to the result containing the call ID.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * const result = await client.undelegateAccount();
34
+ * const status = await client.waitForCallsStatus({ id: result.id });
35
+ * ```
36
+ */
37
+ export declare function undelegateAccount(client: InnerWalletApiClient, params?: UndelegateAccountParams): Promise<UndelegateAccountResult>;
@@ -0,0 +1,49 @@
1
+ import { zeroAddress } from "viem";
2
+ import { LOGGER } from "../logger.js";
3
+ import { resolveAddress } from "../utils/resolve.js";
4
+ import { sendCalls } from "./sendCalls.js";
5
+ /**
6
+ * Prepares, signs, and sends an EIP-7702 undelegation to remove delegation from an EOA.
7
+ * Gas is sponsored by Alchemy (requires Enterprise plan).
8
+ *
9
+ * A BSO (Bundler Sponsorship Override) policy ID must be provided either via
10
+ * `params.capabilities.paymaster.policyId` or pre-configured on the client via `policyIds`.
11
+ *
12
+ * @param {InnerWalletApiClient} client - The wallet API client to use for the request
13
+ * @param {UndelegateAccountParams} params - Parameters for undelegating the account
14
+ * @param {AccountParam} [params.account] - The account to undelegate. Defaults to the client's account (signer address).
15
+ * @param {object} [params.chain] - The chain. Defaults to the client's chain.
16
+ * @param {object} [params.capabilities] - Optional capabilities. If omitted, falls back to the policy ID(s) set on the client.
17
+ * @param {object} [params.capabilities.paymaster] - Paymaster capabilities. Requires a BSO policy ID.
18
+ * @param {string} [params.capabilities.paymaster.policyId] - The BSO policy ID to use for gas sponsorship.
19
+ * @returns {Promise<UndelegateAccountResult>} A Promise that resolves to the result containing the call ID.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * const result = await client.undelegateAccount();
24
+ * const status = await client.waitForCallsStatus({ id: result.id });
25
+ * ```
26
+ */
27
+ export async function undelegateAccount(client, params) {
28
+ const account = params?.account
29
+ ? resolveAddress(params.account)
30
+ : client.account.address;
31
+ LOGGER.info("undelegateAccount:start", {
32
+ account,
33
+ chain: params?.chain,
34
+ });
35
+ const result = await sendCalls(client, {
36
+ calls: [],
37
+ account,
38
+ ...(params?.chain != null ? { chain: params.chain } : {}),
39
+ capabilities: {
40
+ ...params?.capabilities,
41
+ eip7702Auth: {
42
+ delegation: zeroAddress,
43
+ },
44
+ },
45
+ });
46
+ LOGGER.info("undelegateAccount:done", { id: result.id });
47
+ return result;
48
+ }
49
+ //# sourceMappingURL=undelegateAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"undelegateAccount.js","sourceRoot":"","sources":["../../../src/actions/undelegateAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA6B,MAAM,MAAM,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,cAAc,EAAqB,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,SAAS,EAAwB,MAAM,gBAAgB,CAAC;AAcjE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAA4B,EAC5B,MAAgC;IAEhC,MAAM,OAAO,GAAG,MAAM,EAAE,OAAO;QAC7B,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC;QAChC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;IAE3B,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE;QACrC,OAAO;QACP,KAAK,EAAE,MAAM,EAAE,KAAK;KACrB,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,MAAM,EAAE;QACrC,KAAK,EAAE,EAAE;QACT,OAAO;QACP,GAAG,CAAC,MAAM,EAAE,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzD,YAAY,EAAE;YACZ,GAAG,MAAM,EAAE,YAAY;YACvB,WAAW,EAAE;gBACX,UAAU,EAAE,WAAW;aACxB;SACF;KACF,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;IACzD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { zeroAddress, type Chain, type Prettify } from \"viem\";\nimport type { InnerWalletApiClient } from \"../types.js\";\nimport { LOGGER } from \"../logger.js\";\nimport { resolveAddress, type AccountParam } from \"../utils/resolve.js\";\nimport { sendCalls, type SendCallsResult } from \"./sendCalls.js\";\n\nexport type UndelegateAccountParams = Prettify<{\n account?: AccountParam;\n chain?: Pick<Chain, \"id\">;\n capabilities?: {\n paymaster?: {\n policyId: string;\n };\n };\n}>;\n\nexport type UndelegateAccountResult = Prettify<SendCallsResult>;\n\n/**\n * Prepares, signs, and sends an EIP-7702 undelegation to remove delegation from an EOA.\n * Gas is sponsored by Alchemy (requires Enterprise plan).\n *\n * A BSO (Bundler Sponsorship Override) policy ID must be provided either via\n * `params.capabilities.paymaster.policyId` or pre-configured on the client via `policyIds`.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {UndelegateAccountParams} params - Parameters for undelegating the account\n * @param {AccountParam} [params.account] - The account to undelegate. Defaults to the client's account (signer address).\n * @param {object} [params.chain] - The chain. Defaults to the client's chain.\n * @param {object} [params.capabilities] - Optional capabilities. If omitted, falls back to the policy ID(s) set on the client.\n * @param {object} [params.capabilities.paymaster] - Paymaster capabilities. Requires a BSO policy ID.\n * @param {string} [params.capabilities.paymaster.policyId] - The BSO policy ID to use for gas sponsorship.\n * @returns {Promise<UndelegateAccountResult>} A Promise that resolves to the result containing the call ID.\n *\n * @example\n * ```ts\n * const result = await client.undelegateAccount();\n * const status = await client.waitForCallsStatus({ id: result.id });\n * ```\n */\nexport async function undelegateAccount(\n client: InnerWalletApiClient,\n params?: UndelegateAccountParams,\n): Promise<UndelegateAccountResult> {\n const account = params?.account\n ? resolveAddress(params.account)\n : client.account.address;\n\n LOGGER.info(\"undelegateAccount:start\", {\n account,\n chain: params?.chain,\n });\n\n const result = await sendCalls(client, {\n calls: [],\n account,\n ...(params?.chain != null ? { chain: params.chain } : {}),\n capabilities: {\n ...params?.capabilities,\n eip7702Auth: {\n delegation: zeroAddress,\n },\n },\n });\n\n LOGGER.info(\"undelegateAccount:done\", { id: result.id });\n return result;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import { BaseError } from "@alchemy/common";
2
+ export declare class SolanaSignerError extends BaseError {
3
+ name: string;
4
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseError } from "@alchemy/common";
2
+ export class SolanaSignerError extends BaseError {
3
+ constructor() {
4
+ super(...arguments);
5
+ Object.defineProperty(this, "name", {
6
+ enumerable: true,
7
+ configurable: true,
8
+ writable: true,
9
+ value: "SolanaSignerError"
10
+ });
11
+ }
12
+ }
13
+ //# sourceMappingURL=SolanaSignerError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SolanaSignerError.js","sourceRoot":"","sources":["../../../src/adapters/SolanaSignerError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,OAAO,iBAAkB,SAAQ,SAAS;IAAhD;;QACW;;;;mBAAO,mBAAmB;WAAC;IACtC,CAAC;CAAA","sourcesContent":["import { BaseError } from \"@alchemy/common\";\n\nexport class SolanaSignerError extends BaseError {\n override name = \"SolanaSignerError\";\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import type { SolanaSigner } from "../types.js";
2
+ /** Raw Ed25519 keypair signer (e.g. `Keypair` from `@solana/web3.js` v1 or a bare Ed25519 key). */
3
+ export interface SolanaKeypairSigner {
4
+ address: string;
5
+ signMessage(message: Uint8Array): Promise<Uint8Array>;
6
+ }
7
+ /**
8
+ * Adapts a raw Ed25519 keypair signer into a {@link SolanaSigner}.
9
+ *
10
+ * Use this for legacy `@solana/web3.js` v1 `Keypair` signers or any signer
11
+ * that exposes a `signMessage(bytes) => signature` interface. For
12
+ * `@solana/kit` signers, use {@link fromKitSigner}. For browser wallets
13
+ * (wallet adapter, Phantom, etc.), use {@link fromWalletAdapter}. For
14
+ * wallet-standard wallets, use {@link fromWalletStandard}.
15
+ *
16
+ * Requires `@solana/kit` or `@solana/web3.js` as a peer dependency.
17
+ *
18
+ * @param {SolanaKeypairSigner} signer - The raw Ed25519 keypair signer to adapt
19
+ * @returns {SolanaSigner} A SolanaSigner compatible with `createSmartWalletClient`
20
+ */
21
+ export declare function fromKeypair(signer: SolanaKeypairSigner): SolanaSigner;