@prb/effect-solana 1.0.0-beta.1 → 1.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +156 -177
- package/dist/core/errors/predicates.d.ts +0 -11
- package/dist/core/errors/predicates.d.ts.map +1 -1
- package/dist/core/errors/predicates.js +0 -5
- package/dist/core/errors/predicates.js.map +1 -1
- package/dist/core/errors/transaction.d.ts +20 -1
- package/dist/core/errors/transaction.d.ts.map +1 -1
- package/dist/core/errors/transaction.js +60 -1
- package/dist/core/errors/transaction.js.map +1 -1
- package/dist/core/errors/wallet.d.ts +0 -7
- package/dist/core/errors/wallet.d.ts.map +1 -1
- package/dist/core/errors/wallet.js +0 -4
- package/dist/core/errors/wallet.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/pda/index.d.ts +1 -0
- package/dist/pda/index.d.ts.map +1 -1
- package/dist/pda/index.js +1 -0
- package/dist/pda/index.js.map +1 -1
- package/dist/pda/service.d.ts +4 -3
- package/dist/pda/service.d.ts.map +1 -1
- package/dist/pda/service.js +12 -4
- package/dist/pda/service.js.map +1 -1
- package/dist/pda/types.d.ts +12 -0
- package/dist/pda/types.d.ts.map +1 -0
- package/dist/pda/types.js +8 -0
- package/dist/pda/types.js.map +1 -0
- package/dist/presets/layers.d.ts +3 -2
- package/dist/presets/layers.d.ts.map +1 -1
- package/dist/presets/layers.js +2 -1
- package/dist/presets/layers.js.map +1 -1
- package/dist/program/index.d.ts +3 -0
- package/dist/program/index.d.ts.map +1 -0
- package/dist/program/index.js +3 -0
- package/dist/program/index.js.map +1 -0
- package/dist/program/service.d.ts +19 -0
- package/dist/program/service.d.ts.map +1 -0
- package/dist/program/service.js +95 -0
- package/dist/program/service.js.map +1 -0
- package/dist/program/types.d.ts +34 -0
- package/dist/program/types.d.ts.map +1 -0
- package/dist/program/types.js +32 -0
- package/dist/program/types.js.map +1 -0
- package/dist/rpc/service.d.ts.map +1 -1
- package/dist/rpc/service.js +6 -11
- package/dist/rpc/service.js.map +1 -1
- package/dist/telemetry/tracer.d.ts +3 -0
- package/dist/telemetry/tracer.d.ts.map +1 -1
- package/dist/telemetry/tracer.js +3 -0
- package/dist/telemetry/tracer.js.map +1 -1
- package/dist/token/service.d.ts +2 -2
- package/dist/token/service.d.ts.map +1 -1
- package/dist/token/service.js +30 -17
- package/dist/token/service.js.map +1 -1
- package/dist/tx/service.d.ts +4 -2
- package/dist/tx/service.d.ts.map +1 -1
- package/dist/tx/service.js +12 -2
- package/dist/tx/service.js.map +1 -1
- package/dist/web3.js/layers.d.ts +2 -1
- package/dist/web3.js/layers.d.ts.map +1 -1
- package/dist/web3.js/layers.js.map +1 -1
- package/dist/web3.js/legacy-signer.d.ts.map +1 -1
- package/dist/web3.js/legacy-signer.js +14 -2
- package/dist/web3.js/legacy-signer.js.map +1 -1
- package/dist/web3.js/transaction-bridge.d.ts.map +1 -1
- package/dist/web3.js/transaction-bridge.js +4 -2
- package/dist/web3.js/transaction-bridge.js.map +1 -1
- package/package.json +14 -1
package/README.md
CHANGED
|
@@ -1,45 +1,60 @@
|
|
|
1
1
|
# @prb/effect-solana
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@prb/effect-solana)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
Effect-TS integration for the Solana blockchain ecosystem. Type-safe, composable abstractions built on
|
|
7
|
+
[@solana/kit](https://github.com/solana-labs/solana-web3.js) v2.
|
|
8
|
+
|
|
9
|
+
## 📦 Installation
|
|
6
10
|
|
|
7
11
|
```bash
|
|
8
|
-
npm install @prb/effect-solana effect
|
|
12
|
+
npm install @prb/effect-solana effect
|
|
9
13
|
# or
|
|
10
|
-
pnpm add @prb/effect-solana effect
|
|
14
|
+
pnpm add @prb/effect-solana effect
|
|
11
15
|
# or
|
|
12
|
-
bun add @prb/effect-solana effect
|
|
16
|
+
bun add @prb/effect-solana effect
|
|
13
17
|
```
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
### Peer Dependencies
|
|
20
|
+
|
|
21
|
+
Required:
|
|
22
|
+
|
|
23
|
+
- `effect` ^3.x
|
|
24
|
+
- `@solana-program/system` ^0.8.0
|
|
25
|
+
- `@solana-program/token` ^0.8.0
|
|
26
|
+
- `@solana-program/compute-budget` ^0.8.0
|
|
27
|
+
|
|
28
|
+
Optional:
|
|
29
|
+
|
|
30
|
+
- `@coral-xyz/anchor` ^0.31.1 (for Anchor IDL support)
|
|
31
|
+
- `@solana/web3.js` ^1.95.0 (for legacy interop)
|
|
32
|
+
- `react`, `react-dom` (for React hooks)
|
|
33
|
+
|
|
34
|
+
## 🚀 Quick Start
|
|
16
35
|
|
|
17
36
|
```typescript
|
|
18
37
|
import { Effect, Layer } from "effect";
|
|
19
|
-
import { BalanceService,
|
|
38
|
+
import { BalanceService, makeSolanaLayer } from "@prb/effect-solana";
|
|
20
39
|
import type { Address } from "@solana/kit";
|
|
21
40
|
|
|
22
|
-
// Create a
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// Compose with BalanceService
|
|
29
|
-
const MainLayer = BalanceServiceLive.pipe(Layer.provide(MyRpcLayer));
|
|
41
|
+
// Create a complete Solana layer
|
|
42
|
+
const SolanaLayer = makeSolanaLayer(
|
|
43
|
+
{ cluster: "devnet" },
|
|
44
|
+
() => walletAdapter, // your wallet adapter
|
|
45
|
+
);
|
|
30
46
|
|
|
31
47
|
// Read SOL balance
|
|
32
48
|
const program = Effect.gen(function* () {
|
|
33
49
|
const balance = yield* BalanceService;
|
|
34
50
|
const address = "YOUR_ADDRESS" as Address;
|
|
35
|
-
|
|
36
|
-
console.log(`Balance: ${sol} lamports`);
|
|
51
|
+
return yield* balance.getSolBalance(address);
|
|
37
52
|
});
|
|
38
53
|
|
|
39
|
-
Effect.runPromise(Effect.provide(program,
|
|
54
|
+
Effect.runPromise(Effect.provide(program, SolanaLayer));
|
|
40
55
|
```
|
|
41
56
|
|
|
42
|
-
## Services
|
|
57
|
+
## 🔧 Services
|
|
43
58
|
|
|
44
59
|
### RpcService
|
|
45
60
|
|
|
@@ -98,10 +113,10 @@ const program = Effect.gen(function* () {
|
|
|
98
113
|
|
|
99
114
|
### TokenService
|
|
100
115
|
|
|
101
|
-
SPL token operations.
|
|
116
|
+
SPL token operations (supports both Token and Token-2022 programs).
|
|
102
117
|
|
|
103
118
|
```typescript
|
|
104
|
-
import { TokenService } from "@prb/effect-solana";
|
|
119
|
+
import { TokenService, TOKEN_2022_PROGRAM_ADDRESS } from "@prb/effect-solana";
|
|
105
120
|
|
|
106
121
|
const program = Effect.gen(function* () {
|
|
107
122
|
const token = yield* TokenService;
|
|
@@ -109,7 +124,7 @@ const program = Effect.gen(function* () {
|
|
|
109
124
|
// Get associated token address
|
|
110
125
|
const ata = yield* token.getAssociatedTokenAddress({ owner, mint });
|
|
111
126
|
|
|
112
|
-
// Token-2022
|
|
127
|
+
// Token-2022 support
|
|
113
128
|
const ata2022 = yield* token.getAssociatedTokenAddress({
|
|
114
129
|
owner,
|
|
115
130
|
mint,
|
|
@@ -117,17 +132,15 @@ const program = Effect.gen(function* () {
|
|
|
117
132
|
});
|
|
118
133
|
|
|
119
134
|
// Get or create ATA
|
|
120
|
-
const { address, instruction } = yield* token.getOrCreateATA({
|
|
135
|
+
const { address, instruction } = yield* token.getOrCreateATA({
|
|
136
|
+
owner,
|
|
137
|
+
mint,
|
|
138
|
+
payer,
|
|
139
|
+
});
|
|
121
140
|
|
|
122
141
|
// Get token balance
|
|
123
142
|
const balance = yield* token.getTokenBalance(ata);
|
|
124
143
|
|
|
125
|
-
// Get mint account
|
|
126
|
-
const mint = yield* token.getMint(params.mint);
|
|
127
|
-
|
|
128
|
-
// Get token account
|
|
129
|
-
const account = yield* token.getTokenAccount(ata);
|
|
130
|
-
|
|
131
144
|
// Build transfer instruction
|
|
132
145
|
const transfer = yield* token.getTransferInstruction({
|
|
133
146
|
source: ata,
|
|
@@ -135,17 +148,6 @@ const program = Effect.gen(function* () {
|
|
|
135
148
|
authority: owner,
|
|
136
149
|
amount: 1_000_000n,
|
|
137
150
|
});
|
|
138
|
-
|
|
139
|
-
const transfer2022 = yield* token.getTransferInstruction({
|
|
140
|
-
source: ata2022,
|
|
141
|
-
destination: recipientAta2022,
|
|
142
|
-
authority: owner,
|
|
143
|
-
amount: 1_000_000n,
|
|
144
|
-
tokenProgram: TOKEN_2022_PROGRAM_ADDRESS,
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
// Check if token account exists
|
|
148
|
-
const exists = yield* token.tokenAccountExists(ata);
|
|
149
151
|
});
|
|
150
152
|
```
|
|
151
153
|
|
|
@@ -159,36 +161,52 @@ import { TransactionService } from "@prb/effect-solana";
|
|
|
159
161
|
const program = Effect.gen(function* () {
|
|
160
162
|
const tx = yield* TransactionService;
|
|
161
163
|
|
|
162
|
-
// Build transaction
|
|
164
|
+
// Build transaction with compute budget
|
|
163
165
|
const message = yield* tx.build(instructions, {
|
|
164
166
|
computeBudget: { unitLimit: 600_000, microLamports: 10_000 },
|
|
165
167
|
});
|
|
166
168
|
|
|
167
|
-
// Sign
|
|
169
|
+
// Sign, send, and confirm
|
|
168
170
|
const signed = yield* tx.sign(message);
|
|
169
|
-
|
|
170
|
-
// Send transaction
|
|
171
171
|
const signature = yield* tx.send(signed);
|
|
172
|
-
|
|
173
|
-
// Confirm transaction
|
|
174
172
|
const receipt = yield* tx.confirm(signature, {
|
|
175
173
|
commitment: "confirmed",
|
|
176
174
|
timeout: 60_000,
|
|
177
175
|
});
|
|
178
176
|
|
|
179
|
-
// Or
|
|
177
|
+
// Or all at once
|
|
180
178
|
const receipt2 = yield* tx.sendAndConfirm(instructions, {
|
|
181
179
|
commitment: "confirmed",
|
|
182
180
|
});
|
|
183
181
|
|
|
184
|
-
// Batch
|
|
185
|
-
const receipts = yield* tx.sendAndConfirmBatch(
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
);
|
|
182
|
+
// Batch transactions
|
|
183
|
+
const receipts = yield* tx.sendAndConfirmBatch([{ instructions }, { instructions: [instruction2] }], {
|
|
184
|
+
concurrency: 2,
|
|
185
|
+
confirm: { commitment: "confirmed" },
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### ProgramWriter
|
|
189
191
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
+
Build instructions from Anchor IDLs.
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
import { ProgramWriter } from "@prb/effect-solana";
|
|
196
|
+
import type { Idl } from "@prb/effect-solana";
|
|
197
|
+
|
|
198
|
+
const program = Effect.gen(function* () {
|
|
199
|
+
const writer = yield* ProgramWriter;
|
|
200
|
+
|
|
201
|
+
const instruction = yield* writer.build(
|
|
202
|
+
idl,
|
|
203
|
+
{
|
|
204
|
+
method: "withdraw",
|
|
205
|
+
args: [amount],
|
|
206
|
+
accounts: { signer, streamRecipient /* ... */ },
|
|
207
|
+
},
|
|
208
|
+
programId,
|
|
209
|
+
);
|
|
192
210
|
});
|
|
193
211
|
```
|
|
194
212
|
|
|
@@ -205,18 +223,32 @@ const program = Effect.gen(function* () {
|
|
|
205
223
|
});
|
|
206
224
|
```
|
|
207
225
|
|
|
208
|
-
## Layer Composition
|
|
226
|
+
## 🧩 Layer Composition
|
|
209
227
|
|
|
210
|
-
|
|
228
|
+
### Using Presets
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
import { makeSolanaLayer, makeRpcLayer, makeSignerLayer } from "@prb/effect-solana";
|
|
232
|
+
|
|
233
|
+
// Complete layer with all services
|
|
234
|
+
const AppLayer = makeSolanaLayer({ cluster: "devnet" }, () => walletAdapter);
|
|
235
|
+
|
|
236
|
+
// Or compose manually
|
|
237
|
+
const rpcLayer = makeRpcLayer({ cluster: "devnet", rpcUrl: "https://my-rpc.com" });
|
|
238
|
+
const signerLayer = makeSignerLayer(() => walletAdapter);
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Manual Composition
|
|
211
242
|
|
|
212
243
|
```typescript
|
|
213
244
|
import { Layer } from "effect";
|
|
214
245
|
import {
|
|
215
246
|
BalanceServiceLive,
|
|
216
|
-
|
|
217
|
-
|
|
247
|
+
RpcService,
|
|
248
|
+
SignerService,
|
|
218
249
|
TokenServiceLive,
|
|
219
250
|
TransactionServiceLive,
|
|
251
|
+
ProgramWriterLive,
|
|
220
252
|
} from "@prb/effect-solana";
|
|
221
253
|
|
|
222
254
|
// Create custom implementations
|
|
@@ -231,107 +263,20 @@ const MySignerLayer = Layer.succeed(SignerService, {
|
|
|
231
263
|
});
|
|
232
264
|
|
|
233
265
|
// Compose layers
|
|
234
|
-
const AppLayer = Layer.mergeAll(BalanceServiceLive, TokenServiceLive, TransactionServiceLive).pipe(
|
|
266
|
+
const AppLayer = Layer.mergeAll(BalanceServiceLive, TokenServiceLive, TransactionServiceLive, ProgramWriterLive).pipe(
|
|
235
267
|
Layer.provide(Layer.merge(MyRpcLayer, MySignerLayer)),
|
|
236
268
|
);
|
|
237
269
|
```
|
|
238
270
|
|
|
239
|
-
##
|
|
240
|
-
|
|
241
|
-
The library exports common Solana constants:
|
|
242
|
-
|
|
243
|
-
```typescript
|
|
244
|
-
import {
|
|
245
|
-
LAMPORTS_PER_SOL,
|
|
246
|
-
ClusterEndpoints,
|
|
247
|
-
SYSTEM_PROGRAM_ADDRESS,
|
|
248
|
-
TOKEN_PROGRAM_ADDRESS,
|
|
249
|
-
TOKEN_2022_PROGRAM_ADDRESS,
|
|
250
|
-
ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
|
|
251
|
-
COMPUTE_BUDGET_PROGRAM_ADDRESS,
|
|
252
|
-
MEMO_PROGRAM_ADDRESS,
|
|
253
|
-
} from "@prb/effect-solana";
|
|
254
|
-
|
|
255
|
-
// Use cluster endpoints
|
|
256
|
-
const devnetUrl = ClusterEndpoints.devnet;
|
|
257
|
-
const mainnetUrl = ClusterEndpoints["mainnet-beta"];
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
## Types
|
|
261
|
-
|
|
262
|
-
Re-exported Solana types and custom definitions:
|
|
263
|
-
|
|
264
|
-
```typescript
|
|
265
|
-
import type {
|
|
266
|
-
Address,
|
|
267
|
-
Commitment,
|
|
268
|
-
Lamports,
|
|
269
|
-
Signature,
|
|
270
|
-
TransactionError,
|
|
271
|
-
Cluster,
|
|
272
|
-
ClusterConfig,
|
|
273
|
-
Microlamports,
|
|
274
|
-
} from "@prb/effect-solana";
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
## Error Handling
|
|
278
|
-
|
|
279
|
-
All errors are tagged for discriminated union handling:
|
|
280
|
-
|
|
281
|
-
```typescript
|
|
282
|
-
import { Effect } from "effect";
|
|
283
|
-
import { WalletNotConnectedError, TransactionFailedError, TransactionTimeoutError, RpcError } from "@prb/effect-solana";
|
|
284
|
-
|
|
285
|
-
const handled = program.pipe(
|
|
286
|
-
Effect.catchTag("WalletNotConnectedError", (e) => Effect.succeed("Please connect wallet")),
|
|
287
|
-
Effect.catchTag("TransactionFailedError", (e) => Effect.succeed(`TX failed: ${e.message}`)),
|
|
288
|
-
Effect.catchTag("TransactionTimeoutError", (e) => Effect.succeed(`TX timed out: ${e.signature}`)),
|
|
289
|
-
Effect.catchTag("RpcError", (e) => Effect.succeed(`RPC error at ${e.url}: ${e.message}`)),
|
|
290
|
-
);
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
## Telemetry
|
|
294
|
-
|
|
295
|
-
The library includes built-in OpenTelemetry spans for observability:
|
|
296
|
-
|
|
297
|
-
```typescript
|
|
298
|
-
import { SpanNames } from "@prb/effect-solana";
|
|
299
|
-
|
|
300
|
-
// Balance operations
|
|
301
|
-
SpanNames.BALANCE_GET_SOL;
|
|
302
|
-
SpanNames.BALANCE_WATCH_SOL;
|
|
303
|
-
|
|
304
|
-
// Transaction operations
|
|
305
|
-
SpanNames.TX_BUILD;
|
|
306
|
-
SpanNames.TX_SIGN;
|
|
307
|
-
SpanNames.TX_SEND;
|
|
308
|
-
SpanNames.TX_CONFIRM;
|
|
309
|
-
SpanNames.TX_SEND_AND_CONFIRM;
|
|
310
|
-
SpanNames.TX_SIMULATE;
|
|
311
|
-
|
|
312
|
-
// Token operations
|
|
313
|
-
SpanNames.TOKEN_GET_ATA;
|
|
314
|
-
SpanNames.TOKEN_CREATE_ATA;
|
|
315
|
-
SpanNames.TOKEN_GET_ACCOUNT;
|
|
316
|
-
|
|
317
|
-
// PDA operations
|
|
318
|
-
SpanNames.PDA_DERIVE;
|
|
319
|
-
|
|
320
|
-
// And more...
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
## React Integration
|
|
324
|
-
|
|
325
|
-
The library provides React hooks for integrating Solana operations into React applications:
|
|
271
|
+
## ⚛️ React Integration
|
|
326
272
|
|
|
327
273
|
```typescript
|
|
328
274
|
import { EffectSolanaProvider, useEffectMemo } from "@prb/effect-solana";
|
|
329
275
|
import { BalanceService } from "@prb/effect-solana";
|
|
330
|
-
import type { Address } from "@solana/kit";
|
|
331
276
|
|
|
332
277
|
function App() {
|
|
333
278
|
return (
|
|
334
|
-
<EffectSolanaProvider layer={
|
|
279
|
+
<EffectSolanaProvider layer={AppLayer}>
|
|
335
280
|
<Balance address={yourAddress} />
|
|
336
281
|
</EffectSolanaProvider>
|
|
337
282
|
);
|
|
@@ -344,7 +289,7 @@ function Balance({ address }: { address: Address }) {
|
|
|
344
289
|
const balance = yield* BalanceService;
|
|
345
290
|
return yield* balance.getSolBalance(address);
|
|
346
291
|
}),
|
|
347
|
-
[address]
|
|
292
|
+
[address]
|
|
348
293
|
);
|
|
349
294
|
|
|
350
295
|
if (result.status === "loading") return <div>Loading...</div>;
|
|
@@ -353,54 +298,88 @@ function Balance({ address }: { address: Address }) {
|
|
|
353
298
|
}
|
|
354
299
|
```
|
|
355
300
|
|
|
356
|
-
Available
|
|
301
|
+
### Available Hooks
|
|
357
302
|
|
|
358
303
|
- `useEffectMemo` - Run an Effect with memoization
|
|
359
304
|
- `useEffectOnce` - Run an Effect once on mount
|
|
360
305
|
- `useStream` - Subscribe to an Effect Stream
|
|
361
306
|
- `useForkEffect` - Fork an Effect as a background fiber
|
|
362
|
-
- `EffectSolanaProvider` - Context provider for Effect runtime
|
|
363
307
|
- `useEffectSolanaRuntime` - Access the Effect runtime
|
|
364
308
|
|
|
365
|
-
##
|
|
309
|
+
## 🚨 Error Handling
|
|
366
310
|
|
|
367
|
-
|
|
311
|
+
All errors are tagged for discriminated union handling:
|
|
368
312
|
|
|
369
313
|
```typescript
|
|
370
314
|
import { Effect } from "effect";
|
|
371
|
-
import {
|
|
372
|
-
|
|
315
|
+
import {
|
|
316
|
+
WalletNotConnectedError,
|
|
317
|
+
TransactionFailedError,
|
|
318
|
+
TransactionTimeoutError,
|
|
319
|
+
RpcError,
|
|
320
|
+
catchUserRejection,
|
|
321
|
+
} from "@prb/effect-solana";
|
|
373
322
|
|
|
374
|
-
const
|
|
375
|
-
Effect.
|
|
376
|
-
|
|
323
|
+
const handled = program.pipe(
|
|
324
|
+
Effect.catchTag("WalletNotConnectedError", () => Effect.succeed("Please connect wallet")),
|
|
325
|
+
Effect.catchTag("TransactionFailedError", (e) => Effect.succeed(`TX failed: ${e.message}`)),
|
|
326
|
+
Effect.catchTag("TransactionTimeoutError", (e) => Effect.succeed(`TX timed out: ${e.signature}`)),
|
|
327
|
+
Effect.catchTag("RpcError", (e) => Effect.succeed(`RPC error: ${e.message}`)),
|
|
328
|
+
);
|
|
377
329
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
amount: params.amount,
|
|
382
|
-
});
|
|
330
|
+
// Convenience operator for user rejections
|
|
331
|
+
const result = sendTransaction(tx).pipe(catchUserRejection(null));
|
|
332
|
+
```
|
|
383
333
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
334
|
+
### Error Types
|
|
335
|
+
|
|
336
|
+
| Error | Description |
|
|
337
|
+
| -------------------------- | ---------------------------------- |
|
|
338
|
+
| `RpcError` | RPC communication failure |
|
|
339
|
+
| `WalletNotConnectedError` | Wallet not connected |
|
|
340
|
+
| `SignatureError` | Transaction signing failed |
|
|
341
|
+
| `UserRejectedError` | User rejected the transaction |
|
|
342
|
+
| `TransactionSendError` | Failed to send transaction |
|
|
343
|
+
| `TransactionFailedError` | Transaction execution failed |
|
|
344
|
+
| `TransactionTimeoutError` | Transaction confirmation timed out |
|
|
345
|
+
| `BlockhashExpiredError` | Blockhash expired before confirm |
|
|
346
|
+
| `SimulationFailedError` | Transaction simulation failed |
|
|
347
|
+
| `AccountNotFoundError` | Account does not exist |
|
|
348
|
+
| `InsufficientBalanceError` | Insufficient SOL balance |
|
|
349
|
+
|
|
350
|
+
## 📊 Telemetry
|
|
351
|
+
|
|
352
|
+
Built-in OpenTelemetry spans for observability:
|
|
353
|
+
|
|
354
|
+
```typescript
|
|
355
|
+
import { SpanNames } from "@prb/effect-solana";
|
|
356
|
+
|
|
357
|
+
// Examples: SpanNames.TX_SEND, SpanNames.BALANCE_GET_SOL, SpanNames.TOKEN_GET_ATA
|
|
387
358
|
```
|
|
388
359
|
|
|
389
|
-
|
|
360
|
+
## 📚 Constants
|
|
390
361
|
|
|
391
362
|
```typescript
|
|
392
|
-
import {
|
|
393
|
-
|
|
363
|
+
import {
|
|
364
|
+
LAMPORTS_PER_SOL,
|
|
365
|
+
ClusterEndpoints,
|
|
366
|
+
SYSTEM_PROGRAM_ADDRESS,
|
|
367
|
+
TOKEN_PROGRAM_ADDRESS,
|
|
368
|
+
TOKEN_2022_PROGRAM_ADDRESS,
|
|
369
|
+
ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
|
|
370
|
+
COMPUTE_BUDGET_PROGRAM_ADDRESS,
|
|
371
|
+
MEMO_PROGRAM_ADDRESS,
|
|
372
|
+
} from "@prb/effect-solana";
|
|
373
|
+
```
|
|
394
374
|
|
|
395
|
-
|
|
396
|
-
Effect.gen(function* () {
|
|
397
|
-
const balance = yield* BalanceService;
|
|
398
|
-
const stream = yield* balance.watchBalance({ address });
|
|
375
|
+
## 🔗 Legacy Interop
|
|
399
376
|
|
|
400
|
-
|
|
401
|
-
|
|
377
|
+
Bridge utilities for `@solana/web3.js` v1 compatibility:
|
|
378
|
+
|
|
379
|
+
```typescript
|
|
380
|
+
import { LegacySigner, transactionBridge } from "@prb/effect-solana/web3.js";
|
|
402
381
|
```
|
|
403
382
|
|
|
404
|
-
## License
|
|
383
|
+
## 📄 License
|
|
405
384
|
|
|
406
|
-
MIT
|
|
385
|
+
This project is licensed under the MIT License - see the [LICENSE](../LICENSE) file for details.
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
|
-
import type { UserRejectedError } from "./wallet.js";
|
|
3
1
|
export type TaggedErrorShape = {
|
|
4
2
|
readonly _tag: string;
|
|
5
3
|
readonly message: string;
|
|
@@ -9,13 +7,4 @@ export declare const hasTaggedErrorShape: (error: unknown) => error is TaggedErr
|
|
|
9
7
|
export declare const isTaggedError: <T extends {
|
|
10
8
|
readonly _tag: string;
|
|
11
9
|
}>(tag: T["_tag"]) => (error: unknown) => error is T;
|
|
12
|
-
export declare const isUserRejectedError: (error: unknown) => error is UserRejectedError;
|
|
13
|
-
export declare const catchUserRejection: {
|
|
14
|
-
<A2>(fallback: A2): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A | A2, Exclude<E, UserRejectedError>, R>;
|
|
15
|
-
<A, E, R, A2>(effect: Effect.Effect<A, E, R>, fallback: A2): Effect.Effect<A | A2, Exclude<E, UserRejectedError>, R>;
|
|
16
|
-
};
|
|
17
|
-
export declare const catchUserRejectionWith: {
|
|
18
|
-
<A2, E2, R2>(fallback: Effect.Effect<A2, E2, R2>): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A | A2, Exclude<E, UserRejectedError> | E2, R | R2>;
|
|
19
|
-
<A, E, R, A2, E2, R2>(effect: Effect.Effect<A, E, R>, fallback: Effect.Effect<A2, E2, R2>): Effect.Effect<A | A2, Exclude<E, UserRejectedError> | E2, R | R2>;
|
|
20
|
-
};
|
|
21
10
|
//# sourceMappingURL=predicates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predicates.d.ts","sourceRoot":"","sources":["../../../src/core/errors/predicates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"predicates.d.ts","sourceRoot":"","sources":["../../../src/core/errors/predicates.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAMF,eAAO,MAAM,mBAAmB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,gBACoC,CAAC;AAMnG,eAAO,MAAM,aAAa,GACvB,CAAC,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC,MACnD,OAAO,OAAO,KAAG,KAAK,IAAI,CACuB,CAAC"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
|
-
import { dual } from "effect/Function";
|
|
3
1
|
export const hasTaggedErrorShape = (error) => error !== null && typeof error === "object" && "_tag" in error && typeof error._tag === "string";
|
|
4
2
|
export const isTaggedError = (tag) => (error) => hasTaggedErrorShape(error) && error._tag === tag;
|
|
5
|
-
export const isUserRejectedError = isTaggedError("UserRejectedError");
|
|
6
|
-
export const catchUserRejection = dual(2, (effect, fallback) => Effect.catchIf(effect, isUserRejectedError, () => Effect.succeed(fallback)));
|
|
7
|
-
export const catchUserRejectionWith = dual(2, (effect, fallback) => Effect.catchIf(effect, isUserRejectedError, () => fallback));
|
|
8
3
|
//# sourceMappingURL=predicates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predicates.js","sourceRoot":"","sources":["../../../src/core/errors/predicates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"predicates.js","sourceRoot":"","sources":["../../../src/core/errors/predicates.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAc,EAA6B,EAAE,CAC/E,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;AAMnG,MAAM,CAAC,MAAM,aAAa,GACxB,CAAsC,GAAc,EAAE,EAAE,CACxD,CAAC,KAAc,EAAc,EAAE,CAC7B,mBAAmB,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
declare const UserRejectedError_base: Schema.TaggedErrorClass<UserRejectedError, "UserRejectedError", {
|
|
3
|
+
readonly _tag: Schema.tag<"UserRejectedError">;
|
|
4
|
+
} & {
|
|
5
|
+
message: typeof Schema.String;
|
|
6
|
+
}>;
|
|
7
|
+
export declare class UserRejectedError extends UserRejectedError_base {
|
|
8
|
+
}
|
|
2
9
|
declare const TransactionSendError_base: Schema.TaggedErrorClass<TransactionSendError, "TransactionSendError", {
|
|
3
10
|
readonly _tag: Schema.tag<"TransactionSendError">;
|
|
4
11
|
} & {
|
|
@@ -11,6 +18,7 @@ export declare class TransactionSendError extends TransactionSendError_base {
|
|
|
11
18
|
declare const TransactionFailedError_base: Schema.TaggedErrorClass<TransactionFailedError, "TransactionFailedError", {
|
|
12
19
|
readonly _tag: Schema.tag<"TransactionFailedError">;
|
|
13
20
|
} & {
|
|
21
|
+
cause: Schema.optional<typeof Schema.Unknown>;
|
|
14
22
|
logs: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
15
23
|
message: typeof Schema.String;
|
|
16
24
|
signature: typeof Schema.String;
|
|
@@ -42,5 +50,16 @@ declare const SimulationFailedError_base: Schema.TaggedErrorClass<SimulationFail
|
|
|
42
50
|
}>;
|
|
43
51
|
export declare class SimulationFailedError extends SimulationFailedError_base {
|
|
44
52
|
}
|
|
53
|
+
export declare const isTaggedUserRejectedError: (error: unknown) => error is UserRejectedError;
|
|
54
|
+
export declare const isUserRejectedError: (error: unknown) => error is UserRejectedError;
|
|
55
|
+
export declare function isLikelyUserRejectedError(error: unknown): boolean;
|
|
56
|
+
export declare const catchUserRejection: {
|
|
57
|
+
<A2>(fallback: A2): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A | A2, Exclude<E, UserRejectedError>, R>;
|
|
58
|
+
<A, E, R, A2>(effect: Effect.Effect<A, E, R>, fallback: A2): Effect.Effect<A | A2, Exclude<E, UserRejectedError>, R>;
|
|
59
|
+
};
|
|
60
|
+
export declare const catchUserRejectionWith: {
|
|
61
|
+
<A2, E2, R2>(fallback: Effect.Effect<A2, E2, R2>): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A | A2, Exclude<E, UserRejectedError> | E2, R | R2>;
|
|
62
|
+
<A, E, R, A2, E2, R2>(effect: Effect.Effect<A, E, R>, fallback: Effect.Effect<A2, E2, R2>): Effect.Effect<A | A2, Exclude<E, UserRejectedError> | E2, R | R2>;
|
|
63
|
+
};
|
|
45
64
|
export {};
|
|
46
65
|
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/core/errors/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;;;;;;;;
|
|
1
|
+
{"version":3,"file":"transaction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AAE,EAAE,EAAE,EAAE,EAAE,EACT,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,GAClC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EACT,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC,EAAE,iBAAiB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;IACvE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAClB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC9B,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,GAClC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC,EAAE,iBAAiB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;CAYtE,CAAC"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { dual } from "effect/Function";
|
|
3
|
+
import { hasTaggedErrorShape, isTaggedError } from "./predicates.js";
|
|
4
|
+
export class UserRejectedError extends Schema.TaggedError()("UserRejectedError", {
|
|
5
|
+
message: Schema.String,
|
|
6
|
+
}) {
|
|
7
|
+
}
|
|
2
8
|
export class TransactionSendError extends Schema.TaggedError()("TransactionSendError", {
|
|
3
9
|
cause: Schema.optional(Schema.Unknown),
|
|
4
10
|
message: Schema.String,
|
|
@@ -6,6 +12,7 @@ export class TransactionSendError extends Schema.TaggedError()("TransactionSendE
|
|
|
6
12
|
}) {
|
|
7
13
|
}
|
|
8
14
|
export class TransactionFailedError extends Schema.TaggedError()("TransactionFailedError", {
|
|
15
|
+
cause: Schema.optional(Schema.Unknown),
|
|
9
16
|
logs: Schema.optional(Schema.Array(Schema.String)),
|
|
10
17
|
message: Schema.String,
|
|
11
18
|
signature: Schema.String,
|
|
@@ -27,4 +34,56 @@ export class SimulationFailedError extends Schema.TaggedError()("SimulationFaile
|
|
|
27
34
|
message: Schema.String,
|
|
28
35
|
}) {
|
|
29
36
|
}
|
|
37
|
+
export const isTaggedUserRejectedError = isTaggedError("UserRejectedError");
|
|
38
|
+
export const isUserRejectedError = isTaggedUserRejectedError;
|
|
39
|
+
const USER_REJECTION_CODE = 4001;
|
|
40
|
+
const USER_REJECTION_MESSAGES = ["user rejected", "rejected the request"];
|
|
41
|
+
function isRejectionCode(code) {
|
|
42
|
+
return code === USER_REJECTION_CODE || code === `${USER_REJECTION_CODE}`;
|
|
43
|
+
}
|
|
44
|
+
function hasRejectionMessage(message) {
|
|
45
|
+
const lower = message.toLowerCase();
|
|
46
|
+
return USER_REJECTION_MESSAGES.some((m) => lower.includes(m));
|
|
47
|
+
}
|
|
48
|
+
function checkCause(cause, depth) {
|
|
49
|
+
if (!cause || depth > 3) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
if (typeof cause === "object" && "code" in cause && isRejectionCode(cause.code)) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
if (typeof cause === "string") {
|
|
56
|
+
return hasRejectionMessage(cause);
|
|
57
|
+
}
|
|
58
|
+
if (cause instanceof Error) {
|
|
59
|
+
if (isRejectionCode(cause.code)) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
if (hasRejectionMessage(cause.message)) {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
return checkCause(cause.cause, depth + 1);
|
|
66
|
+
}
|
|
67
|
+
if (typeof cause === "object" && "message" in cause && typeof cause.message === "string") {
|
|
68
|
+
return hasRejectionMessage(cause.message);
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
export function isLikelyUserRejectedError(error) {
|
|
73
|
+
if (!error || typeof error !== "object") {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
if (isUserRejectedError(error)) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
if (hasTaggedErrorShape(error) && error._tag === "WalletNotConnectedError") {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
if (hasTaggedErrorShape(error) && error._tag === "SignatureError") {
|
|
83
|
+
return checkCause(error.cause, 0);
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
export const catchUserRejection = dual(2, (effect, fallback) => Effect.catchIf(effect, isUserRejectedError, () => Effect.succeed(fallback)));
|
|
88
|
+
export const catchUserRejectionWith = dual(2, (effect, fallback) => Effect.catchIf(effect, isUserRejectedError, () => fallback));
|
|
30
89
|
//# sourceMappingURL=transaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/core/errors/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/core/errors/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAMrE,MAAM,OAAO,iBAAkB,SAAQ,MAAM,CAAC,WAAW,EAAqB,CAC5E,mBAAmB,EACnB;IACE,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CACF;CAAG;AAEJ,MAAM,OAAO,oBAAqB,SAAQ,MAAM,CAAC,WAAW,EAAwB,CAClF,s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const SignatureError_base: Schema.TaggedErrorClass<SignatureError, "Sign
|
|
|
14
14
|
}>;
|
|
15
15
|
export declare class SignatureError extends SignatureError_base {
|
|
16
16
|
}
|
|
17
|
-
declare const UserRejectedError_base: Schema.TaggedErrorClass<UserRejectedError, "UserRejectedError", {
|
|
18
|
-
readonly _tag: Schema.tag<"UserRejectedError">;
|
|
19
|
-
} & {
|
|
20
|
-
message: typeof Schema.String;
|
|
21
|
-
}>;
|
|
22
|
-
export declare class UserRejectedError extends UserRejectedError_base {
|
|
23
|
-
}
|
|
24
17
|
export {};
|
|
25
18
|
//# sourceMappingURL=wallet.d.ts.map
|