@effect-blockchain/solana 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SolanaIndexer.d.ts +45 -3
- package/dist/SolanaIndexer.d.ts.map +1 -1
- package/dist/SolanaIndexer.js +138 -21
- package/dist/SolanaIndexer.js.map +1 -1
- package/dist/SolanaRelayer.d.ts +207 -0
- package/dist/SolanaRelayer.d.ts.map +1 -0
- package/dist/SolanaRelayer.js +377 -0
- package/dist/SolanaRelayer.js.map +1 -0
- package/dist/SolanaRpc.d.ts +176 -7
- package/dist/SolanaRpc.d.ts.map +1 -1
- package/dist/SolanaRpc.js +68 -6
- package/dist/SolanaRpc.js.map +1 -1
- package/dist/SolanaSigner.d.ts +49 -0
- package/dist/SolanaSigner.d.ts.map +1 -0
- package/dist/SolanaSigner.js +82 -0
- package/dist/SolanaSigner.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/confirmations.d.ts +2 -0
- package/dist/internal/confirmations.d.ts.map +1 -0
- package/dist/internal/confirmations.js +15 -0
- package/dist/internal/confirmations.js.map +1 -0
- package/dist/internal/rpcMethods.js +119 -1
- package/dist/internal/rpcMethods.js.map +1 -1
- package/package.json +1 -1
- package/src/SolanaIndexer.ts +210 -34
- package/src/SolanaRelayer.ts +493 -0
- package/src/SolanaRpc.ts +217 -9
- package/src/SolanaSigner.ts +98 -0
- package/src/index.ts +10 -0
- package/src/internal/confirmations.ts +17 -0
- package/src/internal/rpcMethods.ts +118 -1
package/dist/SolanaIndexer.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ import * as Schedule from "effect/Schedule";
|
|
|
7
7
|
import type * as Schema from "effect/Schema";
|
|
8
8
|
import * as Stream from "effect/Stream";
|
|
9
9
|
import type { SolanaAddress } from "./SolanaAddress.ts";
|
|
10
|
-
import type {
|
|
11
|
-
import { SolanaRpc } from "./SolanaRpc.ts";
|
|
10
|
+
import type { SolanaTransactionEncoding, SolanaTransactionInfo } from "./SolanaRpc.ts";
|
|
11
|
+
import { SolanaRpc, SolanaRpcError } from "./SolanaRpc.ts";
|
|
12
12
|
import type { SolanaTransactionHash } from "./SolanaTransactionHash.ts";
|
|
13
13
|
/**
|
|
14
14
|
* A transaction touching the indexed address, kept raw: the `getTransaction` result with its `signature` and the
|
|
@@ -72,6 +72,33 @@ export interface SolanaIndexerStreamOptions {
|
|
|
72
72
|
*/
|
|
73
73
|
readonly retry?: Schedule.Schedule<unknown, SolanaRpcError> | undefined;
|
|
74
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* The lamports of an address at the end of slot `block`, emitted by {@link SolanaIndexer.Service.streamNativeBalance}.
|
|
77
|
+
*
|
|
78
|
+
* @since 0.2.0
|
|
79
|
+
* @category models
|
|
80
|
+
*/
|
|
81
|
+
export interface SolanaNativeBalance {
|
|
82
|
+
readonly block: bigint;
|
|
83
|
+
readonly balance: bigint;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The {@link SolanaIndexer.Service.streamNativeBalance} options: a sample of the balance of `address` at `fromBlock`,
|
|
87
|
+
* `fromBlock + step`, `fromBlock + 2 * step`... `poll` and `retry` behave as in {@link SolanaIndexerStreamOptions}.
|
|
88
|
+
*
|
|
89
|
+
* @since 0.2.0
|
|
90
|
+
* @category models
|
|
91
|
+
*/
|
|
92
|
+
export interface SolanaIndexerNativeBalanceOptions {
|
|
93
|
+
readonly address: SolanaAddress;
|
|
94
|
+
readonly fromBlock: bigint;
|
|
95
|
+
/** The stream ends after the last sample not above it, and is empty when `fromBlock > toBlock`. */
|
|
96
|
+
readonly toBlock?: bigint | undefined;
|
|
97
|
+
/** The slots between two samples, a positive safe integer. */
|
|
98
|
+
readonly step: number;
|
|
99
|
+
readonly poll?: Schedule.Schedule<unknown> | undefined;
|
|
100
|
+
readonly retry?: Schedule.Schedule<unknown, SolanaRpcError> | undefined;
|
|
101
|
+
}
|
|
75
102
|
declare const SolanaIndexer_base: Context.ServiceClass<SolanaIndexer, "@effect-blockchain/solana/SolanaIndexer", {
|
|
76
103
|
/** The `finalized` slot minus the confirmations, never below 0. */
|
|
77
104
|
readonly lastConfirmedBlock: Effect.Effect<bigint, SolanaRpcError>;
|
|
@@ -99,6 +126,21 @@ declare const SolanaIndexer_base: Context.ServiceClass<SolanaIndexer, "@effect-b
|
|
|
99
126
|
readonly encoding: Encoding;
|
|
100
127
|
}): Stream.Stream<SolanaIndexerBatch<Encoding>, SolanaRpcError>;
|
|
101
128
|
};
|
|
129
|
+
/**
|
|
130
|
+
* The lamports of `address` at the end of slot `block`: the `postBalances` of its newest transaction at or before
|
|
131
|
+
* `block`, else the `preBalances` of its first one after. At or above the confirmed head with no newer transaction,
|
|
132
|
+
* its `getBalance`: an address without any transaction reads its current balance there and 0 below.
|
|
133
|
+
*/
|
|
134
|
+
readonly fetchNativeBalance: (options: {
|
|
135
|
+
readonly address: SolanaAddress;
|
|
136
|
+
readonly block: bigint;
|
|
137
|
+
}) => Effect.Effect<bigint, SolanaRpcError>;
|
|
138
|
+
/**
|
|
139
|
+
* The lamports of `address` at every `step` slots from `fromBlock`, following the confirmed head. A sample only
|
|
140
|
+
* reads the meta of the newest transaction since the previous one, so epoch rewards, which change a balance without
|
|
141
|
+
* a transaction, show from the next transaction on.
|
|
142
|
+
*/
|
|
143
|
+
readonly streamNativeBalance: (options: SolanaIndexerNativeBalanceOptions) => Stream.Stream<SolanaNativeBalance, SolanaRpcError>;
|
|
102
144
|
}>;
|
|
103
145
|
/**
|
|
104
146
|
* @since 0.1.0
|
|
@@ -124,7 +166,7 @@ export declare const DEFAULT_POLL_INTERVAL: Duration.Duration;
|
|
|
124
166
|
/**
|
|
125
167
|
* Builds a {@link SolanaIndexer} on the provided {@link SolanaRpc}.
|
|
126
168
|
*
|
|
127
|
-
* - `confirmations` defaults to
|
|
169
|
+
* - `confirmations` defaults to `SolanaNetwork.defaultConfirmations` for the RPC's network.
|
|
128
170
|
* - `maxBatchSize`, a positive integer, the signatures per `streamTransactions` batch, defaults to
|
|
129
171
|
* {@link DEFAULT_MAX_BATCH_SIZE}.
|
|
130
172
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolanaIndexer.d.ts","sourceRoot":"","sources":["../src/SolanaIndexer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SolanaIndexer.d.ts","sourceRoot":"","sources":["../src/SolanaIndexer.ts"],"names":[],"mappings":"AAgDA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAuB,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAC3G,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAEvE;;;;;;;GAOG;AACH,MAAM,WAAW,wBAAwB,CAAC,QAAQ,SAAS,yBAAyB,GAAG,QAAQ,CAC7F,SAAQ,qBAAqB,CAAC,QAAQ,CAAC;IAEvC,QAAQ,CAAC,SAAS,EAAE,qBAAqB,CAAA;IACzC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAA;CAC1B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,mBAAm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,EAAE;QACrC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAA;QAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KACvB,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC;IAC3C;;;;OAIG;kCAC2B,CAC5B,OAAO,EAAE,iCAAiC,KACvC,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE,cAAc,CAAC;;AAjDzD;;;GAGG;AACH,qBAAa,aAAc,SAAQ,kBA8CY;CAAG;AAMlD;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,MAAM,CAAA;AAEzC;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,QAA+B,CAAA;AAuD5E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,KAAK,aAAa;IAC7B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3C,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC3C,KAAQ,KAAK,CAAC,KAAK,CAAC,aAAa,EAAE,KAAK,EAAE,SAAS,CAwOjD,CAAA;AAEH;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW,YACb,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAC7D,KAAK,CAAC,KAAK,CAAC,aAAa,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAA4D,CAAA"}
|
package/dist/SolanaIndexer.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Solana transaction indexing on top of {@link SolanaRpc}: the last confirmed slot, the transactions touching an
|
|
3
|
-
* address over a slot range,
|
|
3
|
+
* address over a slot range, its lamport balance at a slot, and streams of both following the confirmed head. Blocks
|
|
4
|
+
* are slots.
|
|
4
5
|
*
|
|
5
6
|
* Everything is read at `finalized` commitment. `getSignaturesForAddress` has no slot range, so a range is paged from
|
|
6
7
|
* the head backwards until it passes `fromBlock`: the cost grows with the address's history since `fromBlock`, then
|
|
@@ -9,6 +10,7 @@
|
|
|
9
10
|
*
|
|
10
11
|
* @example
|
|
11
12
|
* ```ts
|
|
13
|
+
* import type { SolanaAddress } from "@effect-blockchain/solana/SolanaAddress"
|
|
12
14
|
* import type { SolanaIndexerFilter } from "@effect-blockchain/solana/SolanaIndexer"
|
|
13
15
|
* import { SolanaIndexer } from "@effect-blockchain/solana/SolanaIndexer"
|
|
14
16
|
* import * as Effect from "effect/Effect"
|
|
@@ -27,6 +29,16 @@
|
|
|
27
29
|
* Stream.runForEach((batch) => save(batch.toBlock))
|
|
28
30
|
* )
|
|
29
31
|
* })
|
|
32
|
+
*
|
|
33
|
+
* declare const address: SolanaAddress
|
|
34
|
+
*
|
|
35
|
+
* // the lamports of `address` every 9000 slots (about an hour) from slot 400000000
|
|
36
|
+
* const balances = Effect.gen(function*() {
|
|
37
|
+
* const indexer = yield* SolanaIndexer
|
|
38
|
+
* yield* indexer.streamNativeBalance({ address, fromBlock: BigInt(400000000), step: 9000 }).pipe(
|
|
39
|
+
* Stream.runForEach(({ balance, block }) => Effect.log(`${block}: ${balance}`))
|
|
40
|
+
* )
|
|
41
|
+
* })
|
|
30
42
|
* ```
|
|
31
43
|
*
|
|
32
44
|
* @since 0.1.0
|
|
@@ -42,8 +54,8 @@ import * as Layer from "effect/Layer";
|
|
|
42
54
|
import * as Option from "effect/Option";
|
|
43
55
|
import * as Schedule from "effect/Schedule";
|
|
44
56
|
import * as Stream from "effect/Stream";
|
|
45
|
-
import * as
|
|
46
|
-
import { SolanaRpc } from "./SolanaRpc.js";
|
|
57
|
+
import * as Confirmations from "./internal/confirmations.js";
|
|
58
|
+
import { SolanaRpc, SolanaRpcError } from "./SolanaRpc.js";
|
|
47
59
|
/**
|
|
48
60
|
* @since 0.1.0
|
|
49
61
|
* @category services
|
|
@@ -76,10 +88,31 @@ const groupBySlot = (signatures, max) => {
|
|
|
76
88
|
}
|
|
77
89
|
return groups;
|
|
78
90
|
};
|
|
91
|
+
// the lamports of `address` before and after `transaction`, none when it is not one of its accounts. An account's
|
|
92
|
+
// index runs over the static account keys, then the addresses loaded from lookup tables, writable then readonly
|
|
93
|
+
// (https://solana.com/docs/advanced/versions)
|
|
94
|
+
const balanceChange = ({
|
|
95
|
+
meta,
|
|
96
|
+
transaction
|
|
97
|
+
}, address) => {
|
|
98
|
+
if (meta === null) return Option.none();
|
|
99
|
+
const index = [...transaction.message.accountKeys, ...(meta.loadedAddresses?.writable ?? []), ...(meta.loadedAddresses?.readonly ?? [])].indexOf(address);
|
|
100
|
+
const pre = meta.preBalances[index];
|
|
101
|
+
const post = meta.postBalances[index];
|
|
102
|
+
return pre === undefined || post === undefined ? Option.none() : Option.some({
|
|
103
|
+
pre,
|
|
104
|
+
post
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
// retries a stream step failing with a transient reason at the same position
|
|
108
|
+
const withRetry = (retry, step) => retry === undefined ? step : position => Effect.retry(step(position), {
|
|
109
|
+
schedule: retry,
|
|
110
|
+
while: error => JsonRpc.isTransient(error.reason)
|
|
111
|
+
});
|
|
79
112
|
/**
|
|
80
113
|
* Builds a {@link SolanaIndexer} on the provided {@link SolanaRpc}.
|
|
81
114
|
*
|
|
82
|
-
* - `confirmations` defaults to
|
|
115
|
+
* - `confirmations` defaults to `SolanaNetwork.defaultConfirmations` for the RPC's network.
|
|
83
116
|
* - `maxBatchSize`, a positive integer, the signatures per `streamTransactions` batch, defaults to
|
|
84
117
|
* {@link DEFAULT_MAX_BATCH_SIZE}.
|
|
85
118
|
*
|
|
@@ -94,27 +127,28 @@ export const layer = (options = {}) => Layer.effect(SolanaIndexer, Effect.gen(fu
|
|
|
94
127
|
if (!Number.isSafeInteger(maxBatchSize) || maxBatchSize < 1) {
|
|
95
128
|
return yield* Effect.die(new RangeError(`maxBatchSize must be a positive integer, got ${maxBatchSize}`));
|
|
96
129
|
}
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
// the signatures of `[fromBlock, toBlock]` in chain order, paged from the head back to the first short page or
|
|
102
|
-
// the first page reaching below `fromBlock`
|
|
103
|
-
const fetchSignatures = filter => Stream.paginate(Option.none(), before => rpc.getSignaturesForAddress({
|
|
104
|
-
address: filter.address,
|
|
130
|
+
const lastConfirmedBlock = Confirmations.lastConfirmedBlock(rpc, options.confirmations).pipe(Effect.withSpan("SolanaIndexer.lastConfirmedBlock"));
|
|
131
|
+
// the signatures of `address`, newest first, a page read only when the previous one is consumed
|
|
132
|
+
const signatures = (address, minContextSlot) => Stream.paginate(Option.none(), before => rpc.getSignaturesForAddress({
|
|
133
|
+
address,
|
|
105
134
|
before: Option.getOrUndefined(before),
|
|
106
135
|
limit: PAGE_SIZE,
|
|
107
136
|
commitment: COMMITMENT,
|
|
108
|
-
minContextSlot
|
|
137
|
+
minContextSlot
|
|
109
138
|
}).pipe(Effect.map(page => {
|
|
110
139
|
const last = page.at(-1);
|
|
111
|
-
return [page, last === undefined || page.length < PAGE_SIZE
|
|
112
|
-
})))
|
|
140
|
+
return [page, last === undefined || page.length < PAGE_SIZE ? Option.none() : Option.some(Option.some(last.signature))];
|
|
141
|
+
})));
|
|
142
|
+
// the signatures of `[fromBlock, toBlock]` in chain order, paged from the head back to the first short page or
|
|
143
|
+
// the first page reaching below `fromBlock`
|
|
144
|
+
const fetchSignatures = filter => signatures(filter.address, filter.toBlock).pipe(Stream.takeWhile(({
|
|
145
|
+
slot
|
|
146
|
+
}) => slot >= filter.fromBlock), Stream.runCollect,
|
|
113
147
|
// newest first, so reversed slots ascend. The order within a slot is undocumented: reversing it is a best
|
|
114
148
|
// guess at execution order (`transactionIndex`, which some providers add, is not in the RPC model)
|
|
115
149
|
Effect.map(signatures => Arr.reverse(Arr.filter(signatures, ({
|
|
116
150
|
slot
|
|
117
|
-
}) => slot
|
|
151
|
+
}) => slot <= filter.toBlock))));
|
|
118
152
|
const fetchEach = (signatures, encoding) => Effect.forEach(signatures, ({
|
|
119
153
|
err,
|
|
120
154
|
signature
|
|
@@ -198,15 +232,98 @@ export const layer = (options = {}) => Layer.effect(SolanaIndexer, Effect.gen(fu
|
|
|
198
232
|
next: fromBlock,
|
|
199
233
|
cap: fromBlock,
|
|
200
234
|
groups: []
|
|
201
|
-
}, retry
|
|
202
|
-
schedule: retry,
|
|
203
|
-
while: error => JsonRpc.isTransient(error.reason)
|
|
204
|
-
}));
|
|
235
|
+
}, withRetry(retry, step));
|
|
205
236
|
}
|
|
237
|
+
const balanceOf = (address, signature, side) => rpc.getTransaction({
|
|
238
|
+
signature,
|
|
239
|
+
commitment: COMMITMENT,
|
|
240
|
+
encoding: "json"
|
|
241
|
+
}).pipe(Effect.flatMap(tx => Option.match(balanceChange(tx, address), {
|
|
242
|
+
onSome: change => Effect.succeed(change[side]),
|
|
243
|
+
onNone: () => Effect.fail(new SolanaRpcError({
|
|
244
|
+
reason: new JsonRpc.InvalidResponse(),
|
|
245
|
+
method: "getTransaction",
|
|
246
|
+
endpoint: "SolanaIndexer",
|
|
247
|
+
cause: new Error(`transaction ${signature} has no balance for ${address}`)
|
|
248
|
+
}))
|
|
249
|
+
})));
|
|
250
|
+
// the balance at the end of `block`, at or below `confirmed`, given the sample before it when there is one
|
|
251
|
+
const balanceAt = Effect.fnUntraced(function* (address, block, confirmed, previous) {
|
|
252
|
+
// read before the signatures, so that a transaction landing in between is listed
|
|
253
|
+
const current = Option.isNone(previous) && block >= confirmed ? Option.some(yield* rpc.getBalance({
|
|
254
|
+
address
|
|
255
|
+
})) : Option.none();
|
|
256
|
+
// the newest signature, and the newest at or before `block` or else the oldest
|
|
257
|
+
const {
|
|
258
|
+
last,
|
|
259
|
+
newest
|
|
260
|
+
} = yield* signatures(address, BigInt_.min(block, confirmed)).pipe(Stream.takeUntil(({
|
|
261
|
+
slot
|
|
262
|
+
}) => slot <= block), Stream.runFold(() => ({
|
|
263
|
+
newest: Option.none(),
|
|
264
|
+
last: Option.none()
|
|
265
|
+
}), (acc, info) => ({
|
|
266
|
+
newest: Option.orElseSome(acc.newest, () => info),
|
|
267
|
+
last: Option.some(info)
|
|
268
|
+
})));
|
|
269
|
+
if (Option.isSome(current) && Option.match(newest, {
|
|
270
|
+
onNone: () => true,
|
|
271
|
+
onSome: ({
|
|
272
|
+
slot
|
|
273
|
+
}) => slot <= BigInt_.min(block, current.value.slot)
|
|
274
|
+
})) {
|
|
275
|
+
return current.value.value;
|
|
276
|
+
}
|
|
277
|
+
if (Option.isSome(last) && last.value.slot <= block) {
|
|
278
|
+
return Option.isSome(previous) && last.value.slot <= previous.value.block ? previous.value.balance : yield* balanceOf(address, last.value.signature, "post");
|
|
279
|
+
}
|
|
280
|
+
if (Option.isSome(previous)) return previous.value.balance;
|
|
281
|
+
return Option.isSome(last) ? yield* balanceOf(address, last.value.signature, "pre") : BigInt(0);
|
|
282
|
+
});
|
|
283
|
+
const fetchNativeBalance = Effect.fn("SolanaIndexer.fetchNativeBalance")(function* ({
|
|
284
|
+
address,
|
|
285
|
+
block
|
|
286
|
+
}) {
|
|
287
|
+
return yield* balanceAt(address, block, yield* lastConfirmedBlock, Option.none());
|
|
288
|
+
});
|
|
289
|
+
const streamNativeBalance = ({
|
|
290
|
+
address,
|
|
291
|
+
fromBlock,
|
|
292
|
+
poll = Schedule.spaced(DEFAULT_POLL_INTERVAL),
|
|
293
|
+
retry,
|
|
294
|
+
step,
|
|
295
|
+
toBlock
|
|
296
|
+
}) => {
|
|
297
|
+
if (!Number.isSafeInteger(step) || step < 1) {
|
|
298
|
+
return Stream.die(new RangeError(`step must be a positive safe integer, got ${step}`));
|
|
299
|
+
}
|
|
300
|
+
if (toBlock !== undefined && fromBlock > toBlock) {
|
|
301
|
+
return Stream.empty;
|
|
302
|
+
}
|
|
303
|
+
const sample = previous => {
|
|
304
|
+
const block = Option.match(previous, {
|
|
305
|
+
onNone: () => fromBlock,
|
|
306
|
+
onSome: p => p.block + BigInt(step)
|
|
307
|
+
});
|
|
308
|
+
return lastConfirmedBlock.pipe(Effect.repeat({
|
|
309
|
+
schedule: poll,
|
|
310
|
+
until: confirmed => confirmed >= block
|
|
311
|
+
}), Effect.flatMap(confirmed => confirmed < block ? Effect.succeed([[], Option.none()]) : balanceAt(address, block, confirmed, previous).pipe(Effect.map(balance => {
|
|
312
|
+
const current = {
|
|
313
|
+
block,
|
|
314
|
+
balance
|
|
315
|
+
};
|
|
316
|
+
return [[current], toBlock !== undefined && block + BigInt(step) > toBlock ? Option.none() : Option.some(Option.some(current))];
|
|
317
|
+
}))), Effect.withSpan("SolanaIndexer.streamNativeBalance.sample"));
|
|
318
|
+
};
|
|
319
|
+
return Stream.paginate(Option.none(), withRetry(retry, sample));
|
|
320
|
+
};
|
|
206
321
|
return SolanaIndexer.of({
|
|
207
322
|
lastConfirmedBlock,
|
|
208
323
|
fetchTransactions,
|
|
209
|
-
streamTransactions
|
|
324
|
+
streamTransactions,
|
|
325
|
+
fetchNativeBalance,
|
|
326
|
+
streamNativeBalance
|
|
210
327
|
});
|
|
211
328
|
}));
|
|
212
329
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolanaIndexer.js","names":[],"sources":["../src/SolanaIndexer.ts"],"sourcesContent":[null],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"SolanaIndexer.js","names":[],"sources":["../src/SolanaIndexer.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,OAAO,KAAK,OAAO,MAAM,iCAAiC;AAC1D,OAAO,KAAK,GAAG,MAAM,cAAc;AACnC,OAAO,KAAK,OAAO,MAAM,eAAe;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe;AACvC,OAAO,KAAK,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAK,QAAQ,MAAM,iBAAiB;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe;AACvC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,iBAAiB;IACjB,kBAAkB;IAClB,kBAAkB;IAClB;GACD,CAAC;AACJ,CAAC,CAAC,CACH;AAEH;;;;;;;;;;;;;;AAcA,OAAO,MAAM,WAAW,GACtB,OAA8D,IACA,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import * as Context from "effect/Context";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
import * as Schedule from "effect/Schedule";
|
|
5
|
+
import * as Schema from "effect/Schema";
|
|
6
|
+
import { SolanaAddress } from "./SolanaAddress.ts";
|
|
7
|
+
import * as SolanaRpc from "./SolanaRpc.ts";
|
|
8
|
+
import { type SolanaSigner, SolanaSignerError } from "./SolanaSigner.ts";
|
|
9
|
+
import { SolanaTransactionHash } from "./SolanaTransactionHash.ts";
|
|
10
|
+
/**
|
|
11
|
+
* Where a transaction stands, by `_tag`: see the module's table. `block` is the slot holding it, and `reason` the
|
|
12
|
+
* transaction error as the node returns it.
|
|
13
|
+
*
|
|
14
|
+
* @since 0.2.0
|
|
15
|
+
* @category models
|
|
16
|
+
*/
|
|
17
|
+
export type SolanaTransactionStatus = {
|
|
18
|
+
readonly _tag: "Pending";
|
|
19
|
+
} | {
|
|
20
|
+
readonly _tag: "Included";
|
|
21
|
+
readonly block: bigint;
|
|
22
|
+
} | {
|
|
23
|
+
readonly _tag: "Confirmed";
|
|
24
|
+
readonly block: bigint;
|
|
25
|
+
} | {
|
|
26
|
+
readonly _tag: "Failed";
|
|
27
|
+
readonly block: bigint;
|
|
28
|
+
readonly reason: SolanaRpc.SolanaTransactionError;
|
|
29
|
+
} | {
|
|
30
|
+
readonly _tag: "Expired";
|
|
31
|
+
} | {
|
|
32
|
+
readonly _tag: "NotFound";
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* The transaction to look up: its `hash` (its first signature) and the `lastValidBlockHeight` returned with its
|
|
36
|
+
* recent blockhash. Without `lastValidBlockHeight`, an unknown transaction is `NotFound`, never `Expired`.
|
|
37
|
+
*
|
|
38
|
+
* @since 0.2.0
|
|
39
|
+
* @category models
|
|
40
|
+
*/
|
|
41
|
+
export interface SolanaTransactionStatusOptions {
|
|
42
|
+
readonly hash: SolanaTransactionHash;
|
|
43
|
+
readonly lastValidBlockHeight?: bigint | undefined;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* An account an instruction reads, `writable` when the instruction changes it and `signer` when it must sign the
|
|
47
|
+
* transaction.
|
|
48
|
+
*
|
|
49
|
+
* @since 0.2.0
|
|
50
|
+
* @category models
|
|
51
|
+
*/
|
|
52
|
+
export interface SolanaAccountMeta {
|
|
53
|
+
readonly address: SolanaAddress;
|
|
54
|
+
readonly signer?: boolean | undefined;
|
|
55
|
+
readonly writable?: boolean | undefined;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* An instruction of a transaction: the program to call, the accounts it takes, in the program's order, and its `data`
|
|
59
|
+
* as the program encodes it.
|
|
60
|
+
*
|
|
61
|
+
* @since 0.2.0
|
|
62
|
+
* @category models
|
|
63
|
+
*/
|
|
64
|
+
export interface SolanaInstruction {
|
|
65
|
+
readonly programAddress: SolanaAddress;
|
|
66
|
+
readonly accounts?: ReadonlyArray<SolanaAccountMeta> | undefined;
|
|
67
|
+
readonly data?: Uint8Array | undefined;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* A transaction signed by {@link SolanaRelayer.sign}: `signed` is the base64 wire transaction `broadcast` takes,
|
|
71
|
+
* `hash` the fee payer's signature and `lastValidBlockHeight` the last block height it can land at.
|
|
72
|
+
*
|
|
73
|
+
* @since 0.2.0
|
|
74
|
+
* @category models
|
|
75
|
+
*/
|
|
76
|
+
export interface SolanaSignedTransaction {
|
|
77
|
+
readonly hash: SolanaTransactionHash;
|
|
78
|
+
readonly signed: string;
|
|
79
|
+
readonly lastValidBlockHeight: bigint;
|
|
80
|
+
}
|
|
81
|
+
declare const BlockhashNotFound_base: Schema.Class<BlockhashNotFound, Schema.TaggedStruct<"BlockhashNotFound", {}>, import("effect/Cause").YieldableError>;
|
|
82
|
+
/**
|
|
83
|
+
* The node does not know the transaction's blockhash: it has expired, or the node is behind the one that returned
|
|
84
|
+
* it. Past `lastValidBlockHeight`, sign the transaction again.
|
|
85
|
+
*
|
|
86
|
+
* @since 0.2.0
|
|
87
|
+
* @category reasons
|
|
88
|
+
*/
|
|
89
|
+
export declare class BlockhashNotFound extends BlockhashNotFound_base {
|
|
90
|
+
}
|
|
91
|
+
declare const InsufficientFundsForFee_base: Schema.Class<InsufficientFundsForFee, Schema.TaggedStruct<"InsufficientFundsForFee", {}>, import("effect/Cause").YieldableError>;
|
|
92
|
+
/**
|
|
93
|
+
* The fee payer cannot pay the transaction fee: its balance is too low, or it holds no account.
|
|
94
|
+
*
|
|
95
|
+
* @since 0.2.0
|
|
96
|
+
* @category reasons
|
|
97
|
+
*/
|
|
98
|
+
export declare class InsufficientFundsForFee extends InsufficientFundsForFee_base {
|
|
99
|
+
}
|
|
100
|
+
declare const SimulationFailed_base: Schema.Class<SimulationFailed, Schema.TaggedStruct<"SimulationFailed", {
|
|
101
|
+
readonly error: Schema.Codec<SolanaRpc.SolanaTransactionError, SolanaRpc.SolanaTransactionError, never, never>;
|
|
102
|
+
readonly logs: Schema.$Array<Schema.String>;
|
|
103
|
+
}>, import("effect/Cause").YieldableError>;
|
|
104
|
+
/**
|
|
105
|
+
* The node simulated the transaction and it failed: `error` is the transaction error and `logs` the program logs up
|
|
106
|
+
* to it. {@link SolanaRelayer.sign} fails with it when it estimates the compute unit limit.
|
|
107
|
+
*
|
|
108
|
+
* @since 0.2.0
|
|
109
|
+
* @category reasons
|
|
110
|
+
*/
|
|
111
|
+
export declare class SimulationFailed extends SimulationFailed_base {
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Why a node refused a transaction, the `reason` of a {@link SolanaBroadcastError}, matched with `Effect.catchReason`.
|
|
115
|
+
*
|
|
116
|
+
* @since 0.2.0
|
|
117
|
+
* @category reasons
|
|
118
|
+
*/
|
|
119
|
+
export declare const SolanaBroadcastReason: Schema.Union<readonly [typeof BlockhashNotFound, typeof InsufficientFundsForFee, typeof SimulationFailed]>;
|
|
120
|
+
/**
|
|
121
|
+
* @since 0.2.0
|
|
122
|
+
* @category reasons
|
|
123
|
+
*/
|
|
124
|
+
export type SolanaBroadcastReason = typeof SolanaBroadcastReason.Type;
|
|
125
|
+
declare const SolanaBroadcastError_base: Schema.Class<SolanaBroadcastError, Schema.TaggedStruct<"SolanaBroadcastError", {
|
|
126
|
+
readonly reason: Schema.Union<readonly [typeof BlockhashNotFound, typeof InsufficientFundsForFee, typeof SimulationFailed]>;
|
|
127
|
+
readonly cause: Schema.Defect;
|
|
128
|
+
}>, import("effect/Cause").YieldableError>;
|
|
129
|
+
/**
|
|
130
|
+
* A node refused the transaction at its preflight simulation for a `reason` the sender can act on: `cause` is the
|
|
131
|
+
* {@link SolanaRpc.SolanaRpcError} holding the node's message. Any other refusal stays a `SolanaRpcError`.
|
|
132
|
+
*
|
|
133
|
+
* @since 0.2.0
|
|
134
|
+
* @category errors
|
|
135
|
+
*/
|
|
136
|
+
export declare class SolanaBroadcastError extends SolanaBroadcastError_base {
|
|
137
|
+
}
|
|
138
|
+
declare const SolanaRelayer_base: Context.ServiceClass<SolanaRelayer, "@effect-blockchain/solana/SolanaRelayer", {
|
|
139
|
+
/**
|
|
140
|
+
* Signs a v0 transaction of `instructions` paid by `feePayer` without sending it. `signers` are the other accounts
|
|
141
|
+
* the instructions mark as signer. A missing `blockhash` is the latest one at `confirmed` commitment, a missing
|
|
142
|
+
* `computeUnitLimit` is the units a simulation consumed times the layer's `computeUnitMultiplier` (a transaction
|
|
143
|
+
* that would fail fails with `SimulationFailed`), and a missing `computeUnitPrice`, in micro-lamports, comes from
|
|
144
|
+
* the layer's fee strategy.
|
|
145
|
+
*/
|
|
146
|
+
readonly sign: (options: {
|
|
147
|
+
readonly feePayer: SolanaSigner;
|
|
148
|
+
readonly signers?: ReadonlyArray<SolanaSigner> | undefined;
|
|
149
|
+
readonly instructions: ReadonlyArray<SolanaInstruction>;
|
|
150
|
+
readonly blockhash?: Pick<SolanaRpc.SolanaLatestBlockhash, "blockhash" | "lastValidBlockHeight"> | undefined;
|
|
151
|
+
readonly computeUnitLimit?: number | undefined;
|
|
152
|
+
readonly computeUnitPrice?: bigint | undefined;
|
|
153
|
+
}) => Effect.Effect<SolanaSignedTransaction, SolanaRpc.SolanaRpcError | SolanaSignerError | SimulationFailed>;
|
|
154
|
+
/**
|
|
155
|
+
* Sends a signed transaction with `sendTransaction` and returns its hash. The node simulates it first at
|
|
156
|
+
* `confirmed` commitment, then rebroadcasts it to the leaders until its blockhash expires (the node's default
|
|
157
|
+
* `maxRetries`). Sending the same bytes again is safe: a node answering that it has already processed the
|
|
158
|
+
* transaction is a success.
|
|
159
|
+
*/
|
|
160
|
+
readonly broadcast: (options: {
|
|
161
|
+
readonly signed: string;
|
|
162
|
+
}) => Effect.Effect<SolanaTransactionHash, SolanaBroadcastError | SolanaRpc.SolanaRpcError>;
|
|
163
|
+
/**
|
|
164
|
+
* The status of the transaction as the answering endpoint sees it. An endpoint behind the head, or one that never
|
|
165
|
+
* received the transaction, answers `NotFound`, or `Expired` when `lastValidBlockHeight` has passed, for a
|
|
166
|
+
* transaction another one has in a block.
|
|
167
|
+
*/
|
|
168
|
+
readonly fetchTransactionStatus: (options: SolanaTransactionStatusOptions) => Effect.Effect<SolanaTransactionStatus, SolanaRpc.SolanaRpcError>;
|
|
169
|
+
/**
|
|
170
|
+
* Reads {@link fetchTransactionStatus} on `poll` (`Schedule.spaced(SolanaIndexer.DEFAULT_POLL_INTERVAL)` by
|
|
171
|
+
* default) until it is `Confirmed`, `Failed` or `Expired`, and returns it. `NotFound` keeps polling, so bound the
|
|
172
|
+
* wait with a timeout. A `poll` that ends first returns the last status read.
|
|
173
|
+
*/
|
|
174
|
+
readonly awaitConfirmation: (options: SolanaTransactionStatusOptions & {
|
|
175
|
+
readonly poll?: Schedule.Schedule<unknown> | undefined;
|
|
176
|
+
}) => Effect.Effect<SolanaTransactionStatus, SolanaRpc.SolanaRpcError>;
|
|
177
|
+
}>;
|
|
178
|
+
/**
|
|
179
|
+
* @since 0.2.0
|
|
180
|
+
* @category services
|
|
181
|
+
*/
|
|
182
|
+
export declare class SolanaRelayer extends SolanaRelayer_base {
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* The library's fee strategy: the compute unit price is the 75th percentile of the recent slots' prioritization fees,
|
|
186
|
+
* at least 1 micro-lamport.
|
|
187
|
+
*
|
|
188
|
+
* @since 0.2.0
|
|
189
|
+
* @category fees
|
|
190
|
+
*/
|
|
191
|
+
export declare const defaultFees: (fees: ReadonlyArray<SolanaRpc.SolanaPrioritizationFee>) => bigint;
|
|
192
|
+
/**
|
|
193
|
+
* Builds a {@link SolanaRelayer} over the provided {@link SolanaRpc.SolanaRpc}. `confirmations` overrides the
|
|
194
|
+
* network's default, as in `SolanaIndexer.layer`: both agree on the last confirmed slot. `fees` (default
|
|
195
|
+
* {@link defaultFees}) prices the transactions signed without a compute unit price, and `computeUnitMultiplier`
|
|
196
|
+
* (default 1.2) is the margin applied to a simulated compute unit limit.
|
|
197
|
+
*
|
|
198
|
+
* @since 0.2.0
|
|
199
|
+
* @category layers
|
|
200
|
+
*/
|
|
201
|
+
export declare const layer: (options?: {
|
|
202
|
+
readonly confirmations?: number | undefined;
|
|
203
|
+
readonly fees?: ((fees: ReadonlyArray<SolanaRpc.SolanaPrioritizationFee>) => bigint) | undefined;
|
|
204
|
+
readonly computeUnitMultiplier?: number | undefined;
|
|
205
|
+
}) => Layer.Layer<SolanaRelayer, never, SolanaRpc.SolanaRpc>;
|
|
206
|
+
export {};
|
|
207
|
+
//# sourceMappingURL=SolanaRelayer.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