@subsquid/solana-normalization 0.0.9 → 0.1.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/lib/instruction-parser.d.ts +48 -0
- package/lib/instruction-parser.d.ts.map +1 -0
- package/lib/instruction-parser.js +287 -0
- package/lib/instruction-parser.js.map +1 -0
- package/lib/mapping.d.ts +2 -1
- package/lib/mapping.d.ts.map +1 -1
- package/lib/mapping.js +90 -305
- package/lib/mapping.js.map +1 -1
- package/lib/transaction-context.d.ts +21 -0
- package/lib/transaction-context.d.ts.map +1 -0
- package/lib/transaction-context.js +81 -0
- package/lib/transaction-context.js.map +1 -0
- package/package.json +2 -2
- package/src/instruction-parser.ts +337 -0
- package/src/mapping.ts +103 -389
- package/src/transaction-context.ts +99 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as rpc from '@subsquid/solana-rpc-data';
|
|
2
|
+
import { Instruction, LogMessage } from './data';
|
|
3
|
+
import { Message } from './log-parser';
|
|
4
|
+
import { TransactionContext } from './transaction-context';
|
|
5
|
+
export declare class ParsingError {
|
|
6
|
+
msg: string;
|
|
7
|
+
instructionIndex?: number;
|
|
8
|
+
innerInstructionIndex?: number;
|
|
9
|
+
programId?: string;
|
|
10
|
+
logMessageIndex?: number;
|
|
11
|
+
constructor(msg: string);
|
|
12
|
+
}
|
|
13
|
+
export declare class MessageStream {
|
|
14
|
+
private messages;
|
|
15
|
+
private pos;
|
|
16
|
+
constructor(messages: string[]);
|
|
17
|
+
get unfinished(): boolean;
|
|
18
|
+
get ended(): boolean;
|
|
19
|
+
get truncated(): boolean;
|
|
20
|
+
get current(): Message;
|
|
21
|
+
get position(): number;
|
|
22
|
+
advance(): boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare class InstructionTreeTraversal {
|
|
25
|
+
private tx;
|
|
26
|
+
private messages;
|
|
27
|
+
private instructionIndex;
|
|
28
|
+
private output;
|
|
29
|
+
private log;
|
|
30
|
+
private lastAddress;
|
|
31
|
+
private instructions;
|
|
32
|
+
private pos;
|
|
33
|
+
constructor(tx: TransactionContext, messages: MessageStream, instructionIndex: number, instruction: rpc.Instruction, inner: rpc.Instruction[], output: Instruction[], log: LogMessage[]);
|
|
34
|
+
private call;
|
|
35
|
+
private invoke;
|
|
36
|
+
private eatInvokeLessSubCalls;
|
|
37
|
+
private takeInstructionMessages;
|
|
38
|
+
private dropNonInvokeMessages;
|
|
39
|
+
private finishLogLess;
|
|
40
|
+
private get current();
|
|
41
|
+
private get unfinished();
|
|
42
|
+
private get ended();
|
|
43
|
+
private assert;
|
|
44
|
+
private error;
|
|
45
|
+
private warn;
|
|
46
|
+
private push;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=instruction-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instruction-parser.d.ts","sourceRoot":"","sources":["../src/instruction-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,2BAA2B,CAAA;AAGhD,OAAO,EAAC,WAAW,EAAE,UAAU,EAAC,MAAM,QAAQ,CAAA;AAC9C,OAAO,EAAC,OAAO,EAAkB,MAAM,cAAc,CAAA;AACrD,OAAO,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAA;AAcxD,qBAAa,YAAY;IAMF,GAAG,EAAE,MAAM;IAL9B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,CAAC,EAAE,MAAM,CAAA;gBAEL,GAAG,EAAE,MAAM;CACjC;AAED,qBAAa,aAAa;IACtB,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,GAAG,CAAI;gBAEH,QAAQ,EAAE,MAAM,EAAE;IAI9B,IAAI,UAAU,IAAI,OAAO,CAExB;IAED,IAAI,KAAK,IAAI,OAAO,CAEnB;IAED,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,IAAI,OAAO,IAAI,OAAO,CAGrB;IAED,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,OAAO,IAAI,OAAO;CAKrB;AAED,qBAAa,wBAAwB;IAM7B,OAAO,CAAC,EAAE;IACV,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,gBAAgB;IAGxB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,GAAG;IAXf,OAAO,CAAC,WAAW,CAAU;IAC7B,OAAO,CAAC,YAAY,CAAmB;IACvC,OAAO,CAAC,GAAG,CAAI;gBAGH,EAAE,EAAE,kBAAkB,EACtB,QAAQ,EAAE,aAAa,EACvB,gBAAgB,EAAE,MAAM,EAChC,WAAW,EAAE,GAAG,CAAC,WAAW,EAC5B,KAAK,EAAE,GAAG,CAAC,WAAW,EAAE,EAChB,MAAM,EAAE,WAAW,EAAE,EACrB,GAAG,EAAE,UAAU,EAAE;IAc7B,OAAO,CAAC,IAAI;IA4CZ,OAAO,CAAC,MAAM;IA8Bd,OAAO,CAAC,qBAAqB;IAqC7B,OAAO,CAAC,uBAAuB;IAqC/B,OAAO,CAAC,qBAAqB;IAoB7B,OAAO,CAAC,aAAa;IAMrB,OAAO,KAAK,OAAO,GAGlB;IAED,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,KAAK,KAAK,GAEhB;IAED,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,KAAK;IAab,OAAO,CAAC,IAAI;IAKZ,OAAO,CAAC,IAAI;CAqCf"}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.InstructionTreeTraversal = exports.MessageStream = exports.ParsingError = void 0;
|
|
7
|
+
const util_internal_1 = require("@subsquid/util-internal");
|
|
8
|
+
const assert_1 = __importDefault(require("assert"));
|
|
9
|
+
const log_parser_1 = require("./log-parser");
|
|
10
|
+
const PROGRAMS_MISSING_INVOKE_LOG = new Set([
|
|
11
|
+
'AddressLookupTab1e1111111111111111111111111',
|
|
12
|
+
'BPFLoader1111111111111111111111111111111111',
|
|
13
|
+
'BPFLoader2111111111111111111111111111111111',
|
|
14
|
+
'BPFLoaderUpgradeab1e11111111111111111111111',
|
|
15
|
+
'Ed25519SigVerify111111111111111111111111111',
|
|
16
|
+
'KeccakSecp256k11111111111111111111111111111',
|
|
17
|
+
'NativeLoader1111111111111111111111111111111',
|
|
18
|
+
'ZkTokenProof1111111111111111111111111111111',
|
|
19
|
+
'Secp256r1SigVerify1111111111111111111111111',
|
|
20
|
+
]);
|
|
21
|
+
class ParsingError {
|
|
22
|
+
constructor(msg) {
|
|
23
|
+
this.msg = msg;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.ParsingError = ParsingError;
|
|
27
|
+
class MessageStream {
|
|
28
|
+
constructor(messages) {
|
|
29
|
+
this.pos = 0;
|
|
30
|
+
this.messages = messages.map(log_parser_1.parseLogMessage);
|
|
31
|
+
}
|
|
32
|
+
get unfinished() {
|
|
33
|
+
return !this.ended;
|
|
34
|
+
}
|
|
35
|
+
get ended() {
|
|
36
|
+
return this.pos >= this.messages.length || this.messages[this.pos].kind == 'truncate';
|
|
37
|
+
}
|
|
38
|
+
get truncated() {
|
|
39
|
+
return this.pos < this.messages.length && this.messages[this.pos].kind == 'truncate';
|
|
40
|
+
}
|
|
41
|
+
get current() {
|
|
42
|
+
(0, assert_1.default)(this.pos < this.messages.length, 'eof reached');
|
|
43
|
+
return this.messages[this.pos];
|
|
44
|
+
}
|
|
45
|
+
get position() {
|
|
46
|
+
return this.pos;
|
|
47
|
+
}
|
|
48
|
+
advance() {
|
|
49
|
+
if (this.truncated)
|
|
50
|
+
return false;
|
|
51
|
+
this.pos = Math.min(this.pos + 1, this.messages.length);
|
|
52
|
+
return this.pos < this.messages.length;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.MessageStream = MessageStream;
|
|
56
|
+
class InstructionTreeTraversal {
|
|
57
|
+
constructor(tx, messages, instructionIndex, instruction, inner, output, log) {
|
|
58
|
+
this.tx = tx;
|
|
59
|
+
this.messages = messages;
|
|
60
|
+
this.instructionIndex = instructionIndex;
|
|
61
|
+
this.output = output;
|
|
62
|
+
this.log = log;
|
|
63
|
+
this.pos = 0;
|
|
64
|
+
this.lastAddress = [instructionIndex - 1];
|
|
65
|
+
this.instructions = [{ ...instruction, stackHeight: 1 }, ...inner];
|
|
66
|
+
if (this.tx.erroredInstruction >= this.instructionIndex) {
|
|
67
|
+
this.call(1);
|
|
68
|
+
this.finishLogLess();
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
this.assert(this.instructions.length === 1, 'failed instructions should not have inner calls', 0);
|
|
72
|
+
this.push(1);
|
|
73
|
+
}
|
|
74
|
+
this.assert(this.ended, 'not all inner instructions where consumed', 0);
|
|
75
|
+
}
|
|
76
|
+
call(stackHeight) {
|
|
77
|
+
let ins = this.current;
|
|
78
|
+
this.assert(ins.stackHeight == null || ins.stackHeight === stackHeight, 'stack height mismatch', this.pos);
|
|
79
|
+
let programId = this.tx.getAccount(ins.programIdIndex);
|
|
80
|
+
if (this.messages.unfinished &&
|
|
81
|
+
this.messages.current.kind === 'invoke' &&
|
|
82
|
+
this.messages.current.programId === programId) {
|
|
83
|
+
this.assert(this.messages.current.stackHeight === stackHeight, 'invoke message has unexpected stack height', this.pos, this.messages.position);
|
|
84
|
+
this.messages.advance();
|
|
85
|
+
this.invoke(stackHeight);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (this.messages.truncated) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (PROGRAMS_MISSING_INVOKE_LOG.has(programId)) {
|
|
92
|
+
}
|
|
93
|
+
else if (this.tx.couldFailBeforeInvokeMessage &&
|
|
94
|
+
this.tx.erroredInstruction == this.instructionIndex &&
|
|
95
|
+
this.pos + 1 == this.instructions.length) {
|
|
96
|
+
// instruction processing has not reached 'invoke message' logging point
|
|
97
|
+
}
|
|
98
|
+
else if (this.messages.ended) {
|
|
99
|
+
this.warn('unexpected end of message log', this.pos);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
this.warn('missing invoke message', this.pos, this.messages.position);
|
|
103
|
+
}
|
|
104
|
+
this.push(stackHeight).hasDroppedLogMessages = true;
|
|
105
|
+
this.dropNonInvokeMessages();
|
|
106
|
+
}
|
|
107
|
+
invoke(stackHeight) {
|
|
108
|
+
let pos = this.pos;
|
|
109
|
+
let ins = this.push(stackHeight);
|
|
110
|
+
this.takeInstructionMessages(ins, pos);
|
|
111
|
+
if (this.messages.truncated) {
|
|
112
|
+
ins.hasDroppedLogMessages = true;
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (this.messages.ended) {
|
|
116
|
+
throw this.error('unexpected end of log', pos);
|
|
117
|
+
}
|
|
118
|
+
let result = this.messages.current;
|
|
119
|
+
(0, assert_1.default)(result.kind === 'invoke-result');
|
|
120
|
+
this.assert(result.programId === ins.programId, "invoke result message and instruction program ids don't match", pos);
|
|
121
|
+
ins.error = result.error;
|
|
122
|
+
this.messages.advance();
|
|
123
|
+
// consume invoke-less subcalls,
|
|
124
|
+
// that might have left unvisited due to missing 'invoke' messages
|
|
125
|
+
this.eatInvokeLessSubCalls(ins);
|
|
126
|
+
}
|
|
127
|
+
eatInvokeLessSubCalls(parent) {
|
|
128
|
+
while (this.unfinished) {
|
|
129
|
+
let stackHeight;
|
|
130
|
+
if (this.current.stackHeight == null) {
|
|
131
|
+
if (parent.error) {
|
|
132
|
+
// all remaining calls must belong to the given parent
|
|
133
|
+
stackHeight = parent.instructionAddress.length + 1;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
stackHeight = 2;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
stackHeight = this.current.stackHeight;
|
|
141
|
+
}
|
|
142
|
+
if (stackHeight <= parent.instructionAddress.length)
|
|
143
|
+
return;
|
|
144
|
+
let pos = this.pos;
|
|
145
|
+
let ins = this.push(stackHeight);
|
|
146
|
+
// even if we have some messages emitted,
|
|
147
|
+
// we already assigned them to parent call
|
|
148
|
+
ins.hasDroppedLogMessages = true;
|
|
149
|
+
if (PROGRAMS_MISSING_INVOKE_LOG.has(ins.programId)) {
|
|
150
|
+
// all good, it is expected to not have 'invoke' message
|
|
151
|
+
}
|
|
152
|
+
else if (this.tx.couldFailBeforeInvokeMessage &&
|
|
153
|
+
this.tx.erroredInstruction == this.instructionIndex &&
|
|
154
|
+
this.ended) {
|
|
155
|
+
// instruction processing has not reached 'invoke message' logging point
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
this.warn('missing invoke message for inner instruction', pos);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
takeInstructionMessages(ins, pos) {
|
|
163
|
+
while (this.messages.unfinished) {
|
|
164
|
+
let msg = this.messages.current;
|
|
165
|
+
switch (msg.kind) {
|
|
166
|
+
case 'log':
|
|
167
|
+
case 'data':
|
|
168
|
+
case 'other':
|
|
169
|
+
this.log.push({
|
|
170
|
+
transactionIndex: this.tx.transactionIndex,
|
|
171
|
+
logIndex: this.messages.position,
|
|
172
|
+
instructionAddress: ins.instructionAddress,
|
|
173
|
+
programId: ins.programId,
|
|
174
|
+
kind: msg.kind,
|
|
175
|
+
message: msg.message,
|
|
176
|
+
});
|
|
177
|
+
this.messages.advance();
|
|
178
|
+
break;
|
|
179
|
+
case 'cu':
|
|
180
|
+
if (ins.programId == msg.programId) {
|
|
181
|
+
ins.computeUnitsConsumed = msg.consumed;
|
|
182
|
+
this.messages.advance();
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
throw this.error('unexpected programId in compute unit message', pos, this.messages.position);
|
|
186
|
+
}
|
|
187
|
+
break;
|
|
188
|
+
case 'invoke':
|
|
189
|
+
this.call(ins.instructionAddress.length + 1);
|
|
190
|
+
break;
|
|
191
|
+
case 'invoke-result':
|
|
192
|
+
case 'truncate':
|
|
193
|
+
return;
|
|
194
|
+
default:
|
|
195
|
+
throw (0, util_internal_1.unexpectedCase)();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
dropNonInvokeMessages() {
|
|
200
|
+
while (this.messages.unfinished) {
|
|
201
|
+
let msg = this.messages.current;
|
|
202
|
+
switch (msg.kind) {
|
|
203
|
+
case 'log':
|
|
204
|
+
case 'data':
|
|
205
|
+
case 'cu':
|
|
206
|
+
case 'other':
|
|
207
|
+
this.messages.advance();
|
|
208
|
+
break;
|
|
209
|
+
case 'invoke':
|
|
210
|
+
case 'invoke-result':
|
|
211
|
+
case 'truncate':
|
|
212
|
+
return;
|
|
213
|
+
default:
|
|
214
|
+
throw (0, util_internal_1.unexpectedCase)();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
finishLogLess() {
|
|
219
|
+
while (this.unfinished) {
|
|
220
|
+
this.push(this.current.stackHeight ?? 2).hasDroppedLogMessages = true;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
get current() {
|
|
224
|
+
(0, assert_1.default)(this.pos < this.instructions.length);
|
|
225
|
+
return this.instructions[this.pos];
|
|
226
|
+
}
|
|
227
|
+
get unfinished() {
|
|
228
|
+
return this.pos < this.instructions.length;
|
|
229
|
+
}
|
|
230
|
+
get ended() {
|
|
231
|
+
return !this.unfinished;
|
|
232
|
+
}
|
|
233
|
+
assert(ok, msg, pos, messagePos) {
|
|
234
|
+
if (!ok)
|
|
235
|
+
throw this.error(msg, pos, messagePos);
|
|
236
|
+
}
|
|
237
|
+
error(msg, pos, messagePos) {
|
|
238
|
+
let err = new ParsingError(msg);
|
|
239
|
+
err.instructionIndex = this.instructionIndex;
|
|
240
|
+
if (pos) {
|
|
241
|
+
err.innerInstructionIndex = pos - 1;
|
|
242
|
+
}
|
|
243
|
+
err.programId = this.tx.getAccount(this.instructions[pos].programIdIndex);
|
|
244
|
+
if (messagePos != null) {
|
|
245
|
+
err.logMessageIndex = messagePos;
|
|
246
|
+
}
|
|
247
|
+
return err;
|
|
248
|
+
}
|
|
249
|
+
warn(msg, pos, messagePos) {
|
|
250
|
+
let { msg: message, ...props } = this.error(msg, pos, messagePos);
|
|
251
|
+
this.tx.warn(props, message);
|
|
252
|
+
}
|
|
253
|
+
push(stackHeight) {
|
|
254
|
+
(0, assert_1.default)(stackHeight > 0);
|
|
255
|
+
let ins = this.current;
|
|
256
|
+
if (ins.stackHeight != null) {
|
|
257
|
+
(0, assert_1.default)(stackHeight === ins.stackHeight);
|
|
258
|
+
}
|
|
259
|
+
let address = this.lastAddress.slice();
|
|
260
|
+
while (address.length > stackHeight) {
|
|
261
|
+
address.pop();
|
|
262
|
+
}
|
|
263
|
+
if (address.length === stackHeight) {
|
|
264
|
+
address[stackHeight - 1] += 1;
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
(0, assert_1.default)(address.length + 1 == stackHeight);
|
|
268
|
+
address[stackHeight - 1] = 0;
|
|
269
|
+
}
|
|
270
|
+
(0, assert_1.default)(address[0] === this.instructionIndex);
|
|
271
|
+
let mapped = {
|
|
272
|
+
transactionIndex: this.tx.transactionIndex,
|
|
273
|
+
instructionAddress: address,
|
|
274
|
+
programId: this.tx.getAccount(ins.programIdIndex),
|
|
275
|
+
accounts: ins.accounts.map((a) => this.tx.getAccount(a)),
|
|
276
|
+
data: ins.data,
|
|
277
|
+
isCommitted: this.tx.isCommitted,
|
|
278
|
+
hasDroppedLogMessages: false,
|
|
279
|
+
};
|
|
280
|
+
this.output.push(mapped);
|
|
281
|
+
this.lastAddress = address;
|
|
282
|
+
this.pos = Math.min(this.pos + 1, this.instructions.length);
|
|
283
|
+
return mapped;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
exports.InstructionTreeTraversal = InstructionTreeTraversal;
|
|
287
|
+
//# sourceMappingURL=instruction-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instruction-parser.js","sourceRoot":"","sources":["../src/instruction-parser.ts"],"names":[],"mappings":";;;;;;AACA,2DAAsD;AACtD,oDAA2B;AAE3B,6CAAqD;AAGrD,MAAM,2BAA2B,GAAG,IAAI,GAAG,CAAC;IACxC,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;CAChD,CAAC,CAAA;AAEF,MAAa,YAAY;IAMrB,YAAmB,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;IAAG,CAAC;CACrC;AAPD,oCAOC;AAED,MAAa,aAAa;IAItB,YAAY,QAAkB;QAFtB,QAAG,GAAG,CAAC,CAAA;QAGX,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,4BAAe,CAAC,CAAA;IACjD,CAAC;IAED,IAAI,UAAU;QACV,OAAO,CAAC,IAAI,CAAC,KAAK,CAAA;IACtB,CAAC;IAED,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,UAAU,CAAA;IACzF,CAAC;IAED,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,UAAU,CAAA;IACxF,CAAC;IAED,IAAI,OAAO;QACP,IAAA,gBAAM,EAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;QACtD,OAAO,IAAI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solana-rpc-data';
|
|
2
2
|
import { Block } from './data';
|
|
3
|
-
|
|
3
|
+
import { Journal } from './transaction-context';
|
|
4
|
+
export declare function mapRpcBlock(src: rpc.Block, journal: Journal): Block;
|
|
4
5
|
//# sourceMappingURL=mapping.d.ts.map
|
package/lib/mapping.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../src/mapping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,2BAA2B,CAAA;AAIrD,OAAO,EAAU,KAAK,EAA0E,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../src/mapping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,2BAA2B,CAAA;AAIrD,OAAO,EAAU,KAAK,EAA0E,MAAM,QAAQ,CAAA;AAE9G,OAAO,EAAC,OAAO,EAAqB,MAAM,uBAAuB,CAAA;AAIjE,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,KAAK,CAuCnE"}
|