phantasma-sdk-ts 0.8.2 → 0.9.1

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.
Files changed (36) hide show
  1. package/dist/cjs/rpc/phantasma.js +162 -21
  2. package/dist/cjs/types/carbon-serialization.js +38 -29
  3. package/dist/esm/rpc/phantasma.js +161 -20
  4. package/dist/esm/types/carbon-serialization.js +38 -29
  5. package/dist/types/rpc/interfaces/account.d.ts +2 -2
  6. package/dist/types/rpc/interfaces/account.d.ts.map +1 -1
  7. package/dist/types/rpc/interfaces/archive.d.ts +5 -5
  8. package/dist/types/rpc/interfaces/archive.d.ts.map +1 -1
  9. package/dist/types/rpc/interfaces/block.d.ts +2 -2
  10. package/dist/types/rpc/interfaces/block.d.ts.map +1 -1
  11. package/dist/types/rpc/interfaces/chain.d.ts +6 -6
  12. package/dist/types/rpc/interfaces/chain.d.ts.map +1 -1
  13. package/dist/types/rpc/interfaces/contract.d.ts +1 -1
  14. package/dist/types/rpc/interfaces/contract.d.ts.map +1 -1
  15. package/dist/types/rpc/interfaces/leaderboard.d.ts +2 -2
  16. package/dist/types/rpc/interfaces/leaderboard.d.ts.map +1 -1
  17. package/dist/types/rpc/interfaces/nexus.d.ts +7 -7
  18. package/dist/types/rpc/interfaces/nexus.d.ts.map +1 -1
  19. package/dist/types/rpc/interfaces/nft.d.ts +2 -1
  20. package/dist/types/rpc/interfaces/nft.d.ts.map +1 -1
  21. package/dist/types/rpc/interfaces/organization.d.ts +3 -3
  22. package/dist/types/rpc/interfaces/organization.d.ts.map +1 -1
  23. package/dist/types/rpc/interfaces/signature-result.d.ts +2 -2
  24. package/dist/types/rpc/interfaces/token-data.d.ts +2 -1
  25. package/dist/types/rpc/interfaces/token-data.d.ts.map +1 -1
  26. package/dist/types/rpc/interfaces/token-series-result.d.ts +7 -4
  27. package/dist/types/rpc/interfaces/token-series-result.d.ts.map +1 -1
  28. package/dist/types/rpc/interfaces/token.d.ts +3 -1
  29. package/dist/types/rpc/interfaces/token.d.ts.map +1 -1
  30. package/dist/types/rpc/interfaces/transaction-data.d.ts +1 -1
  31. package/dist/types/rpc/interfaces/transaction-data.d.ts.map +1 -1
  32. package/dist/types/rpc/phantasma.d.ts +10 -2
  33. package/dist/types/rpc/phantasma.d.ts.map +1 -1
  34. package/dist/types/types/carbon-serialization.d.ts +2 -0
  35. package/dist/types/types/carbon-serialization.d.ts.map +1 -1
  36. package/package.json +3 -2
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PhantasmaAPI = void 0;
6
+ exports.PhantasmaAPI = exports.DEFAULT_MAX_RPC_RESPONSE_BYTES = void 0;
7
7
  const logger_js_1 = require("../utils/logger.js");
8
8
  const cross_fetch_1 = __importDefault(require("cross-fetch"));
9
9
  const rpc_result_js_1 = require("./rpc-result.js");
@@ -17,10 +17,120 @@ function rpcHttpError(status, statusText) {
17
17
  statusText,
18
18
  };
19
19
  }
20
+ exports.DEFAULT_MAX_RPC_RESPONSE_BYTES = 16 * 1024 * 1024;
20
21
  function parseRpcNumber(result) {
21
22
  return typeof result === 'string' ? parseInt(result, 10) : result;
22
23
  }
24
+ function rpcResponseIdMatches(responseId, requestId) {
25
+ if (typeof responseId === 'string') {
26
+ return responseId === requestId;
27
+ }
28
+ if (typeof responseId === 'number' && Number.isInteger(responseId)) {
29
+ return String(responseId) === requestId;
30
+ }
31
+ return false;
32
+ }
33
+ function normalizeMaxRpcResponseBytes(value) {
34
+ const maxBytes = value ?? exports.DEFAULT_MAX_RPC_RESPONSE_BYTES;
35
+ if (maxBytes !== Number.POSITIVE_INFINITY && (!Number.isFinite(maxBytes) || maxBytes <= 0)) {
36
+ throw new Error('maxRpcResponseBytes must be a positive number');
37
+ }
38
+ return maxBytes;
39
+ }
40
+ function isObject(value) {
41
+ return typeof value === 'object' && value !== null;
42
+ }
43
+ function isWebReadableStream(value) {
44
+ return (isObject(value) &&
45
+ 'getReader' in value &&
46
+ typeof value.getReader === 'function');
47
+ }
48
+ function isAsyncIterableBody(value) {
49
+ return isObject(value) && Symbol.asyncIterator in value;
50
+ }
51
+ function chunkBytes(chunk) {
52
+ return typeof chunk === 'string' ? new TextEncoder().encode(chunk) : chunk;
53
+ }
54
+ function appendLimitedChunk(chunks, chunk, totalBytes, maxBytes, method) {
55
+ const bytes = chunkBytes(chunk);
56
+ const nextTotal = totalBytes + bytes.byteLength;
57
+ if (nextTotal > maxBytes) {
58
+ throw new Error(`RPC request ${method} response body exceeds ${maxBytes} bytes`);
59
+ }
60
+ chunks.push(bytes);
61
+ return nextTotal;
62
+ }
63
+ function decodeChunks(chunks, totalBytes) {
64
+ const body = new Uint8Array(totalBytes);
65
+ let offset = 0;
66
+ for (const chunk of chunks) {
67
+ body.set(chunk, offset);
68
+ offset += chunk.byteLength;
69
+ }
70
+ return new TextDecoder().decode(body);
71
+ }
72
+ async function readStreamBody(body, method, maxBytes) {
73
+ const chunks = [];
74
+ let totalBytes = 0;
75
+ if (isWebReadableStream(body)) {
76
+ const reader = body.getReader();
77
+ try {
78
+ for (;;) {
79
+ const { done, value } = await reader.read();
80
+ if (done)
81
+ break;
82
+ if (value) {
83
+ totalBytes = appendLimitedChunk(chunks, value, totalBytes, maxBytes, method);
84
+ }
85
+ }
86
+ }
87
+ catch (error) {
88
+ await reader.cancel().catch(() => undefined);
89
+ throw error;
90
+ }
91
+ finally {
92
+ reader.releaseLock();
93
+ }
94
+ return decodeChunks(chunks, totalBytes);
95
+ }
96
+ for await (const chunk of body) {
97
+ totalBytes = appendLimitedChunk(chunks, chunk, totalBytes, maxBytes, method);
98
+ }
99
+ return decodeChunks(chunks, totalBytes);
100
+ }
101
+ async function readJsonResponseBody(res, method, maxBytes) {
102
+ const contentLength = res.headers.get('content-length');
103
+ if (contentLength !== null) {
104
+ const contentLengthBytes = Number(contentLength);
105
+ if (Number.isFinite(contentLengthBytes) && contentLengthBytes > maxBytes) {
106
+ throw new Error(`RPC request ${method} response body exceeds ${maxBytes} bytes`);
107
+ }
108
+ }
109
+ let text;
110
+ const body = res.body;
111
+ if (isWebReadableStream(body) || isAsyncIterableBody(body)) {
112
+ text = await readStreamBody(body, method, maxBytes);
113
+ }
114
+ else if (contentLength !== null || maxBytes === Number.POSITIVE_INFINITY) {
115
+ text = await res.text();
116
+ }
117
+ else {
118
+ throw new Error(`RPC request ${method} response body stream is not available`);
119
+ }
120
+ try {
121
+ return JSON.parse(text);
122
+ }
123
+ catch (error) {
124
+ const message = error instanceof Error ? error.message : String(error);
125
+ throw new Error(`Invalid JSON: ${message}`);
126
+ }
127
+ }
23
128
  class PhantasmaAPI {
129
+ nextJsonRpcRequestId() {
130
+ const requestId = String(this.nextRpcRequestId);
131
+ this.nextRpcRequestId += 1;
132
+ return requestId;
133
+ }
24
134
  pingAsync(host) {
25
135
  return new Promise((resolve, reject) => {
26
136
  const started = new Date().getTime();
@@ -49,11 +159,13 @@ class PhantasmaAPI {
49
159
  }
50
160
  });
51
161
  }
52
- constructor(defHost, peersUrlJson, nexus) {
162
+ constructor(defHost, peersUrlJson, nexus, options = {}) {
163
+ this.nextRpcRequestId = 1;
53
164
  this.rpcName = 'Auto';
54
165
  this.nexus = nexus;
55
166
  this.host = defHost;
56
167
  this.availableHosts = [];
168
+ this.maxRpcResponseBytes = normalizeMaxRpcResponseBytes(options.maxRpcResponseBytes);
57
169
  if (peersUrlJson != undefined && peersUrlJson != null) {
58
170
  (0, cross_fetch_1.default)(peersUrlJson + '?_=' + new Date().getTime()).then(async (res) => {
59
171
  const data = (await res.json());
@@ -77,6 +189,7 @@ class PhantasmaAPI {
77
189
  }
78
190
  }
79
191
  async JSONRPCResult(method, params) {
192
+ const requestId = this.nextJsonRpcRequestId();
80
193
  let res;
81
194
  try {
82
195
  res = await (0, cross_fetch_1.default)(this.host, {
@@ -86,7 +199,7 @@ class PhantasmaAPI {
86
199
  jsonrpc: '2.0',
87
200
  method: method,
88
201
  params: params,
89
- id: '1',
202
+ id: requestId,
90
203
  }),
91
204
  headers: { 'Content-Type': 'application/json' },
92
205
  });
@@ -99,7 +212,7 @@ class PhantasmaAPI {
99
212
  }
100
213
  let resJson;
101
214
  try {
102
- resJson = await res.json();
215
+ resJson = await readJsonResponseBody(res, method, this.maxRpcResponseBytes);
103
216
  }
104
217
  catch (error) {
105
218
  return (0, rpc_result_js_1.normalizeRpcError)(error, `RPC request ${method} returned invalid JSON`);
@@ -109,6 +222,9 @@ class PhantasmaAPI {
109
222
  return (0, rpc_result_js_1.normalizeRpcError)(undefined, `RPC request ${method} returned an invalid response`);
110
223
  }
111
224
  const response = resJson;
225
+ if (!rpcResponseIdMatches(response.id, requestId)) {
226
+ return (0, rpc_result_js_1.normalizeRpcError)(undefined, `RPC request ${method} returned a mismatched response id`);
227
+ }
112
228
  if (response.error !== undefined && response.error !== null) {
113
229
  return (0, rpc_result_js_1.normalizeRpcError)(response.error, `RPC request ${method} failed`);
114
230
  }
@@ -118,25 +234,50 @@ class PhantasmaAPI {
118
234
  return response.result;
119
235
  }
120
236
  async JSONRPC(method, params) {
121
- const res = await (0, cross_fetch_1.default)(this.host, {
122
- method: 'POST',
123
- mode: 'cors',
124
- body: JSON.stringify({
125
- jsonrpc: '2.0',
126
- method: method,
127
- params: params,
128
- id: '1',
129
- }),
130
- headers: { 'Content-Type': 'application/json' },
131
- });
132
- const resJson = (await res.json());
237
+ const requestId = this.nextJsonRpcRequestId();
238
+ let res;
239
+ try {
240
+ res = await (0, cross_fetch_1.default)(this.host, {
241
+ method: 'POST',
242
+ mode: 'cors',
243
+ body: JSON.stringify({
244
+ jsonrpc: '2.0',
245
+ method: method,
246
+ params: params,
247
+ id: requestId,
248
+ }),
249
+ headers: { 'Content-Type': 'application/json' },
250
+ });
251
+ }
252
+ catch (error) {
253
+ const message = error instanceof Error ? error.message : String(error);
254
+ throw new Error(`RPC request ${method} failed: ${message}`);
255
+ }
256
+ if (!res.ok) {
257
+ throw new Error(res.statusText ? `HTTP ${res.status}: ${res.statusText}` : `HTTP ${res.status}`);
258
+ }
259
+ const resJson = await readJsonResponseBody(res, method, this.maxRpcResponseBytes);
133
260
  logger_js_1.logger.log('method', method, resJson);
134
- if (resJson.error) {
135
- if (typeof resJson.error === 'object' && resJson.error.message)
136
- return { error: resJson.error.message };
137
- return { error: resJson.error };
261
+ if (!isObjectRecord(resJson)) {
262
+ throw new Error(`RPC request ${method} returned an invalid response`);
138
263
  }
139
- return resJson.result;
264
+ const response = resJson;
265
+ if (!rpcResponseIdMatches(response.id, requestId)) {
266
+ throw new Error(`RPC request ${method} returned a mismatched response id`);
267
+ }
268
+ if (response.error) {
269
+ if (typeof response.error === 'object' && response.error.message)
270
+ return { error: response.error.message };
271
+ return { error: response.error };
272
+ }
273
+ if (!('result' in response)) {
274
+ throw new Error(`RPC request ${method} returned no result`);
275
+ }
276
+ return response.result;
277
+ }
278
+ setMaxRpcResponseBytes(maxBytes) {
279
+ this.maxRpcResponseBytes = normalizeMaxRpcResponseBytes(maxBytes);
280
+ return this;
140
281
  }
141
282
  setRpcHost(rpcHost) {
142
283
  this.host = rpcHost;
@@ -199,45 +199,54 @@ class CarbonBinaryReader {
199
199
  this.bytes = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
200
200
  this.view = new DataView(this.bytes.buffer, this.bytes.byteOffset, this.bytes.byteLength);
201
201
  }
202
+ remaining() {
203
+ return this.bytes.length - this.offset;
204
+ }
202
205
  take(count) {
203
- Throw.If(this.offset + count > this.bytes.length, 'end of stream reached');
206
+ Throw.If(!Number.isInteger(count) || count < 0, 'invalid byte count');
207
+ Throw.If(count > this.remaining(), 'end of stream reached');
204
208
  const out = this.bytes.subarray(this.offset, this.offset + count);
205
209
  this.offset += count;
206
210
  return out;
207
211
  }
212
+ readLength(elementSize = 1) {
213
+ const len = this.read4();
214
+ Throw.If(len < 0, 'invalid array length');
215
+ Throw.If(!Number.isInteger(elementSize) || elementSize <= 0, 'invalid array element size');
216
+ Throw.If(len > Math.floor(this.remaining() / elementSize), `array length ${len} exceeds remaining bytes ${this.remaining()}`);
217
+ return len;
218
+ }
208
219
  readRemaining() {
209
220
  return this.take(this.bytes.length - this.offset);
210
221
  }
211
222
  // Raw reads
212
223
  read1() {
213
- const b = this.bytes[this.offset];
214
- this.offset += 1;
215
- return b;
224
+ return this.take(1)[0];
216
225
  }
217
226
  read2() {
218
- const v = this.view.getInt16(this.offset, true);
219
- this.offset += 2;
220
- return v;
227
+ const offset = this.offset;
228
+ this.take(2);
229
+ return this.view.getInt16(offset, true);
221
230
  }
222
231
  read4() {
223
- const v = this.view.getInt32(this.offset, true);
224
- this.offset += 4;
225
- return v;
232
+ const offset = this.offset;
233
+ this.take(4);
234
+ return this.view.getInt32(offset, true);
226
235
  }
227
236
  read4u() {
228
- const v = this.view.getUint32(this.offset, true);
229
- this.offset += 4;
230
- return v;
237
+ const offset = this.offset;
238
+ this.take(4);
239
+ return this.view.getUint32(offset, true);
231
240
  }
232
241
  read8() {
233
- const v = this.view.getBigInt64(this.offset, true);
234
- this.offset += 8;
235
- return v;
242
+ const offset = this.offset;
243
+ this.take(8);
244
+ return this.view.getBigInt64(offset, true);
236
245
  }
237
246
  read8u() {
238
- const v = this.view.getBigUint64(this.offset, true);
239
- this.offset += 8;
240
- return v;
247
+ const offset = this.offset;
248
+ this.take(8);
249
+ return this.view.getBigUint64(offset, true);
241
250
  }
242
251
  // Fixed-size blobs
243
252
  readExactly(count) {
@@ -268,7 +277,7 @@ class CarbonBinaryReader {
268
277
  return t;
269
278
  }
270
279
  readArrayBlob(ctor) {
271
- const len = this.read4();
280
+ const len = this.readLength();
272
281
  const arr = new Array(len);
273
282
  for (let i = 0; i < len; i++) {
274
283
  const t = new ctor();
@@ -300,7 +309,7 @@ class CarbonBinaryReader {
300
309
  return twosComplementLEToBigInt(word);
301
310
  }
302
311
  readArrayBigInt() {
303
- const len = this.read4();
312
+ const len = this.readLength();
304
313
  const arr = new Array(len);
305
314
  for (let i = 0; i < len; i++)
306
315
  arr[i] = this.readBigInt();
@@ -320,7 +329,7 @@ class CarbonBinaryReader {
320
329
  return textDecoder.decode(slice);
321
330
  }
322
331
  readArraySz() {
323
- const len = this.read4();
332
+ const len = this.readLength();
324
333
  const out = new Array(len);
325
334
  for (let i = 0; i < len; i++)
326
335
  out[i] = this.readSz();
@@ -328,46 +337,46 @@ class CarbonBinaryReader {
328
337
  }
329
338
  // Variable-length byte arrays
330
339
  readArray() {
331
- const len = this.read4();
340
+ const len = this.readLength();
332
341
  return this.readExactly(len);
333
342
  }
334
343
  readArrayOfArrays() {
335
- const len = this.read4();
344
+ const len = this.readLength(4);
336
345
  const arr = new Array(len);
337
346
  for (let i = 0; i < len; i++)
338
347
  arr[i] = this.readArray();
339
348
  return arr;
340
349
  }
341
350
  readArray64u() {
342
- const len = this.read4();
351
+ const len = this.readLength(8);
343
352
  const out = new Array(len);
344
353
  for (let i = 0; i < len; i++)
345
354
  out[i] = this.read8u();
346
355
  return out;
347
356
  }
348
357
  readArray64() {
349
- const len = this.read4();
358
+ const len = this.readLength(8);
350
359
  const out = new Array(len);
351
360
  for (let i = 0; i < len; i++)
352
361
  out[i] = this.read8();
353
362
  return out;
354
363
  }
355
364
  readArray32() {
356
- const len = this.read4();
365
+ const len = this.readLength(4);
357
366
  const out = new Array(len);
358
367
  for (let i = 0; i < len; i++)
359
368
  out[i] = this.read4();
360
369
  return out;
361
370
  }
362
371
  readArray16() {
363
- const len = this.read4();
372
+ const len = this.readLength(2);
364
373
  const out = new Array(len);
365
374
  for (let i = 0; i < len; i++)
366
375
  out[i] = this.read2();
367
376
  return out;
368
377
  }
369
378
  readArray8() {
370
- const len = this.read4();
379
+ const len = this.readLength();
371
380
  const out = new Array(len);
372
381
  for (let i = 0; i < len; i++)
373
382
  out[i] = this.read1();
@@ -11,10 +11,120 @@ function rpcHttpError(status, statusText) {
11
11
  statusText,
12
12
  };
13
13
  }
14
+ export const DEFAULT_MAX_RPC_RESPONSE_BYTES = 16 * 1024 * 1024;
14
15
  function parseRpcNumber(result) {
15
16
  return typeof result === 'string' ? parseInt(result, 10) : result;
16
17
  }
18
+ function rpcResponseIdMatches(responseId, requestId) {
19
+ if (typeof responseId === 'string') {
20
+ return responseId === requestId;
21
+ }
22
+ if (typeof responseId === 'number' && Number.isInteger(responseId)) {
23
+ return String(responseId) === requestId;
24
+ }
25
+ return false;
26
+ }
27
+ function normalizeMaxRpcResponseBytes(value) {
28
+ const maxBytes = value ?? DEFAULT_MAX_RPC_RESPONSE_BYTES;
29
+ if (maxBytes !== Number.POSITIVE_INFINITY && (!Number.isFinite(maxBytes) || maxBytes <= 0)) {
30
+ throw new Error('maxRpcResponseBytes must be a positive number');
31
+ }
32
+ return maxBytes;
33
+ }
34
+ function isObject(value) {
35
+ return typeof value === 'object' && value !== null;
36
+ }
37
+ function isWebReadableStream(value) {
38
+ return (isObject(value) &&
39
+ 'getReader' in value &&
40
+ typeof value.getReader === 'function');
41
+ }
42
+ function isAsyncIterableBody(value) {
43
+ return isObject(value) && Symbol.asyncIterator in value;
44
+ }
45
+ function chunkBytes(chunk) {
46
+ return typeof chunk === 'string' ? new TextEncoder().encode(chunk) : chunk;
47
+ }
48
+ function appendLimitedChunk(chunks, chunk, totalBytes, maxBytes, method) {
49
+ const bytes = chunkBytes(chunk);
50
+ const nextTotal = totalBytes + bytes.byteLength;
51
+ if (nextTotal > maxBytes) {
52
+ throw new Error(`RPC request ${method} response body exceeds ${maxBytes} bytes`);
53
+ }
54
+ chunks.push(bytes);
55
+ return nextTotal;
56
+ }
57
+ function decodeChunks(chunks, totalBytes) {
58
+ const body = new Uint8Array(totalBytes);
59
+ let offset = 0;
60
+ for (const chunk of chunks) {
61
+ body.set(chunk, offset);
62
+ offset += chunk.byteLength;
63
+ }
64
+ return new TextDecoder().decode(body);
65
+ }
66
+ async function readStreamBody(body, method, maxBytes) {
67
+ const chunks = [];
68
+ let totalBytes = 0;
69
+ if (isWebReadableStream(body)) {
70
+ const reader = body.getReader();
71
+ try {
72
+ for (;;) {
73
+ const { done, value } = await reader.read();
74
+ if (done)
75
+ break;
76
+ if (value) {
77
+ totalBytes = appendLimitedChunk(chunks, value, totalBytes, maxBytes, method);
78
+ }
79
+ }
80
+ }
81
+ catch (error) {
82
+ await reader.cancel().catch(() => undefined);
83
+ throw error;
84
+ }
85
+ finally {
86
+ reader.releaseLock();
87
+ }
88
+ return decodeChunks(chunks, totalBytes);
89
+ }
90
+ for await (const chunk of body) {
91
+ totalBytes = appendLimitedChunk(chunks, chunk, totalBytes, maxBytes, method);
92
+ }
93
+ return decodeChunks(chunks, totalBytes);
94
+ }
95
+ async function readJsonResponseBody(res, method, maxBytes) {
96
+ const contentLength = res.headers.get('content-length');
97
+ if (contentLength !== null) {
98
+ const contentLengthBytes = Number(contentLength);
99
+ if (Number.isFinite(contentLengthBytes) && contentLengthBytes > maxBytes) {
100
+ throw new Error(`RPC request ${method} response body exceeds ${maxBytes} bytes`);
101
+ }
102
+ }
103
+ let text;
104
+ const body = res.body;
105
+ if (isWebReadableStream(body) || isAsyncIterableBody(body)) {
106
+ text = await readStreamBody(body, method, maxBytes);
107
+ }
108
+ else if (contentLength !== null || maxBytes === Number.POSITIVE_INFINITY) {
109
+ text = await res.text();
110
+ }
111
+ else {
112
+ throw new Error(`RPC request ${method} response body stream is not available`);
113
+ }
114
+ try {
115
+ return JSON.parse(text);
116
+ }
117
+ catch (error) {
118
+ const message = error instanceof Error ? error.message : String(error);
119
+ throw new Error(`Invalid JSON: ${message}`);
120
+ }
121
+ }
17
122
  export class PhantasmaAPI {
123
+ nextJsonRpcRequestId() {
124
+ const requestId = String(this.nextRpcRequestId);
125
+ this.nextRpcRequestId += 1;
126
+ return requestId;
127
+ }
18
128
  pingAsync(host) {
19
129
  return new Promise((resolve, reject) => {
20
130
  const started = new Date().getTime();
@@ -43,11 +153,13 @@ export class PhantasmaAPI {
43
153
  }
44
154
  });
45
155
  }
46
- constructor(defHost, peersUrlJson, nexus) {
156
+ constructor(defHost, peersUrlJson, nexus, options = {}) {
157
+ this.nextRpcRequestId = 1;
47
158
  this.rpcName = 'Auto';
48
159
  this.nexus = nexus;
49
160
  this.host = defHost;
50
161
  this.availableHosts = [];
162
+ this.maxRpcResponseBytes = normalizeMaxRpcResponseBytes(options.maxRpcResponseBytes);
51
163
  if (peersUrlJson != undefined && peersUrlJson != null) {
52
164
  fetch(peersUrlJson + '?_=' + new Date().getTime()).then(async (res) => {
53
165
  const data = (await res.json());
@@ -71,6 +183,7 @@ export class PhantasmaAPI {
71
183
  }
72
184
  }
73
185
  async JSONRPCResult(method, params) {
186
+ const requestId = this.nextJsonRpcRequestId();
74
187
  let res;
75
188
  try {
76
189
  res = await fetch(this.host, {
@@ -80,7 +193,7 @@ export class PhantasmaAPI {
80
193
  jsonrpc: '2.0',
81
194
  method: method,
82
195
  params: params,
83
- id: '1',
196
+ id: requestId,
84
197
  }),
85
198
  headers: { 'Content-Type': 'application/json' },
86
199
  });
@@ -93,7 +206,7 @@ export class PhantasmaAPI {
93
206
  }
94
207
  let resJson;
95
208
  try {
96
- resJson = await res.json();
209
+ resJson = await readJsonResponseBody(res, method, this.maxRpcResponseBytes);
97
210
  }
98
211
  catch (error) {
99
212
  return normalizeRpcError(error, `RPC request ${method} returned invalid JSON`);
@@ -103,6 +216,9 @@ export class PhantasmaAPI {
103
216
  return normalizeRpcError(undefined, `RPC request ${method} returned an invalid response`);
104
217
  }
105
218
  const response = resJson;
219
+ if (!rpcResponseIdMatches(response.id, requestId)) {
220
+ return normalizeRpcError(undefined, `RPC request ${method} returned a mismatched response id`);
221
+ }
106
222
  if (response.error !== undefined && response.error !== null) {
107
223
  return normalizeRpcError(response.error, `RPC request ${method} failed`);
108
224
  }
@@ -112,25 +228,50 @@ export class PhantasmaAPI {
112
228
  return response.result;
113
229
  }
114
230
  async JSONRPC(method, params) {
115
- const res = await fetch(this.host, {
116
- method: 'POST',
117
- mode: 'cors',
118
- body: JSON.stringify({
119
- jsonrpc: '2.0',
120
- method: method,
121
- params: params,
122
- id: '1',
123
- }),
124
- headers: { 'Content-Type': 'application/json' },
125
- });
126
- const resJson = (await res.json());
231
+ const requestId = this.nextJsonRpcRequestId();
232
+ let res;
233
+ try {
234
+ res = await fetch(this.host, {
235
+ method: 'POST',
236
+ mode: 'cors',
237
+ body: JSON.stringify({
238
+ jsonrpc: '2.0',
239
+ method: method,
240
+ params: params,
241
+ id: requestId,
242
+ }),
243
+ headers: { 'Content-Type': 'application/json' },
244
+ });
245
+ }
246
+ catch (error) {
247
+ const message = error instanceof Error ? error.message : String(error);
248
+ throw new Error(`RPC request ${method} failed: ${message}`);
249
+ }
250
+ if (!res.ok) {
251
+ throw new Error(res.statusText ? `HTTP ${res.status}: ${res.statusText}` : `HTTP ${res.status}`);
252
+ }
253
+ const resJson = await readJsonResponseBody(res, method, this.maxRpcResponseBytes);
127
254
  logger.log('method', method, resJson);
128
- if (resJson.error) {
129
- if (typeof resJson.error === 'object' && resJson.error.message)
130
- return { error: resJson.error.message };
131
- return { error: resJson.error };
255
+ if (!isObjectRecord(resJson)) {
256
+ throw new Error(`RPC request ${method} returned an invalid response`);
132
257
  }
133
- return resJson.result;
258
+ const response = resJson;
259
+ if (!rpcResponseIdMatches(response.id, requestId)) {
260
+ throw new Error(`RPC request ${method} returned a mismatched response id`);
261
+ }
262
+ if (response.error) {
263
+ if (typeof response.error === 'object' && response.error.message)
264
+ return { error: response.error.message };
265
+ return { error: response.error };
266
+ }
267
+ if (!('result' in response)) {
268
+ throw new Error(`RPC request ${method} returned no result`);
269
+ }
270
+ return response.result;
271
+ }
272
+ setMaxRpcResponseBytes(maxBytes) {
273
+ this.maxRpcResponseBytes = normalizeMaxRpcResponseBytes(maxBytes);
274
+ return this;
134
275
  }
135
276
  setRpcHost(rpcHost) {
136
277
  this.host = rpcHost;
@@ -190,45 +190,54 @@ export class CarbonBinaryReader {
190
190
  this.bytes = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
191
191
  this.view = new DataView(this.bytes.buffer, this.bytes.byteOffset, this.bytes.byteLength);
192
192
  }
193
+ remaining() {
194
+ return this.bytes.length - this.offset;
195
+ }
193
196
  take(count) {
194
- Throw.If(this.offset + count > this.bytes.length, 'end of stream reached');
197
+ Throw.If(!Number.isInteger(count) || count < 0, 'invalid byte count');
198
+ Throw.If(count > this.remaining(), 'end of stream reached');
195
199
  const out = this.bytes.subarray(this.offset, this.offset + count);
196
200
  this.offset += count;
197
201
  return out;
198
202
  }
203
+ readLength(elementSize = 1) {
204
+ const len = this.read4();
205
+ Throw.If(len < 0, 'invalid array length');
206
+ Throw.If(!Number.isInteger(elementSize) || elementSize <= 0, 'invalid array element size');
207
+ Throw.If(len > Math.floor(this.remaining() / elementSize), `array length ${len} exceeds remaining bytes ${this.remaining()}`);
208
+ return len;
209
+ }
199
210
  readRemaining() {
200
211
  return this.take(this.bytes.length - this.offset);
201
212
  }
202
213
  // Raw reads
203
214
  read1() {
204
- const b = this.bytes[this.offset];
205
- this.offset += 1;
206
- return b;
215
+ return this.take(1)[0];
207
216
  }
208
217
  read2() {
209
- const v = this.view.getInt16(this.offset, true);
210
- this.offset += 2;
211
- return v;
218
+ const offset = this.offset;
219
+ this.take(2);
220
+ return this.view.getInt16(offset, true);
212
221
  }
213
222
  read4() {
214
- const v = this.view.getInt32(this.offset, true);
215
- this.offset += 4;
216
- return v;
223
+ const offset = this.offset;
224
+ this.take(4);
225
+ return this.view.getInt32(offset, true);
217
226
  }
218
227
  read4u() {
219
- const v = this.view.getUint32(this.offset, true);
220
- this.offset += 4;
221
- return v;
228
+ const offset = this.offset;
229
+ this.take(4);
230
+ return this.view.getUint32(offset, true);
222
231
  }
223
232
  read8() {
224
- const v = this.view.getBigInt64(this.offset, true);
225
- this.offset += 8;
226
- return v;
233
+ const offset = this.offset;
234
+ this.take(8);
235
+ return this.view.getBigInt64(offset, true);
227
236
  }
228
237
  read8u() {
229
- const v = this.view.getBigUint64(this.offset, true);
230
- this.offset += 8;
231
- return v;
238
+ const offset = this.offset;
239
+ this.take(8);
240
+ return this.view.getBigUint64(offset, true);
232
241
  }
233
242
  // Fixed-size blobs
234
243
  readExactly(count) {
@@ -259,7 +268,7 @@ export class CarbonBinaryReader {
259
268
  return t;
260
269
  }
261
270
  readArrayBlob(ctor) {
262
- const len = this.read4();
271
+ const len = this.readLength();
263
272
  const arr = new Array(len);
264
273
  for (let i = 0; i < len; i++) {
265
274
  const t = new ctor();
@@ -291,7 +300,7 @@ export class CarbonBinaryReader {
291
300
  return twosComplementLEToBigInt(word);
292
301
  }
293
302
  readArrayBigInt() {
294
- const len = this.read4();
303
+ const len = this.readLength();
295
304
  const arr = new Array(len);
296
305
  for (let i = 0; i < len; i++)
297
306
  arr[i] = this.readBigInt();
@@ -311,7 +320,7 @@ export class CarbonBinaryReader {
311
320
  return textDecoder.decode(slice);
312
321
  }
313
322
  readArraySz() {
314
- const len = this.read4();
323
+ const len = this.readLength();
315
324
  const out = new Array(len);
316
325
  for (let i = 0; i < len; i++)
317
326
  out[i] = this.readSz();
@@ -319,46 +328,46 @@ export class CarbonBinaryReader {
319
328
  }
320
329
  // Variable-length byte arrays
321
330
  readArray() {
322
- const len = this.read4();
331
+ const len = this.readLength();
323
332
  return this.readExactly(len);
324
333
  }
325
334
  readArrayOfArrays() {
326
- const len = this.read4();
335
+ const len = this.readLength(4);
327
336
  const arr = new Array(len);
328
337
  for (let i = 0; i < len; i++)
329
338
  arr[i] = this.readArray();
330
339
  return arr;
331
340
  }
332
341
  readArray64u() {
333
- const len = this.read4();
342
+ const len = this.readLength(8);
334
343
  const out = new Array(len);
335
344
  for (let i = 0; i < len; i++)
336
345
  out[i] = this.read8u();
337
346
  return out;
338
347
  }
339
348
  readArray64() {
340
- const len = this.read4();
349
+ const len = this.readLength(8);
341
350
  const out = new Array(len);
342
351
  for (let i = 0; i < len; i++)
343
352
  out[i] = this.read8();
344
353
  return out;
345
354
  }
346
355
  readArray32() {
347
- const len = this.read4();
356
+ const len = this.readLength(4);
348
357
  const out = new Array(len);
349
358
  for (let i = 0; i < len; i++)
350
359
  out[i] = this.read4();
351
360
  return out;
352
361
  }
353
362
  readArray16() {
354
- const len = this.read4();
363
+ const len = this.readLength(2);
355
364
  const out = new Array(len);
356
365
  for (let i = 0; i < len; i++)
357
366
  out[i] = this.read2();
358
367
  return out;
359
368
  }
360
369
  readArray8() {
361
- const len = this.read4();
370
+ const len = this.readLength();
362
371
  const out = new Array(len);
363
372
  for (let i = 0; i < len; i++)
364
373
  out[i] = this.read1();
@@ -7,10 +7,10 @@ export interface Account {
7
7
  stakes: Stake;
8
8
  stake: string;
9
9
  unclaimed: string;
10
- relay: string;
10
+ relay?: string;
11
11
  validator: string;
12
12
  storage: Storage;
13
13
  balances: Array<Balance>;
14
- txs: Array<string>;
14
+ txs?: Array<string>;
15
15
  }
16
16
  //# sourceMappingURL=account.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,KAAK,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACpB"}
1
+ {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,KAAK,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,GAAG,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACrB"}
@@ -1,11 +1,11 @@
1
1
  export interface Archive {
2
- name: string;
3
- hash: string;
2
+ name?: string;
3
+ hash?: string;
4
4
  time: number;
5
5
  size: number;
6
- encryption: string;
6
+ encryption?: string;
7
7
  blockCount: number;
8
- missingBlocks: Array<number>;
9
- owners: Array<string>;
8
+ missingBlocks?: Array<number>;
9
+ owners?: Array<string>;
10
10
  }
11
11
  //# sourceMappingURL=archive.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"archive.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/archive.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACvB"}
1
+ {"version":3,"file":"archive.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/archive.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACxB"}
@@ -11,7 +11,7 @@ export interface Block {
11
11
  txs: Array<TransactionData>;
12
12
  validatorAddress: string;
13
13
  reward: string;
14
- events: Array<Event>;
15
- oracles: Array<Oracle>;
14
+ events?: Array<Event>;
15
+ oracles?: Array<Oracle>;
16
16
  }
17
17
  //# sourceMappingURL=block.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACxB"}
1
+ {"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACzB"}
@@ -1,10 +1,10 @@
1
1
  export interface Chain {
2
- name: string;
3
- address: string;
4
- parent: string;
2
+ name?: string;
3
+ address?: string;
4
+ parent?: string;
5
5
  height: number;
6
- organization: string;
7
- contracts: Array<string>;
8
- dapps: Array<string>;
6
+ organization?: string;
7
+ contracts?: Array<string>;
8
+ dapps?: Array<string>;
9
9
  }
10
10
  //# sourceMappingURL=chain.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/chain.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACtB"}
1
+ {"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/chain.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACvB"}
@@ -3,7 +3,7 @@ import { ABIMethod } from './abi-method.js';
3
3
  export interface Contract {
4
4
  name: string;
5
5
  address: string;
6
- owner: string;
6
+ owner?: string;
7
7
  script: string;
8
8
  methods?: Array<ABIMethod>;
9
9
  events?: Array<ABIEvent>;
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC3B,MAAM,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;CAC1B"}
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC3B,MAAM,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;CAC1B"}
@@ -1,6 +1,6 @@
1
1
  import { LeaderboardRow } from './leaderboard-row.js';
2
2
  export interface Leaderboard {
3
- name: string;
4
- rows: Array<LeaderboardRow>;
3
+ name?: string;
4
+ rows?: Array<LeaderboardRow>;
5
5
  }
6
6
  //# sourceMappingURL=leaderboard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"leaderboard.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/leaderboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;CAC7B"}
1
+ {"version":3,"file":"leaderboard.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/leaderboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;CAC9B"}
@@ -3,12 +3,12 @@ import { Governance } from './governance.js';
3
3
  import { Token } from './token.js';
4
4
  import { Chain } from './chain.js';
5
5
  export interface Nexus {
6
- name: string;
7
- protocol: string;
8
- platforms: Array<Platform>;
9
- tokens: Array<Token>;
10
- chains: Array<Chain>;
11
- governance: Array<Governance>;
12
- organizations: Array<string>;
6
+ name?: string;
7
+ protocol: number;
8
+ platforms?: Array<Platform>;
9
+ tokens?: Array<Token>;
10
+ chains?: Array<Chain>;
11
+ governance?: Array<Governance>;
12
+ organizations?: Array<string>;
13
13
  }
14
14
  //# sourceMappingURL=nexus.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nexus.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/nexus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC3B,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC9B,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC9B"}
1
+ {"version":3,"file":"nexus.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/nexus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,WAAW,KAAK;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC5B,MAAM,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,MAAM,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,UAAU,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC/B,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC/B"}
@@ -1,8 +1,9 @@
1
1
  import type { KeyValue } from './key-value.js';
2
2
  export interface NFT {
3
- ID: string;
3
+ id: string;
4
4
  series: string;
5
5
  carbonTokenId: string;
6
+ carbonSeriesId: string;
6
7
  carbonNftAddress: string;
7
8
  mint: string;
8
9
  chainName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"nft.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/nft.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,WAAW,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,UAAU,EAAE,QAAQ,EAAE,CAAC;CACxB"}
1
+ {"version":3,"file":"nft.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/nft.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,WAAW,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,UAAU,EAAE,QAAQ,EAAE,CAAC;CACxB"}
@@ -1,6 +1,6 @@
1
1
  export interface Organization {
2
- id: string;
3
- name: string;
4
- members: Array<string>;
2
+ id?: string;
3
+ name?: string;
4
+ members?: Array<string>;
5
5
  }
6
6
  //# sourceMappingURL=organization.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"organization.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/organization.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACxB"}
1
+ {"version":3,"file":"organization.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/organization.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACzB"}
@@ -1,5 +1,5 @@
1
1
  export interface SignatureResult {
2
- Kind: string;
3
- Data: string;
2
+ kind: string;
3
+ data: string;
4
4
  }
5
5
  //# sourceMappingURL=signature-result.d.ts.map
@@ -1,8 +1,9 @@
1
1
  import type { KeyValue } from './key-value.js';
2
2
  export interface TokenData {
3
- ID: string;
3
+ id: string;
4
4
  series: string;
5
5
  carbonTokenId: string;
6
+ carbonSeriesId: string;
6
7
  carbonNftAddress: string;
7
8
  mint: string;
8
9
  chainName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"token-data.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/token-data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,UAAU,EAAE,QAAQ,EAAE,CAAC;CACxB"}
1
+ {"version":3,"file":"token-data.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/token-data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,UAAU,EAAE,QAAQ,EAAE,CAAC;CACxB"}
@@ -4,12 +4,15 @@ export interface TokenSeriesResult {
4
4
  seriesId: string;
5
5
  carbonTokenId: string;
6
6
  carbonSeriesId: string;
7
+ ownerAddress: string;
8
+ maxMint: string;
9
+ mintCount: string;
7
10
  currentSupply: string;
8
11
  maxSupply: string;
9
- burnedSupply: string;
10
- mode: string;
11
- script: string;
12
- methods: ABIMethod[];
12
+ burnedSupply?: string;
13
+ mode?: string;
14
+ script?: string;
15
+ methods?: ABIMethod[];
13
16
  metadata: KeyValue[];
14
17
  }
15
18
  //# sourceMappingURL=token-series-result.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"token-series-result.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/token-series-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,QAAQ,EAAE,QAAQ,EAAE,CAAC;CACtB"}
1
+ {"version":3,"file":"token-series-result.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/token-series-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,QAAQ,EAAE,QAAQ,EAAE,CAAC;CACtB"}
@@ -1,6 +1,7 @@
1
1
  import { TokenExternal } from './token-external.js';
2
2
  import { TokenPrice } from './token-price.js';
3
3
  import { TokenSeries } from './token-series.js';
4
+ import type { KeyValue } from './key-value.js';
4
5
  import type { TokenSchemasResult } from './token-schemas-result.js';
5
6
  export interface Token {
6
7
  symbol: string;
@@ -12,9 +13,10 @@ export interface Token {
12
13
  address: string;
13
14
  owner: string;
14
15
  flags: string;
15
- script: string;
16
+ script?: string;
16
17
  series: Array<TokenSeries>;
17
18
  carbonId: string;
19
+ metadata?: KeyValue[];
18
20
  tokenSchemas?: TokenSchemasResult;
19
21
  external?: Array<TokenExternal>;
20
22
  price?: Array<TokenPrice>;
@@ -1 +1 @@
1
- {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACj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,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,QAAQ,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAChC,KAAK,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;CAC3B"}
@@ -14,7 +14,7 @@ export interface TransactionData {
14
14
  events: Array<Event>;
15
15
  extendedEvents?: Array<EventExtended>;
16
16
  result: string;
17
- debugComment: string;
17
+ debugComment?: string;
18
18
  fee: string;
19
19
  state: string;
20
20
  signatures: Array<SignatureResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"transaction-data.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/transaction-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB"}
1
+ {"version":3,"file":"transaction-data.d.ts","sourceRoot":"","sources":["../../../../src/rpc/interfaces/transaction-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB"}
@@ -23,15 +23,23 @@ interface RpcPeer {
23
23
  info?: string;
24
24
  msecs?: number;
25
25
  }
26
+ export interface PhantasmaAPIOptions {
27
+ maxRpcResponseBytes?: number;
28
+ }
29
+ export declare const DEFAULT_MAX_RPC_RESPONSE_BYTES: number;
26
30
  export declare class PhantasmaAPI {
27
31
  host: string;
28
32
  rpcName: string;
29
33
  nexus: string;
30
34
  availableHosts: RpcPeer[];
35
+ maxRpcResponseBytes: number;
36
+ private nextRpcRequestId;
37
+ private nextJsonRpcRequestId;
31
38
  pingAsync(host: string): Promise<number>;
32
- constructor(defHost: string, peersUrlJson: string | undefined | null, nexus: string);
39
+ constructor(defHost: string, peersUrlJson: string | undefined | null, nexus: string, options?: PhantasmaAPIOptions);
33
40
  JSONRPCResult<T = unknown>(method: string, params: JsonRpcParam[]): Promise<RpcResult<T>>;
34
41
  JSONRPC(method: string, params: JsonRpcParam[]): Promise<unknown>;
42
+ setMaxRpcResponseBytes(maxBytes: number): this;
35
43
  setRpcHost(rpcHost: string): void;
36
44
  setRpcByName(rpcName: string): void;
37
45
  setNexus(nexus: string): void;
@@ -74,7 +82,7 @@ export declare class PhantasmaAPI {
74
82
  getAccountOwnedTokens(account: string, tokenSymbol?: string, carbonTokenId?: bigint, pageSize?: number, cursor?: string, checkAddressReservedByte?: boolean): Promise<CursorPaginatedResult<Token[]>>;
75
83
  getAccountOwnedTokenSeries(account: string, tokenSymbol?: string, carbonTokenId?: bigint, pageSize?: number, cursor?: string, checkAddressReservedByte?: boolean): Promise<CursorPaginatedResult<TokenSeriesResult[]>>;
76
84
  getAuctionsCount(chainAddressOrName: string, symbol: string): Promise<number>;
77
- getAuctions(chainAddressOrName: string, symbol: string, page: number, pageSize: number): Promise<Auction>;
85
+ getAuctions(chainAddressOrName: string, symbol: string, page: number, pageSize: number): Promise<Paginated<Auction[]>>;
78
86
  getAuction(chainAddressOrName: string, symbol: string, IDtext: string): Promise<Auction>;
79
87
  getArchive(hashText: string): Promise<Archive>;
80
88
  writeArchive(hashText: string, blockIndex: number, blockContent: string): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"phantasma.d.ts","sourceRoot":"","sources":["../../../src/rpc/phantasma.ts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AAO,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;IAM1B,UAAU,CAAC,kBAAkB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAOxF,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAO9C,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAM1F,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,OAAc,GAAG,OAAO,CAAC,GAAG,CAAC;IAK7E,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,QAAQ,GAAE,OAAc,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAKnF,UAAU,IAAI,OAAO,CAAC,eAAe,CAAC;IAItC,oBAAoB,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAInF"}
@@ -49,7 +49,9 @@ export declare class CarbonBinaryReader {
49
49
  private readonly view;
50
50
  private readonly bytes;
51
51
  constructor(buffer: ArrayBuffer | Uint8Array);
52
+ private remaining;
52
53
  private take;
54
+ private readLength;
53
55
  readRemaining(): Uint8Array;
54
56
  read1(): number;
55
57
  read2(): number;
@@ -1 +1 @@
1
- {"version":3,"file":"carbon-serialization.d.ts","sourceRoot":"","sources":["../../../src/types/carbon-serialization.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,C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BtC,eAAe,IAAI,MAAM,EAAE;IAQ3B,MAAM,IAAI,MAAM;IAYhB,WAAW,IAAI,MAAM,EAAE;IAQvB,SAAS,IAAI,UAAU;IAIvB,iBAAiB,IAAI,UAAU,EAAE;IAOjC,YAAY,IAAI,MAAM,EAAE;IAMxB,WAAW,IAAI,MAAM,EAAE;IAMvB,WAAW,IAAI,MAAM,EAAE;IAMvB,WAAW,IAAI,MAAM,EAAE;IAMvB,UAAU,IAAI,MAAM,EAAE;CAMvB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CA0BlE;AA8CD,6DAA6D;AAC7D,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAelE;AAGD,wBAAgB,SAAS,CAAC,CAAC,SAAS,cAAc,EAAE,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAExF;AACD,wBAAgB,QAAQ,CAAC,CAAC,SAAS,cAAc,EAAE,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,CAI9F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phantasma-sdk-ts",
3
- "version": "0.8.2",
3
+ "version": "0.9.1",
4
4
  "description": "Typescript SDK for interacting with the Phantasma Chain",
5
5
  "author": "Phantasma Team",
6
6
  "main": "dist/cjs/index.js",
@@ -255,7 +255,8 @@
255
255
  "test:package-exports": "npm run build && node scripts/check-package-exports.mjs && node scripts/check-public-types.mjs && node scripts/check-examples.mjs",
256
256
  "coverage": "jest --coverage",
257
257
  "typecheck": "tsc -p tsconfig.json --pretty false",
258
- "lint": "npm run typecheck && node scripts/check-deprecated-api-usage.mjs && node scripts/check-consumer-deprecated-api.mjs && node scripts/check-compat-shims.mjs && node scripts/check-source-filenames.mjs && prettier --check . && eslint .",
258
+ "typecheck:rpc-fixtures": "tsc -p tsconfig.rpc-fixtures.json --pretty false",
259
+ "lint": "npm run typecheck && npm run typecheck:rpc-fixtures && node scripts/check-deprecated-api-usage.mjs && node scripts/check-consumer-deprecated-api.mjs && node scripts/check-compat-shims.mjs && node scripts/check-source-filenames.mjs && prettier --check . && eslint .",
259
260
  "format": "prettier --write .",
260
261
  "prettier-watch": "onchange 'src/**/*.ts' -- prettier --write {{changed}}"
261
262
  },