import { Marshalled , PackPrimitive , PackTypeDefinition , TxStatus , TypedPackValue , } from "@renproject/utils" ; import { ParamsQueryBlockState , ResponseQueryBlockState , } from "./ren_queryBlockState" ; export * from "./ren_queryBlockState" ; export enum RPCMethod { SubmitGateway = "ren_submitGateway" , SubmitTx = "ren_submitTx" , QueryTx = "ren_queryTx" , QueryTxs = "ren_queryTxs" , QueryBlock = "ren_queryBlock" , QueryBlocks = "ren_queryBlocks" , QueryConfig = "ren_queryConfig" , QueryBlockState = "ren_queryBlockState" } export interface TransactionInput < Input extends TypedPackValue = TypedPackValue > { hash : string ; version : string ; selector : string ; in : Input ; } export interface TransactionOutput < Input extends TypedPackValue , Output extends TypedPackValue > extends TransactionInput < Input > { out : Output ; } export interface RPCValue < Types extends PackTypeDefinition , Values > { t : Types ; v : Values ; } export type EmptyRPCStruct = RPCValue < { struct : [ ] ; } , { } > ; export const burnParamsType = { struct : [ { amount : PackPrimitive . U256 , } , { to : PackPrimitive . Str , } , { nonce : PackPrimitive . Bytes32 , } , ] , } ; export const crossChainParamsType = { struct : [ { txid : PackPrimitive . Bytes , } , { txindex : PackPrimitive . U32 , } , { amount : PackPrimitive . U256 , } , { payload : PackPrimitive . Bytes , } , { phash : PackPrimitive . Bytes32 , } , { to : PackPrimitive . Str , } , { nonce : PackPrimitive . Bytes32 , } , { nhash : PackPrimitive . Bytes32 , } , { gpubkey : PackPrimitive . Bytes , } , { ghash : PackPrimitive . Bytes32 , } , ] , } ; export type CrossChainParams = RPCValue < typeof crossChainParamsType , { amount : Marshalled < PackPrimitive . U256 > ; ghash : Marshalled < PackPrimitive . Bytes32 > ; gpubkey : Marshalled < PackPrimitive . Bytes > ; nhash : Marshalled < PackPrimitive . Bytes32 > ; nonce : Marshalled < PackPrimitive . Bytes32 > ; payload : Marshalled < PackPrimitive . Bytes > ; phash : Marshalled < PackPrimitive . Bytes32 > ; to : Marshalled < PackPrimitive . Str > ; txid : Marshalled < PackPrimitive . Bytes > ; txindex : Marshalled < PackPrimitive . U32 > ; } > ; export const submitGatewayType = { struct : [ { payload : PackPrimitive . Bytes , } , { phash : PackPrimitive . Bytes32 , } , { to : PackPrimitive . Str , } , { nonce : PackPrimitive . Bytes32 , } , { nhash : PackPrimitive . Bytes32 , } , { gpubkey : PackPrimitive . Bytes , } , { ghash : PackPrimitive . Bytes32 , } , ] , } ; export type SubmitGateway = RPCValue < typeof submitGatewayType , { amount : Marshalled < PackPrimitive . U256 > ; ghash : Marshalled < PackPrimitive . Bytes32 > ; gpubkey : Marshalled < PackPrimitive . Bytes > ; nhash : Marshalled < PackPrimitive . Bytes32 > ; nonce : Marshalled < PackPrimitive . Bytes32 > ; payload : Marshalled < PackPrimitive . Bytes > ; phash : Marshalled < PackPrimitive . Bytes32 > ; to : Marshalled < PackPrimitive . Str > ; txid : Marshalled < PackPrimitive . Bytes > ; txindex : Marshalled < PackPrimitive . U32 > ; } > ; export interface SubmitGatewayInput { version : string ; selector : string ; in : SubmitGateway ; } export interface ParamsQueryTxs { txStatus ? : TxStatus ; page : Marshalled < PackPrimitive . U64 > ; pageSize ? : Marshalled < PackPrimitive . U64 > ; tags : Array < Marshalled < PackPrimitive . Bytes32 > > ; } export type ParamsSubmitGateway = { gateway : string ; tx : SubmitGatewayInput ; } ; export interface ParamsSubmitTx < T extends TransactionInput = TransactionInput > { tx : T ; } export interface ParamsQueryTx { txHash : string ; } export interface ParamsQueryBlock { blockHeight : number ; } export interface ParamsQueryBlocks { blockHeight : number ; n : number ; } export interface ParamsQueryConfig { } export interface ResponseSubmitTx { } export interface ResponseSubmitTx { tx : { hash : string ; to : string ; in : TypedPackValue ; } ; } export interface ResponseSubmitGateway { } export interface ResponseQueryTx < Input extends TypedPackValue = TypedPackValue , Output extends TypedPackValue = TypedPackValue > { tx : { version : "0" | "1" ; hash : string ; selector : string ; in : Input ; out : Output ; } ; txStatus : TxStatus ; } export interface ResponseQueryTxs { txs : Array < ResponseQueryTx [ "tx" ] > ; } export interface ResponseQueryBlock { block : any ; } export interface ResponseQueryBlocks { blocks : any ; } export interface ResponseQueryConfig { confirmations : { [ chain ] : Marshalled < PackPrimitive . U64 > ; } ; maxConfirmations : { [ chain ] : Marshalled < PackPrimitive . U64 > ; } ; network : string ; registries : { [ chain ] : string ; } ; whitelist : string [ ] ; } export type RPCParams = { [ RPCMethod . SubmitTx ] : ParamsSubmitTx ; [ RPCMethod . SubmitGateway ] : ParamsSubmitGateway ; [ RPCMethod . QueryTx ] : ParamsQueryTx ; [ RPCMethod . QueryTxs ] : ParamsQueryTxs ; [ RPCMethod . QueryBlock ] : ParamsQueryBlock ; [ RPCMethod . QueryBlocks ] : ParamsQueryBlocks ; [ RPCMethod . QueryConfig ] : ParamsQueryConfig ; [ RPCMethod . QueryBlockState ] : ParamsQueryBlockState ; } ; export type RPCResponses = { [ RPCMethod . SubmitTx ] : ResponseSubmitTx ; [ RPCMethod . SubmitGateway ] : ResponseSubmitGateway ; [ RPCMethod . QueryTx ] : ResponseQueryTx ; [ RPCMethod . QueryTxs ] : ResponseQueryTxs ; [ RPCMethod . QueryBlock ] : ResponseQueryBlock ; [ RPCMethod . QueryBlocks ] : ResponseQueryBlocks ; [ RPCMethod . QueryConfig ] : ResponseQueryConfig ; [ RPCMethod . QueryBlockState ] : ResponseQueryBlockState ; } ; ( ) : RPCParams [ RPCMethod ] | void => { } ; ( ) : RPCResponses [ RPCMethod ] | void => { } ;