publicrpc.proto 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. syntax = "proto3";
  2. package publicrpc.v1;
  3. option go_package = "github.com/certusone/wormhole/node/pkg/proto/publicrpc/v1;publicrpcv1";
  4. import "gossip/v1/gossip.proto";
  5. import "google/api/annotations.proto";
  6. enum ChainID {
  7. CHAIN_ID_UNSPECIFIED = 0;
  8. CHAIN_ID_SOLANA = 1;
  9. CHAIN_ID_ETHEREUM = 2;
  10. CHAIN_ID_TERRA = 3;
  11. CHAIN_ID_BSC = 4;
  12. CHAIN_ID_POLYGON = 5;
  13. CHAIN_ID_AVALANCHE = 6;
  14. CHAIN_ID_OASIS = 7;
  15. CHAIN_ID_ALGORAND = 8;
  16. CHAIN_ID_AURORA = 9;
  17. CHAIN_ID_FANTOM = 10;
  18. CHAIN_ID_KARURA = 11;
  19. CHAIN_ID_ACALA = 12;
  20. CHAIN_ID_KLAYTN = 13;
  21. CHAIN_ID_CELO = 14;
  22. CHAIN_ID_NEAR = 15;
  23. CHAIN_ID_MOONBEAM = 16;
  24. CHAIN_ID_NEON = 17;
  25. CHAIN_ID_TERRA2 = 18;
  26. CHAIN_ID_INJECTIVE = 19;
  27. CHAIN_ID_OSMOSIS = 20;
  28. CHAIN_ID_SUI = 21;
  29. CHAIN_ID_APTOS = 22;
  30. CHAIN_ID_ARBITRUM = 23;
  31. CHAIN_ID_OPTIMISM = 24;
  32. CHAIN_ID_GNOSIS = 25;
  33. CHAIN_ID_PYTHNET = 26;
  34. // Special case - Eth has two testnets. CHAIN_ID_ETHEREUM is Goerli,
  35. // but we also want to connect to Ropsten, so we add a separate chain.
  36. CHAIN_ID_ETHEREUM_ROPSTEN = 10001;
  37. }
  38. // MessageID is a VAA's globally unique identifier (see data availability design document).
  39. message MessageID {
  40. // Emitter chain ID.
  41. ChainID emitter_chain = 1;
  42. // Hex-encoded (without leading 0x) emitter address.
  43. string emitter_address = 2;
  44. // Sequence number for (emitter_chain, emitter_address).
  45. uint64 sequence = 3;
  46. }
  47. // PublicRPCService service exposes endpoints to be consumed externally; GUIs, historical record keeping, etc.
  48. service PublicRPCService {
  49. // GetLastHeartbeats returns the last heartbeat received for each guardian node in the
  50. // node's active guardian set. Heartbeats received by nodes not in the guardian set are ignored.
  51. // The heartbeat value is null if no heartbeat has yet been received.
  52. rpc GetLastHeartbeats (GetLastHeartbeatsRequest) returns (GetLastHeartbeatsResponse) {
  53. option (google.api.http) = {
  54. get: "/v1/heartbeats"
  55. };
  56. }
  57. rpc GetSignedVAA (GetSignedVAARequest) returns (GetSignedVAAResponse) {
  58. option (google.api.http) = {
  59. get: "/v1/signed_vaa/{message_id.emitter_chain}/{message_id.emitter_address}/{message_id.sequence}"
  60. };
  61. }
  62. rpc GetCurrentGuardianSet (GetCurrentGuardianSetRequest) returns (GetCurrentGuardianSetResponse) {
  63. option (google.api.http) = {
  64. get: "/v1/guardianset/current"
  65. };
  66. }
  67. rpc GovernorGetAvailableNotionalByChain (GovernorGetAvailableNotionalByChainRequest) returns (GovernorGetAvailableNotionalByChainResponse) {
  68. option (google.api.http) = {
  69. get: "/v1/governor/available_notional_by_chain"
  70. };
  71. }
  72. rpc GovernorGetEnqueuedVAAs (GovernorGetEnqueuedVAAsRequest) returns (GovernorGetEnqueuedVAAsResponse) {
  73. option (google.api.http) = {
  74. get: "/v1/governor/enqueued_vaas"
  75. };
  76. }
  77. rpc GovernorIsVAAEnqueued (GovernorIsVAAEnqueuedRequest) returns (GovernorIsVAAEnqueuedResponse) {
  78. option (google.api.http) = {
  79. get: "/v1/governor/is_vaa_enqueued/{message_id.emitter_chain}/{message_id.emitter_address}/{message_id.sequence}"
  80. };
  81. }
  82. rpc GovernorGetTokenList (GovernorGetTokenListRequest) returns (GovernorGetTokenListResponse) {
  83. option (google.api.http) = {
  84. get: "/v1/governor/token_list"
  85. };
  86. }
  87. }
  88. message GetSignedVAARequest {
  89. MessageID message_id = 1;
  90. }
  91. message GetSignedVAAResponse {
  92. bytes vaa_bytes = 1;
  93. }
  94. message GetLastHeartbeatsRequest {
  95. }
  96. message GetLastHeartbeatsResponse {
  97. message Entry {
  98. // Verified, hex-encoded (with leading 0x) guardian address. This is the guardian address
  99. // which signed this heartbeat. The GuardianAddr field inside the heartbeat
  100. // is NOT verified - remote nodes can put arbitrary data in it.
  101. string verified_guardian_addr = 1;
  102. // Base58-encoded libp2p node address that sent this heartbeat, used to
  103. // distinguish between multiple nodes running for the same guardian.
  104. string p2p_node_addr = 2;
  105. // Raw heartbeat received from the network. Data is only as trusted
  106. // as the guardian node that sent it - none of the fields are verified.
  107. gossip.v1.Heartbeat raw_heartbeat = 3;
  108. }
  109. repeated Entry entries = 1;
  110. }
  111. message GetCurrentGuardianSetRequest {
  112. }
  113. message GetCurrentGuardianSetResponse {
  114. GuardianSet guardian_set = 1;
  115. }
  116. message GuardianSet {
  117. // Guardian set index
  118. uint32 index = 1;
  119. // List of guardian addresses as human-readable hex-encoded (leading 0x) addresses.
  120. repeated string addresses = 2;
  121. }
  122. message GovernorGetAvailableNotionalByChainRequest {
  123. }
  124. message GovernorGetAvailableNotionalByChainResponse {
  125. message Entry {
  126. uint32 chain_id = 1;
  127. uint64 remaining_available_notional = 2;
  128. uint64 notional_limit = 3;
  129. }
  130. // There is an entry for each chain that is being governed.
  131. // Chains that are not being governed are not listed, and assumed to be unlimited.
  132. repeated Entry entries = 1;
  133. }
  134. message GovernorGetEnqueuedVAAsRequest {
  135. }
  136. message GovernorGetEnqueuedVAAsResponse {
  137. message Entry {
  138. uint32 emitter_chain = 1;
  139. string emitter_address = 2; // human-readable hex-encoded (leading 0x)
  140. uint64 sequence = 3;
  141. }
  142. // There is an entry for each enqueued vaa.
  143. repeated Entry entries = 1;
  144. }
  145. message GovernorIsVAAEnqueuedRequest {
  146. MessageID message_id = 1;
  147. }
  148. message GovernorIsVAAEnqueuedResponse {
  149. bool is_enqueued = 1;
  150. }
  151. message GovernorGetTokenListRequest {
  152. }
  153. message GovernorGetTokenListResponse {
  154. message Entry {
  155. uint32 origin_chain_id = 1;
  156. string origin_address = 2; // human-readable hex-encoded (leading 0x)
  157. float price = 3;
  158. }
  159. // There is an entry for each token that applies to the notional TVL calcuation.
  160. repeated Entry entries = 1;
  161. }