@account-kit/privy-integration 4.71.0 → 4.72.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +97 -9
  2. package/dist/esm/Provider.d.ts +4 -2
  3. package/dist/esm/Provider.js +4 -2
  4. package/dist/esm/Provider.js.map +1 -1
  5. package/dist/esm/hooks/useAlchemySolanaTransaction.d.ts +163 -0
  6. package/dist/esm/hooks/useAlchemySolanaTransaction.js +233 -0
  7. package/dist/esm/hooks/useAlchemySolanaTransaction.js.map +1 -0
  8. package/dist/esm/index.d.ts +1 -0
  9. package/dist/esm/index.js +1 -0
  10. package/dist/esm/index.js.map +1 -1
  11. package/dist/esm/types.d.ts +5 -1
  12. package/dist/esm/types.js.map +1 -1
  13. package/dist/esm/util/createSolanaSponsoredTransaction.d.ts +12 -0
  14. package/dist/esm/util/createSolanaSponsoredTransaction.js +52 -0
  15. package/dist/esm/util/createSolanaSponsoredTransaction.js.map +1 -0
  16. package/dist/esm/util/createSolanaTransaction.d.ts +11 -0
  17. package/dist/esm/util/createSolanaTransaction.js +21 -0
  18. package/dist/esm/util/createSolanaTransaction.js.map +1 -0
  19. package/dist/esm/version.d.ts +1 -1
  20. package/dist/esm/version.js +1 -1
  21. package/dist/esm/version.js.map +1 -1
  22. package/dist/types/Provider.d.ts +4 -2
  23. package/dist/types/Provider.d.ts.map +1 -1
  24. package/dist/types/hooks/useAlchemySolanaTransaction.d.ts +164 -0
  25. package/dist/types/hooks/useAlchemySolanaTransaction.d.ts.map +1 -0
  26. package/dist/types/index.d.ts +1 -0
  27. package/dist/types/index.d.ts.map +1 -1
  28. package/dist/types/types.d.ts +5 -1
  29. package/dist/types/types.d.ts.map +1 -1
  30. package/dist/types/util/createSolanaSponsoredTransaction.d.ts +13 -0
  31. package/dist/types/util/createSolanaSponsoredTransaction.d.ts.map +1 -0
  32. package/dist/types/util/createSolanaTransaction.d.ts +12 -0
  33. package/dist/types/util/createSolanaTransaction.d.ts.map +1 -0
  34. package/dist/types/version.d.ts +1 -1
  35. package/package.json +5 -5
  36. package/src/hooks/useAlchemySolanaTransaction.ts +402 -0
  37. package/src/index.ts +1 -0
  38. package/src/types.ts +7 -1
  39. package/src/util/createSolanaSponsoredTransaction.ts +74 -0
  40. package/src/util/createSolanaTransaction.ts +31 -0
  41. package/src/version.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,WAAW;AACX,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAElE,QAAQ;AACR,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC","sourcesContent":["// Provider\nexport { AlchemyProvider, useAlchemyConfig } from \"./Provider.js\";\n\n// Hooks\nexport { useAlchemyClient } from \"./hooks/useAlchemyClient.js\";\nexport { useAlchemySendTransaction } from \"./hooks/useAlchemySendTransaction.js\";\nexport { useAlchemyPrepareSwap } from \"./hooks/useAlchemyPrepareSwap.js\";\nexport { useAlchemySubmitSwap } from \"./hooks/useAlchemySubmitSwap.js\";\n\n// Types\nexport type {\n AlchemyProviderConfig,\n UnsignedTransactionRequest,\n SendTransactionOptions,\n SendTransactionResult,\n UseSendTransactionResult,\n PrepareSwapRequest,\n PrepareSwapResult,\n UsePrepareSwapResult,\n SubmitSwapResult,\n UseSubmitSwapResult,\n SwapQuote,\n} from \"./types.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,WAAW;AACX,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAElE,QAAQ;AACR,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC","sourcesContent":["// Provider\nexport { AlchemyProvider, useAlchemyConfig } from \"./Provider.js\";\n\n// Hooks\nexport { useAlchemyClient } from \"./hooks/useAlchemyClient.js\";\nexport { useAlchemySendTransaction } from \"./hooks/useAlchemySendTransaction.js\";\nexport { useAlchemyPrepareSwap } from \"./hooks/useAlchemyPrepareSwap.js\";\nexport { useAlchemySubmitSwap } from \"./hooks/useAlchemySubmitSwap.js\";\nexport { useAlchemySolanaTransaction } from \"./hooks/useAlchemySolanaTransaction.js\";\n\n// Types\nexport type {\n AlchemyProviderConfig,\n UnsignedTransactionRequest,\n SendTransactionOptions,\n SendTransactionResult,\n UseSendTransactionResult,\n PrepareSwapRequest,\n PrepareSwapResult,\n UsePrepareSwapResult,\n SubmitSwapResult,\n UseSubmitSwapResult,\n SwapQuote,\n} from \"./types.js\";\n"]}
@@ -7,8 +7,12 @@ import type { z } from "zod";
7
7
  * Uses ConnectionConfigSchema to ensure valid transport configuration
8
8
  */
9
9
  export type AlchemyProviderConfig = z.infer<typeof ConnectionConfigSchema> & {
10
- /** Policy ID(s) for gas sponsorship */
10
+ /** Policy ID(s) for EVM gas sponsorship */
11
11
  policyId?: string | string[];
12
+ /** Policy ID(s) for Solana gas sponsorship */
13
+ solanaPolicyId?: string | string[];
14
+ /** Solana RPC URL (separate from EVM rpcUrl) */
15
+ solanaRpcUrl?: string;
12
16
  /**
13
17
  * Set to true to disable gas sponsorship by default
14
18
  * Default: false (sponsorship enabled when policyId is provided)
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC","sourcesContent":["import type { Address, Hash, Hex } from \"viem\";\nimport type { swapActions } from \"@account-kit/wallet-client/experimental\";\nimport { ConnectionConfigSchema } from \"@aa-sdk/core\";\nimport type { z } from \"zod\";\n\n/**\n * Configuration for the Alchemy provider\n * Uses ConnectionConfigSchema to ensure valid transport configuration\n */\nexport type AlchemyProviderConfig = z.infer<typeof ConnectionConfigSchema> & {\n /** Policy ID(s) for gas sponsorship */\n policyId?: string | string[];\n\n /**\n * Set to true to disable gas sponsorship by default\n * Default: false (sponsorship enabled when policyId is provided)\n */\n disableSponsorship?: boolean;\n};\n\n/**\n * Unsigned transaction request\n */\nexport interface UnsignedTransactionRequest {\n /** Recipient address */\n to: Address;\n\n /** Transaction data (calldata) */\n data?: Hex;\n\n /** Transaction value - accepts string | number | bigint */\n value?: string | number | bigint;\n}\n\n/**\n * Options for sending a transaction\n */\nexport interface SendTransactionOptions {\n /**\n * Set to true to disable sponsorship for this specific transaction\n * Default: false (follows provider's disableSponsorship setting)\n */\n disableSponsorship?: boolean;\n}\n\n/**\n * Result of a successful transaction\n */\nexport interface SendTransactionResult {\n /** EVM transaction hash (first receipt hash) */\n txnHash: Hash;\n}\n\n/**\n * Hook result for sending transactions\n */\nexport interface UseSendTransactionResult {\n /** Whether the transaction is currently being sent */\n isLoading: boolean;\n\n /** Error if transaction failed */\n error: Error | null;\n\n /** Transaction result if successful */\n data: SendTransactionResult | null;\n\n /** Reset the hook state */\n reset(): void;\n\n /** Send a single transaction or batch of transactions */\n sendTransaction(\n input: UnsignedTransactionRequest | UnsignedTransactionRequest[],\n options?: SendTransactionOptions,\n ): Promise<SendTransactionResult>;\n}\n\n/**\n * Request parameters for preparing a swap\n * Derived directly from the SDK to ensure type safety\n *\n * Note: Provide either `fromAmount` OR `minimumToAmount`, not both.\n * - Use `fromAmount` to specify exact amount to swap FROM\n * - Use `minimumToAmount` to specify minimum amount to receive TO\n */\nexport type PrepareSwapRequest = Parameters<\n ReturnType<typeof swapActions>[\"requestQuoteV0\"]\n>[0];\n\n/**\n * Response from requestQuoteV0\n * Derived directly from the SDK to ensure type safety\n */\nexport type RequestQuoteV0Result = Awaited<\n ReturnType<ReturnType<typeof swapActions>[\"requestQuoteV0\"]>\n>;\n\n/**\n * Swap quote information extracted from prepared swap calls\n * Derived directly from the SDK response\n */\nexport type SwapQuote = NonNullable<RequestQuoteV0Result[\"quote\"]>;\n\n/**\n * Result of preparing a swap (full response from requestQuoteV0)\n * Contains quote and prepared calls ready for signing\n */\nexport type PrepareSwapResult = Extract<\n RequestQuoteV0Result,\n { rawCalls?: false | undefined }\n>;\n\n/**\n * Hook result for preparing swaps\n */\nexport interface UsePrepareSwapResult {\n /** Whether the swap is being prepared */\n isLoading: boolean;\n\n /** Error if preparation failed */\n error: Error | null;\n\n /** Prepared swap data if successful */\n data: PrepareSwapResult | null;\n\n /** Reset the hook state */\n reset(): void;\n\n /** Request a swap quote and prepare calls */\n prepareSwap(request: PrepareSwapRequest): Promise<PrepareSwapResult>;\n}\n\n/**\n * Result of submitting a swap\n * Simplified wrapper that extracts the transaction hash\n */\nexport interface SubmitSwapResult {\n /** Transaction hash of the swap */\n txnHash: Hash;\n}\n\n/**\n * Hook result for submitting swaps\n */\nexport interface UseSubmitSwapResult {\n /** Whether the swap is being submitted */\n isLoading: boolean;\n\n /** Error if submission failed */\n error: Error | null;\n\n /** Swap submission result if successful */\n data: SubmitSwapResult | null;\n\n /** Reset the hook state */\n reset(): void;\n\n /** Sign and submit prepared swap calls */\n submitSwap(preparedSwap: PrepareSwapResult): Promise<SubmitSwapResult>;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC","sourcesContent":["import type { Address, Hash, Hex } from \"viem\";\nimport type { swapActions } from \"@account-kit/wallet-client/experimental\";\nimport { ConnectionConfigSchema } from \"@aa-sdk/core\";\nimport type { z } from \"zod\";\n\n/**\n * Configuration for the Alchemy provider\n * Uses ConnectionConfigSchema to ensure valid transport configuration\n */\nexport type AlchemyProviderConfig = z.infer<typeof ConnectionConfigSchema> & {\n /** Policy ID(s) for EVM gas sponsorship */\n policyId?: string | string[];\n\n /** Policy ID(s) for Solana gas sponsorship */\n solanaPolicyId?: string | string[];\n\n /** Solana RPC URL (separate from EVM rpcUrl) */\n solanaRpcUrl?: string;\n\n /**\n * Set to true to disable gas sponsorship by default\n * Default: false (sponsorship enabled when policyId is provided)\n */\n disableSponsorship?: boolean;\n};\n\n/**\n * Unsigned transaction request\n */\nexport interface UnsignedTransactionRequest {\n /** Recipient address */\n to: Address;\n\n /** Transaction data (calldata) */\n data?: Hex;\n\n /** Transaction value - accepts string | number | bigint */\n value?: string | number | bigint;\n}\n\n/**\n * Options for sending a transaction\n */\nexport interface SendTransactionOptions {\n /**\n * Set to true to disable sponsorship for this specific transaction\n * Default: false (follows provider's disableSponsorship setting)\n */\n disableSponsorship?: boolean;\n}\n\n/**\n * Result of a successful transaction\n */\nexport interface SendTransactionResult {\n /** EVM transaction hash (first receipt hash) */\n txnHash: Hash;\n}\n\n/**\n * Hook result for sending transactions\n */\nexport interface UseSendTransactionResult {\n /** Whether the transaction is currently being sent */\n isLoading: boolean;\n\n /** Error if transaction failed */\n error: Error | null;\n\n /** Transaction result if successful */\n data: SendTransactionResult | null;\n\n /** Reset the hook state */\n reset(): void;\n\n /** Send a single transaction or batch of transactions */\n sendTransaction(\n input: UnsignedTransactionRequest | UnsignedTransactionRequest[],\n options?: SendTransactionOptions,\n ): Promise<SendTransactionResult>;\n}\n\n/**\n * Request parameters for preparing a swap\n * Derived directly from the SDK to ensure type safety\n *\n * Note: Provide either `fromAmount` OR `minimumToAmount`, not both.\n * - Use `fromAmount` to specify exact amount to swap FROM\n * - Use `minimumToAmount` to specify minimum amount to receive TO\n */\nexport type PrepareSwapRequest = Parameters<\n ReturnType<typeof swapActions>[\"requestQuoteV0\"]\n>[0];\n\n/**\n * Response from requestQuoteV0\n * Derived directly from the SDK to ensure type safety\n */\nexport type RequestQuoteV0Result = Awaited<\n ReturnType<ReturnType<typeof swapActions>[\"requestQuoteV0\"]>\n>;\n\n/**\n * Swap quote information extracted from prepared swap calls\n * Derived directly from the SDK response\n */\nexport type SwapQuote = NonNullable<RequestQuoteV0Result[\"quote\"]>;\n\n/**\n * Result of preparing a swap (full response from requestQuoteV0)\n * Contains quote and prepared calls ready for signing\n */\nexport type PrepareSwapResult = Extract<\n RequestQuoteV0Result,\n { rawCalls?: false | undefined }\n>;\n\n/**\n * Hook result for preparing swaps\n */\nexport interface UsePrepareSwapResult {\n /** Whether the swap is being prepared */\n isLoading: boolean;\n\n /** Error if preparation failed */\n error: Error | null;\n\n /** Prepared swap data if successful */\n data: PrepareSwapResult | null;\n\n /** Reset the hook state */\n reset(): void;\n\n /** Request a swap quote and prepare calls */\n prepareSwap(request: PrepareSwapRequest): Promise<PrepareSwapResult>;\n}\n\n/**\n * Result of submitting a swap\n * Simplified wrapper that extracts the transaction hash\n */\nexport interface SubmitSwapResult {\n /** Transaction hash of the swap */\n txnHash: Hash;\n}\n\n/**\n * Hook result for submitting swaps\n */\nexport interface UseSubmitSwapResult {\n /** Whether the swap is being submitted */\n isLoading: boolean;\n\n /** Error if submission failed */\n error: Error | null;\n\n /** Swap submission result if successful */\n data: SubmitSwapResult | null;\n\n /** Reset the hook state */\n reset(): void;\n\n /** Sign and submit prepared swap calls */\n submitSwap(preparedSwap: PrepareSwapResult): Promise<SubmitSwapResult>;\n}\n"]}
@@ -0,0 +1,12 @@
1
+ import type { TransactionInstruction } from "@solana/web3.js";
2
+ import { Connection, VersionedTransaction } from "@solana/web3.js";
3
+ /**
4
+ * This function wraps instructions in a sponsored transaction using Alchemy's fee payer service
5
+ *
6
+ * @param {TransactionInstruction[]} instructions - The instructions to add sponsorship to
7
+ * @param {Connection} connection - The connection to use
8
+ * @param {string} policyId - The policy id to use
9
+ * @param {string} address - The address to use
10
+ * @returns {Promise<VersionedTransaction>} - The sponsored transaction
11
+ */
12
+ export declare function createSolanaSponsoredTransaction(instructions: TransactionInstruction[], connection: Connection, policyId: string, address: string): Promise<VersionedTransaction>;
@@ -0,0 +1,52 @@
1
+ import { Connection, PublicKey, TransactionMessage, VersionedTransaction, } from "@solana/web3.js";
2
+ /**
3
+ * This function wraps instructions in a sponsored transaction using Alchemy's fee payer service
4
+ *
5
+ * @param {TransactionInstruction[]} instructions - The instructions to add sponsorship to
6
+ * @param {Connection} connection - The connection to use
7
+ * @param {string} policyId - The policy id to use
8
+ * @param {string} address - The address to use
9
+ * @returns {Promise<VersionedTransaction>} - The sponsored transaction
10
+ */
11
+ export async function createSolanaSponsoredTransaction(instructions, connection, policyId, address) {
12
+ const { blockhash } = await connection.getLatestBlockhash({
13
+ commitment: "finalized",
14
+ });
15
+ const message = new TransactionMessage({
16
+ // Right now the backend will rewrite this payer Key to the server's address
17
+ payerKey: new PublicKey(address),
18
+ recentBlockhash: blockhash,
19
+ instructions,
20
+ }).compileToV0Message();
21
+ const versionedTransaction = new VersionedTransaction(message);
22
+ const serializedTransaction = Buffer.from(versionedTransaction.serialize()).toString("base64");
23
+ const body = JSON.stringify({
24
+ id: crypto?.randomUUID() ??
25
+ `${Date.now()}-${Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)}`,
26
+ jsonrpc: "2.0",
27
+ method: "alchemy_requestFeePayer",
28
+ params: [
29
+ {
30
+ policyId,
31
+ serializedTransaction,
32
+ },
33
+ ],
34
+ });
35
+ const options = {
36
+ method: "POST",
37
+ headers: {
38
+ accept: "application/json",
39
+ "content-type": "application/json",
40
+ },
41
+ body,
42
+ };
43
+ const response = await fetch(connection.rpcEndpoint, options);
44
+ const jsonResponse = await response.json();
45
+ if (!jsonResponse?.result?.serializedTransaction)
46
+ throw new Error(`Response doesn't include the serializedTransaction ${JSON.stringify(jsonResponse)}`);
47
+ return VersionedTransaction.deserialize(decodeBase64(jsonResponse.result.serializedTransaction));
48
+ }
49
+ function decodeBase64(serializedTransaction) {
50
+ return Buffer.from(serializedTransaction, "base64");
51
+ }
52
+ //# sourceMappingURL=createSolanaSponsoredTransaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSolanaSponsoredTransaction.js","sourceRoot":"","sources":["../../../src/util/createSolanaSponsoredTransaction.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,SAAS,EACT,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACpD,YAAsC,EACtC,UAAsB,EACtB,QAAgB,EAChB,OAAe;IAEf,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,UAAU,CAAC,kBAAkB,CAAC;QACxD,UAAU,EAAE,WAAW;KACxB,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,IAAI,kBAAkB,CAAC;QACrC,4EAA4E;QAC5E,QAAQ,EAAE,IAAI,SAAS,CAAC,OAAO,CAAC;QAChC,eAAe,EAAE,SAAS;QAC1B,YAAY;KACb,CAAC,CAAC,kBAAkB,EAAE,CAAC;IACxB,MAAM,oBAAoB,GAAG,IAAI,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC/D,MAAM,qBAAqB,GAAG,MAAM,CAAC,IAAI,CACvC,oBAAoB,CAAC,SAAS,EAAE,CACjC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACrB,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;QAC1B,EAAE,EACA,MAAM,EAAE,UAAU,EAAE;YACpB,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,gBAAgB,CAAC,EAAE;QACxE,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,yBAAyB;QACjC,MAAM,EAAE;YACN;gBACE,QAAQ;gBACR,qBAAqB;aACtB;SACF;KACF,CAAC,CAAC;IACH,MAAM,OAAO,GAAG;QACd,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;YAC1B,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI;KACL,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC9D,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC3C,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,qBAAqB;QAC9C,MAAM,IAAI,KAAK,CACb,sDAAsD,IAAI,CAAC,SAAS,CAClE,YAAY,CACb,EAAE,CACJ,CAAC;IACJ,OAAO,oBAAoB,CAAC,WAAW,CACrC,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,qBAAqB,CAAC,CACxD,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,qBAA6B;IACjD,OAAO,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import type { TransactionInstruction } from \"@solana/web3.js\";\nimport {\n Connection,\n PublicKey,\n TransactionMessage,\n VersionedTransaction,\n} from \"@solana/web3.js\";\n\n/**\n * This function wraps instructions in a sponsored transaction using Alchemy's fee payer service\n *\n * @param {TransactionInstruction[]} instructions - The instructions to add sponsorship to\n * @param {Connection} connection - The connection to use\n * @param {string} policyId - The policy id to use\n * @param {string} address - The address to use\n * @returns {Promise<VersionedTransaction>} - The sponsored transaction\n */\nexport async function createSolanaSponsoredTransaction(\n instructions: TransactionInstruction[],\n connection: Connection,\n policyId: string,\n address: string,\n): Promise<VersionedTransaction> {\n const { blockhash } = await connection.getLatestBlockhash({\n commitment: \"finalized\",\n });\n const message = new TransactionMessage({\n // Right now the backend will rewrite this payer Key to the server's address\n payerKey: new PublicKey(address),\n recentBlockhash: blockhash,\n instructions,\n }).compileToV0Message();\n const versionedTransaction = new VersionedTransaction(message);\n const serializedTransaction = Buffer.from(\n versionedTransaction.serialize(),\n ).toString(\"base64\");\n const body = JSON.stringify({\n id:\n crypto?.randomUUID() ??\n `${Date.now()}-${Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)}`,\n jsonrpc: \"2.0\",\n method: \"alchemy_requestFeePayer\",\n params: [\n {\n policyId,\n serializedTransaction,\n },\n ],\n });\n const options = {\n method: \"POST\",\n headers: {\n accept: \"application/json\",\n \"content-type\": \"application/json\",\n },\n body,\n };\n\n const response = await fetch(connection.rpcEndpoint, options);\n const jsonResponse = await response.json();\n if (!jsonResponse?.result?.serializedTransaction)\n throw new Error(\n `Response doesn't include the serializedTransaction ${JSON.stringify(\n jsonResponse,\n )}`,\n );\n return VersionedTransaction.deserialize(\n decodeBase64(jsonResponse.result.serializedTransaction),\n );\n}\n\nfunction decodeBase64(serializedTransaction: string): Uint8Array {\n return Buffer.from(serializedTransaction, \"base64\");\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import type { TransactionInstruction } from "@solana/web3.js";
2
+ import { Connection, VersionedTransaction } from "@solana/web3.js";
3
+ /**
4
+ * Creates a regular (non-sponsored) Solana transaction from instructions
5
+ *
6
+ * @param {TransactionInstruction[]} instructions - The instructions to create transaction from
7
+ * @param {Connection} connection - The connection to use
8
+ * @param {string} address - The payer address
9
+ * @returns {Promise<VersionedTransaction>} - The transaction
10
+ */
11
+ export declare function createSolanaTransaction(instructions: TransactionInstruction[], connection: Connection, address: string): Promise<VersionedTransaction>;
@@ -0,0 +1,21 @@
1
+ import { Connection, PublicKey, TransactionMessage, VersionedTransaction, } from "@solana/web3.js";
2
+ /**
3
+ * Creates a regular (non-sponsored) Solana transaction from instructions
4
+ *
5
+ * @param {TransactionInstruction[]} instructions - The instructions to create transaction from
6
+ * @param {Connection} connection - The connection to use
7
+ * @param {string} address - The payer address
8
+ * @returns {Promise<VersionedTransaction>} - The transaction
9
+ */
10
+ export async function createSolanaTransaction(instructions, connection, address) {
11
+ const { blockhash } = await connection.getLatestBlockhash({
12
+ commitment: "finalized",
13
+ });
14
+ const message = new TransactionMessage({
15
+ payerKey: new PublicKey(address),
16
+ recentBlockhash: blockhash,
17
+ instructions,
18
+ }).compileToV0Message();
19
+ return new VersionedTransaction(message);
20
+ }
21
+ //# sourceMappingURL=createSolanaTransaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSolanaTransaction.js","sourceRoot":"","sources":["../../../src/util/createSolanaTransaction.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,SAAS,EACT,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,YAAsC,EACtC,UAAsB,EACtB,OAAe;IAEf,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,UAAU,CAAC,kBAAkB,CAAC;QACxD,UAAU,EAAE,WAAW;KACxB,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,IAAI,kBAAkB,CAAC;QACrC,QAAQ,EAAE,IAAI,SAAS,CAAC,OAAO,CAAC;QAChC,eAAe,EAAE,SAAS;QAC1B,YAAY;KACb,CAAC,CAAC,kBAAkB,EAAE,CAAC;IACxB,OAAO,IAAI,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["import type { TransactionInstruction } from \"@solana/web3.js\";\nimport {\n Connection,\n PublicKey,\n TransactionMessage,\n VersionedTransaction,\n} from \"@solana/web3.js\";\n\n/**\n * Creates a regular (non-sponsored) Solana transaction from instructions\n *\n * @param {TransactionInstruction[]} instructions - The instructions to create transaction from\n * @param {Connection} connection - The connection to use\n * @param {string} address - The payer address\n * @returns {Promise<VersionedTransaction>} - The transaction\n */\nexport async function createSolanaTransaction(\n instructions: TransactionInstruction[],\n connection: Connection,\n address: string,\n): Promise<VersionedTransaction> {\n const { blockhash } = await connection.getLatestBlockhash({\n commitment: \"finalized\",\n });\n const message = new TransactionMessage({\n payerKey: new PublicKey(address),\n recentBlockhash: blockhash,\n instructions,\n }).compileToV0Message();\n return new VersionedTransaction(message);\n}\n"]}
@@ -1 +1 @@
1
- export declare const VERSION = "4.71.0";
1
+ export declare const VERSION = "4.72.0";
@@ -1,4 +1,4 @@
1
1
  // This file is autogenerated by inject-version.ts. Any changes will be
2
2
  // overwritten on commit!
3
- export const VERSION = "4.71.0";
3
+ export const VERSION = "4.72.0";
4
4
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.71.0\";\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.72.0\";\n"]}
@@ -19,8 +19,10 @@ interface ClientCache {
19
19
  * @param {React.ReactNode} props.children - React children to wrap with Alchemy configuration
20
20
  * @param {string} [props.apiKey] - Your Alchemy API key
21
21
  * @param {string} [props.jwt] - JWT token for authentication
22
- * @param {string} [props.rpcUrl] - Custom RPC URL
23
- * @param {string | string[]} [props.policyId] - Gas Manager policy ID(s)
22
+ * @param {string} [props.rpcUrl] - Custom RPC URL for EVM chains
23
+ * @param {string} [props.solanaRpcUrl] - Custom RPC URL for Solana
24
+ * @param {string | string[]} [props.policyId] - Gas Manager policy ID(s) for EVM chains
25
+ * @param {string | string[]} [props.solanaPolicyId] - Gas Manager policy ID(s) for Solana
24
26
  * @param {boolean} [props.disableSponsorship] - Set to true to disable sponsorship by default (default: false)
25
27
  * @returns {JSX.Element} Provider component
26
28
  *
@@ -1 +1 @@
1
- {"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../src/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EAKvB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAIxD;;;;GAIG;AACH,UAAU,WAAW;IACnB,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACjC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAID;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,GAAG,MAAM,EACV,EAAE,iBAAiB,CAAC,qBAAqB,CAAC,2CAiD1C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,IAAI,qBAAqB,CAMxD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAQ5C"}
1
+ {"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../src/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EAKvB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAIxD;;;;GAIG;AACH,UAAU,WAAW;IACnB,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACjC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,GAAG,MAAM,EACV,EAAE,iBAAiB,CAAC,qBAAqB,CAAC,2CAiD1C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,IAAI,qBAAqB,CAMxD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAQ5C"}
@@ -0,0 +1,164 @@
1
+ import { Connection, Transaction, TransactionInstruction, VersionedTransaction } from "@solana/web3.js";
2
+ /**
3
+ * Type helper for values that can be synchronous or asynchronous
4
+ *
5
+ * @template T - The value type
6
+ */
7
+ export type PromiseOrValue<T> = T | Promise<T>;
8
+ /**
9
+ * Callback to modify a transaction before it's signed
10
+ * Useful for adding additional signatures or metadata
11
+ *
12
+ * @param transaction - The unsigned transaction to modify
13
+ * @returns The modified transaction
14
+ */
15
+ export type PreSend = (this: void, transaction: VersionedTransaction | Transaction) => PromiseOrValue<VersionedTransaction | Transaction>;
16
+ /**
17
+ * Callback to transform instructions into a custom transaction
18
+ * Useful for advanced transaction construction (e.g., multi-sig, custom versioning)
19
+ *
20
+ * @param instructions - Array of Solana transaction instructions
21
+ * @returns Constructed transaction (legacy or versioned)
22
+ */
23
+ export type TransformInstruction = (this: void, instructions: TransactionInstruction[]) => PromiseOrValue<Transaction | VersionedTransaction>;
24
+ /**
25
+ * Optional transaction lifecycle hooks for advanced use cases
26
+ */
27
+ export type SolanaTransactionParamOptions = {
28
+ /** Hook called before signing the transaction */
29
+ preSend?: PreSend;
30
+ /** Custom transaction builder from instructions */
31
+ transformInstruction?: TransformInstruction;
32
+ };
33
+ /**
34
+ * Parameters for sending a Solana transaction
35
+ * Supports either a simple transfer or custom instructions
36
+ */
37
+ export type SolanaTransactionParams = {
38
+ /** Simple SOL transfer parameters */
39
+ transfer: {
40
+ /** Amount in lamports (accepts number or bigint) */
41
+ amount: number | bigint;
42
+ /** Recipient's base58-encoded address */
43
+ toAddress: string;
44
+ };
45
+ /** Optional transaction lifecycle hooks */
46
+ transactionComponents?: SolanaTransactionParamOptions;
47
+ /** Options for confirming the transaction on-chain */
48
+ confirmationOptions?: Parameters<Connection["confirmTransaction"]>[1];
49
+ } | {
50
+ /** Custom Solana transaction instructions */
51
+ instructions: TransactionInstruction[];
52
+ /** Optional transaction lifecycle hooks */
53
+ transactionComponents?: SolanaTransactionParamOptions;
54
+ /** Options for confirming the transaction on-chain */
55
+ confirmationOptions?: Parameters<Connection["confirmTransaction"]>[1];
56
+ };
57
+ /**
58
+ * Result of a successful Solana transaction
59
+ */
60
+ export interface SolanaTransactionResult {
61
+ /** Base58-encoded transaction signature (hash) */
62
+ hash: string;
63
+ }
64
+ /**
65
+ * Configuration options for useAlchemySolanaTransaction hook
66
+ */
67
+ export interface UseAlchemySolanaTransactionOptions {
68
+ /** Solana RPC URL (overrides provider config) */
69
+ rpcUrl?: string;
70
+ /** Gas sponsorship policy ID (overrides provider config) */
71
+ policyId?: string | void;
72
+ /** Transaction confirmation options */
73
+ confirmationOptions?: Parameters<Connection["confirmTransaction"]>[1];
74
+ /** Specific wallet address to use (defaults to first available wallet) */
75
+ walletAddress?: string;
76
+ }
77
+ /**
78
+ * Return type of useAlchemySolanaTransaction hook
79
+ */
80
+ export interface UseAlchemySolanaTransactionResult {
81
+ /** Active Solana connection instance */
82
+ readonly connection: Connection | null;
83
+ /** Transaction result if successful */
84
+ readonly data: void | SolanaTransactionResult;
85
+ /** Whether a transaction is currently being sent */
86
+ readonly isPending: boolean;
87
+ /** Error if transaction failed */
88
+ readonly error: Error | null;
89
+ /** Reset hook state (clears error, data, isPending) */
90
+ reset(): void;
91
+ /** Send transaction (fire-and-forget, errors caught internally) */
92
+ sendTransaction(params: SolanaTransactionParams): void;
93
+ /** Send transaction and await result (throws on error) */
94
+ sendTransactionAsync(params: SolanaTransactionParams): Promise<SolanaTransactionResult>;
95
+ }
96
+ /**
97
+ * Hook to send Solana transactions with optional gas sponsorship via Alchemy
98
+ * Works with Privy's Solana wallet integration for signing transactions
99
+ * Supports both simple transfers and custom instruction sets
100
+ *
101
+ * @param {UseAlchemySolanaTransactionOptions} [opts] - Configuration options
102
+ * @param {string} [opts.rpcUrl] - Solana RPC URL (overrides provider config)
103
+ * @param {string} [opts.policyId] - Gas sponsorship policy ID (overrides provider config)
104
+ * @param {string} [opts.walletAddress] - Specific wallet address to use (defaults to first wallet)
105
+ * @param {Parameters<Connection["confirmTransaction"]>[1]} [opts.confirmationOptions] - Transaction confirmation options
106
+ * @returns {UseAlchemySolanaTransactionResult} Hook result with transaction functions and state
107
+ *
108
+ * @example Simple SOL transfer
109
+ * ```tsx
110
+ * const { sendTransactionAsync, isPending, error, data } = useAlchemySolanaTransaction({
111
+ * rpcUrl: 'https://solana-mainnet.g.alchemy.com/v2/your-api-key',
112
+ * policyId: 'your-policy-id', // Optional: for gas sponsorship
113
+ * });
114
+ *
115
+ * const handleTransfer = async () => {
116
+ * try {
117
+ * const result = await sendTransactionAsync({
118
+ * transfer: {
119
+ * amount: 1_000_000_000, // 1 SOL in lamports
120
+ * toAddress: 'recipient-address',
121
+ * },
122
+ * });
123
+ * console.log('Transaction hash:', result.hash);
124
+ * } catch (err) {
125
+ * console.error('Transaction failed:', err);
126
+ * }
127
+ * };
128
+ * ```
129
+ *
130
+ * @example Custom instructions
131
+ * ```tsx
132
+ * import { SystemProgram, PublicKey } from '@solana/web3.js';
133
+ *
134
+ * const { sendTransactionAsync } = useAlchemySolanaTransaction();
135
+ *
136
+ * // Build your custom instructions
137
+ * const transferIx = SystemProgram.transfer({
138
+ * fromPubkey: new PublicKey(walletAddress),
139
+ * toPubkey: new PublicKey(recipientAddress),
140
+ * lamports: 1_000_000,
141
+ * });
142
+ *
143
+ * // Pass instructions array to the hook
144
+ * const result = await sendTransactionAsync({
145
+ * instructions: [transferIx],
146
+ * });
147
+ * ```
148
+ *
149
+ * @example With provider configuration
150
+ * ```tsx
151
+ * // In your provider setup
152
+ * <AlchemyProvider
153
+ * solanaRpcUrl="https://solana-mainnet.g.alchemy.com/v2/..."
154
+ * solanaPolicyId="your-solana-policy-id"
155
+ * >
156
+ * <YourApp />
157
+ * </AlchemyProvider>
158
+ *
159
+ * // In your component - uses provider config automatically
160
+ * const { sendTransactionAsync } = useAlchemySolanaTransaction();
161
+ * ```
162
+ */
163
+ export declare function useAlchemySolanaTransaction(opts?: UseAlchemySolanaTransactionOptions): UseAlchemySolanaTransactionResult;
164
+ //# sourceMappingURL=useAlchemySolanaTransaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAlchemySolanaTransaction.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAlchemySolanaTransaction.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EAGV,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAMzB;;;;GAIG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,MAAM,OAAO,GAAG,CACpB,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,oBAAoB,GAAG,WAAW,KAC5C,cAAc,CAAC,oBAAoB,GAAG,WAAW,CAAC,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAAG,CACjC,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,sBAAsB,EAAE,KACnC,cAAc,CAAC,WAAW,GAAG,oBAAoB,CAAC,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C,iDAAiD;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mDAAmD;IACnD,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;CAC7C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAC/B;IACE,qCAAqC;IACrC,QAAQ,EAAE;QACR,oDAAoD;QACpD,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;QACxB,yCAAyC;QACzC,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,2CAA2C;IAC3C,qBAAqB,CAAC,EAAE,6BAA6B,CAAC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,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,GAAE,kCAAuC,GAC5C,iCAAiC,CA0MnC"}
@@ -3,5 +3,6 @@ export { useAlchemyClient } from "./hooks/useAlchemyClient.js";
3
3
  export { useAlchemySendTransaction } from "./hooks/useAlchemySendTransaction.js";
4
4
  export { useAlchemyPrepareSwap } from "./hooks/useAlchemyPrepareSwap.js";
5
5
  export { useAlchemySubmitSwap } from "./hooks/useAlchemySubmitSwap.js";
6
+ export { useAlchemySolanaTransaction } from "./hooks/useAlchemySolanaTransaction.js";
6
7
  export type { AlchemyProviderConfig, UnsignedTransactionRequest, SendTransactionOptions, SendTransactionResult, UseSendTransactionResult, PrepareSwapRequest, PrepareSwapResult, UsePrepareSwapResult, SubmitSwapResult, UseSubmitSwapResult, SwapQuote, } from "./types.js";
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGlE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAGvE,YAAY,EACV,qBAAqB,EACrB,0BAA0B,EAC1B,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,SAAS,GACV,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGlE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AAGrF,YAAY,EACV,qBAAqB,EACrB,0BAA0B,EAC1B,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,SAAS,GACV,MAAM,YAAY,CAAC"}
@@ -7,8 +7,12 @@ import type { z } from "zod";
7
7
  * Uses ConnectionConfigSchema to ensure valid transport configuration
8
8
  */
9
9
  export type AlchemyProviderConfig = z.infer<typeof ConnectionConfigSchema> & {
10
- /** Policy ID(s) for gas sponsorship */
10
+ /** Policy ID(s) for EVM gas sponsorship */
11
11
  policyId?: string | string[];
12
+ /** Policy ID(s) for Solana gas sponsorship */
13
+ solanaPolicyId?: string | string[];
14
+ /** Solana RPC URL (separate from EVM rpcUrl) */
15
+ solanaRpcUrl?: string;
12
16
  /**
13
17
  * Set to true to disable gas sponsorship by default
14
18
  * Default: false (sponsorship enabled when policyId is provided)
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,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E,KAAK,GAAG,IAAI,CAAC;IAEpB,2CAA2C;IAC3C,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAE9B,2BAA2B;IAC3B,KAAK,IAAI,IAAI,CAAC;IAEd,0CAA0C;IAC1C,UAAU,CAAC,YAAY,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACxE"}
@@ -0,0 +1,13 @@
1
+ import type { TransactionInstruction } from "@solana/web3.js";
2
+ import { Connection, VersionedTransaction } from "@solana/web3.js";
3
+ /**
4
+ * This function wraps instructions in a sponsored transaction using Alchemy's fee payer service
5
+ *
6
+ * @param {TransactionInstruction[]} instructions - The instructions to add sponsorship to
7
+ * @param {Connection} connection - The connection to use
8
+ * @param {string} policyId - The policy id to use
9
+ * @param {string} address - The address to use
10
+ * @returns {Promise<VersionedTransaction>} - The sponsored transaction
11
+ */
12
+ export declare function createSolanaSponsoredTransaction(instructions: TransactionInstruction[], connection: Connection, policyId: string, address: string): Promise<VersionedTransaction>;
13
+ //# sourceMappingURL=createSolanaSponsoredTransaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSolanaSponsoredTransaction.d.ts","sourceRoot":"","sources":["../../../src/util/createSolanaSponsoredTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EACL,UAAU,EAGV,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;GAQG;AACH,wBAAsB,gCAAgC,CACpD,YAAY,EAAE,sBAAsB,EAAE,EACtC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,oBAAoB,CAAC,CA+C/B"}
@@ -0,0 +1,12 @@
1
+ import type { TransactionInstruction } from "@solana/web3.js";
2
+ import { Connection, VersionedTransaction } from "@solana/web3.js";
3
+ /**
4
+ * Creates a regular (non-sponsored) Solana transaction from instructions
5
+ *
6
+ * @param {TransactionInstruction[]} instructions - The instructions to create transaction from
7
+ * @param {Connection} connection - The connection to use
8
+ * @param {string} address - The payer address
9
+ * @returns {Promise<VersionedTransaction>} - The transaction
10
+ */
11
+ export declare function createSolanaTransaction(instructions: TransactionInstruction[], connection: Connection, address: string): Promise<VersionedTransaction>;
12
+ //# sourceMappingURL=createSolanaTransaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSolanaTransaction.d.ts","sourceRoot":"","sources":["../../../src/util/createSolanaTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EACL,UAAU,EAGV,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,YAAY,EAAE,sBAAsB,EAAE,EACtC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,oBAAoB,CAAC,CAU/B"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "4.71.0";
1
+ export declare const VERSION = "4.72.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@account-kit/privy-integration",
3
- "version": "4.71.0",
3
+ "version": "4.72.0",
4
4
  "description": "Use Alchemy gas sponsorship, swaps and more with Privy",
5
5
  "author": "Alchemy",
6
6
  "license": "MIT",
@@ -39,12 +39,12 @@
39
39
  "test:run": "vitest run --passWithNoTests"
40
40
  },
41
41
  "devDependencies": {
42
- "@privy-io/react-auth": "^2.3.1",
42
+ "@privy-io/react-auth": "3.3.0",
43
43
  "typescript-template": "*"
44
44
  },
45
45
  "dependencies": {
46
- "@account-kit/infra": "^4.71.0",
47
- "@account-kit/wallet-client": "^4.71.0"
46
+ "@account-kit/infra": "^4.72.0",
47
+ "@account-kit/wallet-client": "^4.72.0"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "@privy-io/react-auth": "^2.3.1 || ^3.0.0",
@@ -62,5 +62,5 @@
62
62
  "url": "https://github.com/alchemyplatform/aa-sdk/issues"
63
63
  },
64
64
  "homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
65
- "gitHead": "a3ce23e6b1e59b2b4aee11b36887885552861dd7"
65
+ "gitHead": "e5efee1de2bb143287c3da604d0a7f545612a309"
66
66
  }