envio 3.0.1 → 3.0.2-svm-alpha.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/evm.schema.json +8 -8
- package/fuel.schema.json +12 -12
- package/index.d.ts +155 -1
- package/package.json +6 -7
- package/src/ChainFetcher.res +25 -1
- package/src/ChainFetcher.res.mjs +19 -1
- package/src/Config.res +156 -94
- package/src/Config.res.mjs +60 -97
- package/src/Core.res +32 -0
- package/src/Env.res.mjs +1 -2
- package/src/Envio.res +94 -0
- package/src/EventConfigBuilder.res +50 -0
- package/src/EventConfigBuilder.res.mjs +31 -0
- package/src/HandlerLoader.res +12 -1
- package/src/HandlerLoader.res.mjs +6 -1
- package/src/Internal.res +38 -0
- package/src/Main.res +53 -3
- package/src/Main.res.mjs +34 -2
- package/src/Persistence.res +2 -17
- package/src/Persistence.res.mjs +2 -14
- package/src/SimulateItems.res +23 -10
- package/src/SimulateItems.res.mjs +21 -6
- package/src/SvmTypes.res +9 -0
- package/src/SvmTypes.res.mjs +14 -0
- package/src/sources/EventRouter.res +65 -0
- package/src/sources/EventRouter.res.mjs +43 -0
- package/src/sources/HyperSyncClient.res +30 -157
- package/src/sources/HyperSyncClient.res.mjs +20 -6
- package/src/sources/HyperSyncSolanaClient.res +227 -0
- package/src/sources/HyperSyncSolanaClient.res.mjs +25 -0
- package/src/sources/HyperSyncSolanaSource.res +515 -0
- package/src/sources/HyperSyncSolanaSource.res.mjs +441 -0
- package/src/sources/HyperSyncSource.res +5 -8
- package/src/sources/HyperSyncSource.res.mjs +1 -8
- package/src/sources/RpcSource.res.mjs +1 -1
- package/src/sources/Svm.res +2 -2
- package/src/sources/Svm.res.mjs +3 -2
- package/src/tui/Tui.res +9 -2
- package/src/tui/Tui.res.mjs +19 -4
- package/src/tui/components/TuiData.res +3 -0
- package/svm.schema.json +345 -4
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
type cfg = {
|
|
2
|
+
/** HyperSync server URL. */
|
|
3
|
+
url: string,
|
|
4
|
+
/** Optional bearer token for the HyperSync server. */
|
|
5
|
+
apiToken?: string,
|
|
6
|
+
httpReqTimeoutMillis?: int,
|
|
7
|
+
maxNumRetries?: int,
|
|
8
|
+
retryBaseMs?: int,
|
|
9
|
+
retryCeilingMs?: int,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
module QueryTypes = {
|
|
13
|
+
type blockField =
|
|
14
|
+
| @as("slot") Slot
|
|
15
|
+
| @as("blockhash") Blockhash
|
|
16
|
+
| @as("parent_slot") ParentSlot
|
|
17
|
+
| @as("parent_blockhash") ParentBlockhash
|
|
18
|
+
| @as("block_time") BlockTime
|
|
19
|
+
| @as("block_height") BlockHeight
|
|
20
|
+
|
|
21
|
+
type transactionField =
|
|
22
|
+
| @as("slot") Slot
|
|
23
|
+
| @as("transaction_index") TransactionIndex
|
|
24
|
+
| @as("signatures") Signatures
|
|
25
|
+
| @as("fee_payer") FeePayer
|
|
26
|
+
| @as("success") Success
|
|
27
|
+
| @as("err") Err
|
|
28
|
+
| @as("fee") Fee
|
|
29
|
+
| @as("compute_units_consumed") ComputeUnitsConsumed
|
|
30
|
+
| @as("account_keys") AccountKeys
|
|
31
|
+
| @as("recent_blockhash") RecentBlockhash
|
|
32
|
+
| @as("version") Version
|
|
33
|
+
| @as("loaded_addresses_writable") LoadedAddressesWritable
|
|
34
|
+
| @as("loaded_addresses_readonly") LoadedAddressesReadonly
|
|
35
|
+
|
|
36
|
+
type instructionField =
|
|
37
|
+
| @as("slot") Slot
|
|
38
|
+
| @as("transaction_index") TransactionIndex
|
|
39
|
+
| @as("instruction_address") InstructionAddress
|
|
40
|
+
| @as("program_id") ProgramId
|
|
41
|
+
| @as("accounts") Accounts
|
|
42
|
+
| @as("data") Data
|
|
43
|
+
| @as("d1") D1
|
|
44
|
+
| @as("d2") D2
|
|
45
|
+
| @as("d4") D4
|
|
46
|
+
| @as("d8") D8
|
|
47
|
+
| @as("a0") A0
|
|
48
|
+
| @as("a1") A1
|
|
49
|
+
| @as("a2") A2
|
|
50
|
+
| @as("a3") A3
|
|
51
|
+
| @as("a4") A4
|
|
52
|
+
| @as("a5") A5
|
|
53
|
+
| @as("a6") A6
|
|
54
|
+
| @as("a7") A7
|
|
55
|
+
| @as("a8") A8
|
|
56
|
+
| @as("a9") A9
|
|
57
|
+
| @as("is_inner") IsInner
|
|
58
|
+
| @as("is_committed") IsCommitted
|
|
59
|
+
|
|
60
|
+
type logField =
|
|
61
|
+
| @as("slot") Slot
|
|
62
|
+
| @as("transaction_index") TransactionIndex
|
|
63
|
+
| @as("instruction_address") InstructionAddress
|
|
64
|
+
| @as("program_id") ProgramId
|
|
65
|
+
| @as("kind") Kind
|
|
66
|
+
| @as("message") Message
|
|
67
|
+
|
|
68
|
+
type fieldSelection = {
|
|
69
|
+
block?: array<blockField>,
|
|
70
|
+
transaction?: array<transactionField>,
|
|
71
|
+
instruction?: array<instructionField>,
|
|
72
|
+
log?: array<logField>,
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Filter for selecting instructions. All non-empty fields are AND-ed: an
|
|
76
|
+
instruction must match at least one value in every non-empty field.
|
|
77
|
+
|
|
78
|
+
Discriminator filters (d1..d8) take hex-encoded byte prefixes ("0x" optional).
|
|
79
|
+
Account filters (a0..a9) take base58 pubkey strings. */
|
|
80
|
+
type instructionSelection = {
|
|
81
|
+
programId?: array<string>,
|
|
82
|
+
d1?: array<string>,
|
|
83
|
+
d2?: array<string>,
|
|
84
|
+
d4?: array<string>,
|
|
85
|
+
d8?: array<string>,
|
|
86
|
+
a0?: array<string>,
|
|
87
|
+
a1?: array<string>,
|
|
88
|
+
a2?: array<string>,
|
|
89
|
+
a3?: array<string>,
|
|
90
|
+
a4?: array<string>,
|
|
91
|
+
a5?: array<string>,
|
|
92
|
+
a6?: array<string>,
|
|
93
|
+
a7?: array<string>,
|
|
94
|
+
a8?: array<string>,
|
|
95
|
+
a9?: array<string>,
|
|
96
|
+
isInner?: bool,
|
|
97
|
+
includeTransaction?: bool,
|
|
98
|
+
includeLogs?: bool,
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
type transactionSelection = {
|
|
102
|
+
feePayer?: array<string>,
|
|
103
|
+
success?: bool,
|
|
104
|
+
includeInstructions?: bool,
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
type logSelection = {
|
|
108
|
+
programId?: array<string>,
|
|
109
|
+
kind?: array<string>,
|
|
110
|
+
includeTransaction?: bool,
|
|
111
|
+
includeInstruction?: bool,
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
type query = {
|
|
115
|
+
fromSlot: int,
|
|
116
|
+
toSlot?: int,
|
|
117
|
+
instructions?: array<instructionSelection>,
|
|
118
|
+
transactions?: array<transactionSelection>,
|
|
119
|
+
logs?: array<logSelection>,
|
|
120
|
+
includeAllBlocks?: bool,
|
|
121
|
+
fields?: fieldSelection,
|
|
122
|
+
maxNumBlocks?: int,
|
|
123
|
+
maxNumTransactions?: int,
|
|
124
|
+
maxNumInstructions?: int,
|
|
125
|
+
maxNumLogs?: int,
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
module ResponseTypes = {
|
|
130
|
+
type block = {
|
|
131
|
+
slot: int,
|
|
132
|
+
blockhash: string,
|
|
133
|
+
parentSlot?: int,
|
|
134
|
+
parentBlockhash?: string,
|
|
135
|
+
blockTime?: int,
|
|
136
|
+
blockHeight?: int,
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
type transaction = {
|
|
140
|
+
slot: int,
|
|
141
|
+
transactionIndex: int,
|
|
142
|
+
signatures: array<string>,
|
|
143
|
+
feePayer?: string,
|
|
144
|
+
success?: bool,
|
|
145
|
+
err?: string,
|
|
146
|
+
fee?: int,
|
|
147
|
+
computeUnitsConsumed?: int,
|
|
148
|
+
accountKeys: array<string>,
|
|
149
|
+
recentBlockhash?: string,
|
|
150
|
+
version?: string,
|
|
151
|
+
loadedAddressesWritable: array<string>,
|
|
152
|
+
loadedAddressesReadonly: array<string>,
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Solana instruction record.
|
|
156
|
+
|
|
157
|
+
`data` is the raw instruction byte buffer, hex-encoded with a `0x` prefix.
|
|
158
|
+
`d1`..`d8` are the same byte prefix as `data` but truncated to N bytes
|
|
159
|
+
(only `Some` when the instruction is at least that long), exposed for
|
|
160
|
+
handler-dispatch convenience.
|
|
161
|
+
`accounts` is the full positional account list in base58. */
|
|
162
|
+
type instruction = {
|
|
163
|
+
slot: int,
|
|
164
|
+
transactionIndex: int,
|
|
165
|
+
instructionAddress: array<int>,
|
|
166
|
+
programId: string,
|
|
167
|
+
accounts: array<string>,
|
|
168
|
+
data: string,
|
|
169
|
+
d1?: string,
|
|
170
|
+
d2?: string,
|
|
171
|
+
d4?: string,
|
|
172
|
+
d8?: string,
|
|
173
|
+
isInner: bool,
|
|
174
|
+
isCommitted: bool,
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
type log = {
|
|
178
|
+
slot: int,
|
|
179
|
+
transactionIndex?: int,
|
|
180
|
+
instructionAddress?: array<int>,
|
|
181
|
+
programId?: string,
|
|
182
|
+
kind?: string,
|
|
183
|
+
message?: string,
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
type queryResponseData = {
|
|
187
|
+
blocks: array<block>,
|
|
188
|
+
transactions: array<transaction>,
|
|
189
|
+
instructions: array<instruction>,
|
|
190
|
+
logs: array<log>,
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
type queryResponse = {
|
|
194
|
+
nextSlot: int,
|
|
195
|
+
responseBytes: int,
|
|
196
|
+
data: queryResponseData,
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
type query = QueryTypes.query
|
|
201
|
+
type queryResponse = ResponseTypes.queryResponse
|
|
202
|
+
|
|
203
|
+
type t = {
|
|
204
|
+
getHeight: unit => promise<int>,
|
|
205
|
+
get: (~query: query) => promise<queryResponse>,
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
@send
|
|
209
|
+
external classFromConfig: (Core.hypersyncSolanaClientCtor, cfg) => t = "fromConfig"
|
|
210
|
+
|
|
211
|
+
let make = (
|
|
212
|
+
~url,
|
|
213
|
+
~apiToken=?,
|
|
214
|
+
~httpReqTimeoutMillis=?,
|
|
215
|
+
~maxNumRetries=?,
|
|
216
|
+
~retryBaseMs=?,
|
|
217
|
+
~retryCeilingMs=?,
|
|
218
|
+
) => {
|
|
219
|
+
Core.getAddon().hypersyncSolanaClient->classFromConfig({
|
|
220
|
+
url,
|
|
221
|
+
?apiToken,
|
|
222
|
+
?httpReqTimeoutMillis,
|
|
223
|
+
?maxNumRetries,
|
|
224
|
+
?retryBaseMs,
|
|
225
|
+
?retryCeilingMs,
|
|
226
|
+
})
|
|
227
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Core from "../Core.res.mjs";
|
|
4
|
+
|
|
5
|
+
let QueryTypes = {};
|
|
6
|
+
|
|
7
|
+
let ResponseTypes = {};
|
|
8
|
+
|
|
9
|
+
function make(url, apiToken, httpReqTimeoutMillis, maxNumRetries, retryBaseMs, retryCeilingMs) {
|
|
10
|
+
return Core.getAddon().HypersyncSolanaClient.fromConfig({
|
|
11
|
+
url: url,
|
|
12
|
+
apiToken: apiToken,
|
|
13
|
+
httpReqTimeoutMillis: httpReqTimeoutMillis,
|
|
14
|
+
maxNumRetries: maxNumRetries,
|
|
15
|
+
retryBaseMs: retryBaseMs,
|
|
16
|
+
retryCeilingMs: retryCeilingMs
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
QueryTypes,
|
|
22
|
+
ResponseTypes,
|
|
23
|
+
make,
|
|
24
|
+
}
|
|
25
|
+
/* Core Not a pure module */
|