@lukso/web-components 1.142.3 → 1.143.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/components/index.cjs +4 -9
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -5
- package/dist/components/lukso-button/index.cjs +3 -3
- package/dist/components/lukso-button/index.js +3 -3
- package/dist/components/lukso-button/lukso-button.stories.d.ts +1 -1
- package/dist/components/lukso-button/lukso-button.stories.d.ts.map +1 -1
- package/dist/components/lukso-card/index.cjs +7 -7
- package/dist/components/lukso-card/index.js +7 -7
- package/dist/components/lukso-card/lukso-card.stories.d.ts +1 -1
- package/dist/components/lukso-card/lukso-card.stories.d.ts.map +1 -1
- package/dist/components/lukso-checkbox/index.cjs +3 -3
- package/dist/components/lukso-checkbox/index.js +3 -3
- package/dist/components/lukso-checkbox/lukso-checkbox.stories.d.ts +1 -1
- package/dist/components/lukso-checkbox/lukso-checkbox.stories.d.ts.map +1 -1
- package/dist/components/lukso-color-picker/index.cjs +4 -4
- package/dist/components/lukso-color-picker/index.js +4 -4
- package/dist/components/lukso-color-picker/lukso-color-picker.stories.d.ts +1 -1
- package/dist/components/lukso-color-picker/lukso-color-picker.stories.d.ts.map +1 -1
- package/dist/components/lukso-dropdown/index.cjs +4 -4
- package/dist/components/lukso-dropdown/index.js +4 -4
- package/dist/components/lukso-dropdown/lukso-dropdown.stories.d.ts +1 -1
- package/dist/components/lukso-dropdown/lukso-dropdown.stories.d.ts.map +1 -1
- package/dist/components/lukso-dropdown-option/index.cjs +2 -2
- package/dist/components/lukso-dropdown-option/index.js +2 -2
- package/dist/components/lukso-dropdown-option/lukso-dropdown-option.stories.d.ts +1 -1
- package/dist/components/lukso-dropdown-option/lukso-dropdown-option.stories.d.ts.map +1 -1
- package/dist/components/lukso-footer/index.cjs +2 -2
- package/dist/components/lukso-footer/index.js +2 -2
- package/dist/components/lukso-footer/lukso-footer.stories.d.ts +1 -1
- package/dist/components/lukso-footer/lukso-footer.stories.d.ts.map +1 -1
- package/dist/components/lukso-icon/index.cjs +8 -3
- package/dist/components/lukso-icon/index.d.ts +1 -1
- package/dist/components/lukso-icon/index.d.ts.map +1 -1
- package/dist/components/lukso-icon/index.js +8 -3
- package/dist/components/lukso-icon/lukso-icon.stories.d.ts +3 -1
- package/dist/components/lukso-icon/lukso-icon.stories.d.ts.map +1 -1
- package/dist/components/lukso-image/index.cjs +4 -4
- package/dist/components/lukso-image/index.js +4 -4
- package/dist/components/lukso-image/lukso-image.stories.d.ts +1 -1
- package/dist/components/lukso-image/lukso-image.stories.d.ts.map +1 -1
- package/dist/components/lukso-input/index.cjs +3 -3
- package/dist/components/lukso-input/index.js +3 -3
- package/dist/components/lukso-input/lukso-input.stories.d.ts +1 -1
- package/dist/components/lukso-input/lukso-input.stories.d.ts.map +1 -1
- package/dist/components/lukso-modal/index.cjs +2 -2
- package/dist/components/lukso-modal/index.js +2 -2
- package/dist/components/lukso-modal/lukso-modal.stories.d.ts +1 -1
- package/dist/components/lukso-modal/lukso-modal.stories.d.ts.map +1 -1
- package/dist/components/lukso-navbar/index.cjs +3 -3
- package/dist/components/lukso-navbar/index.js +3 -3
- package/dist/components/lukso-navbar/lukso-navbar.stories.d.ts +1 -1
- package/dist/components/lukso-navbar/lukso-navbar.stories.d.ts.map +1 -1
- package/dist/components/lukso-pagination/index.cjs +3 -3
- package/dist/components/lukso-pagination/index.js +3 -3
- package/dist/components/lukso-pagination/lukso-pagination.stories.d.ts +1 -1
- package/dist/components/lukso-pagination/lukso-pagination.stories.d.ts.map +1 -1
- package/dist/components/lukso-profile/index.cjs +3 -3
- package/dist/components/lukso-profile/index.js +3 -3
- package/dist/components/lukso-profile/lukso-profile.stories.d.ts +1 -1
- package/dist/components/lukso-profile/lukso-profile.stories.d.ts.map +1 -1
- package/dist/components/lukso-progress/index.cjs +3 -3
- package/dist/components/lukso-progress/index.js +3 -3
- package/dist/components/lukso-progress/lukso-progress.stories.d.ts +1 -1
- package/dist/components/lukso-progress/lukso-progress.stories.d.ts.map +1 -1
- package/dist/components/lukso-radio/index.cjs +3 -3
- package/dist/components/lukso-radio/index.js +3 -3
- package/dist/components/lukso-radio/lukso-radio.stories.d.ts +1 -1
- package/dist/components/lukso-radio/lukso-radio.stories.d.ts.map +1 -1
- package/dist/components/lukso-radio-group/index.cjs +3 -3
- package/dist/components/lukso-radio-group/index.js +3 -3
- package/dist/components/lukso-radio-group/lukso-radio-group.stories.d.ts +1 -1
- package/dist/components/lukso-radio-group/lukso-radio-group.stories.d.ts.map +1 -1
- package/dist/components/lukso-sanitize/index.cjs +2 -2
- package/dist/components/lukso-sanitize/index.js +2 -2
- package/dist/components/lukso-sanitize/lukso-sanitize.stories.d.ts +1 -1
- package/dist/components/lukso-sanitize/lukso-sanitize.stories.d.ts.map +1 -1
- package/dist/components/lukso-search/index.cjs +6 -6
- package/dist/components/lukso-search/index.js +6 -6
- package/dist/components/lukso-search/lukso-search.stories.d.ts +1 -1
- package/dist/components/lukso-search/lukso-search.stories.d.ts.map +1 -1
- package/dist/components/lukso-select/index.cjs +5 -5
- package/dist/components/lukso-select/index.js +5 -5
- package/dist/components/lukso-select/lukso-select.stories.d.ts +1 -1
- package/dist/components/lukso-select/lukso-select.stories.d.ts.map +1 -1
- package/dist/components/lukso-share/index.cjs +2 -2
- package/dist/components/lukso-share/index.js +2 -2
- package/dist/components/lukso-share/lukso-share.stories.d.ts +1 -1
- package/dist/components/lukso-share/lukso-share.stories.d.ts.map +1 -1
- package/dist/components/lukso-switch/index.cjs +3 -3
- package/dist/components/lukso-switch/index.js +3 -3
- package/dist/components/lukso-switch/lukso-switch.stories.d.ts +1 -1
- package/dist/components/lukso-switch/lukso-switch.stories.d.ts.map +1 -1
- package/dist/components/lukso-tag/index.cjs +3 -3
- package/dist/components/lukso-tag/index.js +3 -3
- package/dist/components/lukso-tag/lukso-tag.stories.d.ts +1 -1
- package/dist/components/lukso-tag/lukso-tag.stories.d.ts.map +1 -1
- package/dist/components/lukso-terms/index.cjs +3 -3
- package/dist/components/lukso-terms/index.js +3 -3
- package/dist/components/lukso-terms/lukso-terms.stories.d.ts +1 -1
- package/dist/components/lukso-terms/lukso-terms.stories.d.ts.map +1 -1
- package/dist/components/lukso-textarea/index.cjs +3 -3
- package/dist/components/lukso-textarea/index.js +3 -3
- package/dist/components/lukso-textarea/lukso-textarea.stories.d.ts +1 -1
- package/dist/components/lukso-textarea/lukso-textarea.stories.d.ts.map +1 -1
- package/dist/components/lukso-tooltip/index.cjs +3 -3
- package/dist/components/lukso-tooltip/index.js +3 -3
- package/dist/components/lukso-tooltip/lukso-tooltip.stories.d.ts +1 -1
- package/dist/components/lukso-tooltip/lukso-tooltip.stories.d.ts.map +1 -1
- package/dist/components/lukso-username/index.cjs +4 -4
- package/dist/components/lukso-username/index.js +4 -4
- package/dist/components/lukso-username/lukso-username.stories.d.ts +1 -1
- package/dist/components/lukso-username/lukso-username.stories.d.ts.map +1 -1
- package/dist/components/lukso-wizard/index.cjs +9 -4
- package/dist/components/lukso-wizard/index.js +11 -6
- package/dist/components/lukso-wizard/lukso-wizard.stories.d.ts +1 -1
- package/dist/components/lukso-wizard/lukso-wizard.stories.d.ts.map +1 -1
- package/dist/docs/Animations.stories.d.ts +7 -0
- package/dist/docs/Animations.stories.d.ts.map +1 -0
- package/dist/docs/Colors.stories.d.ts +22 -0
- package/dist/docs/Colors.stories.d.ts.map +1 -0
- package/dist/docs/DropShadows.stories.d.ts +11 -0
- package/dist/docs/DropShadows.stories.d.ts.map +1 -0
- package/dist/docs/Icons.stories.d.ts +37 -0
- package/dist/docs/Icons.stories.d.ts.map +1 -0
- package/dist/docs/Typography.stories.d.ts +8 -0
- package/dist/docs/Typography.stories.d.ts.map +1 -0
- package/dist/{index-DHLarDqH.cjs → index-3V8ZK5SA.cjs} +5 -5
- package/dist/{index-D0uJDSKi.js → index-B663nE0O.js} +5 -5
- package/dist/{index-DSVq9yxq.js → index-BWVB_bXl.js} +167 -602
- package/dist/{index-CdJ6sSDh.cjs → index-BfBfOrWa.cjs} +2 -2
- package/dist/index-C1D2PVva.cjs +50 -0
- package/dist/{index-mcfs95wa.js → index-CIVHkTr0.js} +2 -2
- package/dist/{index-C6mXmsh3.js → index-CiDuqHsl.js} +1 -1
- package/dist/{index-CmsSXJJP.cjs → index-CzuGUp5e.cjs} +1 -1
- package/dist/index-Ga3DorGn.js +41 -0
- package/dist/{index-Bia7DdI2.cjs → index-muwdeQPx.cjs} +167 -602
- package/dist/index.cjs +4 -9
- package/dist/index.js +4 -5
- package/dist/{property-BAw-oPoY.cjs → property-BF9Ipvfh.cjs} +1 -1
- package/dist/{property-UjLizyyC.js → property-jBJt0uQ6.js} +1 -1
- package/dist/shared/tailwind-element/index.cjs +1 -1
- package/dist/shared/tailwind-element/index.js +1 -1
- package/dist/{state-Dr1i5F-v.cjs → state-CTmsENPK.cjs} +1 -1
- package/dist/{state-Cp3uU49S.js → state-Dnqg2VVB.js} +1 -1
- package/dist/{style-map-BDGPu5bX.cjs → style-map-CV0IkMGG.cjs} +1 -1
- package/dist/{style-map-8Lfg1B1r.js → style-map-hOUSiHf5.js} +1 -1
- package/package.json +1 -6
- package/tools/index.cjs +1 -1
- package/tools/index.js +1 -1
- package/dist/components/lukso-test/index.cjs +0 -101
- package/dist/components/lukso-test/index.d.ts +0 -18
- package/dist/components/lukso-test/index.d.ts.map +0 -1
- package/dist/components/lukso-test/index.js +0 -99
- package/dist/components/lukso-test/test.stories.d.ts +0 -15
- package/dist/components/lukso-test/test.stories.d.ts.map +0 -1
- package/dist/directive-helpers-D-GSfYoF.cjs +0 -16
- package/dist/directive-helpers-HolCALDF.js +0 -9
- package/dist/index-CuduEaB2.cjs +0 -50
- package/dist/index-DqZeY5Ft.js +0 -41
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { T as TailwindStyledElement, x, E } from './index-
|
|
2
|
-
import { n, t } from './property-
|
|
1
|
+
import { T as TailwindStyledElement, x, E } from './index-Ga3DorGn.js';
|
|
2
|
+
import { n, t } from './property-jBJt0uQ6.js';
|
|
3
3
|
import { c as ce } from './index-B9iart53.js';
|
|
4
|
-
import { c as customStyleMap } from './index-
|
|
4
|
+
import { c as customStyleMap } from './index-CiDuqHsl.js';
|
|
5
5
|
import './tailwind-config.js';
|
|
6
6
|
import { c as cn } from './cn-Cu9aP49j.js';
|
|
7
7
|
|
|
@@ -378,28 +378,29 @@ You should have received a copy of the GNU Lesser General Public License
|
|
|
378
378
|
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
|
379
379
|
*/
|
|
380
380
|
// Response error
|
|
381
|
-
const ERR_MULTIPLE_ERRORS
|
|
381
|
+
const ERR_MULTIPLE_ERRORS = 208;
|
|
382
382
|
// RPC error codes (EIP-1193)
|
|
383
383
|
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#provider-errors
|
|
384
|
-
const JSONRPC_ERR_REJECTED_REQUEST
|
|
385
|
-
const JSONRPC_ERR_UNAUTHORIZED
|
|
386
|
-
const JSONRPC_ERR_UNSUPPORTED_METHOD
|
|
387
|
-
const JSONRPC_ERR_DISCONNECTED
|
|
388
|
-
const JSONRPC_ERR_CHAIN_DISCONNECTED
|
|
384
|
+
const JSONRPC_ERR_REJECTED_REQUEST = 4001;
|
|
385
|
+
const JSONRPC_ERR_UNAUTHORIZED = 4100;
|
|
386
|
+
const JSONRPC_ERR_UNSUPPORTED_METHOD = 4200;
|
|
387
|
+
const JSONRPC_ERR_DISCONNECTED = 4900;
|
|
388
|
+
const JSONRPC_ERR_CHAIN_DISCONNECTED = 4901;
|
|
389
|
+
const ERR_INVALID_ADDRESS = 1005;
|
|
389
390
|
// RPC error codes (EIP-1474)
|
|
390
391
|
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1474.md
|
|
391
|
-
const ERR_RPC_INVALID_JSON
|
|
392
|
-
const ERR_RPC_INVALID_REQUEST
|
|
393
|
-
const ERR_RPC_INVALID_METHOD
|
|
394
|
-
const ERR_RPC_INVALID_PARAMS
|
|
395
|
-
const ERR_RPC_INTERNAL_ERROR
|
|
396
|
-
const ERR_RPC_INVALID_INPUT
|
|
397
|
-
const ERR_RPC_MISSING_RESOURCE
|
|
398
|
-
const ERR_RPC_UNAVAILABLE_RESOURCE
|
|
399
|
-
const ERR_RPC_TRANSACTION_REJECTED
|
|
400
|
-
const ERR_RPC_UNSUPPORTED_METHOD
|
|
401
|
-
const ERR_RPC_LIMIT_EXCEEDED
|
|
402
|
-
const ERR_RPC_NOT_SUPPORTED
|
|
392
|
+
const ERR_RPC_INVALID_JSON = -32700;
|
|
393
|
+
const ERR_RPC_INVALID_REQUEST = -32600;
|
|
394
|
+
const ERR_RPC_INVALID_METHOD = -32601;
|
|
395
|
+
const ERR_RPC_INVALID_PARAMS = -32602;
|
|
396
|
+
const ERR_RPC_INTERNAL_ERROR = -32603;
|
|
397
|
+
const ERR_RPC_INVALID_INPUT = -32e3;
|
|
398
|
+
const ERR_RPC_MISSING_RESOURCE = -32001;
|
|
399
|
+
const ERR_RPC_UNAVAILABLE_RESOURCE = -32002;
|
|
400
|
+
const ERR_RPC_TRANSACTION_REJECTED = -32003;
|
|
401
|
+
const ERR_RPC_UNSUPPORTED_METHOD = -32004;
|
|
402
|
+
const ERR_RPC_LIMIT_EXCEEDED = -32005;
|
|
403
|
+
const ERR_RPC_NOT_SUPPORTED = -32006;
|
|
403
404
|
|
|
404
405
|
/*
|
|
405
406
|
This file is part of web3.js.
|
|
@@ -420,30 +421,13 @@ along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
|
|
420
421
|
/**
|
|
421
422
|
* Base class for Web3 errors.
|
|
422
423
|
*/
|
|
423
|
-
|
|
424
|
-
constructor(msg, cause) {
|
|
425
|
-
super(msg);
|
|
426
|
-
if (Array.isArray(cause)) {
|
|
427
|
-
// eslint-disable-next-line no-use-before-define
|
|
428
|
-
this.cause = new MultipleErrors$1(cause);
|
|
429
|
-
}
|
|
430
|
-
else {
|
|
431
|
-
this.cause = cause;
|
|
432
|
-
}
|
|
433
|
-
this.name = this.constructor.name;
|
|
434
|
-
if (typeof Error.captureStackTrace === 'function') {
|
|
435
|
-
Error.captureStackTrace(new.target.constructor);
|
|
436
|
-
}
|
|
437
|
-
else {
|
|
438
|
-
this.stack = new Error().stack;
|
|
439
|
-
}
|
|
440
|
-
}
|
|
424
|
+
class BaseWeb3Error extends Error {
|
|
441
425
|
/**
|
|
442
426
|
* @deprecated Use the `cause` property instead.
|
|
443
427
|
*/
|
|
444
428
|
get innerError() {
|
|
445
429
|
// eslint-disable-next-line no-use-before-define
|
|
446
|
-
if (this.cause instanceof MultipleErrors
|
|
430
|
+
if (this.cause instanceof MultipleErrors) {
|
|
447
431
|
return this.cause.errors;
|
|
448
432
|
}
|
|
449
433
|
return this.cause;
|
|
@@ -454,11 +438,28 @@ let BaseWeb3Error$1 = class BaseWeb3Error extends Error {
|
|
|
454
438
|
set innerError(cause) {
|
|
455
439
|
if (Array.isArray(cause)) {
|
|
456
440
|
// eslint-disable-next-line no-use-before-define
|
|
457
|
-
this.cause = new MultipleErrors
|
|
441
|
+
this.cause = new MultipleErrors(cause);
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
this.cause = cause;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
constructor(msg, cause) {
|
|
448
|
+
super(msg);
|
|
449
|
+
if (Array.isArray(cause)) {
|
|
450
|
+
// eslint-disable-next-line no-use-before-define
|
|
451
|
+
this.cause = new MultipleErrors(cause);
|
|
458
452
|
}
|
|
459
453
|
else {
|
|
460
454
|
this.cause = cause;
|
|
461
455
|
}
|
|
456
|
+
this.name = this.constructor.name;
|
|
457
|
+
if (typeof Error.captureStackTrace === 'function') {
|
|
458
|
+
Error.captureStackTrace(new.target.constructor);
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
this.stack = new Error().stack;
|
|
462
|
+
}
|
|
462
463
|
}
|
|
463
464
|
static convertToString(value, unquotValue = false) {
|
|
464
465
|
// Using "null" value intentionally for validation
|
|
@@ -480,14 +481,44 @@ let BaseWeb3Error$1 = class BaseWeb3Error extends Error {
|
|
|
480
481
|
innerError: this.cause,
|
|
481
482
|
};
|
|
482
483
|
}
|
|
483
|
-
}
|
|
484
|
-
|
|
484
|
+
}
|
|
485
|
+
class MultipleErrors extends BaseWeb3Error {
|
|
485
486
|
constructor(errors) {
|
|
486
487
|
super(`Multiple errors occurred: [${errors.map(e => e.message).join('], [')}]`);
|
|
487
|
-
this.code = ERR_MULTIPLE_ERRORS
|
|
488
|
+
this.code = ERR_MULTIPLE_ERRORS;
|
|
488
489
|
this.errors = errors;
|
|
489
490
|
}
|
|
490
|
-
}
|
|
491
|
+
}
|
|
492
|
+
class InvalidValueError extends BaseWeb3Error {
|
|
493
|
+
constructor(value, msg) {
|
|
494
|
+
super(`Invalid value given "${BaseWeb3Error.convertToString(value, true)}". Error: ${msg}.`);
|
|
495
|
+
this.name = this.constructor.name;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/*
|
|
500
|
+
This file is part of web3.js.
|
|
501
|
+
|
|
502
|
+
web3.js is free software: you can redistribute it and/or modify
|
|
503
|
+
it under the terms of the GNU Lesser General Public License as published by
|
|
504
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
505
|
+
(at your option) any later version.
|
|
506
|
+
|
|
507
|
+
web3.js is distributed in the hope that it will be useful,
|
|
508
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
509
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
510
|
+
GNU Lesser General Public License for more details.
|
|
511
|
+
|
|
512
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
513
|
+
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
|
514
|
+
*/
|
|
515
|
+
/* eslint-disable max-classes-per-file */
|
|
516
|
+
class InvalidAddressError extends InvalidValueError {
|
|
517
|
+
constructor(value) {
|
|
518
|
+
super(value, 'invalid ethereum address');
|
|
519
|
+
this.code = ERR_INVALID_ADDRESS;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
491
522
|
|
|
492
523
|
/*
|
|
493
524
|
This file is part of web3.js.
|
|
@@ -510,78 +541,78 @@ along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
|
|
510
541
|
* Note: consider in next version that a spelling mistake could be corrected for `occured` and the value could be:
|
|
511
542
|
* `An Rpc error has occurred with a code of *code*`
|
|
512
543
|
*/
|
|
513
|
-
const genericRpcErrorMessageTemplate
|
|
544
|
+
const genericRpcErrorMessageTemplate = 'An Rpc error has occured with a code of *code*';
|
|
514
545
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
515
|
-
const RpcErrorMessages
|
|
546
|
+
const RpcErrorMessages = {
|
|
516
547
|
// EIP-1474 & JSON RPC 2.0
|
|
517
548
|
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1474.md
|
|
518
|
-
[ERR_RPC_INVALID_JSON
|
|
549
|
+
[ERR_RPC_INVALID_JSON]: {
|
|
519
550
|
message: 'Parse error',
|
|
520
551
|
description: 'Invalid JSON',
|
|
521
552
|
},
|
|
522
|
-
[ERR_RPC_INVALID_REQUEST
|
|
553
|
+
[ERR_RPC_INVALID_REQUEST]: {
|
|
523
554
|
message: 'Invalid request',
|
|
524
555
|
description: 'JSON is not a valid request object ',
|
|
525
556
|
},
|
|
526
|
-
[ERR_RPC_INVALID_METHOD
|
|
557
|
+
[ERR_RPC_INVALID_METHOD]: {
|
|
527
558
|
message: 'Method not found',
|
|
528
559
|
description: 'Method does not exist ',
|
|
529
560
|
},
|
|
530
|
-
[ERR_RPC_INVALID_PARAMS
|
|
561
|
+
[ERR_RPC_INVALID_PARAMS]: {
|
|
531
562
|
message: 'Invalid params',
|
|
532
563
|
description: 'Invalid method parameters',
|
|
533
564
|
},
|
|
534
|
-
[ERR_RPC_INTERNAL_ERROR
|
|
565
|
+
[ERR_RPC_INTERNAL_ERROR]: {
|
|
535
566
|
message: 'Internal error',
|
|
536
567
|
description: 'Internal JSON-RPC error',
|
|
537
568
|
},
|
|
538
|
-
[ERR_RPC_INVALID_INPUT
|
|
569
|
+
[ERR_RPC_INVALID_INPUT]: {
|
|
539
570
|
message: 'Invalid input',
|
|
540
571
|
description: 'Missing or invalid parameters',
|
|
541
572
|
},
|
|
542
|
-
[ERR_RPC_MISSING_RESOURCE
|
|
573
|
+
[ERR_RPC_MISSING_RESOURCE]: {
|
|
543
574
|
message: 'Resource not found',
|
|
544
575
|
description: 'Requested resource not found',
|
|
545
576
|
},
|
|
546
|
-
[ERR_RPC_UNAVAILABLE_RESOURCE
|
|
577
|
+
[ERR_RPC_UNAVAILABLE_RESOURCE]: {
|
|
547
578
|
message: 'Resource unavailable',
|
|
548
579
|
description: 'Requested resource not available',
|
|
549
580
|
},
|
|
550
|
-
[ERR_RPC_TRANSACTION_REJECTED
|
|
581
|
+
[ERR_RPC_TRANSACTION_REJECTED]: {
|
|
551
582
|
message: 'Transaction rejected',
|
|
552
583
|
description: 'Transaction creation failed',
|
|
553
584
|
},
|
|
554
|
-
[ERR_RPC_UNSUPPORTED_METHOD
|
|
585
|
+
[ERR_RPC_UNSUPPORTED_METHOD]: {
|
|
555
586
|
message: 'Method not supported',
|
|
556
587
|
description: 'Method is not implemented',
|
|
557
588
|
},
|
|
558
|
-
[ERR_RPC_LIMIT_EXCEEDED
|
|
589
|
+
[ERR_RPC_LIMIT_EXCEEDED]: {
|
|
559
590
|
message: 'Limit exceeded',
|
|
560
591
|
description: 'Request exceeds defined limit',
|
|
561
592
|
},
|
|
562
|
-
[ERR_RPC_NOT_SUPPORTED
|
|
593
|
+
[ERR_RPC_NOT_SUPPORTED]: {
|
|
563
594
|
message: 'JSON-RPC version not supported',
|
|
564
595
|
description: 'Version of JSON-RPC protocol is not supported',
|
|
565
596
|
},
|
|
566
597
|
// EIP-1193
|
|
567
598
|
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#provider-errors
|
|
568
|
-
[JSONRPC_ERR_REJECTED_REQUEST
|
|
599
|
+
[JSONRPC_ERR_REJECTED_REQUEST]: {
|
|
569
600
|
name: 'User Rejected Request',
|
|
570
601
|
message: 'The user rejected the request.',
|
|
571
602
|
},
|
|
572
|
-
[JSONRPC_ERR_UNAUTHORIZED
|
|
603
|
+
[JSONRPC_ERR_UNAUTHORIZED]: {
|
|
573
604
|
name: 'Unauthorized',
|
|
574
605
|
message: 'The requested method and/or account has not been authorized by the user.',
|
|
575
606
|
},
|
|
576
|
-
[JSONRPC_ERR_UNSUPPORTED_METHOD
|
|
607
|
+
[JSONRPC_ERR_UNSUPPORTED_METHOD]: {
|
|
577
608
|
name: 'Unsupported Method',
|
|
578
609
|
message: 'The Provider does not support the requested method.',
|
|
579
610
|
},
|
|
580
|
-
[JSONRPC_ERR_DISCONNECTED
|
|
611
|
+
[JSONRPC_ERR_DISCONNECTED]: {
|
|
581
612
|
name: 'Disconnected',
|
|
582
613
|
message: 'The Provider is disconnected from all chains.',
|
|
583
614
|
},
|
|
584
|
-
[JSONRPC_ERR_CHAIN_DISCONNECTED
|
|
615
|
+
[JSONRPC_ERR_CHAIN_DISCONNECTED]: {
|
|
585
616
|
name: 'Chain Disconnected',
|
|
586
617
|
message: 'The Provider is not connected to the requested chain.',
|
|
587
618
|
},
|
|
@@ -685,9 +716,9 @@ GNU Lesser General Public License for more details.
|
|
|
685
716
|
You should have received a copy of the GNU Lesser General Public License
|
|
686
717
|
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
|
687
718
|
*/
|
|
688
|
-
|
|
719
|
+
class RpcError extends BaseWeb3Error {
|
|
689
720
|
constructor(rpcError, message) {
|
|
690
|
-
super(message !== null && message !== void 0 ? message : genericRpcErrorMessageTemplate
|
|
721
|
+
super(message !== null && message !== void 0 ? message : genericRpcErrorMessageTemplate.replace('*code*', rpcError.error.code.toString()));
|
|
691
722
|
this.code = rpcError.error.code;
|
|
692
723
|
this.id = rpcError.id;
|
|
693
724
|
this.jsonrpc = rpcError.jsonrpc;
|
|
@@ -696,106 +727,106 @@ let RpcError$1 = class RpcError extends BaseWeb3Error$1 {
|
|
|
696
727
|
toJSON() {
|
|
697
728
|
return Object.assign(Object.assign({}, super.toJSON()), { error: this.jsonRpcError, id: this.id, jsonRpc: this.jsonrpc });
|
|
698
729
|
}
|
|
699
|
-
}
|
|
700
|
-
|
|
730
|
+
}
|
|
731
|
+
class ParseError extends RpcError {
|
|
701
732
|
constructor(rpcError) {
|
|
702
|
-
super(rpcError, RpcErrorMessages
|
|
703
|
-
this.code = ERR_RPC_INVALID_JSON
|
|
733
|
+
super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_JSON].message);
|
|
734
|
+
this.code = ERR_RPC_INVALID_JSON;
|
|
704
735
|
}
|
|
705
|
-
}
|
|
706
|
-
|
|
736
|
+
}
|
|
737
|
+
class InvalidRequestError extends RpcError {
|
|
707
738
|
constructor(rpcError) {
|
|
708
|
-
super(rpcError, RpcErrorMessages
|
|
709
|
-
this.code = ERR_RPC_INVALID_REQUEST
|
|
739
|
+
super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_REQUEST].message);
|
|
740
|
+
this.code = ERR_RPC_INVALID_REQUEST;
|
|
710
741
|
}
|
|
711
|
-
}
|
|
712
|
-
|
|
742
|
+
}
|
|
743
|
+
class MethodNotFoundError extends RpcError {
|
|
713
744
|
constructor(rpcError) {
|
|
714
|
-
super(rpcError, RpcErrorMessages
|
|
715
|
-
this.code = ERR_RPC_INVALID_METHOD
|
|
745
|
+
super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_METHOD].message);
|
|
746
|
+
this.code = ERR_RPC_INVALID_METHOD;
|
|
716
747
|
}
|
|
717
|
-
}
|
|
718
|
-
|
|
748
|
+
}
|
|
749
|
+
class InvalidParamsError extends RpcError {
|
|
719
750
|
constructor(rpcError) {
|
|
720
|
-
super(rpcError, RpcErrorMessages
|
|
721
|
-
this.code = ERR_RPC_INVALID_PARAMS
|
|
751
|
+
super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_PARAMS].message);
|
|
752
|
+
this.code = ERR_RPC_INVALID_PARAMS;
|
|
722
753
|
}
|
|
723
|
-
}
|
|
724
|
-
|
|
754
|
+
}
|
|
755
|
+
class InternalError extends RpcError {
|
|
725
756
|
constructor(rpcError) {
|
|
726
|
-
super(rpcError, RpcErrorMessages
|
|
727
|
-
this.code = ERR_RPC_INTERNAL_ERROR
|
|
757
|
+
super(rpcError, RpcErrorMessages[ERR_RPC_INTERNAL_ERROR].message);
|
|
758
|
+
this.code = ERR_RPC_INTERNAL_ERROR;
|
|
728
759
|
}
|
|
729
|
-
}
|
|
730
|
-
|
|
760
|
+
}
|
|
761
|
+
class InvalidInputError extends RpcError {
|
|
731
762
|
constructor(rpcError) {
|
|
732
|
-
super(rpcError, RpcErrorMessages
|
|
733
|
-
this.code = ERR_RPC_INVALID_INPUT
|
|
763
|
+
super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_INPUT].message);
|
|
764
|
+
this.code = ERR_RPC_INVALID_INPUT;
|
|
734
765
|
}
|
|
735
|
-
}
|
|
736
|
-
|
|
766
|
+
}
|
|
767
|
+
class MethodNotSupported extends RpcError {
|
|
737
768
|
constructor(rpcError) {
|
|
738
|
-
super(rpcError, RpcErrorMessages
|
|
739
|
-
this.code = ERR_RPC_UNSUPPORTED_METHOD
|
|
769
|
+
super(rpcError, RpcErrorMessages[ERR_RPC_UNSUPPORTED_METHOD].message);
|
|
770
|
+
this.code = ERR_RPC_UNSUPPORTED_METHOD;
|
|
740
771
|
}
|
|
741
|
-
}
|
|
742
|
-
|
|
772
|
+
}
|
|
773
|
+
class ResourceUnavailableError extends RpcError {
|
|
743
774
|
constructor(rpcError) {
|
|
744
|
-
super(rpcError, RpcErrorMessages
|
|
745
|
-
this.code = ERR_RPC_UNAVAILABLE_RESOURCE
|
|
775
|
+
super(rpcError, RpcErrorMessages[ERR_RPC_UNAVAILABLE_RESOURCE].message);
|
|
776
|
+
this.code = ERR_RPC_UNAVAILABLE_RESOURCE;
|
|
746
777
|
}
|
|
747
|
-
}
|
|
748
|
-
|
|
778
|
+
}
|
|
779
|
+
class ResourcesNotFoundError extends RpcError {
|
|
749
780
|
constructor(rpcError) {
|
|
750
|
-
super(rpcError, RpcErrorMessages
|
|
751
|
-
this.code = ERR_RPC_MISSING_RESOURCE
|
|
781
|
+
super(rpcError, RpcErrorMessages[ERR_RPC_MISSING_RESOURCE].message);
|
|
782
|
+
this.code = ERR_RPC_MISSING_RESOURCE;
|
|
752
783
|
}
|
|
753
|
-
}
|
|
754
|
-
|
|
784
|
+
}
|
|
785
|
+
class VersionNotSupportedError extends RpcError {
|
|
755
786
|
constructor(rpcError) {
|
|
756
|
-
super(rpcError, RpcErrorMessages
|
|
757
|
-
this.code = ERR_RPC_NOT_SUPPORTED
|
|
787
|
+
super(rpcError, RpcErrorMessages[ERR_RPC_NOT_SUPPORTED].message);
|
|
788
|
+
this.code = ERR_RPC_NOT_SUPPORTED;
|
|
758
789
|
}
|
|
759
|
-
}
|
|
760
|
-
|
|
790
|
+
}
|
|
791
|
+
class TransactionRejectedError extends RpcError {
|
|
761
792
|
constructor(rpcError) {
|
|
762
|
-
super(rpcError, RpcErrorMessages
|
|
763
|
-
this.code = ERR_RPC_TRANSACTION_REJECTED
|
|
793
|
+
super(rpcError, RpcErrorMessages[ERR_RPC_TRANSACTION_REJECTED].message);
|
|
794
|
+
this.code = ERR_RPC_TRANSACTION_REJECTED;
|
|
764
795
|
}
|
|
765
|
-
}
|
|
766
|
-
|
|
796
|
+
}
|
|
797
|
+
class LimitExceededError extends RpcError {
|
|
767
798
|
constructor(rpcError) {
|
|
768
|
-
super(rpcError, RpcErrorMessages
|
|
769
|
-
this.code = ERR_RPC_LIMIT_EXCEEDED
|
|
799
|
+
super(rpcError, RpcErrorMessages[ERR_RPC_LIMIT_EXCEEDED].message);
|
|
800
|
+
this.code = ERR_RPC_LIMIT_EXCEEDED;
|
|
770
801
|
}
|
|
771
|
-
}
|
|
772
|
-
const rpcErrorsMap
|
|
773
|
-
rpcErrorsMap
|
|
774
|
-
rpcErrorsMap
|
|
775
|
-
error: InvalidRequestError
|
|
802
|
+
}
|
|
803
|
+
const rpcErrorsMap = new Map();
|
|
804
|
+
rpcErrorsMap.set(ERR_RPC_INVALID_JSON, { error: ParseError });
|
|
805
|
+
rpcErrorsMap.set(ERR_RPC_INVALID_REQUEST, {
|
|
806
|
+
error: InvalidRequestError,
|
|
776
807
|
});
|
|
777
|
-
rpcErrorsMap
|
|
778
|
-
error: MethodNotFoundError
|
|
808
|
+
rpcErrorsMap.set(ERR_RPC_INVALID_METHOD, {
|
|
809
|
+
error: MethodNotFoundError,
|
|
779
810
|
});
|
|
780
|
-
rpcErrorsMap
|
|
781
|
-
rpcErrorsMap
|
|
782
|
-
rpcErrorsMap
|
|
783
|
-
rpcErrorsMap
|
|
784
|
-
error: MethodNotSupported
|
|
811
|
+
rpcErrorsMap.set(ERR_RPC_INVALID_PARAMS, { error: InvalidParamsError });
|
|
812
|
+
rpcErrorsMap.set(ERR_RPC_INTERNAL_ERROR, { error: InternalError });
|
|
813
|
+
rpcErrorsMap.set(ERR_RPC_INVALID_INPUT, { error: InvalidInputError });
|
|
814
|
+
rpcErrorsMap.set(ERR_RPC_UNSUPPORTED_METHOD, {
|
|
815
|
+
error: MethodNotSupported,
|
|
785
816
|
});
|
|
786
|
-
rpcErrorsMap
|
|
787
|
-
error: ResourceUnavailableError
|
|
817
|
+
rpcErrorsMap.set(ERR_RPC_UNAVAILABLE_RESOURCE, {
|
|
818
|
+
error: ResourceUnavailableError,
|
|
788
819
|
});
|
|
789
|
-
rpcErrorsMap
|
|
790
|
-
error: TransactionRejectedError
|
|
820
|
+
rpcErrorsMap.set(ERR_RPC_TRANSACTION_REJECTED, {
|
|
821
|
+
error: TransactionRejectedError,
|
|
791
822
|
});
|
|
792
|
-
rpcErrorsMap
|
|
793
|
-
error: ResourcesNotFoundError
|
|
823
|
+
rpcErrorsMap.set(ERR_RPC_MISSING_RESOURCE, {
|
|
824
|
+
error: ResourcesNotFoundError,
|
|
794
825
|
});
|
|
795
|
-
rpcErrorsMap
|
|
796
|
-
error: VersionNotSupportedError
|
|
826
|
+
rpcErrorsMap.set(ERR_RPC_NOT_SUPPORTED, {
|
|
827
|
+
error: VersionNotSupportedError,
|
|
797
828
|
});
|
|
798
|
-
rpcErrorsMap
|
|
829
|
+
rpcErrorsMap.set(ERR_RPC_LIMIT_EXCEEDED, { error: LimitExceededError });
|
|
799
830
|
|
|
800
831
|
/*
|
|
801
832
|
This file is part of web3.js.
|
|
@@ -978,6 +1009,7 @@ var BlockTags;
|
|
|
978
1009
|
BlockTags["PENDING"] = "pending";
|
|
979
1010
|
BlockTags["SAFE"] = "safe";
|
|
980
1011
|
BlockTags["FINALIZED"] = "finalized";
|
|
1012
|
+
BlockTags["COMMITTED"] = "committed";
|
|
981
1013
|
})(BlockTags || (BlockTags = {}));
|
|
982
1014
|
// This list of hardforks is expected to be in order
|
|
983
1015
|
// keep this in mind when making changes to it
|
|
@@ -1051,473 +1083,6 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
1051
1083
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
1052
1084
|
GNU Lesser General Public License for more details.
|
|
1053
1085
|
|
|
1054
|
-
You should have received a copy of the GNU Lesser General Public License
|
|
1055
|
-
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
|
1056
|
-
*/
|
|
1057
|
-
// Response error
|
|
1058
|
-
const ERR_MULTIPLE_ERRORS = 208;
|
|
1059
|
-
// RPC error codes (EIP-1193)
|
|
1060
|
-
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#provider-errors
|
|
1061
|
-
const JSONRPC_ERR_REJECTED_REQUEST = 4001;
|
|
1062
|
-
const JSONRPC_ERR_UNAUTHORIZED = 4100;
|
|
1063
|
-
const JSONRPC_ERR_UNSUPPORTED_METHOD = 4200;
|
|
1064
|
-
const JSONRPC_ERR_DISCONNECTED = 4900;
|
|
1065
|
-
const JSONRPC_ERR_CHAIN_DISCONNECTED = 4901;
|
|
1066
|
-
const ERR_INVALID_ADDRESS = 1005;
|
|
1067
|
-
// RPC error codes (EIP-1474)
|
|
1068
|
-
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1474.md
|
|
1069
|
-
const ERR_RPC_INVALID_JSON = -32700;
|
|
1070
|
-
const ERR_RPC_INVALID_REQUEST = -32600;
|
|
1071
|
-
const ERR_RPC_INVALID_METHOD = -32601;
|
|
1072
|
-
const ERR_RPC_INVALID_PARAMS = -32602;
|
|
1073
|
-
const ERR_RPC_INTERNAL_ERROR = -32603;
|
|
1074
|
-
const ERR_RPC_INVALID_INPUT = -32e3;
|
|
1075
|
-
const ERR_RPC_MISSING_RESOURCE = -32001;
|
|
1076
|
-
const ERR_RPC_UNAVAILABLE_RESOURCE = -32002;
|
|
1077
|
-
const ERR_RPC_TRANSACTION_REJECTED = -32003;
|
|
1078
|
-
const ERR_RPC_UNSUPPORTED_METHOD = -32004;
|
|
1079
|
-
const ERR_RPC_LIMIT_EXCEEDED = -32005;
|
|
1080
|
-
const ERR_RPC_NOT_SUPPORTED = -32006;
|
|
1081
|
-
|
|
1082
|
-
/*
|
|
1083
|
-
This file is part of web3.js.
|
|
1084
|
-
|
|
1085
|
-
web3.js is free software: you can redistribute it and/or modify
|
|
1086
|
-
it under the terms of the GNU Lesser General Public License as published by
|
|
1087
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
1088
|
-
(at your option) any later version.
|
|
1089
|
-
|
|
1090
|
-
web3.js is distributed in the hope that it will be useful,
|
|
1091
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
1092
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
1093
|
-
GNU Lesser General Public License for more details.
|
|
1094
|
-
|
|
1095
|
-
You should have received a copy of the GNU Lesser General Public License
|
|
1096
|
-
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
|
1097
|
-
*/
|
|
1098
|
-
/**
|
|
1099
|
-
* Base class for Web3 errors.
|
|
1100
|
-
*/
|
|
1101
|
-
class BaseWeb3Error extends Error {
|
|
1102
|
-
/**
|
|
1103
|
-
* @deprecated Use the `cause` property instead.
|
|
1104
|
-
*/
|
|
1105
|
-
get innerError() {
|
|
1106
|
-
// eslint-disable-next-line no-use-before-define
|
|
1107
|
-
if (this.cause instanceof MultipleErrors) {
|
|
1108
|
-
return this.cause.errors;
|
|
1109
|
-
}
|
|
1110
|
-
return this.cause;
|
|
1111
|
-
}
|
|
1112
|
-
/**
|
|
1113
|
-
* @deprecated Use the `cause` property instead.
|
|
1114
|
-
*/
|
|
1115
|
-
set innerError(cause) {
|
|
1116
|
-
if (Array.isArray(cause)) {
|
|
1117
|
-
// eslint-disable-next-line no-use-before-define
|
|
1118
|
-
this.cause = new MultipleErrors(cause);
|
|
1119
|
-
}
|
|
1120
|
-
else {
|
|
1121
|
-
this.cause = cause;
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
constructor(msg, cause) {
|
|
1125
|
-
super(msg);
|
|
1126
|
-
if (Array.isArray(cause)) {
|
|
1127
|
-
// eslint-disable-next-line no-use-before-define
|
|
1128
|
-
this.cause = new MultipleErrors(cause);
|
|
1129
|
-
}
|
|
1130
|
-
else {
|
|
1131
|
-
this.cause = cause;
|
|
1132
|
-
}
|
|
1133
|
-
this.name = this.constructor.name;
|
|
1134
|
-
if (typeof Error.captureStackTrace === 'function') {
|
|
1135
|
-
Error.captureStackTrace(new.target.constructor);
|
|
1136
|
-
}
|
|
1137
|
-
else {
|
|
1138
|
-
this.stack = new Error().stack;
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
1141
|
-
static convertToString(value, unquotValue = false) {
|
|
1142
|
-
// Using "null" value intentionally for validation
|
|
1143
|
-
// eslint-disable-next-line no-null/no-null
|
|
1144
|
-
if (value === null || value === undefined)
|
|
1145
|
-
return 'undefined';
|
|
1146
|
-
const result = JSON.stringify(value, (_, v) => (typeof v === 'bigint' ? v.toString() : v));
|
|
1147
|
-
return unquotValue && ['bigint', 'string'].includes(typeof value)
|
|
1148
|
-
? result.replace(/['\\"]+/g, '')
|
|
1149
|
-
: result;
|
|
1150
|
-
}
|
|
1151
|
-
toJSON() {
|
|
1152
|
-
return {
|
|
1153
|
-
name: this.name,
|
|
1154
|
-
code: this.code,
|
|
1155
|
-
message: this.message,
|
|
1156
|
-
cause: this.cause,
|
|
1157
|
-
// deprecated
|
|
1158
|
-
innerError: this.cause,
|
|
1159
|
-
};
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
class MultipleErrors extends BaseWeb3Error {
|
|
1163
|
-
constructor(errors) {
|
|
1164
|
-
super(`Multiple errors occurred: [${errors.map(e => e.message).join('], [')}]`);
|
|
1165
|
-
this.code = ERR_MULTIPLE_ERRORS;
|
|
1166
|
-
this.errors = errors;
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
class InvalidValueError extends BaseWeb3Error {
|
|
1170
|
-
constructor(value, msg) {
|
|
1171
|
-
super(`Invalid value given "${BaseWeb3Error.convertToString(value, true)}". Error: ${msg}.`);
|
|
1172
|
-
this.name = this.constructor.name;
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
/*
|
|
1177
|
-
This file is part of web3.js.
|
|
1178
|
-
|
|
1179
|
-
web3.js is free software: you can redistribute it and/or modify
|
|
1180
|
-
it under the terms of the GNU Lesser General Public License as published by
|
|
1181
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
1182
|
-
(at your option) any later version.
|
|
1183
|
-
|
|
1184
|
-
web3.js is distributed in the hope that it will be useful,
|
|
1185
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
1186
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
1187
|
-
GNU Lesser General Public License for more details.
|
|
1188
|
-
|
|
1189
|
-
You should have received a copy of the GNU Lesser General Public License
|
|
1190
|
-
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
|
1191
|
-
*/
|
|
1192
|
-
/* eslint-disable max-classes-per-file */
|
|
1193
|
-
class InvalidAddressError extends InvalidValueError {
|
|
1194
|
-
constructor(value) {
|
|
1195
|
-
super(value, 'invalid ethereum address');
|
|
1196
|
-
this.code = ERR_INVALID_ADDRESS;
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
/*
|
|
1201
|
-
This file is part of web3.js.
|
|
1202
|
-
|
|
1203
|
-
web3.js is free software: you can redistribute it and/or modify
|
|
1204
|
-
it under the terms of the GNU Lesser General Public License as published by
|
|
1205
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
1206
|
-
(at your option) any later version.
|
|
1207
|
-
|
|
1208
|
-
web3.js is distributed in the hope that it will be useful,
|
|
1209
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
1210
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
1211
|
-
GNU Lesser General Public License for more details.
|
|
1212
|
-
|
|
1213
|
-
You should have received a copy of the GNU Lesser General Public License
|
|
1214
|
-
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
|
1215
|
-
*/
|
|
1216
|
-
/**
|
|
1217
|
-
* A template string for a generic Rpc Error. The `*code*` will be replaced with the code number.
|
|
1218
|
-
* Note: consider in next version that a spelling mistake could be corrected for `occured` and the value could be:
|
|
1219
|
-
* `An Rpc error has occurred with a code of *code*`
|
|
1220
|
-
*/
|
|
1221
|
-
const genericRpcErrorMessageTemplate = 'An Rpc error has occured with a code of *code*';
|
|
1222
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
1223
|
-
const RpcErrorMessages = {
|
|
1224
|
-
// EIP-1474 & JSON RPC 2.0
|
|
1225
|
-
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1474.md
|
|
1226
|
-
[ERR_RPC_INVALID_JSON]: {
|
|
1227
|
-
message: 'Parse error',
|
|
1228
|
-
description: 'Invalid JSON',
|
|
1229
|
-
},
|
|
1230
|
-
[ERR_RPC_INVALID_REQUEST]: {
|
|
1231
|
-
message: 'Invalid request',
|
|
1232
|
-
description: 'JSON is not a valid request object ',
|
|
1233
|
-
},
|
|
1234
|
-
[ERR_RPC_INVALID_METHOD]: {
|
|
1235
|
-
message: 'Method not found',
|
|
1236
|
-
description: 'Method does not exist ',
|
|
1237
|
-
},
|
|
1238
|
-
[ERR_RPC_INVALID_PARAMS]: {
|
|
1239
|
-
message: 'Invalid params',
|
|
1240
|
-
description: 'Invalid method parameters',
|
|
1241
|
-
},
|
|
1242
|
-
[ERR_RPC_INTERNAL_ERROR]: {
|
|
1243
|
-
message: 'Internal error',
|
|
1244
|
-
description: 'Internal JSON-RPC error',
|
|
1245
|
-
},
|
|
1246
|
-
[ERR_RPC_INVALID_INPUT]: {
|
|
1247
|
-
message: 'Invalid input',
|
|
1248
|
-
description: 'Missing or invalid parameters',
|
|
1249
|
-
},
|
|
1250
|
-
[ERR_RPC_MISSING_RESOURCE]: {
|
|
1251
|
-
message: 'Resource not found',
|
|
1252
|
-
description: 'Requested resource not found',
|
|
1253
|
-
},
|
|
1254
|
-
[ERR_RPC_UNAVAILABLE_RESOURCE]: {
|
|
1255
|
-
message: 'Resource unavailable',
|
|
1256
|
-
description: 'Requested resource not available',
|
|
1257
|
-
},
|
|
1258
|
-
[ERR_RPC_TRANSACTION_REJECTED]: {
|
|
1259
|
-
message: 'Transaction rejected',
|
|
1260
|
-
description: 'Transaction creation failed',
|
|
1261
|
-
},
|
|
1262
|
-
[ERR_RPC_UNSUPPORTED_METHOD]: {
|
|
1263
|
-
message: 'Method not supported',
|
|
1264
|
-
description: 'Method is not implemented',
|
|
1265
|
-
},
|
|
1266
|
-
[ERR_RPC_LIMIT_EXCEEDED]: {
|
|
1267
|
-
message: 'Limit exceeded',
|
|
1268
|
-
description: 'Request exceeds defined limit',
|
|
1269
|
-
},
|
|
1270
|
-
[ERR_RPC_NOT_SUPPORTED]: {
|
|
1271
|
-
message: 'JSON-RPC version not supported',
|
|
1272
|
-
description: 'Version of JSON-RPC protocol is not supported',
|
|
1273
|
-
},
|
|
1274
|
-
// EIP-1193
|
|
1275
|
-
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#provider-errors
|
|
1276
|
-
[JSONRPC_ERR_REJECTED_REQUEST]: {
|
|
1277
|
-
name: 'User Rejected Request',
|
|
1278
|
-
message: 'The user rejected the request.',
|
|
1279
|
-
},
|
|
1280
|
-
[JSONRPC_ERR_UNAUTHORIZED]: {
|
|
1281
|
-
name: 'Unauthorized',
|
|
1282
|
-
message: 'The requested method and/or account has not been authorized by the user.',
|
|
1283
|
-
},
|
|
1284
|
-
[JSONRPC_ERR_UNSUPPORTED_METHOD]: {
|
|
1285
|
-
name: 'Unsupported Method',
|
|
1286
|
-
message: 'The Provider does not support the requested method.',
|
|
1287
|
-
},
|
|
1288
|
-
[JSONRPC_ERR_DISCONNECTED]: {
|
|
1289
|
-
name: 'Disconnected',
|
|
1290
|
-
message: 'The Provider is disconnected from all chains.',
|
|
1291
|
-
},
|
|
1292
|
-
[JSONRPC_ERR_CHAIN_DISCONNECTED]: {
|
|
1293
|
-
name: 'Chain Disconnected',
|
|
1294
|
-
message: 'The Provider is not connected to the requested chain.',
|
|
1295
|
-
},
|
|
1296
|
-
// EIP-1193 - CloseEvent
|
|
1297
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code
|
|
1298
|
-
'0-999': {
|
|
1299
|
-
name: '',
|
|
1300
|
-
message: 'Not used.',
|
|
1301
|
-
},
|
|
1302
|
-
1000: {
|
|
1303
|
-
name: 'Normal Closure',
|
|
1304
|
-
message: 'The connection successfully completed the purpose for which it was created.',
|
|
1305
|
-
},
|
|
1306
|
-
1001: {
|
|
1307
|
-
name: 'Going Away',
|
|
1308
|
-
message: 'The endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection.',
|
|
1309
|
-
},
|
|
1310
|
-
1002: {
|
|
1311
|
-
name: 'Protocol error',
|
|
1312
|
-
message: 'The endpoint is terminating the connection due to a protocol error.',
|
|
1313
|
-
},
|
|
1314
|
-
1003: {
|
|
1315
|
-
name: 'Unsupported Data',
|
|
1316
|
-
message: 'The connection is being terminated because the endpoint received data of a type it cannot accept. (For example, a text-only endpoint received binary data.)',
|
|
1317
|
-
},
|
|
1318
|
-
1004: {
|
|
1319
|
-
name: 'Reserved',
|
|
1320
|
-
message: 'Reserved. A meaning might be defined in the future.',
|
|
1321
|
-
},
|
|
1322
|
-
1005: {
|
|
1323
|
-
name: 'No Status Rcvd',
|
|
1324
|
-
message: 'Reserved. Indicates that no status code was provided even though one was expected.',
|
|
1325
|
-
},
|
|
1326
|
-
1006: {
|
|
1327
|
-
name: 'Abnormal Closure',
|
|
1328
|
-
message: 'Reserved. Indicates that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected.',
|
|
1329
|
-
},
|
|
1330
|
-
1007: {
|
|
1331
|
-
name: 'Invalid frame payload data',
|
|
1332
|
-
message: 'The endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-UTF-8 data within a text message).',
|
|
1333
|
-
},
|
|
1334
|
-
1008: {
|
|
1335
|
-
name: 'Policy Violation',
|
|
1336
|
-
message: 'The endpoint is terminating the connection because it received a message that violates its policy. This is a generic status code, used when codes 1003 and 1009 are not suitable.',
|
|
1337
|
-
},
|
|
1338
|
-
1009: {
|
|
1339
|
-
name: 'Message Too Big',
|
|
1340
|
-
message: 'The endpoint is terminating the connection because a data frame was received that is too large.',
|
|
1341
|
-
},
|
|
1342
|
-
1010: {
|
|
1343
|
-
name: 'Mandatory Ext.',
|
|
1344
|
-
message: "The client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't.",
|
|
1345
|
-
},
|
|
1346
|
-
1011: {
|
|
1347
|
-
name: 'Internal Error',
|
|
1348
|
-
message: 'The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.',
|
|
1349
|
-
},
|
|
1350
|
-
1012: {
|
|
1351
|
-
name: 'Service Restart',
|
|
1352
|
-
message: 'The server is terminating the connection because it is restarting.',
|
|
1353
|
-
},
|
|
1354
|
-
1013: {
|
|
1355
|
-
name: 'Try Again Later',
|
|
1356
|
-
message: 'The server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients.',
|
|
1357
|
-
},
|
|
1358
|
-
1014: {
|
|
1359
|
-
name: 'Bad Gateway',
|
|
1360
|
-
message: 'The server was acting as a gateway or proxy and received an invalid response from the upstream server. This is similar to 502 HTTP Status Code.',
|
|
1361
|
-
},
|
|
1362
|
-
1015: {
|
|
1363
|
-
name: 'TLS handshake',
|
|
1364
|
-
message: "Reserved. Indicates that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified).",
|
|
1365
|
-
},
|
|
1366
|
-
'1016-2999': {
|
|
1367
|
-
name: '',
|
|
1368
|
-
message: 'For definition by future revisions of the WebSocket Protocol specification, and for definition by extension specifications.',
|
|
1369
|
-
},
|
|
1370
|
-
'3000-3999': {
|
|
1371
|
-
name: '',
|
|
1372
|
-
message: 'For use by libraries, frameworks, and applications. These status codes are registered directly with IANA. The interpretation of these codes is undefined by the WebSocket protocol.',
|
|
1373
|
-
},
|
|
1374
|
-
'4000-4999': {
|
|
1375
|
-
name: '',
|
|
1376
|
-
message: "For private use, and thus can't be registered. Such codes can be used by prior agreements between WebSocket applications. The interpretation of these codes is undefined by the WebSocket protocol.",
|
|
1377
|
-
},
|
|
1378
|
-
};
|
|
1379
|
-
|
|
1380
|
-
/*
|
|
1381
|
-
This file is part of web3.js.
|
|
1382
|
-
|
|
1383
|
-
web3.js is free software: you can redistribute it and/or modify
|
|
1384
|
-
it under the terms of the GNU Lesser General Public License as published by
|
|
1385
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
1386
|
-
(at your option) any later version.
|
|
1387
|
-
|
|
1388
|
-
web3.js is distributed in the hope that it will be useful,
|
|
1389
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
1390
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
1391
|
-
GNU Lesser General Public License for more details.
|
|
1392
|
-
|
|
1393
|
-
You should have received a copy of the GNU Lesser General Public License
|
|
1394
|
-
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
|
1395
|
-
*/
|
|
1396
|
-
class RpcError extends BaseWeb3Error {
|
|
1397
|
-
constructor(rpcError, message) {
|
|
1398
|
-
super(message !== null && message !== void 0 ? message : genericRpcErrorMessageTemplate.replace('*code*', rpcError.error.code.toString()));
|
|
1399
|
-
this.code = rpcError.error.code;
|
|
1400
|
-
this.id = rpcError.id;
|
|
1401
|
-
this.jsonrpc = rpcError.jsonrpc;
|
|
1402
|
-
this.jsonRpcError = rpcError.error;
|
|
1403
|
-
}
|
|
1404
|
-
toJSON() {
|
|
1405
|
-
return Object.assign(Object.assign({}, super.toJSON()), { error: this.jsonRpcError, id: this.id, jsonRpc: this.jsonrpc });
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
class ParseError extends RpcError {
|
|
1409
|
-
constructor(rpcError) {
|
|
1410
|
-
super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_JSON].message);
|
|
1411
|
-
this.code = ERR_RPC_INVALID_JSON;
|
|
1412
|
-
}
|
|
1413
|
-
}
|
|
1414
|
-
class InvalidRequestError extends RpcError {
|
|
1415
|
-
constructor(rpcError) {
|
|
1416
|
-
super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_REQUEST].message);
|
|
1417
|
-
this.code = ERR_RPC_INVALID_REQUEST;
|
|
1418
|
-
}
|
|
1419
|
-
}
|
|
1420
|
-
class MethodNotFoundError extends RpcError {
|
|
1421
|
-
constructor(rpcError) {
|
|
1422
|
-
super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_METHOD].message);
|
|
1423
|
-
this.code = ERR_RPC_INVALID_METHOD;
|
|
1424
|
-
}
|
|
1425
|
-
}
|
|
1426
|
-
class InvalidParamsError extends RpcError {
|
|
1427
|
-
constructor(rpcError) {
|
|
1428
|
-
super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_PARAMS].message);
|
|
1429
|
-
this.code = ERR_RPC_INVALID_PARAMS;
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
class InternalError extends RpcError {
|
|
1433
|
-
constructor(rpcError) {
|
|
1434
|
-
super(rpcError, RpcErrorMessages[ERR_RPC_INTERNAL_ERROR].message);
|
|
1435
|
-
this.code = ERR_RPC_INTERNAL_ERROR;
|
|
1436
|
-
}
|
|
1437
|
-
}
|
|
1438
|
-
class InvalidInputError extends RpcError {
|
|
1439
|
-
constructor(rpcError) {
|
|
1440
|
-
super(rpcError, RpcErrorMessages[ERR_RPC_INVALID_INPUT].message);
|
|
1441
|
-
this.code = ERR_RPC_INVALID_INPUT;
|
|
1442
|
-
}
|
|
1443
|
-
}
|
|
1444
|
-
class MethodNotSupported extends RpcError {
|
|
1445
|
-
constructor(rpcError) {
|
|
1446
|
-
super(rpcError, RpcErrorMessages[ERR_RPC_UNSUPPORTED_METHOD].message);
|
|
1447
|
-
this.code = ERR_RPC_UNSUPPORTED_METHOD;
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
class ResourceUnavailableError extends RpcError {
|
|
1451
|
-
constructor(rpcError) {
|
|
1452
|
-
super(rpcError, RpcErrorMessages[ERR_RPC_UNAVAILABLE_RESOURCE].message);
|
|
1453
|
-
this.code = ERR_RPC_UNAVAILABLE_RESOURCE;
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
class ResourcesNotFoundError extends RpcError {
|
|
1457
|
-
constructor(rpcError) {
|
|
1458
|
-
super(rpcError, RpcErrorMessages[ERR_RPC_MISSING_RESOURCE].message);
|
|
1459
|
-
this.code = ERR_RPC_MISSING_RESOURCE;
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
class VersionNotSupportedError extends RpcError {
|
|
1463
|
-
constructor(rpcError) {
|
|
1464
|
-
super(rpcError, RpcErrorMessages[ERR_RPC_NOT_SUPPORTED].message);
|
|
1465
|
-
this.code = ERR_RPC_NOT_SUPPORTED;
|
|
1466
|
-
}
|
|
1467
|
-
}
|
|
1468
|
-
class TransactionRejectedError extends RpcError {
|
|
1469
|
-
constructor(rpcError) {
|
|
1470
|
-
super(rpcError, RpcErrorMessages[ERR_RPC_TRANSACTION_REJECTED].message);
|
|
1471
|
-
this.code = ERR_RPC_TRANSACTION_REJECTED;
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
class LimitExceededError extends RpcError {
|
|
1475
|
-
constructor(rpcError) {
|
|
1476
|
-
super(rpcError, RpcErrorMessages[ERR_RPC_LIMIT_EXCEEDED].message);
|
|
1477
|
-
this.code = ERR_RPC_LIMIT_EXCEEDED;
|
|
1478
|
-
}
|
|
1479
|
-
}
|
|
1480
|
-
const rpcErrorsMap = new Map();
|
|
1481
|
-
rpcErrorsMap.set(ERR_RPC_INVALID_JSON, { error: ParseError });
|
|
1482
|
-
rpcErrorsMap.set(ERR_RPC_INVALID_REQUEST, {
|
|
1483
|
-
error: InvalidRequestError,
|
|
1484
|
-
});
|
|
1485
|
-
rpcErrorsMap.set(ERR_RPC_INVALID_METHOD, {
|
|
1486
|
-
error: MethodNotFoundError,
|
|
1487
|
-
});
|
|
1488
|
-
rpcErrorsMap.set(ERR_RPC_INVALID_PARAMS, { error: InvalidParamsError });
|
|
1489
|
-
rpcErrorsMap.set(ERR_RPC_INTERNAL_ERROR, { error: InternalError });
|
|
1490
|
-
rpcErrorsMap.set(ERR_RPC_INVALID_INPUT, { error: InvalidInputError });
|
|
1491
|
-
rpcErrorsMap.set(ERR_RPC_UNSUPPORTED_METHOD, {
|
|
1492
|
-
error: MethodNotSupported,
|
|
1493
|
-
});
|
|
1494
|
-
rpcErrorsMap.set(ERR_RPC_UNAVAILABLE_RESOURCE, {
|
|
1495
|
-
error: ResourceUnavailableError,
|
|
1496
|
-
});
|
|
1497
|
-
rpcErrorsMap.set(ERR_RPC_TRANSACTION_REJECTED, {
|
|
1498
|
-
error: TransactionRejectedError,
|
|
1499
|
-
});
|
|
1500
|
-
rpcErrorsMap.set(ERR_RPC_MISSING_RESOURCE, {
|
|
1501
|
-
error: ResourcesNotFoundError,
|
|
1502
|
-
});
|
|
1503
|
-
rpcErrorsMap.set(ERR_RPC_NOT_SUPPORTED, {
|
|
1504
|
-
error: VersionNotSupportedError,
|
|
1505
|
-
});
|
|
1506
|
-
rpcErrorsMap.set(ERR_RPC_LIMIT_EXCEEDED, { error: LimitExceededError });
|
|
1507
|
-
|
|
1508
|
-
/*
|
|
1509
|
-
This file is part of web3.js.
|
|
1510
|
-
|
|
1511
|
-
web3.js is free software: you can redistribute it and/or modify
|
|
1512
|
-
it under the terms of the GNU Lesser General Public License as published by
|
|
1513
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
1514
|
-
(at your option) any later version.
|
|
1515
|
-
|
|
1516
|
-
web3.js is distributed in the hope that it will be useful,
|
|
1517
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
1518
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
1519
|
-
GNU Lesser General Public License for more details.
|
|
1520
|
-
|
|
1521
1086
|
You should have received a copy of the GNU Lesser General Public License
|
|
1522
1087
|
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
|
1523
1088
|
*/
|