fragment TransactionEventFields on TransactionResult {
  partyId
  hash
  status
  error
}

subscription TransactionEvent($partyId: ID!) {
  busEvents(partyId: $partyId, batchSize: 0, types: [TransactionResult]) {
    type
    event {
      ... on TransactionResult {
        ...TransactionEventFields
      }
    }
  }
}

fragment WithdrawalBusEventFields on Withdrawal {
  id
  status
  amount
  asset {
    id
    name
    symbol
    decimals
    status
    source {
      ... on ERC20 {
        contractAddress
      }
    }
  }
  createdTimestamp
  withdrawnTimestamp
  txHash
  details {
    ... on Erc20WithdrawalDetails {
      receiverAddress
    }
  }
  pendingOnForeignChain @client
}

subscription WithdrawalBusEvent($partyId: ID!) {
  busEvents(partyId: $partyId, batchSize: 0, types: [Withdrawal]) {
    event {
      ... on Withdrawal {
        ...WithdrawalBusEventFields
      }
    }
  }
}

fragment OrderTxUpdateFields on OrderUpdate {
  type
  id
  status
  rejectionReason
  createdAt
  size
  price
  timeInForce
  expiresAt
  side
  marketId
}

subscription OrderTxUpdate($partyId: ID!) {
  orders(partyId: $partyId) {
    ...OrderTxUpdateFields
  }
}

fragment DepositBusEventFields on Deposit {
  id
  status
  amount
  asset {
    id
    symbol
    decimals
  }
  createdTimestamp
  creditedTimestamp
  txHash
}

subscription DepositBusEvent($partyId: ID!) {
  busEvents(partyId: $partyId, batchSize: 0, types: [Deposit]) {
    event {
      ... on Deposit {
        ...DepositBusEventFields
      }
    }
  }
}
