soroban-events 2.0.1 → 2.0.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/package.json +1 -1
- package/src/cli.js +33 -13
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -141,23 +141,43 @@ program
|
|
|
141
141
|
);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
null,
|
|
148
|
-
2
|
|
149
|
-
) + '\n'
|
|
150
|
-
);
|
|
151
|
-
|
|
152
|
-
if (!response.ok) {
|
|
153
|
-
process.exitCode = 1;
|
|
154
|
-
}
|
|
144
|
+
const rpcError =
|
|
145
|
+
parsed &&
|
|
146
|
+
parsed.error;
|
|
155
147
|
|
|
156
148
|
if (
|
|
157
|
-
|
|
158
|
-
|
|
149
|
+
response.ok === false ||
|
|
150
|
+
rpcError
|
|
159
151
|
) {
|
|
152
|
+
process.stdout.write(
|
|
153
|
+
JSON.stringify(
|
|
154
|
+
rpcError ?? {
|
|
155
|
+
status: response.status,
|
|
156
|
+
statusText: response.statusText
|
|
157
|
+
},
|
|
158
|
+
null,
|
|
159
|
+
2
|
|
160
|
+
) + '\n'
|
|
161
|
+
);
|
|
162
|
+
|
|
160
163
|
process.exitCode = 1;
|
|
164
|
+
} else {
|
|
165
|
+
const sequence =
|
|
166
|
+
parsed &&
|
|
167
|
+
parsed.result &&
|
|
168
|
+
parsed.result.sequence;
|
|
169
|
+
|
|
170
|
+
if (
|
|
171
|
+
sequence === undefined
|
|
172
|
+
) {
|
|
173
|
+
throw new Error(
|
|
174
|
+
'RPC response did not contain result.sequence'
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
process.stdout.write(
|
|
179
|
+
`${sequence}\n`
|
|
180
|
+
);
|
|
161
181
|
}
|
|
162
182
|
}
|
|
163
183
|
);
|