@elsoul/erpc-sdk 0.5.0 → 0.6.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/README.md +17 -4
- package/dist/index.cjs +127 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +192 -2
- package/dist/index.d.ts +192 -2
- package/dist/index.js +122 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -226,6 +226,23 @@ declare class PriceClient {
|
|
|
226
226
|
streamPriceUpdates(options: PriceStreamOptions, sendOptions?: RpcSendOptions): AsyncGenerator<PriceStreamEvent, void, undefined>;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
+
interface HttpTransportConfig {
|
|
230
|
+
readonly apiKey: string;
|
|
231
|
+
readonly endpoint: URL;
|
|
232
|
+
readonly fetch: typeof globalThis.fetch;
|
|
233
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
234
|
+
readonly maxBatchSize?: number;
|
|
235
|
+
readonly timeoutMs: number;
|
|
236
|
+
}
|
|
237
|
+
declare class HttpJsonRpcTransport {
|
|
238
|
+
#private;
|
|
239
|
+
readonly endpoint: string;
|
|
240
|
+
readonly maxBatchSize: number;
|
|
241
|
+
constructor(config: HttpTransportConfig);
|
|
242
|
+
request<TResult>(method: string, params?: JsonRpcParams, options?: RpcSendOptions): Promise<TResult>;
|
|
243
|
+
batch<TResult extends readonly unknown[]>(calls: readonly RpcBatchCall[], options?: RpcSendOptions): Promise<TResult>;
|
|
244
|
+
}
|
|
245
|
+
|
|
229
246
|
interface JsonRpcTransport {
|
|
230
247
|
readonly endpoint: string;
|
|
231
248
|
readonly maxBatchSize: number;
|
|
@@ -370,6 +387,177 @@ interface EthereumClient {
|
|
|
370
387
|
readonly rpc: RpcNamespace<EthereumRpcSchema>;
|
|
371
388
|
}
|
|
372
389
|
|
|
390
|
+
interface AvalancheEncodingParams {
|
|
391
|
+
readonly encoding?: string;
|
|
392
|
+
}
|
|
393
|
+
interface AvalancheUtxoParams extends AvalancheEncodingParams {
|
|
394
|
+
readonly addresses: readonly string[];
|
|
395
|
+
readonly limit?: number | string;
|
|
396
|
+
readonly sourceChain?: string;
|
|
397
|
+
readonly startIndex?: Readonly<Record<string, JsonValue>>;
|
|
398
|
+
}
|
|
399
|
+
interface AvalancheAvaxSchema {
|
|
400
|
+
readonly getAtomicTx: RpcMethodSpec<AvalancheEncodingParams & {
|
|
401
|
+
readonly txID: string;
|
|
402
|
+
}, JsonValue>;
|
|
403
|
+
readonly getAtomicTxStatus: RpcMethodSpec<{
|
|
404
|
+
readonly txID: string;
|
|
405
|
+
}, JsonValue>;
|
|
406
|
+
readonly getUTXOs: RpcMethodSpec<AvalancheUtxoParams & {
|
|
407
|
+
readonly sourceChain: string;
|
|
408
|
+
}, JsonValue>;
|
|
409
|
+
readonly issueTx: RpcMethodSpec<AvalancheEncodingParams & {
|
|
410
|
+
readonly tx: string;
|
|
411
|
+
}, JsonValue>;
|
|
412
|
+
}
|
|
413
|
+
interface AvalancheXChainSchema {
|
|
414
|
+
readonly buildGenesis: RpcMethodSpec<AvalancheEncodingParams & {
|
|
415
|
+
readonly genesisData: Readonly<Record<string, JsonValue>>;
|
|
416
|
+
readonly networkId: number | string;
|
|
417
|
+
}, JsonValue>;
|
|
418
|
+
readonly getAllBalances: RpcMethodSpec<{
|
|
419
|
+
readonly address: string;
|
|
420
|
+
}, JsonValue>;
|
|
421
|
+
readonly getAssetDescription: RpcMethodSpec<{
|
|
422
|
+
readonly assetID: string;
|
|
423
|
+
}, JsonValue>;
|
|
424
|
+
readonly getBalance: RpcMethodSpec<{
|
|
425
|
+
readonly address: string;
|
|
426
|
+
readonly assetID: string;
|
|
427
|
+
}, JsonValue>;
|
|
428
|
+
readonly getBlockByHeight: RpcMethodSpec<AvalancheEncodingParams & {
|
|
429
|
+
readonly height: number | string;
|
|
430
|
+
}, JsonValue>;
|
|
431
|
+
readonly getHeight: RpcMethodSpec<undefined, JsonValue>;
|
|
432
|
+
readonly getTx: RpcMethodSpec<AvalancheEncodingParams & {
|
|
433
|
+
readonly txID: string;
|
|
434
|
+
}, JsonValue>;
|
|
435
|
+
readonly getTxFee: RpcMethodSpec<undefined, JsonValue>;
|
|
436
|
+
readonly getTxStatus: RpcMethodSpec<{
|
|
437
|
+
readonly txID: string;
|
|
438
|
+
}, JsonValue>;
|
|
439
|
+
readonly getUTXOs: RpcMethodSpec<AvalancheUtxoParams, JsonValue>;
|
|
440
|
+
readonly issueTx: RpcMethodSpec<AvalancheEncodingParams & {
|
|
441
|
+
readonly tx: string;
|
|
442
|
+
}, JsonValue>;
|
|
443
|
+
}
|
|
444
|
+
interface AvalanchePChainSchema {
|
|
445
|
+
readonly getAllValidatorsAt: RpcMethodSpec<{
|
|
446
|
+
readonly height: number | string;
|
|
447
|
+
}, JsonValue>;
|
|
448
|
+
readonly getBalance: RpcMethodSpec<{
|
|
449
|
+
readonly addresses?: readonly string[];
|
|
450
|
+
}, JsonValue>;
|
|
451
|
+
readonly getBlockchainStatus: RpcMethodSpec<{
|
|
452
|
+
readonly blockchainID?: string;
|
|
453
|
+
}, JsonValue>;
|
|
454
|
+
readonly getBlockchains: RpcMethodSpec<undefined, JsonValue>;
|
|
455
|
+
readonly getCurrentSupply: RpcMethodSpec<undefined, JsonValue>;
|
|
456
|
+
readonly getCurrentValidators: RpcMethodSpec<{
|
|
457
|
+
readonly nodeIDs?: readonly string[];
|
|
458
|
+
readonly subnetID?: string;
|
|
459
|
+
}, JsonValue>;
|
|
460
|
+
readonly getFeeConfig: RpcMethodSpec<undefined, JsonValue>;
|
|
461
|
+
readonly getFeeState: RpcMethodSpec<undefined, JsonValue>;
|
|
462
|
+
readonly getHeight: RpcMethodSpec<undefined, JsonValue>;
|
|
463
|
+
readonly getMinStake: RpcMethodSpec<undefined, JsonValue>;
|
|
464
|
+
readonly getRewardUTXOs: RpcMethodSpec<AvalancheEncodingParams & {
|
|
465
|
+
readonly txID?: string;
|
|
466
|
+
}, JsonValue>;
|
|
467
|
+
readonly getStake: RpcMethodSpec<AvalancheEncodingParams & {
|
|
468
|
+
readonly addresses?: readonly string[];
|
|
469
|
+
readonly validatorsOnly?: boolean;
|
|
470
|
+
}, JsonValue>;
|
|
471
|
+
readonly getStakingAssetID: RpcMethodSpec<{
|
|
472
|
+
readonly subnetID?: string;
|
|
473
|
+
}, JsonValue>;
|
|
474
|
+
readonly getSubnets: RpcMethodSpec<{
|
|
475
|
+
readonly ids?: readonly string[];
|
|
476
|
+
}, JsonValue>;
|
|
477
|
+
readonly getTimestamp: RpcMethodSpec<undefined, JsonValue>;
|
|
478
|
+
readonly getTotalStake: RpcMethodSpec<{
|
|
479
|
+
readonly subnetID?: string;
|
|
480
|
+
}, JsonValue>;
|
|
481
|
+
readonly getTx: RpcMethodSpec<AvalancheEncodingParams & {
|
|
482
|
+
readonly txID: string;
|
|
483
|
+
}, JsonValue>;
|
|
484
|
+
readonly getTxStatus: RpcMethodSpec<{
|
|
485
|
+
readonly txID: string;
|
|
486
|
+
}, JsonValue>;
|
|
487
|
+
readonly getUTXOs: RpcMethodSpec<AvalancheUtxoParams, JsonValue>;
|
|
488
|
+
readonly getValidatorFeeConfig: RpcMethodSpec<undefined, JsonValue>;
|
|
489
|
+
readonly getValidatorFeeState: RpcMethodSpec<undefined, JsonValue>;
|
|
490
|
+
readonly getValidatorsAt: RpcMethodSpec<{
|
|
491
|
+
readonly height: number | string;
|
|
492
|
+
readonly subnetID?: string;
|
|
493
|
+
}, JsonValue>;
|
|
494
|
+
readonly issueTx: RpcMethodSpec<AvalancheEncodingParams & {
|
|
495
|
+
readonly tx: string;
|
|
496
|
+
}, JsonValue>;
|
|
497
|
+
readonly sampleValidators: RpcMethodSpec<{
|
|
498
|
+
readonly size: number | string;
|
|
499
|
+
readonly subnetID?: string;
|
|
500
|
+
}, JsonValue>;
|
|
501
|
+
readonly validatedBy: RpcMethodSpec<{
|
|
502
|
+
readonly blockchainID: string;
|
|
503
|
+
}, JsonValue>;
|
|
504
|
+
readonly validates: RpcMethodSpec<{
|
|
505
|
+
readonly subnetID: string;
|
|
506
|
+
}, JsonValue>;
|
|
507
|
+
}
|
|
508
|
+
interface AvalancheProposerVmSchema {
|
|
509
|
+
readonly getCurrentEpoch: RpcMethodSpec<undefined, JsonValue>;
|
|
510
|
+
readonly getProposedHeight: RpcMethodSpec<undefined, JsonValue>;
|
|
511
|
+
}
|
|
512
|
+
interface AvalancheInfoSchema {
|
|
513
|
+
readonly upgrades: RpcMethodSpec<undefined, JsonValue>;
|
|
514
|
+
}
|
|
515
|
+
interface AvalancheIndexSchema {
|
|
516
|
+
readonly getContainerByID: RpcMethodSpec<AvalancheEncodingParams & {
|
|
517
|
+
readonly id: string;
|
|
518
|
+
}, JsonValue>;
|
|
519
|
+
readonly getContainerByIndex: RpcMethodSpec<AvalancheEncodingParams & {
|
|
520
|
+
readonly index: number | string;
|
|
521
|
+
}, JsonValue>;
|
|
522
|
+
readonly getContainerRange: RpcMethodSpec<AvalancheEncodingParams & {
|
|
523
|
+
readonly numToFetch: number | string;
|
|
524
|
+
readonly startIndex: number | string;
|
|
525
|
+
}, JsonValue>;
|
|
526
|
+
readonly getIndex: RpcMethodSpec<AvalancheEncodingParams & {
|
|
527
|
+
readonly containerID: string;
|
|
528
|
+
}, JsonValue>;
|
|
529
|
+
readonly getLastAccepted: RpcMethodSpec<AvalancheEncodingParams, JsonValue>;
|
|
530
|
+
readonly isAccepted: RpcMethodSpec<AvalancheEncodingParams & {
|
|
531
|
+
readonly containerID: string;
|
|
532
|
+
}, JsonValue>;
|
|
533
|
+
}
|
|
534
|
+
declare const AVALANCHE_AVAX_METHODS: readonly ["avax.getAtomicTx", "avax.getAtomicTxStatus", "avax.getUTXOs", "avax.issueTx"];
|
|
535
|
+
declare const AVALANCHE_X_CHAIN_METHODS: readonly ["avm.buildGenesis", "avm.getAllBalances", "avm.getAssetDescription", "avm.getBalance", "avm.getBlockByHeight", "avm.getHeight", "avm.getTx", "avm.getTxFee", "avm.getTxStatus", "avm.getUTXOs", "avm.issueTx"];
|
|
536
|
+
declare const AVALANCHE_P_CHAIN_METHODS: readonly ["platform.getAllValidatorsAt", "platform.getBalance", "platform.getBlockchainStatus", "platform.getBlockchains", "platform.getCurrentSupply", "platform.getCurrentValidators", "platform.getFeeConfig", "platform.getFeeState", "platform.getHeight", "platform.getMinStake", "platform.getRewardUTXOs", "platform.getStake", "platform.getStakingAssetID", "platform.getSubnets", "platform.getTimestamp", "platform.getTotalStake", "platform.getTx", "platform.getTxStatus", "platform.getUTXOs", "platform.getValidatorFeeConfig", "platform.getValidatorFeeState", "platform.getValidatorsAt", "platform.issueTx", "platform.sampleValidators", "platform.validatedBy", "platform.validates"];
|
|
537
|
+
declare const AVALANCHE_PROPOSER_VM_METHODS: readonly ["proposervm.getCurrentEpoch", "proposervm.getProposedHeight"];
|
|
538
|
+
declare const AVALANCHE_INFO_METHODS: readonly ["info.upgrades"];
|
|
539
|
+
declare const AVALANCHE_INDEX_METHODS: readonly ["index.getContainerByID", "index.getContainerByIndex", "index.getContainerRange", "index.getIndex", "index.getLastAccepted", "index.isAccepted"];
|
|
540
|
+
interface AvalancheIndexClient {
|
|
541
|
+
readonly cChainBlocks: RpcNamespace<AvalancheIndexSchema>;
|
|
542
|
+
readonly pChainBlocks: RpcNamespace<AvalancheIndexSchema>;
|
|
543
|
+
readonly xChainBlocks: RpcNamespace<AvalancheIndexSchema>;
|
|
544
|
+
readonly xChainTransactions: RpcNamespace<AvalancheIndexSchema>;
|
|
545
|
+
}
|
|
546
|
+
interface AvalancheClient extends EthereumClient {
|
|
547
|
+
readonly avax: RpcNamespace<AvalancheAvaxSchema>;
|
|
548
|
+
readonly index: AvalancheIndexClient;
|
|
549
|
+
readonly info: RpcNamespace<AvalancheInfoSchema>;
|
|
550
|
+
readonly pChain: RpcNamespace<AvalanchePChainSchema>;
|
|
551
|
+
readonly proposerVm: RpcNamespace<AvalancheProposerVmSchema>;
|
|
552
|
+
readonly xChain: RpcNamespace<AvalancheXChainSchema>;
|
|
553
|
+
}
|
|
554
|
+
interface AvalancheIndexTransports {
|
|
555
|
+
readonly cChainBlocks: HttpJsonRpcTransport;
|
|
556
|
+
readonly pChainBlocks: HttpJsonRpcTransport;
|
|
557
|
+
readonly xChainBlocks: HttpJsonRpcTransport;
|
|
558
|
+
readonly xChainTransactions: HttpJsonRpcTransport;
|
|
559
|
+
}
|
|
560
|
+
|
|
373
561
|
type SolanaCommitment = 'confirmed' | 'finalized' | 'processed';
|
|
374
562
|
type SolanaEncoding = 'base58' | 'base64' | 'base64+zstd' | 'jsonParsed';
|
|
375
563
|
type SolanaConfig = Readonly<Record<string, unknown>>;
|
|
@@ -845,7 +1033,9 @@ interface ErpcSolanaClient extends SolanaClient {
|
|
|
845
1033
|
interface ErpcEthereumClient extends EthereumClient {
|
|
846
1034
|
readonly subscriptions: EthereumSubscriptions;
|
|
847
1035
|
}
|
|
848
|
-
|
|
1036
|
+
interface ErpcAvalancheClient extends AvalancheClient {
|
|
1037
|
+
readonly subscriptions: EthereumSubscriptions;
|
|
1038
|
+
}
|
|
849
1039
|
interface ErpcClient {
|
|
850
1040
|
readonly account: AccountClient;
|
|
851
1041
|
readonly avalanche: ErpcAvalancheClient;
|
|
@@ -922,4 +1112,4 @@ declare class ErpcBatchPolicyError extends ErpcError {
|
|
|
922
1112
|
constructor(message: string);
|
|
923
1113
|
}
|
|
924
1114
|
|
|
925
|
-
export { AccountClient, type AddressTransaction, type AddressTransactionPage, type AddressTransactionsOptions, type AddressTransfer, type AddressTransferPage, type AddressTransfersOptions, type AnalyticsTimeBound, type AssetBatchRequest, type AssetListRequest, type AssetRequest, type BinaryUpdate, CloudCatalogClient, type CloudCredit, type CloudCreditAlertLevel, CloudCreditClient, type CloudOffering, type CloudOfferingBilling, type CloudOfferingCompute, type CloudOfferingSolana, type CloudResource, type CloudResourceKind, type CloudResourceMode, type CloudResourceStatus, type CloudResourceStatusBilling, CloudResourcesClient, DEFAULT_ACCOUNT_ENDPOINT, DEFAULT_AVALANCHE_ENDPOINT, DEFAULT_ENDPOINT, DEFAULT_TIMEOUT_MS, DEFAULT_USER_ENDPOINT, ETHEREUM_RPC_METHODS, ETHEREUM_SUBSCRIPTION_METHODS, type EpochSummary, ErpcAbortedError, type ErpcAvalancheClient, ErpcBatchPolicyError, type ErpcClient, type ErpcClientConfig, type ErpcCloudClient, type ErpcCloudClientConfig, type ErpcCloudRequestOptions, ErpcConfigError, ErpcError, type ErpcErrorCode, type ErpcEthereumClient, ErpcHttpError, ErpcInvalidResponseError, ErpcJsonRpcError, type ErpcPlan, type ErpcSolanaClient, ErpcTimeoutError, ErpcTransportError, type EthereumAddress, type EthereumBlockTag, type EthereumClient, type EthereumFilter, type EthereumObject, type EthereumRpcSchema, type EthereumSubscriptionSchema, EthereumSubscriptions, type EthereumTransactionRequest, type Hex, type IndexedAsset, type IndexedAssetList, type IndexedAssetProof, type JsonObject, type JsonPrimitive, type JsonRpcErrorObject, type JsonRpcFailure, type JsonRpcId, type JsonRpcParams, type JsonRpcRequest, type JsonRpcResponse, type JsonRpcSuccess, type JsonRpcTransport, type JsonValue, type LeaderSlot, type LeaderSlotsResult, type MonthlyApiKeyChainUsage, type MonthlyApiKeyMethodUsage, type MonthlyApiKeyUsage, type MonthlyApiKeyUsageEntry, type MonthlyApiKeyUsageParams, type NumericFilter, type ParsedPriceUpdate, PendingRpcBatchRequest, PendingRpcRequest, type PingMeasurement, type PriceAssetType, PriceClient, type PriceEncoding, type PriceFeedMetadata, type PricePoint, type PriceStreamEvent, type PriceStreamOptions, type PriceUpdateOptions, type PriceUpdateResponse, type PriorityFeeEstimate, type ProgramStatsBucket, type ProgramStatsOptions, type PublisherStakeCap, type PublisherStakeCapsResponse, type RpcBatchCall, type RpcMethodSpec, type RpcNamespace, type RpcNamespaceBase, type RpcNotification, type RpcNotificationListener, type RpcParams, type RpcResult, type RpcSendOptions, RpcSubscription, SOLANA_ANALYTICS_METHODS, SOLANA_DAS_METHODS, SOLANA_ENHANCED_SUBSCRIPTION_METHODS, SOLANA_HISTORY_METHODS, SOLANA_LEADER_METHODS, SOLANA_RPC_METHODS, type SlotStatsOptions, type SlotStatsRow, type SolanaAnalyticsSchema, type SolanaClient, type SolanaCommitment, type SolanaConfig, type SolanaContext, type SolanaContextResult, type SolanaDasSchema, type SolanaEncoding, type SolanaEnhancedSubscriptionSchema, type SolanaHistorySchema, type SolanaLeaderSchema, type SolanaRpcSchema, SolanaSubscriptions, type SubscriptionId, type SubscriptionListener, type TokenBalance, type TopProgramRow, type TopProgramsOptions, type TpsBucket, type TpsTimeseriesOptions, UsageClient, type ValidatorInformation, type ValidatorsInformationOptions, type ValidatorsInformationResult, createErpcClient, createErpcCloudClient };
|
|
1115
|
+
export { AVALANCHE_AVAX_METHODS, AVALANCHE_INDEX_METHODS, AVALANCHE_INFO_METHODS, AVALANCHE_PROPOSER_VM_METHODS, AVALANCHE_P_CHAIN_METHODS, AVALANCHE_X_CHAIN_METHODS, AccountClient, type AddressTransaction, type AddressTransactionPage, type AddressTransactionsOptions, type AddressTransfer, type AddressTransferPage, type AddressTransfersOptions, type AnalyticsTimeBound, type AssetBatchRequest, type AssetListRequest, type AssetRequest, type AvalancheAvaxSchema, type AvalancheClient, type AvalancheEncodingParams, type AvalancheIndexClient, type AvalancheIndexSchema, type AvalancheIndexTransports, type AvalancheInfoSchema, type AvalanchePChainSchema, type AvalancheProposerVmSchema, type AvalancheUtxoParams, type AvalancheXChainSchema, type BinaryUpdate, CloudCatalogClient, type CloudCredit, type CloudCreditAlertLevel, CloudCreditClient, type CloudOffering, type CloudOfferingBilling, type CloudOfferingCompute, type CloudOfferingSolana, type CloudResource, type CloudResourceKind, type CloudResourceMode, type CloudResourceStatus, type CloudResourceStatusBilling, CloudResourcesClient, DEFAULT_ACCOUNT_ENDPOINT, DEFAULT_AVALANCHE_ENDPOINT, DEFAULT_ENDPOINT, DEFAULT_TIMEOUT_MS, DEFAULT_USER_ENDPOINT, ETHEREUM_RPC_METHODS, ETHEREUM_SUBSCRIPTION_METHODS, type EpochSummary, ErpcAbortedError, type ErpcAvalancheClient, ErpcBatchPolicyError, type ErpcClient, type ErpcClientConfig, type ErpcCloudClient, type ErpcCloudClientConfig, type ErpcCloudRequestOptions, ErpcConfigError, ErpcError, type ErpcErrorCode, type ErpcEthereumClient, ErpcHttpError, ErpcInvalidResponseError, ErpcJsonRpcError, type ErpcPlan, type ErpcSolanaClient, ErpcTimeoutError, ErpcTransportError, type EthereumAddress, type EthereumBlockTag, type EthereumClient, type EthereumFilter, type EthereumObject, type EthereumRpcSchema, type EthereumSubscriptionSchema, EthereumSubscriptions, type EthereumTransactionRequest, type Hex, type IndexedAsset, type IndexedAssetList, type IndexedAssetProof, type JsonObject, type JsonPrimitive, type JsonRpcErrorObject, type JsonRpcFailure, type JsonRpcId, type JsonRpcParams, type JsonRpcRequest, type JsonRpcResponse, type JsonRpcSuccess, type JsonRpcTransport, type JsonValue, type LeaderSlot, type LeaderSlotsResult, type MonthlyApiKeyChainUsage, type MonthlyApiKeyMethodUsage, type MonthlyApiKeyUsage, type MonthlyApiKeyUsageEntry, type MonthlyApiKeyUsageParams, type NumericFilter, type ParsedPriceUpdate, PendingRpcBatchRequest, PendingRpcRequest, type PingMeasurement, type PriceAssetType, PriceClient, type PriceEncoding, type PriceFeedMetadata, type PricePoint, type PriceStreamEvent, type PriceStreamOptions, type PriceUpdateOptions, type PriceUpdateResponse, type PriorityFeeEstimate, type ProgramStatsBucket, type ProgramStatsOptions, type PublisherStakeCap, type PublisherStakeCapsResponse, type RpcBatchCall, type RpcMethodSpec, type RpcNamespace, type RpcNamespaceBase, type RpcNotification, type RpcNotificationListener, type RpcParams, type RpcResult, type RpcSendOptions, RpcSubscription, SOLANA_ANALYTICS_METHODS, SOLANA_DAS_METHODS, SOLANA_ENHANCED_SUBSCRIPTION_METHODS, SOLANA_HISTORY_METHODS, SOLANA_LEADER_METHODS, SOLANA_RPC_METHODS, type SlotStatsOptions, type SlotStatsRow, type SolanaAnalyticsSchema, type SolanaClient, type SolanaCommitment, type SolanaConfig, type SolanaContext, type SolanaContextResult, type SolanaDasSchema, type SolanaEncoding, type SolanaEnhancedSubscriptionSchema, type SolanaHistorySchema, type SolanaLeaderSchema, type SolanaRpcSchema, SolanaSubscriptions, type SubscriptionId, type SubscriptionListener, type TokenBalance, type TopProgramRow, type TopProgramsOptions, type TpsBucket, type TpsTimeseriesOptions, UsageClient, type ValidatorInformation, type ValidatorsInformationOptions, type ValidatorsInformationResult, createErpcClient, createErpcCloudClient };
|
package/dist/index.d.ts
CHANGED
|
@@ -226,6 +226,23 @@ declare class PriceClient {
|
|
|
226
226
|
streamPriceUpdates(options: PriceStreamOptions, sendOptions?: RpcSendOptions): AsyncGenerator<PriceStreamEvent, void, undefined>;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
+
interface HttpTransportConfig {
|
|
230
|
+
readonly apiKey: string;
|
|
231
|
+
readonly endpoint: URL;
|
|
232
|
+
readonly fetch: typeof globalThis.fetch;
|
|
233
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
234
|
+
readonly maxBatchSize?: number;
|
|
235
|
+
readonly timeoutMs: number;
|
|
236
|
+
}
|
|
237
|
+
declare class HttpJsonRpcTransport {
|
|
238
|
+
#private;
|
|
239
|
+
readonly endpoint: string;
|
|
240
|
+
readonly maxBatchSize: number;
|
|
241
|
+
constructor(config: HttpTransportConfig);
|
|
242
|
+
request<TResult>(method: string, params?: JsonRpcParams, options?: RpcSendOptions): Promise<TResult>;
|
|
243
|
+
batch<TResult extends readonly unknown[]>(calls: readonly RpcBatchCall[], options?: RpcSendOptions): Promise<TResult>;
|
|
244
|
+
}
|
|
245
|
+
|
|
229
246
|
interface JsonRpcTransport {
|
|
230
247
|
readonly endpoint: string;
|
|
231
248
|
readonly maxBatchSize: number;
|
|
@@ -370,6 +387,177 @@ interface EthereumClient {
|
|
|
370
387
|
readonly rpc: RpcNamespace<EthereumRpcSchema>;
|
|
371
388
|
}
|
|
372
389
|
|
|
390
|
+
interface AvalancheEncodingParams {
|
|
391
|
+
readonly encoding?: string;
|
|
392
|
+
}
|
|
393
|
+
interface AvalancheUtxoParams extends AvalancheEncodingParams {
|
|
394
|
+
readonly addresses: readonly string[];
|
|
395
|
+
readonly limit?: number | string;
|
|
396
|
+
readonly sourceChain?: string;
|
|
397
|
+
readonly startIndex?: Readonly<Record<string, JsonValue>>;
|
|
398
|
+
}
|
|
399
|
+
interface AvalancheAvaxSchema {
|
|
400
|
+
readonly getAtomicTx: RpcMethodSpec<AvalancheEncodingParams & {
|
|
401
|
+
readonly txID: string;
|
|
402
|
+
}, JsonValue>;
|
|
403
|
+
readonly getAtomicTxStatus: RpcMethodSpec<{
|
|
404
|
+
readonly txID: string;
|
|
405
|
+
}, JsonValue>;
|
|
406
|
+
readonly getUTXOs: RpcMethodSpec<AvalancheUtxoParams & {
|
|
407
|
+
readonly sourceChain: string;
|
|
408
|
+
}, JsonValue>;
|
|
409
|
+
readonly issueTx: RpcMethodSpec<AvalancheEncodingParams & {
|
|
410
|
+
readonly tx: string;
|
|
411
|
+
}, JsonValue>;
|
|
412
|
+
}
|
|
413
|
+
interface AvalancheXChainSchema {
|
|
414
|
+
readonly buildGenesis: RpcMethodSpec<AvalancheEncodingParams & {
|
|
415
|
+
readonly genesisData: Readonly<Record<string, JsonValue>>;
|
|
416
|
+
readonly networkId: number | string;
|
|
417
|
+
}, JsonValue>;
|
|
418
|
+
readonly getAllBalances: RpcMethodSpec<{
|
|
419
|
+
readonly address: string;
|
|
420
|
+
}, JsonValue>;
|
|
421
|
+
readonly getAssetDescription: RpcMethodSpec<{
|
|
422
|
+
readonly assetID: string;
|
|
423
|
+
}, JsonValue>;
|
|
424
|
+
readonly getBalance: RpcMethodSpec<{
|
|
425
|
+
readonly address: string;
|
|
426
|
+
readonly assetID: string;
|
|
427
|
+
}, JsonValue>;
|
|
428
|
+
readonly getBlockByHeight: RpcMethodSpec<AvalancheEncodingParams & {
|
|
429
|
+
readonly height: number | string;
|
|
430
|
+
}, JsonValue>;
|
|
431
|
+
readonly getHeight: RpcMethodSpec<undefined, JsonValue>;
|
|
432
|
+
readonly getTx: RpcMethodSpec<AvalancheEncodingParams & {
|
|
433
|
+
readonly txID: string;
|
|
434
|
+
}, JsonValue>;
|
|
435
|
+
readonly getTxFee: RpcMethodSpec<undefined, JsonValue>;
|
|
436
|
+
readonly getTxStatus: RpcMethodSpec<{
|
|
437
|
+
readonly txID: string;
|
|
438
|
+
}, JsonValue>;
|
|
439
|
+
readonly getUTXOs: RpcMethodSpec<AvalancheUtxoParams, JsonValue>;
|
|
440
|
+
readonly issueTx: RpcMethodSpec<AvalancheEncodingParams & {
|
|
441
|
+
readonly tx: string;
|
|
442
|
+
}, JsonValue>;
|
|
443
|
+
}
|
|
444
|
+
interface AvalanchePChainSchema {
|
|
445
|
+
readonly getAllValidatorsAt: RpcMethodSpec<{
|
|
446
|
+
readonly height: number | string;
|
|
447
|
+
}, JsonValue>;
|
|
448
|
+
readonly getBalance: RpcMethodSpec<{
|
|
449
|
+
readonly addresses?: readonly string[];
|
|
450
|
+
}, JsonValue>;
|
|
451
|
+
readonly getBlockchainStatus: RpcMethodSpec<{
|
|
452
|
+
readonly blockchainID?: string;
|
|
453
|
+
}, JsonValue>;
|
|
454
|
+
readonly getBlockchains: RpcMethodSpec<undefined, JsonValue>;
|
|
455
|
+
readonly getCurrentSupply: RpcMethodSpec<undefined, JsonValue>;
|
|
456
|
+
readonly getCurrentValidators: RpcMethodSpec<{
|
|
457
|
+
readonly nodeIDs?: readonly string[];
|
|
458
|
+
readonly subnetID?: string;
|
|
459
|
+
}, JsonValue>;
|
|
460
|
+
readonly getFeeConfig: RpcMethodSpec<undefined, JsonValue>;
|
|
461
|
+
readonly getFeeState: RpcMethodSpec<undefined, JsonValue>;
|
|
462
|
+
readonly getHeight: RpcMethodSpec<undefined, JsonValue>;
|
|
463
|
+
readonly getMinStake: RpcMethodSpec<undefined, JsonValue>;
|
|
464
|
+
readonly getRewardUTXOs: RpcMethodSpec<AvalancheEncodingParams & {
|
|
465
|
+
readonly txID?: string;
|
|
466
|
+
}, JsonValue>;
|
|
467
|
+
readonly getStake: RpcMethodSpec<AvalancheEncodingParams & {
|
|
468
|
+
readonly addresses?: readonly string[];
|
|
469
|
+
readonly validatorsOnly?: boolean;
|
|
470
|
+
}, JsonValue>;
|
|
471
|
+
readonly getStakingAssetID: RpcMethodSpec<{
|
|
472
|
+
readonly subnetID?: string;
|
|
473
|
+
}, JsonValue>;
|
|
474
|
+
readonly getSubnets: RpcMethodSpec<{
|
|
475
|
+
readonly ids?: readonly string[];
|
|
476
|
+
}, JsonValue>;
|
|
477
|
+
readonly getTimestamp: RpcMethodSpec<undefined, JsonValue>;
|
|
478
|
+
readonly getTotalStake: RpcMethodSpec<{
|
|
479
|
+
readonly subnetID?: string;
|
|
480
|
+
}, JsonValue>;
|
|
481
|
+
readonly getTx: RpcMethodSpec<AvalancheEncodingParams & {
|
|
482
|
+
readonly txID: string;
|
|
483
|
+
}, JsonValue>;
|
|
484
|
+
readonly getTxStatus: RpcMethodSpec<{
|
|
485
|
+
readonly txID: string;
|
|
486
|
+
}, JsonValue>;
|
|
487
|
+
readonly getUTXOs: RpcMethodSpec<AvalancheUtxoParams, JsonValue>;
|
|
488
|
+
readonly getValidatorFeeConfig: RpcMethodSpec<undefined, JsonValue>;
|
|
489
|
+
readonly getValidatorFeeState: RpcMethodSpec<undefined, JsonValue>;
|
|
490
|
+
readonly getValidatorsAt: RpcMethodSpec<{
|
|
491
|
+
readonly height: number | string;
|
|
492
|
+
readonly subnetID?: string;
|
|
493
|
+
}, JsonValue>;
|
|
494
|
+
readonly issueTx: RpcMethodSpec<AvalancheEncodingParams & {
|
|
495
|
+
readonly tx: string;
|
|
496
|
+
}, JsonValue>;
|
|
497
|
+
readonly sampleValidators: RpcMethodSpec<{
|
|
498
|
+
readonly size: number | string;
|
|
499
|
+
readonly subnetID?: string;
|
|
500
|
+
}, JsonValue>;
|
|
501
|
+
readonly validatedBy: RpcMethodSpec<{
|
|
502
|
+
readonly blockchainID: string;
|
|
503
|
+
}, JsonValue>;
|
|
504
|
+
readonly validates: RpcMethodSpec<{
|
|
505
|
+
readonly subnetID: string;
|
|
506
|
+
}, JsonValue>;
|
|
507
|
+
}
|
|
508
|
+
interface AvalancheProposerVmSchema {
|
|
509
|
+
readonly getCurrentEpoch: RpcMethodSpec<undefined, JsonValue>;
|
|
510
|
+
readonly getProposedHeight: RpcMethodSpec<undefined, JsonValue>;
|
|
511
|
+
}
|
|
512
|
+
interface AvalancheInfoSchema {
|
|
513
|
+
readonly upgrades: RpcMethodSpec<undefined, JsonValue>;
|
|
514
|
+
}
|
|
515
|
+
interface AvalancheIndexSchema {
|
|
516
|
+
readonly getContainerByID: RpcMethodSpec<AvalancheEncodingParams & {
|
|
517
|
+
readonly id: string;
|
|
518
|
+
}, JsonValue>;
|
|
519
|
+
readonly getContainerByIndex: RpcMethodSpec<AvalancheEncodingParams & {
|
|
520
|
+
readonly index: number | string;
|
|
521
|
+
}, JsonValue>;
|
|
522
|
+
readonly getContainerRange: RpcMethodSpec<AvalancheEncodingParams & {
|
|
523
|
+
readonly numToFetch: number | string;
|
|
524
|
+
readonly startIndex: number | string;
|
|
525
|
+
}, JsonValue>;
|
|
526
|
+
readonly getIndex: RpcMethodSpec<AvalancheEncodingParams & {
|
|
527
|
+
readonly containerID: string;
|
|
528
|
+
}, JsonValue>;
|
|
529
|
+
readonly getLastAccepted: RpcMethodSpec<AvalancheEncodingParams, JsonValue>;
|
|
530
|
+
readonly isAccepted: RpcMethodSpec<AvalancheEncodingParams & {
|
|
531
|
+
readonly containerID: string;
|
|
532
|
+
}, JsonValue>;
|
|
533
|
+
}
|
|
534
|
+
declare const AVALANCHE_AVAX_METHODS: readonly ["avax.getAtomicTx", "avax.getAtomicTxStatus", "avax.getUTXOs", "avax.issueTx"];
|
|
535
|
+
declare const AVALANCHE_X_CHAIN_METHODS: readonly ["avm.buildGenesis", "avm.getAllBalances", "avm.getAssetDescription", "avm.getBalance", "avm.getBlockByHeight", "avm.getHeight", "avm.getTx", "avm.getTxFee", "avm.getTxStatus", "avm.getUTXOs", "avm.issueTx"];
|
|
536
|
+
declare const AVALANCHE_P_CHAIN_METHODS: readonly ["platform.getAllValidatorsAt", "platform.getBalance", "platform.getBlockchainStatus", "platform.getBlockchains", "platform.getCurrentSupply", "platform.getCurrentValidators", "platform.getFeeConfig", "platform.getFeeState", "platform.getHeight", "platform.getMinStake", "platform.getRewardUTXOs", "platform.getStake", "platform.getStakingAssetID", "platform.getSubnets", "platform.getTimestamp", "platform.getTotalStake", "platform.getTx", "platform.getTxStatus", "platform.getUTXOs", "platform.getValidatorFeeConfig", "platform.getValidatorFeeState", "platform.getValidatorsAt", "platform.issueTx", "platform.sampleValidators", "platform.validatedBy", "platform.validates"];
|
|
537
|
+
declare const AVALANCHE_PROPOSER_VM_METHODS: readonly ["proposervm.getCurrentEpoch", "proposervm.getProposedHeight"];
|
|
538
|
+
declare const AVALANCHE_INFO_METHODS: readonly ["info.upgrades"];
|
|
539
|
+
declare const AVALANCHE_INDEX_METHODS: readonly ["index.getContainerByID", "index.getContainerByIndex", "index.getContainerRange", "index.getIndex", "index.getLastAccepted", "index.isAccepted"];
|
|
540
|
+
interface AvalancheIndexClient {
|
|
541
|
+
readonly cChainBlocks: RpcNamespace<AvalancheIndexSchema>;
|
|
542
|
+
readonly pChainBlocks: RpcNamespace<AvalancheIndexSchema>;
|
|
543
|
+
readonly xChainBlocks: RpcNamespace<AvalancheIndexSchema>;
|
|
544
|
+
readonly xChainTransactions: RpcNamespace<AvalancheIndexSchema>;
|
|
545
|
+
}
|
|
546
|
+
interface AvalancheClient extends EthereumClient {
|
|
547
|
+
readonly avax: RpcNamespace<AvalancheAvaxSchema>;
|
|
548
|
+
readonly index: AvalancheIndexClient;
|
|
549
|
+
readonly info: RpcNamespace<AvalancheInfoSchema>;
|
|
550
|
+
readonly pChain: RpcNamespace<AvalanchePChainSchema>;
|
|
551
|
+
readonly proposerVm: RpcNamespace<AvalancheProposerVmSchema>;
|
|
552
|
+
readonly xChain: RpcNamespace<AvalancheXChainSchema>;
|
|
553
|
+
}
|
|
554
|
+
interface AvalancheIndexTransports {
|
|
555
|
+
readonly cChainBlocks: HttpJsonRpcTransport;
|
|
556
|
+
readonly pChainBlocks: HttpJsonRpcTransport;
|
|
557
|
+
readonly xChainBlocks: HttpJsonRpcTransport;
|
|
558
|
+
readonly xChainTransactions: HttpJsonRpcTransport;
|
|
559
|
+
}
|
|
560
|
+
|
|
373
561
|
type SolanaCommitment = 'confirmed' | 'finalized' | 'processed';
|
|
374
562
|
type SolanaEncoding = 'base58' | 'base64' | 'base64+zstd' | 'jsonParsed';
|
|
375
563
|
type SolanaConfig = Readonly<Record<string, unknown>>;
|
|
@@ -845,7 +1033,9 @@ interface ErpcSolanaClient extends SolanaClient {
|
|
|
845
1033
|
interface ErpcEthereumClient extends EthereumClient {
|
|
846
1034
|
readonly subscriptions: EthereumSubscriptions;
|
|
847
1035
|
}
|
|
848
|
-
|
|
1036
|
+
interface ErpcAvalancheClient extends AvalancheClient {
|
|
1037
|
+
readonly subscriptions: EthereumSubscriptions;
|
|
1038
|
+
}
|
|
849
1039
|
interface ErpcClient {
|
|
850
1040
|
readonly account: AccountClient;
|
|
851
1041
|
readonly avalanche: ErpcAvalancheClient;
|
|
@@ -922,4 +1112,4 @@ declare class ErpcBatchPolicyError extends ErpcError {
|
|
|
922
1112
|
constructor(message: string);
|
|
923
1113
|
}
|
|
924
1114
|
|
|
925
|
-
export { AccountClient, type AddressTransaction, type AddressTransactionPage, type AddressTransactionsOptions, type AddressTransfer, type AddressTransferPage, type AddressTransfersOptions, type AnalyticsTimeBound, type AssetBatchRequest, type AssetListRequest, type AssetRequest, type BinaryUpdate, CloudCatalogClient, type CloudCredit, type CloudCreditAlertLevel, CloudCreditClient, type CloudOffering, type CloudOfferingBilling, type CloudOfferingCompute, type CloudOfferingSolana, type CloudResource, type CloudResourceKind, type CloudResourceMode, type CloudResourceStatus, type CloudResourceStatusBilling, CloudResourcesClient, DEFAULT_ACCOUNT_ENDPOINT, DEFAULT_AVALANCHE_ENDPOINT, DEFAULT_ENDPOINT, DEFAULT_TIMEOUT_MS, DEFAULT_USER_ENDPOINT, ETHEREUM_RPC_METHODS, ETHEREUM_SUBSCRIPTION_METHODS, type EpochSummary, ErpcAbortedError, type ErpcAvalancheClient, ErpcBatchPolicyError, type ErpcClient, type ErpcClientConfig, type ErpcCloudClient, type ErpcCloudClientConfig, type ErpcCloudRequestOptions, ErpcConfigError, ErpcError, type ErpcErrorCode, type ErpcEthereumClient, ErpcHttpError, ErpcInvalidResponseError, ErpcJsonRpcError, type ErpcPlan, type ErpcSolanaClient, ErpcTimeoutError, ErpcTransportError, type EthereumAddress, type EthereumBlockTag, type EthereumClient, type EthereumFilter, type EthereumObject, type EthereumRpcSchema, type EthereumSubscriptionSchema, EthereumSubscriptions, type EthereumTransactionRequest, type Hex, type IndexedAsset, type IndexedAssetList, type IndexedAssetProof, type JsonObject, type JsonPrimitive, type JsonRpcErrorObject, type JsonRpcFailure, type JsonRpcId, type JsonRpcParams, type JsonRpcRequest, type JsonRpcResponse, type JsonRpcSuccess, type JsonRpcTransport, type JsonValue, type LeaderSlot, type LeaderSlotsResult, type MonthlyApiKeyChainUsage, type MonthlyApiKeyMethodUsage, type MonthlyApiKeyUsage, type MonthlyApiKeyUsageEntry, type MonthlyApiKeyUsageParams, type NumericFilter, type ParsedPriceUpdate, PendingRpcBatchRequest, PendingRpcRequest, type PingMeasurement, type PriceAssetType, PriceClient, type PriceEncoding, type PriceFeedMetadata, type PricePoint, type PriceStreamEvent, type PriceStreamOptions, type PriceUpdateOptions, type PriceUpdateResponse, type PriorityFeeEstimate, type ProgramStatsBucket, type ProgramStatsOptions, type PublisherStakeCap, type PublisherStakeCapsResponse, type RpcBatchCall, type RpcMethodSpec, type RpcNamespace, type RpcNamespaceBase, type RpcNotification, type RpcNotificationListener, type RpcParams, type RpcResult, type RpcSendOptions, RpcSubscription, SOLANA_ANALYTICS_METHODS, SOLANA_DAS_METHODS, SOLANA_ENHANCED_SUBSCRIPTION_METHODS, SOLANA_HISTORY_METHODS, SOLANA_LEADER_METHODS, SOLANA_RPC_METHODS, type SlotStatsOptions, type SlotStatsRow, type SolanaAnalyticsSchema, type SolanaClient, type SolanaCommitment, type SolanaConfig, type SolanaContext, type SolanaContextResult, type SolanaDasSchema, type SolanaEncoding, type SolanaEnhancedSubscriptionSchema, type SolanaHistorySchema, type SolanaLeaderSchema, type SolanaRpcSchema, SolanaSubscriptions, type SubscriptionId, type SubscriptionListener, type TokenBalance, type TopProgramRow, type TopProgramsOptions, type TpsBucket, type TpsTimeseriesOptions, UsageClient, type ValidatorInformation, type ValidatorsInformationOptions, type ValidatorsInformationResult, createErpcClient, createErpcCloudClient };
|
|
1115
|
+
export { AVALANCHE_AVAX_METHODS, AVALANCHE_INDEX_METHODS, AVALANCHE_INFO_METHODS, AVALANCHE_PROPOSER_VM_METHODS, AVALANCHE_P_CHAIN_METHODS, AVALANCHE_X_CHAIN_METHODS, AccountClient, type AddressTransaction, type AddressTransactionPage, type AddressTransactionsOptions, type AddressTransfer, type AddressTransferPage, type AddressTransfersOptions, type AnalyticsTimeBound, type AssetBatchRequest, type AssetListRequest, type AssetRequest, type AvalancheAvaxSchema, type AvalancheClient, type AvalancheEncodingParams, type AvalancheIndexClient, type AvalancheIndexSchema, type AvalancheIndexTransports, type AvalancheInfoSchema, type AvalanchePChainSchema, type AvalancheProposerVmSchema, type AvalancheUtxoParams, type AvalancheXChainSchema, type BinaryUpdate, CloudCatalogClient, type CloudCredit, type CloudCreditAlertLevel, CloudCreditClient, type CloudOffering, type CloudOfferingBilling, type CloudOfferingCompute, type CloudOfferingSolana, type CloudResource, type CloudResourceKind, type CloudResourceMode, type CloudResourceStatus, type CloudResourceStatusBilling, CloudResourcesClient, DEFAULT_ACCOUNT_ENDPOINT, DEFAULT_AVALANCHE_ENDPOINT, DEFAULT_ENDPOINT, DEFAULT_TIMEOUT_MS, DEFAULT_USER_ENDPOINT, ETHEREUM_RPC_METHODS, ETHEREUM_SUBSCRIPTION_METHODS, type EpochSummary, ErpcAbortedError, type ErpcAvalancheClient, ErpcBatchPolicyError, type ErpcClient, type ErpcClientConfig, type ErpcCloudClient, type ErpcCloudClientConfig, type ErpcCloudRequestOptions, ErpcConfigError, ErpcError, type ErpcErrorCode, type ErpcEthereumClient, ErpcHttpError, ErpcInvalidResponseError, ErpcJsonRpcError, type ErpcPlan, type ErpcSolanaClient, ErpcTimeoutError, ErpcTransportError, type EthereumAddress, type EthereumBlockTag, type EthereumClient, type EthereumFilter, type EthereumObject, type EthereumRpcSchema, type EthereumSubscriptionSchema, EthereumSubscriptions, type EthereumTransactionRequest, type Hex, type IndexedAsset, type IndexedAssetList, type IndexedAssetProof, type JsonObject, type JsonPrimitive, type JsonRpcErrorObject, type JsonRpcFailure, type JsonRpcId, type JsonRpcParams, type JsonRpcRequest, type JsonRpcResponse, type JsonRpcSuccess, type JsonRpcTransport, type JsonValue, type LeaderSlot, type LeaderSlotsResult, type MonthlyApiKeyChainUsage, type MonthlyApiKeyMethodUsage, type MonthlyApiKeyUsage, type MonthlyApiKeyUsageEntry, type MonthlyApiKeyUsageParams, type NumericFilter, type ParsedPriceUpdate, PendingRpcBatchRequest, PendingRpcRequest, type PingMeasurement, type PriceAssetType, PriceClient, type PriceEncoding, type PriceFeedMetadata, type PricePoint, type PriceStreamEvent, type PriceStreamOptions, type PriceUpdateOptions, type PriceUpdateResponse, type PriorityFeeEstimate, type ProgramStatsBucket, type ProgramStatsOptions, type PublisherStakeCap, type PublisherStakeCapsResponse, type RpcBatchCall, type RpcMethodSpec, type RpcNamespace, type RpcNamespaceBase, type RpcNotification, type RpcNotificationListener, type RpcParams, type RpcResult, type RpcSendOptions, RpcSubscription, SOLANA_ANALYTICS_METHODS, SOLANA_DAS_METHODS, SOLANA_ENHANCED_SUBSCRIPTION_METHODS, SOLANA_HISTORY_METHODS, SOLANA_LEADER_METHODS, SOLANA_RPC_METHODS, type SlotStatsOptions, type SlotStatsRow, type SolanaAnalyticsSchema, type SolanaClient, type SolanaCommitment, type SolanaConfig, type SolanaContext, type SolanaContextResult, type SolanaDasSchema, type SolanaEncoding, type SolanaEnhancedSubscriptionSchema, type SolanaHistorySchema, type SolanaLeaderSchema, type SolanaRpcSchema, SolanaSubscriptions, type SubscriptionId, type SubscriptionListener, type TokenBalance, type TopProgramRow, type TopProgramsOptions, type TpsBucket, type TpsTimeseriesOptions, UsageClient, type ValidatorInformation, type ValidatorsInformationOptions, type ValidatorsInformationResult, createErpcClient, createErpcCloudClient };
|
package/dist/index.js
CHANGED
|
@@ -539,10 +539,14 @@ var methodParams = (mode, args) => {
|
|
|
539
539
|
return args[0];
|
|
540
540
|
};
|
|
541
541
|
var createRpcNamespace = (config) => {
|
|
542
|
+
const wireMethod = (method) => config.methodPrefix === void 0 ? method : `${config.methodPrefix}.${method}`;
|
|
542
543
|
const base = {
|
|
543
544
|
endpoint: config.transport.endpoint,
|
|
544
545
|
batch: (calls) => {
|
|
545
|
-
const wireCalls = calls
|
|
546
|
+
const wireCalls = calls.map((call) => ({
|
|
547
|
+
...call,
|
|
548
|
+
method: wireMethod(call.method)
|
|
549
|
+
}));
|
|
546
550
|
config.validateBatch?.(wireCalls);
|
|
547
551
|
return new PendingRpcBatchRequest(
|
|
548
552
|
(options) => config.transport.batch(
|
|
@@ -556,7 +560,7 @@ var createRpcNamespace = (config) => {
|
|
|
556
560
|
),
|
|
557
561
|
request: (method, ...params) => new PendingRpcRequest(
|
|
558
562
|
(options) => config.transport.request(
|
|
559
|
-
method,
|
|
563
|
+
wireMethod(method),
|
|
560
564
|
params[0],
|
|
561
565
|
options
|
|
562
566
|
)
|
|
@@ -570,7 +574,7 @@ var createRpcNamespace = (config) => {
|
|
|
570
574
|
if (property === "then") return void 0;
|
|
571
575
|
return (...args) => new PendingRpcRequest(
|
|
572
576
|
(options) => config.transport.request(
|
|
573
|
-
property,
|
|
577
|
+
wireMethod(property),
|
|
574
578
|
methodParams(config.parameterMode, args),
|
|
575
579
|
options
|
|
576
580
|
)
|
|
@@ -646,6 +650,110 @@ var createEthereumClient = (transport) => ({
|
|
|
646
650
|
})
|
|
647
651
|
});
|
|
648
652
|
|
|
653
|
+
// src/rpc/avalanche.ts
|
|
654
|
+
var AVALANCHE_AVAX_METHODS = [
|
|
655
|
+
"avax.getAtomicTx",
|
|
656
|
+
"avax.getAtomicTxStatus",
|
|
657
|
+
"avax.getUTXOs",
|
|
658
|
+
"avax.issueTx"
|
|
659
|
+
];
|
|
660
|
+
var AVALANCHE_X_CHAIN_METHODS = [
|
|
661
|
+
"avm.buildGenesis",
|
|
662
|
+
"avm.getAllBalances",
|
|
663
|
+
"avm.getAssetDescription",
|
|
664
|
+
"avm.getBalance",
|
|
665
|
+
"avm.getBlockByHeight",
|
|
666
|
+
"avm.getHeight",
|
|
667
|
+
"avm.getTx",
|
|
668
|
+
"avm.getTxFee",
|
|
669
|
+
"avm.getTxStatus",
|
|
670
|
+
"avm.getUTXOs",
|
|
671
|
+
"avm.issueTx"
|
|
672
|
+
];
|
|
673
|
+
var AVALANCHE_P_CHAIN_METHODS = [
|
|
674
|
+
"platform.getAllValidatorsAt",
|
|
675
|
+
"platform.getBalance",
|
|
676
|
+
"platform.getBlockchainStatus",
|
|
677
|
+
"platform.getBlockchains",
|
|
678
|
+
"platform.getCurrentSupply",
|
|
679
|
+
"platform.getCurrentValidators",
|
|
680
|
+
"platform.getFeeConfig",
|
|
681
|
+
"platform.getFeeState",
|
|
682
|
+
"platform.getHeight",
|
|
683
|
+
"platform.getMinStake",
|
|
684
|
+
"platform.getRewardUTXOs",
|
|
685
|
+
"platform.getStake",
|
|
686
|
+
"platform.getStakingAssetID",
|
|
687
|
+
"platform.getSubnets",
|
|
688
|
+
"platform.getTimestamp",
|
|
689
|
+
"platform.getTotalStake",
|
|
690
|
+
"platform.getTx",
|
|
691
|
+
"platform.getTxStatus",
|
|
692
|
+
"platform.getUTXOs",
|
|
693
|
+
"platform.getValidatorFeeConfig",
|
|
694
|
+
"platform.getValidatorFeeState",
|
|
695
|
+
"platform.getValidatorsAt",
|
|
696
|
+
"platform.issueTx",
|
|
697
|
+
"platform.sampleValidators",
|
|
698
|
+
"platform.validatedBy",
|
|
699
|
+
"platform.validates"
|
|
700
|
+
];
|
|
701
|
+
var AVALANCHE_PROPOSER_VM_METHODS = [
|
|
702
|
+
"proposervm.getCurrentEpoch",
|
|
703
|
+
"proposervm.getProposedHeight"
|
|
704
|
+
];
|
|
705
|
+
var AVALANCHE_INFO_METHODS = ["info.upgrades"];
|
|
706
|
+
var AVALANCHE_INDEX_METHODS = [
|
|
707
|
+
"index.getContainerByID",
|
|
708
|
+
"index.getContainerByIndex",
|
|
709
|
+
"index.getContainerRange",
|
|
710
|
+
"index.getIndex",
|
|
711
|
+
"index.getLastAccepted",
|
|
712
|
+
"index.isAccepted"
|
|
713
|
+
];
|
|
714
|
+
var rejectNativeBatch = (calls) => {
|
|
715
|
+
if (calls.length > 0) {
|
|
716
|
+
throw new ErpcBatchPolicyError(
|
|
717
|
+
"Avalanche native RPC methods do not support batching"
|
|
718
|
+
);
|
|
719
|
+
}
|
|
720
|
+
};
|
|
721
|
+
var nativeNamespace = (transport, methodPrefix) => createRpcNamespace({
|
|
722
|
+
methodPrefix,
|
|
723
|
+
parameterMode: "named",
|
|
724
|
+
transport,
|
|
725
|
+
validateBatch: rejectNativeBatch
|
|
726
|
+
});
|
|
727
|
+
var createAvalancheClient = (transport, indexTransports) => ({
|
|
728
|
+
...createEthereumClient(transport),
|
|
729
|
+
avax: nativeNamespace(transport, "avax"),
|
|
730
|
+
xChain: nativeNamespace(transport, "avm"),
|
|
731
|
+
pChain: nativeNamespace(transport, "platform"),
|
|
732
|
+
proposerVm: nativeNamespace(
|
|
733
|
+
transport,
|
|
734
|
+
"proposervm"
|
|
735
|
+
),
|
|
736
|
+
info: nativeNamespace(transport, "info"),
|
|
737
|
+
index: {
|
|
738
|
+
cChainBlocks: nativeNamespace(
|
|
739
|
+
indexTransports.cChainBlocks,
|
|
740
|
+
"index"
|
|
741
|
+
),
|
|
742
|
+
pChainBlocks: nativeNamespace(
|
|
743
|
+
indexTransports.pChainBlocks,
|
|
744
|
+
"index"
|
|
745
|
+
),
|
|
746
|
+
xChainBlocks: nativeNamespace(
|
|
747
|
+
indexTransports.xChainBlocks,
|
|
748
|
+
"index"
|
|
749
|
+
),
|
|
750
|
+
xChainTransactions: nativeNamespace(
|
|
751
|
+
indexTransports.xChainTransactions,
|
|
752
|
+
"index"
|
|
753
|
+
)
|
|
754
|
+
}
|
|
755
|
+
});
|
|
756
|
+
|
|
649
757
|
// src/rpc/solana.ts
|
|
650
758
|
var SOLANA_RPC_METHODS = [
|
|
651
759
|
"getAccountInfo",
|
|
@@ -1408,6 +1516,10 @@ var createErpcClient = (config) => {
|
|
|
1408
1516
|
...sharedTransport,
|
|
1409
1517
|
endpoint: endpointWithPath(resolved.avalancheEndpoint, "/ava")
|
|
1410
1518
|
});
|
|
1519
|
+
const avalancheIndexTransport = (path) => new HttpJsonRpcTransport({
|
|
1520
|
+
...sharedTransport,
|
|
1521
|
+
endpoint: endpointWithPath(resolved.avalancheEndpoint, path)
|
|
1522
|
+
});
|
|
1411
1523
|
const solanaWebSocket = new WebSocketJsonRpcTransport({
|
|
1412
1524
|
endpoint: websocketUrl(resolved.endpoint, resolved.apiKey),
|
|
1413
1525
|
timeoutMs: resolved.timeoutMs,
|
|
@@ -1448,7 +1560,12 @@ var createErpcClient = (config) => {
|
|
|
1448
1560
|
subscriptions: new EthereumSubscriptions(ethereumWebSocket)
|
|
1449
1561
|
};
|
|
1450
1562
|
const avalanche = {
|
|
1451
|
-
...
|
|
1563
|
+
...createAvalancheClient(avalancheTransport, {
|
|
1564
|
+
cChainBlocks: avalancheIndexTransport("/ava/ext/index/C/block"),
|
|
1565
|
+
pChainBlocks: avalancheIndexTransport("/ava/ext/index/P/block"),
|
|
1566
|
+
xChainBlocks: avalancheIndexTransport("/ava/ext/index/X/block"),
|
|
1567
|
+
xChainTransactions: avalancheIndexTransport("/ava/ext/index/X/tx")
|
|
1568
|
+
}),
|
|
1452
1569
|
subscriptions: new EthereumSubscriptions(avalancheWebSocket)
|
|
1453
1570
|
};
|
|
1454
1571
|
return {
|
|
@@ -1682,6 +1799,6 @@ var createErpcCloudClient = (config) => {
|
|
|
1682
1799
|
};
|
|
1683
1800
|
};
|
|
1684
1801
|
|
|
1685
|
-
export { AccountClient, CloudCatalogClient, CloudCreditClient, CloudResourcesClient, DEFAULT_ACCOUNT_ENDPOINT, DEFAULT_AVALANCHE_ENDPOINT, DEFAULT_ENDPOINT, DEFAULT_TIMEOUT_MS, DEFAULT_USER_ENDPOINT, ETHEREUM_RPC_METHODS, ETHEREUM_SUBSCRIPTION_METHODS, ErpcAbortedError, ErpcBatchPolicyError, ErpcConfigError, ErpcError, ErpcHttpError, ErpcInvalidResponseError, ErpcJsonRpcError, ErpcTimeoutError, ErpcTransportError, EthereumSubscriptions, PendingRpcBatchRequest, PendingRpcRequest, PriceClient, RpcSubscription, SOLANA_ANALYTICS_METHODS, SOLANA_DAS_METHODS, SOLANA_ENHANCED_SUBSCRIPTION_METHODS, SOLANA_HISTORY_METHODS, SOLANA_LEADER_METHODS, SOLANA_RPC_METHODS, SolanaSubscriptions, UsageClient, createErpcClient, createErpcCloudClient };
|
|
1802
|
+
export { AVALANCHE_AVAX_METHODS, AVALANCHE_INDEX_METHODS, AVALANCHE_INFO_METHODS, AVALANCHE_PROPOSER_VM_METHODS, AVALANCHE_P_CHAIN_METHODS, AVALANCHE_X_CHAIN_METHODS, AccountClient, CloudCatalogClient, CloudCreditClient, CloudResourcesClient, DEFAULT_ACCOUNT_ENDPOINT, DEFAULT_AVALANCHE_ENDPOINT, DEFAULT_ENDPOINT, DEFAULT_TIMEOUT_MS, DEFAULT_USER_ENDPOINT, ETHEREUM_RPC_METHODS, ETHEREUM_SUBSCRIPTION_METHODS, ErpcAbortedError, ErpcBatchPolicyError, ErpcConfigError, ErpcError, ErpcHttpError, ErpcInvalidResponseError, ErpcJsonRpcError, ErpcTimeoutError, ErpcTransportError, EthereumSubscriptions, PendingRpcBatchRequest, PendingRpcRequest, PriceClient, RpcSubscription, SOLANA_ANALYTICS_METHODS, SOLANA_DAS_METHODS, SOLANA_ENHANCED_SUBSCRIPTION_METHODS, SOLANA_HISTORY_METHODS, SOLANA_LEADER_METHODS, SOLANA_RPC_METHODS, SolanaSubscriptions, UsageClient, createErpcClient, createErpcCloudClient };
|
|
1686
1803
|
//# sourceMappingURL=index.js.map
|
|
1687
1804
|
//# sourceMappingURL=index.js.map
|