@prb/effect-solana 1.0.0-beta.0 → 1.0.0-beta.2
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 +154 -174
- 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 +94 -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/_fixtures.d.ts +4 -0
- package/dist/web3.js/_fixtures.d.ts.map +1 -0
- package/dist/web3.js/_fixtures.js +30 -0
- package/dist/web3.js/_fixtures.js.map +1 -0
- package/dist/web3.js/index.d.ts +5 -0
- package/dist/web3.js/index.d.ts.map +1 -0
- package/dist/web3.js/index.js +5 -0
- package/dist/web3.js/index.js.map +1 -0
- package/dist/web3.js/layers.d.ts +12 -0
- package/dist/web3.js/layers.d.ts.map +1 -0
- package/dist/web3.js/layers.js +10 -0
- package/dist/web3.js/layers.js.map +1 -0
- package/dist/web3.js/legacy-signer.d.ts +5 -0
- package/dist/web3.js/legacy-signer.d.ts.map +1 -0
- package/dist/web3.js/legacy-signer.js +71 -0
- package/dist/web3.js/legacy-signer.js.map +1 -0
- package/dist/web3.js/transaction-bridge.d.ts +9 -0
- package/dist/web3.js/transaction-bridge.d.ts.map +1 -0
- package/dist/web3.js/transaction-bridge.js +47 -0
- package/dist/web3.js/transaction-bridge.js.map +1 -0
- package/dist/web3.js/types.d.ts +12 -0
- package/dist/web3.js/types.d.ts.map +1 -0
- package/dist/web3.js/types.js +14 -0
- package/dist/web3.js/types.js.map +1 -0
- package/package.json +15 -1
package/README.md
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
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
12
|
npm install @prb/effect-solana effect @solana/kit
|
|
@@ -12,34 +16,46 @@ pnpm add @prb/effect-solana effect @solana/kit
|
|
|
12
16
|
bun add @prb/effect-solana effect @solana/kit
|
|
13
17
|
```
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
### Peer Dependencies
|
|
20
|
+
|
|
21
|
+
Required:
|
|
22
|
+
|
|
23
|
+
- `effect` ^3.x
|
|
24
|
+
- `@solana/kit` ^2.2.0
|
|
25
|
+
- `@solana-program/system` ^0.8.0
|
|
26
|
+
- `@solana-program/token` ^0.8.0
|
|
27
|
+
- `@solana-program/compute-budget` ^0.8.0
|
|
28
|
+
|
|
29
|
+
Optional:
|
|
30
|
+
|
|
31
|
+
- `@coral-xyz/anchor` ^0.31.1 (for Anchor IDL support)
|
|
32
|
+
- `@solana/web3.js` ^1.95.0 (for legacy interop)
|
|
33
|
+
- `react`, `react-dom` (for React hooks)
|
|
34
|
+
|
|
35
|
+
## 🚀 Quick Start
|
|
16
36
|
|
|
17
37
|
```typescript
|
|
18
38
|
import { Effect, Layer } from "effect";
|
|
19
|
-
import { BalanceService,
|
|
39
|
+
import { BalanceService, makeSolanaLayer } from "@prb/effect-solana";
|
|
20
40
|
import type { Address } from "@solana/kit";
|
|
21
41
|
|
|
22
|
-
// Create a
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// Compose with BalanceService
|
|
29
|
-
const MainLayer = BalanceServiceLive.pipe(Layer.provide(MyRpcLayer));
|
|
42
|
+
// Create a complete Solana layer
|
|
43
|
+
const SolanaLayer = makeSolanaLayer(
|
|
44
|
+
{ cluster: "devnet" },
|
|
45
|
+
() => walletAdapter, // your wallet adapter
|
|
46
|
+
);
|
|
30
47
|
|
|
31
48
|
// Read SOL balance
|
|
32
49
|
const program = Effect.gen(function* () {
|
|
33
50
|
const balance = yield* BalanceService;
|
|
34
51
|
const address = "YOUR_ADDRESS" as Address;
|
|
35
|
-
|
|
36
|
-
console.log(`Balance: ${sol} lamports`);
|
|
52
|
+
return yield* balance.getSolBalance(address);
|
|
37
53
|
});
|
|
38
54
|
|
|
39
|
-
Effect.runPromise(Effect.provide(program,
|
|
55
|
+
Effect.runPromise(Effect.provide(program, SolanaLayer));
|
|
40
56
|
```
|
|
41
57
|
|
|
42
|
-
## Services
|
|
58
|
+
## 🔧 Services
|
|
43
59
|
|
|
44
60
|
### RpcService
|
|
45
61
|
|
|
@@ -98,10 +114,10 @@ const program = Effect.gen(function* () {
|
|
|
98
114
|
|
|
99
115
|
### TokenService
|
|
100
116
|
|
|
101
|
-
SPL token operations.
|
|
117
|
+
SPL token operations (supports both Token and Token-2022 programs).
|
|
102
118
|
|
|
103
119
|
```typescript
|
|
104
|
-
import { TokenService } from "@prb/effect-solana";
|
|
120
|
+
import { TokenService, TOKEN_2022_PROGRAM_ADDRESS } from "@prb/effect-solana";
|
|
105
121
|
|
|
106
122
|
const program = Effect.gen(function* () {
|
|
107
123
|
const token = yield* TokenService;
|
|
@@ -109,7 +125,7 @@ const program = Effect.gen(function* () {
|
|
|
109
125
|
// Get associated token address
|
|
110
126
|
const ata = yield* token.getAssociatedTokenAddress({ owner, mint });
|
|
111
127
|
|
|
112
|
-
// Token-2022
|
|
128
|
+
// Token-2022 support
|
|
113
129
|
const ata2022 = yield* token.getAssociatedTokenAddress({
|
|
114
130
|
owner,
|
|
115
131
|
mint,
|
|
@@ -117,17 +133,15 @@ const program = Effect.gen(function* () {
|
|
|
117
133
|
});
|
|
118
134
|
|
|
119
135
|
// Get or create ATA
|
|
120
|
-
const { address, instruction } = yield* token.getOrCreateATA({
|
|
136
|
+
const { address, instruction } = yield* token.getOrCreateATA({
|
|
137
|
+
owner,
|
|
138
|
+
mint,
|
|
139
|
+
payer,
|
|
140
|
+
});
|
|
121
141
|
|
|
122
142
|
// Get token balance
|
|
123
143
|
const balance = yield* token.getTokenBalance(ata);
|
|
124
144
|
|
|
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
145
|
// Build transfer instruction
|
|
132
146
|
const transfer = yield* token.getTransferInstruction({
|
|
133
147
|
source: ata,
|
|
@@ -135,17 +149,6 @@ const program = Effect.gen(function* () {
|
|
|
135
149
|
authority: owner,
|
|
136
150
|
amount: 1_000_000n,
|
|
137
151
|
});
|
|
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
152
|
});
|
|
150
153
|
```
|
|
151
154
|
|
|
@@ -159,36 +162,52 @@ import { TransactionService } from "@prb/effect-solana";
|
|
|
159
162
|
const program = Effect.gen(function* () {
|
|
160
163
|
const tx = yield* TransactionService;
|
|
161
164
|
|
|
162
|
-
// Build transaction
|
|
165
|
+
// Build transaction with compute budget
|
|
163
166
|
const message = yield* tx.build(instructions, {
|
|
164
167
|
computeBudget: { unitLimit: 600_000, microLamports: 10_000 },
|
|
165
168
|
});
|
|
166
169
|
|
|
167
|
-
// Sign
|
|
170
|
+
// Sign, send, and confirm
|
|
168
171
|
const signed = yield* tx.sign(message);
|
|
169
|
-
|
|
170
|
-
// Send transaction
|
|
171
172
|
const signature = yield* tx.send(signed);
|
|
172
|
-
|
|
173
|
-
// Confirm transaction
|
|
174
173
|
const receipt = yield* tx.confirm(signature, {
|
|
175
174
|
commitment: "confirmed",
|
|
176
175
|
timeout: 60_000,
|
|
177
176
|
});
|
|
178
177
|
|
|
179
|
-
// Or
|
|
178
|
+
// Or all at once
|
|
180
179
|
const receipt2 = yield* tx.sendAndConfirm(instructions, {
|
|
181
180
|
commitment: "confirmed",
|
|
182
181
|
});
|
|
183
182
|
|
|
184
|
-
// Batch
|
|
185
|
-
const receipts = yield* tx.sendAndConfirmBatch(
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
);
|
|
183
|
+
// Batch transactions
|
|
184
|
+
const receipts = yield* tx.sendAndConfirmBatch([{ instructions }, { instructions: [instruction2] }], {
|
|
185
|
+
concurrency: 2,
|
|
186
|
+
confirm: { commitment: "confirmed" },
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### ProgramWriter
|
|
189
192
|
|
|
190
|
-
|
|
191
|
-
|
|
193
|
+
Build instructions from Anchor IDLs.
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
import { ProgramWriter } from "@prb/effect-solana";
|
|
197
|
+
import type { Idl } from "@prb/effect-solana";
|
|
198
|
+
|
|
199
|
+
const program = Effect.gen(function* () {
|
|
200
|
+
const writer = yield* ProgramWriter;
|
|
201
|
+
|
|
202
|
+
const instruction = yield* writer.build(
|
|
203
|
+
idl,
|
|
204
|
+
{
|
|
205
|
+
method: "withdraw",
|
|
206
|
+
args: [amount],
|
|
207
|
+
accounts: { signer, streamRecipient /* ... */ },
|
|
208
|
+
},
|
|
209
|
+
programId,
|
|
210
|
+
);
|
|
192
211
|
});
|
|
193
212
|
```
|
|
194
213
|
|
|
@@ -205,18 +224,32 @@ const program = Effect.gen(function* () {
|
|
|
205
224
|
});
|
|
206
225
|
```
|
|
207
226
|
|
|
208
|
-
## Layer Composition
|
|
227
|
+
## 🧩 Layer Composition
|
|
209
228
|
|
|
210
|
-
|
|
229
|
+
### Using Presets
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
import { makeSolanaLayer, makeRpcLayer, makeSignerLayer } from "@prb/effect-solana";
|
|
233
|
+
|
|
234
|
+
// Complete layer with all services
|
|
235
|
+
const AppLayer = makeSolanaLayer({ cluster: "devnet" }, () => walletAdapter);
|
|
236
|
+
|
|
237
|
+
// Or compose manually
|
|
238
|
+
const rpcLayer = makeRpcLayer({ cluster: "devnet", rpcUrl: "https://my-rpc.com" });
|
|
239
|
+
const signerLayer = makeSignerLayer(() => walletAdapter);
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Manual Composition
|
|
211
243
|
|
|
212
244
|
```typescript
|
|
213
245
|
import { Layer } from "effect";
|
|
214
246
|
import {
|
|
215
247
|
BalanceServiceLive,
|
|
216
|
-
|
|
217
|
-
|
|
248
|
+
RpcService,
|
|
249
|
+
SignerService,
|
|
218
250
|
TokenServiceLive,
|
|
219
251
|
TransactionServiceLive,
|
|
252
|
+
ProgramWriterLive,
|
|
220
253
|
} from "@prb/effect-solana";
|
|
221
254
|
|
|
222
255
|
// Create custom implementations
|
|
@@ -231,107 +264,20 @@ const MySignerLayer = Layer.succeed(SignerService, {
|
|
|
231
264
|
});
|
|
232
265
|
|
|
233
266
|
// Compose layers
|
|
234
|
-
const AppLayer = Layer.mergeAll(BalanceServiceLive, TokenServiceLive, TransactionServiceLive).pipe(
|
|
267
|
+
const AppLayer = Layer.mergeAll(BalanceServiceLive, TokenServiceLive, TransactionServiceLive, ProgramWriterLive).pipe(
|
|
235
268
|
Layer.provide(Layer.merge(MyRpcLayer, MySignerLayer)),
|
|
236
269
|
);
|
|
237
270
|
```
|
|
238
271
|
|
|
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:
|
|
272
|
+
## ⚛️ React Integration
|
|
326
273
|
|
|
327
274
|
```typescript
|
|
328
275
|
import { EffectSolanaProvider, useEffectMemo } from "@prb/effect-solana";
|
|
329
276
|
import { BalanceService } from "@prb/effect-solana";
|
|
330
|
-
import type { Address } from "@solana/kit";
|
|
331
277
|
|
|
332
278
|
function App() {
|
|
333
279
|
return (
|
|
334
|
-
<EffectSolanaProvider layer={
|
|
280
|
+
<EffectSolanaProvider layer={AppLayer}>
|
|
335
281
|
<Balance address={yourAddress} />
|
|
336
282
|
</EffectSolanaProvider>
|
|
337
283
|
);
|
|
@@ -344,7 +290,7 @@ function Balance({ address }: { address: Address }) {
|
|
|
344
290
|
const balance = yield* BalanceService;
|
|
345
291
|
return yield* balance.getSolBalance(address);
|
|
346
292
|
}),
|
|
347
|
-
[address]
|
|
293
|
+
[address]
|
|
348
294
|
);
|
|
349
295
|
|
|
350
296
|
if (result.status === "loading") return <div>Loading...</div>;
|
|
@@ -353,54 +299,88 @@ function Balance({ address }: { address: Address }) {
|
|
|
353
299
|
}
|
|
354
300
|
```
|
|
355
301
|
|
|
356
|
-
Available
|
|
302
|
+
### Available Hooks
|
|
357
303
|
|
|
358
304
|
- `useEffectMemo` - Run an Effect with memoization
|
|
359
305
|
- `useEffectOnce` - Run an Effect once on mount
|
|
360
306
|
- `useStream` - Subscribe to an Effect Stream
|
|
361
307
|
- `useForkEffect` - Fork an Effect as a background fiber
|
|
362
|
-
- `EffectSolanaProvider` - Context provider for Effect runtime
|
|
363
308
|
- `useEffectSolanaRuntime` - Access the Effect runtime
|
|
364
309
|
|
|
365
|
-
##
|
|
310
|
+
## 🚨 Error Handling
|
|
366
311
|
|
|
367
|
-
|
|
312
|
+
All errors are tagged for discriminated union handling:
|
|
368
313
|
|
|
369
314
|
```typescript
|
|
370
315
|
import { Effect } from "effect";
|
|
371
|
-
import {
|
|
372
|
-
|
|
316
|
+
import {
|
|
317
|
+
WalletNotConnectedError,
|
|
318
|
+
TransactionFailedError,
|
|
319
|
+
TransactionTimeoutError,
|
|
320
|
+
RpcError,
|
|
321
|
+
catchUserRejection,
|
|
322
|
+
} from "@prb/effect-solana";
|
|
373
323
|
|
|
374
|
-
const
|
|
375
|
-
Effect.
|
|
376
|
-
|
|
324
|
+
const handled = program.pipe(
|
|
325
|
+
Effect.catchTag("WalletNotConnectedError", () => Effect.succeed("Please connect wallet")),
|
|
326
|
+
Effect.catchTag("TransactionFailedError", (e) => Effect.succeed(`TX failed: ${e.message}`)),
|
|
327
|
+
Effect.catchTag("TransactionTimeoutError", (e) => Effect.succeed(`TX timed out: ${e.signature}`)),
|
|
328
|
+
Effect.catchTag("RpcError", (e) => Effect.succeed(`RPC error: ${e.message}`)),
|
|
329
|
+
);
|
|
377
330
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
amount: params.amount,
|
|
382
|
-
});
|
|
331
|
+
// Convenience operator for user rejections
|
|
332
|
+
const result = sendTransaction(tx).pipe(catchUserRejection(null));
|
|
333
|
+
```
|
|
383
334
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
335
|
+
### Error Types
|
|
336
|
+
|
|
337
|
+
| Error | Description |
|
|
338
|
+
| -------------------------- | ---------------------------------- |
|
|
339
|
+
| `RpcError` | RPC communication failure |
|
|
340
|
+
| `WalletNotConnectedError` | Wallet not connected |
|
|
341
|
+
| `SignatureError` | Transaction signing failed |
|
|
342
|
+
| `UserRejectedError` | User rejected the transaction |
|
|
343
|
+
| `TransactionSendError` | Failed to send transaction |
|
|
344
|
+
| `TransactionFailedError` | Transaction execution failed |
|
|
345
|
+
| `TransactionTimeoutError` | Transaction confirmation timed out |
|
|
346
|
+
| `BlockhashExpiredError` | Blockhash expired before confirm |
|
|
347
|
+
| `SimulationFailedError` | Transaction simulation failed |
|
|
348
|
+
| `AccountNotFoundError` | Account does not exist |
|
|
349
|
+
| `InsufficientBalanceError` | Insufficient SOL balance |
|
|
350
|
+
|
|
351
|
+
## 📊 Telemetry
|
|
352
|
+
|
|
353
|
+
Built-in OpenTelemetry spans for observability:
|
|
354
|
+
|
|
355
|
+
```typescript
|
|
356
|
+
import { SpanNames } from "@prb/effect-solana";
|
|
357
|
+
|
|
358
|
+
// Examples: SpanNames.TX_SEND, SpanNames.BALANCE_GET_SOL, SpanNames.TOKEN_GET_ATA
|
|
387
359
|
```
|
|
388
360
|
|
|
389
|
-
|
|
361
|
+
## 📚 Constants
|
|
390
362
|
|
|
391
363
|
```typescript
|
|
392
|
-
import {
|
|
393
|
-
|
|
364
|
+
import {
|
|
365
|
+
LAMPORTS_PER_SOL,
|
|
366
|
+
ClusterEndpoints,
|
|
367
|
+
SYSTEM_PROGRAM_ADDRESS,
|
|
368
|
+
TOKEN_PROGRAM_ADDRESS,
|
|
369
|
+
TOKEN_2022_PROGRAM_ADDRESS,
|
|
370
|
+
ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
|
|
371
|
+
COMPUTE_BUDGET_PROGRAM_ADDRESS,
|
|
372
|
+
MEMO_PROGRAM_ADDRESS,
|
|
373
|
+
} from "@prb/effect-solana";
|
|
374
|
+
```
|
|
394
375
|
|
|
395
|
-
|
|
396
|
-
Effect.gen(function* () {
|
|
397
|
-
const balance = yield* BalanceService;
|
|
398
|
-
const stream = yield* balance.watchBalance({ address });
|
|
376
|
+
## 🔗 Legacy Interop
|
|
399
377
|
|
|
400
|
-
|
|
401
|
-
|
|
378
|
+
Bridge utilities for `@solana/web3.js` v1 compatibility:
|
|
379
|
+
|
|
380
|
+
```typescript
|
|
381
|
+
import { LegacySigner, transactionBridge } from "@prb/effect-solana/web3.js";
|
|
402
382
|
```
|
|
403
383
|
|
|
404
|
-
## License
|
|
384
|
+
## 📄 License
|
|
405
385
|
|
|
406
|
-
MIT
|
|
386
|
+
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.d.ts","sourceRoot":"","sources":["../../../src/core/errors/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;;;;;;AASxC,qBAAa,iBAAkB,SAAQ,sBAKtC;CAAG;;;;;;;;AAEJ,qBAAa,oBAAqB,SAAQ,yBAOzC;CAAG;;;;;;;;;AAEJ,qBAAa,sBAAuB,SAAQ,2BAQ3C;CAAG;;;;;;;AAEJ,qBAAa,uBAAwB,SAAQ,4BAM5C;CAAG;;;;;;;AAEJ,qBAAa,qBAAsB,SAAQ,0BAM1C;CAAG;;;;;;;;AAEJ,qBAAa,qBAAsB,SAAQ,0BAO1C;CAAG;AASJ,eAAO,MAAM,yBAAyB,gDAAwD,CAAC;AAM/F,eAAO,MAAM,mBAAmB,gDAA4B,CAAC;AAiE7D,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAqBjE;AAoBD,eAAO,MAAM,kBAAkB,EAAE;IAC/B,CAAC,EAAE,EACD,QAAQ,EAAE,EAAE,GACX,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,C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
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":[],"mapp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,QAAY,EAC6C,EAAE,CAC3D,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,mBAAmB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAIzE,CACJ,CAAC;AAcF,MAAM,CAAC,MAAM,sBAAsB,GAU/B,IAAI,CACN,CAAC,EACD,CACE,MAA8B,EAC9B,QAAmC,EACgC,EAAE,CACrE,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,mBAAmB,EAAE,GAAG,EAAE,CAAC,QAAQ,CAIzD,CACJ,CAAC"}
|
|
@@ -14,12 +14,5 @@ declare 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
|