@nosana/kit 2.0.19 → 2.0.25

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 (87) hide show
  1. package/README.md +96 -24
  2. package/dist/NosanaClient.d.ts +5 -5
  3. package/dist/NosanaClient.js +7 -5
  4. package/dist/NosanaClient.js.map +1 -1
  5. package/dist/index.d.ts +9 -9
  6. package/dist/index.js +5 -5
  7. package/dist/index.js.map +1 -1
  8. package/dist/services/programs/{JobsProgram.d.ts → jobs/JobsProgram.d.ts} +47 -11
  9. package/dist/services/programs/{JobsProgram.js → jobs/JobsProgram.js} +84 -208
  10. package/dist/services/programs/jobs/JobsProgram.js.map +1 -0
  11. package/dist/services/programs/jobs/index.d.ts +1 -0
  12. package/dist/services/programs/jobs/index.js +2 -0
  13. package/dist/services/programs/jobs/index.js.map +1 -0
  14. package/dist/services/programs/{instructions → jobs/instructions}/delist.d.ts +1 -1
  15. package/dist/services/programs/jobs/instructions/delist.js.map +1 -0
  16. package/dist/services/programs/{instructions → jobs/instructions}/end.d.ts +1 -1
  17. package/dist/services/programs/jobs/instructions/end.js.map +1 -0
  18. package/dist/services/programs/{instructions → jobs/instructions}/extend.d.ts +1 -1
  19. package/dist/services/programs/jobs/instructions/extend.js.map +1 -0
  20. package/dist/services/programs/jobs/instructions/index.js.map +1 -0
  21. package/dist/services/programs/{instructions → jobs/instructions}/post.d.ts +1 -1
  22. package/dist/services/programs/jobs/instructions/post.js.map +1 -0
  23. package/dist/services/programs/jobs/instructions/types.d.ts +16 -0
  24. package/dist/services/programs/jobs/instructions/types.js.map +1 -0
  25. package/dist/services/programs/jobs/monitor/index.d.ts +3 -0
  26. package/dist/services/programs/jobs/monitor/index.js +3 -0
  27. package/dist/services/programs/jobs/monitor/index.js.map +1 -0
  28. package/dist/services/programs/jobs/monitor/monitor.d.ts +22 -0
  29. package/dist/services/programs/jobs/monitor/monitor.js +180 -0
  30. package/dist/services/programs/jobs/monitor/monitor.js.map +1 -0
  31. package/dist/services/programs/jobs/monitor/types.d.ts +27 -0
  32. package/dist/services/programs/jobs/monitor/types.js +9 -0
  33. package/dist/services/programs/jobs/monitor/types.js.map +1 -0
  34. package/dist/services/programs/{MerkleDistributorProgram.d.ts → merkleDistributor/MerkleDistributorProgram.d.ts} +4 -4
  35. package/dist/services/programs/{MerkleDistributorProgram.js → merkleDistributor/MerkleDistributorProgram.js} +3 -3
  36. package/dist/services/programs/merkleDistributor/MerkleDistributorProgram.js.map +1 -0
  37. package/dist/services/programs/merkleDistributor/index.d.ts +1 -0
  38. package/dist/services/programs/merkleDistributor/index.js +2 -0
  39. package/dist/services/programs/merkleDistributor/index.js.map +1 -0
  40. package/dist/services/programs/{StakeProgram.d.ts → stake/StakeProgram.d.ts} +4 -4
  41. package/dist/services/programs/{StakeProgram.js → stake/StakeProgram.js} +2 -2
  42. package/dist/services/programs/stake/StakeProgram.js.map +1 -0
  43. package/dist/services/programs/stake/index.d.ts +1 -0
  44. package/dist/services/programs/stake/index.js +2 -0
  45. package/dist/services/programs/stake/index.js.map +1 -0
  46. package/dist/services/solana/SolanaService.d.ts +150 -0
  47. package/dist/services/{SolanaService.js → solana/SolanaService.js} +191 -9
  48. package/dist/services/solana/SolanaService.js.map +1 -0
  49. package/dist/services/solana/index.d.ts +1 -0
  50. package/dist/services/solana/index.js +2 -0
  51. package/dist/services/solana/index.js.map +1 -0
  52. package/dist/services/token/TokenService.d.ts +65 -0
  53. package/dist/services/{TokenService.js → token/TokenService.js} +82 -4
  54. package/dist/services/token/TokenService.js.map +1 -0
  55. package/dist/services/token/index.d.ts +1 -0
  56. package/dist/services/token/index.js +2 -0
  57. package/dist/services/token/index.js.map +1 -0
  58. package/dist/types.d.ts +3 -1
  59. package/dist/utils/convertHttpToWebSocketUrl.d.ts +28 -0
  60. package/dist/utils/convertHttpToWebSocketUrl.js +37 -0
  61. package/dist/utils/convertHttpToWebSocketUrl.js.map +1 -0
  62. package/dist/utils/getStaticAccounts.d.ts +1 -1
  63. package/dist/utils/index.d.ts +1 -0
  64. package/dist/utils/index.js +1 -0
  65. package/dist/utils/index.js.map +1 -1
  66. package/package.json +4 -4
  67. package/dist/services/SolanaService.d.ts +0 -64
  68. package/dist/services/SolanaService.js.map +0 -1
  69. package/dist/services/TokenService.d.ts +0 -41
  70. package/dist/services/TokenService.js.map +0 -1
  71. package/dist/services/programs/JobsProgram.js.map +0 -1
  72. package/dist/services/programs/MerkleDistributorProgram.js.map +0 -1
  73. package/dist/services/programs/StakeProgram.js.map +0 -1
  74. package/dist/services/programs/instructions/delist.js.map +0 -1
  75. package/dist/services/programs/instructions/end.js.map +0 -1
  76. package/dist/services/programs/instructions/extend.js.map +0 -1
  77. package/dist/services/programs/instructions/index.js.map +0 -1
  78. package/dist/services/programs/instructions/post.js.map +0 -1
  79. package/dist/services/programs/instructions/types.d.ts +0 -16
  80. package/dist/services/programs/instructions/types.js.map +0 -1
  81. /package/dist/services/programs/{instructions → jobs/instructions}/delist.js +0 -0
  82. /package/dist/services/programs/{instructions → jobs/instructions}/end.js +0 -0
  83. /package/dist/services/programs/{instructions → jobs/instructions}/extend.js +0 -0
  84. /package/dist/services/programs/{instructions → jobs/instructions}/index.d.ts +0 -0
  85. /package/dist/services/programs/{instructions → jobs/instructions}/index.js +0 -0
  86. /package/dist/services/programs/{instructions → jobs/instructions}/post.js +0 -0
  87. /package/dist/services/programs/{instructions → jobs/instructions}/types.js +0 -0
@@ -0,0 +1,180 @@
1
+ import { parseBase64RpcAccount } from '@solana/kit';
2
+ import { JobState } from '../JobsProgram.js';
3
+ import { MonitorEventType } from './types.js';
4
+ /**
5
+ * Set up WebSocket subscription for program notifications
6
+ */
7
+ async function setupSubscription(deps, programId, abortController) {
8
+ try {
9
+ // Set up the subscription using the correct API pattern
10
+ const subscriptionIterable = await deps.solana.rpcSubscriptions
11
+ .programNotifications(programId, { encoding: 'base64' })
12
+ .subscribe({ abortSignal: abortController.signal });
13
+ return subscriptionIterable;
14
+ }
15
+ catch (error) {
16
+ throw new Error(`Failed to setup subscription: ${error}`);
17
+ }
18
+ }
19
+ /**
20
+ * Handle JobAccount updates
21
+ */
22
+ async function handleJobAccount(encodedAccount, autoMerge, runs, monitorDeps) {
23
+ const { client, transformJobAccount, mergeRunIntoJob, deps } = monitorDeps;
24
+ const jobAccount = client.decodeJobAccount(encodedAccount);
25
+ let job = transformJobAccount(jobAccount);
26
+ // If auto-merge is enabled, check for run accounts
27
+ if (autoMerge && job.state === JobState.QUEUED) {
28
+ try {
29
+ const runAccounts = await runs({ job: job.address });
30
+ if (runAccounts.length > 0) {
31
+ job = mergeRunIntoJob(job, runAccounts[0]);
32
+ }
33
+ }
34
+ catch (error) {
35
+ deps.logger.error(`Error checking run account for job ${job.address}: ${error}`);
36
+ }
37
+ }
38
+ return { type: MonitorEventType.JOB, data: job };
39
+ }
40
+ /**
41
+ * Handle MarketAccount updates
42
+ */
43
+ function handleMarketAccount(encodedAccount, monitorDeps) {
44
+ const { client, transformMarketAccount } = monitorDeps;
45
+ const marketAccount = client.decodeMarketAccount(encodedAccount);
46
+ const market = transformMarketAccount(marketAccount);
47
+ return { type: MonitorEventType.MARKET, data: market };
48
+ }
49
+ /**
50
+ * Handle RunAccount updates
51
+ */
52
+ async function handleRunAccount(encodedAccount, autoMerge, get, monitorDeps) {
53
+ const { client, transformRunAccount, mergeRunIntoJob, deps } = monitorDeps;
54
+ const runAccount = client.decodeRunAccount(encodedAccount);
55
+ const run = transformRunAccount(runAccount);
56
+ if (autoMerge) {
57
+ // For auto-merge, fetch the job and merge run data, then yield as job event
58
+ try {
59
+ const job = await get(run.job, false);
60
+ const mergedJob = mergeRunIntoJob(job, run);
61
+ return { type: MonitorEventType.JOB, data: mergedJob };
62
+ }
63
+ catch (error) {
64
+ deps.logger.error(`Error fetching job ${run.job} for run account ${runAccount.address}: ${error}`);
65
+ // Skip this event if we can't fetch the job
66
+ return null;
67
+ }
68
+ }
69
+ else {
70
+ // For detailed monitoring, yield run event as-is
71
+ return { type: MonitorEventType.RUN, data: run };
72
+ }
73
+ }
74
+ /**
75
+ * Create an async generator that yields monitor events from subscription notifications
76
+ */
77
+ async function* createEventStream(subscriptionIterable, isMonitoring, autoMerge, get, runs, monitorDeps) {
78
+ const { deps, client } = monitorDeps;
79
+ try {
80
+ for await (const notification of subscriptionIterable) {
81
+ // Check if monitoring should continue
82
+ if (!isMonitoring()) {
83
+ deps.logger.info('Monitoring stopped, exiting subscription processing');
84
+ break;
85
+ }
86
+ try {
87
+ const { value } = notification;
88
+ const { account, pubkey } = value;
89
+ const encodedAccount = parseBase64RpcAccount(pubkey, account);
90
+ const accountType = client.identifyNosanaJobsAccount(encodedAccount);
91
+ let event = null;
92
+ switch (accountType) {
93
+ case client.NosanaJobsAccount.JobAccount:
94
+ event = await handleJobAccount(encodedAccount, autoMerge, runs, monitorDeps);
95
+ break;
96
+ case client.NosanaJobsAccount.MarketAccount:
97
+ event = handleMarketAccount(encodedAccount, monitorDeps);
98
+ break;
99
+ case client.NosanaJobsAccount.RunAccount:
100
+ event = await handleRunAccount(encodedAccount, autoMerge, get, monitorDeps);
101
+ break;
102
+ default:
103
+ deps.logger.error(`No support yet for account type: ${accountType}`);
104
+ break;
105
+ }
106
+ if (event) {
107
+ yield event;
108
+ }
109
+ }
110
+ catch (error) {
111
+ deps.logger.error(`Error handling account update notification: ${error}`);
112
+ // Continue processing other events
113
+ }
114
+ }
115
+ }
116
+ catch (error) {
117
+ deps.logger.error(`Subscription error: ${error}`);
118
+ // Throw the error so the calling function can restart the subscription
119
+ throw error;
120
+ }
121
+ }
122
+ async function createMonitorStream(get, runs, autoMerge, monitorDeps) {
123
+ const { deps, config } = monitorDeps;
124
+ const programId = config.jobsAddress;
125
+ let abortController = null;
126
+ let isMonitoring = true;
127
+ // Function to stop all monitoring
128
+ const stopMonitoring = () => {
129
+ isMonitoring = false;
130
+ if (abortController) {
131
+ abortController.abort();
132
+ }
133
+ deps.logger.info(`Stopped monitoring job program account updates`);
134
+ };
135
+ // Create async generator that handles reconnection
136
+ const eventStream = (async function* () {
137
+ while (isMonitoring) {
138
+ try {
139
+ deps.logger.info('Attempting to establish WebSocket subscription...');
140
+ abortController = new AbortController();
141
+ const subscriptionIterable = await setupSubscription(deps, programId, abortController);
142
+ deps.logger.info('Successfully established WebSocket subscription');
143
+ // Yield events from the subscription
144
+ yield* createEventStream(subscriptionIterable, () => isMonitoring, autoMerge, get, runs, monitorDeps);
145
+ }
146
+ catch (error) {
147
+ if (!isMonitoring) {
148
+ // Monitoring was stopped, exit gracefully
149
+ return;
150
+ }
151
+ deps.logger.warn(`WebSocket subscription failed: ${error}`);
152
+ // Clean up current subscription
153
+ if (abortController) {
154
+ abortController.abort();
155
+ abortController = null;
156
+ }
157
+ if (isMonitoring) {
158
+ deps.logger.info('Retrying WebSocket subscription in 5 seconds...');
159
+ await new Promise((resolve) => setTimeout(resolve, 5000));
160
+ }
161
+ }
162
+ }
163
+ })();
164
+ deps.logger.info(`Successfully started monitoring job program account updates`);
165
+ return [eventStream, stopMonitoring];
166
+ }
167
+ /**
168
+ * Factory function to create monitor functions
169
+ */
170
+ export function createMonitorFunctions(get, runs, monitorDeps) {
171
+ return {
172
+ async monitor() {
173
+ return createMonitorStream(get, runs, true, monitorDeps);
174
+ },
175
+ async monitorDetailed() {
176
+ return createMonitorStream(get, runs, false, monitorDeps);
177
+ },
178
+ };
179
+ }
180
+ //# sourceMappingURL=monitor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monitor.js","sourceRoot":"","sources":["../../../../../src/services/programs/jobs/monitor/monitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAapD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAA8C,MAAM,YAAY,CAAC;AAY1F;;GAEG;AACH,KAAK,UAAU,iBAAiB,CAC9B,IAAiB,EACjB,SAAkB,EAClB,eAAgC;IAMhC,IAAI,C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AAO;YACX,OAAO,mBAAmB,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;QAC3D,CAAC;QACD,KAAK,CAAC,eAAe;YACnB,OAAO,mBAAmB,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;QAC5D,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { Job, Market, Run } from '../JobsProgram.js';
2
+ /**
3
+ * Monitor event type constants
4
+ */
5
+ export declare const MonitorEventType: {
6
+ readonly JOB: "job";
7
+ readonly MARKET: "market";
8
+ readonly RUN: "run";
9
+ };
10
+ export type MonitorEventType = (typeof MonitorEventType)[keyof typeof MonitorEventType];
11
+ /**
12
+ * Simple monitor event (run accounts are auto-merged into job events)
13
+ */
14
+ export type SimpleMonitorEvent = {
15
+ type: typeof MonitorEventType.JOB;
16
+ data: Job;
17
+ } | {
18
+ type: typeof MonitorEventType.MARKET;
19
+ data: Market;
20
+ };
21
+ /**
22
+ * Event types for monitoring (extends SimpleMonitorEvent with run events)
23
+ */
24
+ export type MonitorEvent = SimpleMonitorEvent | {
25
+ type: typeof MonitorEventType.RUN;
26
+ data: Run;
27
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Monitor event type constants
3
+ */
4
+ export const MonitorEventType = {
5
+ JOB: 'job',
6
+ MARKET: 'market',
7
+ RUN: 'run',
8
+ };
9
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/services/programs/jobs/monitor/types.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;CACF,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { Address, ReadonlyUint8Array, TransactionSigner } from '@solana/kit';
2
- import type { ProgramDeps } from '../../types.js';
3
- import * as programClient from '../../generated_clients/merkle_distributor/index.js';
4
- import { ConvertTypesForDb } from '../../utils/index.js';
2
+ import type { ProgramDeps } from '../../../types.js';
3
+ import * as programClient from '../../../generated_clients/merkle_distributor/index.js';
4
+ import { ConvertTypesForDb } from '../../../utils/index.js';
5
5
  /**
6
6
  * Claim target enum for merkle distributor.
7
7
  * Determines which address receives the claimed tokens.
@@ -97,5 +97,5 @@ export interface MerkleDistributorProgram {
97
97
  * const distributor = await merkleDistributor.get('distributor-address');
98
98
  * ```
99
99
  */
100
- import type { ProgramConfig } from '../../config/types.js';
100
+ import type { ProgramConfig } from '../../../config/types.js';
101
101
  export declare function createMerkleDistributorProgram(deps: ProgramDeps, config: ProgramConfig): MerkleDistributorProgram;
@@ -1,7 +1,7 @@
1
1
  import { parseBase64RpcAccount, address, } from '@solana/kit';
2
- import { NosanaError, ErrorCodes } from '../../errors/NosanaError.js';
3
- import * as programClient from '../../generated_clients/merkle_distributor/index.js';
4
- import { convertBigIntToNumber } from '../../utils/index.js';
2
+ import { NosanaError, ErrorCodes } from '../../../errors/NosanaError.js';
3
+ import * as programClient from '../../../generated_clients/merkle_distributor/index.js';
4
+ import { convertBigIntToNumber } from '../../../utils/index.js';
5
5
  import { findAssociatedTokenPda, TOKEN_PROGRAM_ADDRESS } from '@solana-program/token';
6
6
  import { SYSTEM_PROGRAM_ADDRESS } from '@solana-program/system';
7
7
  import bs58 from 'bs58';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MerkleDistributorProgram.js","sourceRoot":"","sources":["../../../../src/services/programs/merkleDistributor/MerkleDistributorProgram.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,qBAAqB,EAGrB,OAAO,GAER,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAEzE,OAAO,KAAK,aAAa,MAAM,wDAAwD,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAqB,MAAM,y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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/programs/merkleDistributor/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { Address } from '@solana/kit';
2
- import type { ProgramDeps } from '../../types.js';
3
- import * as programClient from '../../generated_clients/staking/index.js';
4
- import { ConvertTypesForDb } from '../../utils/index.js';
2
+ import type { ProgramDeps } from '../../../types.js';
3
+ import * as programClient from '../../../generated_clients/staking/index.js';
4
+ import { ConvertTypesForDb } from '../../../utils/index.js';
5
5
  export type Stake = ConvertTypesForDb<programClient.StakeAccountArgs> & {
6
6
  address: Address;
7
7
  };
@@ -42,5 +42,5 @@ export interface StakeProgram {
42
42
  * const stake = await stakeProgram.get('stake-address');
43
43
  * ```
44
44
  */
45
- import type { ProgramConfig } from '../../config/types.js';
45
+ import type { ProgramConfig } from '../../../config/types.js';
46
46
  export declare function createStakeProgram(deps: ProgramDeps, config: ProgramConfig): StakeProgram;
@@ -1,6 +1,6 @@
1
1
  import { parseBase64RpcAccount } from '@solana/kit';
2
- import * as programClient from '../../generated_clients/staking/index.js';
3
- import { convertBigIntToNumber } from '../../utils/index.js';
2
+ import * as programClient from '../../../generated_clients/staking/index.js';
3
+ import { convertBigIntToNumber } from '../../../utils/index.js';
4
4
  import bs58 from 'bs58';
5
5
  export function createStakeProgram(deps, config) {
6
6
  const programId = config.stakeAddress;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StakeProgram.js","sourceRoot":"","sources":["../../../../src/services/programs/stake/StakeProgram.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,qBAAqB,EAAsB,MAAM,aAAa,CAAC;AAE1F,OAAO,KAAK,aAAa,MAAM,6CAA6C,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAqB,MAAM,yBAAyB,CAAC;AACnF,OAAO,IAAI,MAAM,MAAM,CAAC;AA8CxB,MAAM,UAAU,kBAAkB,CAAC,IAAiB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@@ -0,0 +1 @@
1
+ export * from './StakeProgram.js';
@@ -0,0 +1,2 @@
1
+ export * from './StakeProgram.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/programs/stake/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,150 @@
1
+ import { createSolanaRpc, createSolanaRpcSubscriptions, Address, Signature, Instruction, TransactionMessageWithBlockhashLifetime, sendAndConfirmTransactionFactory, TransactionMessageWithFeePayer, TransactionMessageWithLifetime, TransactionMessage, SendableTransaction, Transaction, BaseTransactionMessage, TransactionSigner, TransactionWithBlockhashLifetime, TransactionPartialSigner } from '@solana/kit';
2
+ import { estimateComputeUnitLimitFactory } from '@solana-program/compute-budget';
3
+ import { getCreateAssociatedTokenIdempotentInstructionAsync } from '@solana-program/token';
4
+ import { getTransferSolInstruction } from '@solana-program/system';
5
+ import { Logger } from '../../logger/Logger.js';
6
+ import { Wallet } from '../../types.js';
7
+ import { SolanaConfig } from '../../config/types.js';
8
+ /**
9
+ * Factory function to create an estimateAndSetComputeUnitLimit function
10
+ * that estimates compute units and adds the set compute unit limit instruction
11
+ */
12
+ declare function estimateAndSetComputeUnitLimitFactory(...params: Parameters<typeof estimateComputeUnitLimitFactory>): <T extends BaseTransactionMessage & TransactionMessageWithFeePayer>(transactionMessage: T) => Promise<Omit<import("@solana/transaction-messages").ExcludeTransactionMessageWithinSizeLimit<T>, "instructions"> & {
13
+ readonly instructions: readonly [...T["instructions"], import("@solana-program/compute-budget").SetComputeUnitLimitInstruction<Address, []>];
14
+ }>;
15
+ /**
16
+ * Dependencies for SolanaService
17
+ */
18
+ export interface SolanaServiceDeps {
19
+ logger: Logger;
20
+ getWallet: () => Wallet | undefined;
21
+ }
22
+ /**
23
+ * Solana service interface
24
+ */
25
+ export interface SolanaService {
26
+ readonly config: SolanaConfig;
27
+ readonly rpc: ReturnType<typeof createSolanaRpc>;
28
+ readonly rpcSubscriptions: ReturnType<typeof createSolanaRpcSubscriptions>;
29
+ readonly sendAndConfirmTransaction: ReturnType<typeof sendAndConfirmTransactionFactory>;
30
+ readonly estimateAndSetComputeUnitLimit: ReturnType<typeof estimateAndSetComputeUnitLimitFactory>;
31
+ /**
32
+ * Optional fee payer for transactions. If set, will be used as fallback when no feePayer is provided in options.
33
+ * Set this property directly to configure the fee payer.
34
+ */
35
+ feePayer: TransactionSigner | undefined;
36
+ pda(seeds: Array<Address | string>, programId: Address): Promise<Address>;
37
+ /**
38
+ * Get the SOL balance for a specific address.
39
+ *
40
+ * @param addressStr - Optional address to query. If not provided, uses the wallet address.
41
+ * @returns The SOL balance in lamports as a number
42
+ * @throws {NosanaError} If neither address nor wallet is provided
43
+ */
44
+ getBalance(addressStr?: string | Address): Promise<number>;
45
+ /**
46
+ * Build a transaction message from instructions.
47
+ * This function creates a transaction message with fee payer, blockhash, and instructions.
48
+ *
49
+ * @param instructions Single instruction or array of instructions
50
+ * @param options Optional configuration
51
+ * @param options.feePayer Optional custom fee payer. Can be a TransactionSigner (for full signing)
52
+ * or an Address/string (for partial signing where feepayer signs later).
53
+ * Takes precedence over service feePayer and wallet.
54
+ * @param options.estimateComputeUnits If true, estimates and sets the compute unit limit. Default: false.
55
+ * @returns An unsigned transaction message ready to be signed
56
+ */
57
+ buildTransaction(instructions: Instruction | Instruction[], options?: {
58
+ feePayer?: TransactionSigner | Address | string;
59
+ estimateComputeUnits?: boolean;
60
+ }): Promise<TransactionMessage & TransactionMessageWithFeePayer & TransactionMessageWithBlockhashLifetime>;
61
+ signTransaction(transactionMessage: TransactionMessage & TransactionMessageWithFeePayer & TransactionMessageWithBlockhashLifetime): Promise<SendableTransaction & Transaction & TransactionWithBlockhashLifetime>;
62
+ sendTransaction(transaction: SendableTransaction & Transaction & TransactionWithBlockhashLifetime, options?: {
63
+ commitment?: 'processed' | 'confirmed' | 'finalized';
64
+ }): Promise<Signature>;
65
+ buildSignAndSend(instructions: Instruction | Instruction[], options?: {
66
+ feePayer?: TransactionSigner;
67
+ commitment?: 'processed' | 'confirmed' | 'finalized';
68
+ estimateComputeUnits?: boolean;
69
+ }): Promise<Signature>;
70
+ /**
71
+ * Partially sign a transaction message with the signers embedded in the transaction.
72
+ * The transaction message must already have a fee payer address set (via buildTransaction with an address).
73
+ * Signers are extracted from instructions in the message (e.g., transfer source signer).
74
+ * Use this when building transactions where the fee payer will sign later.
75
+ *
76
+ * @param transactionMessage The transaction message to sign (must have fee payer address set and signers embedded in instructions)
77
+ * @returns A partially signed transaction
78
+ */
79
+ partiallySignTransaction(transactionMessage: TransactionMessage & TransactionMessageWithFeePayer & TransactionMessageWithBlockhashLifetime): Promise<Transaction & TransactionWithBlockhashLifetime>;
80
+ /**
81
+ * Serialize a transaction to a base64 string.
82
+ * Works with both partially signed and fully signed transactions.
83
+ * Use this to transmit transactions to other parties (e.g., for fee payer signing).
84
+ *
85
+ * @param transaction The transaction to serialize
86
+ * @returns Base64 encoded wire transaction string
87
+ */
88
+ serializeTransaction(transaction: Transaction): string;
89
+ /**
90
+ * Deserialize a base64 string back to a transaction.
91
+ * Use this to receive transactions from other parties.
92
+ *
93
+ * @param base64 The base64 encoded transaction string
94
+ * @returns The deserialized transaction
95
+ */
96
+ deserializeTransaction(base64: string): Transaction & TransactionWithBlockhashLifetime;
97
+ /**
98
+ * Sign a transaction with the provided signers.
99
+ * Use this when receiving a partially signed transaction that needs additional signatures.
100
+ * This adds signatures from the provided signers to the transaction.
101
+ *
102
+ * @param transaction The transaction to sign (typically partially signed, received from another party)
103
+ * @param signers Array of TransactionPartialSigners to sign with
104
+ * @returns The signed transaction with additional signatures
105
+ */
106
+ signTransactionWithSigners(transaction: Transaction & TransactionWithBlockhashLifetime, signers: TransactionPartialSigner[]): Promise<SendableTransaction & Transaction & TransactionWithBlockhashLifetime>;
107
+ /**
108
+ * Decompile a transaction back to a transaction message.
109
+ * Use this to inspect/verify the content of a deserialized transaction before signing.
110
+ *
111
+ * Note: Decompilation is lossy - some information like lastValidBlockHeight may not be fully
112
+ * reconstructed. The returned message is suitable for inspection but may not be suitable
113
+ * for re-signing without additional context.
114
+ *
115
+ * @param transaction The compiled transaction to decompile
116
+ * @returns The decompiled transaction message (with either blockhash or durable nonce lifetime)
117
+ */
118
+ decompileTransaction(transaction: Transaction & TransactionWithBlockhashLifetime): BaseTransactionMessage & TransactionMessageWithFeePayer & TransactionMessageWithLifetime;
119
+ /**
120
+ * Get an instruction to transfer SOL from one address to another.
121
+ *
122
+ * @param params Transfer parameters
123
+ * @param params.to Recipient address
124
+ * @param params.amount Amount in lamports (number or bigint)
125
+ * @param params.from Optional sender TransactionSigner. If not provided, uses wallet from client.
126
+ * @returns An instruction to transfer SOL
127
+ */
128
+ transfer(params: {
129
+ to: Address | string;
130
+ amount: number | bigint;
131
+ from?: TransactionSigner;
132
+ }): Promise<ReturnType<typeof getTransferSolInstruction>>;
133
+ /**
134
+ * Get an instruction to create an associated token account if it doesn't exist.
135
+ * Checks if the ATA exists, and if not, returns an instruction to create it.
136
+ * Uses the idempotent version so it's safe to call even if the account already exists.
137
+ *
138
+ * @param ata The associated token account address
139
+ * @param mint The token mint address
140
+ * @param owner The owner of the associated token account
141
+ * @param payer Optional payer for the account creation. If not provided, uses the wallet or service feePayer.
142
+ * @returns An instruction to create the ATA if it doesn't exist, or null if it already exists
143
+ */
144
+ getCreateATAInstructionIfNeeded(ata: Address, mint: Address, owner: Address, payer?: TransactionSigner): Promise<Awaited<ReturnType<typeof getCreateAssociatedTokenIdempotentInstructionAsync>> | null>;
145
+ }
146
+ /**
147
+ * Creates a Solana service instance.
148
+ */
149
+ export declare function createSolanaService(deps: SolanaServiceDeps, config: SolanaConfig): SolanaService;
150
+ export {};