Skip to content

Commit

Permalink
Update IDL file
Browse files Browse the repository at this point in the history
  • Loading branch information
mertwole committed Dec 27, 2024
1 parent 62b0706 commit 9adfeea
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions api/gear/historical_proxy.idl
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
/// Errors returned by the Historical Proxy service.
type ProxyError = enum {
/// Endpoint for requested slot not found.
NoEndpointForSlot: u64,
/// Failed to send message.
SendFailure: str,
ReplyTimeout: str,
/// Failed to receive reply.
ReplyFailure: str,
/// Failed to decode reply.
DecodeFailure: str,
NotAdmin,
/// `ethereum-event-client` returned error.
EthereumEventClient: Error,
};

Expand All @@ -29,28 +33,37 @@ constructor {
};

service HistoricalProxy {
AddEndpoint : (slot: u64, endpoint: actor_id) -> result (null, ProxyError);
EndpointFor : (slot: u64) -> result (actor_id, ProxyError);
/// Redirect message to ERC20 Relay service which is valid for `slot`.
/// If message is relayed successfully then reply from relay service is sent to
/// `client` address and proofs are returned.
/// Add new endpoint to the map. Endpoint will be effective for all the
/// requests with slots starting from `slot`.
///
/// This function can be called only by an admin.
AddEndpoint : (slot: u64, endpoint: actor_id) -> null;
/// Redirect message to `ethereum-event-client` program which is valid for `slot`.
/// If message is relayed successfully then reply is sent to `client` address
/// to `client_route` route.
///
/// # Parameters
///
/// - `slot`: slot for which message is relayed.
/// - `tx_index`: transaction index for message.
/// - `proofs`: SCALE encoded `EthToVaraEvent`.
/// - `client`: client address to send receipt to on success.
/// - `client_route`: route to send receipt to on success.
///
/// # Returns
///
/// - `(Vec<u8>, Vec<u8>)`: on success where first vector is receipt and second vector is reply from calling `client_route`.
/// - `ProxyError`: if redirect failed
///
Redirect : (slot: u64, proofs: vec u8, client: actor_id, client_route: vec u8) -> result (struct { vec u8, vec u8 }, ProxyError);
/// Get current service admin.
query Admin : () -> actor_id;
/// Get endpoint for the specified `slot`.
query EndpointFor : (slot: u64) -> result (actor_id, ProxyError);
/// Get endpoint map stored in this service.
query Endpoints : () -> vec struct { u64, actor_id };

events {
/// Tx receipt is checked to be valid and successfully sent to the
/// underlying program.
Relayed: struct { slot: u64, block_number: u64, transaction_index: u32 };
}
};
Expand Down

0 comments on commit 9adfeea

Please sign in to comment.