You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[listMetrics](docs/sdks/l1validators/README.md#listmetrics) - Get given metric for all validators
554
+
*[getMetricsByValidationId](docs/sdks/l1validators/README.md#getmetricsbyvalidationid) - Get metric values with given validation id and timestamp range
555
+
*[getMetricsByNodeId](docs/sdks/l1validators/README.md#getmetricsbynodeid) - Get metric values with given node id and timestamp range
556
+
*[getMetricsBySubnetId](docs/sdks/l1validators/README.md#getmetricsbysubnetid) - Get metric values with given subnet ID and timestamp range
*[getStakingMetrics](docs/sdks/networks/README.md#getstakingmetrics) - Get staking metrics for a given subnet
@@ -666,6 +671,10 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
666
671
-[`metricsChainsListNftHolders`](docs/sdks/chains/README.md#listnftholders) - Get NFT holders by contract address
667
672
-[`metricsChainsListTokenHoldersAboveThreshold`](docs/sdks/chains/README.md#listtokenholdersabovethreshold) - Get addresses by balance over time
668
673
-[`metricsHealthCheck`](docs/sdks/metrics/README.md#healthcheck) - Get the health of the service
674
+
-[`metricsL1ValidatorsGetMetricsByNodeId`](docs/sdks/l1validators/README.md#getmetricsbynodeid) - Get metric values with given node id and timestamp range
675
+
-[`metricsL1ValidatorsGetMetricsBySubnetId`](docs/sdks/l1validators/README.md#getmetricsbysubnetid) - Get metric values with given subnet ID and timestamp range
676
+
-[`metricsL1ValidatorsGetMetricsByValidationId`](docs/sdks/l1validators/README.md#getmetricsbyvalidationid) - Get metric values with given validation id and timestamp range
677
+
-[`metricsL1ValidatorsListMetrics`](docs/sdks/l1validators/README.md#listmetrics) - Get given metric for all validators
669
678
-[`metricsNetworksGetStakingMetrics`](docs/sdks/networks/README.md#getstakingmetrics) - Get staking metrics for a given subnet
670
679
-[`metricsSubnetsGetValidators`](docs/sdks/subnets/README.md#getvalidators) - Get addresses running validators during a given time frame
671
680
-[`webhooksAddressesAdd`](docs/sdks/addresses/README.md#add) - Add addresses to EVM activity webhook
@@ -737,7 +746,6 @@ async function run() {
737
746
});
738
747
739
748
forawait (const page ofresult) {
740
-
// Handle the page
741
749
console.log(page);
742
750
}
743
751
}
@@ -764,8 +772,6 @@ import { AvaCloudSDK } from "@avalabs/avacloud-sdk";
764
772
765
773
const avaCloudSDK =newAvaCloudSDK({
766
774
serverURL: "https://api.example.com",
767
-
chainId: "43114",
768
-
network: "mainnet",
769
775
});
770
776
771
777
asyncfunction run() {
@@ -774,7 +780,6 @@ async function run() {
774
780
});
775
781
776
782
forawait (const page ofresult) {
777
-
// Handle the page
778
783
console.log(page);
779
784
}
780
785
}
@@ -795,8 +800,6 @@ import { AvaCloudSDK } from "@avalabs/avacloud-sdk";
795
800
796
801
const avaCloudSDK =newAvaCloudSDK({
797
802
serverURL: "https://api.example.com",
798
-
chainId: "43114",
799
-
network: "mainnet",
800
803
});
801
804
802
805
asyncfunction run() {
@@ -813,7 +816,6 @@ async function run() {
813
816
},
814
817
});
815
818
816
-
// Handle the result
817
819
console.log(result);
818
820
}
819
821
@@ -837,14 +839,11 @@ const avaCloudSDK = new AvaCloudSDK({
837
839
},
838
840
retryConnectionErrors: false,
839
841
},
840
-
chainId: "43114",
841
-
network: "mainnet",
842
842
});
843
843
844
844
asyncfunction run() {
845
845
const result =awaitavaCloudSDK.metrics.healthCheck();
846
846
847
-
// Handle the result
848
847
console.log(result);
849
848
}
850
849
@@ -856,102 +855,46 @@ run();
856
855
<!-- Start Error Handling [errors] -->
857
856
## Error Handling
858
857
859
-
Some methods specify known errors which can be thrown. All the known errors are enumerated in the `models/errors/errors.ts` module. The known errors for a method are documented under the *Errors* tables in SDK docs. For example, the `reindex` method may throw the following errors:
858
+
[`AvaCloudSDKError`](./src/models/errors/avacloudsdkerror.ts) is the base class for all HTTP error responses. It has the following properties:
Validation errors can also occur when either method arguments or data returned from the server do not match the expected format. The `SDKValidationError` that is thrown as a result will capture the raw value that failed validation in an attribute called `rawValue`. Additionally, a `pretty()` method is available on this error that can be used to log a nicely formatted multi-line string since validation errors can list many issues and the plain error string may be difficult read when debugging.
907
+
### Error Classes
908
+
**Primary errors:**
909
+
*[`AvaCloudSDKError`](./src/models/errors/avacloudsdkerror.ts): The base class for HTTP error responses.
910
+
*[`BadRequest`](docs/models/errors/badrequest.md): Bad requests generally mean the client has passed invalid or malformed parameters. Error messages in the response could help in evaluating the error. Status code `400`.
911
+
*[`Unauthorized`](docs/models/errors/unauthorized.md): When a client attempts to access resources that require authorization credentials but the client lacks proper authentication in the request, the server responds with 401. Status code `401`.
912
+
*[`Forbidden`](docs/models/errors/forbidden.md): When a client attempts to access resources with valid credentials but doesn't have the privilege to perform that action, the server responds with 403. Status code `403`.
913
+
*[`NotFound`](docs/models/errors/notfound.md): The error is mostly returned when the client requests with either mistyped URL, or the passed resource is moved or deleted, or the resource doesn't exist. Status code `404`.
914
+
*[`TooManyRequests`](docs/models/errors/toomanyrequests.md): This error is returned when the client has sent too many, and has hit the rate limit. Status code `429`.
915
+
*[`InternalServerError`](docs/models/errors/internalservererror.md): The error is a generic server side error that is returned for any uncaught and unexpected issues on the server side. This should be very rare, and you may reach out to us if the problem persists for a longer duration. Status code `500`.
916
+
*[`BadGateway`](docs/models/errors/badgateway.md): This is an internal error indicating invalid response received by the client-facing proxy or gateway from the upstream server. Status code `502`.
917
+
*[`ServiceUnavailable`](docs/models/errors/serviceunavailable.md): The error is returned for certain routes on a particular Subnet. This indicates an internal problem with our Subnet node, and may not necessarily mean the Subnet is down or affected. Status code `503`.
965
918
966
-
In some rare cases, the SDK can fail to get a response from the server or even make the request due to unexpected circumstances such as network conditions. These types of errors are captured in the `models/errors/httpclienterrors.ts` module:
919
+
<details><summary>Less common errors (6)</summary>
| RequestAbortedError | HTTP request was aborted by the client |
971
-
| RequestTimeoutError | HTTP request timed out due to an AbortSignal signal |
972
-
| ConnectionError | HTTP client was unable to make a request to a server |
973
-
| InvalidRequestError | Any input used to create a request is invalid |
974
-
| UnexpectedClientError | Unrecognised or unexpected error |
921
+
<br />
922
+
923
+
**Network errors:**
924
+
*[`ConnectionError`](./src/models/errors/httpclienterrors.ts): HTTP client was unable to make a request to a server.
925
+
*[`RequestTimeoutError`](./src/models/errors/httpclienterrors.ts): HTTP request timed out due to an AbortSignal signal.
926
+
*[`RequestAbortedError`](./src/models/errors/httpclienterrors.ts): HTTP request was aborted by the client.
927
+
*[`InvalidRequestError`](./src/models/errors/httpclienterrors.ts): Any input used to create a request is invalid.
928
+
*[`UnexpectedClientError`](./src/models/errors/httpclienterrors.ts): Unrecognised or unexpected error.
929
+
930
+
931
+
**Inherit from [`AvaCloudSDKError`](./src/models/errors/avacloudsdkerror.ts)**:
932
+
*[`ResponseValidationError`](./src/models/errors/responsevalidationerror.ts): Type mismatch between the data returned from the server and the structure expected by the SDK. See `error.rawValue` for the raw value and `error.pretty()` for a nicely formatted multi-line string.
933
+
934
+
</details>
975
935
<!-- End Error Handling [errors] -->
976
936
977
937
<!-- Start Custom HTTP Client [http-client] -->
@@ -1041,14 +1001,11 @@ import { AvaCloudSDK } from "@avalabs/avacloud-sdk";
1041
1001
const avaCloudSDK =newAvaCloudSDK({
1042
1002
serverURL: "https://api.example.com",
1043
1003
apiKey: "<YOUR_API_KEY_HERE>",
1044
-
chainId: "43114",
1045
-
network: "mainnet",
1046
1004
});
1047
1005
1048
1006
asyncfunction run() {
1049
1007
const result =awaitavaCloudSDK.metrics.healthCheck();
0 commit comments